pqb 0.47.3 → 0.47.5
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/index.js +12 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -561,7 +561,7 @@ const indexInnerToCode = (index, t) => {
|
|
|
561
561
|
if (columnsMultiline) {
|
|
562
562
|
const objects = [];
|
|
563
563
|
for (const column of index.columns) {
|
|
564
|
-
const expr = "
|
|
564
|
+
const expr = "expression" in column ? column.expression : column.column;
|
|
565
565
|
let hasOptions2 = false;
|
|
566
566
|
for (const key in column) {
|
|
567
567
|
if (key !== "column") {
|
|
@@ -572,7 +572,7 @@ const indexInnerToCode = (index, t) => {
|
|
|
572
572
|
objects.push(`${singleQuote(expr)},`);
|
|
573
573
|
} else {
|
|
574
574
|
const props = [
|
|
575
|
-
`${"
|
|
575
|
+
`${"expression" in column ? "expression" : "column"}: ${singleQuote(
|
|
576
576
|
expr
|
|
577
577
|
)},`
|
|
578
578
|
];
|
|
@@ -642,9 +642,11 @@ const excludeInnerToCode = (item, t) => {
|
|
|
642
642
|
const hasOptions = optionsKeys.some((key) => key && item.options[key]);
|
|
643
643
|
const objects = [];
|
|
644
644
|
for (const column of item.columns) {
|
|
645
|
-
const expr = "
|
|
645
|
+
const expr = "expression" in column ? column.expression : column.column;
|
|
646
646
|
const props = [
|
|
647
|
-
`${"
|
|
647
|
+
`${"expression" in column ? "expression" : "column"}: ${singleQuote(
|
|
648
|
+
expr
|
|
649
|
+
)},`
|
|
648
650
|
];
|
|
649
651
|
for (const key of columnOptions) {
|
|
650
652
|
const value = column[key];
|
|
@@ -766,12 +768,14 @@ const foreignKeyArgumentToCode = ({
|
|
|
766
768
|
const columnIndexesToCode = (items) => {
|
|
767
769
|
const code = [];
|
|
768
770
|
for (const { options, name } of items) {
|
|
769
|
-
addCode(
|
|
771
|
+
addCode(
|
|
772
|
+
code,
|
|
773
|
+
`.${options.unique ? "unique" : "index"}(${name ? `${singleQuote(name)}` : ""}`
|
|
774
|
+
);
|
|
770
775
|
const arr = [
|
|
771
776
|
options.collate && `collate: ${singleQuote(options.collate)},`,
|
|
772
777
|
options.opclass && `opclass: ${singleQuote(options.opclass)},`,
|
|
773
778
|
options.order && `order: ${singleQuote(options.order)},`,
|
|
774
|
-
name && `name: ${singleQuote(name)},`,
|
|
775
779
|
options.using && `using: ${singleQuote(options.using)},`,
|
|
776
780
|
options.include && `include: ${typeof options.include === "string" ? singleQuote(options.include) : `[${options.include.map(singleQuote).join(", ")}]`},`,
|
|
777
781
|
options.nullsNotDistinct && `nullsNotDistinct: true,`,
|
|
@@ -780,7 +784,7 @@ const columnIndexesToCode = (items) => {
|
|
|
780
784
|
options.where && `where: ${singleQuote(options.where)},`
|
|
781
785
|
].filter((x) => !!x);
|
|
782
786
|
if (arr.length) {
|
|
783
|
-
addCode(code, "{");
|
|
787
|
+
addCode(code, name ? `, {` : "{");
|
|
784
788
|
addCode(code, arr);
|
|
785
789
|
addCode(code, "}");
|
|
786
790
|
}
|
|
@@ -2998,12 +3002,7 @@ const runAfterCommit = async (afterCommit, result) => {
|
|
|
2998
3002
|
const applyBatchTransforms = (q, batches) => {
|
|
2999
3003
|
if (q.transform) {
|
|
3000
3004
|
for (const item of batches) {
|
|
3001
|
-
item.parent[item.key] = applyTransforms(
|
|
3002
|
-
q,
|
|
3003
|
-
q.returnType,
|
|
3004
|
-
q.transform,
|
|
3005
|
-
item.data
|
|
3006
|
-
);
|
|
3005
|
+
item.parent[item.key] = item.data === null ? void 0 : applyTransforms(q, q.returnType, q.transform, item.data);
|
|
3007
3006
|
}
|
|
3008
3007
|
}
|
|
3009
3008
|
};
|