Updates
This commit is contained in:
parent
6e32bbb4e0
commit
c24afca519
37
dist/engine/schema-to-typedef.js
vendored
37
dist/engine/schema-to-typedef.js
vendored
@ -18,6 +18,7 @@ const __1 = __importDefault(require(".."));
|
|||||||
const util_1 = require("util");
|
const util_1 = require("util");
|
||||||
const db_schema_to_type_1 = __importDefault(require("../package-shared/functions/dsql/db-schema-to-type"));
|
const db_schema_to_type_1 = __importDefault(require("../package-shared/functions/dsql/db-schema-to-type"));
|
||||||
const path_1 = __importDefault(require("path"));
|
const path_1 = __importDefault(require("path"));
|
||||||
|
const debug_log_1 = __importDefault(require("../package-shared/utils/logging/debug-log"));
|
||||||
const args = (0, util_1.parseArgs)({
|
const args = (0, util_1.parseArgs)({
|
||||||
args: process.argv,
|
args: process.argv,
|
||||||
options: {
|
options: {
|
||||||
@ -33,15 +34,39 @@ const args = (0, util_1.parseArgs)({
|
|||||||
},
|
},
|
||||||
outfile: {
|
outfile: {
|
||||||
type: "string",
|
type: "string",
|
||||||
default: process.env.DSQL_DB_NAME,
|
|
||||||
short: "o",
|
short: "o",
|
||||||
},
|
},
|
||||||
|
debug: {
|
||||||
|
type: "boolean",
|
||||||
|
default: false,
|
||||||
|
short: "d",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
strict: false,
|
strict: false,
|
||||||
});
|
});
|
||||||
(() => __awaiter(void 0, void 0, void 0, function* () {
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
const { apiKey: key, database, outfile } = args.values;
|
const { apiKey: key, database, outfile, debug } = args.values;
|
||||||
|
if (debug) {
|
||||||
|
(0, debug_log_1.default)({
|
||||||
|
log: args.values,
|
||||||
|
label: "Arguments",
|
||||||
|
title: "Schema to Typedef",
|
||||||
|
addTime: true,
|
||||||
|
});
|
||||||
|
(0, debug_log_1.default)({
|
||||||
|
log: process.env.DSQL_FULL_ACCESS_API_KEY,
|
||||||
|
label: "process.env.DSQL_FULL_ACCESS_API_KEY",
|
||||||
|
title: "Schema to Typedef",
|
||||||
|
addTime: true,
|
||||||
|
});
|
||||||
|
(0, debug_log_1.default)({
|
||||||
|
log: process.env.DSQL_DB_NAME,
|
||||||
|
label: "process.env.DSQL_DB_NAME",
|
||||||
|
title: "Schema to Typedef",
|
||||||
|
addTime: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
if (!database || typeof database !== "string")
|
if (!database || typeof database !== "string")
|
||||||
throw new Error("Database name is required");
|
throw new Error("Database name is required");
|
||||||
if (!key || typeof key !== "string")
|
if (!key || typeof key !== "string")
|
||||||
@ -65,7 +90,13 @@ const args = (0, util_1.parseArgs)({
|
|||||||
fs_1.default.writeFileSync(finalOutfile, (definitions === null || definitions === void 0 ? void 0 : definitions.join("\n\n")) || "", "utf-8");
|
fs_1.default.writeFileSync(finalOutfile, (definitions === null || definitions === void 0 ? void 0 : definitions.join("\n\n")) || "", "utf-8");
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.log("Error:", error.message);
|
(0, debug_log_1.default)({
|
||||||
|
log: error.message,
|
||||||
|
label: "Error",
|
||||||
|
title: "Schema to Typedef",
|
||||||
|
addTime: true,
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}))();
|
}))();
|
||||||
|
@ -7,6 +7,7 @@ import { parseArgs } from "util";
|
|||||||
import { DSQL_DatabaseSchemaType } from "../package-shared/types";
|
import { DSQL_DatabaseSchemaType } from "../package-shared/types";
|
||||||
import dbSchemaToType from "../package-shared/functions/dsql/db-schema-to-type";
|
import dbSchemaToType from "../package-shared/functions/dsql/db-schema-to-type";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
import debugLog from "../package-shared/utils/logging/debug-log";
|
||||||
|
|
||||||
const args = parseArgs({
|
const args = parseArgs({
|
||||||
args: process.argv,
|
args: process.argv,
|
||||||
@ -23,16 +24,41 @@ const args = parseArgs({
|
|||||||
},
|
},
|
||||||
outfile: {
|
outfile: {
|
||||||
type: "string",
|
type: "string",
|
||||||
default: process.env.DSQL_DB_NAME,
|
|
||||||
short: "o",
|
short: "o",
|
||||||
},
|
},
|
||||||
|
debug: {
|
||||||
|
type: "boolean",
|
||||||
|
default: false,
|
||||||
|
short: "d",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
strict: false,
|
strict: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
const { apiKey: key, database, outfile } = args.values;
|
const { apiKey: key, database, outfile, debug } = args.values;
|
||||||
|
|
||||||
|
if (debug) {
|
||||||
|
debugLog({
|
||||||
|
log: args.values,
|
||||||
|
label: "Arguments",
|
||||||
|
title: "Schema to Typedef",
|
||||||
|
addTime: true,
|
||||||
|
});
|
||||||
|
debugLog({
|
||||||
|
log: process.env.DSQL_FULL_ACCESS_API_KEY,
|
||||||
|
label: "process.env.DSQL_FULL_ACCESS_API_KEY",
|
||||||
|
title: "Schema to Typedef",
|
||||||
|
addTime: true,
|
||||||
|
});
|
||||||
|
debugLog({
|
||||||
|
log: process.env.DSQL_DB_NAME,
|
||||||
|
label: "process.env.DSQL_DB_NAME",
|
||||||
|
title: "Schema to Typedef",
|
||||||
|
addTime: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (!database || typeof database !== "string")
|
if (!database || typeof database !== "string")
|
||||||
throw new Error("Database name is required");
|
throw new Error("Database name is required");
|
||||||
@ -65,7 +91,13 @@ const args = parseArgs({
|
|||||||
"utf-8"
|
"utf-8"
|
||||||
);
|
);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.log("Error:", error.message);
|
debugLog({
|
||||||
|
log: error.message,
|
||||||
|
label: "Error",
|
||||||
|
title: "Schema to Typedef",
|
||||||
|
addTime: true,
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/datasquirel",
|
"name": "@moduletrace/datasquirel",
|
||||||
"version": "4.3.0",
|
"version": "4.3.1",
|
||||||
"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