foxhound 1.0.41 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.config/configstore/update-notifier-npm.json +1 -1
- package/Dockerfile_LUXURYCode +73 -0
- package/dist/foxhound.js +3029 -0
- package/dist/foxhound.min.js +18 -0
- package/dist/foxhound.min.js.map +1 -0
- package/gulpfile.js +83 -0
- package/package.json +17 -8
- package/source/Foxhound-Browser-Shim.js +14 -0
- package/source/dialects/MySQL/FoxHound-Dialect-MySQL.js +12 -3
- package/test/FoxHound-Dialect-ALASQL_tests.js +1 -1
- package/test/FoxHound-Dialect-English_tests.js +1 -1
- package/test/FoxHound-Dialect-MeadowEndpoints_tests.js +1 -1
- package/test/FoxHound-Dialect-MySQL_tests.js +23 -1
- package/test/FoxHound_tests.js +1 -1
- package/Dockerfile +0 -46
package/gulpfile.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// We aren't abstracting this yet but here's the ... "Config"
|
|
4
|
+
const _CONFIG = (
|
|
5
|
+
{
|
|
6
|
+
// The input source file that should be passed to browserify:
|
|
7
|
+
// (if you need to auto-instantiate an object, for instance)
|
|
8
|
+
EntrypointInputSourceFile: `${__dirname}/source/Foxhound-Browser-Shim.js`,
|
|
9
|
+
|
|
10
|
+
// The name of the packaged object to be passed to browserify:
|
|
11
|
+
// (browserify sets this to global scope and window.SOMEOBJECTNAMEHERE where SOMEOBJECTNAMEHERE is the string below)
|
|
12
|
+
LibraryObjectName: `Foxhound`,
|
|
13
|
+
|
|
14
|
+
// The folder to write the library files and maps out to:
|
|
15
|
+
LibraryOutputFolder: `${__dirname}/dist/`,
|
|
16
|
+
|
|
17
|
+
// The name of the unminified version of the packaged library, for easy debugging:
|
|
18
|
+
LibraryUniminifiedFileName: `foxhound.js`,
|
|
19
|
+
|
|
20
|
+
// The name of the minified version of the packaged library, for production release:
|
|
21
|
+
LibraryMinifiedFileName: `foxhound.min.js`
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// ---> Boilerplate Browser Uglification and Packaging <--- \\
|
|
25
|
+
|
|
26
|
+
const libBrowserify = require('browserify');
|
|
27
|
+
const libGulp = require('gulp');
|
|
28
|
+
|
|
29
|
+
const libVinylSourceStream = require('vinyl-source-stream');
|
|
30
|
+
const libVinylBuffer = require('vinyl-buffer');
|
|
31
|
+
|
|
32
|
+
const libSourcemaps = require('gulp-sourcemaps');
|
|
33
|
+
const libGulpUtil = require('gulp-util');
|
|
34
|
+
const libBabel = require('gulp-babel');
|
|
35
|
+
const libTerser = require('gulp-terser');
|
|
36
|
+
|
|
37
|
+
// Build the module for the browser
|
|
38
|
+
libGulp.task('minified',
|
|
39
|
+
() => {
|
|
40
|
+
// set up the custom browserify instance for this task
|
|
41
|
+
var tmpBrowserify = libBrowserify(
|
|
42
|
+
{
|
|
43
|
+
entries: _CONFIG.EntrypointInputSourceFile,
|
|
44
|
+
standalone: _CONFIG.LibraryObjectName,
|
|
45
|
+
debug: true
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
return tmpBrowserify.bundle()
|
|
49
|
+
.pipe(libVinylSourceStream(_CONFIG.LibraryMinifiedFileName))
|
|
50
|
+
.pipe(libVinylBuffer())
|
|
51
|
+
.pipe(libSourcemaps.init({loadMaps: true}))
|
|
52
|
+
// Add transformation tasks to the pipeline here.
|
|
53
|
+
.pipe(libBabel())
|
|
54
|
+
.pipe(libTerser())
|
|
55
|
+
.on('error', libGulpUtil.log)
|
|
56
|
+
.pipe(libSourcemaps.write('./'))
|
|
57
|
+
.pipe(libGulp.dest(_CONFIG.LibraryOutputFolder));
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Build the module for the browser
|
|
61
|
+
libGulp.task('debug',
|
|
62
|
+
() => {
|
|
63
|
+
// set up the custom browserify instance for this task
|
|
64
|
+
var tmpBrowserify = libBrowserify(
|
|
65
|
+
{
|
|
66
|
+
entries: _CONFIG.EntrypointInputSourceFile,
|
|
67
|
+
standalone: _CONFIG.LibraryObjectName,
|
|
68
|
+
debug: true
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
return tmpBrowserify.bundle()
|
|
72
|
+
.pipe(libVinylSourceStream(_CONFIG.LibraryUniminifiedFileName))
|
|
73
|
+
.pipe(libVinylBuffer())
|
|
74
|
+
.pipe(libBabel())
|
|
75
|
+
.on('error', libGulpUtil.log)
|
|
76
|
+
.pipe(libGulp.dest(_CONFIG.LibraryOutputFolder));
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
libGulp.task
|
|
80
|
+
(
|
|
81
|
+
'build',
|
|
82
|
+
libGulp.series('debug', 'minified')
|
|
83
|
+
);
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxhound",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A Database Query generation library.",
|
|
5
5
|
"main": "source/FoxHound.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "node source/FoxHound.js",
|
|
8
|
-
"coverage": "./node_modules/
|
|
8
|
+
"coverage": "./node_modules/.bin/nyc --reporter=lcov --reporter=text-lcov ./node_modules/mocha/bin/_mocha -- -u tdd -R spec",
|
|
9
9
|
"test": "./node_modules/.bin/mocha -u tdd -R spec",
|
|
10
|
-
"
|
|
10
|
+
"build": "./node_modules/.bin/gulp build",
|
|
11
|
+
"docker-dev-build-image": "docker build ./ -f Dockerfile_LUXURYCode -t retold/foxhound:local",
|
|
11
12
|
"docker-dev-run": "docker run -it -d --name foxhound-dev -p 127.0.0.1:12346:8080 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/foxhound\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" retold/foxhound:local"
|
|
12
13
|
},
|
|
13
14
|
"mocha": {
|
|
@@ -44,12 +45,20 @@
|
|
|
44
45
|
},
|
|
45
46
|
"homepage": "https://github.com/stevenvelozo/foxhound",
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
48
|
+
"browserify": "^17.0.0",
|
|
49
|
+
"chai": "4.3.7",
|
|
50
|
+
"gulp": "^4.0.2",
|
|
51
|
+
"gulp-babel": "^8.0.0",
|
|
52
|
+
"gulp-sourcemaps": "^3.0.0",
|
|
53
|
+
"gulp-terser": "^2.1.0",
|
|
54
|
+
"gulp-util": "^3.0.8",
|
|
55
|
+
"mocha": "10.2.0",
|
|
56
|
+
"nyc": "^15.1.0",
|
|
57
|
+
"vinyl-buffer": "^1.0.1",
|
|
58
|
+
"vinyl-source-stream": "^2.0.0"
|
|
50
59
|
},
|
|
51
60
|
"dependencies": {
|
|
52
|
-
"fable": "
|
|
53
|
-
"underscore": "1.13.
|
|
61
|
+
"fable": "^3.0.2",
|
|
62
|
+
"underscore": "1.13.6"
|
|
54
63
|
}
|
|
55
64
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple browser shim loader - assign the npm module to a window global automatically
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @author <steven@velozo.com>
|
|
6
|
+
*/
|
|
7
|
+
var libNPMModuleWrapper = require('./Foxhound.js');
|
|
8
|
+
|
|
9
|
+
if ((typeof(window) === 'object') && !window.hasOwnProperty('Foxhound'))
|
|
10
|
+
{
|
|
11
|
+
window.Foxhound = libNPMModuleWrapper;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = libNPMModuleWrapper;
|
|
@@ -113,12 +113,21 @@ var FoxHoundDialectMySQL = function()
|
|
|
113
113
|
let pFieldNames = pFieldName.split('.');
|
|
114
114
|
if (pFieldNames.length > 1)
|
|
115
115
|
{
|
|
116
|
-
|
|
116
|
+
const cleansedFieldName = cleanseQuoting(pFieldNames[1]);
|
|
117
|
+
if (cleansedFieldName === '*')
|
|
118
|
+
{
|
|
119
|
+
// do not put * as `*`
|
|
120
|
+
return "`" + cleanseQuoting(pFieldNames[0]) + "`.*";
|
|
121
|
+
}
|
|
122
|
+
return "`" + cleanseQuoting(pFieldNames[0]) + "`.`" + cleansedFieldName + "`";
|
|
117
123
|
}
|
|
118
|
-
|
|
124
|
+
const cleansedFieldName = cleanseQuoting(pFieldNames[0]);
|
|
125
|
+
if (cleansedFieldName === '*')
|
|
119
126
|
{
|
|
120
|
-
|
|
127
|
+
// do not put * as `*`
|
|
128
|
+
return '*';
|
|
121
129
|
}
|
|
130
|
+
return "`" + cleanseQuoting(pFieldNames[0]) + "`";
|
|
122
131
|
}
|
|
123
132
|
|
|
124
133
|
/**
|
|
@@ -10,7 +10,7 @@ var Chai = require('chai');
|
|
|
10
10
|
var Expect = Chai.expect;
|
|
11
11
|
var Assert = Chai.assert;
|
|
12
12
|
|
|
13
|
-
var libFable = require('fable')
|
|
13
|
+
var libFable = new (require('fable'))({Product:'FoxhoundTests'});
|
|
14
14
|
var libFoxHound = require('../source/FoxHound.js');
|
|
15
15
|
|
|
16
16
|
var _AnimalSchema = (
|
|
@@ -10,7 +10,7 @@ var Chai = require('chai');
|
|
|
10
10
|
var Expect = Chai.expect;
|
|
11
11
|
var Assert = Chai.assert;
|
|
12
12
|
|
|
13
|
-
var libFable = require('fable')
|
|
13
|
+
var libFable = new (require('fable'))({Product:'FoxhoundTests'});
|
|
14
14
|
var libFoxHound = require('../source/FoxHound.js');
|
|
15
15
|
|
|
16
16
|
suite
|
|
@@ -10,7 +10,7 @@ var Chai = require('chai');
|
|
|
10
10
|
var Expect = Chai.expect;
|
|
11
11
|
var Assert = Chai.assert;
|
|
12
12
|
|
|
13
|
-
var libFable = require('fable')
|
|
13
|
+
var libFable = new (require('fable'))({Product:'FoxhoundTests'});
|
|
14
14
|
var libFoxHound = require('../source/FoxHound.js');
|
|
15
15
|
|
|
16
16
|
var _AnimalSchema = (
|
|
@@ -10,7 +10,7 @@ var Chai = require('chai');
|
|
|
10
10
|
var Expect = Chai.expect;
|
|
11
11
|
var Assert = Chai.assert;
|
|
12
12
|
|
|
13
|
-
var libFable = require('fable')
|
|
13
|
+
var libFable = new (require('fable'))({Product:'FoxhoundTests'});
|
|
14
14
|
var libFoxHound = require('../source/FoxHound.js');
|
|
15
15
|
|
|
16
16
|
var _AnimalSchema = (
|
|
@@ -161,6 +161,28 @@ suite
|
|
|
161
161
|
}
|
|
162
162
|
);
|
|
163
163
|
test
|
|
164
|
+
(
|
|
165
|
+
'Complex Read Query with qualified and unqualified "SELECT *" cases',
|
|
166
|
+
function()
|
|
167
|
+
{
|
|
168
|
+
var tmpQuery = libFoxHound.new(libFable)
|
|
169
|
+
.setDialect('MySQL')
|
|
170
|
+
.setScope('Animal')
|
|
171
|
+
.setCap(10)
|
|
172
|
+
.setBegin(0)
|
|
173
|
+
.setDataElements(['*', 'Name', 'Age', 'Cost', 'Animal.*'])
|
|
174
|
+
.setSort([{Column:'Age',Direction:'Ascending'}])
|
|
175
|
+
.setFilter({Column:'Age',Operator:'=',Value:'15',Connector:'AND',Parameter:'Age'});
|
|
176
|
+
tmpQuery.addSort('Cost');
|
|
177
|
+
// Build the query
|
|
178
|
+
tmpQuery.buildReadQuery();
|
|
179
|
+
// This is the query generated by the MySQL dialect
|
|
180
|
+
libFable.log.trace('Select Query', tmpQuery.query);
|
|
181
|
+
Expect(tmpQuery.query.body)
|
|
182
|
+
.to.equal('SELECT *, `Name`, `Age`, `Cost`, `Animal`.* FROM `Animal` WHERE Age = :Age_w0 ORDER BY Age, Cost LIMIT 0, 10;');
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
test
|
|
164
186
|
(
|
|
165
187
|
'Complex Read Query 2',
|
|
166
188
|
function()
|
package/test/FoxHound_tests.js
CHANGED
|
@@ -10,7 +10,7 @@ var Chai = require('chai');
|
|
|
10
10
|
var Expect = Chai.expect;
|
|
11
11
|
var Assert = Chai.assert;
|
|
12
12
|
|
|
13
|
-
var libFable = require('fable')
|
|
13
|
+
var libFable = new (require('fable'))({Product:'FoxhoundTests'});
|
|
14
14
|
var libFoxHound = require('../source/FoxHound.js');
|
|
15
15
|
|
|
16
16
|
suite
|
package/Dockerfile
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Use the codercom/code-server image
|
|
2
|
-
FROM codercom/code-server:latest
|
|
3
|
-
MAINTAINER steven velozo
|
|
4
|
-
|
|
5
|
-
VOLUME /home/coder/.config
|
|
6
|
-
VOLUME /home/coder/.vscode
|
|
7
|
-
|
|
8
|
-
RUN echo "...installing debian dependencies..."
|
|
9
|
-
RUN sudo apt update
|
|
10
|
-
RUN sudo apt install vim curl tmux -y
|
|
11
|
-
|
|
12
|
-
RUN echo "Building RETOLD development image..."
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
RUN echo "...mapping library specific volumes..."
|
|
16
|
-
# Volume mappings for RETOLD:Foxhound library
|
|
17
|
-
VOLUME /home/coder/foxhound
|
|
18
|
-
# VOLUME /home/coder/foxhound/node_modules
|
|
19
|
-
|
|
20
|
-
RUN echo "...installing vscode extensions..."
|
|
21
|
-
RUN code-server --install-extension hbenl.vscode-mocha-test-adapter \
|
|
22
|
-
code-server --install-extension hbenl.vscode-test-explorer \
|
|
23
|
-
code-server --install-extension hbenl.test-adapter-converter \
|
|
24
|
-
code-server --install-extension cweijan.vscode-mysql-client2 \
|
|
25
|
-
code-server --install-extension daylerees.rainglow \
|
|
26
|
-
code-server --install-extension oderwat.indent-rainbow \
|
|
27
|
-
code-server --install-extension evan-buss.font-switcher \
|
|
28
|
-
code-server --install-extension vscode-icons-team.vscode-icons \
|
|
29
|
-
code-server --install-extension bengreenier.vscode-node-readme \
|
|
30
|
-
code-server --install-extension bierner.color-info \
|
|
31
|
-
code-server --install-extension dbaeumer.vscode-eslint \
|
|
32
|
-
code-server --install-extension PKief.material-icon-theme
|
|
33
|
-
|
|
34
|
-
SHELL ["/bin/bash", "-c"]
|
|
35
|
-
USER coder
|
|
36
|
-
|
|
37
|
-
RUN echo "...installing node version manager..."
|
|
38
|
-
# Because there is a .bashrc chicken/egg problem, we will create one here to simulate logging in. This is not great.
|
|
39
|
-
RUN touch ~/.bashrc && chmod +x ~/.bashrc
|
|
40
|
-
RUN curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
|
|
41
|
-
|
|
42
|
-
RUN echo "...installing node version 14 as the default..."
|
|
43
|
-
RUN . ~/.nvm/nvm.sh && source ~/.bashrc && nvm install 14
|
|
44
|
-
RUN . ~/.nvm/nvm.sh && source ~/.bashrc && nvm alias default 14
|
|
45
|
-
|
|
46
|
-
WORKDIR /home/coder/foxhound
|