hotstaq 0.8.17 → 0.8.19

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 (115) hide show
  1. package/build/src/Hot.js +227 -343
  2. package/build/src/Hot.js.map +1 -1
  3. package/build/src/HotAPI.js +104 -185
  4. package/build/src/HotAPI.js.map +1 -1
  5. package/build/src/HotAgentAPI.js +17 -67
  6. package/build/src/HotAgentAPI.js.map +1 -1
  7. package/build/src/HotAgentRoute.js +22 -70
  8. package/build/src/HotAgentRoute.js.map +1 -1
  9. package/build/src/HotAsset.js +19 -21
  10. package/build/src/HotAsset.js.map +1 -1
  11. package/build/src/HotBuilder.js +426 -715
  12. package/build/src/HotBuilder.js.map +1 -1
  13. package/build/src/HotCLI.js +1189 -1536
  14. package/build/src/HotCLI.js.map +1 -1
  15. package/build/src/HotClient.js +4 -5
  16. package/build/src/HotClient.js.map +1 -1
  17. package/build/src/HotComponent.js +6 -8
  18. package/build/src/HotComponent.js.map +1 -1
  19. package/build/src/HotCreator.js +328 -428
  20. package/build/src/HotCreator.js.map +1 -1
  21. package/build/src/HotDB.js +3 -7
  22. package/build/src/HotDB.js.map +1 -1
  23. package/build/src/HotFile.d.ts.map +1 -1
  24. package/build/src/HotFile.js +250 -252
  25. package/build/src/HotFile.js.map +1 -1
  26. package/build/src/HotGenerator.js +626 -502
  27. package/build/src/HotGenerator.js.map +1 -1
  28. package/build/src/HotHTTPServer.d.ts.map +1 -1
  29. package/build/src/HotHTTPServer.js +580 -839
  30. package/build/src/HotHTTPServer.js.map +1 -1
  31. package/build/src/HotHTTPServerProcessRequest.js +112 -182
  32. package/build/src/HotHTTPServerProcessRequest.js.map +1 -1
  33. package/build/src/HotHTTPServerThread.js +6 -41
  34. package/build/src/HotHTTPServerThread.js.map +1 -1
  35. package/build/src/HotIO.js +131 -218
  36. package/build/src/HotIO.js.map +1 -1
  37. package/build/src/HotLog.js +17 -19
  38. package/build/src/HotLog.js.map +1 -1
  39. package/build/src/HotModule.js +47 -96
  40. package/build/src/HotModule.js.map +1 -1
  41. package/build/src/HotPage.js +41 -103
  42. package/build/src/HotPage.js.map +1 -1
  43. package/build/src/HotRoute.js +13 -18
  44. package/build/src/HotRoute.js.map +1 -1
  45. package/build/src/HotRouteMethod.js +38 -49
  46. package/build/src/HotRouteMethod.js.map +1 -1
  47. package/build/src/HotServer.js +11 -40
  48. package/build/src/HotServer.js.map +1 -1
  49. package/build/src/HotSetAsWeb.js +1 -1
  50. package/build/src/HotSetAsWeb.js.map +1 -1
  51. package/build/src/HotStaq.js +889 -1079
  52. package/build/src/HotStaq.js.map +1 -1
  53. package/build/src/HotStaqRegisterComponent.js +115 -140
  54. package/build/src/HotStaqRegisterComponent.js.map +1 -1
  55. package/build/src/HotStaqWebStart.js +207 -242
  56. package/build/src/HotStaqWebStart.js.map +1 -1
  57. package/build/src/HotTestDestination.js +3 -6
  58. package/build/src/HotTestDestination.js.map +1 -1
  59. package/build/src/HotTestDriver.js +32 -83
  60. package/build/src/HotTestDriver.js.map +1 -1
  61. package/build/src/HotTestElement.js +6 -11
  62. package/build/src/HotTestElement.js.map +1 -1
  63. package/build/src/HotTestMap.js +8 -12
  64. package/build/src/HotTestMap.js.map +1 -1
  65. package/build/src/HotTestSeleniumDriver.js +279 -438
  66. package/build/src/HotTestSeleniumDriver.js.map +1 -1
  67. package/build/src/HotTestUIDriver.js +5 -23
  68. package/build/src/HotTestUIDriver.js.map +1 -1
  69. package/build/src/HotTester.js +321 -555
  70. package/build/src/HotTester.js.map +1 -1
  71. package/build/src/HotTesterAPI.js +80 -145
  72. package/build/src/HotTesterAPI.js.map +1 -1
  73. package/build/src/HotTesterMocha.js +104 -212
  74. package/build/src/HotTesterMocha.js.map +1 -1
  75. package/build/src/HotTesterMochaSelenium.js +124 -235
  76. package/build/src/HotTesterMochaSelenium.js.map +1 -1
  77. package/build/src/HotTesterServer.js +295 -472
  78. package/build/src/HotTesterServer.js.map +1 -1
  79. package/build/src/HotWebSocketClient.js +14 -17
  80. package/build/src/HotWebSocketClient.js.map +1 -1
  81. package/build/src/HotWebSocketServer.js +143 -242
  82. package/build/src/HotWebSocketServer.js.map +1 -1
  83. package/build/src/api-web.js +19 -19
  84. package/build/src/api-web.js.map +1 -1
  85. package/build/src/api.js +33 -33
  86. package/build/src/api.js.map +1 -1
  87. package/build/src/index.js +5 -39
  88. package/build/src/index.js.map +1 -1
  89. package/build/src/schemas/HotDBInflux.js +104 -178
  90. package/build/src/schemas/HotDBInflux.js.map +1 -1
  91. package/build/src/schemas/HotDBMigration.js +3 -5
  92. package/build/src/schemas/HotDBMigration.js.map +1 -1
  93. package/build/src/schemas/HotDBMySQL.js +154 -278
  94. package/build/src/schemas/HotDBMySQL.js.map +1 -1
  95. package/build/src/schemas/HotDBSchema.js +3 -4
  96. package/build/src/schemas/HotDBSchema.js.map +1 -1
  97. package/build/src/schemas/influx/InfluxSchema.js +6 -24
  98. package/build/src/schemas/influx/InfluxSchema.js.map +1 -1
  99. package/build/src/schemas/mysql/MySQLSchema.js +33 -108
  100. package/build/src/schemas/mysql/MySQLSchema.js.map +1 -1
  101. package/build/src/schemas/mysql/MySQLSchemaField.js +73 -117
  102. package/build/src/schemas/mysql/MySQLSchemaField.js.map +1 -1
  103. package/build/src/schemas/mysql/MySQLSchemaTable.js +184 -244
  104. package/build/src/schemas/mysql/MySQLSchemaTable.js.map +1 -1
  105. package/build-web/HotStaq.js +2 -2
  106. package/build-web/HotStaq.min.js +6 -6
  107. package/builder/docker/dockerignore +1 -2
  108. package/creator/project/npmignore +2 -0
  109. package/creator/ts/tsconfig-web.json +1 -1
  110. package/creator/ts/tsconfig.json +1 -1
  111. package/package.json +1 -1
  112. package/src/HotFile.ts +6 -2
  113. package/src/HotHTTPServer.ts +6 -0
  114. package/src/HotStaq.ts +1 -1
  115. package/tsconfig.json +1 -1
package/build/src/Hot.js CHANGED
@@ -8,44 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
39
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
13
  };
41
14
  Object.defineProperty(exports, "__esModule", { value: true });
42
15
  exports.Hot = exports.DeveloperMode = void 0;
43
- var HotFile_1 = require("./HotFile");
44
- var HotStaq_1 = require("./HotStaq");
45
- var HotTestElement_1 = require("./HotTestElement");
46
- var js_cookie_1 = __importDefault(require("js-cookie"));
47
- var node_fetch_1 = __importDefault(require("node-fetch"));
48
- var HotRouteMethod_1 = require("./HotRouteMethod");
16
+ const HotFile_1 = require("./HotFile");
17
+ const HotStaq_1 = require("./HotStaq");
18
+ const HotTestElement_1 = require("./HotTestElement");
19
+ const js_cookie_1 = __importDefault(require("js-cookie"));
20
+ const node_fetch_1 = __importDefault(require("node-fetch"));
21
+ const HotRouteMethod_1 = require("./HotRouteMethod");
49
22
  /**
50
23
  * The available developer modes.
51
24
  */
@@ -65,191 +38,125 @@ var DeveloperMode;
65
38
  /**
66
39
  * The api used during processing.
67
40
  */
68
- var Hot = /** @class */ (function () {
69
- function Hot() {
70
- }
41
+ class Hot {
71
42
  /**
72
43
  * Retrieve a file and echo out it's contents.
73
44
  */
74
- Hot.include = function (file, args) {
75
- if (args === void 0) { args = null; }
76
- return __awaiter(this, void 0, void 0, function () {
77
- var lowerFile, _a, _b;
78
- return __generator(this, function (_c) {
79
- switch (_c.label) {
80
- case 0:
81
- if (HotStaq_1.HotStaq.isWeb === true) {
82
- if (typeof (file) === "string") {
83
- lowerFile = file.toLowerCase();
84
- // If the file to be included does not have a nahfam, add it. This
85
- // will ensure the server sends only the file content.
86
- if (lowerFile.indexOf(".hott") > -1) {
87
- if (lowerFile.indexOf("nahfam") < 0)
88
- file += "?hstqserve=nahfam";
89
- }
90
- }
91
- }
92
- _b = (_a = Hot).echo;
93
- return [4 /*yield*/, Hot.getFile(file, args)];
94
- case 1:
95
- _b.apply(_a, [_c.sent()]);
96
- return [2 /*return*/];
45
+ static include(file, args = null) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ if (HotStaq_1.HotStaq.isWeb === true) {
48
+ if (typeof (file) === "string") {
49
+ const lowerFile = file.toLowerCase();
50
+ // If the file to be included does not have a nahfam, add it. This
51
+ // will ensure the server sends only the file content.
52
+ if (lowerFile.indexOf(".hott") > -1) {
53
+ if (lowerFile.indexOf("nahfam") < 0)
54
+ file += "?hstqserve=nahfam";
55
+ }
97
56
  }
98
- });
57
+ }
58
+ Hot.echo(yield Hot.getFile(file, args));
99
59
  });
100
- };
60
+ }
101
61
  /**
102
62
  * Include and execute JavaScript for use when running the preprocessor.
103
63
  */
104
- Hot.includeJS = function (file, args, parentObject) {
105
- if (args === void 0) { args = null; }
106
- if (parentObject === void 0) { parentObject = null; }
107
- return __awaiter(this, void 0, void 0, function () {
108
- var output;
109
- return __generator(this, function (_a) {
110
- switch (_a.label) {
111
- case 0: return [4 /*yield*/, Hot.getFile(file, args)];
112
- case 1:
113
- output = _a.sent();
114
- if (HotStaq_1.HotStaq.isWeb === true) {
115
- if (parentObject == null)
116
- parentObject = window;
117
- }
118
- else {
119
- if (parentObject == null)
120
- parentObject = global;
121
- }
122
- return [2 /*return*/, (eval.apply(parentObject, [output]))];
123
- }
124
- });
64
+ static includeJS(file, args = null, parentObject = null) {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ const output = yield Hot.getFile(file, args);
67
+ if (HotStaq_1.HotStaq.isWeb === true) {
68
+ if (parentObject == null)
69
+ parentObject = window;
70
+ }
71
+ else {
72
+ if (parentObject == null)
73
+ parentObject = global;
74
+ }
75
+ return (eval.apply(parentObject, [output]));
125
76
  });
126
- };
77
+ }
127
78
  /**
128
79
  * Retrieve a file and echo out it's contents.
129
80
  */
130
- Hot.import = function (moduleName, args, parentObject) {
131
- if (args === void 0) { args = null; }
132
- if (parentObject === void 0) { parentObject = null; }
133
- return __awaiter(this, void 0, void 0, function () {
134
- var foundModule, file, output, newModule;
135
- return __generator(this, function (_a) {
136
- switch (_a.label) {
137
- case 0:
138
- foundModule = Hot.CurrentPage.processor.getModule(moduleName);
139
- if (foundModule != null)
140
- return [2 /*return*/, (foundModule)];
141
- file = "./hotstaq_modules/".concat(moduleName, "/index.js");
142
- return [4 /*yield*/, Hot.getFile(file, args)];
143
- case 1:
144
- output = _a.sent();
145
- if (HotStaq_1.HotStaq.isWeb === true) {
146
- if (parentObject == null)
147
- parentObject = window;
148
- }
149
- else {
150
- if (parentObject == null)
151
- parentObject = global;
152
- }
153
- newModule = new Function(output).apply(parentObject);
154
- if (!(newModule.loadHTML != null)) return [3 /*break*/, 3];
155
- return [4 /*yield*/, newModule.loadHTML()];
156
- case 2:
157
- _a.sent();
158
- _a.label = 3;
159
- case 3:
160
- Hot.CurrentPage.processor.addModule(moduleName, newModule);
161
- return [2 /*return*/, (newModule)];
162
- }
163
- });
81
+ static import(moduleName, args = null, parentObject = null) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ let foundModule = Hot.CurrentPage.processor.getModule(moduleName);
84
+ if (foundModule != null)
85
+ return (foundModule);
86
+ const file = `./hotstaq_modules/${moduleName}/index.js`;
87
+ const output = yield Hot.getFile(file, args);
88
+ if (HotStaq_1.HotStaq.isWeb === true) {
89
+ if (parentObject == null)
90
+ parentObject = window;
91
+ }
92
+ else {
93
+ if (parentObject == null)
94
+ parentObject = global;
95
+ }
96
+ let newModule = new Function(output).apply(parentObject);
97
+ if (newModule.loadHTML != null)
98
+ yield newModule.loadHTML();
99
+ Hot.CurrentPage.processor.addModule(moduleName, newModule);
100
+ return (newModule);
164
101
  });
165
- };
102
+ }
166
103
  /**
167
104
  * Run an already loaded file and echo out it's contents.
168
105
  */
169
- Hot.runFile = function (fileName, args) {
170
- if (args === void 0) { args = null; }
171
- return __awaiter(this, void 0, void 0, function () {
172
- var file, tempFile, content;
173
- return __generator(this, function (_a) {
174
- switch (_a.label) {
175
- case 0:
176
- file = Hot.CurrentPage.processor.getFile(fileName);
177
- tempFile = file;
178
- tempFile.page = this.CurrentPage;
179
- return [4 /*yield*/, tempFile.process(args)];
180
- case 1:
181
- content = _a.sent();
182
- Hot.echo(content);
183
- return [2 /*return*/];
184
- }
185
- });
106
+ static runFile(fileName, args = null) {
107
+ return __awaiter(this, void 0, void 0, function* () {
108
+ let file = Hot.CurrentPage.processor.getFile(fileName);
109
+ /// @fixme Does the file need to be deep cloned first?
110
+ //let clonedFile: HotFile = new HotFile (Object.assign ({}, file));
111
+ let tempFile = file;
112
+ tempFile.page = this.CurrentPage;
113
+ let content = yield tempFile.process(args);
114
+ Hot.echo(content);
186
115
  });
187
- };
116
+ }
188
117
  /**
189
118
  * Get the content of a file.
190
119
  */
191
- Hot.getFile = function (path, args) {
192
- if (args === void 0) { args = null; }
193
- return __awaiter(this, void 0, void 0, function () {
194
- var tempFile, checkFile, content;
195
- return __generator(this, function (_a) {
196
- switch (_a.label) {
197
- case 0:
198
- tempFile = null;
199
- if (typeof (path) === "string") {
200
- tempFile = new HotFile_1.HotFile();
201
- tempFile.name = path;
202
- if (HotStaq_1.HotStaq.isWeb === true)
203
- tempFile.url = path;
204
- else
205
- tempFile.localFile = path;
206
- }
207
- else
208
- tempFile = path;
209
- checkFile = Hot.CurrentPage.processor.getFile(tempFile.name, false);
210
- if (checkFile != null)
211
- tempFile = checkFile;
212
- return [4 /*yield*/, tempFile.load()];
213
- case 1:
214
- _a.sent();
215
- tempFile.page = this.CurrentPage;
216
- return [4 /*yield*/, tempFile.process(args)];
217
- case 2:
218
- content = _a.sent();
219
- return [2 /*return*/, (content)];
220
- }
221
- });
120
+ static getFile(path, args = null) {
121
+ return __awaiter(this, void 0, void 0, function* () {
122
+ let tempFile = null;
123
+ if (typeof (path) === "string") {
124
+ tempFile = new HotFile_1.HotFile();
125
+ tempFile.name = path;
126
+ if (HotStaq_1.HotStaq.isWeb === true)
127
+ tempFile.url = path;
128
+ else
129
+ tempFile.localFile = path;
130
+ }
131
+ else
132
+ tempFile = path;
133
+ let checkFile = Hot.CurrentPage.processor.getFile(tempFile.name, false);
134
+ if (checkFile != null)
135
+ tempFile = checkFile;
136
+ yield tempFile.load();
137
+ tempFile.page = this.CurrentPage;
138
+ let content = yield tempFile.process(args);
139
+ return (content);
222
140
  });
223
- };
141
+ }
224
142
  /**
225
143
  * Make an api call.
226
144
  */
227
- Hot.apiCall = function (route, data, httpMethod, files) {
228
- if (data === void 0) { data = null; }
229
- if (httpMethod === void 0) { httpMethod = HotRouteMethod_1.HotEventMethod.POST; }
230
- if (files === void 0) { files = {}; }
231
- return __awaiter(this, void 0, void 0, function () {
232
- var result;
233
- return __generator(this, function (_a) {
234
- switch (_a.label) {
235
- case 0:
236
- result = null;
237
- if (Hot.CurrentPage == null)
238
- throw new Error("Current page is null!");
239
- if (Hot.CurrentPage.processor == null)
240
- throw new Error("Current page's processor is null!");
241
- if (Hot.CurrentPage.processor.api == null)
242
- throw new Error("Current page's processor api is null! Did you forget to set the API name or URL?");
243
- if (!(Hot.CurrentPage.processor.api != null)) return [3 /*break*/, 2];
244
- return [4 /*yield*/, Hot.CurrentPage.processor.api.makeCall(route, data, httpMethod, files)];
245
- case 1:
246
- result = _a.sent();
247
- _a.label = 2;
248
- case 2: return [2 /*return*/, (result)];
249
- }
250
- });
145
+ static apiCall(route, data = null, httpMethod = HotRouteMethod_1.HotEventMethod.POST, files = {}) {
146
+ return __awaiter(this, void 0, void 0, function* () {
147
+ let result = null;
148
+ if (Hot.CurrentPage == null)
149
+ throw new Error("Current page is null!");
150
+ if (Hot.CurrentPage.processor == null)
151
+ throw new Error("Current page's processor is null!");
152
+ if (Hot.CurrentPage.processor.api == null)
153
+ throw new Error("Current page's processor api is null! Did you forget to set the API name or URL?");
154
+ if (Hot.CurrentPage.processor.api != null) {
155
+ result = yield Hot.CurrentPage.processor.api.makeCall(route, data, httpMethod, files);
156
+ }
157
+ return (result);
251
158
  });
252
- };
159
+ }
253
160
  /**
254
161
  * Get a HTTP JSON file or request.
255
162
  *
@@ -257,13 +164,11 @@ var Hot = /** @class */ (function () {
257
164
  *
258
165
  * @returns The parsed JSON object.
259
166
  */
260
- Hot.getJSON = function (url) {
261
- return __awaiter(this, void 0, void 0, function () {
262
- return __generator(this, function (_a) {
263
- return [2 /*return*/, (Hot.jsonRequest(url, null, HotRouteMethod_1.HotEventMethod.GET))];
264
- });
167
+ static getJSON(url) {
168
+ return __awaiter(this, void 0, void 0, function* () {
169
+ return (Hot.jsonRequest(url, null, HotRouteMethod_1.HotEventMethod.GET));
265
170
  });
266
- };
171
+ }
267
172
  /**
268
173
  * Make a HTTP JSON request.
269
174
  *
@@ -273,43 +178,31 @@ var Hot = /** @class */ (function () {
273
178
  *
274
179
  * @returns The parsed JSON object.
275
180
  */
276
- Hot.jsonRequest = function (url, data, httpMethod) {
277
- if (data === void 0) { data = null; }
278
- if (httpMethod === void 0) { httpMethod = HotRouteMethod_1.HotEventMethod.POST; }
279
- return __awaiter(this, void 0, void 0, function () {
280
- var fetchObj, res, result, ex_1;
281
- return __generator(this, function (_a) {
282
- switch (_a.label) {
283
- case 0:
284
- _a.trys.push([0, 3, , 4]);
285
- fetchObj = {
286
- "method": httpMethod,
287
- "headers": {
288
- "Accept": "application/json",
289
- "Content-Type": "application/json"
290
- }
291
- };
292
- if (httpMethod === HotRouteMethod_1.HotEventMethod.POST) {
293
- /// @ts-ignore
294
- fetchObj["body"] = JSON.stringify(data);
295
- }
296
- return [4 /*yield*/, (0, node_fetch_1.default)(url, fetchObj)];
297
- case 1:
298
- res = _a.sent();
299
- if (res.ok === false)
300
- throw new Error("".concat(res.status, ": ").concat(res.statusText));
301
- return [4 /*yield*/, res.json()];
302
- case 2:
303
- result = _a.sent();
304
- return [2 /*return*/, (result)];
305
- case 3:
306
- ex_1 = _a.sent();
307
- return [2 /*return*/, (JSON.stringify({ "error": "".concat(ex_1.message, " - Could not fetch ").concat(url) }))];
308
- case 4: return [2 /*return*/];
181
+ static jsonRequest(url, data = null, httpMethod = HotRouteMethod_1.HotEventMethod.POST) {
182
+ return __awaiter(this, void 0, void 0, function* () {
183
+ try {
184
+ let fetchObj = {
185
+ "method": httpMethod,
186
+ "headers": {
187
+ "Accept": "application/json",
188
+ "Content-Type": "application/json"
189
+ }
190
+ };
191
+ if (httpMethod === HotRouteMethod_1.HotEventMethod.POST) {
192
+ /// @ts-ignore
193
+ fetchObj["body"] = JSON.stringify(data);
309
194
  }
310
- });
195
+ let res = yield (0, node_fetch_1.default)(url, fetchObj);
196
+ if (res.ok === false)
197
+ throw new Error(`${res.status}: ${res.statusText}`);
198
+ let result = yield res.json();
199
+ return (result);
200
+ }
201
+ catch (ex) {
202
+ return (JSON.stringify({ "error": `${ex.message} - Could not fetch ${url}` }));
203
+ }
311
204
  });
312
- };
205
+ }
313
206
  /**
314
207
  * Make a HTTP request. This is basically just a wrapper for fetch.
315
208
  *
@@ -318,137 +211,128 @@ var Hot = /** @class */ (function () {
318
211
  *
319
212
  * @returns The HTTP response.
320
213
  */
321
- Hot.httpRequest = function (url, requestInit) {
322
- if (requestInit === void 0) { requestInit = undefined; }
323
- return __awaiter(this, void 0, void 0, function () {
324
- var res;
325
- return __generator(this, function (_a) {
326
- switch (_a.label) {
327
- case 0: return [4 /*yield*/, (0, node_fetch_1.default)(url, requestInit)];
328
- case 1:
329
- res = _a.sent();
330
- return [2 /*return*/, (res)];
331
- }
332
- });
214
+ static httpRequest(url, requestInit = undefined) {
215
+ return __awaiter(this, void 0, void 0, function* () {
216
+ let res = yield (0, node_fetch_1.default)(url, requestInit);
217
+ return (res);
333
218
  });
334
- };
219
+ }
335
220
  /**
336
221
  * Echo out some output.
337
222
  */
338
- Hot.echo = function (message) {
223
+ static echo(message) {
339
224
  Hot.Output += message;
340
- };
225
+ }
341
226
  /**
342
227
  * Echo out the CSS for the current page being generated.
343
228
  */
344
- Hot.displayCSS = function () {
345
- for (var iIdx = 0; iIdx < Hot.CSS.length; iIdx++) {
346
- var cssFile = Hot.CSS[iIdx];
347
- var cssOut = Hot.cssStr;
229
+ static displayCSS() {
230
+ for (let iIdx = 0; iIdx < Hot.CSS.length; iIdx++) {
231
+ let cssFile = Hot.CSS[iIdx];
232
+ let cssOut = Hot.cssStr;
348
233
  cssOut = cssOut.replace(/\%CSS_FILE\%/g, cssFile);
349
234
  Hot.echo(cssOut);
350
235
  }
351
- };
236
+ }
352
237
  /**
353
238
  * Echo out the JS files for the current page being generated.
354
239
  */
355
- Hot.displayJSFiles = function () {
356
- for (var iIdx = 0; iIdx < Hot.JSFiles.length; iIdx++) {
357
- var jsFile = Hot.JSFiles[iIdx];
358
- var jsFileOut = Hot.jsFileStr;
240
+ static displayJSFiles() {
241
+ for (let iIdx = 0; iIdx < Hot.JSFiles.length; iIdx++) {
242
+ let jsFile = Hot.JSFiles[iIdx];
243
+ let jsFileOut = Hot.jsFileStr;
359
244
  jsFileOut = jsFileOut.replace(/\%JS_FILE\%/g, jsFile);
360
245
  Hot.echo(jsFileOut);
361
246
  }
362
- };
247
+ }
363
248
  /**
364
249
  * Echo out the JS scripts for the current page being generated.
365
250
  */
366
- Hot.displayJSScripts = function () {
367
- for (var iIdx = 0; iIdx < Hot.JSScripts.length; iIdx++) {
368
- var jsScript = Hot.JSScripts[iIdx];
369
- var jsScriptOut = Hot.jsScriptsStr;
251
+ static displayJSScripts() {
252
+ for (let iIdx = 0; iIdx < Hot.JSScripts.length; iIdx++) {
253
+ let jsScript = Hot.JSScripts[iIdx];
254
+ let jsScriptOut = Hot.jsScriptsStr;
370
255
  jsScriptOut = jsScriptOut.replace(/\%JS_CODE\%/g, jsScript);
371
256
  Hot.echo(jsScriptOut);
372
257
  }
373
- };
374
- /**
375
- * The currently generated page being displayed. This is cleared between every file processed.
376
- */
377
- Hot.CurrentPage = null;
378
- /**
379
- * The arguments passed.
380
- */
381
- Hot.Arguments = null;
382
- /**
383
- * The mode in which this application is running. If it's set to development mode, all testing
384
- * related data will be collected, parsed, and executed if necessary.
385
- */
386
- Hot.DeveloperMode = DeveloperMode;
387
- /**
388
- * The mode in which this application is running. If it's set to development mode, all testing
389
- * related data will be collected, parsed, and executed if necessary.
390
- */
391
- Hot.HotTestElement = HotTestElement_1.HotTestElement;
392
- /**
393
- * The mode in which this application is running. If it's set to development mode, all testing
394
- * related data will be collected, parsed, and executed if necessary.
395
- */
396
- Hot.Mode = DeveloperMode.Production;
397
- /**
398
- *The current API used on this page. This is cleared between every file processed.
399
- */
400
- Hot.API = null;
401
- /**
402
- * The API being used by the tester.
403
- */
404
- Hot.TesterAPI = null;
405
- /**
406
- * Contains the buffer to output. This is cleared between every file processed.
407
- */
408
- Hot.Output = "";
409
- /**
410
- * The data to share across all the different files and pages. This data will be public.
411
- */
412
- Hot.Data = {};
413
- /**
414
- * The cookies to use between pages.
415
- */
416
- Hot.Cookies = js_cookie_1.default;
417
- /**
418
- * Any public keys that need to be shown. These can be passed from HotSite.json.
419
- */
420
- Hot.PublicKeys = {};
421
- /**
422
- * The CSS string to use when echoing out the CSS files.
423
- */
424
- Hot.cssStr = "<link rel = \"stylesheet\" href = \"%CSS_FILE%\" />";
425
- /**
426
- * The CSS files to use in the current page being generated.
427
- *
428
- * @todo Make this a "string | CSSObject" data type so it can also include
429
- * the integrity hashes as well.
430
- */
431
- Hot.CSS = [];
432
- /**
433
- * The JavaScript files to use in the current page being generated.
434
- *
435
- * @todo Make this a "string | JSFileObject" data type so it can also include
436
- * the integrity hashes as well.
437
- */
438
- Hot.JSFiles = [];
439
- /**
440
- * The JavaScript inline code to use in the current page being generated.
441
- */
442
- Hot.JSScripts = [];
443
- /**
444
- * The JavaScript string to use when echoing out the Scripts files.
445
- */
446
- Hot.jsFileStr = "<script type = \"text/javascript\" src = \"%JS_FILE%\"></script>";
447
- /**
448
- * The JavaScript string to use when echoing out the Scripts files.
449
- */
450
- Hot.jsScriptsStr = "<script type = \"text/javascript\">%JS_CODE%</script>";
451
- return Hot;
452
- }());
258
+ }
259
+ }
453
260
  exports.Hot = Hot;
261
+ /**
262
+ * The currently generated page being displayed. This is cleared between every file processed.
263
+ */
264
+ Hot.CurrentPage = null;
265
+ /**
266
+ * The arguments passed.
267
+ */
268
+ Hot.Arguments = null;
269
+ /**
270
+ * The mode in which this application is running. If it's set to development mode, all testing
271
+ * related data will be collected, parsed, and executed if necessary.
272
+ */
273
+ Hot.DeveloperMode = DeveloperMode;
274
+ /**
275
+ * The mode in which this application is running. If it's set to development mode, all testing
276
+ * related data will be collected, parsed, and executed if necessary.
277
+ */
278
+ Hot.HotTestElement = HotTestElement_1.HotTestElement;
279
+ /**
280
+ * The mode in which this application is running. If it's set to development mode, all testing
281
+ * related data will be collected, parsed, and executed if necessary.
282
+ */
283
+ Hot.Mode = DeveloperMode.Production;
284
+ /**
285
+ *The current API used on this page. This is cleared between every file processed.
286
+ */
287
+ Hot.API = null;
288
+ /**
289
+ * The API being used by the tester.
290
+ */
291
+ Hot.TesterAPI = null;
292
+ /**
293
+ * Contains the buffer to output. This is cleared between every file processed.
294
+ */
295
+ Hot.Output = "";
296
+ /**
297
+ * The data to share across all the different files and pages. This data will be public.
298
+ */
299
+ Hot.Data = {};
300
+ /**
301
+ * The cookies to use between pages.
302
+ */
303
+ Hot.Cookies = js_cookie_1.default;
304
+ /**
305
+ * Any public keys that need to be shown. These can be passed from HotSite.json.
306
+ */
307
+ Hot.PublicKeys = {};
308
+ /**
309
+ * The CSS string to use when echoing out the CSS files.
310
+ */
311
+ Hot.cssStr = `<link rel = "stylesheet" href = "%CSS_FILE%" />`;
312
+ /**
313
+ * The CSS files to use in the current page being generated.
314
+ *
315
+ * @todo Make this a "string | CSSObject" data type so it can also include
316
+ * the integrity hashes as well.
317
+ */
318
+ Hot.CSS = [];
319
+ /**
320
+ * The JavaScript files to use in the current page being generated.
321
+ *
322
+ * @todo Make this a "string | JSFileObject" data type so it can also include
323
+ * the integrity hashes as well.
324
+ */
325
+ Hot.JSFiles = [];
326
+ /**
327
+ * The JavaScript inline code to use in the current page being generated.
328
+ */
329
+ Hot.JSScripts = [];
330
+ /**
331
+ * The JavaScript string to use when echoing out the Scripts files.
332
+ */
333
+ Hot.jsFileStr = `<script type = "text/javascript" src = "%JS_FILE%"></script>`;
334
+ /**
335
+ * The JavaScript string to use when echoing out the Scripts files.
336
+ */
337
+ Hot.jsScriptsStr = `<script type = "text/javascript">%JS_CODE%</script>`;
454
338
  //# sourceMappingURL=Hot.js.map