Updates
This commit is contained in:
Vendored
+34
-3
@@ -18,6 +18,7 @@ const __1 = __importDefault(require(".."));
|
||||
const util_1 = require("util");
|
||||
const db_schema_to_type_1 = __importDefault(require("../package-shared/functions/dsql/db-schema-to-type"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const debug_log_1 = __importDefault(require("../package-shared/utils/logging/debug-log"));
|
||||
const args = (0, util_1.parseArgs)({
|
||||
args: process.argv,
|
||||
options: {
|
||||
@@ -33,15 +34,39 @@ const args = (0, util_1.parseArgs)({
|
||||
},
|
||||
outfile: {
|
||||
type: "string",
|
||||
default: process.env.DSQL_DB_NAME,
|
||||
short: "o",
|
||||
},
|
||||
debug: {
|
||||
type: "boolean",
|
||||
default: false,
|
||||
short: "d",
|
||||
},
|
||||
},
|
||||
strict: false,
|
||||
});
|
||||
(() => __awaiter(void 0, void 0, void 0, function* () {
|
||||
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")
|
||||
throw new Error("Database name is required");
|
||||
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");
|
||||
}
|
||||
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);
|
||||
}
|
||||
}))();
|
||||
|
||||
Reference in New Issue
Block a user