retold-harness 1.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/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/Dockerfile_LUXURYCode +92 -0
- package/LICENSE +21 -0
- package/README.md +7 -0
- package/docker_scripts/MySQL-Laden-Entry.sh +19 -0
- package/package.json +49 -0
- package/source/Retold-Harness.js +41 -0
- package/source/configuration-bookstore-serve-api.js +30 -0
- package/source/model/Model-Extended.json +915 -0
- package/source/model/Model-PICT.json +1 -0
- package/source/model/Model.json +280 -0
- package/source/model/bookstore-api-endpoint-exercises.paw +0 -0
- package/source/model/ddl/BookStore.ddl +66 -0
- package/source/model/generated_diagram/README.md +1 -0
- package/source/model/generated_diagram/Stricture_Output.dot +13 -0
- package/source/model/generated_diagram/Stricture_Output.png +0 -0
- package/source/model/generated_documentation/Dictionary.md +18 -0
- package/source/model/generated_documentation/Model-Author.md +20 -0
- package/source/model/generated_documentation/Model-Book.md +26 -0
- package/source/model/generated_documentation/Model-BookAuthorJoin.md +14 -0
- package/source/model/generated_documentation/Model-BookPrice.md +25 -0
- package/source/model/generated_documentation/Model-Review.md +22 -0
- package/source/model/generated_documentation/ModelChangeTracking.md +17 -0
- package/source/model/generated_documentation/README.md +1 -0
- package/source/model/manual_scripts/DropTables.sql +5 -0
- package/source/model/manual_scripts/MySQL-Laden-Entry.sh +17 -0
- package/source/model/manual_scripts/MySQL-Security.sql +5 -0
- package/source/model/manual_scripts/README.md +2 -0
- package/source/model/manual_scripts/my.cnf +4 -0
- package/source/model/meadow/Model-MeadowSchema-Author.json +220 -0
- package/source/model/meadow/Model-MeadowSchema-Book.json +268 -0
- package/source/model/meadow/Model-MeadowSchema-BookAuthorJoin.json +172 -0
- package/source/model/meadow/Model-MeadowSchema-BookPrice.json +260 -0
- package/source/model/meadow/Model-MeadowSchema-Review.json +236 -0
- package/source/model/meadow/README.md +1 -0
- package/source/model/sql_create/BookStore-CreateDatabase.mysql.sql +116 -0
- package/source/model/sql_create/BookStore-DeleteAndRepopulateTables.sql +194 -0
- package/source/model/sql_create/MySQL-Security.sql +5 -0
- package/source/model/sql_create/README.md +1 -0
|
@@ -0,0 +1,92 @@
|
|
|
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 development image..."
|
|
13
|
+
|
|
14
|
+
RUN echo "...installing vscode extensions..."
|
|
15
|
+
|
|
16
|
+
# Mocha unit testing in the sidebar
|
|
17
|
+
RUN code-server --install-extension hbenl.vscode-mocha-test-adapter
|
|
18
|
+
RUN code-server --install-extension hbenl.test-adapter-converter
|
|
19
|
+
RUN code-server --install-extension hbenl.vscode-test-explorer
|
|
20
|
+
|
|
21
|
+
# Magic indentation rainbow
|
|
22
|
+
RUN code-server --install-extension oderwat.indent-rainbow
|
|
23
|
+
RUN code-server --install-extension dbaeumer.vscode-eslint
|
|
24
|
+
|
|
25
|
+
# Contextual git
|
|
26
|
+
RUN code-server --install-extension eamodio.gitlens
|
|
27
|
+
|
|
28
|
+
# Other extensions (uncomment them to have them automagic, or run this from a terminal to install in the container):
|
|
29
|
+
|
|
30
|
+
# SQL Tools
|
|
31
|
+
RUN code-server --install-extension mtxr.sqltools
|
|
32
|
+
RUN code-server --install-extension mtxr.sqltools-driver-mysql
|
|
33
|
+
|
|
34
|
+
# Microsoft's AI code completion
|
|
35
|
+
# RUN code-server --install-extension VisualStudioExptTeam.vscodeintellicode
|
|
36
|
+
|
|
37
|
+
# Live server -- make sure to open up the port on the docker image
|
|
38
|
+
# RUN code-server --install-extension ritwickdey.LiveServer
|
|
39
|
+
|
|
40
|
+
# Quick link to required modules' documentation
|
|
41
|
+
# RUN code-server --install-extension bengreenier.vscode-node-readme
|
|
42
|
+
|
|
43
|
+
# Switch up fonts
|
|
44
|
+
# RUN code-server --install-extension evan-buss.font-switcher
|
|
45
|
+
|
|
46
|
+
# Icons
|
|
47
|
+
# RUN code-server --install-extension vscode-icons-team.vscode-icons
|
|
48
|
+
# RUN code-server --install-extension PKief.material-icon-theme
|
|
49
|
+
|
|
50
|
+
# Hover over CSS colors to see them previewed
|
|
51
|
+
# RUN code-server --install-extension bierner.color-info
|
|
52
|
+
|
|
53
|
+
# An easy on the eyes color theme
|
|
54
|
+
# RUN code-server --install-extension daylerees.rainglow
|
|
55
|
+
|
|
56
|
+
RUN echo "...configuring mariadb (mysql) server...."
|
|
57
|
+
RUN sudo apt install default-mysql-server default-mysql-client -y
|
|
58
|
+
RUN sudo sed -i "s|bind-address|#bind-address|g" /etc/mysql/mariadb.conf.d/50-server.cnf
|
|
59
|
+
ADD ./source/model/sql_create/MySQL-Security.sql /home/coder/MySQL-Configure-Security.sql
|
|
60
|
+
ADD ./docker_scripts/MySQL-Laden-Entry.sh /usr/bin/MySQL-Laden-Entry.sh
|
|
61
|
+
RUN ( sudo mysqld_safe --skip-grant-tables --skip-networking & ) && sleep 5 && mysql -u root < /home/coder/MySQL-Configure-Security.sql
|
|
62
|
+
|
|
63
|
+
# Import the initial database
|
|
64
|
+
COPY ./source/model/sql_create/BookStore-CreateDatabase.mysql.sql /home/coder/MySQL-Create-Databases.sql
|
|
65
|
+
COPY ./source/model/sql_create/BookStore-DeleteAndRepopulateTables.sql /home/coder/MySQL-Repopulate-Databases.sql
|
|
66
|
+
RUN sudo service mariadb restart && sleep 5 && mysql -u root -p"123456789" -e "CREATE DATABASE bookstore;"
|
|
67
|
+
RUN sudo service mariadb restart && sleep 5 && mysql -u root -p"123456789" bookstore < /home/coder/MySQL-Create-Databases.sql
|
|
68
|
+
RUN sudo service mariadb restart && sleep 5 && mysql -u root -p"123456789" bookstore < /home/coder/MySQL-Repopulate-Databases.sql
|
|
69
|
+
|
|
70
|
+
RUN echo "...mapping library specific volumes..."
|
|
71
|
+
|
|
72
|
+
# Volume mapping for code
|
|
73
|
+
VOLUME /home/coder/retold-harness
|
|
74
|
+
|
|
75
|
+
SHELL ["/bin/bash", "-c"]
|
|
76
|
+
USER coder
|
|
77
|
+
|
|
78
|
+
RUN echo "...installing node version manager..."
|
|
79
|
+
# Because there is a .bashrc chicken/egg problem, we will create one here to simulate logging in. This is not great.
|
|
80
|
+
RUN touch ~/.bashrc && chmod +x ~/.bashrc
|
|
81
|
+
RUN curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
|
|
82
|
+
|
|
83
|
+
RUN echo "...installing node version 14 as the default..."
|
|
84
|
+
RUN . ~/.nvm/nvm.sh && source ~/.bashrc && nvm install 14
|
|
85
|
+
RUN . ~/.nvm/nvm.sh && source ~/.bashrc && nvm alias default 14
|
|
86
|
+
|
|
87
|
+
# Install PM2
|
|
88
|
+
RUN . ~/.nvm/nvm.sh && source ~/.bashrc && npm install pm2 -g
|
|
89
|
+
|
|
90
|
+
WORKDIR /home/coder/retold-harness
|
|
91
|
+
|
|
92
|
+
ENTRYPOINT ["/usr/bin/MySQL-Laden-Entry.sh"]
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Steven Velozo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
trap 'kill -TERM $PID' TERM INT
|
|
4
|
+
|
|
5
|
+
/usr/bin/entrypoint.sh --bind-addr "0.0.0.0:8080" . &
|
|
6
|
+
|
|
7
|
+
PID=$!
|
|
8
|
+
|
|
9
|
+
sleep 2
|
|
10
|
+
|
|
11
|
+
sudo service mariadb restart
|
|
12
|
+
|
|
13
|
+
sleep 2
|
|
14
|
+
|
|
15
|
+
wait $PID
|
|
16
|
+
trap - TERM INT
|
|
17
|
+
wait $PID
|
|
18
|
+
EXIT_STATUS=$?
|
|
19
|
+
echo "Service exited with status ${EXIT_STATUS}"
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "retold-harness",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Restful API harness. Serves on 8086.",
|
|
5
|
+
"main": "source/Retold-Harness.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "./node_modules/.bin/mocha -u tdd -R spec",
|
|
8
|
+
"start": "node source/Retold-Harness.js",
|
|
9
|
+
"coverage": "./node_modules/.bin/nyc --reporter=lcov --reporter=text-lcov ./node_modules/mocha/bin/_mocha -- -u tdd -R spec",
|
|
10
|
+
"build": "npx quack build",
|
|
11
|
+
"docker-dev-build": "docker build ./ -f Dockerfile_LUXURYCode -t retold-harness-image:local",
|
|
12
|
+
"docker-dev-run": "docker run -it -d --name retold-harness-dev -p 20001:8080 -p 8086:8086 -p 23306:3306 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/retold-harness\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" retold-harness-image:local",
|
|
13
|
+
"docker-dev-shell": "docker exec -it retold-harness-dev /bin/bash"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/stevenvelozo/retold-harness.git"
|
|
18
|
+
},
|
|
19
|
+
"author": "steven velozo <steven@velozo.com>",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/stevenvelozo/retold-harness/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/stevenvelozo/retold-harness#readme",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"retold-data-service": "^1.0.3"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"quackage": "^1.0.7"
|
|
30
|
+
},
|
|
31
|
+
"mocha": {
|
|
32
|
+
"diff": true,
|
|
33
|
+
"extension": [
|
|
34
|
+
"js"
|
|
35
|
+
],
|
|
36
|
+
"package": "./package.json",
|
|
37
|
+
"reporter": "spec",
|
|
38
|
+
"slow": "75",
|
|
39
|
+
"timeout": "5000",
|
|
40
|
+
"ui": "tdd",
|
|
41
|
+
"watch-files": [
|
|
42
|
+
"source/**/*.js",
|
|
43
|
+
"test/**/*.js"
|
|
44
|
+
],
|
|
45
|
+
"watch-ignore": [
|
|
46
|
+
"lib/vendor"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const _Settings = require('./configuration-bookstore-serve-api.js');
|
|
2
|
+
|
|
3
|
+
const libFable = require('fable');
|
|
4
|
+
|
|
5
|
+
_Fable = new libFable(_Settings);
|
|
6
|
+
_Fable.serviceManager.addServiceType('RetoldDataService', require('retold-data-service'));
|
|
7
|
+
// The RetoldDataService defaults to process.cwd() but we want to run this from wherever.
|
|
8
|
+
_Fable.serviceManager.instantiateServiceProvider('RetoldDataService',
|
|
9
|
+
{
|
|
10
|
+
"FullMeadowSchemaPath": `${__dirname}/model/`,
|
|
11
|
+
"DALMeadowSchemaPath": `${__dirname}/model/meadow/`
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
_Fable.MeadowEndpoints.Book.controller.BehaviorInjection.setBehavior('Read-PostOperation',
|
|
15
|
+
(pRequest, pRequestState, fComplete) =>
|
|
16
|
+
{
|
|
17
|
+
// Get the join records
|
|
18
|
+
_Fable.DAL.BookAuthorJoin.doReads(_Fable.DAL.BookAuthorJoin.query.addFilter('IDBook', pRequestState.Record.IDBook),
|
|
19
|
+
(pJoinReadError, pJoinReadQuery, pJoinRecords)=>
|
|
20
|
+
{
|
|
21
|
+
let tmpAuthorList = [];
|
|
22
|
+
for (let j = 0; j < pJoinRecords.length; j++)
|
|
23
|
+
{
|
|
24
|
+
tmpAuthorList.push(pJoinRecords[j].IDAuthor);
|
|
25
|
+
}
|
|
26
|
+
if (tmpAuthorList.length < 1)
|
|
27
|
+
{
|
|
28
|
+
pRequestState.Record.Authors = [];
|
|
29
|
+
return fComplete();
|
|
30
|
+
}
|
|
31
|
+
else
|
|
32
|
+
{
|
|
33
|
+
_Fable.DAL.Author.doReads(_Fable.DAL.Author.query.addFilter('IDAuthor', tmpAuthorList, 'IN'),
|
|
34
|
+
(pReadsError, pReadsQuery, pAuthors)=>
|
|
35
|
+
{
|
|
36
|
+
pRequestState.Record.Authors = pAuthors;
|
|
37
|
+
return fComplete();
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module.exports = (
|
|
2
|
+
{
|
|
3
|
+
"Product": "MeadowEndpointsTestBookStore",
|
|
4
|
+
"ProductVersion": "1.0.0",
|
|
5
|
+
|
|
6
|
+
"UUID":
|
|
7
|
+
{
|
|
8
|
+
"DataCenter": 0,
|
|
9
|
+
"Worker": 0
|
|
10
|
+
},
|
|
11
|
+
"LogStreams":
|
|
12
|
+
[
|
|
13
|
+
{
|
|
14
|
+
"streamtype": "console"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
|
|
18
|
+
"APIServerPort": 8086,
|
|
19
|
+
|
|
20
|
+
"MySQL":
|
|
21
|
+
{
|
|
22
|
+
"Server": "127.0.0.1",
|
|
23
|
+
"Port": 3306,
|
|
24
|
+
"User": "root",
|
|
25
|
+
"Password": "123456789",
|
|
26
|
+
"Database": "bookstore",
|
|
27
|
+
"ConnectionPoolLimit": 20
|
|
28
|
+
},
|
|
29
|
+
"MeadowConnectionMySQLAutoConnect": true
|
|
30
|
+
});
|