tempest.games 0.1.26 → 0.1.28

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.
@@ -1951,11 +1951,11 @@ function osUsername() {
1951
1951
  try {
1952
1952
  return os.userInfo().username;
1953
1953
  } catch (_) {
1954
- return process.env.USERNAME || "runner";
1954
+ return process.env.USERNAME || process.env.USER || process.env.LOGNAME;
1955
1955
  }
1956
1956
  }
1957
1957
 
1958
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/entity.js
1958
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/entity.js
1959
1959
  var entityKind = Symbol.for("drizzle:entityKind");
1960
1960
  var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
1961
1961
  function is(value, type) {
@@ -1980,7 +1980,7 @@ function is(value, type) {
1980
1980
  return false;
1981
1981
  }
1982
1982
 
1983
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/logger.js
1983
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/logger.js
1984
1984
  class ConsoleLogWriter {
1985
1985
  static [entityKind] = "ConsoleLogWriter";
1986
1986
  write(message) {
@@ -2013,7 +2013,7 @@ class NoopLogger {
2013
2013
  }
2014
2014
  }
2015
2015
 
2016
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/query-promise.js
2016
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/query-promise.js
2017
2017
  class QueryPromise {
2018
2018
  static [entityKind] = "QueryPromise";
2019
2019
  [Symbol.toStringTag] = "QueryPromise";
@@ -2034,89 +2034,7 @@ class QueryPromise {
2034
2034
  }
2035
2035
  }
2036
2036
 
2037
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/table.utils.js
2038
- var TableName = Symbol.for("drizzle:Name");
2039
-
2040
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/table.js
2041
- var Schema = Symbol.for("drizzle:Schema");
2042
- var Columns = Symbol.for("drizzle:Columns");
2043
- var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
2044
- var OriginalName = Symbol.for("drizzle:OriginalName");
2045
- var BaseName = Symbol.for("drizzle:BaseName");
2046
- var IsAlias = Symbol.for("drizzle:IsAlias");
2047
- var ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
2048
- var IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
2049
-
2050
- class Table {
2051
- static [entityKind] = "Table";
2052
- static Symbol = {
2053
- Name: TableName,
2054
- Schema,
2055
- OriginalName,
2056
- Columns,
2057
- ExtraConfigColumns,
2058
- BaseName,
2059
- IsAlias,
2060
- ExtraConfigBuilder
2061
- };
2062
- [TableName];
2063
- [OriginalName];
2064
- [Schema];
2065
- [Columns];
2066
- [ExtraConfigColumns];
2067
- [BaseName];
2068
- [IsAlias] = false;
2069
- [IsDrizzleTable] = true;
2070
- [ExtraConfigBuilder] = undefined;
2071
- constructor(name, schema, baseName) {
2072
- this[TableName] = this[OriginalName] = name;
2073
- this[Schema] = schema;
2074
- this[BaseName] = baseName;
2075
- }
2076
- }
2077
- function getTableName(table) {
2078
- return table[TableName];
2079
- }
2080
- function getTableUniqueName(table) {
2081
- return `${table[Schema] ?? "public"}.${table[TableName]}`;
2082
- }
2083
-
2084
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/tracing-utils.js
2085
- function iife(fn, ...args) {
2086
- return fn(...args);
2087
- }
2088
-
2089
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/version.js
2090
- var version = "0.38.3";
2091
-
2092
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/tracing.js
2093
- var otel;
2094
- var rawTracer;
2095
- var tracer = {
2096
- startActiveSpan(name, fn) {
2097
- if (!otel) {
2098
- return fn();
2099
- }
2100
- if (!rawTracer) {
2101
- rawTracer = otel.trace.getTracer("drizzle-orm", version);
2102
- }
2103
- return iife((otel2, rawTracer2) => rawTracer2.startActiveSpan(name, (span) => {
2104
- try {
2105
- return fn(span);
2106
- } catch (e) {
2107
- span.setStatus({
2108
- code: otel2.SpanStatusCode.ERROR,
2109
- message: e instanceof Error ? e.message : "Unknown error"
2110
- });
2111
- throw e;
2112
- } finally {
2113
- span.end();
2114
- }
2115
- }), otel, rawTracer);
2116
- }
2117
- };
2118
-
2119
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/column.js
2037
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/column.js
2120
2038
  class Column {
2121
2039
  constructor(table, config) {
2122
2040
  this.table = table;
@@ -2166,12 +2084,20 @@ class Column {
2166
2084
  }
2167
2085
  }
2168
2086
 
2169
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/unique-constraint.js
2087
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/table.utils.js
2088
+ var TableName = Symbol.for("drizzle:Name");
2089
+
2090
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/tracing-utils.js
2091
+ function iife(fn, ...args) {
2092
+ return fn(...args);
2093
+ }
2094
+
2095
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/unique-constraint.js
2170
2096
  function uniqueKeyName(table, columns) {
2171
2097
  return `${table[TableName]}_${columns.join("_")}_unique`;
2172
2098
  }
2173
2099
 
2174
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/columns/common.js
2100
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/columns/common.js
2175
2101
  class PgColumn extends Column {
2176
2102
  constructor(table, config) {
2177
2103
  if (!config.uniqueName) {
@@ -2220,7 +2146,7 @@ class ExtraConfigColumn extends PgColumn {
2220
2146
  }
2221
2147
  }
2222
2148
 
2223
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/columns/enum.js
2149
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/columns/enum.js
2224
2150
  var isPgEnumSym = Symbol.for("drizzle:isPgEnum");
2225
2151
  function isPgEnum(obj) {
2226
2152
  return !!obj && typeof obj === "function" && isPgEnumSym in obj && obj[isPgEnumSym] === true;
@@ -2238,7 +2164,7 @@ class PgEnumColumn extends PgColumn {
2238
2164
  }
2239
2165
  }
2240
2166
 
2241
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/subquery.js
2167
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/subquery.js
2242
2168
  class Subquery {
2243
2169
  static [entityKind] = "Subquery";
2244
2170
  constructor(sql, selection, alias, isWith = false) {
@@ -2256,10 +2182,84 @@ class WithSubquery extends Subquery {
2256
2182
  static [entityKind] = "WithSubquery";
2257
2183
  }
2258
2184
 
2259
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/view-common.js
2185
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/version.js
2186
+ var version = "0.39.1";
2187
+
2188
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/tracing.js
2189
+ var otel;
2190
+ var rawTracer;
2191
+ var tracer = {
2192
+ startActiveSpan(name, fn) {
2193
+ if (!otel) {
2194
+ return fn();
2195
+ }
2196
+ if (!rawTracer) {
2197
+ rawTracer = otel.trace.getTracer("drizzle-orm", version);
2198
+ }
2199
+ return iife((otel2, rawTracer2) => rawTracer2.startActiveSpan(name, (span) => {
2200
+ try {
2201
+ return fn(span);
2202
+ } catch (e) {
2203
+ span.setStatus({
2204
+ code: otel2.SpanStatusCode.ERROR,
2205
+ message: e instanceof Error ? e.message : "Unknown error"
2206
+ });
2207
+ throw e;
2208
+ } finally {
2209
+ span.end();
2210
+ }
2211
+ }), otel, rawTracer);
2212
+ }
2213
+ };
2214
+
2215
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/view-common.js
2260
2216
  var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
2261
2217
 
2262
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/sql/sql.js
2218
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/table.js
2219
+ var Schema = Symbol.for("drizzle:Schema");
2220
+ var Columns = Symbol.for("drizzle:Columns");
2221
+ var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
2222
+ var OriginalName = Symbol.for("drizzle:OriginalName");
2223
+ var BaseName = Symbol.for("drizzle:BaseName");
2224
+ var IsAlias = Symbol.for("drizzle:IsAlias");
2225
+ var ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
2226
+ var IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
2227
+
2228
+ class Table {
2229
+ static [entityKind] = "Table";
2230
+ static Symbol = {
2231
+ Name: TableName,
2232
+ Schema,
2233
+ OriginalName,
2234
+ Columns,
2235
+ ExtraConfigColumns,
2236
+ BaseName,
2237
+ IsAlias,
2238
+ ExtraConfigBuilder
2239
+ };
2240
+ [TableName];
2241
+ [OriginalName];
2242
+ [Schema];
2243
+ [Columns];
2244
+ [ExtraConfigColumns];
2245
+ [BaseName];
2246
+ [IsAlias] = false;
2247
+ [IsDrizzleTable] = true;
2248
+ [ExtraConfigBuilder] = undefined;
2249
+ constructor(name, schema, baseName) {
2250
+ this[TableName] = this[OriginalName] = name;
2251
+ this[Schema] = schema;
2252
+ this[BaseName] = baseName;
2253
+ }
2254
+ }
2255
+ function getTableName(table) {
2256
+ return table[TableName];
2257
+ }
2258
+ function getTableUniqueName(table) {
2259
+ return `${table[Schema] ?? "public"}.${table[TableName]}`;
2260
+ }
2261
+
2262
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/sql/sql.js
2263
2263
  function isSQLWrapper(value) {
2264
2264
  return value !== null && value !== undefined && typeof value.getSQL === "function";
2265
2265
  }
@@ -2354,7 +2354,7 @@ class SQL {
2354
2354
  const schemaName = chunk[Table.Symbol.Schema];
2355
2355
  const tableName = chunk[Table.Symbol.Name];
2356
2356
  return {
2357
- sql: schemaName === undefined ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
2357
+ sql: schemaName === undefined || chunk[IsAlias] ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
2358
2358
  params: []
2359
2359
  };
2360
2360
  }
@@ -2373,7 +2373,7 @@ class SQL {
2373
2373
  const schemaName = chunk[ViewBaseConfig].schema;
2374
2374
  const viewName = chunk[ViewBaseConfig].name;
2375
2375
  return {
2376
- sql: schemaName === undefined ? escapeName(viewName) : escapeName(schemaName) + "." + escapeName(viewName),
2376
+ sql: schemaName === undefined || chunk[ViewBaseConfig].isAlias ? escapeName(viewName) : escapeName(schemaName) + "." + escapeName(viewName),
2377
2377
  params: []
2378
2378
  };
2379
2379
  }
@@ -2632,7 +2632,138 @@ Subquery.prototype.getSQL = function() {
2632
2632
  return new SQL([this]);
2633
2633
  };
2634
2634
 
2635
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/utils.js
2635
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/alias.js
2636
+ class ColumnAliasProxyHandler {
2637
+ constructor(table) {
2638
+ this.table = table;
2639
+ }
2640
+ static [entityKind] = "ColumnAliasProxyHandler";
2641
+ get(columnObj, prop) {
2642
+ if (prop === "table") {
2643
+ return this.table;
2644
+ }
2645
+ return columnObj[prop];
2646
+ }
2647
+ }
2648
+
2649
+ class TableAliasProxyHandler {
2650
+ constructor(alias, replaceOriginalName) {
2651
+ this.alias = alias;
2652
+ this.replaceOriginalName = replaceOriginalName;
2653
+ }
2654
+ static [entityKind] = "TableAliasProxyHandler";
2655
+ get(target, prop) {
2656
+ if (prop === Table.Symbol.IsAlias) {
2657
+ return true;
2658
+ }
2659
+ if (prop === Table.Symbol.Name) {
2660
+ return this.alias;
2661
+ }
2662
+ if (this.replaceOriginalName && prop === Table.Symbol.OriginalName) {
2663
+ return this.alias;
2664
+ }
2665
+ if (prop === ViewBaseConfig) {
2666
+ return {
2667
+ ...target[ViewBaseConfig],
2668
+ name: this.alias,
2669
+ isAlias: true
2670
+ };
2671
+ }
2672
+ if (prop === Table.Symbol.Columns) {
2673
+ const columns = target[Table.Symbol.Columns];
2674
+ if (!columns) {
2675
+ return columns;
2676
+ }
2677
+ const proxiedColumns = {};
2678
+ Object.keys(columns).map((key) => {
2679
+ proxiedColumns[key] = new Proxy(columns[key], new ColumnAliasProxyHandler(new Proxy(target, this)));
2680
+ });
2681
+ return proxiedColumns;
2682
+ }
2683
+ const value = target[prop];
2684
+ if (is(value, Column)) {
2685
+ return new Proxy(value, new ColumnAliasProxyHandler(new Proxy(target, this)));
2686
+ }
2687
+ return value;
2688
+ }
2689
+ }
2690
+ function aliasedTable(table, tableAlias) {
2691
+ return new Proxy(table, new TableAliasProxyHandler(tableAlias, false));
2692
+ }
2693
+ function aliasedTableColumn(column, tableAlias) {
2694
+ return new Proxy(column, new ColumnAliasProxyHandler(new Proxy(column.table, new TableAliasProxyHandler(tableAlias, false))));
2695
+ }
2696
+ function mapColumnsInAliasedSQLToAlias(query, alias) {
2697
+ return new SQL.Aliased(mapColumnsInSQLToAlias(query.sql, alias), query.fieldAlias);
2698
+ }
2699
+ function mapColumnsInSQLToAlias(query, alias) {
2700
+ return sql.join(query.queryChunks.map((c) => {
2701
+ if (is(c, Column)) {
2702
+ return aliasedTableColumn(c, alias);
2703
+ }
2704
+ if (is(c, SQL)) {
2705
+ return mapColumnsInSQLToAlias(c, alias);
2706
+ }
2707
+ if (is(c, SQL.Aliased)) {
2708
+ return mapColumnsInAliasedSQLToAlias(c, alias);
2709
+ }
2710
+ return c;
2711
+ }));
2712
+ }
2713
+
2714
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/selection-proxy.js
2715
+ class SelectionProxyHandler {
2716
+ static [entityKind] = "SelectionProxyHandler";
2717
+ config;
2718
+ constructor(config) {
2719
+ this.config = { ...config };
2720
+ }
2721
+ get(subquery, prop) {
2722
+ if (prop === "_") {
2723
+ return {
2724
+ ...subquery["_"],
2725
+ selectedFields: new Proxy(subquery._.selectedFields, this)
2726
+ };
2727
+ }
2728
+ if (prop === ViewBaseConfig) {
2729
+ return {
2730
+ ...subquery[ViewBaseConfig],
2731
+ selectedFields: new Proxy(subquery[ViewBaseConfig].selectedFields, this)
2732
+ };
2733
+ }
2734
+ if (typeof prop === "symbol") {
2735
+ return subquery[prop];
2736
+ }
2737
+ const columns = is(subquery, Subquery) ? subquery._.selectedFields : is(subquery, View) ? subquery[ViewBaseConfig].selectedFields : subquery;
2738
+ const value = columns[prop];
2739
+ if (is(value, SQL.Aliased)) {
2740
+ if (this.config.sqlAliasedBehavior === "sql" && !value.isSelectionField) {
2741
+ return value.sql;
2742
+ }
2743
+ const newValue = value.clone();
2744
+ newValue.isSelectionField = true;
2745
+ return newValue;
2746
+ }
2747
+ if (is(value, SQL)) {
2748
+ if (this.config.sqlBehavior === "sql") {
2749
+ return value;
2750
+ }
2751
+ throw new Error(`You tried to reference "${prop}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`);
2752
+ }
2753
+ if (is(value, Column)) {
2754
+ if (this.config.alias) {
2755
+ return new Proxy(value, new ColumnAliasProxyHandler(new Proxy(value.table, new TableAliasProxyHandler(this.config.alias, this.config.replaceOriginalName ?? false))));
2756
+ }
2757
+ return value;
2758
+ }
2759
+ if (typeof value !== "object" || value === null) {
2760
+ return value;
2761
+ }
2762
+ return new Proxy(value, new SelectionProxyHandler(this.config));
2763
+ }
2764
+ }
2765
+
2766
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/utils.js
2636
2767
  function mapResultRow(columns, row, joinsNotNullableMap) {
2637
2768
  const nullifyMap = {};
2638
2769
  const result = columns.reduce((result2, { path, field }, columnIndex) => {
@@ -2777,7 +2908,7 @@ function isConfig(data) {
2777
2908
  return false;
2778
2909
  }
2779
2910
 
2780
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/query-builders/delete.js
2911
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/query-builders/delete.js
2781
2912
  class PgDeleteBase extends QueryPromise {
2782
2913
  constructor(table, session, dialect, withList) {
2783
2914
  super();
@@ -2792,6 +2923,7 @@ class PgDeleteBase extends QueryPromise {
2792
2923
  return this;
2793
2924
  }
2794
2925
  returning(fields = this.config.table[Table.Symbol.Columns]) {
2926
+ this.config.returningFields = fields;
2795
2927
  this.config.returning = orderSelectedFields(fields);
2796
2928
  return this;
2797
2929
  }
@@ -2820,91 +2952,19 @@ class PgDeleteBase extends QueryPromise {
2820
2952
  return this._prepare().execute(placeholderValues, this.authToken);
2821
2953
  });
2822
2954
  };
2955
+ getSelectedFields() {
2956
+ return this.config.returningFields ? new Proxy(this.config.returningFields, new SelectionProxyHandler({
2957
+ alias: getTableName(this.config.table),
2958
+ sqlAliasedBehavior: "alias",
2959
+ sqlBehavior: "error"
2960
+ })) : undefined;
2961
+ }
2823
2962
  $dynamic() {
2824
2963
  return this;
2825
2964
  }
2826
2965
  }
2827
2966
 
2828
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/alias.js
2829
- class ColumnAliasProxyHandler {
2830
- constructor(table) {
2831
- this.table = table;
2832
- }
2833
- static [entityKind] = "ColumnAliasProxyHandler";
2834
- get(columnObj, prop) {
2835
- if (prop === "table") {
2836
- return this.table;
2837
- }
2838
- return columnObj[prop];
2839
- }
2840
- }
2841
-
2842
- class TableAliasProxyHandler {
2843
- constructor(alias, replaceOriginalName) {
2844
- this.alias = alias;
2845
- this.replaceOriginalName = replaceOriginalName;
2846
- }
2847
- static [entityKind] = "TableAliasProxyHandler";
2848
- get(target, prop) {
2849
- if (prop === Table.Symbol.IsAlias) {
2850
- return true;
2851
- }
2852
- if (prop === Table.Symbol.Name) {
2853
- return this.alias;
2854
- }
2855
- if (this.replaceOriginalName && prop === Table.Symbol.OriginalName) {
2856
- return this.alias;
2857
- }
2858
- if (prop === ViewBaseConfig) {
2859
- return {
2860
- ...target[ViewBaseConfig],
2861
- name: this.alias,
2862
- isAlias: true
2863
- };
2864
- }
2865
- if (prop === Table.Symbol.Columns) {
2866
- const columns = target[Table.Symbol.Columns];
2867
- if (!columns) {
2868
- return columns;
2869
- }
2870
- const proxiedColumns = {};
2871
- Object.keys(columns).map((key) => {
2872
- proxiedColumns[key] = new Proxy(columns[key], new ColumnAliasProxyHandler(new Proxy(target, this)));
2873
- });
2874
- return proxiedColumns;
2875
- }
2876
- const value = target[prop];
2877
- if (is(value, Column)) {
2878
- return new Proxy(value, new ColumnAliasProxyHandler(new Proxy(target, this)));
2879
- }
2880
- return value;
2881
- }
2882
- }
2883
- function aliasedTable(table, tableAlias) {
2884
- return new Proxy(table, new TableAliasProxyHandler(tableAlias, false));
2885
- }
2886
- function aliasedTableColumn(column, tableAlias) {
2887
- return new Proxy(column, new ColumnAliasProxyHandler(new Proxy(column.table, new TableAliasProxyHandler(tableAlias, false))));
2888
- }
2889
- function mapColumnsInAliasedSQLToAlias(query, alias) {
2890
- return new SQL.Aliased(mapColumnsInSQLToAlias(query.sql, alias), query.fieldAlias);
2891
- }
2892
- function mapColumnsInSQLToAlias(query, alias) {
2893
- return sql.join(query.queryChunks.map((c) => {
2894
- if (is(c, Column)) {
2895
- return aliasedTableColumn(c, alias);
2896
- }
2897
- if (is(c, SQL)) {
2898
- return mapColumnsInSQLToAlias(c, alias);
2899
- }
2900
- if (is(c, SQL.Aliased)) {
2901
- return mapColumnsInAliasedSQLToAlias(c, alias);
2902
- }
2903
- return c;
2904
- }));
2905
- }
2906
-
2907
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/casing.js
2967
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/casing.js
2908
2968
  function toSnakeCase(input) {
2909
2969
  const words = input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? [];
2910
2970
  return words.map((word) => word.toLowerCase()).join("_");
@@ -2957,7 +3017,7 @@ class CasingCache {
2957
3017
  }
2958
3018
  }
2959
3019
 
2960
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/errors.js
3020
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/errors.js
2961
3021
  class DrizzleError extends Error {
2962
3022
  static [entityKind] = "DrizzleError";
2963
3023
  constructor({ message, cause }) {
@@ -2974,7 +3034,7 @@ class TransactionRollbackError extends DrizzleError {
2974
3034
  }
2975
3035
  }
2976
3036
 
2977
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/columns/date.js
3037
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/columns/date.js
2978
3038
  class PgDate extends PgColumn {
2979
3039
  static [entityKind] = "PgDate";
2980
3040
  getSQLType() {
@@ -2994,7 +3054,7 @@ class PgDateString extends PgColumn {
2994
3054
  }
2995
3055
  }
2996
3056
 
2997
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/columns/json.js
3057
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/columns/json.js
2998
3058
  class PgJson extends PgColumn {
2999
3059
  static [entityKind] = "PgJson";
3000
3060
  constructor(table, config) {
@@ -3018,7 +3078,7 @@ class PgJson extends PgColumn {
3018
3078
  }
3019
3079
  }
3020
3080
 
3021
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/columns/jsonb.js
3081
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/columns/jsonb.js
3022
3082
  class PgJsonb extends PgColumn {
3023
3083
  static [entityKind] = "PgJsonb";
3024
3084
  constructor(table, config) {
@@ -3042,7 +3102,7 @@ class PgJsonb extends PgColumn {
3042
3102
  }
3043
3103
  }
3044
3104
 
3045
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/columns/numeric.js
3105
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/columns/numeric.js
3046
3106
  class PgNumeric extends PgColumn {
3047
3107
  static [entityKind] = "PgNumeric";
3048
3108
  precision;
@@ -3063,7 +3123,7 @@ class PgNumeric extends PgColumn {
3063
3123
  }
3064
3124
  }
3065
3125
 
3066
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/columns/time.js
3126
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/columns/time.js
3067
3127
  class PgTime extends PgColumn {
3068
3128
  static [entityKind] = "PgTime";
3069
3129
  withTimezone;
@@ -3079,7 +3139,7 @@ class PgTime extends PgColumn {
3079
3139
  }
3080
3140
  }
3081
3141
 
3082
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/columns/timestamp.js
3142
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/columns/timestamp.js
3083
3143
  class PgTimestamp extends PgColumn {
3084
3144
  static [entityKind] = "PgTimestamp";
3085
3145
  withTimezone;
@@ -3115,7 +3175,7 @@ class PgTimestampString extends PgColumn {
3115
3175
  }
3116
3176
  }
3117
3177
 
3118
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/columns/uuid.js
3178
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/columns/uuid.js
3119
3179
  class PgUUID extends PgColumn {
3120
3180
  static [entityKind] = "PgUUID";
3121
3181
  getSQLType() {
@@ -3123,7 +3183,7 @@ class PgUUID extends PgColumn {
3123
3183
  }
3124
3184
  }
3125
3185
 
3126
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/table.js
3186
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/table.js
3127
3187
  var InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
3128
3188
  var EnableRLS = Symbol.for("drizzle:EnableRLS");
3129
3189
 
@@ -3138,7 +3198,7 @@ class PgTable extends Table {
3138
3198
  [Table.Symbol.ExtraConfigBuilder] = undefined;
3139
3199
  }
3140
3200
 
3141
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/primary-keys.js
3201
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/primary-keys.js
3142
3202
  class PrimaryKeyBuilder {
3143
3203
  static [entityKind] = "PgPrimaryKeyBuilder";
3144
3204
  columns;
@@ -3166,7 +3226,7 @@ class PrimaryKey {
3166
3226
  }
3167
3227
  }
3168
3228
 
3169
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/sql/expressions/conditions.js
3229
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/sql/expressions/conditions.js
3170
3230
  function bindIfParam(value, column) {
3171
3231
  if (isDriverValueEncoder(column) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value, Column) && !is(value, Table) && !is(value, View)) {
3172
3232
  return new Param(value, column);
@@ -3271,7 +3331,7 @@ function notIlike(column, value) {
3271
3331
  return sql`${column} not ilike ${value}`;
3272
3332
  }
3273
3333
 
3274
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/sql/expressions/select.js
3334
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/sql/expressions/select.js
3275
3335
  function asc(column) {
3276
3336
  return sql`${column} asc`;
3277
3337
  }
@@ -3279,7 +3339,7 @@ function desc(column) {
3279
3339
  return sql`${column} desc`;
3280
3340
  }
3281
3341
 
3282
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/relations.js
3342
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/relations.js
3283
3343
  class Relation {
3284
3344
  constructor(sourceTable, referencedTable, relationName) {
3285
3345
  this.sourceTable = sourceTable;
@@ -3499,12 +3559,12 @@ function mapRelationalRow(tablesConfig, tableConfig, row, buildQueryResultSelect
3499
3559
  return result;
3500
3560
  }
3501
3561
 
3502
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/view-base.js
3562
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/view-base.js
3503
3563
  class PgViewBase extends View {
3504
3564
  static [entityKind] = "PgViewBase";
3505
3565
  }
3506
3566
 
3507
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/dialect.js
3567
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/dialect.js
3508
3568
  class PgDialect {
3509
3569
  static [entityKind] = "PgDialect";
3510
3570
  casing;
@@ -4061,59 +4121,7 @@ class PgDialect {
4061
4121
  }
4062
4122
  }
4063
4123
 
4064
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/selection-proxy.js
4065
- class SelectionProxyHandler {
4066
- static [entityKind] = "SelectionProxyHandler";
4067
- config;
4068
- constructor(config) {
4069
- this.config = { ...config };
4070
- }
4071
- get(subquery, prop) {
4072
- if (prop === "_") {
4073
- return {
4074
- ...subquery["_"],
4075
- selectedFields: new Proxy(subquery._.selectedFields, this)
4076
- };
4077
- }
4078
- if (prop === ViewBaseConfig) {
4079
- return {
4080
- ...subquery[ViewBaseConfig],
4081
- selectedFields: new Proxy(subquery[ViewBaseConfig].selectedFields, this)
4082
- };
4083
- }
4084
- if (typeof prop === "symbol") {
4085
- return subquery[prop];
4086
- }
4087
- const columns = is(subquery, Subquery) ? subquery._.selectedFields : is(subquery, View) ? subquery[ViewBaseConfig].selectedFields : subquery;
4088
- const value = columns[prop];
4089
- if (is(value, SQL.Aliased)) {
4090
- if (this.config.sqlAliasedBehavior === "sql" && !value.isSelectionField) {
4091
- return value.sql;
4092
- }
4093
- const newValue = value.clone();
4094
- newValue.isSelectionField = true;
4095
- return newValue;
4096
- }
4097
- if (is(value, SQL)) {
4098
- if (this.config.sqlBehavior === "sql") {
4099
- return value;
4100
- }
4101
- throw new Error(`You tried to reference "${prop}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`);
4102
- }
4103
- if (is(value, Column)) {
4104
- if (this.config.alias) {
4105
- return new Proxy(value, new ColumnAliasProxyHandler(new Proxy(value.table, new TableAliasProxyHandler(this.config.alias, this.config.replaceOriginalName ?? false))));
4106
- }
4107
- return value;
4108
- }
4109
- if (typeof value !== "object" || value === null) {
4110
- return value;
4111
- }
4112
- return new Proxy(value, new SelectionProxyHandler(this.config));
4113
- }
4114
- }
4115
-
4116
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/query-builders/query-builder.js
4124
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/query-builders/query-builder.js
4117
4125
  class TypedQueryBuilder {
4118
4126
  static [entityKind] = "TypedQueryBuilder";
4119
4127
  getSelectedFields() {
@@ -4121,7 +4129,7 @@ class TypedQueryBuilder {
4121
4129
  }
4122
4130
  }
4123
4131
 
4124
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/query-builders/select.js
4132
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/query-builders/select.js
4125
4133
  class PgSelectBuilder {
4126
4134
  static [entityKind] = "PgSelectBuilder";
4127
4135
  fields;
@@ -4145,20 +4153,21 @@ class PgSelectBuilder {
4145
4153
  }
4146
4154
  from(source) {
4147
4155
  const isPartialSelect = !!this.fields;
4156
+ const src = source;
4148
4157
  let fields;
4149
4158
  if (this.fields) {
4150
4159
  fields = this.fields;
4151
- } else if (is(source, Subquery)) {
4152
- fields = Object.fromEntries(Object.keys(source._.selectedFields).map((key) => [key, source[key]]));
4153
- } else if (is(source, PgViewBase)) {
4154
- fields = source[ViewBaseConfig].selectedFields;
4155
- } else if (is(source, SQL)) {
4160
+ } else if (is(src, Subquery)) {
4161
+ fields = Object.fromEntries(Object.keys(src._.selectedFields).map((key) => [key, src[key]]));
4162
+ } else if (is(src, PgViewBase)) {
4163
+ fields = src[ViewBaseConfig].selectedFields;
4164
+ } else if (is(src, SQL)) {
4156
4165
  fields = {};
4157
4166
  } else {
4158
- fields = getTableColumns(source);
4167
+ fields = getTableColumns(src);
4159
4168
  }
4160
4169
  return new PgSelectBase({
4161
- table: source,
4170
+ table: src,
4162
4171
  fields,
4163
4172
  isPartialSelect,
4164
4173
  session: this.session,
@@ -4409,7 +4418,7 @@ var intersectAll = createSetOperator("intersect", true);
4409
4418
  var except = createSetOperator("except", false);
4410
4419
  var exceptAll = createSetOperator("except", true);
4411
4420
 
4412
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/query-builders/query-builder.js
4421
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/query-builders/query-builder.js
4413
4422
  class QueryBuilder {
4414
4423
  static [entityKind] = "PgQueryBuilder";
4415
4424
  dialect;
@@ -4418,17 +4427,16 @@ class QueryBuilder {
4418
4427
  this.dialect = is(dialect, PgDialect) ? dialect : undefined;
4419
4428
  this.dialectConfig = is(dialect, PgDialect) ? undefined : dialect;
4420
4429
  }
4421
- $with(alias) {
4430
+ $with = (alias, selection) => {
4422
4431
  const queryBuilder = this;
4423
- return {
4424
- as(qb) {
4425
- if (typeof qb === "function") {
4426
- qb = qb(queryBuilder);
4427
- }
4428
- return new Proxy(new WithSubquery(qb.getSQL(), qb.getSelectedFields(), alias, true), new SelectionProxyHandler({ alias, sqlAliasedBehavior: "alias", sqlBehavior: "error" }));
4432
+ const as = (qb) => {
4433
+ if (typeof qb === "function") {
4434
+ qb = qb(queryBuilder);
4429
4435
  }
4436
+ return new Proxy(new WithSubquery(qb.getSQL(), selection ?? ("getSelectedFields" in qb ? qb.getSelectedFields() ?? {} : {}), alias, true), new SelectionProxyHandler({ alias, sqlAliasedBehavior: "alias", sqlBehavior: "error" }));
4430
4437
  };
4431
- }
4438
+ return { as };
4439
+ };
4432
4440
  with(...queries) {
4433
4441
  const self = this;
4434
4442
  function select2(fields) {
@@ -4488,7 +4496,7 @@ class QueryBuilder {
4488
4496
  }
4489
4497
  }
4490
4498
 
4491
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/query-builders/insert.js
4499
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/query-builders/insert.js
4492
4500
  class PgInsertBuilder {
4493
4501
  constructor(table, session, dialect, withList, overridingSystemValue_) {
4494
4502
  this.table = table;
@@ -4542,6 +4550,7 @@ class PgInsertBase extends QueryPromise {
4542
4550
  static [entityKind] = "PgInsert";
4543
4551
  config;
4544
4552
  returning(fields = this.config.table[Table.Symbol.Columns]) {
4553
+ this.config.returningFields = fields;
4545
4554
  this.config.returning = orderSelectedFields(fields);
4546
4555
  return this;
4547
4556
  }
@@ -4594,12 +4603,19 @@ class PgInsertBase extends QueryPromise {
4594
4603
  return this._prepare().execute(placeholderValues, this.authToken);
4595
4604
  });
4596
4605
  };
4606
+ getSelectedFields() {
4607
+ return this.config.returningFields ? new Proxy(this.config.returningFields, new SelectionProxyHandler({
4608
+ alias: getTableName(this.config.table),
4609
+ sqlAliasedBehavior: "alias",
4610
+ sqlBehavior: "error"
4611
+ })) : undefined;
4612
+ }
4597
4613
  $dynamic() {
4598
4614
  return this;
4599
4615
  }
4600
4616
  }
4601
4617
 
4602
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/query-builders/refresh-materialized-view.js
4618
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/query-builders/refresh-materialized-view.js
4603
4619
  class PgRefreshMaterializedView extends QueryPromise {
4604
4620
  constructor(view, session, dialect) {
4605
4621
  super();
@@ -4650,7 +4666,7 @@ class PgRefreshMaterializedView extends QueryPromise {
4650
4666
  };
4651
4667
  }
4652
4668
 
4653
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/query-builders/update.js
4669
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/query-builders/update.js
4654
4670
  class PgUpdateBuilder {
4655
4671
  constructor(table, session, dialect, withList) {
4656
4672
  this.table = table;
@@ -4683,11 +4699,12 @@ class PgUpdateBase extends QueryPromise {
4683
4699
  tableName;
4684
4700
  joinsNotNullableMap;
4685
4701
  from(source) {
4686
- const tableName = getTableLikeName(source);
4702
+ const src = source;
4703
+ const tableName = getTableLikeName(src);
4687
4704
  if (typeof tableName === "string") {
4688
4705
  this.joinsNotNullableMap[tableName] = true;
4689
4706
  }
4690
- this.config.from = source;
4707
+ this.config.from = src;
4691
4708
  return this;
4692
4709
  }
4693
4710
  getTableLikeFields(table) {
@@ -4760,6 +4777,7 @@ class PgUpdateBase extends QueryPromise {
4760
4777
  }
4761
4778
  }
4762
4779
  }
4780
+ this.config.returningFields = fields;
4763
4781
  this.config.returning = orderSelectedFields(fields);
4764
4782
  return this;
4765
4783
  }
@@ -4786,12 +4804,19 @@ class PgUpdateBase extends QueryPromise {
4786
4804
  execute = (placeholderValues) => {
4787
4805
  return this._prepare().execute(placeholderValues, this.authToken);
4788
4806
  };
4807
+ getSelectedFields() {
4808
+ return this.config.returningFields ? new Proxy(this.config.returningFields, new SelectionProxyHandler({
4809
+ alias: getTableName(this.config.table),
4810
+ sqlAliasedBehavior: "alias",
4811
+ sqlBehavior: "error"
4812
+ })) : undefined;
4813
+ }
4789
4814
  $dynamic() {
4790
4815
  return this;
4791
4816
  }
4792
4817
  }
4793
4818
 
4794
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/query-builders/count.js
4819
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/query-builders/count.js
4795
4820
  class PgCountBuilder extends SQL {
4796
4821
  constructor(params) {
4797
4822
  super(PgCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
@@ -4832,7 +4857,7 @@ class PgCountBuilder extends SQL {
4832
4857
  }
4833
4858
  }
4834
4859
 
4835
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/query-builders/query.js
4860
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/query-builders/query.js
4836
4861
  class RelationalQueryBuilder {
4837
4862
  constructor(fullSchema, schema, tableNamesMap, table, tableConfig, dialect, session) {
4838
4863
  this.fullSchema = fullSchema;
@@ -4915,7 +4940,7 @@ class PgRelationalQuery extends QueryPromise {
4915
4940
  }
4916
4941
  }
4917
4942
 
4918
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/query-builders/raw.js
4943
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/query-builders/raw.js
4919
4944
  class PgRaw extends QueryPromise {
4920
4945
  constructor(execute, sql2, query, mapBatchResult) {
4921
4946
  super();
@@ -4942,7 +4967,7 @@ class PgRaw extends QueryPromise {
4942
4967
  }
4943
4968
  }
4944
4969
 
4945
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/db.js
4970
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/db.js
4946
4971
  class PgDatabase {
4947
4972
  constructor(dialect, session, schema) {
4948
4973
  this.dialect = dialect;
@@ -4967,17 +4992,16 @@ class PgDatabase {
4967
4992
  }
4968
4993
  static [entityKind] = "PgDatabase";
4969
4994
  query;
4970
- $with(alias) {
4995
+ $with = (alias, selection) => {
4971
4996
  const self = this;
4972
- return {
4973
- as(qb) {
4974
- if (typeof qb === "function") {
4975
- qb = qb(new QueryBuilder(self.dialect));
4976
- }
4977
- return new Proxy(new WithSubquery(qb.getSQL(), qb.getSelectedFields(), alias, true), new SelectionProxyHandler({ alias, sqlAliasedBehavior: "alias", sqlBehavior: "error" }));
4997
+ const as = (qb) => {
4998
+ if (typeof qb === "function") {
4999
+ qb = qb(new QueryBuilder(self.dialect));
4978
5000
  }
5001
+ return new Proxy(new WithSubquery(qb.getSQL(), selection ?? ("getSelectedFields" in qb ? qb.getSelectedFields() ?? {} : {}), alias, true), new SelectionProxyHandler({ alias, sqlAliasedBehavior: "alias", sqlBehavior: "error" }));
4979
5002
  };
4980
- }
5003
+ return { as };
5004
+ };
4981
5005
  $count(source, filters) {
4982
5006
  return new PgCountBuilder({ source, filters, session: this.session });
4983
5007
  }
@@ -5067,7 +5091,7 @@ class PgDatabase {
5067
5091
  }
5068
5092
  }
5069
5093
 
5070
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/session.js
5094
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/pg-core/session.js
5071
5095
  class PgPreparedQuery {
5072
5096
  constructor(query) {
5073
5097
  this.query = query;
@@ -5137,7 +5161,7 @@ class PgTransaction extends PgDatabase {
5137
5161
  }
5138
5162
  }
5139
5163
 
5140
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/postgres-js/session.js
5164
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/postgres-js/session.js
5141
5165
  class PostgresJsPreparedQuery extends PgPreparedQuery {
5142
5166
  constructor(client, queryString, params, logger, fields, _isResponseInArrayMode, customResultMapper) {
5143
5167
  super({ sql: queryString, params });
@@ -5245,7 +5269,7 @@ class PostgresJsTransaction extends PgTransaction {
5245
5269
  }
5246
5270
  }
5247
5271
 
5248
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/postgres-js/driver.js
5272
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/postgres-js/driver.js
5249
5273
  class PostgresJsDatabase extends PgDatabase {
5250
5274
  static [entityKind] = "PostgresJsDatabase";
5251
5275
  }
@@ -5309,7 +5333,7 @@ function drizzle(...params) {
5309
5333
  drizzle2.mock = mock;
5310
5334
  })(drizzle || (drizzle = {}));
5311
5335
 
5312
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/migrator.js
5336
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/migrator.js
5313
5337
  import crypto2 from "crypto";
5314
5338
  import fs2 from "fs";
5315
5339
  function readMigrationFiles(config) {
@@ -5341,12 +5365,109 @@ function readMigrationFiles(config) {
5341
5365
  return migrationQueries;
5342
5366
  }
5343
5367
 
5344
- // ../../node_modules/.pnpm/drizzle-orm@0.38.3_@types+react@19.0.2_bun-types@1.1.42_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/postgres-js/migrator.js
5368
+ // ../../node_modules/.pnpm/drizzle-orm@0.39.1_@types+react@19.0.8_bun-types@1.2.2_postgres@3.4.5_react@19.0.0/node_modules/drizzle-orm/postgres-js/migrator.js
5345
5369
  async function migrate(db, config) {
5346
5370
  const migrations = readMigrationFiles(config);
5347
5371
  await db.dialect.migrate(migrations, db.session, config);
5348
5372
  }
5349
5373
 
5374
+ // ../../node_modules/.pnpm/@t3-oss+env-core@0.12.0_typescript@5.7.3_zod@3.24.1/node_modules/@t3-oss/env-core/dist/index.js
5375
+ function parseWithDictionary(dictionary, value) {
5376
+ const result = {};
5377
+ const issues = [];
5378
+ for (const key in dictionary) {
5379
+ const schema = dictionary[key];
5380
+ const prop = value[key];
5381
+ const propResult = schema["~standard"].validate(prop);
5382
+ if (propResult instanceof Promise) {
5383
+ throw new Error(`Validation must be synchronous, but ${key} returned a Promise.`);
5384
+ }
5385
+ if (propResult.issues) {
5386
+ issues.push(...propResult.issues.map((issue) => ({
5387
+ ...issue,
5388
+ path: [
5389
+ key,
5390
+ ...issue.path ?? []
5391
+ ]
5392
+ })));
5393
+ continue;
5394
+ }
5395
+ result[key] = propResult.value;
5396
+ }
5397
+ if (issues.length) {
5398
+ return {
5399
+ issues
5400
+ };
5401
+ }
5402
+ return {
5403
+ value: result
5404
+ };
5405
+ }
5406
+ function createEnv(opts) {
5407
+ const runtimeEnv = opts.runtimeEnvStrict ?? opts.runtimeEnv ?? process.env;
5408
+ const emptyStringAsUndefined = opts.emptyStringAsUndefined ?? false;
5409
+ if (emptyStringAsUndefined) {
5410
+ for (const [key, value] of Object.entries(runtimeEnv)) {
5411
+ if (value === "") {
5412
+ delete runtimeEnv[key];
5413
+ }
5414
+ }
5415
+ }
5416
+ const skip = !!opts.skipValidation;
5417
+ if (skip)
5418
+ return runtimeEnv;
5419
+ const _client = typeof opts.client === "object" ? opts.client : {};
5420
+ const _server = typeof opts.server === "object" ? opts.server : {};
5421
+ const _shared = typeof opts.shared === "object" ? opts.shared : {};
5422
+ const isServer = opts.isServer ?? (typeof window === "undefined" || ("Deno" in window));
5423
+ const finalSchema = isServer ? {
5424
+ ..._server,
5425
+ ..._shared,
5426
+ ..._client
5427
+ } : {
5428
+ ..._client,
5429
+ ..._shared
5430
+ };
5431
+ const parsed = parseWithDictionary(finalSchema, runtimeEnv);
5432
+ const onValidationError = opts.onValidationError ?? ((issues) => {
5433
+ console.error("\u274C Invalid environment variables:", issues);
5434
+ throw new Error("Invalid environment variables");
5435
+ });
5436
+ const onInvalidAccess = opts.onInvalidAccess ?? (() => {
5437
+ throw new Error("\u274C Attempted to access a server-side environment variable on the client");
5438
+ });
5439
+ if (parsed.issues) {
5440
+ return onValidationError(parsed.issues);
5441
+ }
5442
+ const isServerAccess = (prop) => {
5443
+ if (!opts.clientPrefix)
5444
+ return true;
5445
+ return !prop.startsWith(opts.clientPrefix) && !(prop in _shared);
5446
+ };
5447
+ const isValidServerAccess = (prop) => {
5448
+ return isServer || !isServerAccess(prop);
5449
+ };
5450
+ const ignoreProp = (prop) => {
5451
+ return prop === "__esModule" || prop === "$$typeof";
5452
+ };
5453
+ const extendedObj = (opts.extends ?? []).reduce((acc, curr) => {
5454
+ return Object.assign(acc, curr);
5455
+ }, {});
5456
+ const fullObj = Object.assign(parsed.value, extendedObj);
5457
+ const env = new Proxy(fullObj, {
5458
+ get(target, prop) {
5459
+ if (typeof prop !== "string")
5460
+ return;
5461
+ if (ignoreProp(prop))
5462
+ return;
5463
+ if (!isValidServerAccess(prop))
5464
+ return onInvalidAccess(prop);
5465
+ return Reflect.get(target, prop);
5466
+ }
5467
+ });
5468
+ return env;
5469
+ }
5470
+
5350
5471
  // ../../node_modules/.pnpm/zod@3.24.1/node_modules/zod/lib/index.mjs
5351
5472
  var util;
5352
5473
  (function(util2) {
@@ -9337,69 +9458,6 @@ var z = /* @__PURE__ */ Object.freeze({
9337
9458
  ZodError
9338
9459
  });
9339
9460
 
9340
- // ../../node_modules/.pnpm/@t3-oss+env-core@0.11.1_typescript@5.7.2_zod@3.24.1/node_modules/@t3-oss/env-core/dist/index.js
9341
- function createEnv(opts) {
9342
- const runtimeEnv = opts.runtimeEnvStrict ?? opts.runtimeEnv ?? process.env;
9343
- const emptyStringAsUndefined = opts.emptyStringAsUndefined ?? false;
9344
- if (emptyStringAsUndefined) {
9345
- for (const [key, value] of Object.entries(runtimeEnv)) {
9346
- if (value === "") {
9347
- delete runtimeEnv[key];
9348
- }
9349
- }
9350
- }
9351
- const skip = !!opts.skipValidation;
9352
- if (skip)
9353
- return runtimeEnv;
9354
- const _client = typeof opts.client === "object" ? opts.client : {};
9355
- const _server = typeof opts.server === "object" ? opts.server : {};
9356
- const _shared = typeof opts.shared === "object" ? opts.shared : {};
9357
- const client = objectType(_client);
9358
- const server = objectType(_server);
9359
- const shared = objectType(_shared);
9360
- const isServer = opts.isServer ?? (typeof window === "undefined" || ("Deno" in window));
9361
- const allClient = client.merge(shared);
9362
- const allServer = server.merge(shared).merge(client);
9363
- const parsed = isServer ? allServer.safeParse(runtimeEnv) : allClient.safeParse(runtimeEnv);
9364
- const onValidationError = opts.onValidationError ?? ((error) => {
9365
- console.error("\u274C Invalid environment variables:", error.flatten().fieldErrors);
9366
- throw new Error("Invalid environment variables");
9367
- });
9368
- const onInvalidAccess = opts.onInvalidAccess ?? ((_variable) => {
9369
- throw new Error("\u274C Attempted to access a server-side environment variable on the client");
9370
- });
9371
- if (parsed.success === false) {
9372
- return onValidationError(parsed.error);
9373
- }
9374
- const isServerAccess = (prop) => {
9375
- if (!opts.clientPrefix)
9376
- return true;
9377
- return !prop.startsWith(opts.clientPrefix) && !(prop in shared.shape);
9378
- };
9379
- const isValidServerAccess = (prop) => {
9380
- return isServer || !isServerAccess(prop);
9381
- };
9382
- const ignoreProp = (prop) => {
9383
- return prop === "__esModule" || prop === "$$typeof";
9384
- };
9385
- const extendedObj = (opts.extends ?? []).reduce((acc, curr) => {
9386
- return Object.assign(acc, curr);
9387
- }, {});
9388
- const fullObj = Object.assign(parsed.data, extendedObj);
9389
- const env = new Proxy(fullObj, {
9390
- get(target, prop) {
9391
- if (typeof prop !== "string")
9392
- return;
9393
- if (ignoreProp(prop))
9394
- return;
9395
- if (!isValidServerAccess(prop))
9396
- return onInvalidAccess(prop);
9397
- return Reflect.get(target, prop);
9398
- }
9399
- });
9400
- return env;
9401
- }
9402
-
9403
9461
  // src/library/env.ts
9404
9462
  var BUILDING_WITH_VITE = `__vite_start_time` in globalThis;
9405
9463
  var HAS_WINDOW = typeof window !== `undefined`;