{"_id":"@b-flower/bdn-ref","_rev":"2-00dcbd1b296087b59670f4df06b2b66d","name":"@b-flower/bdn-ref","description":"References manager for b-eden env","dist-tags":{"latest":"0.2.3"},"versions":{"0.2.2":{"name":"@b-flower/bdn-ref","description":"References manager for JAB env","author":{"name":"A. Mélon","email":"pastaga@gmail.com"},"keywords":["references","jab","express","mongoose"],"version":"0.2.2","repository":{"type":"git","url":"git+https://github.com/amelon/jab-ref.git"},"bugs":{"url":"https://github.com/amelon/jab-ref/issues"},"dependencies":{"bluebird":"^3.4.6","through2":"^0.4.1"},"devDependencies":{"gulp":"^3.5.5","gulp-util":"^2.2.10","gulp-if":"0.0.3","gulp-rimraf":"^0.0.8"},"engines":{"node":">= 6.0.x"},"main":"index.js","scripts":{"test":"grunt test"},"homepage":"https://github.com/amelon/jab-ref#readme","directories":{"example":"example","test":"test"},"license":"Apache-2.0","gitHead":"897764babe7447f071ec704dab40519f7bcbc3a3","_id":"@b-flower/bdn-ref@0.2.2","_npmVersion":"5.6.0","_nodeVersion":"8.9.3","_npmUser":{"name":"gabchang","email":"dotgab@gmail.com"},"dist":{"integrity":"sha512-3AMZzs7GJTH29+1EpX3ML+T7+SgRmVQv+u89CIh1HN1DinF9eZdK3f83NRyea49ol1rUR9UZ8ACxou2LjTdHHw==","shasum":"be18011b8bf591272a91895e6e7ccd0536e854b8","tarball":"https://registry.npmjs.org/@b-flower/bdn-ref/-/bdn-ref-0.2.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDoVyRP7vauhTDng3B/PjDEYUHzDob5v8EvZE3sCotE3wIgDHtbUAcL5jUg75MM6X45R2/8pdfjvx/xRR1Peg2tt/I="}]},"maintainers":[{"name":"gabchang","email":"dotgab@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bdn-ref-0.2.2.tgz_1517406366675_0.63856763811782"}},"0.2.3":{"name":"@b-flower/bdn-ref","version":"0.2.3","description":"References manager for b-eden env","author":{"name":"A. Mélon","email":"pastaga@gmail.com"},"keywords":["references","jab","express","mongoose"],"repository":{"type":"git","url":"git+https://bitbucket.org/bflower/bdn-ref.git"},"dependencies":{"bluebird":"^3.4.6","through2":"^0.4.1"},"devDependencies":{"gulp":"^3.5.5","gulp-util":"^2.2.10","gulp-if":"0.0.3","gulp-rimraf":"^0.0.8"},"engines":{"node":">= 6.0.x"},"main":"index.js","scripts":{"test":"grunt test"},"homepage":"https://bitbucket.org/bflower/bdn-ref#readme","directories":{"example":"example","test":"test"},"license":"Apache-2.0","gitHead":"45c71f19667cd8f836f7565263f513fdfe40b419","_id":"@b-flower/bdn-ref@0.2.3","_npmVersion":"5.6.0","_nodeVersion":"8.9.3","_npmUser":{"name":"gabchang","email":"dotgab@gmail.com"},"dist":{"integrity":"sha512-Jema8qm4x+4G1ECDANKH8TyzNmDWZtBg0zWNtI1qh6HDwsMyiZNtdI6pIA0+vkBR62jclQV0w5zpcxS/TXbojQ==","shasum":"8166a8bc7131599d72f4c9152dda6b6714a198b7","tarball":"https://registry.npmjs.org/@b-flower/bdn-ref/-/bdn-ref-0.2.3.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCLpIvhaEjFVONvcWkWRLTjS4m9Fvaq9gjKcaZbmh0XZgIgeDC8cDo5xPYhp8zKxultuOv0f9l8g5Zbp9CKz7626BA="}]},"maintainers":[{"name":"kcoulibaly","email":"kcoulibaly@b-flower.com"},{"name":"amelon","email":"paztaga@gmail.com"},{"name":"gabchang","email":"dotgab@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bdn-ref-0.2.3.tgz_1517494199547_0.7420822803396732"}}},"readme":"bdn-ref\n=======\n\nreference manager client/server with task loading\n\nuse [`mongoose`][1], [`Marionette`][2], [`grunt`][3]\n\nclient architecture is based on [`backbonerails`][4]\n\nShort structure\n-------\n### Loading refs\n\n[`grunt`][5] task defined `loadref`\n\n\n### Client side\n\nuse Marionette Application\n\n\n### Server side\n\nuse express node server with [`mongoose`][6] backend\n\n\nUsage\n-------\n### Loading Ref in `MongoDB`\n\n    module.exports = function (grunt) {\n      'use strict';\n\n      require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);\n      grunt.loadNpmTasks('jab-ref');\n\n      grunt.initConfig({\n      , loadref: {\n          options: {\n            mongoose_db: 'mongodb://localhost/jab_ref_test'\n          }\n        , conf: {\n            src: ['config/ref.conf.js']\n          }\n        }\n      });\n\n      grunt.registerTask('test', ['loadref']);\n     };\n\n### Server\n\n    var express = require('express');\n    var app = express();\n    var mongoose = require('mongoose');\n    var config = require('../config/config.js');\n    var path = require('path');\n\n    mongoose.connect(config.db);\n\n    var db = mongoose.connection;\n\n    db.on('error', console.error.bind(console, 'mongoose connection error:'));\n    db.once('open', console.log.bind(console, 'mongoose connection done'));\n\n    app.use(express.logger());\n\n    app.use(app.router);\n\n    app.use(express.static( path.join(__dirname, '..', 'public') ));\n    app.use(express.errorHandler());\n\n    app.listen(config.port, function() {\n      console.log('Running on http://localhost:'+config.port.toString());\n    });\n\n    var ref_ctrl = require('../controllers/ref')(mongoose);\n\n    // use your own routes\n    app.get('/ref/timestamp',   ref_ctrl.timestamp);\n    app.get('/ref',             ref_ctrl.used);\n\n\n### Client\nusing `browserify`\n\n#### First step - initialize Marionette App & load Ref entities\n\n\n    require('./bower_components/jquery');\n    global.underscore = global._ = require('lodash');\n\n    //lodash need manual global registration (or maybe browserify shim ??)\n    global._ = global.underscore = require('lodash');\n    //backbone need manual global registration\n    global.Backbone = require('./bower_components/backbone/backbone.js');\n\n    //marionette needs manual global registration\n    global.Marionette = require('marionette');\n\n    var store = global.store = require('./bower_components/store2/dist/store2.js');\n\n    var App = global.JabberApp = new Backbone.Marionette.Application();\n\n    // see package.json browser key\n    var ref = require('jab-ref')(App, 'ref', store);\n\n#### Second step - init Ref entities\n\n      App.on('initialize:after', function() {\n        App.vent.once('ref:entities:synced', function(refs) {\n          this.startHistory();\n          if (!this.getCurrentRoute()) {\n            this.navigate(this.rootRoute, {trigger: true});\n          }\n        });\n        // ref call - make ajax call or load from localStorage\n        App.execute('ref:entities:init');\n      });\n\n#### Second step - init Ref entities with Deferred\neasier to maintain more than one storage (eg: one for Ref, one, i18n, ...)\n\n      function initRefs() {\n        var q = new $.Deferred();\n        App.addInitializer( function(options) {\n          App.vent.once('ref:entities:synced', function(refs) {\n            q.resolve(true);\n          });\n\n          App.vent.once('ref:entities:error', function() {\n            q.reject();\n          });\n\n          App.execute('ref:entities:init');\n        });\n\n        return q.promise();\n      }\n\n      function initI18n() {\n        var q = new $.Deferred();\n        ...\n        return q.promise();\n      }\n\n      var refs = initRefs(); // promise obj\n      var i18n = initI18n(); // promise obj\n      App.on('initialize:after', function() {\n        $.when(refs , i18n).done(function() {\n          this.startHistory();\n          if (!this.getCurrentRoute()) {\n            this.navigate(this.rootRoute, {trigger: true});\n          }\n        });\n\n        // if refs only you can do\n        // $.when(ref).done(...);\n\n      });\n\n\n## File structure\n\n- assets\n    - entities\n        - `ref.js` : file loaded in client browser application\n    - `test.js` : used to build bundle for `karma` test (should maybe done in test folder directly)\n    - bower_components : list of bower components needed for making tests working (see `test.js` & `bower.json`)\n- config\n    - `config.js` : default config for http server & mongodb conf\n    - `karma.conf.js` : karma config\n    - `ref.conf.js` : sample data for testing grunt load ref task\n- controllers:\n    - `ref.js` : express controller for loading refs in browser\n- models\n    - `ref.js`: mongoose model for ref collection serialization server side\n- public\n    - bundle\n        - `bundle.js` : created by `browserify` grunt task - used for karma test\n- tasks\n    - `load-ref-conf.js`: grunt task for loading `js` file in `mongodb` ref collection\n- test\n\n## Other info\nFor loading jab-ref in the browser, the module expect use of `browserify` in conbination of `package.json` browser key.\n\nvar ref = require('jab-ref');\n\nSee `package.json` [gist][7] and browserify [doc][8] for more info.\n\nIn `package.json` file `browser` key allows this cool stuff:\n\n    \"browser\": \"./assets/entities/ref.js\"\n\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2009-2012 A. Mélon &lt;paztaga@gmail.com&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n  [1]: http://mongoosejs.com/\n  [2]: http://marionettejs.com/\n  [3]: http://gruntjs.com/\n  [4]: http://www.backbonerails.com/\n  [5]: http://gruntjs.com/\n  [6]: http://mongoosejs.com/\n  [7]: https://gist.github.com/defunctzombie/4339901\n  [8]: https://github.com/substack/node-browserify","maintainers":[{"name":"kcoulibaly","email":"kcoulibaly@b-flower.com"},{"name":"amelon","email":"paztaga@gmail.com"},{"name":"gabchang","email":"dotgab@gmail.com"}],"time":{"modified":"2022-04-04T17:23:28.095Z","created":"2018-01-31T13:46:07.804Z","0.2.2":"2018-01-31T13:46:07.804Z","0.2.3":"2018-02-01T14:10:00.524Z"},"homepage":"https://bitbucket.org/bflower/bdn-ref#readme","keywords":["references","jab","express","mongoose"],"repository":{"type":"git","url":"git+https://bitbucket.org/bflower/bdn-ref.git"},"author":{"name":"A. Mélon","email":"pastaga@gmail.com"},"license":"Apache-2.0","readmeFilename":"README.md"}