meadow-endpoints 3.0.6 → 4.0.2

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 (126) hide show
  1. package/{Dockerfile → Dockerfile_LUXURYCode} +43 -1
  2. package/README.md +48 -14
  3. package/debug/Animal.json +62 -0
  4. package/debug/Harness-Configuration.json +31 -0
  5. package/debug/Harness.js +7 -108
  6. package/debug/KillHarness.sh +10 -0
  7. package/dist/meadowendpoints.js +4402 -0
  8. package/dist/meadowendpoints.min.js +92 -0
  9. package/dist/meadowendpoints.min.js.map +1 -0
  10. package/gulpfile.js +83 -0
  11. package/package.json +29 -16
  12. package/source/Meadow-Endpoints-Browser-Shim.js +14 -0
  13. package/source/Meadow-Endpoints.js +176 -562
  14. package/source/controller/Meadow-Endpoints-Controller-Base.js +161 -0
  15. package/source/controller/components/Meadow-Endpoints-Controller-BehaviorInjection.js +125 -0
  16. package/source/controller/components/Meadow-Endpoints-Controller-Error-StatusCodes.txt +189 -0
  17. package/source/controller/components/Meadow-Endpoints-Controller-Error.js +118 -0
  18. package/source/controller/components/Meadow-Endpoints-Controller-Log.js +103 -0
  19. package/source/controller/utility/Meadow-Endpoints-Filter-Parser.js +225 -0
  20. package/source/controller/utility/Meadow-Endpoints-Session-Marshaler.js +48 -0
  21. package/source/controller/utility/Meadow-Endpoints-Stream-RecordArray.js +66 -0
  22. package/source/endpoints/count/Meadow-Endpoint-Count.js +49 -0
  23. package/source/endpoints/count/Meadow-Endpoint-CountBy.js +40 -0
  24. package/source/endpoints/create/Meadow-Endpoint-BulkCreate.js +53 -0
  25. package/source/endpoints/create/Meadow-Endpoint-Create.js +58 -0
  26. package/source/endpoints/create/Meadow-Operation-Create.js +83 -0
  27. package/source/endpoints/delete/Meadow-Endpoint-Delete.js +93 -0
  28. package/source/endpoints/delete/Meadow-Endpoint-Undelete.js +108 -0
  29. package/source/endpoints/read/Meadow-Endpoint-Read.js +72 -0
  30. package/source/endpoints/read/Meadow-Endpoint-ReadDistinctList.js +92 -0
  31. package/source/endpoints/read/Meadow-Endpoint-ReadLiteList.js +85 -0
  32. package/source/endpoints/read/Meadow-Endpoint-ReadMax.js +55 -0
  33. package/source/endpoints/read/Meadow-Endpoint-ReadSelectList.js +89 -0
  34. package/source/endpoints/read/Meadow-Endpoint-Reads.js +75 -0
  35. package/source/endpoints/read/Meadow-Endpoint-ReadsBy.js +100 -0
  36. package/source/{crud → endpoints/read}/Meadow-Marshal-DistinctList.js +4 -13
  37. package/source/{crud → endpoints/read}/Meadow-Marshal-LiteList.js +5 -14
  38. package/source/endpoints/schema/Meadow-Endpoint-New.js +36 -0
  39. package/source/endpoints/schema/Meadow-Endpoint-Schema.js +36 -0
  40. package/source/endpoints/schema/Meadow-Endpoint-Validate.js +41 -0
  41. package/source/endpoints/update/Meadow-Endpoint-BulkUpdate.js +50 -0
  42. package/source/endpoints/update/Meadow-Endpoint-Update.js +58 -0
  43. package/source/endpoints/update/Meadow-Operation-Update.js +115 -0
  44. package/source/endpoints/upsert/Meadow-Endpoint-BulkUpsert.js +52 -0
  45. package/source/endpoints/upsert/Meadow-Endpoint-Upsert.js +57 -0
  46. package/source/endpoints/upsert/Meadow-Operation-Upsert.js +137 -0
  47. package/test/MeadowEndpoints_basic_tests.js +50 -2375
  48. package/test_support/bookstore-api-endpoint-exercises.paw +0 -0
  49. package/test_support/bookstore-configuration.json +28 -0
  50. package/test_support/bookstore-import-books-run.js +1 -0
  51. package/test_support/bookstore-import-books.js +215 -0
  52. package/test_support/bookstore-serve-meadow-endpoint-apis-IPC.js +138 -0
  53. package/test_support/bookstore-serve-meadow-endpoint-apis-run.js +6 -0
  54. package/test_support/bookstore-serve-meadow-endpoint-apis.js +129 -0
  55. package/test_support/data/books.csv +10001 -0
  56. package/test_support/model/ddl/BookStore.ddl +66 -0
  57. package/test_support/model/generated_diagram/README.md +1 -0
  58. package/test_support/model/generated_diagram/Stricture_Output.dot +13 -0
  59. package/test_support/model/generated_diagram/Stricture_Output.png +0 -0
  60. package/test_support/model/generated_documentation/Dictionary.md +18 -0
  61. package/test_support/model/generated_documentation/Model-Author.md +20 -0
  62. package/test_support/model/generated_documentation/Model-Book.md +26 -0
  63. package/test_support/model/generated_documentation/Model-BookAuthorJoin.md +14 -0
  64. package/test_support/model/generated_documentation/Model-BookPrice.md +25 -0
  65. package/test_support/model/generated_documentation/Model-Review.md +22 -0
  66. package/test_support/model/generated_documentation/ModelChangeTracking.md +17 -0
  67. package/test_support/model/generated_documentation/README.md +1 -0
  68. package/test_support/model/manual_scripts/DropTables.sql +5 -0
  69. package/test_support/model/manual_scripts/README.md +2 -0
  70. package/test_support/model/sql_create/BookStore-CreateDatabase.mysql.sql +116 -0
  71. package/test_support/model/sql_create/README.md +1 -0
  72. package/test_support/test_old/Tests.js +3243 -0
  73. package/test_support/test_old/untitled.js +88 -0
  74. package/source/Meadow-Authenticator.js +0 -31
  75. package/source/Meadow-Authorizers.js +0 -214
  76. package/source/Meadow-BehaviorModifications.js +0 -170
  77. package/source/Meadow-CommonServices.js +0 -206
  78. package/source/Meadow-MarshallSessionData.js +0 -64
  79. package/source/Restify-RouteParser.js +0 -114
  80. package/source/authorizers/Meadow-Authorizer-Allow.js +0 -17
  81. package/source/authorizers/Meadow-Authorizer-Deny.js +0 -17
  82. package/source/authorizers/Meadow-Authorizer-Mine.js +0 -47
  83. package/source/authorizers/Meadow-Authorizer-MyCustomer.js +0 -48
  84. package/source/crud/Meadow-Endpoint-BulkCreate.js +0 -67
  85. package/source/crud/Meadow-Endpoint-BulkUpdate.js +0 -74
  86. package/source/crud/Meadow-Endpoint-BulkUpsert.js +0 -76
  87. package/source/crud/Meadow-Endpoint-Count.js +0 -93
  88. package/source/crud/Meadow-Endpoint-CountBy.js +0 -101
  89. package/source/crud/Meadow-Endpoint-Create.js +0 -77
  90. package/source/crud/Meadow-Endpoint-Delete.js +0 -139
  91. package/source/crud/Meadow-Endpoint-Read.js +0 -109
  92. package/source/crud/Meadow-Endpoint-ReadDistinctList.js +0 -146
  93. package/source/crud/Meadow-Endpoint-ReadLiteList.js +0 -139
  94. package/source/crud/Meadow-Endpoint-ReadMax.js +0 -86
  95. package/source/crud/Meadow-Endpoint-ReadSelectList.js +0 -145
  96. package/source/crud/Meadow-Endpoint-Reads.js +0 -129
  97. package/source/crud/Meadow-Endpoint-ReadsBy.js +0 -155
  98. package/source/crud/Meadow-Endpoint-Update.js +0 -80
  99. package/source/crud/Meadow-Endpoint-Upsert.js +0 -78
  100. package/source/crud/Meadow-Operation-Create.js +0 -105
  101. package/source/crud/Meadow-Operation-Update.js +0 -145
  102. package/source/crud/Meadow-Operation-Upsert.js +0 -106
  103. package/source/crud/Meadow-StreamRecordArray.js +0 -45
  104. package/source/schema/Meadow-Endpoint-New.js +0 -37
  105. package/source/schema/Meadow-Endpoint-Schema.js +0 -37
  106. package/source/schema/Meadow-Endpoint-Validate.js +0 -43
  107. package/test/Animal.json +0 -140
  108. package/test/MeadowEndpoints_disabledAuth_tests.js +0 -1325
  109. package/test/MeadowEndpoints_trustedSession_tests.js +0 -1731
  110. package/test/load/artillery-low.yml +0 -10
  111. package/test/load/cloud9setup.sh +0 -25
  112. package/test/load/package.json +0 -19
  113. package/test/load/test-schema-initializedatabase.sql +0 -29
  114. package/test/load/test-schema.json +0 -119
  115. package/test/load/test-server.js +0 -157
  116. package/test/scripts/InitializeDatabase-C9.sql +0 -7
  117. /package/{test/schemas → test_support/model}/json_schema/BookStore-Extended.json +0 -0
  118. /package/{test/schemas → test_support/model}/json_schema/BookStore-PICT.json +0 -0
  119. /package/{test/schemas → test_support/model}/json_schema/BookStore.json +0 -0
  120. /package/{test/schemas → test_support/model}/json_schema/README.md +0 -0
  121. /package/{test/schemas → test_support/model}/meadow_schema/BookStore-MeadowSchema-Author.json +0 -0
  122. /package/{test/schemas → test_support/model}/meadow_schema/BookStore-MeadowSchema-Book.json +0 -0
  123. /package/{test/schemas → test_support/model}/meadow_schema/BookStore-MeadowSchema-BookAuthorJoin.json +0 -0
  124. /package/{test/schemas → test_support/model}/meadow_schema/BookStore-MeadowSchema-BookPrice.json +0 -0
  125. /package/{test/schemas → test_support/model}/meadow_schema/BookStore-MeadowSchema-Review.json +0 -0
  126. /package/{test/schemas → test_support/model}/meadow_schema/README.md +0 -0
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/Meadow-Endpoints-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: `MeadowEndpoints`,
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: `meadowendpoints.js`,
19
+
20
+ // The name of the minified version of the packaged library, for production release:
21
+ LibraryMinifiedFileName: `meadowendpoints.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,14 +1,18 @@
1
1
  {
2
2
  "name": "meadow-endpoints",
3
- "version": "3.0.6",
3
+ "version": "4.0.2",
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
- "coverage": "nyc npm run test && nyc report --reporter=lcov",
8
+ "harness": "node debug/Harness.js",
9
+ "killharness": "debug/KillHarness.sh",
10
+ "coverage": "./node_modules/.bin/nyc --reporter=lcov --reporter=text-lcov ./node_modules/mocha/bin/_mocha -- -u tdd -R spec",
9
11
  "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 -p 12305:3306 -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
+ "tests": "./node_modules/.bin/mocha -u tdd --exit -R spec --grep",
13
+ "build": "./node_modules/.bin/gulp build",
14
+ "docker-dev-build-image": "docker build ./ -f Dockerfile_LUXURYCode -t retold/meadow-endpoints:local",
15
+ "docker-dev-run": "docker run -it -d --name meadow-endpoints-dev -p 12343:8080 -p 12305:3306 -p 18086:8086 -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
16
  },
13
17
  "mocha": {
14
18
  "diff": true,
@@ -18,7 +22,6 @@
18
22
  "package": "./package.json",
19
23
  "reporter": "spec",
20
24
  "slow": "75",
21
- "timeout": "5000",
22
25
  "ui": "tdd",
23
26
  "watch-files": [
24
27
  "source/**/*.js",
@@ -43,20 +46,30 @@
43
46
  },
44
47
  "homepage": "https://github.com/stevenvelozo/meadow-endpoints",
45
48
  "devDependencies": {
46
- "chai": "4.1.2",
47
- "chance": "^1.1.8",
48
- "fable": "^2.0.1",
49
- "mocha": "9.2.2",
50
- "mysql2": "1.6.1",
49
+ "alasql": "^4.0.0",
50
+ "browserify": "^17.0.0",
51
+ "chai": "4.3.7",
52
+ "chance": "^1.1.11",
53
+ "gulp": "^4.0.2",
54
+ "gulp-babel": "^8.0.0",
55
+ "gulp-sourcemaps": "^3.0.0",
56
+ "gulp-terser": "^2.1.0",
57
+ "gulp-util": "^3.0.8",
58
+ "mocha": "10.2.0",
59
+ "mysql2": "^3.3.1",
51
60
  "nyc": "^15.1.0",
52
- "supertest": "3.1.0"
61
+ "orator-serviceserver-restify": "^1.0.4",
62
+ "papaparse": "^5.4.1",
63
+ "supertest": "^6.3.3",
64
+ "vinyl-buffer": "^1.0.1",
65
+ "vinyl-source-stream": "^2.0.0",
66
+ "why-is-node-running": "^2.2.2"
53
67
  },
54
68
  "dependencies": {
55
- "async": "2.6.1",
69
+ "async": "3.2.4",
70
+ "fable": "^3.0.37",
56
71
  "JSONStream": "^1.3.5",
57
- "meadow": "~1.0.34",
58
- "meadow-filter": "^1.0.1",
59
- "orator": "~2.0.2",
60
- "underscore": "1.12.1"
72
+ "meadow": "^2.0.4",
73
+ "orator": "^3.0.11"
61
74
  }
62
75
  }
@@ -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('./Meadow-Endpoints.js');
8
+
9
+ if ((typeof(window) === 'object') && !window.hasOwnProperty('MeadowEndpoints'))
10
+ {
11
+ window.MeadowEndpoints = libNPMModuleWrapper;
12
+ }
13
+
14
+ module.exports = libNPMModuleWrapper;