elderwand 0.1.75 → 0.1.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Environment/environment.js +2 -2
- package/NoDuplicate/README.md +94 -46
- package/NoDuplicate/no-duplicate.js +43 -25
- package/NoDuplicate/package-lock.json +1420 -0
- package/NoDuplicate/package.json +22 -24
- package/NoDuplicate/tests/characterization.test.js +359 -0
- package/SoftDelete/mongoose-soft-delete.js +60 -8
- package/SoftDelete/package-lock.json +1391 -0
- package/SoftDelete/package.json +20 -22
- package/SoftDelete/tests/characterization.test.js +375 -0
- package/ToolBox/RequestTrackTools.js +0 -14
- package/ToolBox/Routes.js +148 -54
- package/ToolBox/package-lock.json +2533 -0
- package/ToolBox/package.json +23 -7
- package/ToolBox/tests/event-log.test.js +365 -0
- package/ToolBox/tests/helpers.js +241 -0
- package/ToolBox/tests/request-track-tools.test.js +197 -0
- package/ToolBox/tests/routes.test.js +313 -0
- package/package.json +39 -29
- package/threads/Workers/ControllerWorker.js +38 -58
- package/threads/Workers/DBWorker.js +21 -17
- package/threads/Workers/MongoClientWorker.js +36 -24
- package/threads/package-lock.json +2082 -27
- package/threads/package.json +21 -10
- package/threads/tests/CrashWorker.js +17 -0
- package/threads/tests/DuplicatePartialWorker.js +32 -0
- package/threads/tests/EchoWorker.js +13 -0
- package/threads/tests/LargePayloadWorker.js +39 -0
- package/threads/tests/MalformedPartialWorker.js +27 -0
- package/threads/tests/SlowWorker.js +17 -0
- package/threads/tests/StreamingPartialWorker.js +47 -0
- package/threads/tests/bug-reproducers.js +309 -0
- package/threads/tests/locked-interface.js +250 -0
- package/threads/tests/tests.js +529 -46
- package/threads/threads.js +438 -382
- package/utils/package-lock.json +1343 -0
- package/utils/package.json +14 -5
- package/utils/tests/coordination.test.js +247 -0
- package/utils/tests/crypto.test.js +81 -0
- package/utils/tests/helpers.js +111 -0
- package/utils/tests/http.test.js +324 -0
- package/utils/tests/pure.test.js +284 -0
- package/utils/tests/strings.test.js +112 -0
- package/utils/utils.js +37 -17
- package/.idea/.name +0 -1
- package/.idea/encodings.xml +0 -6
- package/.idea/jsLibraryMappings.xml +0 -6
- package/.idea/kle-ElderWand.iml +0 -9
- package/.idea/libraries/kle_ElderWand_node_modules.xml +0 -14
- package/.idea/misc.xml +0 -13
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -793
- package/BoilerPlate/Documents/.editorconfig +0 -10
- package/BoilerPlate/Documents/.sailsrc +0 -5
- package/BoilerPlate/Documents/CONTRIBUTING.md +0 -1
- package/BoilerPlate/Documents/LICENSE.txt +0 -21
- package/BoilerPlate/Documents/Procfile +0 -1
- package/BoilerPlate/Documents/README.md +0 -63
- package/BoilerPlate/Documents/app/controllers/documents.js +0 -45
- package/BoilerPlate/Documents/app/controllers/sectionGrups.js +0 -22
- package/BoilerPlate/Documents/app/controllers/sectionTypes.js +0 -51
- package/BoilerPlate/Documents/app/controllers/sections.js +0 -139
- package/BoilerPlate/Documents/app/controllers/users.js +0 -74
- package/BoilerPlate/Documents/app/models/document.js +0 -105
- package/BoilerPlate/Documents/app/models/section.js +0 -156
- package/BoilerPlate/Documents/app/models/sectionGrup.js +0 -136
- package/BoilerPlate/Documents/app/models/sectionType.js +0 -135
- package/BoilerPlate/Documents/app/models/user.js +0 -202
- package/BoilerPlate/Documents/app/views/404.html +0 -5
- package/BoilerPlate/Documents/app/views/500.html +0 -13
- package/BoilerPlate/Documents/app/views/documentation.html +0 -37
- package/BoilerPlate/Documents/app/views/documents/document.html +0 -11
- package/BoilerPlate/Documents/app/views/documents/edit.html +0 -1
- package/BoilerPlate/Documents/app/views/documents/form.html +0 -43
- package/BoilerPlate/Documents/app/views/documents/index.html +0 -58
- package/BoilerPlate/Documents/app/views/documents/new.html +0 -1
- package/BoilerPlate/Documents/app/views/documents/show.html +0 -2
- package/BoilerPlate/Documents/app/views/includes/foot.html +0 -29
- package/BoilerPlate/Documents/app/views/includes/footer.html +0 -1
- package/BoilerPlate/Documents/app/views/includes/head.html +0 -31
- package/BoilerPlate/Documents/app/views/includes/header.html +0 -47
- package/BoilerPlate/Documents/app/views/includes/messages.html +0 -43
- package/BoilerPlate/Documents/app/views/layouts/default.html +0 -25
- package/BoilerPlate/Documents/app/views/sectionGrups/edit.html +0 -1
- package/BoilerPlate/Documents/app/views/sectionGrups/form.html +0 -47
- package/BoilerPlate/Documents/app/views/sectionGrups/index.html +0 -33
- package/BoilerPlate/Documents/app/views/sectionGrups/new.html +0 -1
- package/BoilerPlate/Documents/app/views/sectionGrups/sectionGrup.html +0 -11
- package/BoilerPlate/Documents/app/views/sectionGrups/show.html +0 -55
- package/BoilerPlate/Documents/app/views/sectionTypes/edit.html +0 -1
- package/BoilerPlate/Documents/app/views/sectionTypes/form.html +0 -42
- package/BoilerPlate/Documents/app/views/sectionTypes/index.html +0 -33
- package/BoilerPlate/Documents/app/views/sectionTypes/new.html +0 -1
- package/BoilerPlate/Documents/app/views/sectionTypes/sectionType.html +0 -17
- package/BoilerPlate/Documents/app/views/sectionTypes/show.html +0 -55
- package/BoilerPlate/Documents/app/views/sections/edit.html +0 -320
- package/BoilerPlate/Documents/app/views/sections/form.html +0 -277
- package/BoilerPlate/Documents/app/views/sections/index.html +0 -40
- package/BoilerPlate/Documents/app/views/sections/liste.html +0 -39
- package/BoilerPlate/Documents/app/views/sections/new.html +0 -1
- package/BoilerPlate/Documents/app/views/sections/section.html +0 -1
- package/BoilerPlate/Documents/app/views/sections/section_Like_blog.html +0 -32
- package/BoilerPlate/Documents/app/views/sections/section_Like_project.html +0 -35
- package/BoilerPlate/Documents/app/views/sections/section_about.html +0 -31
- package/BoilerPlate/Documents/app/views/sections/section_blog.html +0 -47
- package/BoilerPlate/Documents/app/views/sections/section_clients.html +0 -23
- package/BoilerPlate/Documents/app/views/sections/section_contact.html +0 -74
- package/BoilerPlate/Documents/app/views/sections/section_detay1Resimli.html +0 -23
- package/BoilerPlate/Documents/app/views/sections/section_detay1Resimsiz.html +0 -11
- package/BoilerPlate/Documents/app/views/sections/section_features.html +0 -23
- package/BoilerPlate/Documents/app/views/sections/section_funfact.html +0 -19
- package/BoilerPlate/Documents/app/views/sections/section_projects.html +0 -49
- package/BoilerPlate/Documents/app/views/sections/section_sadeceParagraf.html +0 -13
- package/BoilerPlate/Documents/app/views/sections/section_services.html +0 -34
- package/BoilerPlate/Documents/app/views/sections/section_slider.html +0 -195
- package/BoilerPlate/Documents/app/views/sections/section_team.html +0 -42
- package/BoilerPlate/Documents/app/views/sections/section_testimonialSSS.html +0 -51
- package/BoilerPlate/Documents/app/views/sections/section_video_about.html +0 -31
- package/BoilerPlate/Documents/app/views/sections/show.html +0 -55
- package/BoilerPlate/Documents/app/views/users/auth.html +0 -12
- package/BoilerPlate/Documents/app/views/users/index.html +0 -26
- package/BoilerPlate/Documents/app/views/users/login.html +0 -33
- package/BoilerPlate/Documents/app/views/users/show.html +0 -5
- package/BoilerPlate/Documents/app/views/users/signup.html +0 -43
- package/BoilerPlate/Documents/app/views/users/user.html +0 -28
- package/BoilerPlate/Documents/config/config.js +0 -35
- package/BoilerPlate/Documents/config/env/development.js +0 -53
- package/BoilerPlate/Documents/config/env/env.json +0 -12
- package/BoilerPlate/Documents/config/env/production.js +0 -33
- package/BoilerPlate/Documents/config/env/test.js +0 -33
- package/BoilerPlate/Documents/config/express.js +0 -124
- package/BoilerPlate/Documents/config/imager.js +0 -36
- package/BoilerPlate/Documents/config/middlewares/authorization.js +0 -55
- package/BoilerPlate/Documents/config/passport/facebook.js +0 -43
- package/BoilerPlate/Documents/config/passport/github.js +0 -43
- package/BoilerPlate/Documents/config/passport/google.js +0 -43
- package/BoilerPlate/Documents/config/passport/linkedin.js +0 -44
- package/BoilerPlate/Documents/config/passport/local.js +0 -37
- package/BoilerPlate/Documents/config/passport/twitter.js +0 -42
- package/BoilerPlate/Documents/config/passport.js +0 -40
- package/BoilerPlate/Documents/config/routes.js +0 -104
- package/BoilerPlate/Documents/lib/utils.js +0 -79
- package/BoilerPlate/Documents/nodemon.json +0 -5
- package/BoilerPlate/Documents/package-lock.json +0 -8993
- package/BoilerPlate/Documents/package.json +0 -49
- package/BoilerPlate/Documents/public/css/TheDocs.min.css +0 -1
- package/BoilerPlate/Documents/public/css/custom.css +0 -102
- package/BoilerPlate/Documents/public/css/skin/skin-blue.css +0 -71
- package/BoilerPlate/Documents/public/css/skin/skin-blue.css.map +0 -10
- package/BoilerPlate/Documents/public/css/skin/skin-blue.min.css +0 -1
- package/BoilerPlate/Documents/public/css/skin/skin-brown.css +0 -71
- package/BoilerPlate/Documents/public/css/skin/skin-brown.css.map +0 -10
- package/BoilerPlate/Documents/public/css/skin/skin-brown.min.css +0 -1
- package/BoilerPlate/Documents/public/css/skin/skin-cyan.css +0 -71
- package/BoilerPlate/Documents/public/css/skin/skin-cyan.css.map +0 -10
- package/BoilerPlate/Documents/public/css/skin/skin-cyan.min.css +0 -1
- package/BoilerPlate/Documents/public/css/skin/skin-dark.css +0 -71
- package/BoilerPlate/Documents/public/css/skin/skin-dark.css.map +0 -10
- package/BoilerPlate/Documents/public/css/skin/skin-dark.min.css +0 -1
- package/BoilerPlate/Documents/public/css/skin/skin-gray.css +0 -71
- package/BoilerPlate/Documents/public/css/skin/skin-gray.css.map +0 -10
- package/BoilerPlate/Documents/public/css/skin/skin-gray.min.css +0 -1
- package/BoilerPlate/Documents/public/css/skin/skin-green.css +0 -71
- package/BoilerPlate/Documents/public/css/skin/skin-green.css.map +0 -10
- package/BoilerPlate/Documents/public/css/skin/skin-green.min.css +0 -1
- package/BoilerPlate/Documents/public/css/skin/skin-orange.css +0 -71
- package/BoilerPlate/Documents/public/css/skin/skin-orange.css.map +0 -10
- package/BoilerPlate/Documents/public/css/skin/skin-orange.min.css +0 -1
- package/BoilerPlate/Documents/public/css/skin/skin-pink.css +0 -71
- package/BoilerPlate/Documents/public/css/skin/skin-pink.css.map +0 -10
- package/BoilerPlate/Documents/public/css/skin/skin-pink.min.css +0 -1
- package/BoilerPlate/Documents/public/css/skin/skin-purple.css +0 -71
- package/BoilerPlate/Documents/public/css/skin/skin-purple.css.map +0 -10
- package/BoilerPlate/Documents/public/css/skin/skin-purple.min.css +0 -1
- package/BoilerPlate/Documents/public/css/skin/skin-red.css +0 -71
- package/BoilerPlate/Documents/public/css/skin/skin-red.css.map +0 -10
- package/BoilerPlate/Documents/public/css/skin/skin-red.min.css +0 -1
- package/BoilerPlate/Documents/public/css/skin/skin-teal.css +0 -71
- package/BoilerPlate/Documents/public/css/skin/skin-teal.css.map +0 -10
- package/BoilerPlate/Documents/public/css/skin/skin-teal.min.css +0 -1
- package/BoilerPlate/Documents/public/css/skin/skin-yellow.css +0 -71
- package/BoilerPlate/Documents/public/css/skin/skin-yellow.css.map +0 -10
- package/BoilerPlate/Documents/public/css/skin/skin-yellow.min.css +0 -1
- package/BoilerPlate/Documents/public/css/theDocs/_alerts.scss +0 -49
- package/BoilerPlate/Documents/public/css/theDocs/_banner.scss +0 -225
- package/BoilerPlate/Documents/public/css/theDocs/_blog.scss +0 -240
- package/BoilerPlate/Documents/public/css/theDocs/_breadcrumb.scss +0 -10
- package/BoilerPlate/Documents/public/css/theDocs/_buttons.scss +0 -143
- package/BoilerPlate/Documents/public/css/theDocs/_carousel.scss +0 -92
- package/BoilerPlate/Documents/public/css/theDocs/_code.scss +0 -372
- package/BoilerPlate/Documents/public/css/theDocs/_color.scss +0 -38
- package/BoilerPlate/Documents/public/css/theDocs/_content.scss +0 -108
- package/BoilerPlate/Documents/public/css/theDocs/_faq.scss +0 -82
- package/BoilerPlate/Documents/public/css/theDocs/_files.scss +0 -137
- package/BoilerPlate/Documents/public/css/theDocs/_footer.scss +0 -82
- package/BoilerPlate/Documents/public/css/theDocs/_form.scss +0 -24
- package/BoilerPlate/Documents/public/css/theDocs/_header.scss +0 -374
- package/BoilerPlate/Documents/public/css/theDocs/_jumbotron.scss +0 -150
- package/BoilerPlate/Documents/public/css/theDocs/_labels.scss +0 -23
- package/BoilerPlate/Documents/public/css/theDocs/_media.scss +0 -24
- package/BoilerPlate/Documents/public/css/theDocs/_mixins.scss +0 -66
- package/BoilerPlate/Documents/public/css/theDocs/_pagination.scss +0 -75
- package/BoilerPlate/Documents/public/css/theDocs/_promo.scss +0 -112
- package/BoilerPlate/Documents/public/css/theDocs/_requirements.scss +0 -53
- package/BoilerPlate/Documents/public/css/theDocs/_sidebar.scss +0 -666
- package/BoilerPlate/Documents/public/css/theDocs/_step.scss +0 -161
- package/BoilerPlate/Documents/public/css/theDocs/_tab.scss +0 -105
- package/BoilerPlate/Documents/public/css/theDocs/_tables.scss +0 -106
- package/BoilerPlate/Documents/public/css/theDocs/_toc.scss +0 -78
- package/BoilerPlate/Documents/public/css/theDocs/_typography.scss +0 -282
- package/BoilerPlate/Documents/public/css/theDocs/_variables.scss +0 -98
- package/BoilerPlate/Documents/public/css/theDocs/_views.scss +0 -215
- package/BoilerPlate/Documents/public/css/theDocs/skins/_skin.scss +0 -76
- package/BoilerPlate/Documents/public/css/theDocs/skins/skin-blue.scss +0 -3
- package/BoilerPlate/Documents/public/css/theDocs/skins/skin-brown.scss +0 -3
- package/BoilerPlate/Documents/public/css/theDocs/skins/skin-cyan.scss +0 -3
- package/BoilerPlate/Documents/public/css/theDocs/skins/skin-dark.scss +0 -3
- package/BoilerPlate/Documents/public/css/theDocs/skins/skin-gray.scss +0 -3
- package/BoilerPlate/Documents/public/css/theDocs/skins/skin-green.scss +0 -3
- package/BoilerPlate/Documents/public/css/theDocs/skins/skin-orange.scss +0 -3
- package/BoilerPlate/Documents/public/css/theDocs/skins/skin-pink.scss +0 -3
- package/BoilerPlate/Documents/public/css/theDocs/skins/skin-purple.scss +0 -3
- package/BoilerPlate/Documents/public/css/theDocs/skins/skin-red.scss +0 -3
- package/BoilerPlate/Documents/public/css/theDocs/skins/skin-teal.scss +0 -3
- package/BoilerPlate/Documents/public/css/theDocs/skins/skin-yellow.scss +0 -3
- package/BoilerPlate/Documents/public/css/theDocs.all.min.css +0 -24
- package/BoilerPlate/Documents/public/css/theDocs.css +0 -3945
- package/BoilerPlate/Documents/public/css/theDocs.css.map +0 -38
- package/BoilerPlate/Documents/public/css/theDocs.scss +0 -70
- package/BoilerPlate/Documents/public/fonts/FontAwesome.otf +0 -0
- package/BoilerPlate/Documents/public/fonts/fontawesome-webfont.eot +0 -0
- package/BoilerPlate/Documents/public/fonts/fontawesome-webfont.svg +0 -2671
- package/BoilerPlate/Documents/public/fonts/fontawesome-webfont.ttf +0 -0
- package/BoilerPlate/Documents/public/fonts/fontawesome-webfont.woff +0 -0
- package/BoilerPlate/Documents/public/fonts/fontawesome-webfont.woff2 +0 -0
- package/BoilerPlate/Documents/public/fonts/glyphicons-halflings-regular.eot +0 -0
- package/BoilerPlate/Documents/public/fonts/glyphicons-halflings-regular.svg +0 -288
- package/BoilerPlate/Documents/public/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/BoilerPlate/Documents/public/fonts/glyphicons-halflings-regular.woff +0 -0
- package/BoilerPlate/Documents/public/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/BoilerPlate/Documents/public/img/apple-touch-icon-114x114.png +0 -0
- package/BoilerPlate/Documents/public/img/apple-touch-icon-72x72.png +0 -0
- package/BoilerPlate/Documents/public/img/apple-touch-icon.png +0 -0
- package/BoilerPlate/Documents/public/img/arrow-circle-down.svg +0 -1
- package/BoilerPlate/Documents/public/img/arrow-circle-right.svg +0 -1
- package/BoilerPlate/Documents/public/img/atlassian.svg +0 -1
- package/BoilerPlate/Documents/public/img/avatar-1.jpg +0 -0
- package/BoilerPlate/Documents/public/img/banner-default.png +0 -0
- package/BoilerPlate/Documents/public/img/banner-full-height.png +0 -0
- package/BoilerPlate/Documents/public/img/banner-lg.png +0 -0
- package/BoilerPlate/Documents/public/img/banner-sample1.png +0 -0
- package/BoilerPlate/Documents/public/img/banner-sample2.png +0 -0
- package/BoilerPlate/Documents/public/img/banner-sample3.png +0 -0
- package/BoilerPlate/Documents/public/img/banner-sm.png +0 -0
- package/BoilerPlate/Documents/public/img/banner.jpg +0 -0
- package/BoilerPlate/Documents/public/img/banner1.jpg +0 -0
- package/BoilerPlate/Documents/public/img/banner2.jpg +0 -0
- package/BoilerPlate/Documents/public/img/banner3.jpg +0 -0
- package/BoilerPlate/Documents/public/img/banner4.png +0 -0
- package/BoilerPlate/Documents/public/img/banner5.png +0 -0
- package/BoilerPlate/Documents/public/img/check-circle.svg +0 -1
- package/BoilerPlate/Documents/public/img/chevron-circle-right.svg +0 -1
- package/BoilerPlate/Documents/public/img/circle-with-minus.svg +0 -1
- package/BoilerPlate/Documents/public/img/circle-with-plus.svg +0 -1
- package/BoilerPlate/Documents/public/img/cloud.svg +0 -1
- package/BoilerPlate/Documents/public/img/conference-image-1.jpg +0 -0
- package/BoilerPlate/Documents/public/img/conference-image-2.jpg +0 -0
- package/BoilerPlate/Documents/public/img/conference-image-3.jpg +0 -0
- package/BoilerPlate/Documents/public/img/edward.jpg +0 -0
- package/BoilerPlate/Documents/public/img/elderwand-logo.png +0 -0
- package/BoilerPlate/Documents/public/img/email.svg +0 -1
- package/BoilerPlate/Documents/public/img/envato.svg +0 -1
- package/BoilerPlate/Documents/public/img/facebook.svg +0 -1
- package/BoilerPlate/Documents/public/img/favicon.png +0 -0
- package/BoilerPlate/Documents/public/img/heart.svg +0 -1
- package/BoilerPlate/Documents/public/img/images.svg +0 -1
- package/BoilerPlate/Documents/public/img/index.png +0 -0
- package/BoilerPlate/Documents/public/img/jacob.jpg +0 -0
- package/BoilerPlate/Documents/public/img/jquery.svg +0 -1
- package/BoilerPlate/Documents/public/img/jumbotron-bg.png +0 -0
- package/BoilerPlate/Documents/public/img/layout-single1.png +0 -0
- package/BoilerPlate/Documents/public/img/layout-single2.png +0 -0
- package/BoilerPlate/Documents/public/img/layout-single3.png +0 -0
- package/BoilerPlate/Documents/public/img/location-pin.svg +0 -1
- package/BoilerPlate/Documents/public/img/lucy.jpg +0 -0
- package/BoilerPlate/Documents/public/img/mamtas-logo-simple.png +0 -0
- package/BoilerPlate/Documents/public/img/music.svg +0 -1
- package/BoilerPlate/Documents/public/img/nathan.jpg +0 -0
- package/BoilerPlate/Documents/public/img/navbar-dark.png +0 -0
- package/BoilerPlate/Documents/public/img/navbar-default.png +0 -0
- package/BoilerPlate/Documents/public/img/navbar-fullwidth.png +0 -0
- package/BoilerPlate/Documents/public/img/navbar-lg.png +0 -0
- package/BoilerPlate/Documents/public/img/navbar-light.png +0 -0
- package/BoilerPlate/Documents/public/img/navbar-sm.png +0 -0
- package/BoilerPlate/Documents/public/img/phone.svg +0 -1
- package/BoilerPlate/Documents/public/img/placeholder-1900.png +0 -0
- package/BoilerPlate/Documents/public/img/placeholder.png +0 -0
- package/BoilerPlate/Documents/public/img/sidebar-default.png +0 -0
- package/BoilerPlate/Documents/public/img/sidebar-icon.png +0 -0
- package/BoilerPlate/Documents/public/img/sidebar-line.png +0 -0
- package/BoilerPlate/Documents/public/img/skin-blue.png +0 -0
- package/BoilerPlate/Documents/public/img/skin-brown.png +0 -0
- package/BoilerPlate/Documents/public/img/skin-cyan.png +0 -0
- package/BoilerPlate/Documents/public/img/skin-dark.png +0 -0
- package/BoilerPlate/Documents/public/img/skin-default.png +0 -0
- package/BoilerPlate/Documents/public/img/skin-gray.png +0 -0
- package/BoilerPlate/Documents/public/img/skin-green.png +0 -0
- package/BoilerPlate/Documents/public/img/skin-orange.png +0 -0
- package/BoilerPlate/Documents/public/img/skin-pink.png +0 -0
- package/BoilerPlate/Documents/public/img/skin-purple.png +0 -0
- package/BoilerPlate/Documents/public/img/skin-red.png +0 -0
- package/BoilerPlate/Documents/public/img/skin-teal.png +0 -0
- package/BoilerPlate/Documents/public/img/skin-yellow.png +0 -0
- package/BoilerPlate/Documents/public/img/skype.svg +0 -1
- package/BoilerPlate/Documents/public/img/step1.png +0 -0
- package/BoilerPlate/Documents/public/img/step2.png +0 -0
- package/BoilerPlate/Documents/public/img/step3.png +0 -0
- package/BoilerPlate/Documents/public/img/step4.png +0 -0
- package/BoilerPlate/Documents/public/img/tumblr.svg +0 -1
- package/BoilerPlate/Documents/public/img/twitter.svg +0 -1
- package/BoilerPlate/Documents/public/img/video-dawn.mp4 +0 -0
- package/BoilerPlate/Documents/public/img/video.svg +0 -1
- package/BoilerPlate/Documents/public/js/custom.js +0 -26
- package/BoilerPlate/Documents/public/js/default.js +0 -1
- package/BoilerPlate/Documents/public/js/theDocs.all.min.js +0 -102
- package/BoilerPlate/Documents/public/js/theDocs.js +0 -482
- package/BoilerPlate/Documents/public/js/theDocs.min.js +0 -6
- package/BoilerPlate/Documents/public/js/vendor/bootstrap.carousel.js +0 -1
- package/BoilerPlate/Documents/public/js/vendor/bootstrap.collapse.js +0 -1
- package/BoilerPlate/Documents/public/js/vendor/bootstrap.dropdown.js +0 -1
- package/BoilerPlate/Documents/public/js/vendor/bootstrap.tab.js +0 -1
- package/BoilerPlate/Documents/public/js/vendor/bootstrap.transition.js +0 -1
- package/BoilerPlate/Documents/public/js/vendor/jquery-1.11.3.min.js +0 -4
- package/BoilerPlate/Documents/public/js/vendor/jquery.drawsvg.js +0 -1
- package/BoilerPlate/Documents/public/js/vendor/jquery.mobile.custom.min.js +0 -1
- package/BoilerPlate/Documents/public/js/vendor/webfontloader.js +0 -1
- package/BoilerPlate/Documents/public/sample.html +0 -530
- package/BoilerPlate/Documents/public/style.css +0 -10
- package/BoilerPlate/Documents/public/vendors/bootstrap/css/bootstrap-theme.css +0 -587
- package/BoilerPlate/Documents/public/vendors/bootstrap/css/bootstrap-theme.css.map +0 -1
- package/BoilerPlate/Documents/public/vendors/bootstrap/css/bootstrap-theme.min.css +0 -6
- package/BoilerPlate/Documents/public/vendors/bootstrap/css/bootstrap-theme.min.css.map +0 -1
- package/BoilerPlate/Documents/public/vendors/bootstrap/css/bootstrap.css +0 -6757
- package/BoilerPlate/Documents/public/vendors/bootstrap/css/bootstrap.css.map +0 -1
- package/BoilerPlate/Documents/public/vendors/bootstrap/css/bootstrap.min.css +0 -6
- package/BoilerPlate/Documents/public/vendors/bootstrap/css/bootstrap.min.css.map +0 -1
- package/BoilerPlate/Documents/public/vendors/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
- package/BoilerPlate/Documents/public/vendors/bootstrap/fonts/glyphicons-halflings-regular.svg +0 -288
- package/BoilerPlate/Documents/public/vendors/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/BoilerPlate/Documents/public/vendors/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
- package/BoilerPlate/Documents/public/vendors/bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/BoilerPlate/Documents/public/vendors/bootstrap/js/bootstrap.js +0 -2377
- package/BoilerPlate/Documents/public/vendors/bootstrap/js/bootstrap.min.js +0 -7
- package/BoilerPlate/Documents/public/vendors/bootstrap/js/npm.js +0 -13
- package/BoilerPlate/Documents/public/vendors/clipboard.js/clipboard.js +0 -778
- package/BoilerPlate/Documents/public/vendors/clipboard.js/clipboard.min.js +0 -7
- package/BoilerPlate/Documents/public/vendors/fitvids/jquery.fitvids.js +0 -11
- package/BoilerPlate/Documents/public/vendors/font-awesome/css/font-awesome.css +0 -2337
- package/BoilerPlate/Documents/public/vendors/font-awesome/css/font-awesome.min.css +0 -4
- package/BoilerPlate/Documents/public/vendors/font-awesome/fonts/FontAwesome.otf +0 -0
- package/BoilerPlate/Documents/public/vendors/font-awesome/fonts/fontawesome-webfont.eot +0 -0
- package/BoilerPlate/Documents/public/vendors/font-awesome/fonts/fontawesome-webfont.svg +0 -2671
- package/BoilerPlate/Documents/public/vendors/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
- package/BoilerPlate/Documents/public/vendors/font-awesome/fonts/fontawesome-webfont.woff +0 -0
- package/BoilerPlate/Documents/public/vendors/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
- package/BoilerPlate/Documents/public/vendors/font-awesome/less/animated.less +0 -34
- package/BoilerPlate/Documents/public/vendors/font-awesome/less/bordered-pulled.less +0 -25
- package/BoilerPlate/Documents/public/vendors/font-awesome/less/core.less +0 -12
- package/BoilerPlate/Documents/public/vendors/font-awesome/less/fixed-width.less +0 -6
- package/BoilerPlate/Documents/public/vendors/font-awesome/less/font-awesome.less +0 -18
- package/BoilerPlate/Documents/public/vendors/font-awesome/less/icons.less +0 -789
- package/BoilerPlate/Documents/public/vendors/font-awesome/less/larger.less +0 -13
- package/BoilerPlate/Documents/public/vendors/font-awesome/less/list.less +0 -19
- package/BoilerPlate/Documents/public/vendors/font-awesome/less/mixins.less +0 -60
- package/BoilerPlate/Documents/public/vendors/font-awesome/less/path.less +0 -15
- package/BoilerPlate/Documents/public/vendors/font-awesome/less/rotated-flipped.less +0 -20
- package/BoilerPlate/Documents/public/vendors/font-awesome/less/screen-reader.less +0 -5
- package/BoilerPlate/Documents/public/vendors/font-awesome/less/stacked.less +0 -20
- package/BoilerPlate/Documents/public/vendors/font-awesome/less/variables.less +0 -800
- package/BoilerPlate/Documents/public/vendors/font-awesome/scss/_animated.scss +0 -34
- package/BoilerPlate/Documents/public/vendors/font-awesome/scss/_bordered-pulled.scss +0 -25
- package/BoilerPlate/Documents/public/vendors/font-awesome/scss/_core.scss +0 -12
- package/BoilerPlate/Documents/public/vendors/font-awesome/scss/_fixed-width.scss +0 -6
- package/BoilerPlate/Documents/public/vendors/font-awesome/scss/_icons.scss +0 -789
- package/BoilerPlate/Documents/public/vendors/font-awesome/scss/_larger.scss +0 -13
- package/BoilerPlate/Documents/public/vendors/font-awesome/scss/_list.scss +0 -19
- package/BoilerPlate/Documents/public/vendors/font-awesome/scss/_mixins.scss +0 -60
- package/BoilerPlate/Documents/public/vendors/font-awesome/scss/_path.scss +0 -15
- package/BoilerPlate/Documents/public/vendors/font-awesome/scss/_rotated-flipped.scss +0 -20
- package/BoilerPlate/Documents/public/vendors/font-awesome/scss/_screen-reader.scss +0 -5
- package/BoilerPlate/Documents/public/vendors/font-awesome/scss/_stacked.scss +0 -20
- package/BoilerPlate/Documents/public/vendors/font-awesome/scss/_variables.scss +0 -800
- package/BoilerPlate/Documents/public/vendors/font-awesome/scss/font-awesome.scss +0 -18
- package/BoilerPlate/Documents/public/vendors/jquery/jquery.min.js +0 -4
- package/BoilerPlate/Documents/public/vendors/lity/lity.css +0 -200
- package/BoilerPlate/Documents/public/vendors/lity/lity.js +0 -637
- package/BoilerPlate/Documents/public/vendors/lity/lity.min.css +0 -3
- package/BoilerPlate/Documents/public/vendors/lity/lity.min.js +0 -4
- package/BoilerPlate/Documents/public/vendors/matchHeight.min.js +0 -11
- package/BoilerPlate/Documents/public/vendors/perfect-scrollbar/css/perfect-scrollbar.css +0 -113
- package/BoilerPlate/Documents/public/vendors/perfect-scrollbar/css/perfect-scrollbar.min.css +0 -2
- package/BoilerPlate/Documents/public/vendors/perfect-scrollbar/js/perfect-scrollbar.jquery.js +0 -1580
- package/BoilerPlate/Documents/public/vendors/perfect-scrollbar/js/perfect-scrollbar.jquery.min.js +0 -2
- package/BoilerPlate/Documents/public/vendors/perfect-scrollbar/js/perfect-scrollbar.js +0 -1553
- package/BoilerPlate/Documents/public/vendors/perfect-scrollbar/js/perfect-scrollbar.min.js +0 -2
- package/BoilerPlate/Documents/public/vendors/prism/prism.css +0 -7
- package/BoilerPlate/Documents/public/vendors/prism/prism.js +0 -54
- package/BoilerPlate/Documents/server.js +0 -63
- package/BoilerPlate/Documents/tempUploads/068f2b77c0e0723b97909b2ffa438fe6.pdf +0 -0
- package/BoilerPlate/Documents/tempUploads/6443f8fd5d507b5a5f76829962fc2dc0.docx +0 -0
- package/BoilerPlate/Documents/tempUploads/7e4560af2cd6cae130bdb79fecaa6437.pdf +0 -0
- package/BoilerPlate/Documents/tempUploads/84b6ad7e0deefc348cfd582c9715ec1d.pdf +0 -0
- package/BoilerPlate/Documents/tempUploads/a894549ed062ada5f48f364a236a7e76.png +0 -0
- package/BoilerPlate/Documents/tempUploads/c2727b94bc909b118b25ae35f0897713.png +0 -0
- package/BoilerPlate/Documents/tempUploads/c588a76c8b0c4b76df2e36bd602a8821.docx +0 -0
- package/BoilerPlate/Documents/tempUploads/d6476c43a03950899e6db91c95dbc8aa.docx +0 -0
- package/BoilerPlate/Documents/tempUploads/dc4ffdc0a703353e0280384afc6ad082.png +0 -0
- package/BoilerPlate/Documents/test/helper.js +0 -27
- package/BoilerPlate/Documents/test/test-articles.js +0 -176
- package/BoilerPlate/Documents/test/test-users.js +0 -106
- package/BoilerPlate/Documents/uploads/section/5ad9bb9853017c217c6673d5/0cb1f166cbb6b46ffc630cb1c86db0a1.png +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9bb9853017c217c6673d5/37fbc499e5eea091ab7215855bf7918b.png +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9bb9853017c217c6673d5/4b0d6e11c87b31cc6c32e18be5a49b6b.pdf +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9bb9853017c217c6673d5/d4248bccecc0f55dd2fe7cd388c4c1ce.docx +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9bbd853017c217c6673d8/7c7b0d7f03359c38e3411ec448bdc746.png +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9bbd853017c217c6673d8/8c7eeb092084ee8349f12ceb7e6dab2d.docx +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9bbd853017c217c6673d8/b512a8558523894f0d9292f39dcd9d82.pdf +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9bc111b67922eb0f547d5/06cdca751d7c5897179af1bb956e13d3.docx +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9bc111b67922eb0f547d5/4fe0695295a41c9e3e5af0d2fd52bbae.png +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9c7ce673a50173865614b/1c68ca7ae23099cd139801766ccec600.docx +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9c7ce673a50173865614b/7d7d49834eea7899d77a29dda1d25bf4.pdf +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9c826673a50173865614e/301398c02f647d1e1804d48233e9e7e0.pdf +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9c826673a50173865614e/c9ca2431eed90529a633f88c6781e686.docx +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9c85f673a501738656153/71b1d92caefe43821426d139e6c931d1.pdf +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9c85f673a501738656153/a0735aa1e0befd14449b26063c112d46.docx +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9ce22f534442218fb8016/31724098865f19fd968d6167736bd388.docx +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9d714f534442218fb801b/a71e1f795a7c2f260ccbd877e9e03b17.docx +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9d755f534442218fb801e/c23154466cfcbb8aa9101509cc990962.docx +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9d816f534442218fb8021/e90f3adde177c831dd96d8fcf2f6bf17.docx +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9d83bf534442218fb8024/11a310205cd7c1b3f0a53cd4a3e1cd91.png +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9d83bf534442218fb8024/4c45d0286d8b0ae23fe1ccfd2d0f6b52.pdf +0 -0
- package/BoilerPlate/Documents/uploads/section/5ad9d83bf534442218fb8024/6dd38b8628ef60ea09e982c375720d94.docx +0 -0
- package/dump.rdb +0 -0
|
@@ -31,7 +31,7 @@ module.exports = function(){
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
addPropertyToClass(global, '__line', undefined,{
|
|
34
|
-
|
|
34
|
+
get: function(){
|
|
35
35
|
return __stack[1].getLineNumber();
|
|
36
36
|
}
|
|
37
37
|
});
|
|
@@ -54,7 +54,7 @@ module.exports = function(){
|
|
|
54
54
|
addPropertyToClass(global, "EWLog", function(){
|
|
55
55
|
var date = new Date();
|
|
56
56
|
var dateStr = date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds() + ":"+ date.getMilliseconds()
|
|
57
|
-
var args = [dateStr,__caller];
|
|
57
|
+
var args = [dateStr, __caller];
|
|
58
58
|
for(var key in arguments){
|
|
59
59
|
args.push(arguments[key]);
|
|
60
60
|
}
|
package/NoDuplicate/README.md
CHANGED
|
@@ -1,68 +1,116 @@
|
|
|
1
|
-
|
|
1
|
+
# elderwand-mongoose-no-duplicate
|
|
2
2
|
|
|
3
|
-
Mongoose
|
|
4
|
-
|
|
3
|
+
A Mongoose plugin that prevents duplicate documents by hashing a document's
|
|
4
|
+
content into a unique-indexed `sha1_hash` field. When two documents would
|
|
5
|
+
have the same content, the second `.save()` is rejected by MongoDB with a
|
|
6
|
+
duplicate-key error.
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
## How it works
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
1. The plugin adds a `sha1_hash: String` field with `unique: true`.
|
|
11
|
+
2. On every `.save()`, a `pre('save')` hook computes
|
|
12
|
+
`sha1(JSON.stringify(model.toObject()))` with selected fields excluded or
|
|
13
|
+
included, and stores the result in `sha1_hash`.
|
|
14
|
+
3. The unique index ensures MongoDB rejects any insert whose content (per
|
|
15
|
+
the hash) is already in the collection.
|
|
9
16
|
|
|
10
|
-
##
|
|
11
|
-
In the original plugin, models were deleted with a date reference only. This version takes that and uses a Boolean flag to to mark models deleted/restored. Adds `deletedAt` field to record when a document was deleted. Additionally, it removes a lot of overhead from the original code and doesn't use Coffeescript for the original code.
|
|
17
|
+
## Usage
|
|
12
18
|
|
|
13
|
-
|
|
14
|
-
This plugin is licensed under the MIT license and can ve viewed in the LICENSE file.
|
|
19
|
+
### Exclude specific fields from the hash
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
```js
|
|
22
|
+
var mongoose = require('mongoose');
|
|
23
|
+
var no_duplicate = require('elderwand-mongoose-no-duplicate');
|
|
24
|
+
|
|
25
|
+
var ArticleSchema = new mongoose.Schema({
|
|
26
|
+
title: String,
|
|
27
|
+
body: String,
|
|
28
|
+
createdAt: Date,
|
|
29
|
+
lastSeenAt: Date,
|
|
30
|
+
meta: {
|
|
31
|
+
views: Number,
|
|
32
|
+
flags: { internal: String }
|
|
33
|
+
}
|
|
34
|
+
});
|
|
24
35
|
|
|
25
|
-
|
|
26
|
-
|
|
36
|
+
ArticleSchema.plugin(no_duplicate.getPluginWithOptions({
|
|
37
|
+
exclude: [
|
|
38
|
+
'createdAt',
|
|
39
|
+
'lastSeenAt',
|
|
40
|
+
'meta.views',
|
|
41
|
+
'meta.flags.internal'
|
|
42
|
+
],
|
|
43
|
+
sparse: true // unique index is sparse — only enforced on docs that
|
|
44
|
+
// have sha1_hash set (every saved doc, in practice)
|
|
45
|
+
}));
|
|
46
|
+
|
|
47
|
+
mongoose.model('Article', ArticleSchema);
|
|
27
48
|
```
|
|
28
49
|
|
|
29
|
-
|
|
50
|
+
Two articles with identical `title` and `body` will collide on `sha1_hash`
|
|
51
|
+
even if their timestamps and `meta.views` counts differ.
|
|
30
52
|
|
|
31
|
-
|
|
53
|
+
### Hash only specific fields
|
|
32
54
|
|
|
33
55
|
```js
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
56
|
+
ArticleSchema.plugin(no_duplicate.getPluginWithOptions({
|
|
57
|
+
includeOnly: ['title', 'body'],
|
|
58
|
+
sparse: true
|
|
59
|
+
}));
|
|
60
|
+
```
|
|
37
61
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
62
|
+
Only `title` and `body` contribute to the hash; everything else is ignored.
|
|
63
|
+
|
|
64
|
+
## Plugin options
|
|
41
65
|
|
|
42
|
-
|
|
66
|
+
| Option | Type | Default | Notes |
|
|
67
|
+
| ------------- | --------- | ------- | ---------------------------------------------------------------------- |
|
|
68
|
+
| `exclude` | string[] | `[]` | Top-level or dotted paths to omit from the hash input. |
|
|
69
|
+
| `includeOnly` | string[] | — | If set, only these paths contribute to the hash (overrides `exclude`). |
|
|
70
|
+
| `sparse` | boolean | `false` | Forwarded to the unique index definition. |
|
|
71
|
+
| `dropDups` | boolean | `false` | Forwarded to mongoose. **Note:** removed in MongoDB ≥ 3.0; ignored. |
|
|
43
72
|
|
|
44
|
-
|
|
45
|
-
|
|
73
|
+
`_id` is always excluded from the hash regardless of `exclude` /
|
|
74
|
+
`includeOnly` — otherwise every document would be unique by definition.
|
|
46
75
|
|
|
47
|
-
|
|
76
|
+
## Catching the duplicate error
|
|
48
77
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
78
|
+
When the unique index trips, MongoDB raises an `E11000 duplicate key
|
|
79
|
+
error`. The plugin does not translate or wrap this — callers should check
|
|
80
|
+
for `err.code === 11000`:
|
|
52
81
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
82
|
+
```js
|
|
83
|
+
new Article({ title: 'Same', body: 'thing' }).save(function (err, doc) {
|
|
84
|
+
if (err && err.code === 11000) {
|
|
85
|
+
return console.log('duplicate; document already exists');
|
|
86
|
+
}
|
|
87
|
+
if (err) return handle(err);
|
|
88
|
+
return console.log('saved:', doc._id);
|
|
56
89
|
});
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Limitations
|
|
93
|
+
|
|
94
|
+
These are known and documented in the characterization test suite:
|
|
57
95
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
96
|
+
- The hash is derived from `JSON.stringify(model.toObject())` — key
|
|
97
|
+
insertion order matters. Two semantically identical documents whose keys
|
|
98
|
+
were set in different orders may hash differently. Don't rely on this
|
|
99
|
+
plugin for cross-system content equivalence.
|
|
100
|
+
- Insert paths that bypass `.save()` (i.e. `Model.insertMany`,
|
|
101
|
+
`Model.collection.insert(…)`, `findOneAndUpdate({…}, {upsert: true})`)
|
|
102
|
+
skip the `pre('save')` hook, so the `sha1_hash` field is never populated
|
|
103
|
+
and duplicates are not blocked on those paths.
|
|
104
|
+
- `dropDups` is forwarded to mongoose for backwards compatibility but is a
|
|
105
|
+
no-op against MongoDB ≥ 3.0.
|
|
106
|
+
|
|
107
|
+
## Tests
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
npm test # offline characterization suite
|
|
111
|
+
npm run test:integration # requires MongoDB at localhost:27017
|
|
112
|
+
```
|
|
65
113
|
|
|
114
|
+
## License
|
|
66
115
|
|
|
67
|
-
|
|
68
|
-
I Added function to fix the problem that loading soft deleted objects when populating properties
|
|
116
|
+
MIT.
|
|
@@ -4,47 +4,65 @@ var mongoose = require('mongoose')
|
|
|
4
4
|
, Query = mongoose.Query
|
|
5
5
|
, crypto = require("crypto");
|
|
6
6
|
var defaultExclude = ["_id"];
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Navigate a dotted path on `obj`, applying `action(token, lastKey)` to
|
|
10
|
+
* the parent of the final segment. Returns false if the path could not
|
|
11
|
+
* be fully resolved (i.e. an intermediate key is missing or non-object).
|
|
12
|
+
*
|
|
13
|
+
* Fix: the original code dereferenced intermediate path keys without a
|
|
14
|
+
* guard and crashed with `Cannot read properties of undefined` whenever
|
|
15
|
+
* a document was missing a key in the middle of a configured nested
|
|
16
|
+
* exclude/include path. This helper makes that case a no-op.
|
|
17
|
+
*/
|
|
18
|
+
function walkDottedPath(obj, dottedKey, action){
|
|
19
|
+
if(dottedKey.indexOf(".") === -1){
|
|
20
|
+
action(obj, dottedKey);
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
var deep = dottedKey.split(".");
|
|
24
|
+
var last = deep.pop();
|
|
25
|
+
var token = obj;
|
|
26
|
+
for(var j = 0; j < deep.length; j++){
|
|
27
|
+
token = token != null ? token[deep[j]] : undefined;
|
|
28
|
+
if(token == null || typeof token !== "object"){
|
|
29
|
+
return false; // intermediate path missing — nothing to do
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
action(token, last);
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
|
|
7
36
|
function hashObject(model, exclude){
|
|
8
|
-
exclude = exclude.concat(defaultExclude);
|
|
37
|
+
exclude = (exclude || []).concat(defaultExclude);
|
|
9
38
|
var obj = model.toObject();
|
|
10
39
|
|
|
11
|
-
for(var i
|
|
40
|
+
for(var i = 0; i < exclude.length; i++){
|
|
12
41
|
var key = exclude[i];
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var token = obj;
|
|
17
|
-
for(var j in deep){
|
|
18
|
-
token = token[deep[j]];
|
|
19
|
-
}
|
|
20
|
-
token[last] = undefined;
|
|
21
|
-
}else{
|
|
22
|
-
obj[key] = undefined;
|
|
23
|
-
}
|
|
42
|
+
walkDottedPath(obj, key, function(parent, lastKey){
|
|
43
|
+
parent[lastKey] = undefined;
|
|
44
|
+
});
|
|
24
45
|
}
|
|
25
46
|
return crypto.createHash('sha1').update(JSON.stringify(obj)).digest('Base64')
|
|
26
47
|
}
|
|
27
48
|
function hashIncludeOnlyObject(model, include){
|
|
28
49
|
var obj = model.toObject();
|
|
29
50
|
var hashObject = {}
|
|
30
|
-
|
|
51
|
+
include = include || [];
|
|
52
|
+
for(var i = 0; i < include.length; i++){
|
|
31
53
|
var key = include[i];
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var token = obj;
|
|
36
|
-
for(var j in deep){
|
|
37
|
-
token = token[deep[j]];
|
|
38
|
-
}
|
|
39
|
-
hashObject[key] = token[last]
|
|
40
|
-
}else{
|
|
41
|
-
hashObject[key] = obj[key];
|
|
42
|
-
}
|
|
54
|
+
walkDottedPath(obj, key, function(parent, lastKey){
|
|
55
|
+
hashObject[key] = parent[lastKey];
|
|
56
|
+
});
|
|
43
57
|
}
|
|
44
58
|
return crypto.createHash('sha1').update(JSON.stringify(hashObject)).digest('Base64')
|
|
45
59
|
}
|
|
46
60
|
module.exports.getPluginWithOptions = function(options){
|
|
47
61
|
|
|
62
|
+
// Fix: tolerate `getPluginWithOptions()` and `getPluginWithOptions({})`
|
|
63
|
+
// rather than crashing on `options.sparse`. exclude/includeOnly fall
|
|
64
|
+
// back to empty arrays so the pre-save hook can run.
|
|
65
|
+
options = options || {};
|
|
48
66
|
options.sparse = options.sparse || false;
|
|
49
67
|
options.dropDups = options.dropDups || false;
|
|
50
68
|
return function(schema) {
|