Updates
This commit is contained in:
Vendored
+2
-1
@@ -7,9 +7,10 @@ type Param = {
|
||||
tableName?: string;
|
||||
useLocal?: boolean;
|
||||
user_id?: string | number;
|
||||
debug?: boolean;
|
||||
};
|
||||
/**
|
||||
* # Make a get request to Datasquirel API
|
||||
*/
|
||||
export default function get({ key, db, query, queryValues, tableName, useLocal, user_id, }: Param): Promise<GetReturn>;
|
||||
export default function get({ key, db, query, queryValues, tableName, useLocal, user_id, debug, }: Param): Promise<GetReturn>;
|
||||
export {};
|
||||
|
||||
Vendored
+15
-2
@@ -1,5 +1,4 @@
|
||||
"use strict";
|
||||
// @ts-check
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
@@ -23,7 +22,7 @@ const serialize_query_1 = __importDefault(require("../package-shared/utils/seria
|
||||
* # Make a get request to Datasquirel API
|
||||
*/
|
||||
function get(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ key, db, query, queryValues, tableName, useLocal, user_id, }) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ key, db, query, queryValues, tableName, useLocal, user_id, debug, }) {
|
||||
const grabedHostNames = (0, grab_host_names_1.default)();
|
||||
const { host, port, scheme } = grabedHostNames;
|
||||
/**
|
||||
@@ -44,6 +43,9 @@ function get(_a) {
|
||||
dbSchema = JSON.parse(fs_1.default.readFileSync(localDbSchemaPath, "utf8"));
|
||||
}
|
||||
catch (error) { }
|
||||
if (debug) {
|
||||
console.log("apiGet:Running Locally ...");
|
||||
}
|
||||
return yield (0, get_1.default)({
|
||||
dbFullName: DSQL_DB_NAME,
|
||||
query,
|
||||
@@ -51,6 +53,7 @@ function get(_a) {
|
||||
tableName,
|
||||
dbSchema,
|
||||
useLocal,
|
||||
debug,
|
||||
});
|
||||
}
|
||||
/**
|
||||
@@ -66,9 +69,19 @@ function get(_a) {
|
||||
? JSON.stringify(queryValues)
|
||||
: undefined,
|
||||
tableName,
|
||||
debug,
|
||||
};
|
||||
if (debug) {
|
||||
console.log("apiGet:queryObject", queryObject);
|
||||
}
|
||||
const queryString = (0, serialize_query_1.default)(Object.assign({}, queryObject));
|
||||
if (debug) {
|
||||
console.log("apiGet:queryString", queryString);
|
||||
}
|
||||
let path = `/api/query/${user_id || grabedHostNames.user_id}/get${queryString}`;
|
||||
if (debug) {
|
||||
console.log("apiGet:path", path);
|
||||
}
|
||||
const requestObject = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user