Updates
This commit is contained in:
parent
b3353b8b70
commit
a68d1c1d3f
3
dist/index.d.ts
vendored
3
dist/index.d.ts
vendored
@ -29,7 +29,6 @@ import sqlInsertGenerator from "./package-shared/functions/dsql/sql/sql-insert-g
|
|||||||
import sqlDeleteGenerator from "./package-shared/functions/dsql/sql/sql-delete-generator";
|
import sqlDeleteGenerator from "./package-shared/functions/dsql/sql/sql-delete-generator";
|
||||||
import trimSql from "./package-shared/utils/trim-sql";
|
import trimSql from "./package-shared/utils/trim-sql";
|
||||||
import parseCookies from "./package-shared/utils/backend/parseCookies";
|
import parseCookies from "./package-shared/utils/backend/parseCookies";
|
||||||
import httpRequest from "./package-shared/functions/backend/httpRequest";
|
|
||||||
import connDbHandler from "./package-shared/utils/db/conn-db-handler";
|
import connDbHandler from "./package-shared/utils/db/conn-db-handler";
|
||||||
import encrypt from "./package-shared/functions/dsql/encrypt";
|
import encrypt from "./package-shared/functions/dsql/encrypt";
|
||||||
import decrypt from "./package-shared/functions/dsql/decrypt";
|
import decrypt from "./package-shared/functions/dsql/decrypt";
|
||||||
@ -127,7 +126,7 @@ declare const datasquirel: {
|
|||||||
hashPassword: typeof hashPassword;
|
hashPassword: typeof hashPassword;
|
||||||
};
|
};
|
||||||
parseCookies: typeof parseCookies;
|
parseCookies: typeof parseCookies;
|
||||||
httpRequest: typeof httpRequest;
|
httpRequest: any;
|
||||||
connDbHandler: typeof connDbHandler;
|
connDbHandler: typeof connDbHandler;
|
||||||
debugLog: typeof debugLog;
|
debugLog: typeof debugLog;
|
||||||
parseEnv: typeof parseEnv;
|
parseEnv: typeof parseEnv;
|
||||||
|
@ -121,7 +121,7 @@ function apiCreateUser(_a) {
|
|||||||
"/images/user-preset-thumbnail.png" }),
|
"/images/user-preset-thumbnail.png" }),
|
||||||
});
|
});
|
||||||
if (addUser === null || addUser === void 0 ? void 0 : addUser.insertId) {
|
if (addUser === null || addUser === void 0 ? void 0 : addUser.insertId) {
|
||||||
const newlyAddedUserQuery = `SELECT id,first_name,last_name,email,username,phone,image,image_thumbnail,city,state,country,zip_code,address,verification_status,more_user_data FROM ${dbFullName}.users WHERE id='${addUser.insertId}'`;
|
const newlyAddedUserQuery = `SELECT id,uuid,first_name,last_name,email,username,image,image_thumbnail,verification_status FROM ${dbFullName}.users WHERE id='${addUser.insertId}'`;
|
||||||
const newlyAddedUser = yield (0, varDatabaseDbHandler_1.default)({
|
const newlyAddedUser = yield (0, varDatabaseDbHandler_1.default)({
|
||||||
queryString: newlyAddedUserQuery,
|
queryString: newlyAddedUserQuery,
|
||||||
database: dbFullName,
|
database: dbFullName,
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
import { HttpFunctionResponse, HttpRequestParams } from "../../types";
|
|
||||||
/**
|
|
||||||
* # Generate a http Request
|
|
||||||
*/
|
|
||||||
export default function httpRequest<ReqObj extends {
|
|
||||||
[k: string]: any;
|
|
||||||
} = {
|
|
||||||
[k: string]: any;
|
|
||||||
}, ResObj extends {
|
|
||||||
[k: string]: any;
|
|
||||||
} = {
|
|
||||||
[k: string]: any;
|
|
||||||
}>(params: HttpRequestParams<ReqObj>): Promise<HttpFunctionResponse<ResObj>>;
|
|
@ -1,91 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.default = httpRequest;
|
|
||||||
const node_http_1 = __importDefault(require("node:http"));
|
|
||||||
const node_https_1 = __importDefault(require("node:https"));
|
|
||||||
const querystring_1 = __importDefault(require("querystring"));
|
|
||||||
const serialize_query_1 = __importDefault(require("../../utils/serialize-query"));
|
|
||||||
/**
|
|
||||||
* # Generate a http Request
|
|
||||||
*/
|
|
||||||
function httpRequest(params) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const isUrlEncodedFormBody = params.urlEncodedFormBody;
|
|
||||||
const reqPayloadString = params.body
|
|
||||||
? isUrlEncodedFormBody
|
|
||||||
? querystring_1.default.stringify(params.body)
|
|
||||||
: JSON.stringify(params.body).replace(/\n|\r|\n\r/gm, "")
|
|
||||||
: undefined;
|
|
||||||
const reqQueryString = params.query
|
|
||||||
? (0, serialize_query_1.default)(params.query)
|
|
||||||
: undefined;
|
|
||||||
const paramScheme = params.scheme;
|
|
||||||
const finalScheme = paramScheme == "http" ? node_http_1.default : node_https_1.default;
|
|
||||||
const finalPath = params.path
|
|
||||||
? params.path + (reqQueryString ? reqQueryString : "")
|
|
||||||
: undefined;
|
|
||||||
delete params.body;
|
|
||||||
delete params.scheme;
|
|
||||||
delete params.query;
|
|
||||||
delete params.urlEncodedFormBody;
|
|
||||||
let finalHeaders = {
|
|
||||||
"Content-Type": isUrlEncodedFormBody
|
|
||||||
? "application/x-www-form-urlencoded"
|
|
||||||
: "application/json",
|
|
||||||
};
|
|
||||||
if (reqPayloadString) {
|
|
||||||
finalHeaders["Content-Length"] =
|
|
||||||
Buffer.from(reqPayloadString).length;
|
|
||||||
}
|
|
||||||
finalHeaders = Object.assign(Object.assign({}, finalHeaders), params.headers);
|
|
||||||
/** @type {import("node:https").RequestOptions} */
|
|
||||||
const requestOptions = Object.assign(Object.assign({}, params), { headers: finalHeaders, port: paramScheme == "https" ? 443 : params.port, path: finalPath });
|
|
||||||
const httpsRequest = finalScheme.request(requestOptions,
|
|
||||||
/**
|
|
||||||
* Callback Function
|
|
||||||
*
|
|
||||||
* @description https request callback
|
|
||||||
*/
|
|
||||||
(response) => {
|
|
||||||
var str = "";
|
|
||||||
response.on("data", function (chunk) {
|
|
||||||
str += chunk;
|
|
||||||
});
|
|
||||||
response.on("end", function () {
|
|
||||||
const data = (() => {
|
|
||||||
try {
|
|
||||||
const jsonObj = JSON.parse(str);
|
|
||||||
return jsonObj;
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
resolve({
|
|
||||||
status: response.statusCode || 404,
|
|
||||||
data,
|
|
||||||
str,
|
|
||||||
requestedPath: finalPath,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
response.on("error", (err) => {
|
|
||||||
resolve({
|
|
||||||
status: response.statusCode || 404,
|
|
||||||
str,
|
|
||||||
error: err.message,
|
|
||||||
requestedPath: finalPath,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
if (reqPayloadString) {
|
|
||||||
httpsRequest.write(reqPayloadString);
|
|
||||||
}
|
|
||||||
httpsRequest.on("error", (error) => {
|
|
||||||
console.log("HTTPS request ERROR =>", error);
|
|
||||||
});
|
|
||||||
httpsRequest.end();
|
|
||||||
});
|
|
||||||
}
|
|
116
dist/package-shared/types/index.d.ts
vendored
116
dist/package-shared/types/index.d.ts
vendored
@ -1,4 +1,5 @@
|
|||||||
import type { RequestOptions } from "https";
|
import type { RequestOptions } from "https";
|
||||||
|
import { DSQL_DATASQUIREL_PROCESS_QUEUE } from "@/package-shared/types/dsql";
|
||||||
import { Editor } from "tinymce";
|
import { Editor } from "tinymce";
|
||||||
export type DSQL_DatabaseFullName = string;
|
export type DSQL_DatabaseFullName = string;
|
||||||
export interface DSQL_DatabaseSchemaType {
|
export interface DSQL_DatabaseSchemaType {
|
||||||
@ -336,7 +337,7 @@ export interface PostInsertReturn {
|
|||||||
protocol41: boolean;
|
protocol41: boolean;
|
||||||
changedRows: number;
|
changedRows: number;
|
||||||
}
|
}
|
||||||
export type UserType = DATASQUIREL_LoggedInUser;
|
export type UserType = DATASQUIREL_LoggedInUser & {};
|
||||||
export interface ApiKeyDef {
|
export interface ApiKeyDef {
|
||||||
name: string;
|
name: string;
|
||||||
scope: string;
|
scope: string;
|
||||||
@ -1414,4 +1415,117 @@ export interface MariaDBUser {
|
|||||||
default_role: string;
|
default_role: string;
|
||||||
max_statement_time: number;
|
max_statement_time: number;
|
||||||
}
|
}
|
||||||
|
export type PagePropsType = {
|
||||||
|
user?: UserType | null;
|
||||||
|
pageUrl?: string | null;
|
||||||
|
query?: any;
|
||||||
|
};
|
||||||
|
export type APIResponseObject<T extends any = any> = {
|
||||||
|
success: boolean;
|
||||||
|
payload?: T;
|
||||||
|
error?: any;
|
||||||
|
msg?: string;
|
||||||
|
queryRes?: any;
|
||||||
|
status?: number;
|
||||||
|
};
|
||||||
|
export declare const UserTypes: readonly ["su", "admin"];
|
||||||
|
export declare const SignUpParadigms: readonly [{
|
||||||
|
readonly name: "email";
|
||||||
|
}, {
|
||||||
|
readonly name: "google";
|
||||||
|
}];
|
||||||
|
export declare const QueueJobTypes: readonly ["dummy", "import-database"];
|
||||||
|
export declare const WebSocketEvents: readonly ["client:check-queue", "client:dev:queue", "client:delete-queue", "client:pty-shell", "server:error", "server:message", "server:ready", "server:success", "server:update", "server:queue", "server:dev:queue", "server:queue-deleted", "server:pty-shell"];
|
||||||
|
export type WebSocketDataType = {
|
||||||
|
event: (typeof WebSocketEvents)[number];
|
||||||
|
data?: {
|
||||||
|
queue?: DSQL_DATASQUIREL_PROCESS_QUEUE;
|
||||||
|
};
|
||||||
|
error?: string;
|
||||||
|
message?: string;
|
||||||
|
};
|
||||||
|
export declare const DatasquirelWindowEvents: readonly ["queue-started", "queue-complete", "queue-running"];
|
||||||
|
export type DatasquirelWindowEventPayloadType = {
|
||||||
|
event: (typeof DatasquirelWindowEvents)[number];
|
||||||
|
data?: {
|
||||||
|
queue?: DSQL_DATASQUIREL_PROCESS_QUEUE;
|
||||||
|
};
|
||||||
|
error?: string;
|
||||||
|
message?: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* # Docker Compose Types
|
||||||
|
*/
|
||||||
|
export type DockerCompose = {
|
||||||
|
services: DockerComposeServices;
|
||||||
|
networks: DockerComposeNetworks;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
export declare const DockerComposeServices: readonly ["setup", "cron", "reverse-proxy", "webapp", "websocket", "static", "db", "db-load-balancer", "post-db-setup"];
|
||||||
|
export type DockerComposeServices = {
|
||||||
|
[key in (typeof DockerComposeServices)[number]]: DockerComposeServiceWithBuildObject;
|
||||||
|
};
|
||||||
|
export type DockerComposeNetworks = {
|
||||||
|
datasquirel: {
|
||||||
|
driver: "bridge";
|
||||||
|
ipam: {
|
||||||
|
config: DockerComposeNetworkConfigObject[];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type DockerComposeNetworkConfigObject = {
|
||||||
|
subnet: string;
|
||||||
|
gateway: string;
|
||||||
|
};
|
||||||
|
export type DockerComposeServiceWithBuildObject = {
|
||||||
|
build: DockerComposeServicesBuildObject;
|
||||||
|
env_file: string;
|
||||||
|
container_name: string;
|
||||||
|
hostname: string;
|
||||||
|
volumes: string[];
|
||||||
|
environment: string[];
|
||||||
|
networks?: DockerComposeServiceNetworkObject;
|
||||||
|
restart?: string;
|
||||||
|
depends_on?: {
|
||||||
|
[k: string]: {
|
||||||
|
condition: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
user?: string;
|
||||||
|
};
|
||||||
|
export type DockerComposeServiceWithImage = Omit<DockerComposeServiceWithBuildObject, "build"> & {
|
||||||
|
image: string;
|
||||||
|
};
|
||||||
|
export type DockerComposeServicesBuildObject = {
|
||||||
|
context: string;
|
||||||
|
dockerfile: string;
|
||||||
|
};
|
||||||
|
export type DockerComposeServiceNetworkObject = {
|
||||||
|
datasquirel: {
|
||||||
|
ipv4_address: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* # Site Setup Types
|
||||||
|
*/
|
||||||
|
export type SiteSetup = {
|
||||||
|
docker: {
|
||||||
|
network: {
|
||||||
|
subnet: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type AppRefObject = {};
|
||||||
|
export type DsqlAppData = {
|
||||||
|
DSQL_REMOTE_SQL_HOST?: string;
|
||||||
|
DSQL_SU_USER_ID?: string;
|
||||||
|
DSQL_HOST_ENV?: string;
|
||||||
|
DSQL_HOST?: string;
|
||||||
|
DSQL_STATIC_HOST?: string;
|
||||||
|
DSQL_GOOGLE_CLIENT_ID?: string;
|
||||||
|
DSQL_TINY_MCE_API_KEY?: string;
|
||||||
|
DSQL_WEBSOCKET_URL?: string;
|
||||||
|
DSQL_FACEBOOK_APP_ID?: string;
|
||||||
|
DSQL_GITHUB_ID?: string;
|
||||||
|
};
|
||||||
export {};
|
export {};
|
||||||
|
51
dist/package-shared/types/index.js
vendored
51
dist/package-shared/types/index.js
vendored
@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.DsqlCrudActions = exports.DataCrudRequestMethods = exports.ServerQueryEqualities = exports.ServerQueryOperators = exports.TextFieldTypesArray = void 0;
|
exports.DockerComposeServices = exports.DatasquirelWindowEvents = exports.WebSocketEvents = exports.QueueJobTypes = exports.SignUpParadigms = exports.UserTypes = exports.DsqlCrudActions = exports.DataCrudRequestMethods = exports.ServerQueryEqualities = exports.ServerQueryOperators = exports.TextFieldTypesArray = void 0;
|
||||||
exports.TextFieldTypesArray = [
|
exports.TextFieldTypesArray = [
|
||||||
{ title: "Plain Text", value: "plain" },
|
{ title: "Plain Text", value: "plain" },
|
||||||
{ title: "Rich Text", value: "richText" },
|
{ title: "Rich Text", value: "richText" },
|
||||||
@ -21,3 +21,52 @@ exports.ServerQueryEqualities = [
|
|||||||
];
|
];
|
||||||
exports.DataCrudRequestMethods = ["GET", "POST", "PUT", "DELETE"];
|
exports.DataCrudRequestMethods = ["GET", "POST", "PUT", "DELETE"];
|
||||||
exports.DsqlCrudActions = ["insert", "update", "delete", "get"];
|
exports.DsqlCrudActions = ["insert", "update", "delete", "get"];
|
||||||
|
exports.UserTypes = ["su", "admin"];
|
||||||
|
exports.SignUpParadigms = [
|
||||||
|
{
|
||||||
|
name: "email",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "google",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
exports.QueueJobTypes = ["dummy", "import-database"];
|
||||||
|
exports.WebSocketEvents = [
|
||||||
|
/**
|
||||||
|
* # Client Events
|
||||||
|
* @description Events sent from Client to Server
|
||||||
|
*/
|
||||||
|
"client:check-queue",
|
||||||
|
"client:dev:queue",
|
||||||
|
"client:delete-queue",
|
||||||
|
"client:pty-shell",
|
||||||
|
/**
|
||||||
|
* # Server Events
|
||||||
|
* @description Events sent from Server to Client
|
||||||
|
*/
|
||||||
|
"server:error",
|
||||||
|
"server:message",
|
||||||
|
"server:ready",
|
||||||
|
"server:success",
|
||||||
|
"server:update",
|
||||||
|
"server:queue",
|
||||||
|
"server:dev:queue",
|
||||||
|
"server:queue-deleted",
|
||||||
|
"server:pty-shell",
|
||||||
|
];
|
||||||
|
exports.DatasquirelWindowEvents = [
|
||||||
|
"queue-started",
|
||||||
|
"queue-complete",
|
||||||
|
"queue-running",
|
||||||
|
];
|
||||||
|
exports.DockerComposeServices = [
|
||||||
|
"setup",
|
||||||
|
"cron",
|
||||||
|
"reverse-proxy",
|
||||||
|
"webapp",
|
||||||
|
"websocket",
|
||||||
|
"static",
|
||||||
|
"db",
|
||||||
|
"db-load-balancer",
|
||||||
|
"post-db-setup",
|
||||||
|
];
|
||||||
|
@ -51,7 +51,7 @@ function grabDirNames(param) {
|
|||||||
const userPrivateDbImportZipFilePath = userPrivateSQLExportsDir
|
const userPrivateDbImportZipFilePath = userPrivateSQLExportsDir
|
||||||
? path_1.default.join(userPrivateSQLExportsDir, userPrivateDbImportZipFileName)
|
? path_1.default.join(userPrivateSQLExportsDir, userPrivateDbImportZipFileName)
|
||||||
: undefined;
|
: undefined;
|
||||||
const dbNginxLoadBalancerConfigFile = path_1.default.join(appDir, "docker/mariadb/load-balancer/config/template/nginx.conf");
|
const dbNginxLoadBalancerConfigFile = path_1.default.join(appDir, "docker/services/mariadb/load-balancer/config/template/nginx.conf");
|
||||||
const dockerComposeFile = path_1.default.join(appDir, "docker-compose.yml");
|
const dockerComposeFile = path_1.default.join(appDir, "docker-compose.yml");
|
||||||
const testDockerComposeFile = path_1.default.join(appDir, "test.docker-compose.yml");
|
const testDockerComposeFile = path_1.default.join(appDir, "test.docker-compose.yml");
|
||||||
const extraDockerComposeFile = path_1.default.join(appDir, "extra.docker-compose.yml");
|
const extraDockerComposeFile = path_1.default.join(appDir, "extra.docker-compose.yml");
|
||||||
|
@ -144,7 +144,7 @@ export default async function apiCreateUser({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (addUser?.insertId) {
|
if (addUser?.insertId) {
|
||||||
const newlyAddedUserQuery = `SELECT id,first_name,last_name,email,username,phone,image,image_thumbnail,city,state,country,zip_code,address,verification_status,more_user_data FROM ${dbFullName}.users WHERE id='${addUser.insertId}'`;
|
const newlyAddedUserQuery = `SELECT id,uuid,first_name,last_name,email,username,image,image_thumbnail,verification_status FROM ${dbFullName}.users WHERE id='${addUser.insertId}'`;
|
||||||
|
|
||||||
const newlyAddedUser = await varDatabaseDbHandler({
|
const newlyAddedUser = await varDatabaseDbHandler({
|
||||||
queryString: newlyAddedUserQuery,
|
queryString: newlyAddedUserQuery,
|
||||||
|
@ -1,115 +0,0 @@
|
|||||||
import http from "node:http";
|
|
||||||
import https from "node:https";
|
|
||||||
import querystring from "querystring";
|
|
||||||
import serializeQuery from "../../utils/serialize-query";
|
|
||||||
import _ from "lodash";
|
|
||||||
import { HttpFunctionResponse, HttpRequestParams } from "../../types";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # Generate a http Request
|
|
||||||
*/
|
|
||||||
export default function httpRequest<
|
|
||||||
ReqObj extends { [k: string]: any } = { [k: string]: any },
|
|
||||||
ResObj extends { [k: string]: any } = { [k: string]: any }
|
|
||||||
>(params: HttpRequestParams<ReqObj>): Promise<HttpFunctionResponse<ResObj>> {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const isUrlEncodedFormBody = params.urlEncodedFormBody;
|
|
||||||
|
|
||||||
const reqPayloadString = params.body
|
|
||||||
? isUrlEncodedFormBody
|
|
||||||
? querystring.stringify(params.body)
|
|
||||||
: JSON.stringify(params.body).replace(/\n|\r|\n\r/gm, "")
|
|
||||||
: undefined;
|
|
||||||
|
|
||||||
const reqQueryString = params.query
|
|
||||||
? serializeQuery(params.query)
|
|
||||||
: undefined;
|
|
||||||
|
|
||||||
const paramScheme = params.scheme;
|
|
||||||
const finalScheme = paramScheme == "http" ? http : https;
|
|
||||||
|
|
||||||
const finalPath = params.path
|
|
||||||
? params.path + (reqQueryString ? reqQueryString : "")
|
|
||||||
: undefined;
|
|
||||||
|
|
||||||
delete params.body;
|
|
||||||
delete params.scheme;
|
|
||||||
delete params.query;
|
|
||||||
delete params.urlEncodedFormBody;
|
|
||||||
|
|
||||||
let finalHeaders: http.OutgoingHttpHeaders = {
|
|
||||||
"Content-Type": isUrlEncodedFormBody
|
|
||||||
? "application/x-www-form-urlencoded"
|
|
||||||
: "application/json",
|
|
||||||
};
|
|
||||||
|
|
||||||
if (reqPayloadString) {
|
|
||||||
finalHeaders["Content-Length"] =
|
|
||||||
Buffer.from(reqPayloadString).length;
|
|
||||||
}
|
|
||||||
|
|
||||||
finalHeaders = { ...finalHeaders, ...params.headers };
|
|
||||||
|
|
||||||
/** @type {import("node:https").RequestOptions} */
|
|
||||||
const requestOptions: import("node:https").RequestOptions = {
|
|
||||||
...params,
|
|
||||||
headers: finalHeaders,
|
|
||||||
port: paramScheme == "https" ? 443 : params.port,
|
|
||||||
path: finalPath,
|
|
||||||
};
|
|
||||||
|
|
||||||
const httpsRequest = finalScheme.request(
|
|
||||||
requestOptions,
|
|
||||||
/**
|
|
||||||
* Callback Function
|
|
||||||
*
|
|
||||||
* @description https request callback
|
|
||||||
*/
|
|
||||||
(response) => {
|
|
||||||
var str = "";
|
|
||||||
|
|
||||||
response.on("data", function (chunk) {
|
|
||||||
str += chunk;
|
|
||||||
});
|
|
||||||
|
|
||||||
response.on("end", function () {
|
|
||||||
const data = (() => {
|
|
||||||
try {
|
|
||||||
const jsonObj: { [k: string]: any } =
|
|
||||||
JSON.parse(str);
|
|
||||||
return jsonObj;
|
|
||||||
} catch (error) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
})() as any;
|
|
||||||
|
|
||||||
resolve({
|
|
||||||
status: response.statusCode || 404,
|
|
||||||
data,
|
|
||||||
str,
|
|
||||||
requestedPath: finalPath,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
response.on("error", (err) => {
|
|
||||||
resolve({
|
|
||||||
status: response.statusCode || 404,
|
|
||||||
str,
|
|
||||||
error: err.message,
|
|
||||||
requestedPath: finalPath,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (reqPayloadString) {
|
|
||||||
httpsRequest.write(reqPayloadString);
|
|
||||||
}
|
|
||||||
|
|
||||||
httpsRequest.on("error", (error) => {
|
|
||||||
console.log("HTTPS request ERROR =>", error);
|
|
||||||
});
|
|
||||||
|
|
||||||
httpsRequest.end();
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
import type { IncomingMessage, ServerResponse } from "http";
|
|
||||||
import type { RequestOptions } from "https";
|
import type { RequestOptions } from "https";
|
||||||
|
import { DSQL_DATASQUIREL_PROCESS_QUEUE } from "@/package-shared/types/dsql";
|
||||||
|
|
||||||
import { Editor } from "tinymce";
|
import { Editor } from "tinymce";
|
||||||
export type DSQL_DatabaseFullName = string;
|
export type DSQL_DatabaseFullName = string;
|
||||||
@ -358,7 +358,7 @@ export interface PostInsertReturn {
|
|||||||
changedRows: number;
|
changedRows: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserType = DATASQUIREL_LoggedInUser;
|
export type UserType = DATASQUIREL_LoggedInUser & {};
|
||||||
|
|
||||||
export interface ApiKeyDef {
|
export interface ApiKeyDef {
|
||||||
name: string;
|
name: string;
|
||||||
@ -1595,3 +1595,180 @@ export interface MariaDBUser {
|
|||||||
default_role: string;
|
default_role: string;
|
||||||
max_statement_time: number;
|
max_statement_time: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type PagePropsType = {
|
||||||
|
user?: UserType | null;
|
||||||
|
pageUrl?: string | null;
|
||||||
|
query?: any;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type APIResponseObject<T extends any = any> = {
|
||||||
|
success: boolean;
|
||||||
|
payload?: T;
|
||||||
|
error?: any;
|
||||||
|
msg?: string;
|
||||||
|
queryRes?: any;
|
||||||
|
status?: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const UserTypes = ["su", "admin"] as const;
|
||||||
|
|
||||||
|
export const SignUpParadigms = [
|
||||||
|
{
|
||||||
|
name: "email",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "google",
|
||||||
|
},
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
export const QueueJobTypes = ["dummy", "import-database"] as const;
|
||||||
|
|
||||||
|
export const WebSocketEvents = [
|
||||||
|
/**
|
||||||
|
* # Client Events
|
||||||
|
* @description Events sent from Client to Server
|
||||||
|
*/
|
||||||
|
"client:check-queue",
|
||||||
|
"client:dev:queue",
|
||||||
|
"client:delete-queue",
|
||||||
|
"client:pty-shell",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* # Server Events
|
||||||
|
* @description Events sent from Server to Client
|
||||||
|
*/
|
||||||
|
"server:error",
|
||||||
|
"server:message",
|
||||||
|
"server:ready",
|
||||||
|
"server:success",
|
||||||
|
"server:update",
|
||||||
|
"server:queue",
|
||||||
|
"server:dev:queue",
|
||||||
|
"server:queue-deleted",
|
||||||
|
"server:pty-shell",
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
export type WebSocketDataType = {
|
||||||
|
event: (typeof WebSocketEvents)[number];
|
||||||
|
data?: {
|
||||||
|
queue?: DSQL_DATASQUIREL_PROCESS_QUEUE;
|
||||||
|
};
|
||||||
|
error?: string;
|
||||||
|
message?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const DatasquirelWindowEvents = [
|
||||||
|
"queue-started",
|
||||||
|
"queue-complete",
|
||||||
|
"queue-running",
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
export type DatasquirelWindowEventPayloadType = {
|
||||||
|
event: (typeof DatasquirelWindowEvents)[number];
|
||||||
|
data?: {
|
||||||
|
queue?: DSQL_DATASQUIREL_PROCESS_QUEUE;
|
||||||
|
};
|
||||||
|
error?: string;
|
||||||
|
message?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* # Docker Compose Types
|
||||||
|
*/
|
||||||
|
export type DockerCompose = {
|
||||||
|
services: DockerComposeServices;
|
||||||
|
networks: DockerComposeNetworks;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const DockerComposeServices = [
|
||||||
|
"setup",
|
||||||
|
"cron",
|
||||||
|
"reverse-proxy",
|
||||||
|
"webapp",
|
||||||
|
"websocket",
|
||||||
|
"static",
|
||||||
|
"db",
|
||||||
|
"db-load-balancer",
|
||||||
|
"post-db-setup",
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
export type DockerComposeServices = {
|
||||||
|
[key in (typeof DockerComposeServices)[number]]: DockerComposeServiceWithBuildObject;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DockerComposeNetworks = {
|
||||||
|
datasquirel: {
|
||||||
|
driver: "bridge";
|
||||||
|
ipam: {
|
||||||
|
config: DockerComposeNetworkConfigObject[];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DockerComposeNetworkConfigObject = {
|
||||||
|
subnet: string;
|
||||||
|
gateway: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DockerComposeServiceWithBuildObject = {
|
||||||
|
build: DockerComposeServicesBuildObject;
|
||||||
|
env_file: string;
|
||||||
|
container_name: string;
|
||||||
|
hostname: string;
|
||||||
|
volumes: string[];
|
||||||
|
environment: string[];
|
||||||
|
networks?: DockerComposeServiceNetworkObject;
|
||||||
|
restart?: string;
|
||||||
|
depends_on?: {
|
||||||
|
[k: string]: {
|
||||||
|
condition: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
user?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DockerComposeServiceWithImage = Omit<
|
||||||
|
DockerComposeServiceWithBuildObject,
|
||||||
|
"build"
|
||||||
|
> & {
|
||||||
|
image: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DockerComposeServicesBuildObject = {
|
||||||
|
context: string;
|
||||||
|
dockerfile: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DockerComposeServiceNetworkObject = {
|
||||||
|
datasquirel: {
|
||||||
|
ipv4_address: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* # Site Setup Types
|
||||||
|
*/
|
||||||
|
export type SiteSetup = {
|
||||||
|
docker: {
|
||||||
|
network: {
|
||||||
|
subnet: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AppRefObject = {};
|
||||||
|
|
||||||
|
export type DsqlAppData = {
|
||||||
|
DSQL_REMOTE_SQL_HOST?: string;
|
||||||
|
DSQL_SU_USER_ID?: string;
|
||||||
|
DSQL_HOST_ENV?: string;
|
||||||
|
DSQL_HOST?: string;
|
||||||
|
DSQL_STATIC_HOST?: string;
|
||||||
|
DSQL_GOOGLE_CLIENT_ID?: string;
|
||||||
|
DSQL_TINY_MCE_API_KEY?: string;
|
||||||
|
DSQL_WEBSOCKET_URL?: string;
|
||||||
|
DSQL_FACEBOOK_APP_ID?: string;
|
||||||
|
DSQL_GITHUB_ID?: string;
|
||||||
|
};
|
||||||
|
@ -68,7 +68,7 @@ export default function grabDirNames(param?: Param) {
|
|||||||
|
|
||||||
const dbNginxLoadBalancerConfigFile = path.join(
|
const dbNginxLoadBalancerConfigFile = path.join(
|
||||||
appDir,
|
appDir,
|
||||||
"docker/mariadb/load-balancer/config/template/nginx.conf"
|
"docker/services/mariadb/load-balancer/config/template/nginx.conf"
|
||||||
);
|
);
|
||||||
|
|
||||||
const dockerComposeFile = path.join(appDir, "docker-compose.yml");
|
const dockerComposeFile = path.join(appDir, "docker-compose.yml");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/datasquirel",
|
"name": "@moduletrace/datasquirel",
|
||||||
"version": "4.6.4",
|
"version": "4.6.5",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
Loading…
Reference in New Issue
Block a user