meadow-endpoints 2.0.14 → 2.0.15
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/code-server/config.yaml +4 -0
- package/.config/configstore/update-notifier-npm-check-updates.json +4 -0
- package/.config/configstore/update-notifier-npm.json +4 -0
- package/.github/workflows/test-master.yml +29 -0
- package/.vscode/launch.json +46 -0
- package/Dockerfile +32 -0
- package/README.md +30 -1
- package/{DebugHarness.js → debug/Harness.js} +0 -0
- package/launch.json +46 -0
- package/package.json +25 -6
- package/source/Meadow-Endpoints.js +6 -1
- package/.travis.yml +0 -21
- package/cloud9setup.sh +0 -25
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
2
|
+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
3
|
+
|
|
4
|
+
name: Node.js CI
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [ master ]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [ master ]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
strategy:
|
|
17
|
+
matrix:
|
|
18
|
+
node-version: [10.x, 12.x, 14.x, 16.x]
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v2
|
|
22
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
23
|
+
uses: actions/setup-node@v2
|
|
24
|
+
with:
|
|
25
|
+
node-version: ${{ matrix.node-version }}
|
|
26
|
+
cache: 'npm'
|
|
27
|
+
- run: npm i
|
|
28
|
+
- run: npm test
|
|
29
|
+
- run: npm run coverage
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"name": "Launch Debug Harness",
|
|
9
|
+
"type": "pwa-node",
|
|
10
|
+
"request": "launch",
|
|
11
|
+
"outputCapture": "std",
|
|
12
|
+
"skipFiles": [
|
|
13
|
+
"<node_internals>/**"
|
|
14
|
+
],
|
|
15
|
+
"program": "${workspaceFolder}/debug/Harness.js",
|
|
16
|
+
"presentation": {
|
|
17
|
+
"hidden": false,
|
|
18
|
+
"group": "",
|
|
19
|
+
"order": 1
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "Mocha Tests",
|
|
24
|
+
"args": [
|
|
25
|
+
"-u",
|
|
26
|
+
"tdd",
|
|
27
|
+
"--timeout",
|
|
28
|
+
"999999",
|
|
29
|
+
"--colors",
|
|
30
|
+
"${workspaceFolder}/test"
|
|
31
|
+
],
|
|
32
|
+
"internalConsoleOptions": "openOnSessionStart",
|
|
33
|
+
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
|
|
34
|
+
"request": "launch",
|
|
35
|
+
"skipFiles": [
|
|
36
|
+
"<node_internals>/**"
|
|
37
|
+
],
|
|
38
|
+
"type": "pwa-node",
|
|
39
|
+
"presentation": {
|
|
40
|
+
"hidden": false,
|
|
41
|
+
"group": "",
|
|
42
|
+
"order": 2
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
package/Dockerfile
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
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:Meadow Endpoints library
|
|
17
|
+
VOLUME /home/coder/meadow-endpoints
|
|
18
|
+
# VOLUME /home/coder/meadow-endpoints/node_modules
|
|
19
|
+
|
|
20
|
+
SHELL ["/bin/bash", "-c"]
|
|
21
|
+
USER coder
|
|
22
|
+
|
|
23
|
+
RUN echo "...installing node version manager..."
|
|
24
|
+
# Because there is a .bashrc chicken/egg problem, we will create one here to simulate logging in. This is not great.
|
|
25
|
+
RUN touch ~/.bashrc && chmod +x ~/.bashrc
|
|
26
|
+
RUN curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
|
|
27
|
+
|
|
28
|
+
RUN echo "...installing node version 14 as the default..."
|
|
29
|
+
RUN . ~/.nvm/nvm.sh && source ~/.bashrc && nvm install 14
|
|
30
|
+
RUN . ~/.nvm/nvm.sh && source ~/.bashrc && nvm alias default 14
|
|
31
|
+
|
|
32
|
+
WORKDIR /home/coder/meadow-endpoints
|
package/README.md
CHANGED
|
@@ -16,4 +16,33 @@ The design philosophy is not to cover every possible use case, but to cover the
|
|
|
16
16
|
|
|
17
17
|
To best use this library, it should be in conjunction with [stricture](https://github.com/stevenvelozo/stricture) and [orator](https://github.com/stevenvelozo/orator).
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
### Docker Development Environment
|
|
21
|
+
|
|
22
|
+
1. Run this command to build this image:
|
|
23
|
+
```
|
|
24
|
+
docker build ./ -t retold/meadow-endpoints:local
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
alternatively you can use npm to run this
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
npm run docker-dev-build-image
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
2. Run this command to build the local container:
|
|
34
|
+
```
|
|
35
|
+
docker run -it --name meadow-endpoints-dev -p 127.0.0.1:12343:8080 -v "$PWD/.config:/home/coder/.config" -v "$PWD:/home/coder/meadow-endpoints" -u "$(id -u):$(id -g)" -e "DOCKER_USER=$USER" retold/meadow-endpoints:local
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
alternatively you can use npm to run this
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
npm run docker-dev-run
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
3. Go to http://localhost:12343/ in a web browser
|
|
45
|
+
|
|
46
|
+
4. The password is "retold"
|
|
47
|
+
|
|
48
|
+
5. Right now you (may) need to delete the `node_modules` folders and regenerate it for Linux.
|
|
File without changes
|
package/launch.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"name": "Launch Debug Harness",
|
|
9
|
+
"type": "pwa-node",
|
|
10
|
+
"request": "launch",
|
|
11
|
+
"outputCapture": "std",
|
|
12
|
+
"skipFiles": [
|
|
13
|
+
"<node_internals>/**"
|
|
14
|
+
],
|
|
15
|
+
"program": "${workspaceFolder}/debug/Harness.js",
|
|
16
|
+
"presentation": {
|
|
17
|
+
"hidden": false,
|
|
18
|
+
"group": "",
|
|
19
|
+
"order": 1
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "Mocha Tests",
|
|
24
|
+
"args": [
|
|
25
|
+
"-u",
|
|
26
|
+
"tdd",
|
|
27
|
+
"--timeout",
|
|
28
|
+
"999999",
|
|
29
|
+
"--colors",
|
|
30
|
+
"${workspaceFolder}/test"
|
|
31
|
+
],
|
|
32
|
+
"internalConsoleOptions": "openOnSessionStart",
|
|
33
|
+
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
|
|
34
|
+
"request": "launch",
|
|
35
|
+
"skipFiles": [
|
|
36
|
+
"<node_internals>/**"
|
|
37
|
+
],
|
|
38
|
+
"type": "pwa-node",
|
|
39
|
+
"presentation": {
|
|
40
|
+
"hidden": false,
|
|
41
|
+
"group": "",
|
|
42
|
+
"order": 2
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meadow-endpoints",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.15",
|
|
4
4
|
"description": "Automatic API endpoints for Meadow data.",
|
|
5
5
|
"main": "source/Meadow-Endpoints.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "node source/Meadow-Endpoints.js",
|
|
8
8
|
"coverage": "nyc npm run test && nyc report --reporter=lcov",
|
|
9
|
-
"test": "./node_modules/.bin/mocha --exit -u tdd -R spec"
|
|
9
|
+
"test": "./node_modules/.bin/mocha --exit -u tdd -R spec",
|
|
10
|
+
"docker-dev-build-image": "docker build ./ -t retold/meadow-endpoints:local",
|
|
11
|
+
"docker-dev-run": "docker run -it -d --name meadow-endpoints-dev -p 127.0.0.1:12343:8080 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/meadow-endpoints\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" retold/meadow-endpoints:local"
|
|
12
|
+
},
|
|
13
|
+
"mocha": {
|
|
14
|
+
"diff": true,
|
|
15
|
+
"extension": [
|
|
16
|
+
"js"
|
|
17
|
+
],
|
|
18
|
+
"package": "./package.json",
|
|
19
|
+
"reporter": "spec",
|
|
20
|
+
"slow": "75",
|
|
21
|
+
"timeout": "5000",
|
|
22
|
+
"ui": "tdd",
|
|
23
|
+
"watch-files": [
|
|
24
|
+
"source/**/*.js",
|
|
25
|
+
"test/**/*.js"
|
|
26
|
+
],
|
|
27
|
+
"watch-ignore": [
|
|
28
|
+
"lib/vendor"
|
|
29
|
+
]
|
|
10
30
|
},
|
|
11
31
|
"repository": {
|
|
12
32
|
"type": "git",
|
|
@@ -24,10 +44,10 @@
|
|
|
24
44
|
"homepage": "https://github.com/stevenvelozo/meadow-endpoints",
|
|
25
45
|
"devDependencies": {
|
|
26
46
|
"chai": "4.1.2",
|
|
27
|
-
"
|
|
28
|
-
"coveralls": "3.0.2",
|
|
47
|
+
"chance": "^1.1.8",
|
|
29
48
|
"fable": "^2.0.1",
|
|
30
|
-
"mocha": "
|
|
49
|
+
"mocha": "9.2.2",
|
|
50
|
+
"mysql2": "1.6.1",
|
|
31
51
|
"nyc": "^15.1.0",
|
|
32
52
|
"supertest": "3.1.0"
|
|
33
53
|
},
|
|
@@ -36,7 +56,6 @@
|
|
|
36
56
|
"JSONStream": "^1.3.5",
|
|
37
57
|
"meadow": "~1.0.32",
|
|
38
58
|
"meadow-filter": "^1.0.1",
|
|
39
|
-
"mysql2": "1.6.1",
|
|
40
59
|
"orator": "~2.0.2",
|
|
41
60
|
"underscore": "1.9.1"
|
|
42
61
|
}
|
|
@@ -433,8 +433,13 @@ var MeadowEndpoints = function()
|
|
|
433
433
|
return tmpCallback('Endpoint \'' + pMethod + '\' does not exist!'); //might be better as an exception
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
-
//TODO: should switch depending on type
|
|
436
|
+
// TODO: should switch depending on type
|
|
437
|
+
// TODO: should we keep this around, just make a deep copy of 'pOptions'
|
|
437
438
|
var pRequest = {params: pData, formattedParams: pData, body: pData};
|
|
439
|
+
if (typeof(pOptions) === 'object' && typeof(pOptions.header) === 'function') {
|
|
440
|
+
// carry over header function
|
|
441
|
+
pRequest.header = pOptions.header.bind(pOptions);
|
|
442
|
+
}
|
|
438
443
|
var pResponse = {};
|
|
439
444
|
|
|
440
445
|
libAsync.waterfall([
|
package/.travis.yml
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
language: node_js
|
|
2
|
-
node_js:
|
|
3
|
-
- "8"
|
|
4
|
-
- "10"
|
|
5
|
-
- "12"
|
|
6
|
-
- "14"
|
|
7
|
-
- "15"
|
|
8
|
-
services:
|
|
9
|
-
- mysql
|
|
10
|
-
before_install:
|
|
11
|
-
- mysql -e 'CREATE DATABASE FableTest;'
|
|
12
|
-
addons:
|
|
13
|
-
code_climate:
|
|
14
|
-
repo_token: b0b7492746ebd2075419cab324ea69ab4f444baeb687a1e4cad47e04216af7f6
|
|
15
|
-
after_success:
|
|
16
|
-
- npm run coverage
|
|
17
|
-
after_script:
|
|
18
|
-
- cat coverage/lcov.info | ./node_modules/codeclimate-test-reporter/bin/codeclimate.js
|
|
19
|
-
- cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
|
|
20
|
-
notifications:
|
|
21
|
-
slack: paviateam:C1q99hL9XXpiPpau2PUrVZPC
|
package/cloud9setup.sh
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#! /bin/bash
|
|
2
|
-
echo "Setup a Cloud9 environment for Meadow Endpoints"
|
|
3
|
-
echo "MIT License."
|
|
4
|
-
echo "steven velozo <steven@velozo.com>"
|
|
5
|
-
echo ""
|
|
6
|
-
echo "---"
|
|
7
|
-
echo ""
|
|
8
|
-
echo "## MySQL Parameters exist. Script running!"
|
|
9
|
-
echo "##"
|
|
10
|
-
echo ""
|
|
11
|
-
echo "!! This may be bad to run on anything but a Cloud9 virtual machine !!"
|
|
12
|
-
echo ""
|
|
13
|
-
read -p "Press [Enter] key to configure the environment..."
|
|
14
|
-
echo ""
|
|
15
|
-
echo "## Initializing the Cloud9 database environment..."
|
|
16
|
-
time mysql-ctl start
|
|
17
|
-
echo ""
|
|
18
|
-
echo "## Creating Fable and Meadow databases and users..."
|
|
19
|
-
time mysql-ctl cli < test/scripts/InitializeDatabase-C9.sql
|
|
20
|
-
echo ""
|
|
21
|
-
echo "## Remember to Switch to node 8.x by running these commands..."
|
|
22
|
-
echo "nvm use 8"
|
|
23
|
-
echo "nvm alias default 8"
|
|
24
|
-
echo ""
|
|
25
|
-
echo "## And we're done! Have a great day."
|