Skip to content

Commit

Permalink
use join instead of 'with' due IE's reserved words.
Browse files Browse the repository at this point in the history
  • Loading branch information
endel committed Nov 11, 2014
1 parent 7a59299 commit 688d14c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "hook-javascript",
"description": "Doubleleft API javascript client.",
"version": "0.1.0",
"description": "hook javascript client",
"version": "0.2.1",
"homepage": "https://github.com/doubleleft/hook-javascript",
"main": "./dist/hook.js",
"ignore": [
"src",
"dl-ext",
"hook-ext",
"docs",
"grunt",
"tests",
Expand Down
20 changes: 10 additions & 10 deletions dist/hook.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* hook-javascript v0.1.0
* hook-javascript v0.2.1
* https://github.com/doubleleft/hook-javascript
*
* @copyright 2014 Doubleleft
* @build 11/5/2014
* @build 11/11/2014
*/
(function(window) {
//
Expand Down Expand Up @@ -9917,7 +9917,7 @@ Hook.Client.prototype.getHeaders = function() {
// App authentication request headers
var request_headers = {
'X-App-Id': this.app_id,
'X-App-Key': this.key,
'X-App-Key': this.key
}, auth_token;

// Forward user authentication token, if it is set
Expand Down Expand Up @@ -10606,33 +10606,33 @@ Hook.Collection.prototype.find = function(_id) {

/**
* Set the relationships that should be eager loaded.
* @method with
* @method join
* @param {String} ...
* @return {Hook.Collection}
*
* @example Simple relationship
*
* client.collection('books').with('author').each(function(book) {
* client.collection('books').join('author').each(function(book) {
* console.log("Author: ", book.author.name);
* });
*
* @example Multiple relationships
*
* client.collection('books').with('author', 'publisher').each(function(book) {
* client.collection('books').join('author', 'publisher').each(function(book) {
* console.log("Author: ", book.author.name);
* console.log("Publisher: ", book.publisher.name);
* });
*
* @example Nested relationships
*
* client.collection('books').with('author.contacts').each(function(book) {
* client.collection('books').join('author.contacts').each(function(book) {
* console.log("Author: ", book.author.name);
* console.log("Contacts: ", book.author.contacts);
* });
*
*/
Hook.Collection.prototype.with = function() {
this.options.with = arguments;
Hook.Collection.prototype.join = function() {
this.options['with'] = arguments;
return this;
};

Expand Down Expand Up @@ -11136,7 +11136,7 @@ Hook.Collection.prototype.buildQuery = function() {
aggregation: 'aggr', // min / max / count / avg / sum
operation: 'op', // increment / decrement
data: 'data', // updateAll / firstOrCreate
with: 'with', // relationships
with: 'with', // join / relationships
select: 'select', // fields to return
distinct: 'distinct' // use distinct operation
};
Expand Down
2 changes: 1 addition & 1 deletion dist/hook.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "hook-javascript",
"title": "JavaScript Client for hook",
"description": "JavaScript client to hook",
"version": "0.2.0",
"version": "0.2.1",
"homepage": "http://github.com/doubleleft/hook-javascript",
"main": "dist/hook.js",
"authors": [{
Expand Down
14 changes: 7 additions & 7 deletions src/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,33 +180,33 @@ Hook.Collection.prototype.find = function(_id) {

/**
* Set the relationships that should be eager loaded.
* @method with
* @method join
* @param {String} ...
* @return {Hook.Collection}
*
* @example Simple relationship
*
* client.collection('books').with('author').each(function(book) {
* client.collection('books').join('author').each(function(book) {
* console.log("Author: ", book.author.name);
* });
*
* @example Multiple relationships
*
* client.collection('books').with('author', 'publisher').each(function(book) {
* client.collection('books').join('author', 'publisher').each(function(book) {
* console.log("Author: ", book.author.name);
* console.log("Publisher: ", book.publisher.name);
* });
*
* @example Nested relationships
*
* client.collection('books').with('author.contacts').each(function(book) {
* client.collection('books').join('author.contacts').each(function(book) {
* console.log("Author: ", book.author.name);
* console.log("Contacts: ", book.author.contacts);
* });
*
*/
Hook.Collection.prototype.with = function() {
this.options.with = arguments;
Hook.Collection.prototype.join = function() {
this.options['with'] = arguments;
return this;
};

Expand Down Expand Up @@ -710,7 +710,7 @@ Hook.Collection.prototype.buildQuery = function() {
aggregation: 'aggr', // min / max / count / avg / sum
operation: 'op', // increment / decrement
data: 'data', // updateAll / firstOrCreate
with: 'with', // relationships
'with': 'with', // join / relationships
select: 'select', // fields to return
distinct: 'distinct' // use distinct operation
};
Expand Down
2 changes: 1 addition & 1 deletion src/core/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ Hook.Client.prototype.getHeaders = function() {
// App authentication request headers
var request_headers = {
'X-App-Id': this.app_id,
'X-App-Key': this.key,
'X-App-Key': this.key
}, auth_token;

// Forward user authentication token, if it is set
Expand Down
2 changes: 1 addition & 1 deletion tests/collections/relationship.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// asyncTest("Collection: Querying relationships", function() {
// client.collection('posts').with('author').then(function(posts) {
// client.collection('posts').join('author').then(function(posts) {
// for (var i=0; i < posts.length; i++) {
// posts[i].author
// }
Expand Down

0 comments on commit 688d14c

Please sign in to comment.