@prisma-next/sql-orm-lane 0.1.0-pr.46.2 → 0.1.0-pr.47.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-AIYGMPVJ.js → chunk-KQPLODPT.js} +166 -208
- package/dist/chunk-KQPLODPT.js.map +1 -0
- package/dist/exports/orm.d.ts +1 -1
- package/dist/exports/orm.js +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +1 -1
- package/dist/{orm-Bi3TkJHa.d.ts → orm-DAnGd7z2.d.ts} +7 -7
- package/package.json +11 -9
- package/dist/chunk-AIYGMPVJ.js.map +0 -1
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
createDeleteAst,
|
|
13
13
|
createInsertAst,
|
|
14
14
|
createJoinOnExpr,
|
|
15
|
-
createNullCheckExpr,
|
|
16
15
|
createOrderByItem,
|
|
17
16
|
createParamRef,
|
|
18
17
|
createSelectAst,
|
|
@@ -94,10 +93,10 @@ function errorMissingAlias(index) {
|
|
|
94
93
|
throw planInvalid(`Missing alias at index ${index}`);
|
|
95
94
|
}
|
|
96
95
|
function errorMissingColumn(alias, index) {
|
|
97
|
-
throw planInvalid(`Missing column for alias
|
|
96
|
+
throw planInvalid(`Missing column for alias ${alias} at index ${index}`);
|
|
98
97
|
}
|
|
99
98
|
function errorInvalidColumn(alias, index) {
|
|
100
|
-
throw planInvalid(`Invalid column for alias
|
|
99
|
+
throw planInvalid(`Invalid column for alias ${alias} at index ${index}`);
|
|
101
100
|
}
|
|
102
101
|
function errorFailedToBuildWhereClause() {
|
|
103
102
|
throw planInvalid("Failed to build WHERE clause");
|
|
@@ -114,115 +113,37 @@ function assertParameterExists(paramsMap, paramName) {
|
|
|
114
113
|
return paramsMap[paramName];
|
|
115
114
|
}
|
|
116
115
|
|
|
117
|
-
// src/utils/guards.ts
|
|
118
|
-
import { getColumnMeta, isParamPlaceholder } from "@prisma-next/sql-relational-core/utils/guards";
|
|
119
|
-
function extractBaseColumnRef(expr) {
|
|
120
|
-
if (expr.kind === "col") {
|
|
121
|
-
return expr;
|
|
122
|
-
}
|
|
123
|
-
return extractBaseColumnRef(expr.self);
|
|
124
|
-
}
|
|
125
|
-
function collectColumnRefs(expr) {
|
|
126
|
-
if (expr.kind === "col") {
|
|
127
|
-
return [expr];
|
|
128
|
-
}
|
|
129
|
-
if (expr.kind === "operation") {
|
|
130
|
-
const refs = collectColumnRefs(expr.self);
|
|
131
|
-
for (const arg of expr.args) {
|
|
132
|
-
refs.push(...collectColumnRefs(arg));
|
|
133
|
-
}
|
|
134
|
-
return refs;
|
|
135
|
-
}
|
|
136
|
-
return [];
|
|
137
|
-
}
|
|
138
|
-
function isOperationExpr(expr) {
|
|
139
|
-
return expr != null && expr.kind === "operation";
|
|
140
|
-
}
|
|
141
|
-
function isExpressionBuilder(value) {
|
|
142
|
-
return typeof value === "object" && value !== null && "kind" in value && value.kind === "expression";
|
|
143
|
-
}
|
|
144
|
-
function extractExpression(builder) {
|
|
145
|
-
if (isExpressionBuilder(builder)) {
|
|
146
|
-
return builder.expr;
|
|
147
|
-
}
|
|
148
|
-
const colBuilder = builder;
|
|
149
|
-
return {
|
|
150
|
-
kind: "col",
|
|
151
|
-
table: colBuilder.table,
|
|
152
|
-
column: colBuilder.column
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
function getColumnInfo(expr) {
|
|
156
|
-
if (isExpressionBuilder(expr)) {
|
|
157
|
-
const baseCol = extractBaseColumnRef(expr.expr);
|
|
158
|
-
return { table: baseCol.table, column: baseCol.column };
|
|
159
|
-
}
|
|
160
|
-
const colBuilder = expr;
|
|
161
|
-
return { table: colBuilder.table, column: colBuilder.column };
|
|
162
|
-
}
|
|
163
|
-
function isColumnBuilder(value) {
|
|
164
|
-
return typeof value === "object" && value !== null && "kind" in value && value.kind === "column";
|
|
165
|
-
}
|
|
166
|
-
|
|
167
116
|
// src/selection/predicates.ts
|
|
168
117
|
function buildWhereExpr(where, contract, paramsMap, descriptors, values) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
paramName: ""
|
|
174
|
-
};
|
|
118
|
+
const placeholder = where.right;
|
|
119
|
+
const paramName = placeholder.name;
|
|
120
|
+
if (!Object.hasOwn(paramsMap, paramName)) {
|
|
121
|
+
errorMissingParameter(paramName);
|
|
175
122
|
}
|
|
123
|
+
const value = paramsMap[paramName];
|
|
124
|
+
const index = values.push(value);
|
|
176
125
|
let leftExpr;
|
|
177
126
|
let codecId;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (leftExpr.kind === "col") {
|
|
182
|
-
const contractTable = contract.storage.tables[leftExpr.table];
|
|
183
|
-
if (!contractTable) {
|
|
184
|
-
errorUnknownTable(leftExpr.table);
|
|
185
|
-
}
|
|
186
|
-
const columnMeta = contractTable.columns[leftExpr.column];
|
|
187
|
-
if (columnMeta) {
|
|
188
|
-
codecId = columnMeta.codecId;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
if (isParamPlaceholder(where.right)) {
|
|
192
|
-
const placeholder = where.right;
|
|
193
|
-
paramName = placeholder.name;
|
|
194
|
-
if (!Object.hasOwn(paramsMap, paramName)) {
|
|
195
|
-
errorMissingParameter(paramName);
|
|
196
|
-
}
|
|
197
|
-
const value = paramsMap[paramName];
|
|
198
|
-
const index = values.push(value);
|
|
199
|
-
if (leftExpr.kind === "col") {
|
|
200
|
-
const contractTable = contract.storage.tables[leftExpr.table];
|
|
201
|
-
const columnMeta = contractTable?.columns[leftExpr.column];
|
|
202
|
-
const builderColumnMeta = isColumnBuilder(where.left) ? getColumnMeta(where.left) : isExpressionBuilder(where.left) ? where.left.columnMeta : void 0;
|
|
203
|
-
descriptors.push({
|
|
204
|
-
name: paramName,
|
|
205
|
-
source: "dsl",
|
|
206
|
-
refs: { table: leftExpr.table, column: leftExpr.column },
|
|
207
|
-
// Only include nullable if builderColumnMeta has it (don't fall back to contract)
|
|
208
|
-
...typeof builderColumnMeta?.nullable === "boolean" ? { nullable: builderColumnMeta.nullable } : {}
|
|
209
|
-
});
|
|
210
|
-
augmentDescriptorWithColumnMeta(descriptors, columnMeta);
|
|
211
|
-
}
|
|
212
|
-
rightExpr = createParamRef(index, paramName);
|
|
213
|
-
} else if (isColumnBuilder(where.right)) {
|
|
214
|
-
const { table, column } = getColumnInfo(where.right);
|
|
215
|
-
const contractTable = contract.storage.tables[table];
|
|
216
|
-
if (!contractTable) {
|
|
217
|
-
errorUnknownTable(table);
|
|
218
|
-
}
|
|
219
|
-
rightExpr = createColumnRef(table, column);
|
|
220
|
-
paramName = "";
|
|
127
|
+
const operationExpr = where.left._operationExpr;
|
|
128
|
+
if (operationExpr) {
|
|
129
|
+
leftExpr = operationExpr;
|
|
221
130
|
} else {
|
|
222
|
-
|
|
131
|
+
const colBuilder = where.left;
|
|
132
|
+
const meta = colBuilder.columnMeta ?? {};
|
|
133
|
+
descriptors.push({
|
|
134
|
+
name: paramName,
|
|
135
|
+
source: "dsl",
|
|
136
|
+
refs: { table: colBuilder.table, column: colBuilder.column },
|
|
137
|
+
...typeof meta.nullable === "boolean" ? { nullable: meta.nullable } : {}
|
|
138
|
+
});
|
|
139
|
+
const contractTable = contract.storage.tables[colBuilder.table];
|
|
140
|
+
const columnMeta = contractTable?.columns[colBuilder.column];
|
|
141
|
+
codecId = columnMeta?.codecId;
|
|
142
|
+
augmentDescriptorWithColumnMeta(descriptors, columnMeta);
|
|
143
|
+
leftExpr = createColumnRef(colBuilder.table, colBuilder.column);
|
|
223
144
|
}
|
|
224
145
|
return {
|
|
225
|
-
expr: createBinaryExpr(where.op, leftExpr,
|
|
146
|
+
expr: createBinaryExpr(where.op, leftExpr, createParamRef(index, paramName)),
|
|
226
147
|
...codecId ? { codecId } : {},
|
|
227
148
|
paramName
|
|
228
149
|
};
|
|
@@ -669,13 +590,50 @@ var OrmRelationFilterBuilderImpl = class _OrmRelationFilterBuilderImpl {
|
|
|
669
590
|
// src/plan/plan-assembly.ts
|
|
670
591
|
import { planInvalid as planInvalid4 } from "@prisma-next/plan";
|
|
671
592
|
import { compact } from "@prisma-next/sql-relational-core/ast";
|
|
593
|
+
|
|
594
|
+
// src/utils/guards.ts
|
|
595
|
+
function extractBaseColumnRef(expr) {
|
|
596
|
+
if (expr.kind === "col") {
|
|
597
|
+
return expr;
|
|
598
|
+
}
|
|
599
|
+
return extractBaseColumnRef(expr.self);
|
|
600
|
+
}
|
|
601
|
+
function collectColumnRefs(expr) {
|
|
602
|
+
if (expr.kind === "col") {
|
|
603
|
+
return [expr];
|
|
604
|
+
}
|
|
605
|
+
if (expr.kind === "operation") {
|
|
606
|
+
const refs = collectColumnRefs(expr.self);
|
|
607
|
+
for (const arg of expr.args) {
|
|
608
|
+
refs.push(...collectColumnRefs(arg));
|
|
609
|
+
}
|
|
610
|
+
return refs;
|
|
611
|
+
}
|
|
612
|
+
return [];
|
|
613
|
+
}
|
|
614
|
+
function isOperationExpr(expr) {
|
|
615
|
+
return typeof expr === "object" && expr !== null && "kind" in expr && expr.kind === "operation";
|
|
616
|
+
}
|
|
617
|
+
function getColumnInfo(expr) {
|
|
618
|
+
if (isOperationExpr(expr)) {
|
|
619
|
+
const baseCol = extractBaseColumnRef(expr);
|
|
620
|
+
return { table: baseCol.table, column: baseCol.column };
|
|
621
|
+
}
|
|
622
|
+
const colBuilder = expr;
|
|
623
|
+
return { table: colBuilder.table, column: colBuilder.column };
|
|
624
|
+
}
|
|
625
|
+
function isColumnBuilder(value) {
|
|
626
|
+
return typeof value === "object" && value !== null && "kind" in value && value.kind === "column";
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
// src/plan/plan-assembly.ts
|
|
672
630
|
function buildMeta(args) {
|
|
673
631
|
const refsColumns = /* @__PURE__ */ new Map();
|
|
674
632
|
const refsTables = /* @__PURE__ */ new Set([args.table.name]);
|
|
675
633
|
for (const column of args.projection.columns) {
|
|
676
|
-
const
|
|
677
|
-
if (
|
|
678
|
-
const allRefs = collectColumnRefs(
|
|
634
|
+
const operationExpr = column._operationExpr;
|
|
635
|
+
if (operationExpr) {
|
|
636
|
+
const allRefs = collectColumnRefs(operationExpr);
|
|
679
637
|
for (const ref of allRefs) {
|
|
680
638
|
refsColumns.set(`${ref.table}.${ref.column}`, {
|
|
681
639
|
table: ref.table,
|
|
@@ -683,10 +641,13 @@ function buildMeta(args) {
|
|
|
683
641
|
});
|
|
684
642
|
}
|
|
685
643
|
} else {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
column
|
|
689
|
-
|
|
644
|
+
const col = column;
|
|
645
|
+
if (col.table && col.column) {
|
|
646
|
+
refsColumns.set(`${col.table}.${col.column}`, {
|
|
647
|
+
table: col.table,
|
|
648
|
+
column: col.column
|
|
649
|
+
});
|
|
650
|
+
}
|
|
690
651
|
}
|
|
691
652
|
}
|
|
692
653
|
if (args.includes) {
|
|
@@ -714,24 +675,11 @@ function buildMeta(args) {
|
|
|
714
675
|
}
|
|
715
676
|
}
|
|
716
677
|
if (include.childWhere) {
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
});
|
|
723
|
-
} else if (include.childWhere.kind === "nullCheck") {
|
|
724
|
-
const colInfo = getColumnInfo(include.childWhere.expr);
|
|
725
|
-
refsColumns.set(`${colInfo.table}.${colInfo.column}`, {
|
|
726
|
-
table: colInfo.table,
|
|
727
|
-
column: colInfo.column
|
|
728
|
-
});
|
|
729
|
-
} else {
|
|
730
|
-
const _exhaustive = include.childWhere;
|
|
731
|
-
throw new Error(
|
|
732
|
-
`Unsupported predicate builder kind: ${_exhaustive.kind}`
|
|
733
|
-
);
|
|
734
|
-
}
|
|
678
|
+
const colInfo = getColumnInfo(include.childWhere.left);
|
|
679
|
+
refsColumns.set(`${colInfo.table}.${colInfo.column}`, {
|
|
680
|
+
table: colInfo.table,
|
|
681
|
+
column: colInfo.column
|
|
682
|
+
});
|
|
735
683
|
}
|
|
736
684
|
if (include.childOrderBy) {
|
|
737
685
|
const orderBy = include.childOrderBy;
|
|
@@ -746,24 +694,10 @@ function buildMeta(args) {
|
|
|
746
694
|
}
|
|
747
695
|
}
|
|
748
696
|
if (args.where) {
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
break;
|
|
754
|
-
case "nullCheck":
|
|
755
|
-
whereExprBuilder = args.where.expr;
|
|
756
|
-
break;
|
|
757
|
-
default: {
|
|
758
|
-
const _exhaustive = args.where;
|
|
759
|
-
throw new Error(
|
|
760
|
-
`Unsupported predicate builder kind: ${_exhaustive.kind}`
|
|
761
|
-
);
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
const expr = extractExpression(whereExprBuilder);
|
|
765
|
-
if (isOperationExpr(expr)) {
|
|
766
|
-
const allRefs = collectColumnRefs(expr);
|
|
697
|
+
const whereLeft = args.where.left;
|
|
698
|
+
const operationExpr = whereLeft._operationExpr;
|
|
699
|
+
if (operationExpr) {
|
|
700
|
+
const allRefs = collectColumnRefs(operationExpr);
|
|
767
701
|
for (const ref of allRefs) {
|
|
768
702
|
refsColumns.set(`${ref.table}.${ref.column}`, {
|
|
769
703
|
table: ref.table,
|
|
@@ -771,19 +705,21 @@ function buildMeta(args) {
|
|
|
771
705
|
});
|
|
772
706
|
}
|
|
773
707
|
} else {
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
column
|
|
777
|
-
|
|
708
|
+
const colBuilder = whereLeft;
|
|
709
|
+
if (colBuilder.table && colBuilder.column) {
|
|
710
|
+
refsColumns.set(`${colBuilder.table}.${colBuilder.column}`, {
|
|
711
|
+
table: colBuilder.table,
|
|
712
|
+
column: colBuilder.column
|
|
713
|
+
});
|
|
714
|
+
}
|
|
778
715
|
}
|
|
779
716
|
}
|
|
780
717
|
if (args.orderBy) {
|
|
781
718
|
const orderBy = args.orderBy;
|
|
782
719
|
const orderByExpr = orderBy.expr;
|
|
783
720
|
if (orderByExpr) {
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
const allRefs = collectColumnRefs(expr);
|
|
721
|
+
if (isOperationExpr(orderByExpr)) {
|
|
722
|
+
const allRefs = collectColumnRefs(orderByExpr);
|
|
787
723
|
for (const ref of allRefs) {
|
|
788
724
|
refsColumns.set(`${ref.table}.${ref.column}`, {
|
|
789
725
|
table: ref.table,
|
|
@@ -791,10 +727,13 @@ function buildMeta(args) {
|
|
|
791
727
|
});
|
|
792
728
|
}
|
|
793
729
|
} else {
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
column
|
|
797
|
-
|
|
730
|
+
const colBuilder = orderByExpr;
|
|
731
|
+
if (colBuilder.table && colBuilder.column) {
|
|
732
|
+
refsColumns.set(`${colBuilder.table}.${colBuilder.column}`, {
|
|
733
|
+
table: colBuilder.table,
|
|
734
|
+
column: colBuilder.column
|
|
735
|
+
});
|
|
736
|
+
}
|
|
798
737
|
}
|
|
799
738
|
}
|
|
800
739
|
}
|
|
@@ -808,11 +747,15 @@ function buildMeta(args) {
|
|
|
808
747
|
if (!column) {
|
|
809
748
|
throw planInvalid4(`Missing column for alias ${alias} at index ${index}`);
|
|
810
749
|
}
|
|
811
|
-
const
|
|
812
|
-
if (
|
|
813
|
-
return [alias, `
|
|
750
|
+
const col = column;
|
|
751
|
+
if (!col.table || !col.column) {
|
|
752
|
+
return [alias, `include:${alias}`];
|
|
753
|
+
}
|
|
754
|
+
const operationExpr = col._operationExpr;
|
|
755
|
+
if (operationExpr) {
|
|
756
|
+
return [alias, `operation:${operationExpr.method}`];
|
|
814
757
|
}
|
|
815
|
-
return [alias, `${
|
|
758
|
+
return [alias, `${col.table}.${col.column}`];
|
|
816
759
|
})
|
|
817
760
|
);
|
|
818
761
|
const projectionTypes = {};
|
|
@@ -825,25 +768,19 @@ function buildMeta(args) {
|
|
|
825
768
|
if (!col) {
|
|
826
769
|
continue;
|
|
827
770
|
}
|
|
828
|
-
const
|
|
829
|
-
if (
|
|
830
|
-
if (
|
|
831
|
-
projectionTypes[alias] =
|
|
832
|
-
} else if (
|
|
833
|
-
projectionTypes[alias] =
|
|
771
|
+
const operationExpr = col._operationExpr;
|
|
772
|
+
if (operationExpr) {
|
|
773
|
+
if (operationExpr.returns.kind === "typeId") {
|
|
774
|
+
projectionTypes[alias] = operationExpr.returns.type;
|
|
775
|
+
} else if (operationExpr.returns.kind === "builtin") {
|
|
776
|
+
projectionTypes[alias] = operationExpr.returns.type;
|
|
834
777
|
}
|
|
835
778
|
} else {
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
} else {
|
|
842
|
-
const columnMeta = getColumnMeta(col);
|
|
843
|
-
const codecId = columnMeta?.codecId;
|
|
844
|
-
if (codecId) {
|
|
845
|
-
projectionTypes[alias] = codecId;
|
|
846
|
-
}
|
|
779
|
+
const colMeta = col;
|
|
780
|
+
const columnMeta = colMeta.columnMeta;
|
|
781
|
+
const codecId = columnMeta?.codecId;
|
|
782
|
+
if (codecId) {
|
|
783
|
+
projectionTypes[alias] = codecId;
|
|
847
784
|
}
|
|
848
785
|
}
|
|
849
786
|
}
|
|
@@ -857,23 +794,17 @@ function buildMeta(args) {
|
|
|
857
794
|
if (!column) {
|
|
858
795
|
continue;
|
|
859
796
|
}
|
|
860
|
-
const
|
|
861
|
-
if (
|
|
862
|
-
if (
|
|
863
|
-
projectionCodecs[alias] =
|
|
797
|
+
const operationExpr = column._operationExpr;
|
|
798
|
+
if (operationExpr) {
|
|
799
|
+
if (operationExpr.returns.kind === "typeId") {
|
|
800
|
+
projectionCodecs[alias] = operationExpr.returns.type;
|
|
864
801
|
}
|
|
865
802
|
} else {
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
} else {
|
|
872
|
-
const columnMeta = getColumnMeta(column);
|
|
873
|
-
const codecId = columnMeta?.codecId;
|
|
874
|
-
if (codecId) {
|
|
875
|
-
projectionCodecs[alias] = codecId;
|
|
876
|
-
}
|
|
803
|
+
const col = column;
|
|
804
|
+
const columnMeta = col.columnMeta;
|
|
805
|
+
const codecId = columnMeta?.codecId;
|
|
806
|
+
if (codecId) {
|
|
807
|
+
projectionCodecs[alias] = codecId;
|
|
877
808
|
}
|
|
878
809
|
}
|
|
879
810
|
}
|
|
@@ -930,7 +861,11 @@ function buildOrderByClause(orderBy) {
|
|
|
930
861
|
return void 0;
|
|
931
862
|
}
|
|
932
863
|
const orderByBuilder = orderBy;
|
|
933
|
-
const
|
|
864
|
+
const orderExpr = orderByBuilder.expr;
|
|
865
|
+
const expr = isOperationExpr(orderExpr) ? orderExpr : (() => {
|
|
866
|
+
const colBuilder = orderExpr;
|
|
867
|
+
return createColumnRef(colBuilder.table, colBuilder.column);
|
|
868
|
+
})();
|
|
934
869
|
return [createOrderByItem(expr, orderByBuilder.dir)];
|
|
935
870
|
}
|
|
936
871
|
function buildChildOrderByClause(orderBy) {
|
|
@@ -938,7 +873,15 @@ function buildChildOrderByClause(orderBy) {
|
|
|
938
873
|
return void 0;
|
|
939
874
|
}
|
|
940
875
|
const orderByBuilder = orderBy;
|
|
941
|
-
const
|
|
876
|
+
const orderExpr = orderByBuilder.expr;
|
|
877
|
+
const expr = (() => {
|
|
878
|
+
if (isOperationExpr(orderExpr)) {
|
|
879
|
+
const baseCol = extractBaseColumnRef(orderExpr);
|
|
880
|
+
return createColumnRef(baseCol.table, baseCol.column);
|
|
881
|
+
}
|
|
882
|
+
const colBuilder = orderExpr;
|
|
883
|
+
return createColumnRef(colBuilder.table, colBuilder.column);
|
|
884
|
+
})();
|
|
942
885
|
return [createOrderByItem(expr, orderByBuilder.dir)];
|
|
943
886
|
}
|
|
944
887
|
|
|
@@ -974,7 +917,7 @@ function flattenProjection(projection, tracker, currentPath = []) {
|
|
|
974
917
|
const columns = [];
|
|
975
918
|
for (const [key, value] of Object.entries(projection)) {
|
|
976
919
|
const path = [...currentPath, key];
|
|
977
|
-
if (isColumnBuilder(value)
|
|
920
|
+
if (isColumnBuilder(value)) {
|
|
978
921
|
const alias = tracker.register(path);
|
|
979
922
|
aliases.push(alias);
|
|
980
923
|
columns.push(value);
|
|
@@ -1009,7 +952,7 @@ function buildProjectionState(_table, projection, includes) {
|
|
|
1009
952
|
nullable: true
|
|
1010
953
|
}
|
|
1011
954
|
});
|
|
1012
|
-
} else if (isColumnBuilder(value)
|
|
955
|
+
} else if (isColumnBuilder(value)) {
|
|
1013
956
|
const alias = tracker.register([key]);
|
|
1014
957
|
aliases.push(alias);
|
|
1015
958
|
columns.push(value);
|
|
@@ -1110,8 +1053,13 @@ function buildIncludeAsts(includes, contract, context, modelName, paramsMap, par
|
|
|
1110
1053
|
if (!column) {
|
|
1111
1054
|
errorMissingColumn(alias, i);
|
|
1112
1055
|
}
|
|
1113
|
-
const
|
|
1114
|
-
|
|
1056
|
+
const operationExpr = column._operationExpr;
|
|
1057
|
+
if (operationExpr) {
|
|
1058
|
+
childProjectionItems.push({ alias, expr: operationExpr });
|
|
1059
|
+
} else {
|
|
1060
|
+
const col = column;
|
|
1061
|
+
childProjectionItems.push({ alias, expr: createColumnRef(col.table, col.column) });
|
|
1062
|
+
}
|
|
1115
1063
|
}
|
|
1116
1064
|
const includeAst = compact2({
|
|
1117
1065
|
kind: "includeMany",
|
|
@@ -1246,14 +1194,24 @@ function buildProjectionItems(projectionState, includesForMeta) {
|
|
|
1246
1194
|
expr: { kind: "includeRef", alias }
|
|
1247
1195
|
});
|
|
1248
1196
|
} else {
|
|
1249
|
-
const
|
|
1250
|
-
if (
|
|
1251
|
-
|
|
1197
|
+
const operationExpr = column._operationExpr;
|
|
1198
|
+
if (operationExpr) {
|
|
1199
|
+
projectEntries.push({
|
|
1200
|
+
alias,
|
|
1201
|
+
expr: operationExpr
|
|
1202
|
+
});
|
|
1203
|
+
} else {
|
|
1204
|
+
const col = column;
|
|
1205
|
+
const tableName = col.table;
|
|
1206
|
+
const columnName = col.column;
|
|
1207
|
+
if (!tableName || !columnName) {
|
|
1208
|
+
errorInvalidColumn(alias, i);
|
|
1209
|
+
}
|
|
1210
|
+
projectEntries.push({
|
|
1211
|
+
alias,
|
|
1212
|
+
expr: createColumnRef(tableName, columnName)
|
|
1213
|
+
});
|
|
1252
1214
|
}
|
|
1253
|
-
projectEntries.push({
|
|
1254
|
-
alias,
|
|
1255
|
-
expr
|
|
1256
|
-
});
|
|
1257
1215
|
}
|
|
1258
1216
|
}
|
|
1259
1217
|
return projectEntries;
|
|
@@ -1758,4 +1716,4 @@ export {
|
|
|
1758
1716
|
OrmModelBuilderImpl,
|
|
1759
1717
|
orm
|
|
1760
1718
|
};
|
|
1761
|
-
//# sourceMappingURL=chunk-
|
|
1719
|
+
//# sourceMappingURL=chunk-KQPLODPT.js.map
|