Updates
This commit is contained in:
parent
18e29fa413
commit
8bcb35a8f0
@ -53,6 +53,8 @@ function checks(_a) {
|
|||||||
if ((_e = newQuery === null || newQuery === void 0 ? void 0 : newQuery.searchQuery) === null || _e === void 0 ? void 0 : _e.join) {
|
if ((_e = newQuery === null || newQuery === void 0 ? void 0 : newQuery.searchQuery) === null || _e === void 0 ? void 0 : _e.join) {
|
||||||
for (let i = 0; i < newQuery.searchQuery.join.length; i++) {
|
for (let i = 0; i < newQuery.searchQuery.join.length; i++) {
|
||||||
const join = newQuery.searchQuery.join[i];
|
const join = newQuery.searchQuery.join[i];
|
||||||
|
if (!join)
|
||||||
|
continue;
|
||||||
const joinTableName = join.tableName;
|
const joinTableName = join.tableName;
|
||||||
const selectFields = join.selectFields;
|
const selectFields = join.selectFields;
|
||||||
if (allowedTables === null || allowedTables === void 0 ? void 0 : allowedTables[0]) {
|
if (allowedTables === null || allowedTables === void 0 ? void 0 : allowedTables[0]) {
|
||||||
|
|||||||
@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.default = sqlGenerator;
|
exports.default = sqlGenerator;
|
||||||
|
const lodash_1 = require("lodash");
|
||||||
const sql_gen_operator_gen_1 = __importDefault(require("./sql-gen-operator-gen"));
|
const sql_gen_operator_gen_1 = __importDefault(require("./sql-gen-operator-gen"));
|
||||||
/**
|
/**
|
||||||
* # SQL Query Generator
|
* # SQL Query Generator
|
||||||
@ -170,6 +171,7 @@ function sqlGenerator({ tableName, genObject, dbFullName, count }) {
|
|||||||
str +=
|
str +=
|
||||||
"," +
|
"," +
|
||||||
genObject.join
|
genObject.join
|
||||||
|
.filter((j) => !(0, lodash_1.isUndefined)(j))
|
||||||
.map((joinObj) => {
|
.map((joinObj) => {
|
||||||
const joinTableName = joinObj.alias
|
const joinTableName = joinObj.alias
|
||||||
? joinObj.alias
|
? joinObj.alias
|
||||||
@ -212,6 +214,7 @@ function sqlGenerator({ tableName, genObject, dbFullName, count }) {
|
|||||||
str +=
|
str +=
|
||||||
" " +
|
" " +
|
||||||
genObject.join
|
genObject.join
|
||||||
|
.filter((j) => !(0, lodash_1.isUndefined)(j))
|
||||||
.map((join) => {
|
.map((join) => {
|
||||||
return (join.joinType +
|
return (join.joinType +
|
||||||
" " +
|
" " +
|
||||||
|
|||||||
2
dist/package-shared/types/index.d.ts
vendored
2
dist/package-shared/types/index.d.ts
vendored
@ -851,7 +851,7 @@ export type ServerQueryParam<T extends {
|
|||||||
addUserId?: {
|
addUserId?: {
|
||||||
fieldName: keyof T;
|
fieldName: keyof T;
|
||||||
};
|
};
|
||||||
join?: ServerQueryParamsJoin<K>[];
|
join?: (ServerQueryParamsJoin<K> | undefined)[];
|
||||||
group?: (keyof T)[];
|
group?: (keyof T)[];
|
||||||
countSubQueries?: ServerQueryParamsCount[];
|
countSubQueries?: ServerQueryParamsCount[];
|
||||||
fullTextSearch?: ServerQueryParamFullTextSearch<T>;
|
fullTextSearch?: ServerQueryParamFullTextSearch<T>;
|
||||||
|
|||||||
@ -77,6 +77,9 @@ export default async function checks<
|
|||||||
if (newQuery?.searchQuery?.join) {
|
if (newQuery?.searchQuery?.join) {
|
||||||
for (let i = 0; i < newQuery.searchQuery.join.length; i++) {
|
for (let i = 0; i < newQuery.searchQuery.join.length; i++) {
|
||||||
const join = newQuery.searchQuery.join[i];
|
const join = newQuery.searchQuery.join[i];
|
||||||
|
|
||||||
|
if (!join) continue;
|
||||||
|
|
||||||
const joinTableName = join.tableName;
|
const joinTableName = join.tableName;
|
||||||
const selectFields = join.selectFields;
|
const selectFields = join.selectFields;
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { isUndefined } from "lodash";
|
||||||
import {
|
import {
|
||||||
ServerQueryParam,
|
ServerQueryParam,
|
||||||
ServerQueryParamOrder,
|
ServerQueryParamOrder,
|
||||||
@ -43,7 +44,7 @@ export default function sqlGenerator<
|
|||||||
field,
|
field,
|
||||||
}: {
|
}: {
|
||||||
queryObj: ServerQueryQueryObject[string];
|
queryObj: ServerQueryQueryObject[string];
|
||||||
join?: ServerQueryParamsJoin[];
|
join?: (ServerQueryParamsJoin | undefined)[];
|
||||||
field?: string;
|
field?: string;
|
||||||
}) {
|
}) {
|
||||||
const finalFieldName = (() => {
|
const finalFieldName = (() => {
|
||||||
@ -247,6 +248,7 @@ export default function sqlGenerator<
|
|||||||
str +=
|
str +=
|
||||||
"," +
|
"," +
|
||||||
genObject.join
|
genObject.join
|
||||||
|
.filter((j) => !isUndefined(j))
|
||||||
.map((joinObj) => {
|
.map((joinObj) => {
|
||||||
const joinTableName = joinObj.alias
|
const joinTableName = joinObj.alias
|
||||||
? joinObj.alias
|
? joinObj.alias
|
||||||
@ -294,6 +296,7 @@ export default function sqlGenerator<
|
|||||||
str +=
|
str +=
|
||||||
" " +
|
" " +
|
||||||
genObject.join
|
genObject.join
|
||||||
|
.filter((j) => !isUndefined(j))
|
||||||
.map((join) => {
|
.map((join) => {
|
||||||
return (
|
return (
|
||||||
join.joinType +
|
join.joinType +
|
||||||
|
|||||||
@ -1043,7 +1043,7 @@ export type ServerQueryParam<
|
|||||||
addUserId?: {
|
addUserId?: {
|
||||||
fieldName: keyof T;
|
fieldName: keyof T;
|
||||||
};
|
};
|
||||||
join?: ServerQueryParamsJoin<K>[];
|
join?: (ServerQueryParamsJoin<K> | undefined)[];
|
||||||
group?: (keyof T)[];
|
group?: (keyof T)[];
|
||||||
countSubQueries?: ServerQueryParamsCount[];
|
countSubQueries?: ServerQueryParamsCount[];
|
||||||
fullTextSearch?: ServerQueryParamFullTextSearch<T>;
|
fullTextSearch?: ServerQueryParamFullTextSearch<T>;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/datasquirel",
|
"name": "@moduletrace/datasquirel",
|
||||||
"version": "5.7.18",
|
"version": "5.7.19",
|
||||||
"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