pqb 0.48.5 → 0.48.6

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.mjs CHANGED
@@ -4335,14 +4335,14 @@ function queryFrom(self, arg) {
4335
4335
  data.batchParsers = q.q.batchParsers;
4336
4336
  }
4337
4337
  data.from = arg;
4338
- data.selectAllColumns = data.selectAllKeys = data.scopes = void 0;
4338
+ data.selectAllColumns = data.scopes = void 0;
4339
4339
  return self;
4340
4340
  }
4341
4341
  function queryFromSql(self, args) {
4342
4342
  const data = self.q;
4343
4343
  data.as || (data.as = "t");
4344
4344
  data.from = sqlQueryArgsToExpression(args);
4345
- data.selectAllColumns = data.selectAllKeys = void 0;
4345
+ data.selectAllColumns = void 0;
4346
4346
  return self;
4347
4347
  }
4348
4348
  class FromMethods {
@@ -4814,7 +4814,7 @@ const selectToSql = (ctx, table, query, quotedAs, hookSelect = query.hookSelect,
4814
4814
  if (item === "*") {
4815
4815
  if (hookSelect) {
4816
4816
  selected ?? (selected = {});
4817
- for (const key in query.selectAllKeys || query.shape) {
4817
+ for (const key in query.selectableShape) {
4818
4818
  selected[key] = quotedAs;
4819
4819
  }
4820
4820
  }
@@ -4940,10 +4940,7 @@ function selectedObjectToSQL(ctx, quotedAs, item) {
4940
4940
  }
4941
4941
  const selectAllSql = (query, quotedAs, jsonList) => {
4942
4942
  if (jsonList) {
4943
- Object.assign(
4944
- jsonList,
4945
- query.selectAllKeys || query.shape
4946
- );
4943
+ Object.assign(jsonList, query.selectableShape);
4947
4944
  }
4948
4945
  return query.join?.length ? query.selectAllColumns?.map((item) => `${quotedAs}.${item}`).join(", ") || `${quotedAs}.*` : query.selectAllColumns?.join(", ") || "*";
4949
4946
  };
@@ -10247,7 +10244,7 @@ const mergableObjects = /* @__PURE__ */ new Set([
10247
10244
  "joinedBatchParsers",
10248
10245
  "selectedComputeds"
10249
10246
  ]);
10250
- const dontMergeArrays = /* @__PURE__ */ new Set(["selectAllColumns", "selectAllKeys"]);
10247
+ const dontMergeArrays = /* @__PURE__ */ new Set(["selectAllColumns"]);
10251
10248
  class MergeQueryMethods {
10252
10249
  merge(q) {
10253
10250
  const query = _clone(this);
@@ -12749,20 +12746,26 @@ class Db extends QueryMethods {
12749
12746
  );
12750
12747
  this.columns = columns;
12751
12748
  if (options.computed) applyComputedColumns(this, options.computed);
12749
+ const selectableShape = this.q.selectableShape = {};
12752
12750
  if (prepareSelectAll) {
12753
12751
  const list = [];
12754
- const keys = {};
12755
12752
  for (const key in shape) {
12756
12753
  const column = shape[key];
12757
- if (!column.data.explicitSelect) {
12754
+ if (!column.data.explicitSelect && !(column instanceof VirtualColumn)) {
12758
12755
  list.push(
12759
12756
  column.data.name ? `"${column.data.name}" "${key}"` : `"${key}"`
12760
12757
  );
12761
- keys[key] = column;
12758
+ selectableShape[key] = column;
12762
12759
  }
12763
12760
  }
12764
12761
  this.q.selectAllColumns = list;
12765
- this.q.selectAllKeys = keys;
12762
+ } else {
12763
+ for (const key in shape) {
12764
+ const column = shape[key];
12765
+ if (column instanceof VirtualColumn) {
12766
+ selectableShape[key] = column;
12767
+ }
12768
+ }
12766
12769
  }
12767
12770
  if (modifyQuery) {
12768
12771
  for (const cb of modifyQuery) {