fable 3.0.39 → 3.0.40
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/.browserslistrc +1 -1
- package/.config/configstore/update-notifier-npm.json +1 -7
- package/.config/vscode-sqltools/runningInfo.json +1 -1
- package/Dockerfile_LUXURYCode +1 -1
- package/dist/fable.compatible.js +6 -3
- package/dist/fable.compatible.min.js +1 -1
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +6 -3
- package/dist/fable.min.js +1 -1
- package/dist/fable.min.js.map +1 -1
- package/gulpfile-config.json +2 -2
- package/package.json +2 -2
- package/source/services/Fable-Service-RestClient.js +26 -12
- package/test/Manifest_tests.js +0 -3
- package/test/RestClient_test.js +6 -0
package/gulpfile-config.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fable",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.40",
|
|
4
4
|
"description": "An entity behavior management and API bundling library.",
|
|
5
5
|
"main": "source/Fable.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"test": "./node_modules/.bin/mocha -u tdd -R spec",
|
|
10
10
|
"build": "./node_modules/.bin/gulp build",
|
|
11
11
|
"build-compatible": "GULP_CUSTOM_BUILD_TARGET=compatible ./node_modules/.bin/gulp build",
|
|
12
|
-
"docker-dev-build
|
|
12
|
+
"docker-dev-build": "docker build ./ -f Dockerfile_LUXURYCode -t retold/fable:local",
|
|
13
13
|
"docker-dev-run": "docker run -it -d --name retold-fable-dev -p 30001:8080 -p 8086:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/fable\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" retold/fable:local",
|
|
14
14
|
"docker-dev-shell": "docker exec -it retold-fable-dev /bin/bash"
|
|
15
15
|
},
|
|
@@ -17,18 +17,30 @@ class FableServiceRestClient extends libFableServiceBase
|
|
|
17
17
|
this.dataFormat = this.fable.defaultServices.DataFormat;
|
|
18
18
|
|
|
19
19
|
this.serviceType = 'RestClient';
|
|
20
|
+
|
|
21
|
+
// This is a function that can be overridden, to allow the management
|
|
22
|
+
// of the request options before they are passed to the request library.
|
|
23
|
+
this.prepareRequestOptions = (pOptions) => { return pOptions; };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
preRequest(pOptions)
|
|
27
|
+
{
|
|
28
|
+
// Validate the options object
|
|
29
|
+
return this.prepareRequestOptions(pOptions);
|
|
20
30
|
}
|
|
21
31
|
|
|
22
32
|
executeChunkedRequest(pOptions, fCallback)
|
|
23
33
|
{
|
|
24
|
-
|
|
34
|
+
let tmpOptions = this.preRequest(pOptions);
|
|
35
|
+
|
|
36
|
+
tmpOptions.RequestStartTime = this.fable.log.getTimeStamp();
|
|
25
37
|
|
|
26
38
|
if (this.TraceLog)
|
|
27
39
|
{
|
|
28
|
-
this.fable.log.debug(`Beginning ${
|
|
40
|
+
this.fable.log.debug(`Beginning ${tmpOptions.method} request to ${tmpOptions.url} at ${tmpOptions.RequestStartTime}`);
|
|
29
41
|
}
|
|
30
42
|
|
|
31
|
-
return libSimpleGet(
|
|
43
|
+
return libSimpleGet(tmpOptions,
|
|
32
44
|
(pError, pResponse)=>
|
|
33
45
|
{
|
|
34
46
|
if (pError)
|
|
@@ -39,7 +51,7 @@ class FableServiceRestClient extends libFableServiceBase
|
|
|
39
51
|
if (this.TraceLog)
|
|
40
52
|
{
|
|
41
53
|
let tmpConnectTime = this.fable.log.getTimeStamp();
|
|
42
|
-
this.fable.log.debug(`--> ${
|
|
54
|
+
this.fable.log.debug(`--> ${tmpOptions.method} connected in ${this.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime, tmpConnectTime)}ms code ${pResponse.statusCode}`);
|
|
43
55
|
}
|
|
44
56
|
|
|
45
57
|
let tmpData = '';
|
|
@@ -50,7 +62,7 @@ class FableServiceRestClient extends libFableServiceBase
|
|
|
50
62
|
if (this.TraceLog)
|
|
51
63
|
{
|
|
52
64
|
let tmpChunkTime = this.fable.log.getTimeStamp();
|
|
53
|
-
this.fable.log.debug(`--> ${
|
|
65
|
+
this.fable.log.debug(`--> ${tmpOptions.method} data chunk size ${pChunk.length}b received in ${this.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime, tmpChunkTime)}ms`);
|
|
54
66
|
}
|
|
55
67
|
tmpData += pChunk;
|
|
56
68
|
});
|
|
@@ -60,7 +72,7 @@ class FableServiceRestClient extends libFableServiceBase
|
|
|
60
72
|
if (this.TraceLog)
|
|
61
73
|
{
|
|
62
74
|
let tmpCompletionTime = this.fable.log.getTimeStamp();
|
|
63
|
-
this.fable.log.debug(`==> ${
|
|
75
|
+
this.fable.log.debug(`==> ${tmpOptions.method} completed data size ${tmpData.length}b received in ${this.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime, tmpCompletionTime)}ms`);
|
|
64
76
|
}
|
|
65
77
|
return fCallback(pError, pResponse, tmpData);
|
|
66
78
|
});
|
|
@@ -71,14 +83,16 @@ class FableServiceRestClient extends libFableServiceBase
|
|
|
71
83
|
{
|
|
72
84
|
pOptions.json = true;
|
|
73
85
|
|
|
74
|
-
|
|
86
|
+
let tmpOptions = this.preRequest(pOptions);
|
|
87
|
+
|
|
88
|
+
tmpOptions.RequestStartTime = this.fable.log.getTimeStamp();
|
|
75
89
|
|
|
76
90
|
if (this.TraceLog)
|
|
77
91
|
{
|
|
78
|
-
this.fable.log.debug(`Beginning ${
|
|
92
|
+
this.fable.log.debug(`Beginning ${tmpOptions.method} JSON request to ${tmpOptions.url} at ${tmpOptions.RequestStartTime}`);
|
|
79
93
|
}
|
|
80
94
|
|
|
81
|
-
return libSimpleGet(
|
|
95
|
+
return libSimpleGet(tmpOptions,
|
|
82
96
|
(pError, pResponse)=>
|
|
83
97
|
{
|
|
84
98
|
if (pError)
|
|
@@ -89,7 +103,7 @@ class FableServiceRestClient extends libFableServiceBase
|
|
|
89
103
|
if (this.TraceLog)
|
|
90
104
|
{
|
|
91
105
|
let tmpConnectTime = this.fable.log.getTimeStamp();
|
|
92
|
-
this.fable.log.debug(`--> JSON ${
|
|
106
|
+
this.fable.log.debug(`--> JSON ${tmpOptions.method} connected in ${this.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime, tmpConnectTime)}ms code ${pResponse.statusCode}`);
|
|
93
107
|
}
|
|
94
108
|
|
|
95
109
|
pResponse.on('data', (pChunk) =>
|
|
@@ -97,7 +111,7 @@ class FableServiceRestClient extends libFableServiceBase
|
|
|
97
111
|
if (this.TraceLog)
|
|
98
112
|
{
|
|
99
113
|
let tmpChunkTime = this.fable.log.getTimeStamp();
|
|
100
|
-
this.fable.log.debug(`--> JSON ${
|
|
114
|
+
this.fable.log.debug(`--> JSON ${tmpOptions.method} data chunk size ${pChunk.length}b received in ${this.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime, tmpChunkTime)}ms`);
|
|
101
115
|
}
|
|
102
116
|
// In a JSON request, the chunk is the serialized method.
|
|
103
117
|
return fCallback(pError, pResponse, JSON.parse(pChunk));
|
|
@@ -108,7 +122,7 @@ class FableServiceRestClient extends libFableServiceBase
|
|
|
108
122
|
if (this.TraceLog)
|
|
109
123
|
{
|
|
110
124
|
let tmpCompletionTime = this.fable.log.getTimeStamp();
|
|
111
|
-
this.fable.log.debug(`==> JSON ${
|
|
125
|
+
this.fable.log.debug(`==> JSON ${tmpOptions.method} completed - received in ${this.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime, tmpCompletionTime)}ms`);
|
|
112
126
|
}
|
|
113
127
|
});
|
|
114
128
|
});
|
package/test/Manifest_tests.js
CHANGED
package/test/RestClient_test.js
CHANGED
|
@@ -57,6 +57,12 @@ suite
|
|
|
57
57
|
// Instantiate the RestClient Service Provider
|
|
58
58
|
let tmpRestClient = testFable.serviceManager.instantiateServiceProvider('RestClient', {TraceLog: true}, 'RestClient-99');
|
|
59
59
|
|
|
60
|
+
tmpRestClient.prepareRequestOptions = (pOptions) =>
|
|
61
|
+
{
|
|
62
|
+
pOptions.headers = {'Content-Type':'application/json'};
|
|
63
|
+
return pOptions;
|
|
64
|
+
};
|
|
65
|
+
|
|
60
66
|
// Download the wiktionary entry for dog!
|
|
61
67
|
tmpRestClient.postJSON({url: 'http://localhost:8086/1.0/Author', body:{Name:'Test Author'}},
|
|
62
68
|
(pError, pResponse, pBody)=>
|