hotstaq 0.5.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/.dockerignore +123 -0
- package/.eslintignore +17 -0
- package/.eslintrc.js +11 -0
- package/.vscode/launch.json +201 -0
- package/.vscode/settings.json +2 -0
- package/.vscode/tasks.json +88 -0
- package/CONTRIBUTING.md +157 -0
- package/LICENSE +21 -0
- package/README.md +128 -0
- package/bin/hotstaq +3 -0
- package/bin/hotstaq.cmd +1 -0
- package/build/src/Hot.d.ts +167 -0
- package/build/src/Hot.d.ts.map +1 -0
- package/build/src/Hot.js +365 -0
- package/build/src/Hot.js.map +1 -0
- package/build/src/HotAPI.d.ts +137 -0
- package/build/src/HotAPI.d.ts.map +1 -0
- package/build/src/HotAPI.js +353 -0
- package/build/src/HotAPI.js.map +1 -0
- package/build/src/HotAgentAPI.d.ts +22 -0
- package/build/src/HotAgentAPI.d.ts.map +1 -0
- package/build/src/HotAgentAPI.js +85 -0
- package/build/src/HotAgentAPI.js.map +1 -0
- package/build/src/HotAgentRoute.d.ts +17 -0
- package/build/src/HotAgentRoute.d.ts.map +1 -0
- package/build/src/HotAgentRoute.js +109 -0
- package/build/src/HotAgentRoute.js.map +1 -0
- package/build/src/HotBuilder.d.ts +52 -0
- package/build/src/HotBuilder.d.ts.map +1 -0
- package/build/src/HotBuilder.js +242 -0
- package/build/src/HotBuilder.js.map +1 -0
- package/build/src/HotClient.d.ts +31 -0
- package/build/src/HotClient.d.ts.map +1 -0
- package/build/src/HotClient.js +19 -0
- package/build/src/HotClient.js.map +1 -0
- package/build/src/HotComponent.d.ts +118 -0
- package/build/src/HotComponent.d.ts.map +1 -0
- package/build/src/HotComponent.js +89 -0
- package/build/src/HotComponent.js.map +1 -0
- package/build/src/HotCreator.d.ts +88 -0
- package/build/src/HotCreator.d.ts.map +1 -0
- package/build/src/HotCreator.js +445 -0
- package/build/src/HotCreator.js.map +1 -0
- package/build/src/HotDB.d.ts +69 -0
- package/build/src/HotDB.d.ts.map +1 -0
- package/build/src/HotDB.js +29 -0
- package/build/src/HotDB.js.map +1 -0
- package/build/src/HotDBConnectionInterface.d.ts +40 -0
- package/build/src/HotDBConnectionInterface.d.ts.map +1 -0
- package/build/src/HotDBConnectionInterface.js +3 -0
- package/build/src/HotDBConnectionInterface.js.map +1 -0
- package/build/src/HotFile.d.ts +134 -0
- package/build/src/HotFile.d.ts.map +1 -0
- package/build/src/HotFile.js +454 -0
- package/build/src/HotFile.js.map +1 -0
- package/build/src/HotGenerator.d.ts +80 -0
- package/build/src/HotGenerator.d.ts.map +1 -0
- package/build/src/HotGenerator.js +342 -0
- package/build/src/HotGenerator.js.map +1 -0
- package/build/src/HotHTTPServer.d.ts +162 -0
- package/build/src/HotHTTPServer.d.ts.map +1 -0
- package/build/src/HotHTTPServer.js +863 -0
- package/build/src/HotHTTPServer.js.map +1 -0
- package/build/src/HotIO.d.ts +47 -0
- package/build/src/HotIO.d.ts.map +1 -0
- package/build/src/HotIO.js +232 -0
- package/build/src/HotIO.js.map +1 -0
- package/build/src/HotLog.d.ts +60 -0
- package/build/src/HotLog.d.ts.map +1 -0
- package/build/src/HotLog.js +126 -0
- package/build/src/HotLog.js.map +1 -0
- package/build/src/HotPage.d.ts +125 -0
- package/build/src/HotPage.d.ts.map +1 -0
- package/build/src/HotPage.js +178 -0
- package/build/src/HotPage.js.map +1 -0
- package/build/src/HotRoute.d.ts +82 -0
- package/build/src/HotRoute.d.ts.map +1 -0
- package/build/src/HotRoute.js +83 -0
- package/build/src/HotRoute.js.map +1 -0
- package/build/src/HotRouteMethod.d.ts +129 -0
- package/build/src/HotRouteMethod.d.ts.map +1 -0
- package/build/src/HotRouteMethod.js +84 -0
- package/build/src/HotRouteMethod.js.map +1 -0
- package/build/src/HotServer.d.ts +152 -0
- package/build/src/HotServer.d.ts.map +1 -0
- package/build/src/HotServer.js +109 -0
- package/build/src/HotServer.js.map +1 -0
- package/build/src/HotSetAsWeb.d.ts +2 -0
- package/build/src/HotSetAsWeb.d.ts.map +1 -0
- package/build/src/HotSetAsWeb.js +5 -0
- package/build/src/HotSetAsWeb.js.map +1 -0
- package/build/src/HotStaq.d.ts +603 -0
- package/build/src/HotStaq.d.ts.map +1 -0
- package/build/src/HotStaq.js +1260 -0
- package/build/src/HotStaq.js.map +1 -0
- package/build/src/HotStaqWeb.d.ts +18 -0
- package/build/src/HotStaqWeb.d.ts.map +1 -0
- package/build/src/HotStaqWeb.js +44 -0
- package/build/src/HotStaqWeb.js.map +1 -0
- package/build/src/HotTestDriver.d.ts +63 -0
- package/build/src/HotTestDriver.d.ts.map +1 -0
- package/build/src/HotTestDriver.js +187 -0
- package/build/src/HotTestDriver.js.map +1 -0
- package/build/src/HotTestElement.d.ts +71 -0
- package/build/src/HotTestElement.d.ts.map +1 -0
- package/build/src/HotTestElement.js +37 -0
- package/build/src/HotTestElement.js.map +1 -0
- package/build/src/HotTestMap.d.ts +83 -0
- package/build/src/HotTestMap.d.ts.map +1 -0
- package/build/src/HotTestMap.js +58 -0
- package/build/src/HotTestMap.js.map +1 -0
- package/build/src/HotTestSeleniumDriver.d.ts +86 -0
- package/build/src/HotTestSeleniumDriver.d.ts.map +1 -0
- package/build/src/HotTestSeleniumDriver.js +400 -0
- package/build/src/HotTestSeleniumDriver.js.map +1 -0
- package/build/src/HotTester.d.ts +188 -0
- package/build/src/HotTester.d.ts.map +1 -0
- package/build/src/HotTester.js +622 -0
- package/build/src/HotTester.js.map +1 -0
- package/build/src/HotTesterAPI.d.ts +15 -0
- package/build/src/HotTesterAPI.d.ts.map +1 -0
- package/build/src/HotTesterAPI.js +161 -0
- package/build/src/HotTesterAPI.js.map +1 -0
- package/build/src/HotTesterMocha.d.ts +50 -0
- package/build/src/HotTesterMocha.d.ts.map +1 -0
- package/build/src/HotTesterMocha.js +205 -0
- package/build/src/HotTesterMocha.js.map +1 -0
- package/build/src/HotTesterMochaSelenium.d.ts +70 -0
- package/build/src/HotTesterMochaSelenium.d.ts.map +1 -0
- package/build/src/HotTesterMochaSelenium.js +257 -0
- package/build/src/HotTesterMochaSelenium.js.map +1 -0
- package/build/src/HotTesterServer.d.ts +114 -0
- package/build/src/HotTesterServer.d.ts.map +1 -0
- package/build/src/HotTesterServer.js +575 -0
- package/build/src/HotTesterServer.js.map +1 -0
- package/build/src/api copy.d.ts +2 -0
- package/build/src/api copy.d.ts.map +1 -0
- package/build/src/api copy.js +153 -0
- package/build/src/api copy.js.map +1 -0
- package/build/src/api-web.d.ts +2 -0
- package/build/src/api-web.d.ts.map +1 -0
- package/build/src/api-web.js +45 -0
- package/build/src/api-web.js.map +1 -0
- package/build/src/api.d.ts +33 -0
- package/build/src/api.d.ts.map +1 -0
- package/build/src/api.js +78 -0
- package/build/src/api.js.map +1 -0
- package/build/src/cli.d.ts +2 -0
- package/build/src/cli.d.ts.map +1 -0
- package/build/src/cli.js +1040 -0
- package/build/src/cli.js.map +1 -0
- package/build/src/schemas/HotDBInflux.d.ts +63 -0
- package/build/src/schemas/HotDBInflux.d.ts.map +1 -0
- package/build/src/schemas/HotDBInflux.js +239 -0
- package/build/src/schemas/HotDBInflux.js.map +1 -0
- package/build/src/schemas/HotDBMigration.d.ts +19 -0
- package/build/src/schemas/HotDBMigration.d.ts.map +1 -0
- package/build/src/schemas/HotDBMigration.js +15 -0
- package/build/src/schemas/HotDBMigration.js.map +1 -0
- package/build/src/schemas/HotDBMySQL.d.ts +65 -0
- package/build/src/schemas/HotDBMySQL.d.ts.map +1 -0
- package/build/src/schemas/HotDBMySQL.js +387 -0
- package/build/src/schemas/HotDBMySQL.js.map +1 -0
- package/build/src/schemas/HotDBSchema.d.ts +15 -0
- package/build/src/schemas/HotDBSchema.d.ts.map +1 -0
- package/build/src/schemas/HotDBSchema.js +19 -0
- package/build/src/schemas/HotDBSchema.js.map +1 -0
- package/build/src/schemas/influx/InfluxSchema.d.ts +14 -0
- package/build/src/schemas/influx/InfluxSchema.d.ts.map +1 -0
- package/build/src/schemas/influx/InfluxSchema.js +33 -0
- package/build/src/schemas/influx/InfluxSchema.js.map +1 -0
- package/build/src/schemas/mysql/MySQLSchema.d.ts +39 -0
- package/build/src/schemas/mysql/MySQLSchema.d.ts.map +1 -0
- package/build/src/schemas/mysql/MySQLSchema.js +151 -0
- package/build/src/schemas/mysql/MySQLSchema.js.map +1 -0
- package/build/src/schemas/mysql/MySQLSchemaField.d.ts +168 -0
- package/build/src/schemas/mysql/MySQLSchemaField.d.ts.map +1 -0
- package/build/src/schemas/mysql/MySQLSchemaField.js +260 -0
- package/build/src/schemas/mysql/MySQLSchemaField.js.map +1 -0
- package/build/src/schemas/mysql/MySQLSchemaTable.d.ts +49 -0
- package/build/src/schemas/mysql/MySQLSchemaTable.d.ts.map +1 -0
- package/build/src/schemas/mysql/MySQLSchemaTable.js +310 -0
- package/build/src/schemas/mysql/MySQLSchemaTable.js.map +1 -0
- package/build-web/HotStaq.js +2 -0
- package/build-web/HotStaq.min.js +119 -0
- package/build-web/HotStaqTests_HelloWorldAPI.js +133 -0
- package/builder/docker/Dockerfile.linux.gen +42 -0
- package/builder/docker/README.md +36 -0
- package/builder/docker/app/start.sh +8 -0
- package/builder/docker/dockerignore +3 -0
- package/builder/docker/scripts/build.bat +11 -0
- package/builder/docker/scripts/build.sh +11 -0
- package/builder/docker/scripts/start-app.bat +7 -0
- package/builder/docker/scripts/start-app.sh +7 -0
- package/builder/docker/scripts/stop-app.bat +5 -0
- package/builder/docker/scripts/stop-app.sh +5 -0
- package/builder/docker-compose/docker-compose.gen.yaml +41 -0
- package/builder/docker-compose/env-skeleton +4 -0
- package/creator/project/.vscode/launch.json +59 -0
- package/creator/project/README.md +20 -0
- package/creator/project/gitignore +118 -0
- package/creator/project/npmignore +118 -0
- package/creator/public/api-test.hott +28 -0
- package/creator/public/index.hott +12 -0
- package/creator/ts/src/AppAPI.ts +30 -0
- package/creator/ts/src/HelloWorld.ts +39 -0
- package/creator/ts/src/WebExport.ts +7 -0
- package/creator/ts/tsconfig-web.json +73 -0
- package/creator/ts/tsconfig.json +73 -0
- package/creator/ts/webpack-api.config.js +57 -0
- package/dbstart.sh +19 -0
- package/dbstop.sh +4 -0
- package/docs/.nojekyll +1 -0
- package/docs/README.md +130 -0
- package/docs/classes/Hot.md +477 -0
- package/docs/classes/HotAPI.md +369 -0
- package/docs/classes/HotClient.md +95 -0
- package/docs/classes/HotComponent.md +279 -0
- package/docs/classes/HotDB.md +247 -0
- package/docs/classes/HotDBInflux.md +404 -0
- package/docs/classes/HotDBMigration.md +80 -0
- package/docs/classes/HotDBMySQL.md +310 -0
- package/docs/classes/HotDBSchema.md +51 -0
- package/docs/classes/HotFile.md +353 -0
- package/docs/classes/HotHTTPServer.md +700 -0
- package/docs/classes/HotLog.md +162 -0
- package/docs/classes/HotPage.md +357 -0
- package/docs/classes/HotRoute.md +312 -0
- package/docs/classes/HotRouteMethod.md +271 -0
- package/docs/classes/HotServer.md +311 -0
- package/docs/classes/HotStaq.md +1155 -0
- package/docs/classes/HotTestDestination.md +58 -0
- package/docs/classes/HotTestDriver.md +332 -0
- package/docs/classes/HotTestElement.md +88 -0
- package/docs/classes/HotTestElementOptions.md +71 -0
- package/docs/classes/HotTestMap.md +92 -0
- package/docs/classes/HotTestSeleniumDriver.md +542 -0
- package/docs/classes/HotTester.md +653 -0
- package/docs/classes/HotTesterAPI.md +493 -0
- package/docs/classes/HotTesterMocha.md +843 -0
- package/docs/classes/HotTesterMochaSelenium.md +896 -0
- package/docs/classes/HotTesterServer.md +633 -0
- package/docs/classes/InfluxSchema.md +74 -0
- package/docs/classes/MySQLSchema.md +199 -0
- package/docs/classes/MySQLSchemaField.md +330 -0
- package/docs/classes/MySQLSchemaTable.md +176 -0
- package/docs/enums/ConnectionStatus.md +43 -0
- package/docs/enums/DeveloperMode.md +38 -0
- package/docs/enums/EventExecutionType.md +43 -0
- package/docs/enums/HTTPMethod.md +32 -0
- package/docs/enums/HotDBGenerationType.md +30 -0
- package/docs/enums/HotLogLevel.md +88 -0
- package/docs/interfaces/HotDBConnectionInterface.md +116 -0
- package/docs/interfaces/HotDestination.md +62 -0
- package/docs/interfaces/HotSite.md +187 -0
- package/docs/interfaces/HotSiteMapPath.md +37 -0
- package/docs/interfaces/HotSiteRoute.md +79 -0
- package/docs/interfaces/HotStartOptions.md +115 -0
- package/docs/interfaces/HotTestPage.md +44 -0
- package/docs/interfaces/HotTestStop.md +62 -0
- package/docs/interfaces/IHotComponent.md +135 -0
- package/docs/interfaces/IHotStaq.md +118 -0
- package/docs/interfaces/IHotTestElement.md +54 -0
- package/docs/interfaces/IHotTestElementOptions.md +43 -0
- package/docs/interfaces/MySQLResults.md +43 -0
- package/docs/interfaces/MySQLSchemaFieldResult.md +75 -0
- package/docs/modules.md +182 -0
- package/package.json +65 -0
- package/selenium-start.sh +7 -0
- package/selenium-stop.sh +3 -0
- package/src/Hot.ts +319 -0
- package/src/HotAPI.ts +386 -0
- package/src/HotAgentAPI.ts +43 -0
- package/src/HotAgentRoute.ts +44 -0
- package/src/HotBuilder.ts +221 -0
- package/src/HotClient.ts +40 -0
- package/src/HotComponent.ts +158 -0
- package/src/HotCreator.ts +470 -0
- package/src/HotDB.ts +79 -0
- package/src/HotDBConnectionInterface.ts +40 -0
- package/src/HotFile.ts +617 -0
- package/src/HotGenerator.ts +446 -0
- package/src/HotHTTPServer.ts +954 -0
- package/src/HotIO.ts +160 -0
- package/src/HotLog.ts +158 -0
- package/src/HotPage.ts +206 -0
- package/src/HotRoute.ts +137 -0
- package/src/HotRouteMethod.ts +216 -0
- package/src/HotServer.ts +211 -0
- package/src/HotSetAsWeb.ts +3 -0
- package/src/HotStaq.ts +1881 -0
- package/src/HotTestDriver.ts +171 -0
- package/src/HotTestElement.ts +97 -0
- package/src/HotTestMap.ts +130 -0
- package/src/HotTestSeleniumDriver.ts +381 -0
- package/src/HotTester.ts +696 -0
- package/src/HotTesterAPI.ts +126 -0
- package/src/HotTesterMocha.ts +133 -0
- package/src/HotTesterMochaSelenium.ts +189 -0
- package/src/HotTesterServer.ts +551 -0
- package/src/api-web.ts +48 -0
- package/src/api.ts +103 -0
- package/src/cli.ts +1225 -0
- package/src/schemas/HotDBInflux.ts +211 -0
- package/src/schemas/HotDBMigration.ts +24 -0
- package/src/schemas/HotDBMySQL.ts +312 -0
- package/src/schemas/HotDBSchema.ts +21 -0
- package/src/schemas/influx/InfluxSchema.ts +19 -0
- package/src/schemas/mysql/MySQLSchema.ts +90 -0
- package/src/schemas/mysql/MySQLSchemaField.ts +408 -0
- package/src/schemas/mysql/MySQLSchemaTable.ts +353 -0
- package/temp/HotStaqWeb.ts +59 -0
- package/tsconfig-generator.json +17 -0
- package/tsconfig-web.json +74 -0
- package/tsconfig.json +73 -0
- package/webpack.config.generator.js +41 -0
- package/webpack.config.js +53 -0
- package/webpack.config.tests.js +56 -0
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
47
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
|
+
function step(op) {
|
|
50
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
51
|
+
while (_) try {
|
|
52
|
+
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;
|
|
53
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
54
|
+
switch (op[0]) {
|
|
55
|
+
case 0: case 1: t = op; break;
|
|
56
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
57
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
58
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
59
|
+
default:
|
|
60
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
61
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
62
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
63
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
64
|
+
if (t[2]) _.ops.pop();
|
|
65
|
+
_.trys.pop(); continue;
|
|
66
|
+
}
|
|
67
|
+
op = body.call(thisArg, _);
|
|
68
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
69
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
73
|
+
exports.HotDBMySQL = void 0;
|
|
74
|
+
var mysql = __importStar(require("mysql"));
|
|
75
|
+
var HotDB_1 = require("../HotDB");
|
|
76
|
+
/**
|
|
77
|
+
* The MySQL database connection.
|
|
78
|
+
*/
|
|
79
|
+
var HotDBMySQL = /** @class */ (function (_super) {
|
|
80
|
+
__extends(HotDBMySQL, _super);
|
|
81
|
+
function HotDBMySQL(db, type, schema) {
|
|
82
|
+
if (db === void 0) { db = null; }
|
|
83
|
+
if (type === void 0) { type = "mysql"; }
|
|
84
|
+
if (schema === void 0) { schema = null; }
|
|
85
|
+
return _super.call(this, db, type, schema) || this;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Connect to the database.
|
|
89
|
+
*/
|
|
90
|
+
HotDBMySQL.prototype.connect = function (connectionInfo) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
+
var _this = this;
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
return [2 /*return*/, (new Promise(function (resolve, reject) {
|
|
95
|
+
_this.connectionStatus = HotDB_1.ConnectionStatus.Connecting;
|
|
96
|
+
_this.db = mysql.createConnection({
|
|
97
|
+
host: connectionInfo.server,
|
|
98
|
+
user: connectionInfo.username,
|
|
99
|
+
password: connectionInfo.password,
|
|
100
|
+
port: connectionInfo.port,
|
|
101
|
+
database: connectionInfo.database
|
|
102
|
+
});
|
|
103
|
+
_this.db.connect(function (err) {
|
|
104
|
+
var args = [];
|
|
105
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
106
|
+
args[_i - 1] = arguments[_i];
|
|
107
|
+
}
|
|
108
|
+
if (err != null) {
|
|
109
|
+
_this.connectionStatus = HotDB_1.ConnectionStatus.Disconnected;
|
|
110
|
+
throw err;
|
|
111
|
+
}
|
|
112
|
+
_this.connectionStatus = HotDB_1.ConnectionStatus.Connected;
|
|
113
|
+
resolve(args[0]);
|
|
114
|
+
});
|
|
115
|
+
}))];
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Checks to see if this has a database connection.
|
|
121
|
+
*/
|
|
122
|
+
HotDBMySQL.prototype.dbCheck = function () {
|
|
123
|
+
if (this.db == null)
|
|
124
|
+
throw new Error("Not connected to a database!");
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Synchronize all tables.
|
|
128
|
+
*/
|
|
129
|
+
/*async syncAllTables (migrationsDirectory: string, throwErrors: boolean = true): Promise<boolean>
|
|
130
|
+
{
|
|
131
|
+
this.dbCheck ();
|
|
132
|
+
|
|
133
|
+
const migrationsPath: string = ppath.normalize (migrationsDirectory);
|
|
134
|
+
|
|
135
|
+
if (await HotIO.exists (migrationsPath) === false)
|
|
136
|
+
throw new Error (`Migrations directory ${migrationsDirectory} does not exist.`);
|
|
137
|
+
|
|
138
|
+
let files: string[] = await HotIO.listFiles (migrationsPath);
|
|
139
|
+
let versions: {
|
|
140
|
+
version: number;
|
|
141
|
+
fileContent: string;
|
|
142
|
+
}[] = [];
|
|
143
|
+
|
|
144
|
+
for (let iIdx = 0; iIdx < files.length; iIdx++)
|
|
145
|
+
{
|
|
146
|
+
let file: string = ppath.normalize (files[iIdx]);
|
|
147
|
+
let fileContent: string = await HotIO.readTextFile (file);
|
|
148
|
+
|
|
149
|
+
let context = { HotDBMigration: HotDBMigration, db: this, migrationPath: file };
|
|
150
|
+
vm.createContext (context);
|
|
151
|
+
let migrationVersion: any = vm.runInContext (
|
|
152
|
+
`${fileContent}
|
|
153
|
+
let migration = new Migration ();
|
|
154
|
+
return (migration.version);
|
|
155
|
+
`, context);
|
|
156
|
+
|
|
157
|
+
versions.push ({ version: migrationVersion, fileContent: fileContent });
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
versions.sort ();
|
|
161
|
+
|
|
162
|
+
await this.syncMigrationsTableTracker ();
|
|
163
|
+
|
|
164
|
+
let madeModifications: boolean = false;
|
|
165
|
+
|
|
166
|
+
for (let tableName in this.schema.tables)
|
|
167
|
+
{
|
|
168
|
+
let tempResult: boolean = await this.syncTable (tableName, throwErrors);
|
|
169
|
+
|
|
170
|
+
if (tempResult === true)
|
|
171
|
+
madeModifications = true;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return (madeModifications);
|
|
175
|
+
}*/
|
|
176
|
+
/**
|
|
177
|
+
* Synchronize a table. This will create/modify the table based on whether it
|
|
178
|
+
* exists, and if there's been any changes to any fields.
|
|
179
|
+
*/
|
|
180
|
+
/*async syncTable (tableName: string, throwErrors: boolean = true): Promise<boolean>
|
|
181
|
+
{
|
|
182
|
+
this.dbCheck ();
|
|
183
|
+
|
|
184
|
+
let tableExists: boolean = await this.tableCheck (tableName);
|
|
185
|
+
let madeModifications: boolean = false;
|
|
186
|
+
|
|
187
|
+
if (tableExists === false)
|
|
188
|
+
{
|
|
189
|
+
let structure: string[] = await this.schema.generateTableStructure (tableName);
|
|
190
|
+
// This should always be structure[0]. There should only be 1 string to process
|
|
191
|
+
// for a newly created table.
|
|
192
|
+
let tempResults = await this.query (structure[0], []);
|
|
193
|
+
|
|
194
|
+
if (tempResults.error == null)
|
|
195
|
+
madeModifications = true;
|
|
196
|
+
else
|
|
197
|
+
{
|
|
198
|
+
if (throwErrors === true)
|
|
199
|
+
throw new Error (`Error while creating table ${tableName}: ${tempResults.error.message}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
else
|
|
203
|
+
{*/
|
|
204
|
+
/*let structure: string[] = await this.schema.generateTableStructure (
|
|
205
|
+
tableName, HotDBGenerationType.Modify, this);
|
|
206
|
+
let tempResults = await this.multiQuery (structure);
|
|
207
|
+
|
|
208
|
+
for (let iIdx = 0; iIdx < tempResults.length; iIdx++)
|
|
209
|
+
{
|
|
210
|
+
let results = tempResults[iIdx];
|
|
211
|
+
|
|
212
|
+
if (results.error != null)
|
|
213
|
+
{
|
|
214
|
+
madeModifications = false;
|
|
215
|
+
|
|
216
|
+
if (throwErrors === true)
|
|
217
|
+
throw new Error (`Error while creating table ${tableName}: ${results.error.message}`);
|
|
218
|
+
}
|
|
219
|
+
else
|
|
220
|
+
madeModifications = true;
|
|
221
|
+
}*/
|
|
222
|
+
/*}
|
|
223
|
+
|
|
224
|
+
return (madeModifications);
|
|
225
|
+
}*/
|
|
226
|
+
/**
|
|
227
|
+
* Sync the migrations table tracker. This keeps track of all database table migrations.
|
|
228
|
+
* If the "migrations" table is missing, it will be created.
|
|
229
|
+
*/
|
|
230
|
+
HotDBMySQL.prototype.syncMigrationsTableTracker = function () {
|
|
231
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
232
|
+
return __generator(this, function (_a) {
|
|
233
|
+
switch (_a.label) {
|
|
234
|
+
case 0: return [4 /*yield*/, this.tableCheck("migrations")];
|
|
235
|
+
case 1:
|
|
236
|
+
if (!((_a.sent()) === false)) return [3 /*break*/, 3];
|
|
237
|
+
/// @todo Verify that this actually created.
|
|
238
|
+
return [4 /*yield*/, this.db.query("create table if not exists migrations (\n\t\t\t\t\tversion datetime not null\n\t\t\t\t);")];
|
|
239
|
+
case 2:
|
|
240
|
+
/// @todo Verify that this actually created.
|
|
241
|
+
_a.sent();
|
|
242
|
+
_a.label = 3;
|
|
243
|
+
case 3: return [2 /*return*/];
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* Checks if the table exists.
|
|
250
|
+
*/
|
|
251
|
+
HotDBMySQL.prototype.tableCheck = function (tableName) {
|
|
252
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
253
|
+
var tableExists;
|
|
254
|
+
var _this = this;
|
|
255
|
+
return __generator(this, function (_a) {
|
|
256
|
+
switch (_a.label) {
|
|
257
|
+
case 0:
|
|
258
|
+
this.dbCheck();
|
|
259
|
+
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
260
|
+
_this.db.query("SELECT table_name FROM information_schema.tables where table_name = ?;", [tableName], function (err, results, fields) {
|
|
261
|
+
var result = false;
|
|
262
|
+
if (results != null) {
|
|
263
|
+
if (results.length > 0)
|
|
264
|
+
result = true;
|
|
265
|
+
}
|
|
266
|
+
resolve(result);
|
|
267
|
+
});
|
|
268
|
+
})];
|
|
269
|
+
case 1:
|
|
270
|
+
tableExists = _a.sent();
|
|
271
|
+
return [2 /*return*/, (tableExists)];
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* The query to make.
|
|
278
|
+
*/
|
|
279
|
+
HotDBMySQL.prototype.query = function (queryString, values) {
|
|
280
|
+
if (values === void 0) { values = []; }
|
|
281
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
282
|
+
var dbresults;
|
|
283
|
+
var _this = this;
|
|
284
|
+
return __generator(this, function (_a) {
|
|
285
|
+
switch (_a.label) {
|
|
286
|
+
case 0:
|
|
287
|
+
this.dbCheck();
|
|
288
|
+
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
289
|
+
_this.db.query(queryString, values, function (err, results, fields) {
|
|
290
|
+
resolve({ error: err, results: results, fields: fields });
|
|
291
|
+
});
|
|
292
|
+
})];
|
|
293
|
+
case 1:
|
|
294
|
+
dbresults = _a.sent();
|
|
295
|
+
return [2 /*return*/, (dbresults)];
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* Make a single query. If there are no results, null will be in MySQLResults.results
|
|
302
|
+
*/
|
|
303
|
+
HotDBMySQL.prototype.queryOne = function (queryString, values) {
|
|
304
|
+
if (values === void 0) { values = []; }
|
|
305
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
306
|
+
var dbresults;
|
|
307
|
+
var _this = this;
|
|
308
|
+
return __generator(this, function (_a) {
|
|
309
|
+
switch (_a.label) {
|
|
310
|
+
case 0:
|
|
311
|
+
this.dbCheck();
|
|
312
|
+
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
313
|
+
_this.db.query(queryString, values, function (err, results, fields) {
|
|
314
|
+
var tempResults = null;
|
|
315
|
+
if (results != null) {
|
|
316
|
+
if (results.length > 0)
|
|
317
|
+
tempResults = results[0];
|
|
318
|
+
}
|
|
319
|
+
resolve({ error: err, results: tempResults, fields: fields });
|
|
320
|
+
});
|
|
321
|
+
})];
|
|
322
|
+
case 1:
|
|
323
|
+
dbresults = _a.sent();
|
|
324
|
+
return [2 /*return*/, (dbresults)];
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
});
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
* Make multiple queries. **Warning! This can be a security vulnerability
|
|
331
|
+
* if misused! Ideally this should only be used when making changes to tables!
|
|
332
|
+
* Additionally, this could overwhelm the server and each command sent is not
|
|
333
|
+
* guaranteed to be done in order.**
|
|
334
|
+
*/
|
|
335
|
+
HotDBMySQL.prototype.multiQuery = function (queryStrings) {
|
|
336
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
337
|
+
var alldbresults, promises, _loop_1, iIdx;
|
|
338
|
+
var _this = this;
|
|
339
|
+
return __generator(this, function (_a) {
|
|
340
|
+
switch (_a.label) {
|
|
341
|
+
case 0:
|
|
342
|
+
this.dbCheck();
|
|
343
|
+
alldbresults = [];
|
|
344
|
+
promises = [];
|
|
345
|
+
_loop_1 = function (iIdx) {
|
|
346
|
+
/// @fixme This could overwhelm the server, and each query most likely will
|
|
347
|
+
/// not be done in a deterministic order. Consider adding a 5-10ms delay between
|
|
348
|
+
/// each query.
|
|
349
|
+
promises.push(new Promise(function (resolve, reject) {
|
|
350
|
+
var queryString = queryStrings[iIdx];
|
|
351
|
+
var queryValues = [];
|
|
352
|
+
if (typeof (queryString) !== "string") {
|
|
353
|
+
queryValues = queryString.values;
|
|
354
|
+
queryString = queryString.query;
|
|
355
|
+
}
|
|
356
|
+
_this.db.query(queryString, queryValues, function (err, results, fields) {
|
|
357
|
+
resolve({ error: err, results: results, fields: fields });
|
|
358
|
+
});
|
|
359
|
+
}));
|
|
360
|
+
};
|
|
361
|
+
for (iIdx = 0; iIdx < queryStrings.length; iIdx++) {
|
|
362
|
+
_loop_1(iIdx);
|
|
363
|
+
}
|
|
364
|
+
return [4 /*yield*/, Promise.all(promises)];
|
|
365
|
+
case 1:
|
|
366
|
+
alldbresults = _a.sent();
|
|
367
|
+
return [2 /*return*/, (alldbresults)];
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
373
|
+
* Disconnect from the server.
|
|
374
|
+
*/
|
|
375
|
+
HotDBMySQL.prototype.disconnect = function () {
|
|
376
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
377
|
+
return __generator(this, function (_a) {
|
|
378
|
+
this.dbCheck();
|
|
379
|
+
this.db.destroy();
|
|
380
|
+
return [2 /*return*/];
|
|
381
|
+
});
|
|
382
|
+
});
|
|
383
|
+
};
|
|
384
|
+
return HotDBMySQL;
|
|
385
|
+
}(HotDB_1.HotDB));
|
|
386
|
+
exports.HotDBMySQL = HotDBMySQL;
|
|
387
|
+
//# sourceMappingURL=HotDBMySQL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HotDBMySQL.js","sourceRoot":"","sources":["../../../src/schemas/HotDBMySQL.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA+B;AAK/B,kCAAmD;AAgBnD;;GAEG;AACH;IAAgC,8BAAkD;IAEjF,oBAAa,EAA2B,EAAE,IAAsB,EAAE,MAA0B;QAA/E,mBAAA,EAAA,SAA2B;QAAE,qBAAA,EAAA,cAAsB;QAAE,uBAAA,EAAA,aAA0B;eAE3F,kBAAO,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC;IACzB,CAAC;IAED;;OAEG;IACG,4BAAO,GAAb,UAAe,cAAwC;;;;gBAEtD,sBAAO,CAAC,IAAI,OAAO,CAAS,UAAC,OAAO,EAAE,MAAM;wBAE1C,KAAI,CAAC,gBAAgB,GAAG,wBAAgB,CAAC,UAAU,CAAC;wBACpD,KAAI,CAAC,EAAE,GAAG,KAAK,CAAC,gBAAgB,CAAE;4BAChC,IAAI,EAAE,cAAc,CAAC,MAAM;4BAC3B,IAAI,EAAE,cAAc,CAAC,QAAQ;4BAC7B,QAAQ,EAAE,cAAc,CAAC,QAAQ;4BACjC,IAAI,EAAE,cAAc,CAAC,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AAC,CAAC;4BACL,CAAC,CAAC,CAAC,CAAC;;wBArBN,KAAS,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE;oCAA5C,IAAI;yBAsBZ;wBAEc,qBAAM,OAAO,CAAC,GAAG,CAAE,QAAQ,CAAC,EAAA;;wBAA3C,YAAY,GAAG,SAA4B,CAAC;wBAE5C,sBAAO,CAAC,YAAY,CAAC,EAAC;;;;KACtB;IAED;;OAEG;IACG,+BAAU,GAAhB;;;gBAEC,IAAI,CAAC,OAAO,EAAG,CAAC;gBAEhB,IAAI,CAAC,EAAE,CAAC,OAAO,EAAG,CAAC;;;;KACnB;IACF,iBAAC;AAAD,CAAC,AA/RD,CAAgC,aAAK,GA+RpC;AA/RY,gCAAU"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare enum HotDBGenerationType {
|
|
2
|
+
Create = 0,
|
|
3
|
+
Modify = 1
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The parent database schema.
|
|
7
|
+
*/
|
|
8
|
+
export declare class HotDBSchema {
|
|
9
|
+
/**
|
|
10
|
+
* The name of this schema.
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
constructor(name: string);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=HotDBSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HotDBSchema.d.ts","sourceRoot":"","sources":["../../../src/schemas/HotDBSchema.ts"],"names":[],"mappings":"AAAA,oBAAY,mBAAmB;IAE9B,MAAM,IAAA;IACN,MAAM,IAAA;CACN;AAED;;GAEG;AACH,qBAAa,WAAW;IAEvB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;gBAEA,IAAI,EAAE,MAAM;CAIzB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HotDBSchema = exports.HotDBGenerationType = void 0;
|
|
4
|
+
var HotDBGenerationType;
|
|
5
|
+
(function (HotDBGenerationType) {
|
|
6
|
+
HotDBGenerationType[HotDBGenerationType["Create"] = 0] = "Create";
|
|
7
|
+
HotDBGenerationType[HotDBGenerationType["Modify"] = 1] = "Modify";
|
|
8
|
+
})(HotDBGenerationType = exports.HotDBGenerationType || (exports.HotDBGenerationType = {}));
|
|
9
|
+
/**
|
|
10
|
+
* The parent database schema.
|
|
11
|
+
*/
|
|
12
|
+
var HotDBSchema = /** @class */ (function () {
|
|
13
|
+
function HotDBSchema(name) {
|
|
14
|
+
this.name = name;
|
|
15
|
+
}
|
|
16
|
+
return HotDBSchema;
|
|
17
|
+
}());
|
|
18
|
+
exports.HotDBSchema = HotDBSchema;
|
|
19
|
+
//# sourceMappingURL=HotDBSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HotDBSchema.js","sourceRoot":"","sources":["../../../src/schemas/HotDBSchema.ts"],"names":[],"mappings":";;;AAAA,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAE9B,iEAAM,CAAA;IACN,iEAAM,CAAA;AACP,CAAC,EAJW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAI9B;AAED;;GAEG;AACH;IAOC,qBAAa,IAAY;QAExB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IACF,kBAAC;AAAD,CAAC,AAXD,IAWC;AAXY,kCAAW"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HotDBSchema } from "../HotDBSchema";
|
|
2
|
+
/**
|
|
3
|
+
* The Influx schema.
|
|
4
|
+
*/
|
|
5
|
+
export declare class InfluxSchema extends HotDBSchema {
|
|
6
|
+
/**
|
|
7
|
+
* The buckets in this schema.
|
|
8
|
+
*/
|
|
9
|
+
buckets: {
|
|
10
|
+
[name: string]: any;
|
|
11
|
+
};
|
|
12
|
+
constructor(name: string);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=InfluxSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfluxSchema.d.ts","sourceRoot":"","sources":["../../../../src/schemas/influx/InfluxSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;GAEG;AACH,qBAAa,YAAa,SAAQ,WAAW;IAE5C;;OAEG;IACH,OAAO,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;gBAEpB,IAAI,EAAE,MAAM;CAMzB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.InfluxSchema = void 0;
|
|
19
|
+
var HotDBSchema_1 = require("../HotDBSchema");
|
|
20
|
+
/**
|
|
21
|
+
* The Influx schema.
|
|
22
|
+
*/
|
|
23
|
+
var InfluxSchema = /** @class */ (function (_super) {
|
|
24
|
+
__extends(InfluxSchema, _super);
|
|
25
|
+
function InfluxSchema(name) {
|
|
26
|
+
var _this = _super.call(this, name) || this;
|
|
27
|
+
_this.buckets = {};
|
|
28
|
+
return _this;
|
|
29
|
+
}
|
|
30
|
+
return InfluxSchema;
|
|
31
|
+
}(HotDBSchema_1.HotDBSchema));
|
|
32
|
+
exports.InfluxSchema = InfluxSchema;
|
|
33
|
+
//# sourceMappingURL=InfluxSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfluxSchema.js","sourceRoot":"","sources":["../../../../src/schemas/influx/InfluxSchema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,8CAA6C;AAE7C;;GAEG;AACH;IAAkC,gCAAW;IAO5C,sBAAa,IAAY;QAAzB,YAEC,kBAAO,IAAI,CAAC,SAGZ;QADA,KAAI,CAAC,OAAO,GAAG,EAAE,CAAC;;IACnB,CAAC;IACF,mBAAC;AAAD,CAAC,AAbD,CAAkC,yBAAW,GAa5C;AAbY,oCAAY"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { MySQLSchemaTable } from "./MySQLSchemaTable";
|
|
2
|
+
import { MySQLSchemaField } from "./MySQLSchemaField";
|
|
3
|
+
import { HotDBSchema, HotDBGenerationType } from "../HotDBSchema";
|
|
4
|
+
import { HotDBMySQL } from "../HotDBMySQL";
|
|
5
|
+
/**
|
|
6
|
+
* The MySQL schema.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MySQLSchema extends HotDBSchema {
|
|
9
|
+
/**
|
|
10
|
+
* The tables in this schema.
|
|
11
|
+
*/
|
|
12
|
+
tables: {
|
|
13
|
+
[name: string]: MySQLSchemaTable;
|
|
14
|
+
};
|
|
15
|
+
constructor(name: string);
|
|
16
|
+
/**
|
|
17
|
+
* Add a table to this schema.
|
|
18
|
+
*/
|
|
19
|
+
addTable(table: MySQLSchemaTable): void;
|
|
20
|
+
/**
|
|
21
|
+
* Add a field to a table.
|
|
22
|
+
*/
|
|
23
|
+
addFieldToTable(tableName: string, field: MySQLSchemaField): void;
|
|
24
|
+
/**
|
|
25
|
+
* Add a field to a table.
|
|
26
|
+
*/
|
|
27
|
+
addFieldsToTable(tableName: string, fields: MySQLSchemaField[]): void;
|
|
28
|
+
/**
|
|
29
|
+
* Generate a table's structure. If type is set to modify, you must pass a db with an
|
|
30
|
+
* active connection.
|
|
31
|
+
*/
|
|
32
|
+
generateTableStructure(tableName: string, type?: HotDBGenerationType, db?: HotDBMySQL): Promise<string[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Generate the entire db structure. If type is set to modify, you must pass a db with an
|
|
35
|
+
* active connection.
|
|
36
|
+
*/
|
|
37
|
+
generateStructure(type?: HotDBGenerationType, db?: HotDBMySQL): Promise<string[][]>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=MySQLSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MySQLSchema.d.ts","sourceRoot":"","sources":["../../../../src/schemas/mysql/MySQLSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;GAEG;AACH,qBAAa,WAAY,SAAQ,WAAW;IAE3C;;OAEG;IACH,MAAM,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAAA;KAAE,CAAC;gBAEhC,IAAI,EAAE,MAAM;IAOzB;;OAEG;IACH,QAAQ,CAAE,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAKxC;;OAEG;IACH,eAAe,CAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB;IAQ3D;;OAEG;IACH,gBAAgB,CAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE;IAY/D;;;OAGG;IACG,sBAAsB,CAAE,SAAS,EAAE,MAAM,EAC9C,IAAI,GAAE,mBAAgD,EAAE,EAAE,GAAE,UAAiB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAWlG;;;OAGG;IACG,iBAAiB,CAAE,IAAI,GAAE,mBAAgD,EAAE,EAAE,GAAE,UAAiB,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;CAa5H"}
|