orator 3.0.9 → 3.0.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orator",
3
- "version": "3.0.9",
3
+ "version": "3.0.11",
4
4
  "description": "Unopinionated restful web API server container",
5
5
  "main": "source/Orator.js",
6
6
  "scripts": {
@@ -82,7 +82,7 @@ class OratorServiceServerBase
82
82
 
83
83
  return true;
84
84
  }
85
-
85
+
86
86
  doGet(pRoute, ...fRouteProcessingFunctions)
87
87
  {
88
88
  return true;
@@ -130,8 +130,7 @@ class OratorServiceServerBase
130
130
  this.log.error(`Orator POST Route mapping failed -- route parameter was ${typeof(pRoute)} instead of a string.`)
131
131
  return false;
132
132
  }
133
-
134
- return true;
133
+ return this.doPost(pRoute, ...fRouteProcessingFunctions);
135
134
  }
136
135
  postWithBodyParser(pRoute, ...fRouteProcessingFunctions)
137
136
  {
@@ -149,14 +148,17 @@ class OratorServiceServerBase
149
148
  this.log.error(`Orator DEL Route mapping failed -- route parameter was ${typeof(pRoute)} instead of a string.`)
150
149
  return false;
151
150
  }
152
-
153
- return true;
151
+ return this.doDel(pRoute, ...fRouteProcessingFunctions);
154
152
  }
155
153
  delWithBodyParser(pRoute, ...fRouteProcessingFunctions)
156
154
  {
157
155
  return this.del(pRoute, this.bodyParser(), ...fRouteProcessingFunctions);
158
156
  }
159
157
 
158
+ doPatch(pRoute, ...fRouteProcessingFunctions)
159
+ {
160
+ return true;
161
+ }
160
162
  patch(pRoute, ...fRouteProcessingFunctions)
161
163
  {
162
164
  if (typeof(pRoute) != 'string')
@@ -164,15 +166,17 @@ class OratorServiceServerBase
164
166
  this.log.error(`Orator PATCH Route mapping failed -- route parameter was ${typeof(pRoute)} instead of a string.`)
165
167
  return false;
166
168
  }
167
-
168
- return true;
169
+ return this.doPatch(pRoute, ...fRouteProcessingFunctions);
169
170
  }
170
171
  patchWithBodyParser(pRoute, ...fRouteProcessingFunctions)
171
172
  {
172
173
  return this.patch(pRoute, this.bodyParser(), ...fRouteProcessingFunctions);
173
174
  }
174
175
 
175
-
176
+ doOpts(pRoute, ...fRouteProcessingFunctions)
177
+ {
178
+ return true;
179
+ }
176
180
  opts(pRoute, ...fRouteProcessingFunctions)
177
181
  {
178
182
  if (typeof(pRoute) != 'string')
@@ -180,15 +184,17 @@ class OratorServiceServerBase
180
184
  this.log.error(`Orator OPTS Route mapping failed -- route parameter was ${typeof(pRoute)} instead of a string.`)
181
185
  return false;
182
186
  }
183
-
184
- return true;
187
+ return this.doOpts(pRoute, ...fRouteProcessingFunctions);
185
188
  }
186
189
  optsWithBodyParser(pRoute, ...fRouteProcessingFunctions)
187
190
  {
188
191
  return this.opts(pRoute, this.bodyParser(), ...fRouteProcessingFunctions);
189
192
  }
190
193
 
191
-
194
+ doHead(pRoute, ...fRouteProcessingFunctions)
195
+ {
196
+ return true;
197
+ }
192
198
  head(pRoute, ...fRouteProcessingFunctions)
193
199
  {
194
200
  if (typeof(pRoute) != 'string')
@@ -166,53 +166,47 @@ class OratorServiceServerIPC extends libOratorServiceServerBase
166
166
  }
167
167
 
168
168
  // This is the virtualized "body parser"
169
-
170
- get(pRoute, ...fRouteProcessingFunctions)
169
+ bodyParser()
171
170
  {
172
- if (!super.get(pRoute, ...fRouteProcessingFunctions))
171
+ return (pRequest, pResponse, fNext) =>
173
172
  {
174
- this.log.error(`IPC provider failed to map GET route [${pRoute}]!`);
175
- return false;
176
- }
173
+ return fNext();
174
+ };
175
+ }
177
176
 
177
+ doGet(pRoute, ...fRouteProcessingFunctions)
178
+ {
178
179
  return this.addRouteProcessor('GET', pRoute, Array.from(fRouteProcessingFunctions));
179
180
  }
180
- getWithBodyParser(pRoute, ...fRouteProcessingFunctions)
181
+
182
+ doPut(pRoute, ...fRouteProcessingFunctions)
181
183
  {
182
- return this.get(pRoute, fS)
184
+ return this.addRouteProcessor('PUT', pRoute, Array.from(fRouteProcessingFunctions));
183
185
  }
184
186
 
185
- put(pRoute, ...fRouteProcessingFunctions)
187
+ doPost(pRoute, ...fRouteProcessingFunctions)
186
188
  {
187
- if (!super.get(pRoute, ...fRouteProcessingFunctions))
188
- {
189
- this.log.error(`IPC provider failed to map PUT route [${pRoute}]!`);
190
- return false;
191
- }
192
-
193
- return true;
189
+ return this.addRouteProcessor('POST', pRoute, Array.from(fRouteProcessingFunctions));
194
190
  }
195
191
 
196
- post(pRoute, ...fRouteProcessingFunctions)
192
+ doDel(pRoute, ...fRouteProcessingFunctions)
197
193
  {
198
- if (!super.get(pRoute, ...fRouteProcessingFunctions))
199
- {
200
- this.log.error(`IPC provider failed to map POST route [${pRoute}]!`);
201
- return false;
202
- }
194
+ return this.addRouteProcessor('DELETE', pRoute, Array.from(fRouteProcessingFunctions));
195
+ }
203
196
 
204
- return true;
197
+ doPatch(pRoute, ...fRouteProcessingFunctions)
198
+ {
199
+ return this.addRouteProcessor('PATCH', pRoute, Array.from(fRouteProcessingFunctions));
205
200
  }
206
201
 
207
- del(pRoute, ...fRouteProcessingFunctions)
202
+ doOpts(pRoute, ...fRouteProcessingFunctions)
208
203
  {
209
- if (!super.get(pRoute, ...fRouteProcessingFunctions))
210
- {
211
- this.log.error(`IPC provider failed to map DEL route [${pRoute}]!`);
212
- return false;
213
- }
204
+ return this.addRouteProcessor('OPTIONS', pRoute, Array.from(fRouteProcessingFunctions));
205
+ }
214
206
 
215
- return true;
207
+ doHead(pRoute, ...fRouteProcessingFunctions)
208
+ {
209
+ return this.addRouteProcessor('HEAD', pRoute, Array.from(fRouteProcessingFunctions));
216
210
  }
217
211
  /*************************************************************************
218
212
  * End of Service Route Creation Functions