Skip to content
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
rkt2spc authored Nov 21, 2018
2 parents 951af8f + d8f1bf9 commit 4052f4c
Show file tree
Hide file tree
Showing 16 changed files with 494 additions and 76 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# ╔═╗╔╦╗╦╔╦╗╔═╗╦═╗┌─┐┌─┐┌┐┌┌─┐┬┌─┐
# ║╣ ║║║ ║ ║ ║╠╦╝│ │ ││││├┤ ││ ┬
# o╚═╝═╩╝╩ ╩ ╚═╝╩╚═└─┘└─┘┘└┘└ ┴└─┘
#
# This file (`.editorconfig`) exists to help maintain consistent formatting
# throughout this package, the Sails framework, and the Node-Machine project.
#
# To review what each of these options mean, see:
# http://editorconfig.org/
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,41 @@
# ┌─┐┬┌┬┐╦╔═╗╔╗╔╔═╗╦═╗╔═╗
# │ ┬│ │ ║║ ╦║║║║ ║╠╦╝║╣
# o└─┘┴ ┴ ╩╚═╝╝╚╝╚═╝╩╚═╚═╝
#
# This file (`.gitignore`) exists to signify to `git` that certain files
# and/or directories should be ignored for the purposes of version control.
#
# This is primarily useful for excluding temporary files of all sorts; stuff
# generated by IDEs, build scripts, automated tests, package managers, or even
# end-users (e.g. file uploads). `.gitignore` files like this also do a nice job
# at keeping sensitive credentials and personal data out of version control systems.
#

############################
# npm
############################
node_modules
npm-debug.log


############################
# tmp, editor & OS files
############################
.tmp
*.swo
*.swp
*.swn
*.swm
.DS_STORE
*#
*~
.idea
nbproject


############################
# Tests
############################

# n/a

122 changes: 122 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
// ┬┌─┐╦ ╦╦╔╗╔╔╦╗┬─┐┌─┐
// │└─┐╠═╣║║║║ ║ ├┬┘│
// o└┘└─┘╩ ╩╩╝╚╝ ╩ ┴└─└─┘
//
// This file (`.jshintrc`) exists to help with consistency of code
// throughout this package, and throughout Sails and the Node-Machine project.
//
// To review what each of these options mean, see:
// http://jshint.com/docs/options
//
// (or: https://github.com/jshint/jshint/blob/master/examples/.jshintrc)



//////////////////////////////////////////////////////////////////////
// NOT SUPPORTED IN SOME JSHINT VERSIONS SO LEAVING COMMENTED OUT:
//////////////////////////////////////////////////////////////////////
// Prevent overwriting prototypes of native classes like `Array`.
// (doing this is _never_ ok in any of our packages that are intended
// to be used as dependencies of other developers' modules and apps)
// "freeze": true,
//////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////
// EVERYTHING ELSE:
//////////////////////////////////////////////////////////////////////

// Allow the use of `eval` and `new Function()`
// (we sometimes actually need to use these things)
"evil": true,

// Tolerate funny-looking dashes in RegExp literals.
// (see https://github.com/jshint/jshint/issues/159#issue-903547)
"regexdash": true,

// The potential runtime "Environments" (as defined by jshint)
// that the _style_ of code written in this package should be
// compatible with (not the code itself, of course).
"browser": true,
"node": true,
"wsh": true,

// Tolerate the use `[]` notation when dot notation would be possible.
// (this is sometimes preferable for readability)
"sub": true,

// Do NOT suppress warnings about mixed tabs and spaces
// (two spaces always, please; see `.editorconfig`)
"smarttabs": false,

// Suppress warnings about trailing whitespace
// (this is already enforced by the .editorconfig, so no need to warn as well)
"trailing": false,

// Suppress warnings about the use of expressions where fn calls or assignments
// are expected, and about using assignments where conditionals are expected.
// (while generally a good idea, without this setting, JSHint needlessly lights up warnings
// in existing, working code that really shouldn't be tampered with. Pandora's box and all.)
"expr": true,
"boss": true,

// Do NOT suppress warnings about using functions inside loops
// (in the general case, we should be using iteratee functions with `_.each()`
// or `Array.prototype.forEach()` instead of `for` or `while` statements
// anyway. This warning serves as a helpful reminder.)
"loopfunc": false,

// Suppress warnings about "weird constructions"
// i.e. allow code like:
// ```
// (new (function OneTimeUsePrototype () { } ))
// ```
//
// (sometimes order of operations in JavaScript can be scary. There is
// nothing wrong with using an extra set of parantheses when the mood
// strikes or you get "that special feeling".)
"supernew": true,

// Do NOT allow backwards, node-dependency-style commas.
// (while this code style choice was used by the project in the past,
// we have since standardized these practices to make code easier to
// read, albeit a bit less exciting)
"laxcomma": false,

// Strictly enforce the consistent use of single quotes.
// (this is a convention that was established primarily to make it easier
// to grep [or FIND+REPLACE in Sublime] particular string literals in
// JavaScript [.js] files. Note that JSON [.json] files are, of course,
// still written exclusively using double quotes around key names and
// around string literals.)
"quotmark": "single",

// Do NOT suppress warnings about the use of `==null` comparisons.
// (please be explicit-- use Lodash or `require('util')` and call
// either `.isNull()` or `.isUndefined()`)
"eqnull": false,

// Strictly enforce the use of curly braces with `if`, `else`, and `switch`
// as well as, much less commonly, `for` and `while` statements.
// (this is just so that all of our code is consistent, and to avoid bugs)
"curly": true,

// Strictly enforce the use of `===` and `!==`.
// (this is always a good idea. Check out "Truth, Equality, and JavaScript"
// by Angus Croll [the author of "If Hemmingway Wrote JavaScript"] for more
// explanation as to why.)
"eqeqeq": true,

// Allow initializing variables to `undefined`.
// For more information, see:
// • https://jslinterrors.com/it-is-not-necessary-to-initialize-a-to-undefined
// • https://github.com/jshint/jshint/issues/1484
//
// (it is often very helpful to explicitly clarify the initial value of
// a local variable-- especially for folks new to more advanced JavaScript
// and who might not recognize the subtle, yet critically important differences between our seemingly
// between `null` and `undefined`, and the impact on `typeof` checks)
"-W080": true

}
21 changes: 21 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
*#
node_modules
ssl
.DS_STORE
*.swo
*.swp
*.swn
*.swm
*~
.idea
nbproject
.git
.gitignore
.tmp
.jshintrc
.editorconfig
CONTRIBUTING.md
*.md
**/*.md
test
.github
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
language: node_js

node_js:
- 0.10
- 0.11
- "0.10"
- "0.12"
- "4"
- "5"
- "node"
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Waterline-Sequel Changelog

### 0.6.4

* [ENHANCEMENT] Update any outdated dependencies that may have been causing warnings on install.

* [BUG] Fixes issued where `[undefined]` was being used to select invalid custom primary keys in certain situations.

* [BUG] Add a check to revert to `SELECT *` when the select array is empty to prevent the case where the query gets built with `SELEC`.

* [BUG] Fix case where `attributes` was still being used instead of `definition`.

### 0.6.3

* [ENHANCEMENT] Added newer versions of Node to the Travis test runner.

* [BUG] Fix a bug from a previous commit. See [#91](https://github.com/balderdashy/waterline-sequel/pull/91) for more details. Thanks to [@acekat](https://github.com/acekat) for the patch.

* [STABILITY] Fix to prevent undefined keys from being used. See [95b0a080a9c5010d867a5dca80b7084501f8dad4](https://github.com/balderdashy/waterline-sequel/commit/95b0a080a9c5010d867a5dca80b7084501f8dad4) for more details.

* [BUG] Fix for unknown operators. See [#87](https://github.com/balderdashy/waterline-sequel/pull/87) for more details. Thanks to [@kevinburkeshyp](https://github.com/kevinburkeshyp) for the patch.

### 0.6.2

* [BUG] Fix the second part of the issue from `0.6.0` this time by updating the complex queries. See [#85](https://github.com/balderdashy/waterline-sequel/pull/85) for more details. Thanks again to [@Bazze](https://github.com/Bazze), [@wulfsolter](https://github.com/wulfsolter) and others who helped debug this.

### 0.6.1

* [BUG] Fix an issue when populating the one side of a one-to-many association where virtual attributes were trying to be selected. See [#84](https://github.com/balderdashy/waterline-sequel/pull/84) for more details. Thanks [@Bazze](https://github.com/Bazze) for the issue submission.

### 0.6.0

* [ENHANCEMENT] Add the ability to use projections in join queries. See [#80](https://github.com/balderdashy/waterline-sequel/pull/80) for more details.

### 0.5.7

* [Bug] Actually fixes issue when building criteria with dates instead of causing more issues. See [#79](https://github.com/balderdashy/waterline-sequel/pull/79) for more.
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
.PHONY: test test-unit install test-integration

ROOT=$(shell pwd)

install:
npm install

test: test-unit

test-unit:
Expand All @@ -12,4 +17,4 @@ test-integration:
ln -s $(ROOT) node_modules/sails-postgresql/node_modules/waterline-sequel
rm -rf node_modules/sails-mysql/node_modules/waterline-sequel
ln -s $(ROOT) node_modules/sails-mysql/node_modules/waterline-sequel
@NODE_ENV=test node test/integration/runnerDispatcher.js
@NODE_ENV=test node test/integration/runnerDispatcher.js
31 changes: 27 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,39 @@
Waterline-Sequel
====================
# waterline-sequel

A helper library for generating SQL queries from the Waterline Query Language (see docs on sailsjs.com for more information.)


## Bugs   [![NPM version](https://badge.fury.io/js/waterline-sequel.svg)](http://npmjs.com/package/waterline-sequel)

To report a bug, [click here](http://sailsjs.com/bugs).

> This is a built-in module in `sails-mysql` and `sails-postgresql`, officially-supported adapters in the Sails framework.
## Contributing   [![Build Status](https://travis-ci.org/balderdashy/waterline-sequel.svg?branch=master)](https://travis-ci.org/balderdashy/waterline-sequel)

Please observe the guidelines and conventions laid out in the [Sails project contribution guide](http://sailsjs.com/documentation/contributing) when opening issues or submitting pull requests.

[![NPM package info](https://nodei.co/npm/waterline-sequel.png?downloads=true)](http://npmjs.com/package/waterline-sequel)


build | integration tests | npm | dependencies |
------|-------------------|-----|---------------|
[![Build Status](https://travis-ci.org/balderdashy/waterline-sequel.svg?branch=master)](https://travis-ci.org/balderdashy/waterline-sequel) | [![Circle CI](https://img.shields.io/circleci/project/balderdashy/waterline-sequel/master.svg?style=shield)](https://circleci.com/gh/balderdashy/waterline-sequel/tree/master) | [![npm version](https://badge.fury.io/js/waterline-sequel.svg)](http://badge.fury.io/js/waterline-sequel) | [![Dependency Status](https://david-dm.org/balderdashy/waterline-sequel.svg)](https://david-dm.org/balderdashy/waterline-sequel)

A helper library for generating SQL queries from the Waterline Query Language.

### Running the tests
#### Running the tests
Simply run `npm test`.


#### Integration Tests
You can read more about waterline-sequel integration tests [here](https://github.com/balderdashy/waterline-sequel/blob/master/test/integration/README.md). To run them, do:

```
npm run test-integration
```


## License

> The [Sails framework](http://sailsjs.com) is free and open-source under the [MIT License](http://sailsjs.com/license).
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "waterline-sequel",
"description": "A helper library for generating SQL queries from the Waterline Query Language.",
"version": "0.5.7",
"version": "0.6.4",
"author": "Cody Stoltman <[email protected]>",
"url": "http://github.com/balderdashy/waterline-sequel",
"keywords": [],
Expand All @@ -10,18 +10,18 @@
"url": "git://github.com/balderdashy/waterline-sequel.git"
},
"dependencies": {
"lodash": "3.10.0"
"lodash": "3.10.1"
},
"devDependencies": {
"async": "1.5.2",
"async": "2.0.1",
"chai": "3.5.0",
"jpath": "0.0.20",
"mocha": "2.4.5",
"npm": "2.7.4",
"sails-mysql": "balderdashy/sails-mysql",
"sails-postgresql": "balderdashy/sails-postgresql",
"should": "8.2.1",
"waterline-adapter-tests": "~0.10.17"
"mocha": "3.0.2",
"npm": "2.15.6",
"sails-mysql": "^0.11.5",
"sails-postgresql": "^0.11.4",
"should": "9.0.0",
"waterline-adapter-tests": "^0.12.1"
},
"scripts": {
"test": "make test",
Expand Down
2 changes: 1 addition & 1 deletion sequel/lib/cast.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Query.prototype.cast = function(values) {
var self = this;
var _values = _.clone(values);

Object.keys(values).forEach(function(key) {
_.each(_.keys(values), function(key) {
self.castValue(key, _values[key], _values, self._schema);
});

Expand Down
Loading

0 comments on commit 4052f4c

Please sign in to comment.