Updates
This commit is contained in:
Vendored
+18
-1
@@ -33,6 +33,11 @@ const args = (0, util_1.parseArgs)({
|
||||
default: process.env.DSQL_DB_NAME,
|
||||
short: "d",
|
||||
},
|
||||
userid: {
|
||||
type: "string",
|
||||
default: process.env.DSQL_API_USER_ID,
|
||||
short: "i",
|
||||
},
|
||||
outfile: {
|
||||
type: "string",
|
||||
short: "o",
|
||||
@@ -64,10 +69,12 @@ if (args.values.envfile && typeof args.values.envfile == "string") {
|
||||
}
|
||||
}
|
||||
const finalEnv = Object.assign(Object.assign({}, process.env), appendedEnv);
|
||||
process.env = Object.assign(Object.assign({}, process.env), appendedEnv);
|
||||
(() => __awaiter(void 0, void 0, void 0, function* () {
|
||||
try {
|
||||
const key = args.values.apiKey || finalEnv["DSQL_FULL_ACCESS_API_KEY"];
|
||||
const database = args.values.database || finalEnv["DSQL_DB_NAME"];
|
||||
const user_id = args.values.userid || finalEnv["DSQL_API_USER_ID"] || "1";
|
||||
if (args.values.debug) {
|
||||
(0, debug_log_1.default)({
|
||||
log: args.values,
|
||||
@@ -94,12 +101,22 @@ const finalEnv = Object.assign(Object.assign({}, process.env), appendedEnv);
|
||||
throw new Error("API key is required");
|
||||
if (!args.values.outfile || typeof args.values.outfile !== "string")
|
||||
throw new Error("Outfile are required");
|
||||
if (!user_id || typeof user_id !== "string")
|
||||
throw new Error("Outfile are required");
|
||||
const schema = yield __1.default.getSchema({
|
||||
key,
|
||||
database,
|
||||
user_id: 1,
|
||||
user_id,
|
||||
});
|
||||
const dbSchema = schema.payload;
|
||||
if (args.values.debug) {
|
||||
(0, debug_log_1.default)({
|
||||
log: schema,
|
||||
label: "schema",
|
||||
title: "Schema to Typedef",
|
||||
addTime: true,
|
||||
});
|
||||
}
|
||||
if (!dbSchema)
|
||||
throw new Error("No schema found");
|
||||
const definitions = (0, db_schema_to_type_1.default)({ dbSchema });
|
||||
|
||||
Reference in New Issue
Block a user