couchdb-emily-tools
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "couchdb-emily-tools", | ||
"description": "CouchDB Tools for Emily&Olives applications", | ||
"version": "1.0.4", | ||
"description": "Complete set of tools for synchronizing an observable key/value stores with CouchDB documents, views, and managing users or security documents. Works both in the browser and in node.js", | ||
"version": "1.0.5", | ||
"homepage": "http://flams.github.com/CouchDB-emily-tools/", | ||
@@ -21,3 +21,3 @@ "licenses": [{ | ||
}, | ||
"keywords": ["CouchDB", "Emily", "Olives", "Tools"], | ||
"keywords": ["CouchDB", "Emily", "Olives", "Tools", "browser", "views", "documents", "synchronize", "login", "security"], | ||
"repository": { | ||
@@ -24,0 +24,0 @@ "type": "git", |
@@ -5,5 +5,5 @@ #CouchDB-emily-tools | ||
Changelog is available here: https://github.com/flams/CouchDB-emily-tools/blob/master/CHANGELOG.md | ||
##To install and use the library on the server side only: | ||
###To install and use the library on the server side: | ||
CouchDB-emily-tools requires Emily to work on the server side | ||
@@ -36,7 +36,26 @@ ```bash | ||
###To install and use the library on the client side: | ||
##To install and use the library on the client side: | ||
place the CouchDBTools.js file into your project alongside Olives, Require.js, and socket.io | ||
Using it on the client side requires Olives.js's socketIOTransport which will bind itself with Emily's. | ||
CouchDB-emily-tools requires Olives to work on the client side. Olives embedds Emily for you. | ||
It also expects you to have socket.io installed, and a store for storing sessions, like redis store. | ||
In future implementations, redis store will probably be optional and an adapter will be accepted to any other store. | ||
[An example can be found in the suggestions application](https://github.com/podefr/suggestions/blob/master/server.js) | ||
```bash | ||
npm install olives couchdb-emily-tools | ||
``` | ||
```js | ||
var olives = require("olives"), | ||
tools = require("couchdb-emily-tools"); | ||
// sessionStore can be a new RedisStore for instance | ||
CouchDBTools.configuration.sessionStore = sessionStore; | ||
// Add the CouchDB handler to Olives | ||
olives.handlers.set("CouchDB", tools.handler); | ||
``` | ||
And on the client side: | ||
```html | ||
@@ -51,18 +70,46 @@ <scirpt src="requirejs.js" /> | ||
```js | ||
requirejs(["CouchDBStore", "SocketIOTransport"], function (CouchDBStore, SocketIOTransport) { | ||
requirejs(["CouchDBStore", "SocketIOTransport"], function (CouchDBStore, SocketIOTransport) { | ||
var cdb = new CouchDBStore, | ||
transport = new Transport(io, location.href); | ||
var socket = io.connect("http://localhost"), | ||
cdb = new CouchDBStore, | ||
transport = new SocketIOTransport(socket); | ||
cdb.setTransport(transport); | ||
cdb.setTransport(transport); | ||
cdb.sync("mydatabase", "mydocument") | ||
.then(function () { | ||
console.log(cdb.toJSON()); | ||
}); | ||
cdb.sync("mydatabase", "mydocument") | ||
.then(function () { | ||
console.log(cdb.toJSON()); | ||
}); | ||
}); | ||
``` | ||
## Changelog | ||
###1.0.5 - 25 MAR 2014 | ||
* Removed specific code imported from another application after 1.0.2 | ||
* Updated documentation | ||
###1.0.3 - 11 MAR 2013 | ||
* Updated emily + requirejs | ||
###1.0.2 - 01 JAN 2013 | ||
* Now using Emily 1.3.1 promises wich are fully compliant with promise/A+ specs | ||
* Moved Emily's CouchDB handler to CouchDB Emily Tools | ||
* Updated tests | ||
###1.0.1 - 08 OCT 2012 | ||
* CouchDBStore Views are compatible with couchdb-lucene's | ||
###1.0.0 - 07 OCT 2012 | ||
* CouchDBStore was removed from Emily and added to CouchDB-Emily-Tools. | ||
* It's now a library by itself, as it concentrates more work than the rest of Emily. | ||
@@ -17,3 +17,4 @@ /** | ||
hostname: "localhost", | ||
port: 5984 | ||
port: 5984, | ||
cookieID: '' | ||
}, | ||
@@ -47,3 +48,3 @@ | ||
if (data.handshake) { | ||
if (data.handshake && configuration.cookieID) { | ||
@@ -53,3 +54,3 @@ var cookieJSON = cookie.parse(data.handshake.headers.cookie); | ||
// I don't like the split but is there a better solution? | ||
configuration.sessionStore.get(cookieJSON["suggestions.sid"].split("s:")[1].split(".")[0], function (err, session) { | ||
configuration.sessionStore.get(cookieJSON[configuration.cookieID].split("s:")[1].split(".")[0], function (err, session) { | ||
if (err) { | ||
@@ -56,0 +57,0 @@ throw new Error(err); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73260
1000
113