retold-data-service 1.0.2 → 1.0.4

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.
Files changed (75) hide show
  1. package/.config/configstore/update-notifier-npm-check-updates.json +1 -1
  2. package/.config/configstore/update-notifier-npm.json +7 -1
  3. package/.config/vscode-sqltools/runningInfo.json +13 -0
  4. package/.vscode/launch.json +24 -0
  5. package/.vscode/settings.json +17 -0
  6. package/Dockerfile_LUXURYCode +94 -0
  7. package/README.md +21 -11
  8. package/debug/Harness.js +52 -2
  9. package/debug/bookstore-configuration.json +29 -0
  10. package/debug/data/books.csv +10001 -0
  11. package/debug/model/bookstore-api-endpoint-exercises.paw +0 -0
  12. package/debug/model/manual_scripts/MySQL-Laden-Entry.sh +17 -0
  13. package/debug/model/manual_scripts/MySQL-Security.sql +5 -0
  14. package/debug/model/manual_scripts/my.cnf +4 -0
  15. package/debug/model/sql_create/BookStore-CreateAndPopulateTables.sql +194 -0
  16. package/package.json +58 -41
  17. package/source/Retold-Data-Service.js +152 -288
  18. package/test/RetoldDataService_tests.js +20 -37
  19. package/test/model/fable-configuration.json +16 -0
  20. package/test/model/meadow/README.md +1 -0
  21. package/debug/Build-Database.sh +0 -12
  22. package/debug/Harness-Configuration.json +0 -51
  23. package/debug/model/doc/Dictionary.md +0 -18
  24. package/debug/model/doc/Model-Author.md +0 -20
  25. package/debug/model/doc/Model-Book.md +0 -26
  26. package/debug/model/doc/Model-BookAuthorJoin.md +0 -14
  27. package/debug/model/doc/Model-BookPrice.md +0 -25
  28. package/debug/model/doc/Model-Review.md +0 -22
  29. package/debug/model/doc/ModelChangeTracking.md +0 -17
  30. package/debug/model/doc/diagrams/Relationships.dot +0 -13
  31. package/debug/model/doc/diagrams/Relationships.png +0 -0
  32. package/debug/model/doc/diagrams/RelationshipsFull.dot +0 -13
  33. package/debug/model/doc/diagrams/RelationshipsFull.png +0 -0
  34. package/debug/model/mysql_create/MeadowModel-CreateMySQLDatabase.mysql.sql +0 -116
  35. package/source/Cumulation-Settings-Default.js +0 -19
  36. package/source/Cumulation.js +0 -90
  37. package/source/GraphGet.js +0 -607
  38. package/source/ProviderHelpers/Meadow-Provider-Helper-ALASQL.js +0 -48
  39. package/source/ProviderHelpers/Meadow-Provider-Helper-Base.js +0 -46
  40. package/source/ProviderHelpers/Meadow-Provider-Helper-MySQL.js +0 -62
  41. package/test/basic_test_configurations/fable-config-load_model.json +0 -45
  42. package/test/model/meadow_model/BookStore-PICT.json +0 -1
  43. package/test/model/meadow_model/README.md +0 -1
  44. /package/debug/model/{MeadowModel-Extended.json → Model-Extended.json} +0 -0
  45. /package/debug/model/{MeadowModel-PICT.json → Model-PICT.json} +0 -0
  46. /package/debug/model/{MeadowModel.json → Model.json} +0 -0
  47. /package/debug/{Model.ddl → model/ddl/BookStore.ddl} +0 -0
  48. /package/{test → debug}/model/generated_diagram/README.md +0 -0
  49. /package/{test → debug}/model/generated_diagram/Stricture_Output.dot +0 -0
  50. /package/{test → debug}/model/generated_diagram/Stricture_Output.png +0 -0
  51. /package/{test → debug}/model/generated_documentation/Dictionary.md +0 -0
  52. /package/{test → debug}/model/generated_documentation/Model-Author.md +0 -0
  53. /package/{test → debug}/model/generated_documentation/Model-Book.md +0 -0
  54. /package/{test → debug}/model/generated_documentation/Model-BookAuthorJoin.md +0 -0
  55. /package/{test → debug}/model/generated_documentation/Model-BookPrice.md +0 -0
  56. /package/{test → debug}/model/generated_documentation/Model-Review.md +0 -0
  57. /package/{test → debug}/model/generated_documentation/ModelChangeTracking.md +0 -0
  58. /package/{test → debug}/model/generated_documentation/README.md +0 -0
  59. /package/{test → debug}/model/manual_scripts/DropTables.sql +0 -0
  60. /package/{test → debug}/model/manual_scripts/README.md +0 -0
  61. /package/debug/model/meadow/{MeadowSchemaAuthor.json → Model-MeadowSchema-Author.json} +0 -0
  62. /package/debug/model/meadow/{MeadowSchemaBook.json → Model-MeadowSchema-Book.json} +0 -0
  63. /package/debug/model/meadow/{MeadowSchemaBookAuthorJoin.json → Model-MeadowSchema-BookAuthorJoin.json} +0 -0
  64. /package/debug/model/meadow/{MeadowSchemaBookPrice.json → Model-MeadowSchema-BookPrice.json} +0 -0
  65. /package/debug/model/meadow/{MeadowSchemaReview.json → Model-MeadowSchema-Review.json} +0 -0
  66. /package/{test/model/meadow_schema → debug/model/meadow}/README.md +0 -0
  67. /package/{test → debug}/model/sql_create/BookStore-CreateDatabase.mysql.sql +0 -0
  68. /package/{test → debug}/model/sql_create/README.md +0 -0
  69. /package/test/model/{meadow_model/BookStore-Extended.json → Model-Extended.json} +0 -0
  70. /package/test/model/{meadow_model/BookStore.json → Model.json} +0 -0
  71. /package/test/model/{meadow_schema/BookStore-MeadowSchema-Author.json → meadow/Model-MeadowSchema-Author.json} +0 -0
  72. /package/test/model/{meadow_schema/BookStore-MeadowSchema-Book.json → meadow/Model-MeadowSchema-Book.json} +0 -0
  73. /package/test/model/{meadow_schema/BookStore-MeadowSchema-BookAuthorJoin.json → meadow/Model-MeadowSchema-BookAuthorJoin.json} +0 -0
  74. /package/test/model/{meadow_schema/BookStore-MeadowSchema-BookPrice.json → meadow/Model-MeadowSchema-BookPrice.json} +0 -0
  75. /package/test/model/{meadow_schema/BookStore-MeadowSchema-Review.json → meadow/Model-MeadowSchema-Review.json} +0 -0
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "optOut": false,
3
- "lastUpdateCheck": 1648097783781
3
+ "lastUpdateCheck": 1684953253420
4
4
  }
@@ -1,4 +1,10 @@
1
1
  {
2
2
  "optOut": false,
3
- "lastUpdateCheck": 1648063932373
3
+ "lastUpdateCheck": 1686012350867,
4
+ "update": {
5
+ "latest": "9.6.7",
6
+ "current": "6.14.18",
7
+ "type": "major",
8
+ "name": "npm"
9
+ }
4
10
  }
@@ -0,0 +1,13 @@
1
+ {
2
+ "numericVersion": 10000,
3
+ "releaseNotes": "https://vscode-sqltools.mteixeira.dev/changelog#v-1-0-0",
4
+ "run": 1684959097875,
5
+ "updated": false,
6
+ "version": "1.0.0",
7
+ "lastNotificationDate": 0,
8
+ "installedExtPlugins": {
9
+ "driver": [
10
+ "mtxr.sqltools-driver-mysql"
11
+ ]
12
+ }
13
+ }
@@ -0,0 +1,24 @@
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": "node",
10
+ "request": "launch",
11
+ "outputCapture": "std",
12
+ "cwd": "${workspaceFolder}/debug/",
13
+ "skipFiles": [
14
+ "<node_internals>/**"
15
+ ],
16
+ "program": "${workspaceFolder}/debug/Harness.js",
17
+ "presentation": {
18
+ "hidden": false,
19
+ "group": "",
20
+ "order": 1
21
+ }
22
+ }
23
+ ]
24
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "sqltools.connections": [
3
+ {
4
+ "mysqlOptions": {
5
+ "authProtocol": "default"
6
+ },
7
+ "previewLimit": 50,
8
+ "server": "localhost",
9
+ "port": 3306,
10
+ "driver": "MariaDB",
11
+ "name": "Local",
12
+ "database": "bookstore",
13
+ "username": "root",
14
+ "password": "123456789"
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,94 @@
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
+ COPY ./debug/model/manual_scripts/MySQL-Security.sql /home/coder/MySQL-Configure-Security.sql
60
+ COPY ./debug/model/manual_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 ./debug/model/sql_create/BookStore-CreateDatabase.mysql.sql /home/coder/MySQL-Create-Databases.sql
65
+ COPY ./debug/model/sql_create/BookStore-CreateAndPopulateTables.sql /home/coder/BookStore-CreateAndPopulateTables.sql
66
+ RUN sudo service mariadb restart && sleep 5 && mysql -u root -p"123456789" -e "CREATE DATABASE bookstore;"
67
+ RUN echo "...creating and populating database..."
68
+ RUN sudo service mariadb restart && sleep 5 && mysql -u root -p"123456789" bookstore < /home/coder/MySQL-Create-Databases.sql
69
+ RUN sudo service mariadb restart && sleep 5 && mysql -u root -p"123456789" bookstore < /home/coder/BookStore-CreateAndPopulateTables.sql
70
+ RUN echo "...database creation and population complmete."
71
+
72
+ RUN echo "...mapping library specific volumes..."
73
+
74
+ # Volume mapping for code
75
+ VOLUME /home/coder/retold-data-service
76
+
77
+ SHELL ["/bin/bash", "-c"]
78
+ USER coder
79
+
80
+ RUN echo "...installing node version manager..."
81
+ # Because there is a .bashrc chicken/egg problem, we will create one here to simulate logging in. This is not great.
82
+ RUN touch ~/.bashrc && chmod +x ~/.bashrc
83
+ RUN curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
84
+
85
+ RUN echo "...installing node version 14 as the default..."
86
+ RUN . ~/.nvm/nvm.sh && source ~/.bashrc && nvm install 14
87
+ RUN . ~/.nvm/nvm.sh && source ~/.bashrc && nvm alias default 14
88
+
89
+ WORKDIR /home/coder/retold-data-service
90
+
91
+ # RUN . ~/.nvm/nvm.sh && source ~/.bashrc && npm install
92
+ # RUN . /home/coder/retold-data-service/debug/Bookstore-Import-Books.sh
93
+
94
+ ENTRYPOINT ["/usr/bin/MySQL-Laden-Entry.sh"]
package/README.md CHANGED
@@ -1,27 +1,37 @@
1
1
  # Retold Data Service
2
2
 
3
- Provide a consistent back or mid-tier data service.
3
+ Provide a consistent back or mid-tier data service with boilerplate tooling
4
+ abstracted behind configuration. Leaving a simple mechanism to add complexity
5
+ where desired.
4
6
 
5
7
  ## Basic Usage
6
8
 
7
- This library can run in any of three types of configurations:
9
+ This library is meant to be run in any of three types of configurations:
8
10
 
9
11
  * Configuration Driven
10
12
  * Managed via Backplane Endpoints
11
13
  * Hybrid (configuration plus endpoint)
12
14
 
15
+ Currently only configuration driven mode is implemented.
16
+
13
17
  ## Configuration-Driven Mode
14
18
 
15
- The service looks for a `Retold` stanza in the configuration. For instance:
19
+ By default this service looks in a relative `model/Model-Extended.json` from the CWD
20
+ for the schemas.
16
21
 
17
- ```
18
- {
19
- ...
20
- "Retold": {
21
- "MeadowModel": "./meadow-schema-extended.json"
22
- },
23
- ...
24
- }
22
+ Default configuration:
23
+
24
+ ```js
25
+ {
26
+ FullMeadowSchemaPath: `${process.cwd()}/model/`,
27
+ FullMeadowSchemaFilename: `Model-Extended.json`,
28
+
29
+ DALMeadowSchemaPath: `${process.cwd()}/model/meadow/`,
30
+ DALMeadowSchemaPrefix: `Model-MeadowSchema-`,
31
+ DALMeadowSchemaPostfix: ``,
32
+
33
+ AutoStartOrator: true
34
+ })
25
35
  ```
26
36
 
27
37
  The three auto-configured parameters are:
package/debug/Harness.js CHANGED
@@ -1,3 +1,53 @@
1
- const libRetoldDataService = require('../source/Retold-Data-Service.js');
1
+ const _Settings = require('./bookstore-configuration.json');
2
2
 
3
- const _DataService = new libRetoldDataService(require('./Harness-Configuration.json'));
3
+ const libFable = require('fable');
4
+
5
+ _Fable = new libFable(_Settings);
6
+ let libRetoldDataService = _Fable.serviceManager.addAndInstantiateServiceType('RetoldDataService', require('../source/Retold-Data-Service.js'));
7
+
8
+ libRetoldDataService.onAfterInitializeAsync =
9
+ (fAfterInitializeComplete) =>
10
+ {
11
+ // Create a post operation behavior for the book Read singular record endpoint only
12
+ _Fable.MeadowEndpoints.Book.controller.BehaviorInjection.setBehavior('Read-PostOperation',
13
+ (pRequest, pRequestState, fRequestComplete) =>
14
+ {
15
+ // Get the join records
16
+ _Fable.DAL.BookAuthorJoin.doReads(_Fable.DAL.BookAuthorJoin.query.addFilter('IDBook', pRequestState.Record.IDBook),
17
+ (pJoinReadError, pJoinReadQuery, pJoinRecords)=>
18
+ {
19
+ let tmpAuthorList = [];
20
+ for (let j = 0; j < pJoinRecords.length; j++)
21
+ {
22
+ tmpAuthorList.push(pJoinRecords[j].IDAuthor);
23
+ }
24
+ if (tmpAuthorList.length < 1)
25
+ {
26
+ _Fable.log.trace(`Found no authors for IDBook ${pRequestState.Record.IDBook} (${pRequestState.Record.Title}). What even is a book without authors?`)
27
+ pRequestState.Record.Authors = [];
28
+ return fRequestComplete();
29
+ }
30
+ else
31
+ {
32
+ _Fable.DAL.Author.doReads(_Fable.DAL.Author.query.addFilter('IDAuthor', tmpAuthorList, 'IN'),
33
+ (pReadsError, pReadsQuery, pAuthors)=>
34
+ {
35
+ pRequestState.Record.Authors = pAuthors;
36
+ _Fable.log.info(`Found ${pAuthors.length} authors for IDBook ${pRequestState.Record.IDBook} (${pRequestState.Record.Title}).`)
37
+ return fRequestComplete();
38
+ });
39
+ }
40
+ });
41
+ });
42
+
43
+ return fAfterInitializeComplete();
44
+ };
45
+
46
+ libRetoldDataService.initializeAsync(
47
+ (pError) =>
48
+ {
49
+ if (pError)
50
+ {
51
+ _Fable.log.error(`Error initializing `)
52
+ }
53
+ });
@@ -0,0 +1,29 @@
1
+ {
2
+ "Product": "MeadowEndpointsTestBookStore",
3
+ "ProductVersion": "1.0.0",
4
+
5
+ "UUID":
6
+ {
7
+ "DataCenter": 0,
8
+ "Worker": 0
9
+ },
10
+ "LogStreams":
11
+ [
12
+ {
13
+ "streamtype": "console"
14
+ }
15
+ ],
16
+
17
+ "APIServerPort": 7765,
18
+
19
+ "MySQL":
20
+ {
21
+ "Server": "127.0.0.1",
22
+ "Port": 3306,
23
+ "User": "root",
24
+ "Password": "123456789",
25
+ "Database": "bookstore",
26
+ "ConnectionPoolLimit": 20
27
+ },
28
+ "MeadowConnectionMySQLAutoConnect": true
29
+ }