drizzle-kit 0.25.0-1800fdd → 0.25.0-1fba875
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/api.js +16 -78
- package/api.mjs +16 -78
- package/bin.cjs +1 -1
- package/package.json +1 -1
    
        package/api.js
    CHANGED
    
    | @@ -26841,46 +26841,6 @@ var init_dialect = __esm({ | |
| 26841 26841 | 
             
                    });
         | 
| 26842 26842 | 
             
                    return sql.join(chunks);
         | 
| 26843 26843 | 
             
                  }
         | 
| 26844 | 
            -
                  buildOptimizedSelection(fields, { isSingleTable = false } = {}) {
         | 
| 26845 | 
            -
                    const columnsLen = fields.length;
         | 
| 26846 | 
            -
                    const chunks = fields.flatMap(({ field }, i5) => {
         | 
| 26847 | 
            -
                      const chunk = [];
         | 
| 26848 | 
            -
                      if (is(field, SQL.Aliased) && field.isSelectionField) {
         | 
| 26849 | 
            -
                        chunk.push(sql.identifier(field.fieldAlias));
         | 
| 26850 | 
            -
                      } else if (is(field, SQL.Aliased) || is(field, SQL)) {
         | 
| 26851 | 
            -
                        const query = is(field, SQL.Aliased) ? field.sql : field;
         | 
| 26852 | 
            -
                        if (isSingleTable) {
         | 
| 26853 | 
            -
                          const parts = [];
         | 
| 26854 | 
            -
                          for (const c5 of query.queryChunks) {
         | 
| 26855 | 
            -
                            if (is(c5, PgColumn)) {
         | 
| 26856 | 
            -
                              parts.push(sql.raw(c5.name), sql`, `, sql.identifier(c5.name));
         | 
| 26857 | 
            -
                              continue;
         | 
| 26858 | 
            -
                            }
         | 
| 26859 | 
            -
                            parts.push(c5);
         | 
| 26860 | 
            -
                          }
         | 
| 26861 | 
            -
                          chunk.push(new SQL(parts));
         | 
| 26862 | 
            -
                        } else {
         | 
| 26863 | 
            -
                          chunk.push(query);
         | 
| 26864 | 
            -
                        }
         | 
| 26865 | 
            -
                        if (is(field, SQL.Aliased)) {
         | 
| 26866 | 
            -
                          chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
         | 
| 26867 | 
            -
                        }
         | 
| 26868 | 
            -
                      } else if (is(field, Column2)) {
         | 
| 26869 | 
            -
                        if (isSingleTable) {
         | 
| 26870 | 
            -
                          chunk.push(sql`'${sql.raw(field.name)}', ${sql.identifier(field.name)}`);
         | 
| 26871 | 
            -
                        } else {
         | 
| 26872 | 
            -
                          chunk.push(field);
         | 
| 26873 | 
            -
                        }
         | 
| 26874 | 
            -
                      }
         | 
| 26875 | 
            -
                      if (i5 < columnsLen - 1) {
         | 
| 26876 | 
            -
                        chunk.push(sql`, `);
         | 
| 26877 | 
            -
                      }
         | 
| 26878 | 
            -
                      return chunk;
         | 
| 26879 | 
            -
                    });
         | 
| 26880 | 
            -
                    chunks.unshift(sql`json_build_object(`);
         | 
| 26881 | 
            -
                    chunks.push(sql`)`);
         | 
| 26882 | 
            -
                    return sql.join(chunks);
         | 
| 26883 | 
            -
                  }
         | 
| 26884 26844 | 
             
                  buildSelectQuery({
         | 
| 26885 26845 | 
             
                    withList,
         | 
| 26886 26846 | 
             
                    fields,
         | 
| @@ -26895,8 +26855,7 @@ var init_dialect = __esm({ | |
| 26895 26855 | 
             
                    offset,
         | 
| 26896 26856 | 
             
                    lockingClause,
         | 
| 26897 26857 | 
             
                    distinct,
         | 
| 26898 | 
            -
                    setOperators | 
| 26899 | 
            -
                    optimize
         | 
| 26858 | 
            +
                    setOperators
         | 
| 26900 26859 | 
             
                  }) {
         | 
| 26901 26860 | 
             
                    const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
         | 
| 26902 26861 | 
             
                    for (const f5 of fieldsList) {
         | 
| @@ -26915,9 +26874,7 @@ var init_dialect = __esm({ | |
| 26915 26874 | 
             
                    if (distinct) {
         | 
| 26916 26875 | 
             
                      distinctSql = distinct === true ? sql` distinct` : sql` distinct on (${sql.join(distinct.on, sql`, `)})`;
         | 
| 26917 26876 | 
             
                    }
         | 
| 26918 | 
            -
                    const selection =  | 
| 26919 | 
            -
                      isSingleTable
         | 
| 26920 | 
            -
                    }) : this.buildSelection(fieldsList, { isSingleTable });
         | 
| 26877 | 
            +
                    const selection = this.buildSelection(fieldsList, { isSingleTable });
         | 
| 26921 26878 | 
             
                    const tableSql = (() => {
         | 
| 26922 26879 | 
             
                      if (is(table4, Table2) && table4[Table2.Symbol.OriginalName] !== table4[Table2.Symbol.Name]) {
         | 
| 26923 26880 | 
             
                        let fullName = sql`${sql.identifier(table4[Table2.Symbol.OriginalName])}`;
         | 
| @@ -28598,10 +28555,6 @@ var init_select2 = __esm({ | |
| 28598 28555 | 
             
                  $dynamic() {
         | 
| 28599 28556 | 
             
                    return this;
         | 
| 28600 28557 | 
             
                  }
         | 
| 28601 | 
            -
                  $optimize() {
         | 
| 28602 | 
            -
                    this.config.optimize = true;
         | 
| 28603 | 
            -
                    return this;
         | 
| 28604 | 
            -
                  }
         | 
| 28605 28558 | 
             
                };
         | 
| 28606 28559 | 
             
                __publicField(PgSelectQueryBuilderBase, _a130, "PgSelectQueryBuilder");
         | 
| 28607 28560 | 
             
                PgSelectBase = class extends (_b101 = PgSelectQueryBuilderBase, _a131 = entityKind, _b101) {
         | 
| @@ -28621,7 +28574,7 @@ var init_select2 = __esm({ | |
| 28621 28574 | 
             
                    }
         | 
| 28622 28575 | 
             
                    return tracer.startActiveSpan("drizzle.prepareQuery", () => {
         | 
| 28623 28576 | 
             
                      const fieldsList = orderSelectedFields(config.fields);
         | 
| 28624 | 
            -
                      const query = session.prepareQuery(dialect7.sqlToQuery(this.getSQL()), fieldsList, name2, true | 
| 28577 | 
            +
                      const query = session.prepareQuery(dialect7.sqlToQuery(this.getSQL()), fieldsList, name2, true);
         | 
| 28625 28578 | 
             
                      query.joinsNotNullableMap = joinsNotNullableMap;
         | 
| 28626 28579 | 
             
                      return query;
         | 
| 28627 28580 | 
             
                    });
         | 
| @@ -28934,7 +28887,7 @@ var _a136, _b104, _c3, _PgCountBuilder, PgCountBuilder; | |
| 28934 28887 | 
             
            var init_count = __esm({
         | 
| 28935 28888 | 
             
              "../drizzle-orm/dist/pg-core/query-builders/count.js"() {
         | 
| 28936 28889 | 
             
                "use strict";
         | 
| 28937 | 
            -
                 | 
| 28890 | 
            +
                init_entity();
         | 
| 28938 28891 | 
             
                init_sql();
         | 
| 28939 28892 | 
             
                _PgCountBuilder = class _PgCountBuilder extends (_c3 = SQL, _b104 = entityKind, _a136 = Symbol.toStringTag, _c3) {
         | 
| 28940 28893 | 
             
                  constructor(params) {
         | 
| @@ -30097,7 +30050,7 @@ var init_session2 = __esm({ | |
| 30097 30050 | 
             
                init_utils2();
         | 
| 30098 30051 | 
             
                ({ Pool } = import_pg.default);
         | 
| 30099 30052 | 
             
                NodePgPreparedQuery = class extends (_b114 = PgPreparedQuery, _a159 = entityKind, _b114) {
         | 
| 30100 | 
            -
                  constructor(client, queryString, params, logger2, fields, name2, _isResponseInArrayMode, customResultMapper | 
| 30053 | 
            +
                  constructor(client, queryString, params, logger2, fields, name2, _isResponseInArrayMode, customResultMapper) {
         | 
| 30101 30054 | 
             
                    super({ sql: queryString, params });
         | 
| 30102 30055 | 
             
                    __publicField(this, "rawQueryConfig");
         | 
| 30103 30056 | 
             
                    __publicField(this, "queryConfig");
         | 
| @@ -30107,7 +30060,6 @@ var init_session2 = __esm({ | |
| 30107 30060 | 
             
                    this.fields = fields;
         | 
| 30108 30061 | 
             
                    this._isResponseInArrayMode = _isResponseInArrayMode;
         | 
| 30109 30062 | 
             
                    this.customResultMapper = customResultMapper;
         | 
| 30110 | 
            -
                    this.isOptimized = isOptimized;
         | 
| 30111 30063 | 
             
                    this.rawQueryConfig = {
         | 
| 30112 30064 | 
             
                      name: name2,
         | 
| 30113 30065 | 
             
                      text: queryString
         | 
| @@ -30122,15 +30074,7 @@ var init_session2 = __esm({ | |
| 30122 30074 | 
             
                    return tracer.startActiveSpan("drizzle.execute", async () => {
         | 
| 30123 30075 | 
             
                      const params = fillPlaceholders(this.params, placeholderValues);
         | 
| 30124 30076 | 
             
                      this.logger.logQuery(this.rawQueryConfig.text, params);
         | 
| 30125 | 
            -
                      const {
         | 
| 30126 | 
            -
                        fields,
         | 
| 30127 | 
            -
                        rawQueryConfig: rawQuery,
         | 
| 30128 | 
            -
                        client,
         | 
| 30129 | 
            -
                        queryConfig: query,
         | 
| 30130 | 
            -
                        joinsNotNullableMap,
         | 
| 30131 | 
            -
                        customResultMapper,
         | 
| 30132 | 
            -
                        isOptimized
         | 
| 30133 | 
            -
                      } = this;
         | 
| 30077 | 
            +
                      const { fields, rawQueryConfig: rawQuery, client, queryConfig: query, joinsNotNullableMap, customResultMapper } = this;
         | 
| 30134 30078 | 
             
                      if (!fields && !customResultMapper) {
         | 
| 30135 30079 | 
             
                        return tracer.startActiveSpan("drizzle.driver.execute", async (span) => {
         | 
| 30136 30080 | 
             
                          span?.setAttributes({
         | 
| @@ -30150,7 +30094,7 @@ var init_session2 = __esm({ | |
| 30150 30094 | 
             
                        return client.query(query, params);
         | 
| 30151 30095 | 
             
                      });
         | 
| 30152 30096 | 
             
                      return tracer.startActiveSpan("drizzle.mapResponse", () => {
         | 
| 30153 | 
            -
                        return  | 
| 30097 | 
            +
                        return customResultMapper ? customResultMapper(result.rows) : result.rows.map((row) => mapResultRow(fields, row, joinsNotNullableMap));
         | 
| 30154 30098 | 
             
                      });
         | 
| 30155 30099 | 
             
                    });
         | 
| 30156 30100 | 
             
                  }
         | 
| @@ -30183,7 +30127,7 @@ var init_session2 = __esm({ | |
| 30183 30127 | 
             
                    this.options = options;
         | 
| 30184 30128 | 
             
                    this.logger = options.logger ?? new NoopLogger();
         | 
| 30185 30129 | 
             
                  }
         | 
| 30186 | 
            -
                  prepareQuery(query, fields, name2, isResponseInArrayMode, customResultMapper | 
| 30130 | 
            +
                  prepareQuery(query, fields, name2, isResponseInArrayMode, customResultMapper) {
         | 
| 30187 30131 | 
             
                    return new NodePgPreparedQuery(
         | 
| 30188 30132 | 
             
                      this.client,
         | 
| 30189 30133 | 
             
                      query.sql,
         | 
| @@ -30192,8 +30136,7 @@ var init_session2 = __esm({ | |
| 30192 30136 | 
             
                      fields,
         | 
| 30193 30137 | 
             
                      name2,
         | 
| 30194 30138 | 
             
                      isResponseInArrayMode,
         | 
| 30195 | 
            -
                      customResultMapper | 
| 30196 | 
            -
                      isOptimized
         | 
| 30139 | 
            +
                      customResultMapper
         | 
| 30197 30140 | 
             
                    );
         | 
| 30198 30141 | 
             
                  }
         | 
| 30199 30142 | 
             
                  async transaction(transaction, config) {
         | 
| @@ -48672,7 +48615,6 @@ var init_session3 = __esm({ | |
| 48672 48615 | 
             
                      database: options.database
         | 
| 48673 48616 | 
             
                    };
         | 
| 48674 48617 | 
             
                  }
         | 
| 48675 | 
            -
                  // @ts-ignore
         | 
| 48676 48618 | 
             
                  prepareQuery(query, fields, name2, isResponseInArrayMode, customResultMapper, transactionId) {
         | 
| 48677 48619 | 
             
                    return new AwsDataApiPreparedQuery(
         | 
| 48678 48620 | 
             
                      this.client,
         | 
| @@ -48693,8 +48635,6 @@ var init_session3 = __esm({ | |
| 48693 48635 | 
             
                      void 0,
         | 
| 48694 48636 | 
             
                      false,
         | 
| 48695 48637 | 
             
                      void 0,
         | 
| 48696 | 
            -
                      void 0,
         | 
| 48697 | 
            -
                      // @ts-ignore
         | 
| 48698 48638 | 
             
                      this.transactionId
         | 
| 48699 48639 | 
             
                    ).execute();
         | 
| 48700 48640 | 
             
                  }
         | 
| @@ -51929,7 +51869,7 @@ var _a215, _b158, _c7, _SQLiteCountBuilder, SQLiteCountBuilder; | |
| 51929 51869 | 
             
            var init_count2 = __esm({
         | 
| 51930 51870 | 
             
              "../drizzle-orm/dist/sqlite-core/query-builders/count.js"() {
         | 
| 51931 51871 | 
             
                "use strict";
         | 
| 51932 | 
            -
                 | 
| 51872 | 
            +
                init_entity();
         | 
| 51933 51873 | 
             
                init_sql();
         | 
| 51934 51874 | 
             
                _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b158 = entityKind, _a215 = Symbol.toStringTag, _c7) {
         | 
| 51935 51875 | 
             
                  constructor(params) {
         | 
| @@ -83019,7 +82959,7 @@ var _a252, _b183, _c9, _MySqlCountBuilder, MySqlCountBuilder; | |
| 83019 82959 | 
             
            var init_count3 = __esm({
         | 
| 83020 82960 | 
             
              "../drizzle-orm/dist/mysql-core/query-builders/count.js"() {
         | 
| 83021 82961 | 
             
                "use strict";
         | 
| 83022 | 
            -
                 | 
| 82962 | 
            +
                init_entity();
         | 
| 83023 82963 | 
             
                init_sql();
         | 
| 83024 82964 | 
             
                _MySqlCountBuilder = class _MySqlCountBuilder extends (_c9 = SQL, _b183 = entityKind, _a252 = Symbol.toStringTag, _c9) {
         | 
| 83025 82965 | 
             
                  constructor(params) {
         | 
| @@ -94580,7 +94520,7 @@ var init_session14 = __esm({ | |
| 94580 94520 | 
             
                init_tracing();
         | 
| 94581 94521 | 
             
                init_utils2();
         | 
| 94582 94522 | 
             
                PostgresJsPreparedQuery = class extends (_b213 = PgPreparedQuery, _a299 = entityKind, _b213) {
         | 
| 94583 | 
            -
                  constructor(client, queryString, params, logger2, fields, _isResponseInArrayMode, customResultMapper | 
| 94523 | 
            +
                  constructor(client, queryString, params, logger2, fields, _isResponseInArrayMode, customResultMapper) {
         | 
| 94584 94524 | 
             
                    super({ sql: queryString, params });
         | 
| 94585 94525 | 
             
                    this.client = client;
         | 
| 94586 94526 | 
             
                    this.queryString = queryString;
         | 
| @@ -94589,7 +94529,6 @@ var init_session14 = __esm({ | |
| 94589 94529 | 
             
                    this.fields = fields;
         | 
| 94590 94530 | 
             
                    this._isResponseInArrayMode = _isResponseInArrayMode;
         | 
| 94591 94531 | 
             
                    this.customResultMapper = customResultMapper;
         | 
| 94592 | 
            -
                    this.isOptimized = isOptimized;
         | 
| 94593 94532 | 
             
                  }
         | 
| 94594 94533 | 
             
                  async execute(placeholderValues = {}) {
         | 
| 94595 94534 | 
             
                    return tracer.startActiveSpan("drizzle.execute", async (span) => {
         | 
| @@ -94599,7 +94538,7 @@ var init_session14 = __esm({ | |
| 94599 94538 | 
             
                        "drizzle.query.params": JSON.stringify(params)
         | 
| 94600 94539 | 
             
                      });
         | 
| 94601 94540 | 
             
                      this.logger.logQuery(this.queryString, params);
         | 
| 94602 | 
            -
                      const { fields, queryString: query, client, joinsNotNullableMap, customResultMapper | 
| 94541 | 
            +
                      const { fields, queryString: query, client, joinsNotNullableMap, customResultMapper } = this;
         | 
| 94603 94542 | 
             
                      if (!fields && !customResultMapper) {
         | 
| 94604 94543 | 
             
                        return tracer.startActiveSpan("drizzle.driver.execute", () => {
         | 
| 94605 94544 | 
             
                          return client.unsafe(query, params);
         | 
| @@ -94613,7 +94552,7 @@ var init_session14 = __esm({ | |
| 94613 94552 | 
             
                        return client.unsafe(query, params).values();
         | 
| 94614 94553 | 
             
                      });
         | 
| 94615 94554 | 
             
                      return tracer.startActiveSpan("drizzle.mapResponse", () => {
         | 
| 94616 | 
            -
                        return  | 
| 94555 | 
            +
                        return customResultMapper ? customResultMapper(rows) : rows.map((row) => mapResultRow(fields, row, joinsNotNullableMap));
         | 
| 94617 94556 | 
             
                      });
         | 
| 94618 94557 | 
             
                    });
         | 
| 94619 94558 | 
             
                  }
         | 
| @@ -94649,7 +94588,7 @@ var init_session14 = __esm({ | |
| 94649 94588 | 
             
                    this.options = options;
         | 
| 94650 94589 | 
             
                    this.logger = options.logger ?? new NoopLogger();
         | 
| 94651 94590 | 
             
                  }
         | 
| 94652 | 
            -
                  prepareQuery(query, fields, name2, isResponseInArrayMode, customResultMapper | 
| 94591 | 
            +
                  prepareQuery(query, fields, name2, isResponseInArrayMode, customResultMapper) {
         | 
| 94653 94592 | 
             
                    return new PostgresJsPreparedQuery(
         | 
| 94654 94593 | 
             
                      this.client,
         | 
| 94655 94594 | 
             
                      query.sql,
         | 
| @@ -94657,8 +94596,7 @@ var init_session14 = __esm({ | |
| 94657 94596 | 
             
                      this.logger,
         | 
| 94658 94597 | 
             
                      fields,
         | 
| 94659 94598 | 
             
                      isResponseInArrayMode,
         | 
| 94660 | 
            -
                      customResultMapper | 
| 94661 | 
            -
                      isOptimized
         | 
| 94599 | 
            +
                      customResultMapper
         | 
| 94662 94600 | 
             
                    );
         | 
| 94663 94601 | 
             
                  }
         | 
| 94664 94602 | 
             
                  query(query, params) {
         | 
    
        package/api.mjs
    CHANGED
    
    | @@ -26846,46 +26846,6 @@ var init_dialect = __esm({ | |
| 26846 26846 | 
             
                    });
         | 
| 26847 26847 | 
             
                    return sql.join(chunks);
         | 
| 26848 26848 | 
             
                  }
         | 
| 26849 | 
            -
                  buildOptimizedSelection(fields, { isSingleTable = false } = {}) {
         | 
| 26850 | 
            -
                    const columnsLen = fields.length;
         | 
| 26851 | 
            -
                    const chunks = fields.flatMap(({ field }, i5) => {
         | 
| 26852 | 
            -
                      const chunk = [];
         | 
| 26853 | 
            -
                      if (is(field, SQL.Aliased) && field.isSelectionField) {
         | 
| 26854 | 
            -
                        chunk.push(sql.identifier(field.fieldAlias));
         | 
| 26855 | 
            -
                      } else if (is(field, SQL.Aliased) || is(field, SQL)) {
         | 
| 26856 | 
            -
                        const query = is(field, SQL.Aliased) ? field.sql : field;
         | 
| 26857 | 
            -
                        if (isSingleTable) {
         | 
| 26858 | 
            -
                          const parts = [];
         | 
| 26859 | 
            -
                          for (const c5 of query.queryChunks) {
         | 
| 26860 | 
            -
                            if (is(c5, PgColumn)) {
         | 
| 26861 | 
            -
                              parts.push(sql.raw(c5.name), sql`, `, sql.identifier(c5.name));
         | 
| 26862 | 
            -
                              continue;
         | 
| 26863 | 
            -
                            }
         | 
| 26864 | 
            -
                            parts.push(c5);
         | 
| 26865 | 
            -
                          }
         | 
| 26866 | 
            -
                          chunk.push(new SQL(parts));
         | 
| 26867 | 
            -
                        } else {
         | 
| 26868 | 
            -
                          chunk.push(query);
         | 
| 26869 | 
            -
                        }
         | 
| 26870 | 
            -
                        if (is(field, SQL.Aliased)) {
         | 
| 26871 | 
            -
                          chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
         | 
| 26872 | 
            -
                        }
         | 
| 26873 | 
            -
                      } else if (is(field, Column2)) {
         | 
| 26874 | 
            -
                        if (isSingleTable) {
         | 
| 26875 | 
            -
                          chunk.push(sql`'${sql.raw(field.name)}', ${sql.identifier(field.name)}`);
         | 
| 26876 | 
            -
                        } else {
         | 
| 26877 | 
            -
                          chunk.push(field);
         | 
| 26878 | 
            -
                        }
         | 
| 26879 | 
            -
                      }
         | 
| 26880 | 
            -
                      if (i5 < columnsLen - 1) {
         | 
| 26881 | 
            -
                        chunk.push(sql`, `);
         | 
| 26882 | 
            -
                      }
         | 
| 26883 | 
            -
                      return chunk;
         | 
| 26884 | 
            -
                    });
         | 
| 26885 | 
            -
                    chunks.unshift(sql`json_build_object(`);
         | 
| 26886 | 
            -
                    chunks.push(sql`)`);
         | 
| 26887 | 
            -
                    return sql.join(chunks);
         | 
| 26888 | 
            -
                  }
         | 
| 26889 26849 | 
             
                  buildSelectQuery({
         | 
| 26890 26850 | 
             
                    withList,
         | 
| 26891 26851 | 
             
                    fields,
         | 
| @@ -26900,8 +26860,7 @@ var init_dialect = __esm({ | |
| 26900 26860 | 
             
                    offset,
         | 
| 26901 26861 | 
             
                    lockingClause,
         | 
| 26902 26862 | 
             
                    distinct,
         | 
| 26903 | 
            -
                    setOperators | 
| 26904 | 
            -
                    optimize
         | 
| 26863 | 
            +
                    setOperators
         | 
| 26905 26864 | 
             
                  }) {
         | 
| 26906 26865 | 
             
                    const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
         | 
| 26907 26866 | 
             
                    for (const f5 of fieldsList) {
         | 
| @@ -26920,9 +26879,7 @@ var init_dialect = __esm({ | |
| 26920 26879 | 
             
                    if (distinct) {
         | 
| 26921 26880 | 
             
                      distinctSql = distinct === true ? sql` distinct` : sql` distinct on (${sql.join(distinct.on, sql`, `)})`;
         | 
| 26922 26881 | 
             
                    }
         | 
| 26923 | 
            -
                    const selection =  | 
| 26924 | 
            -
                      isSingleTable
         | 
| 26925 | 
            -
                    }) : this.buildSelection(fieldsList, { isSingleTable });
         | 
| 26882 | 
            +
                    const selection = this.buildSelection(fieldsList, { isSingleTable });
         | 
| 26926 26883 | 
             
                    const tableSql = (() => {
         | 
| 26927 26884 | 
             
                      if (is(table4, Table2) && table4[Table2.Symbol.OriginalName] !== table4[Table2.Symbol.Name]) {
         | 
| 26928 26885 | 
             
                        let fullName = sql`${sql.identifier(table4[Table2.Symbol.OriginalName])}`;
         | 
| @@ -28603,10 +28560,6 @@ var init_select2 = __esm({ | |
| 28603 28560 | 
             
                  $dynamic() {
         | 
| 28604 28561 | 
             
                    return this;
         | 
| 28605 28562 | 
             
                  }
         | 
| 28606 | 
            -
                  $optimize() {
         | 
| 28607 | 
            -
                    this.config.optimize = true;
         | 
| 28608 | 
            -
                    return this;
         | 
| 28609 | 
            -
                  }
         | 
| 28610 28563 | 
             
                };
         | 
| 28611 28564 | 
             
                __publicField(PgSelectQueryBuilderBase, _a130, "PgSelectQueryBuilder");
         | 
| 28612 28565 | 
             
                PgSelectBase = class extends (_b101 = PgSelectQueryBuilderBase, _a131 = entityKind, _b101) {
         | 
| @@ -28626,7 +28579,7 @@ var init_select2 = __esm({ | |
| 28626 28579 | 
             
                    }
         | 
| 28627 28580 | 
             
                    return tracer.startActiveSpan("drizzle.prepareQuery", () => {
         | 
| 28628 28581 | 
             
                      const fieldsList = orderSelectedFields(config.fields);
         | 
| 28629 | 
            -
                      const query = session.prepareQuery(dialect7.sqlToQuery(this.getSQL()), fieldsList, name2, true | 
| 28582 | 
            +
                      const query = session.prepareQuery(dialect7.sqlToQuery(this.getSQL()), fieldsList, name2, true);
         | 
| 28630 28583 | 
             
                      query.joinsNotNullableMap = joinsNotNullableMap;
         | 
| 28631 28584 | 
             
                      return query;
         | 
| 28632 28585 | 
             
                    });
         | 
| @@ -28939,7 +28892,7 @@ var _a136, _b104, _c3, _PgCountBuilder, PgCountBuilder; | |
| 28939 28892 | 
             
            var init_count = __esm({
         | 
| 28940 28893 | 
             
              "../drizzle-orm/dist/pg-core/query-builders/count.js"() {
         | 
| 28941 28894 | 
             
                "use strict";
         | 
| 28942 | 
            -
                 | 
| 28895 | 
            +
                init_entity();
         | 
| 28943 28896 | 
             
                init_sql();
         | 
| 28944 28897 | 
             
                _PgCountBuilder = class _PgCountBuilder extends (_c3 = SQL, _b104 = entityKind, _a136 = Symbol.toStringTag, _c3) {
         | 
| 28945 28898 | 
             
                  constructor(params) {
         | 
| @@ -30102,7 +30055,7 @@ var init_session2 = __esm({ | |
| 30102 30055 | 
             
                init_utils2();
         | 
| 30103 30056 | 
             
                ({ Pool } = import_pg.default);
         | 
| 30104 30057 | 
             
                NodePgPreparedQuery = class extends (_b114 = PgPreparedQuery, _a159 = entityKind, _b114) {
         | 
| 30105 | 
            -
                  constructor(client, queryString, params, logger2, fields, name2, _isResponseInArrayMode, customResultMapper | 
| 30058 | 
            +
                  constructor(client, queryString, params, logger2, fields, name2, _isResponseInArrayMode, customResultMapper) {
         | 
| 30106 30059 | 
             
                    super({ sql: queryString, params });
         | 
| 30107 30060 | 
             
                    __publicField(this, "rawQueryConfig");
         | 
| 30108 30061 | 
             
                    __publicField(this, "queryConfig");
         | 
| @@ -30112,7 +30065,6 @@ var init_session2 = __esm({ | |
| 30112 30065 | 
             
                    this.fields = fields;
         | 
| 30113 30066 | 
             
                    this._isResponseInArrayMode = _isResponseInArrayMode;
         | 
| 30114 30067 | 
             
                    this.customResultMapper = customResultMapper;
         | 
| 30115 | 
            -
                    this.isOptimized = isOptimized;
         | 
| 30116 30068 | 
             
                    this.rawQueryConfig = {
         | 
| 30117 30069 | 
             
                      name: name2,
         | 
| 30118 30070 | 
             
                      text: queryString
         | 
| @@ -30127,15 +30079,7 @@ var init_session2 = __esm({ | |
| 30127 30079 | 
             
                    return tracer.startActiveSpan("drizzle.execute", async () => {
         | 
| 30128 30080 | 
             
                      const params = fillPlaceholders(this.params, placeholderValues);
         | 
| 30129 30081 | 
             
                      this.logger.logQuery(this.rawQueryConfig.text, params);
         | 
| 30130 | 
            -
                      const {
         | 
| 30131 | 
            -
                        fields,
         | 
| 30132 | 
            -
                        rawQueryConfig: rawQuery,
         | 
| 30133 | 
            -
                        client,
         | 
| 30134 | 
            -
                        queryConfig: query,
         | 
| 30135 | 
            -
                        joinsNotNullableMap,
         | 
| 30136 | 
            -
                        customResultMapper,
         | 
| 30137 | 
            -
                        isOptimized
         | 
| 30138 | 
            -
                      } = this;
         | 
| 30082 | 
            +
                      const { fields, rawQueryConfig: rawQuery, client, queryConfig: query, joinsNotNullableMap, customResultMapper } = this;
         | 
| 30139 30083 | 
             
                      if (!fields && !customResultMapper) {
         | 
| 30140 30084 | 
             
                        return tracer.startActiveSpan("drizzle.driver.execute", async (span) => {
         | 
| 30141 30085 | 
             
                          span?.setAttributes({
         | 
| @@ -30155,7 +30099,7 @@ var init_session2 = __esm({ | |
| 30155 30099 | 
             
                        return client.query(query, params);
         | 
| 30156 30100 | 
             
                      });
         | 
| 30157 30101 | 
             
                      return tracer.startActiveSpan("drizzle.mapResponse", () => {
         | 
| 30158 | 
            -
                        return  | 
| 30102 | 
            +
                        return customResultMapper ? customResultMapper(result.rows) : result.rows.map((row) => mapResultRow(fields, row, joinsNotNullableMap));
         | 
| 30159 30103 | 
             
                      });
         | 
| 30160 30104 | 
             
                    });
         | 
| 30161 30105 | 
             
                  }
         | 
| @@ -30188,7 +30132,7 @@ var init_session2 = __esm({ | |
| 30188 30132 | 
             
                    this.options = options;
         | 
| 30189 30133 | 
             
                    this.logger = options.logger ?? new NoopLogger();
         | 
| 30190 30134 | 
             
                  }
         | 
| 30191 | 
            -
                  prepareQuery(query, fields, name2, isResponseInArrayMode, customResultMapper | 
| 30135 | 
            +
                  prepareQuery(query, fields, name2, isResponseInArrayMode, customResultMapper) {
         | 
| 30192 30136 | 
             
                    return new NodePgPreparedQuery(
         | 
| 30193 30137 | 
             
                      this.client,
         | 
| 30194 30138 | 
             
                      query.sql,
         | 
| @@ -30197,8 +30141,7 @@ var init_session2 = __esm({ | |
| 30197 30141 | 
             
                      fields,
         | 
| 30198 30142 | 
             
                      name2,
         | 
| 30199 30143 | 
             
                      isResponseInArrayMode,
         | 
| 30200 | 
            -
                      customResultMapper | 
| 30201 | 
            -
                      isOptimized
         | 
| 30144 | 
            +
                      customResultMapper
         | 
| 30202 30145 | 
             
                    );
         | 
| 30203 30146 | 
             
                  }
         | 
| 30204 30147 | 
             
                  async transaction(transaction, config) {
         | 
| @@ -48676,7 +48619,6 @@ var init_session3 = __esm({ | |
| 48676 48619 | 
             
                      database: options.database
         | 
| 48677 48620 | 
             
                    };
         | 
| 48678 48621 | 
             
                  }
         | 
| 48679 | 
            -
                  // @ts-ignore
         | 
| 48680 48622 | 
             
                  prepareQuery(query, fields, name2, isResponseInArrayMode, customResultMapper, transactionId) {
         | 
| 48681 48623 | 
             
                    return new AwsDataApiPreparedQuery(
         | 
| 48682 48624 | 
             
                      this.client,
         | 
| @@ -48697,8 +48639,6 @@ var init_session3 = __esm({ | |
| 48697 48639 | 
             
                      void 0,
         | 
| 48698 48640 | 
             
                      false,
         | 
| 48699 48641 | 
             
                      void 0,
         | 
| 48700 | 
            -
                      void 0,
         | 
| 48701 | 
            -
                      // @ts-ignore
         | 
| 48702 48642 | 
             
                      this.transactionId
         | 
| 48703 48643 | 
             
                    ).execute();
         | 
| 48704 48644 | 
             
                  }
         | 
| @@ -51933,7 +51873,7 @@ var _a215, _b158, _c7, _SQLiteCountBuilder, SQLiteCountBuilder; | |
| 51933 51873 | 
             
            var init_count2 = __esm({
         | 
| 51934 51874 | 
             
              "../drizzle-orm/dist/sqlite-core/query-builders/count.js"() {
         | 
| 51935 51875 | 
             
                "use strict";
         | 
| 51936 | 
            -
                 | 
| 51876 | 
            +
                init_entity();
         | 
| 51937 51877 | 
             
                init_sql();
         | 
| 51938 51878 | 
             
                _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b158 = entityKind, _a215 = Symbol.toStringTag, _c7) {
         | 
| 51939 51879 | 
             
                  constructor(params) {
         | 
| @@ -83023,7 +82963,7 @@ var _a252, _b183, _c9, _MySqlCountBuilder, MySqlCountBuilder; | |
| 83023 82963 | 
             
            var init_count3 = __esm({
         | 
| 83024 82964 | 
             
              "../drizzle-orm/dist/mysql-core/query-builders/count.js"() {
         | 
| 83025 82965 | 
             
                "use strict";
         | 
| 83026 | 
            -
                 | 
| 82966 | 
            +
                init_entity();
         | 
| 83027 82967 | 
             
                init_sql();
         | 
| 83028 82968 | 
             
                _MySqlCountBuilder = class _MySqlCountBuilder extends (_c9 = SQL, _b183 = entityKind, _a252 = Symbol.toStringTag, _c9) {
         | 
| 83029 82969 | 
             
                  constructor(params) {
         | 
| @@ -94583,7 +94523,7 @@ var init_session14 = __esm({ | |
| 94583 94523 | 
             
                init_tracing();
         | 
| 94584 94524 | 
             
                init_utils2();
         | 
| 94585 94525 | 
             
                PostgresJsPreparedQuery = class extends (_b213 = PgPreparedQuery, _a299 = entityKind, _b213) {
         | 
| 94586 | 
            -
                  constructor(client, queryString, params, logger2, fields, _isResponseInArrayMode, customResultMapper | 
| 94526 | 
            +
                  constructor(client, queryString, params, logger2, fields, _isResponseInArrayMode, customResultMapper) {
         | 
| 94587 94527 | 
             
                    super({ sql: queryString, params });
         | 
| 94588 94528 | 
             
                    this.client = client;
         | 
| 94589 94529 | 
             
                    this.queryString = queryString;
         | 
| @@ -94592,7 +94532,6 @@ var init_session14 = __esm({ | |
| 94592 94532 | 
             
                    this.fields = fields;
         | 
| 94593 94533 | 
             
                    this._isResponseInArrayMode = _isResponseInArrayMode;
         | 
| 94594 94534 | 
             
                    this.customResultMapper = customResultMapper;
         | 
| 94595 | 
            -
                    this.isOptimized = isOptimized;
         | 
| 94596 94535 | 
             
                  }
         | 
| 94597 94536 | 
             
                  async execute(placeholderValues = {}) {
         | 
| 94598 94537 | 
             
                    return tracer.startActiveSpan("drizzle.execute", async (span) => {
         | 
| @@ -94602,7 +94541,7 @@ var init_session14 = __esm({ | |
| 94602 94541 | 
             
                        "drizzle.query.params": JSON.stringify(params)
         | 
| 94603 94542 | 
             
                      });
         | 
| 94604 94543 | 
             
                      this.logger.logQuery(this.queryString, params);
         | 
| 94605 | 
            -
                      const { fields, queryString: query, client, joinsNotNullableMap, customResultMapper | 
| 94544 | 
            +
                      const { fields, queryString: query, client, joinsNotNullableMap, customResultMapper } = this;
         | 
| 94606 94545 | 
             
                      if (!fields && !customResultMapper) {
         | 
| 94607 94546 | 
             
                        return tracer.startActiveSpan("drizzle.driver.execute", () => {
         | 
| 94608 94547 | 
             
                          return client.unsafe(query, params);
         | 
| @@ -94616,7 +94555,7 @@ var init_session14 = __esm({ | |
| 94616 94555 | 
             
                        return client.unsafe(query, params).values();
         | 
| 94617 94556 | 
             
                      });
         | 
| 94618 94557 | 
             
                      return tracer.startActiveSpan("drizzle.mapResponse", () => {
         | 
| 94619 | 
            -
                        return  | 
| 94558 | 
            +
                        return customResultMapper ? customResultMapper(rows) : rows.map((row) => mapResultRow(fields, row, joinsNotNullableMap));
         | 
| 94620 94559 | 
             
                      });
         | 
| 94621 94560 | 
             
                    });
         | 
| 94622 94561 | 
             
                  }
         | 
| @@ -94652,7 +94591,7 @@ var init_session14 = __esm({ | |
| 94652 94591 | 
             
                    this.options = options;
         | 
| 94653 94592 | 
             
                    this.logger = options.logger ?? new NoopLogger();
         | 
| 94654 94593 | 
             
                  }
         | 
| 94655 | 
            -
                  prepareQuery(query, fields, name2, isResponseInArrayMode, customResultMapper | 
| 94594 | 
            +
                  prepareQuery(query, fields, name2, isResponseInArrayMode, customResultMapper) {
         | 
| 94656 94595 | 
             
                    return new PostgresJsPreparedQuery(
         | 
| 94657 94596 | 
             
                      this.client,
         | 
| 94658 94597 | 
             
                      query.sql,
         | 
| @@ -94660,8 +94599,7 @@ var init_session14 = __esm({ | |
| 94660 94599 | 
             
                      this.logger,
         | 
| 94661 94600 | 
             
                      fields,
         | 
| 94662 94601 | 
             
                      isResponseInArrayMode,
         | 
| 94663 | 
            -
                      customResultMapper | 
| 94664 | 
            -
                      isOptimized
         | 
| 94602 | 
            +
                      customResultMapper
         | 
| 94665 94603 | 
             
                    );
         | 
| 94666 94604 | 
             
                  }
         | 
| 94667 94605 | 
             
                  query(query, params) {
         | 
    
        package/bin.cjs
    CHANGED
    
    | @@ -85222,7 +85222,7 @@ init_utils2(); | |
| 85222 85222 | 
             
            var version2 = async () => {
         | 
| 85223 85223 | 
             
              const { npmVersion } = await ormCoreVersions();
         | 
| 85224 85224 | 
             
              const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
         | 
| 85225 | 
            -
              const envVersion = "0.25.0- | 
| 85225 | 
            +
              const envVersion = "0.25.0-1fba875";
         | 
| 85226 85226 | 
             
              const kitVersion = envVersion ? `v${envVersion}` : "--";
         | 
| 85227 85227 | 
             
              const versions = `drizzle-kit: ${kitVersion}
         | 
| 85228 85228 | 
             
            ${ormVersion}`;
         |