backbone-orm
Advanced tools
Comparing version 0.0.0 to 0.5.0
{ | ||
"name": "backbone-orm", | ||
"version": "0.0.0", | ||
"license" : "MIT", | ||
"version": "0.5.0", | ||
"description": "A polystore ORM for Node.js and the browser", | ||
"main": "./lib/index.js", | ||
"license": "MIT", | ||
"author": "Kevin Malakoff (https://github.com/kmalakoff)", | ||
"contributors": ["Gwilym Humphreys (https://github.com/gwilymhumphreys)"], | ||
"repository" : { "type" : "git", "url" : "https://github.com/vidigami/backbone-orm"}, | ||
"repository": {"type": "git", "url": "https://bitbucket.org/vidigami/backbone-orm.git"}, | ||
"keywords": ["backbone", "orm", "backbone-orm"], | ||
"engines": {"node": "*"}, | ||
"scripts": { | ||
"test": "npm run build; NODE_ENV=test mocha test/suite.coffee --compilers coffee:coffee-script --reporter spec --timeout 10000", | ||
"docs": "codo -n BackboneORM -a UA-36443094-3 -o docs src/.", | ||
"build": "coffee -o lib -c src", | ||
"watch": "coffee -o lib -w src", | ||
"clean": "rm -rf lib/*", | ||
"prepublish": "npm run build; grunt" | ||
}, | ||
"devDependencies": { | ||
"coffee-script": "*", | ||
"codo": "1.7.x", | ||
"mocha": "*", | ||
"powerset": "0.0.x", | ||
"store-redis": "0.1.x", | ||
"brunch": "*", | ||
"javascript-brunch": "*", | ||
"coffee-script-brunch": "*", | ||
"browserify": "~2.35.0", | ||
"grunt": "0.4.x", | ||
"grunt-cli": "0.1.x", | ||
"grunt-shell": "~0.5.0", | ||
"grunt-wrap": "~0.3.0", | ||
"grunt-contrib-clean": "~0.5.0", | ||
"grunt-contrib-uglify": "~0.2.4", | ||
"grunt-zip": "~0.10.0" | ||
}, | ||
"dependencies": { | ||
"underscore": "*", | ||
"backbone": "*" | ||
"underscore": "1.5.x", | ||
"backbone": "1.1.x", | ||
"moment": "2.0.x", | ||
"inflection": "1.2.x", | ||
"lru-cache": "2.3.x" | ||
} | ||
} | ||
} |
154
README.md
@@ -1,2 +0,152 @@ | ||
backbone-orm | ||
============ | ||
[![Build Status](https://secure.travis-ci.org/vidigami/backbone-orm.png)](http://travis-ci.org/vidigami/backbone-orm) | ||
![logo](https://github.com/vidigami/backbone-orm/raw/master/media/logo.png) | ||
BackboneORM was designed to provide a consistent, polystore ORM across Node.js and the browser. | ||
It was inspired by other great software and provides: | ||
* Node.js-style callbacks and streams for a familiar asynchronous programming style | ||
* MongoDB-like query language to easily slice-and-dice your data | ||
* a REST controller enabling browser search bar queries and an optional paging format like CouchDB | ||
Other great things: | ||
* it provides a JSON-rendering DSL | ||
* it solves the dreaded Node.js circular dependencies problem for related models | ||
* it is compatible with [Knockback.js](http://kmalakoff.github.io/knockback/) | ||
* it parses ISO8601 dates automatically | ||
* BackboneMongo provides a CouchDB-like '_rev' versioning solution | ||
* BackboneREST provides authorization middleware hooks and emits REST events | ||
#### Examples (CoffeeScript) | ||
``` | ||
# Find the Project with id = 123 | ||
Project.findOne {id: 123}, (err, project) -> | ||
# Find the first Project named 'my kickass project' | ||
Project.findOne {name: 'my kickass project'}, (err, project) -> | ||
# Find all items with is_active = true | ||
Project.find {is_active: true}, (err, projects) -> | ||
# Find the items with an id of 1, 2 or 3 | ||
Project.find {id: {$in: [1, 2, 3]}}, (err, projects) -> | ||
# A shortcut for `$in` when we're working with ids | ||
Project.find {$ids: [1, 2, 3]}, (err, projects) -> | ||
# Find active items in pages | ||
Project.find {is_active: true, $limit: 10, $offset: 20}, (err, projects) -> | ||
# Select named properties from each model | ||
Project.find {$select: ['created_at', 'name']}, (err, array_of_json) -> | ||
# Select values in the specified order | ||
Project.find {$values: ['created_at', 'status']}, (err, array_of_arrays) -> | ||
# Find active items in pages using cursor syntax (Models or JSON) | ||
Project.cursor({is_active: true}).limit(10).offset(20).toModels (err, projects) -> | ||
Project.cursor({is_active: true}).limit(10).offset(20).toJSON (err, projects_json) -> | ||
# Find completed tasks in a project | ||
project.cursor('tasks', {status: 'completed'}).sort('name').toModels (err, tasks) -> | ||
# Iterate through all items with is_active = true in batches of 200 | ||
Project.each {is_active: true, $each: {fetch: 200}}, | ||
((project, callback) -> console.log "project: #{project.get('name')}"; callback()), | ||
(err) -> console.log 'Done' | ||
# Stream all items with is_active = true in batches of 200 | ||
Project.stream({is_active: true, $each: {fetch: 200}}) | ||
.pipe(new ModelStringifier()) | ||
.on('finish', -> console.log 'Done') | ||
# Collect the status of tasks over days | ||
stats = [] | ||
Task.interval {$interval: {key: 'created_at', type: 'days', length: 1}}, | ||
((query, info, callback) -> | ||
histogram = new Histogram() | ||
Task.stream(_.extend(query, {$select: ['created_at', 'status']})) | ||
.pipe(histogram) | ||
.on('finish', -> stats.push(histogram.summary()); callback()) | ||
), | ||
(err) -> console.log 'Done' | ||
``` | ||
#### Examples (JavaScript) | ||
``` | ||
// Find the Project with id = 123 | ||
Project.findOne({id: 123}, function(err, project) {}); | ||
// Find the first Project named 'my kickass project' | ||
Project.findOne({name: 'my kickass project'}, function(err, project) {}); | ||
// Find all items with is_active = true | ||
Project.find({is_active: true}, function(err, projects) {}); | ||
// Find the items with an id of 1, 2 or 3 | ||
Project.find({id: {$in: [1, 2, 3]}}, function(err, projects) {}); | ||
// A shortcut for `$in` when we're working with ids | ||
Project.find({$ids: [1, 2, 3]}, function(err, projects) {}); | ||
// Find all items with is_active = true | ||
Project.find({is_active: true, $limit: 10, $offset: 20}, function(err, projects) {}); | ||
// Select named properties from each model | ||
Project.find({$select: ['created_at', 'name']}, function(err, array_of_json) {}); | ||
// Select values in the specified order | ||
Project.find({$values: ['created_at', 'status']}, function(err, array_of_arrays) {}); | ||
// Find active items in pages using cursor syntax (Models or JSON) | ||
Project.cursor({is_active: true}).limit(10).offset(20).toModels function(err, projects) {}); | ||
Project.cursor({is_active: true}).limit(10).offset(20).toJSON function(err, projects_json) {}); | ||
// Find completed tasks in a project sorted by name | ||
project.cursor('tasks', {status: 'completed'}).sort('name').toModels function(err, tasks) {}); | ||
// Iterate through all items with is_active = true in batches of 200 | ||
Project.each({is_active: true, $each: {fetch: 200}}, | ||
function(project, callback) {console.log('project: ' + project.get('name')); callback()}, | ||
function(err) {return console.log('Done');} | ||
); | ||
// Stream all items with is_active = true in batches of 200 | ||
Project.stream({is_active: true, $each: {fetch: 200}}) | ||
.pipe(new ModelStringifier()) | ||
.on('finish', function() {return console.log('Done');}); | ||
var stats = []; | ||
Task.interval({$interval: {key: 'created_at', type: 'days', length: 1}}, | ||
function(query, info, callback) { | ||
var histogram = new Histogram() | ||
Task.stream(_.extend(query, {$select: ['created_at', 'status']})) | ||
.pipe(histogram) | ||
.on('finish', function() {stats.push(histogram.summary()); return callback();}); | ||
}, | ||
function(err) { return console.log('Done'); } | ||
); | ||
``` | ||
Please [checkout the website](http://vidigami.github.io/backbone-orm/) for installation instructions, examples, documentation, and community! | ||
### For Contributors | ||
To build the library for Node.js: | ||
$ npm run build | ||
To build the library for the browser: | ||
$ grunt | ||
Please run tests before submitting a pull request. | ||
$ npm test |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 2 instances in 1 package
2008654
120
23123
1
153
5
16
13
3
+ Addedinflection@1.2.x
+ Addedlru-cache@2.3.x
+ Addedmoment@2.0.x
+ Addedbackbone@1.1.2(transitive)
+ Addedinflection@1.2.7(transitive)
+ Addedlru-cache@2.3.1(transitive)
+ Addedmoment@2.0.0(transitive)
+ Addedunderscore@1.5.2(transitive)
- Removedbackbone@1.6.0(transitive)
- Removedunderscore@1.13.7(transitive)
Updatedbackbone@1.1.x
Updatedunderscore@1.5.x