orator 3.0.0 → 3.0.3
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/dist/orator.js +986 -0
- package/dist/orator.min.js +135 -0
- package/dist/orator.min.js.map +1 -0
- package/gulpfile.js +83 -0
- package/package.json +5 -3
- package/source/Orator-Browser-Shim.js +14 -0
- package/source/Orator-Default-ServiceServers-Web.js +21 -0
- package/source/Orator-ServiceServer-IPC.js +7 -5
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/Orator-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: `Orator`,
|
|
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: `orator.js`,
|
|
19
|
+
|
|
20
|
+
// The name of the minified version of the packaged library, for production release:
|
|
21
|
+
LibraryMinifiedFileName: `orator.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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orator",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "Unopinionated restful web API server container",
|
|
5
5
|
"main": "source/Orator.js",
|
|
6
6
|
"scripts": {
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
"docker-dev-build-image": "docker build ./ -f Dockerfile_LUXURYCode -t retold/orator:local",
|
|
12
12
|
"docker-dev-run": "docker run -it -d --name retold-orator-dev -p 40000:8080 -p 48086:8086 -p 48088:8088 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/orator\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" retold/orator:local"
|
|
13
13
|
},
|
|
14
|
+
"browser": {
|
|
15
|
+
"./source/Orator-Default-ServiceServers-Node.js": "./source/Orator-Default-ServiceServers-Web.js"
|
|
16
|
+
},
|
|
14
17
|
"repository": {
|
|
15
18
|
"type": "git",
|
|
16
19
|
"url": "https://github.com/stevenvelozo/orator.git"
|
|
@@ -59,8 +62,7 @@
|
|
|
59
62
|
},
|
|
60
63
|
"dependencies": {
|
|
61
64
|
"async": "^3.2.4",
|
|
62
|
-
"
|
|
63
|
-
"fable": "~3.0.2",
|
|
65
|
+
"fable": "~3.0.3",
|
|
64
66
|
"find-my-way": "^7.5.0",
|
|
65
67
|
"orator-serviceserver": "^1.0.1"
|
|
66
68
|
}
|
|
@@ -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('./Orator.js');
|
|
8
|
+
|
|
9
|
+
if ((typeof(window) === 'object') && !window.hasOwnProperty('Orator'))
|
|
10
|
+
{
|
|
11
|
+
window.Orator = libNPMModuleWrapper;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = libNPMModuleWrapper;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default Service Server Function
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
*
|
|
6
|
+
* @author Steven Velozo <steven@velozo.com>
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// Return the servers that are available without extensions loaded
|
|
10
|
+
getDefaultServiceServers = () =>
|
|
11
|
+
{
|
|
12
|
+
let tmpDefaultServiceServers = {};
|
|
13
|
+
|
|
14
|
+
tmpDefaultServiceServers.ipc = require('./Orator-ServiceServer-IPC.js');
|
|
15
|
+
|
|
16
|
+
tmpDefaultServiceServers.default = tmpDefaultServiceServers.ipc;
|
|
17
|
+
|
|
18
|
+
return tmpDefaultServiceServers;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = getDefaultServiceServers();
|
|
@@ -7,7 +7,9 @@ const libOratorServiceServerIPCCustomConstrainer = require('./Orator-ServiceServ
|
|
|
7
7
|
|
|
8
8
|
// This library is the default router for our services
|
|
9
9
|
const libFindMyWay = require('find-my-way');
|
|
10
|
-
const libAsync = require('async');
|
|
10
|
+
//const libAsync = require('async');
|
|
11
|
+
const libAsyncWaterfall = require("async/waterfall");
|
|
12
|
+
const libAsyncEachOfSeries = require('async/eachofseries')
|
|
11
13
|
|
|
12
14
|
class OratorServiceServerIPC extends libOratorServiceServerBase
|
|
13
15
|
{
|
|
@@ -28,7 +30,7 @@ class OratorServiceServerIPC extends libOratorServiceServerBase
|
|
|
28
30
|
|
|
29
31
|
executePreBehaviorFunctions(pRequest, pResponse, fNext)
|
|
30
32
|
{
|
|
31
|
-
|
|
33
|
+
libAsyncEachOfSeries(this.preBehaviorFunctions,
|
|
32
34
|
(fBehaviorFunction, pFunctionIndex, fCallback) =>
|
|
33
35
|
{
|
|
34
36
|
return fBehaviorFunction(pRequest, pResponse, fCallback);
|
|
@@ -45,7 +47,7 @@ class OratorServiceServerIPC extends libOratorServiceServerBase
|
|
|
45
47
|
|
|
46
48
|
executePostBehaviorFunctions(pRequest, pResponse, fNext)
|
|
47
49
|
{
|
|
48
|
-
|
|
50
|
+
libAsyncEachOfSeries(this.postBehaviorFunctions,
|
|
49
51
|
(fBehaviorFunction, pFunctionIndex, fCallback) =>
|
|
50
52
|
{
|
|
51
53
|
return fBehaviorFunction(pRequest, pResponse, fCallback);
|
|
@@ -83,7 +85,7 @@ class OratorServiceServerIPC extends libOratorServiceServerBase
|
|
|
83
85
|
this.router.on(pMethod, pRoute, { constraints: { "ipc": "IPC" } },
|
|
84
86
|
(pRequest, pResponse, pParameters) =>
|
|
85
87
|
{
|
|
86
|
-
|
|
88
|
+
libAsyncWaterfall(
|
|
87
89
|
[
|
|
88
90
|
(fStageComplete)=>
|
|
89
91
|
{
|
|
@@ -97,7 +99,7 @@ class OratorServiceServerIPC extends libOratorServiceServerBase
|
|
|
97
99
|
},
|
|
98
100
|
(fStageComplete)=>
|
|
99
101
|
{
|
|
100
|
-
|
|
102
|
+
libAsyncEachOfSeries(pRouteFunctionArray,
|
|
101
103
|
(fBehaviorFunction, pFunctionIndex, fCallback) =>
|
|
102
104
|
{
|
|
103
105
|
return fBehaviorFunction(pRequest, pResponse, fCallback);
|