drizzle-kit 1.0.0-beta.1-6b935a0 → 1.0.0-beta.1-7946562
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 +4 -132
 - package/api.mjs +4 -132
 - package/bin.cjs +99 -16
 - package/package.json +1 -1
 
    
        package/api.js
    CHANGED
    
    | 
         @@ -22282,14 +22282,6 @@ var init_common2 = __esm({ 
     | 
|
| 
       22282 
22282 
     | 
    
         
             
                    }
         
     | 
| 
       22283 
22283 
     | 
    
         
             
                    return value.map((v) => this.baseColumn.mapFromDriverValue(v));
         
     | 
| 
       22284 
22284 
     | 
    
         
             
                  }
         
     | 
| 
       22285 
     | 
    
         
            -
                  // Needed for arrays of custom types
         
     | 
| 
       22286 
     | 
    
         
            -
                  mapFromJsonValue(value) {
         
     | 
| 
       22287 
     | 
    
         
            -
                    if (typeof value === "string") {
         
     | 
| 
       22288 
     | 
    
         
            -
                      value = parsePgArray(value);
         
     | 
| 
       22289 
     | 
    
         
            -
                    }
         
     | 
| 
       22290 
     | 
    
         
            -
                    const base = this.baseColumn;
         
     | 
| 
       22291 
     | 
    
         
            -
                    return "mapFromJsonValue" in base ? value.map((v) => base.mapFromJsonValue(v)) : value.map((v) => base.mapFromDriverValue(v));
         
     | 
| 
       22292 
     | 
    
         
            -
                  }
         
     | 
| 
       22293 
22285 
     | 
    
         
             
                  mapToDriverValue(value, isNestedArray = false) {
         
     | 
| 
       22294 
22286 
     | 
    
         
             
                    const a = value.map(
         
     | 
| 
       22295 
22287 
     | 
    
         
             
                      (v) => v === null ? null : is(this.baseColumn, _PgArray) ? this.baseColumn.mapToDriverValue(v, true) : this.baseColumn.mapToDriverValue(v)
         
     | 
| 
         @@ -23411,7 +23403,7 @@ function mapRelationalRow(row, buildQueryResultSelection, mapColumnValue = (valu 
     | 
|
| 
       23411 
23403 
     | 
    
         
             
                } else {
         
     | 
| 
       23412 
23404 
     | 
    
         
             
                  decoder = field.getSQL().decoder;
         
     | 
| 
       23413 
23405 
     | 
    
         
             
                }
         
     | 
| 
       23414 
     | 
    
         
            -
                row[selectionItem.key] =  
     | 
| 
      
 23406 
     | 
    
         
            +
                row[selectionItem.key] = decoder.mapFromDriverValue(value);
         
     | 
| 
       23415 
23407 
     | 
    
         
             
              }
         
     | 
| 
       23416 
23408 
     | 
    
         
             
              return row;
         
     | 
| 
       23417 
23409 
     | 
    
         
             
            }
         
     | 
| 
         @@ -24866,13 +24858,9 @@ var init_custom = __esm({ 
     | 
|
| 
       24866 
24858 
     | 
    
         
             
                    __publicField(this, "sqlName");
         
     | 
| 
       24867 
24859 
     | 
    
         
             
                    __publicField(this, "mapTo");
         
     | 
| 
       24868 
24860 
     | 
    
         
             
                    __publicField(this, "mapFrom");
         
     | 
| 
       24869 
     | 
    
         
            -
                    __publicField(this, "mapJson");
         
     | 
| 
       24870 
     | 
    
         
            -
                    __publicField(this, "wrapName");
         
     | 
| 
       24871 
24861 
     | 
    
         
             
                    this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
         
     | 
| 
       24872 
24862 
     | 
    
         
             
                    this.mapTo = config.customTypeParams.toDriver;
         
     | 
| 
       24873 
24863 
     | 
    
         
             
                    this.mapFrom = config.customTypeParams.fromDriver;
         
     | 
| 
       24874 
     | 
    
         
            -
                    this.mapJson = config.customTypeParams.fromJson;
         
     | 
| 
       24875 
     | 
    
         
            -
                    this.wrapName = config.customTypeParams.jsonWrap;
         
     | 
| 
       24876 
24864 
     | 
    
         
             
                  }
         
     | 
| 
       24877 
24865 
     | 
    
         
             
                  getSQLType() {
         
     | 
| 
       24878 
24866 
     | 
    
         
             
                    return this.sqlName;
         
     | 
| 
         @@ -24880,29 +24868,6 @@ var init_custom = __esm({ 
     | 
|
| 
       24880 
24868 
     | 
    
         
             
                  mapFromDriverValue(value) {
         
     | 
| 
       24881 
24869 
     | 
    
         
             
                    return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
         
     | 
| 
       24882 
24870 
     | 
    
         
             
                  }
         
     | 
| 
       24883 
     | 
    
         
            -
                  mapFromJsonValue(value) {
         
     | 
| 
       24884 
     | 
    
         
            -
                    return typeof this.mapJson === "function" ? this.mapJson(value) : this.mapFromDriverValue(value);
         
     | 
| 
       24885 
     | 
    
         
            -
                  }
         
     | 
| 
       24886 
     | 
    
         
            -
                  jsonWrapName(name2, sql2, arrayDimensions) {
         
     | 
| 
       24887 
     | 
    
         
            -
                    if (typeof this.wrapName === "function")
         
     | 
| 
       24888 
     | 
    
         
            -
                      return this.wrapName(name2, sql2, arrayDimensions);
         
     | 
| 
       24889 
     | 
    
         
            -
                    const rawType = this.getSQLType().toLowerCase();
         
     | 
| 
       24890 
     | 
    
         
            -
                    const parenPos = rawType.indexOf("(");
         
     | 
| 
       24891 
     | 
    
         
            -
                    const type = parenPos + 1 ? rawType.slice(0, parenPos) : rawType;
         
     | 
| 
       24892 
     | 
    
         
            -
                    switch (type) {
         
     | 
| 
       24893 
     | 
    
         
            -
                      case "bytea":
         
     | 
| 
       24894 
     | 
    
         
            -
                      case "geometry":
         
     | 
| 
       24895 
     | 
    
         
            -
                      case "timestamp":
         
     | 
| 
       24896 
     | 
    
         
            -
                      case "numeric":
         
     | 
| 
       24897 
     | 
    
         
            -
                      case "bigint": {
         
     | 
| 
       24898 
     | 
    
         
            -
                        const arrVal = "[]".repeat(arrayDimensions ?? 0);
         
     | 
| 
       24899 
     | 
    
         
            -
                        return sql2`${name2}::text${sql2.raw(arrVal).if(arrayDimensions)}`;
         
     | 
| 
       24900 
     | 
    
         
            -
                      }
         
     | 
| 
       24901 
     | 
    
         
            -
                      default: {
         
     | 
| 
       24902 
     | 
    
         
            -
                        return name2;
         
     | 
| 
       24903 
     | 
    
         
            -
                      }
         
     | 
| 
       24904 
     | 
    
         
            -
                    }
         
     | 
| 
       24905 
     | 
    
         
            -
                  }
         
     | 
| 
       24906 
24871 
     | 
    
         
             
                  mapToDriverValue(value) {
         
     | 
| 
       24907 
24872 
     | 
    
         
             
                    return typeof this.mapTo === "function" ? this.mapTo(value) : value;
         
     | 
| 
       24908 
24873 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -27585,11 +27550,11 @@ var init_dialect = __esm({ 
     | 
|
| 
       27585 
27550 
     | 
    
         
             
                      const name2 = sql`${table6}.${sql.identifier(this.casing.getColumnCasing(column6))}`;
         
     | 
| 
       27586 
27551 
     | 
    
         
             
                      let targetType = column6.columnType;
         
     | 
| 
       27587 
27552 
     | 
    
         
             
                      let col = column6;
         
     | 
| 
       27588 
     | 
    
         
            -
                      let  
     | 
| 
      
 27553 
     | 
    
         
            +
                      let arrVal = "";
         
     | 
| 
       27589 
27554 
     | 
    
         
             
                      while (is(col, PgArray)) {
         
     | 
| 
       27590 
     | 
    
         
            -
                        col =  
     | 
| 
      
 27555 
     | 
    
         
            +
                        col = column6.baseColumn;
         
     | 
| 
       27591 
27556 
     | 
    
         
             
                        targetType = col.columnType;
         
     | 
| 
       27592 
     | 
    
         
            -
                         
     | 
| 
      
 27557 
     | 
    
         
            +
                        arrVal = arrVal + "[]";
         
     | 
| 
       27593 
27558 
     | 
    
         
             
                      }
         
     | 
| 
       27594 
27559 
     | 
    
         
             
                      switch (targetType) {
         
     | 
| 
       27595 
27560 
     | 
    
         
             
                        case "PgNumeric":
         
     | 
| 
         @@ -27601,12 +27566,8 @@ var init_dialect = __esm({ 
     | 
|
| 
       27601 
27566 
     | 
    
         
             
                        case "PgGeometry":
         
     | 
| 
       27602 
27567 
     | 
    
         
             
                        case "PgGeometryObject":
         
     | 
| 
       27603 
27568 
     | 
    
         
             
                        case "PgBytea": {
         
     | 
| 
       27604 
     | 
    
         
            -
                          const arrVal = "[]".repeat(dimensionCnt);
         
     | 
| 
       27605 
27569 
     | 
    
         
             
                          return sql`${name2}::text${sql.raw(arrVal).if(arrVal)} as ${sql.identifier(key)}`;
         
     | 
| 
       27606 
27570 
     | 
    
         
             
                        }
         
     | 
| 
       27607 
     | 
    
         
            -
                        case "PgCustomColumn": {
         
     | 
| 
       27608 
     | 
    
         
            -
                          return sql`${col.jsonWrapName(name2, sql, dimensionCnt > 0 ? dimensionCnt : void 0)} as ${sql.identifier(key)}`;
         
     | 
| 
       27609 
     | 
    
         
            -
                        }
         
     | 
| 
       27610 
27571 
     | 
    
         
             
                        default: {
         
     | 
| 
       27611 
27572 
     | 
    
         
             
                          return sql`${name2} as ${sql.identifier(key)}`;
         
     | 
| 
       27612 
27573 
     | 
    
         
             
                        }
         
     | 
| 
         @@ -32570,13 +32531,9 @@ var init_custom2 = __esm({ 
     | 
|
| 
       32570 
32531 
     | 
    
         
             
                    __publicField(this, "sqlName");
         
     | 
| 
       32571 
32532 
     | 
    
         
             
                    __publicField(this, "mapTo");
         
     | 
| 
       32572 
32533 
     | 
    
         
             
                    __publicField(this, "mapFrom");
         
     | 
| 
       32573 
     | 
    
         
            -
                    __publicField(this, "mapJson");
         
     | 
| 
       32574 
     | 
    
         
            -
                    __publicField(this, "wrapName");
         
     | 
| 
       32575 
32534 
     | 
    
         
             
                    this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
         
     | 
| 
       32576 
32535 
     | 
    
         
             
                    this.mapTo = config.customTypeParams.toDriver;
         
     | 
| 
       32577 
32536 
     | 
    
         
             
                    this.mapFrom = config.customTypeParams.fromDriver;
         
     | 
| 
       32578 
     | 
    
         
            -
                    this.mapJson = config.customTypeParams.fromJson;
         
     | 
| 
       32579 
     | 
    
         
            -
                    this.wrapName = config.customTypeParams.jsonWrap;
         
     | 
| 
       32580 
32537 
     | 
    
         
             
                  }
         
     | 
| 
       32581 
32538 
     | 
    
         
             
                  getSQLType() {
         
     | 
| 
       32582 
32539 
     | 
    
         
             
                    return this.sqlName;
         
     | 
| 
         @@ -32584,29 +32541,6 @@ var init_custom2 = __esm({ 
     | 
|
| 
       32584 
32541 
     | 
    
         
             
                  mapFromDriverValue(value) {
         
     | 
| 
       32585 
32542 
     | 
    
         
             
                    return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
         
     | 
| 
       32586 
32543 
     | 
    
         
             
                  }
         
     | 
| 
       32587 
     | 
    
         
            -
                  mapFromJsonValue(value) {
         
     | 
| 
       32588 
     | 
    
         
            -
                    return typeof this.mapJson === "function" ? this.mapJson(value) : this.mapFromDriverValue(value);
         
     | 
| 
       32589 
     | 
    
         
            -
                  }
         
     | 
| 
       32590 
     | 
    
         
            -
                  jsonWrapName(name2, sql2) {
         
     | 
| 
       32591 
     | 
    
         
            -
                    if (typeof this.wrapName === "function")
         
     | 
| 
       32592 
     | 
    
         
            -
                      return this.wrapName(name2, sql2);
         
     | 
| 
       32593 
     | 
    
         
            -
                    const rawType = this.getSQLType().toLowerCase();
         
     | 
| 
       32594 
     | 
    
         
            -
                    const parenPos = rawType.indexOf("(");
         
     | 
| 
       32595 
     | 
    
         
            -
                    const type = parenPos + 1 ? rawType.slice(0, parenPos) : rawType;
         
     | 
| 
       32596 
     | 
    
         
            -
                    switch (type) {
         
     | 
| 
       32597 
     | 
    
         
            -
                      case "numeric":
         
     | 
| 
       32598 
     | 
    
         
            -
                      case "decimal":
         
     | 
| 
       32599 
     | 
    
         
            -
                      case "bigint": {
         
     | 
| 
       32600 
     | 
    
         
            -
                        return sql2`cast(${name2} as text)`;
         
     | 
| 
       32601 
     | 
    
         
            -
                      }
         
     | 
| 
       32602 
     | 
    
         
            -
                      case "blob": {
         
     | 
| 
       32603 
     | 
    
         
            -
                        return sql2`hex(${name2})`;
         
     | 
| 
       32604 
     | 
    
         
            -
                      }
         
     | 
| 
       32605 
     | 
    
         
            -
                      default: {
         
     | 
| 
       32606 
     | 
    
         
            -
                        return name2;
         
     | 
| 
       32607 
     | 
    
         
            -
                      }
         
     | 
| 
       32608 
     | 
    
         
            -
                    }
         
     | 
| 
       32609 
     | 
    
         
            -
                  }
         
     | 
| 
       32610 
32544 
     | 
    
         
             
                  mapToDriverValue(value) {
         
     | 
| 
       32611 
32545 
     | 
    
         
             
                    return typeof this.mapTo === "function" ? this.mapTo(value) : value;
         
     | 
| 
       32612 
32546 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -33800,9 +33734,6 @@ var init_dialect2 = __esm({ 
     | 
|
| 
       33800 
33734 
     | 
    
         
             
                        case "SQLiteNumericBigInt": {
         
     | 
| 
       33801 
33735 
     | 
    
         
             
                          return sql`cast(${name2} as text) as ${sql.identifier(key)}`;
         
     | 
| 
       33802 
33736 
     | 
    
         
             
                        }
         
     | 
| 
       33803 
     | 
    
         
            -
                        case "SQLiteCustomColumn": {
         
     | 
| 
       33804 
     | 
    
         
            -
                          return sql`${column6.jsonWrapName(name2, sql)} as ${sql.identifier(key)}`;
         
     | 
| 
       33805 
     | 
    
         
            -
                        }
         
     | 
| 
       33806 
33737 
     | 
    
         
             
                        default: {
         
     | 
| 
       33807 
33738 
     | 
    
         
             
                          return sql`${name2} as ${sql.identifier(key)}`;
         
     | 
| 
       33808 
33739 
     | 
    
         
             
                        }
         
     | 
| 
         @@ -37412,13 +37343,9 @@ var init_custom3 = __esm({ 
     | 
|
| 
       37412 
37343 
     | 
    
         
             
                    __publicField(this, "sqlName");
         
     | 
| 
       37413 
37344 
     | 
    
         
             
                    __publicField(this, "mapTo");
         
     | 
| 
       37414 
37345 
     | 
    
         
             
                    __publicField(this, "mapFrom");
         
     | 
| 
       37415 
     | 
    
         
            -
                    __publicField(this, "mapJson");
         
     | 
| 
       37416 
     | 
    
         
            -
                    __publicField(this, "wrapName");
         
     | 
| 
       37417 
37346 
     | 
    
         
             
                    this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
         
     | 
| 
       37418 
37347 
     | 
    
         
             
                    this.mapTo = config.customTypeParams.toDriver;
         
     | 
| 
       37419 
37348 
     | 
    
         
             
                    this.mapFrom = config.customTypeParams.fromDriver;
         
     | 
| 
       37420 
     | 
    
         
            -
                    this.mapJson = config.customTypeParams.fromJson;
         
     | 
| 
       37421 
     | 
    
         
            -
                    this.wrapName = config.customTypeParams.jsonWrap;
         
     | 
| 
       37422 
37349 
     | 
    
         
             
                  }
         
     | 
| 
       37423 
37350 
     | 
    
         
             
                  getSQLType() {
         
     | 
| 
       37424 
37351 
     | 
    
         
             
                    return this.sqlName;
         
     | 
| 
         @@ -37426,30 +37353,6 @@ var init_custom3 = __esm({ 
     | 
|
| 
       37426 
37353 
     | 
    
         
             
                  mapFromDriverValue(value) {
         
     | 
| 
       37427 
37354 
     | 
    
         
             
                    return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
         
     | 
| 
       37428 
37355 
     | 
    
         
             
                  }
         
     | 
| 
       37429 
     | 
    
         
            -
                  mapFromJsonValue(value) {
         
     | 
| 
       37430 
     | 
    
         
            -
                    return typeof this.mapJson === "function" ? this.mapJson(value) : this.mapFromDriverValue(value);
         
     | 
| 
       37431 
     | 
    
         
            -
                  }
         
     | 
| 
       37432 
     | 
    
         
            -
                  jsonWrapName(name2, sql2) {
         
     | 
| 
       37433 
     | 
    
         
            -
                    if (typeof this.wrapName === "function")
         
     | 
| 
       37434 
     | 
    
         
            -
                      return this.wrapName(name2, sql2);
         
     | 
| 
       37435 
     | 
    
         
            -
                    const rawType = this.getSQLType().toLowerCase();
         
     | 
| 
       37436 
     | 
    
         
            -
                    const parenPos = rawType.indexOf("(");
         
     | 
| 
       37437 
     | 
    
         
            -
                    const type = parenPos + 1 ? rawType.slice(0, parenPos) : rawType;
         
     | 
| 
       37438 
     | 
    
         
            -
                    switch (type) {
         
     | 
| 
       37439 
     | 
    
         
            -
                      case "binary":
         
     | 
| 
       37440 
     | 
    
         
            -
                      case "varbinary":
         
     | 
| 
       37441 
     | 
    
         
            -
                      case "time":
         
     | 
| 
       37442 
     | 
    
         
            -
                      case "datetime":
         
     | 
| 
       37443 
     | 
    
         
            -
                      case "decimal":
         
     | 
| 
       37444 
     | 
    
         
            -
                      case "float":
         
     | 
| 
       37445 
     | 
    
         
            -
                      case "bigint": {
         
     | 
| 
       37446 
     | 
    
         
            -
                        return sql2`cast(${name2} as char)`;
         
     | 
| 
       37447 
     | 
    
         
            -
                      }
         
     | 
| 
       37448 
     | 
    
         
            -
                      default: {
         
     | 
| 
       37449 
     | 
    
         
            -
                        return name2;
         
     | 
| 
       37450 
     | 
    
         
            -
                      }
         
     | 
| 
       37451 
     | 
    
         
            -
                    }
         
     | 
| 
       37452 
     | 
    
         
            -
                  }
         
     | 
| 
       37453 
37356 
     | 
    
         
             
                  mapToDriverValue(value) {
         
     | 
| 
       37454 
37357 
     | 
    
         
             
                    return typeof this.mapTo === "function" ? this.mapTo(value) : value;
         
     | 
| 
       37455 
37358 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -39808,9 +39711,6 @@ var init_dialect3 = __esm({ 
     | 
|
| 
       39808 
39711 
     | 
    
         
             
                        case "MySqlBigInt64": {
         
     | 
| 
       39809 
39712 
     | 
    
         
             
                          return sql`cast(${name2} as char) as ${sql.identifier(key)}`;
         
     | 
| 
       39810 
39713 
     | 
    
         
             
                        }
         
     | 
| 
       39811 
     | 
    
         
            -
                        case "MySqlCustomColumn": {
         
     | 
| 
       39812 
     | 
    
         
            -
                          return sql`${column6.jsonWrapName(name2, sql)} as ${sql.identifier(key)}`;
         
     | 
| 
       39813 
     | 
    
         
            -
                        }
         
     | 
| 
       39814 
39714 
     | 
    
         
             
                        default: {
         
     | 
| 
       39815 
39715 
     | 
    
         
             
                          return sql`${name2} as ${sql.identifier(key)}`;
         
     | 
| 
       39816 
39716 
     | 
    
         
             
                        }
         
     | 
| 
         @@ -43413,13 +43313,9 @@ var init_custom4 = __esm({ 
     | 
|
| 
       43413 
43313 
     | 
    
         
             
                    __publicField(this, "sqlName");
         
     | 
| 
       43414 
43314 
     | 
    
         
             
                    __publicField(this, "mapTo");
         
     | 
| 
       43415 
43315 
     | 
    
         
             
                    __publicField(this, "mapFrom");
         
     | 
| 
       43416 
     | 
    
         
            -
                    __publicField(this, "mapJson");
         
     | 
| 
       43417 
     | 
    
         
            -
                    __publicField(this, "wrapName");
         
     | 
| 
       43418 
43316 
     | 
    
         
             
                    this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
         
     | 
| 
       43419 
43317 
     | 
    
         
             
                    this.mapTo = config.customTypeParams.toDriver;
         
     | 
| 
       43420 
43318 
     | 
    
         
             
                    this.mapFrom = config.customTypeParams.fromDriver;
         
     | 
| 
       43421 
     | 
    
         
            -
                    this.mapJson = config.customTypeParams.fromJson;
         
     | 
| 
       43422 
     | 
    
         
            -
                    this.wrapName = config.customTypeParams.jsonWrap;
         
     | 
| 
       43423 
43319 
     | 
    
         
             
                  }
         
     | 
| 
       43424 
43320 
     | 
    
         
             
                  getSQLType() {
         
     | 
| 
       43425 
43321 
     | 
    
         
             
                    return this.sqlName;
         
     | 
| 
         @@ -43427,30 +43323,6 @@ var init_custom4 = __esm({ 
     | 
|
| 
       43427 
43323 
     | 
    
         
             
                  mapFromDriverValue(value) {
         
     | 
| 
       43428 
43324 
     | 
    
         
             
                    return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
         
     | 
| 
       43429 
43325 
     | 
    
         
             
                  }
         
     | 
| 
       43430 
     | 
    
         
            -
                  mapFromJsonValue(value) {
         
     | 
| 
       43431 
     | 
    
         
            -
                    return typeof this.mapJson === "function" ? this.mapJson(value) : this.mapFromDriverValue(value);
         
     | 
| 
       43432 
     | 
    
         
            -
                  }
         
     | 
| 
       43433 
     | 
    
         
            -
                  jsonWrapName(name2, sql2) {
         
     | 
| 
       43434 
     | 
    
         
            -
                    if (typeof this.wrapName === "function")
         
     | 
| 
       43435 
     | 
    
         
            -
                      return this.wrapName(name2, sql2);
         
     | 
| 
       43436 
     | 
    
         
            -
                    const rawType = this.getSQLType().toLowerCase();
         
     | 
| 
       43437 
     | 
    
         
            -
                    const parenPos = rawType.indexOf("(");
         
     | 
| 
       43438 
     | 
    
         
            -
                    const type = parenPos + 1 ? rawType.slice(0, parenPos) : rawType;
         
     | 
| 
       43439 
     | 
    
         
            -
                    switch (type) {
         
     | 
| 
       43440 
     | 
    
         
            -
                      case "binary":
         
     | 
| 
       43441 
     | 
    
         
            -
                      case "varbinary":
         
     | 
| 
       43442 
     | 
    
         
            -
                      case "time":
         
     | 
| 
       43443 
     | 
    
         
            -
                      case "datetime":
         
     | 
| 
       43444 
     | 
    
         
            -
                      case "decimal":
         
     | 
| 
       43445 
     | 
    
         
            -
                      case "float":
         
     | 
| 
       43446 
     | 
    
         
            -
                      case "bigint": {
         
     | 
| 
       43447 
     | 
    
         
            -
                        return sql2`cast(${name2} as char)`;
         
     | 
| 
       43448 
     | 
    
         
            -
                      }
         
     | 
| 
       43449 
     | 
    
         
            -
                      default: {
         
     | 
| 
       43450 
     | 
    
         
            -
                        return name2;
         
     | 
| 
       43451 
     | 
    
         
            -
                      }
         
     | 
| 
       43452 
     | 
    
         
            -
                    }
         
     | 
| 
       43453 
     | 
    
         
            -
                  }
         
     | 
| 
       43454 
43326 
     | 
    
         
             
                  mapToDriverValue(value) {
         
     | 
| 
       43455 
43327 
     | 
    
         
             
                    return typeof this.mapTo === "function" ? this.mapTo(value) : value;
         
     | 
| 
       43456 
43328 
     | 
    
         
             
                  }
         
     | 
    
        package/api.mjs
    CHANGED
    
    | 
         @@ -22287,14 +22287,6 @@ var init_common2 = __esm({ 
     | 
|
| 
       22287 
22287 
     | 
    
         
             
                    }
         
     | 
| 
       22288 
22288 
     | 
    
         
             
                    return value.map((v) => this.baseColumn.mapFromDriverValue(v));
         
     | 
| 
       22289 
22289 
     | 
    
         
             
                  }
         
     | 
| 
       22290 
     | 
    
         
            -
                  // Needed for arrays of custom types
         
     | 
| 
       22291 
     | 
    
         
            -
                  mapFromJsonValue(value) {
         
     | 
| 
       22292 
     | 
    
         
            -
                    if (typeof value === "string") {
         
     | 
| 
       22293 
     | 
    
         
            -
                      value = parsePgArray(value);
         
     | 
| 
       22294 
     | 
    
         
            -
                    }
         
     | 
| 
       22295 
     | 
    
         
            -
                    const base = this.baseColumn;
         
     | 
| 
       22296 
     | 
    
         
            -
                    return "mapFromJsonValue" in base ? value.map((v) => base.mapFromJsonValue(v)) : value.map((v) => base.mapFromDriverValue(v));
         
     | 
| 
       22297 
     | 
    
         
            -
                  }
         
     | 
| 
       22298 
22290 
     | 
    
         
             
                  mapToDriverValue(value, isNestedArray = false) {
         
     | 
| 
       22299 
22291 
     | 
    
         
             
                    const a = value.map(
         
     | 
| 
       22300 
22292 
     | 
    
         
             
                      (v) => v === null ? null : is(this.baseColumn, _PgArray) ? this.baseColumn.mapToDriverValue(v, true) : this.baseColumn.mapToDriverValue(v)
         
     | 
| 
         @@ -23416,7 +23408,7 @@ function mapRelationalRow(row, buildQueryResultSelection, mapColumnValue = (valu 
     | 
|
| 
       23416 
23408 
     | 
    
         
             
                } else {
         
     | 
| 
       23417 
23409 
     | 
    
         
             
                  decoder = field.getSQL().decoder;
         
     | 
| 
       23418 
23410 
     | 
    
         
             
                }
         
     | 
| 
       23419 
     | 
    
         
            -
                row[selectionItem.key] =  
     | 
| 
      
 23411 
     | 
    
         
            +
                row[selectionItem.key] = decoder.mapFromDriverValue(value);
         
     | 
| 
       23420 
23412 
     | 
    
         
             
              }
         
     | 
| 
       23421 
23413 
     | 
    
         
             
              return row;
         
     | 
| 
       23422 
23414 
     | 
    
         
             
            }
         
     | 
| 
         @@ -24871,13 +24863,9 @@ var init_custom = __esm({ 
     | 
|
| 
       24871 
24863 
     | 
    
         
             
                    __publicField(this, "sqlName");
         
     | 
| 
       24872 
24864 
     | 
    
         
             
                    __publicField(this, "mapTo");
         
     | 
| 
       24873 
24865 
     | 
    
         
             
                    __publicField(this, "mapFrom");
         
     | 
| 
       24874 
     | 
    
         
            -
                    __publicField(this, "mapJson");
         
     | 
| 
       24875 
     | 
    
         
            -
                    __publicField(this, "wrapName");
         
     | 
| 
       24876 
24866 
     | 
    
         
             
                    this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
         
     | 
| 
       24877 
24867 
     | 
    
         
             
                    this.mapTo = config.customTypeParams.toDriver;
         
     | 
| 
       24878 
24868 
     | 
    
         
             
                    this.mapFrom = config.customTypeParams.fromDriver;
         
     | 
| 
       24879 
     | 
    
         
            -
                    this.mapJson = config.customTypeParams.fromJson;
         
     | 
| 
       24880 
     | 
    
         
            -
                    this.wrapName = config.customTypeParams.jsonWrap;
         
     | 
| 
       24881 
24869 
     | 
    
         
             
                  }
         
     | 
| 
       24882 
24870 
     | 
    
         
             
                  getSQLType() {
         
     | 
| 
       24883 
24871 
     | 
    
         
             
                    return this.sqlName;
         
     | 
| 
         @@ -24885,29 +24873,6 @@ var init_custom = __esm({ 
     | 
|
| 
       24885 
24873 
     | 
    
         
             
                  mapFromDriverValue(value) {
         
     | 
| 
       24886 
24874 
     | 
    
         
             
                    return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
         
     | 
| 
       24887 
24875 
     | 
    
         
             
                  }
         
     | 
| 
       24888 
     | 
    
         
            -
                  mapFromJsonValue(value) {
         
     | 
| 
       24889 
     | 
    
         
            -
                    return typeof this.mapJson === "function" ? this.mapJson(value) : this.mapFromDriverValue(value);
         
     | 
| 
       24890 
     | 
    
         
            -
                  }
         
     | 
| 
       24891 
     | 
    
         
            -
                  jsonWrapName(name2, sql2, arrayDimensions) {
         
     | 
| 
       24892 
     | 
    
         
            -
                    if (typeof this.wrapName === "function")
         
     | 
| 
       24893 
     | 
    
         
            -
                      return this.wrapName(name2, sql2, arrayDimensions);
         
     | 
| 
       24894 
     | 
    
         
            -
                    const rawType = this.getSQLType().toLowerCase();
         
     | 
| 
       24895 
     | 
    
         
            -
                    const parenPos = rawType.indexOf("(");
         
     | 
| 
       24896 
     | 
    
         
            -
                    const type = parenPos + 1 ? rawType.slice(0, parenPos) : rawType;
         
     | 
| 
       24897 
     | 
    
         
            -
                    switch (type) {
         
     | 
| 
       24898 
     | 
    
         
            -
                      case "bytea":
         
     | 
| 
       24899 
     | 
    
         
            -
                      case "geometry":
         
     | 
| 
       24900 
     | 
    
         
            -
                      case "timestamp":
         
     | 
| 
       24901 
     | 
    
         
            -
                      case "numeric":
         
     | 
| 
       24902 
     | 
    
         
            -
                      case "bigint": {
         
     | 
| 
       24903 
     | 
    
         
            -
                        const arrVal = "[]".repeat(arrayDimensions ?? 0);
         
     | 
| 
       24904 
     | 
    
         
            -
                        return sql2`${name2}::text${sql2.raw(arrVal).if(arrayDimensions)}`;
         
     | 
| 
       24905 
     | 
    
         
            -
                      }
         
     | 
| 
       24906 
     | 
    
         
            -
                      default: {
         
     | 
| 
       24907 
     | 
    
         
            -
                        return name2;
         
     | 
| 
       24908 
     | 
    
         
            -
                      }
         
     | 
| 
       24909 
     | 
    
         
            -
                    }
         
     | 
| 
       24910 
     | 
    
         
            -
                  }
         
     | 
| 
       24911 
24876 
     | 
    
         
             
                  mapToDriverValue(value) {
         
     | 
| 
       24912 
24877 
     | 
    
         
             
                    return typeof this.mapTo === "function" ? this.mapTo(value) : value;
         
     | 
| 
       24913 
24878 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -27590,11 +27555,11 @@ var init_dialect = __esm({ 
     | 
|
| 
       27590 
27555 
     | 
    
         
             
                      const name2 = sql`${table6}.${sql.identifier(this.casing.getColumnCasing(column6))}`;
         
     | 
| 
       27591 
27556 
     | 
    
         
             
                      let targetType = column6.columnType;
         
     | 
| 
       27592 
27557 
     | 
    
         
             
                      let col = column6;
         
     | 
| 
       27593 
     | 
    
         
            -
                      let  
     | 
| 
      
 27558 
     | 
    
         
            +
                      let arrVal = "";
         
     | 
| 
       27594 
27559 
     | 
    
         
             
                      while (is(col, PgArray)) {
         
     | 
| 
       27595 
     | 
    
         
            -
                        col =  
     | 
| 
      
 27560 
     | 
    
         
            +
                        col = column6.baseColumn;
         
     | 
| 
       27596 
27561 
     | 
    
         
             
                        targetType = col.columnType;
         
     | 
| 
       27597 
     | 
    
         
            -
                         
     | 
| 
      
 27562 
     | 
    
         
            +
                        arrVal = arrVal + "[]";
         
     | 
| 
       27598 
27563 
     | 
    
         
             
                      }
         
     | 
| 
       27599 
27564 
     | 
    
         
             
                      switch (targetType) {
         
     | 
| 
       27600 
27565 
     | 
    
         
             
                        case "PgNumeric":
         
     | 
| 
         @@ -27606,12 +27571,8 @@ var init_dialect = __esm({ 
     | 
|
| 
       27606 
27571 
     | 
    
         
             
                        case "PgGeometry":
         
     | 
| 
       27607 
27572 
     | 
    
         
             
                        case "PgGeometryObject":
         
     | 
| 
       27608 
27573 
     | 
    
         
             
                        case "PgBytea": {
         
     | 
| 
       27609 
     | 
    
         
            -
                          const arrVal = "[]".repeat(dimensionCnt);
         
     | 
| 
       27610 
27574 
     | 
    
         
             
                          return sql`${name2}::text${sql.raw(arrVal).if(arrVal)} as ${sql.identifier(key)}`;
         
     | 
| 
       27611 
27575 
     | 
    
         
             
                        }
         
     | 
| 
       27612 
     | 
    
         
            -
                        case "PgCustomColumn": {
         
     | 
| 
       27613 
     | 
    
         
            -
                          return sql`${col.jsonWrapName(name2, sql, dimensionCnt > 0 ? dimensionCnt : void 0)} as ${sql.identifier(key)}`;
         
     | 
| 
       27614 
     | 
    
         
            -
                        }
         
     | 
| 
       27615 
27576 
     | 
    
         
             
                        default: {
         
     | 
| 
       27616 
27577 
     | 
    
         
             
                          return sql`${name2} as ${sql.identifier(key)}`;
         
     | 
| 
       27617 
27578 
     | 
    
         
             
                        }
         
     | 
| 
         @@ -32575,13 +32536,9 @@ var init_custom2 = __esm({ 
     | 
|
| 
       32575 
32536 
     | 
    
         
             
                    __publicField(this, "sqlName");
         
     | 
| 
       32576 
32537 
     | 
    
         
             
                    __publicField(this, "mapTo");
         
     | 
| 
       32577 
32538 
     | 
    
         
             
                    __publicField(this, "mapFrom");
         
     | 
| 
       32578 
     | 
    
         
            -
                    __publicField(this, "mapJson");
         
     | 
| 
       32579 
     | 
    
         
            -
                    __publicField(this, "wrapName");
         
     | 
| 
       32580 
32539 
     | 
    
         
             
                    this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
         
     | 
| 
       32581 
32540 
     | 
    
         
             
                    this.mapTo = config.customTypeParams.toDriver;
         
     | 
| 
       32582 
32541 
     | 
    
         
             
                    this.mapFrom = config.customTypeParams.fromDriver;
         
     | 
| 
       32583 
     | 
    
         
            -
                    this.mapJson = config.customTypeParams.fromJson;
         
     | 
| 
       32584 
     | 
    
         
            -
                    this.wrapName = config.customTypeParams.jsonWrap;
         
     | 
| 
       32585 
32542 
     | 
    
         
             
                  }
         
     | 
| 
       32586 
32543 
     | 
    
         
             
                  getSQLType() {
         
     | 
| 
       32587 
32544 
     | 
    
         
             
                    return this.sqlName;
         
     | 
| 
         @@ -32589,29 +32546,6 @@ var init_custom2 = __esm({ 
     | 
|
| 
       32589 
32546 
     | 
    
         
             
                  mapFromDriverValue(value) {
         
     | 
| 
       32590 
32547 
     | 
    
         
             
                    return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
         
     | 
| 
       32591 
32548 
     | 
    
         
             
                  }
         
     | 
| 
       32592 
     | 
    
         
            -
                  mapFromJsonValue(value) {
         
     | 
| 
       32593 
     | 
    
         
            -
                    return typeof this.mapJson === "function" ? this.mapJson(value) : this.mapFromDriverValue(value);
         
     | 
| 
       32594 
     | 
    
         
            -
                  }
         
     | 
| 
       32595 
     | 
    
         
            -
                  jsonWrapName(name2, sql2) {
         
     | 
| 
       32596 
     | 
    
         
            -
                    if (typeof this.wrapName === "function")
         
     | 
| 
       32597 
     | 
    
         
            -
                      return this.wrapName(name2, sql2);
         
     | 
| 
       32598 
     | 
    
         
            -
                    const rawType = this.getSQLType().toLowerCase();
         
     | 
| 
       32599 
     | 
    
         
            -
                    const parenPos = rawType.indexOf("(");
         
     | 
| 
       32600 
     | 
    
         
            -
                    const type = parenPos + 1 ? rawType.slice(0, parenPos) : rawType;
         
     | 
| 
       32601 
     | 
    
         
            -
                    switch (type) {
         
     | 
| 
       32602 
     | 
    
         
            -
                      case "numeric":
         
     | 
| 
       32603 
     | 
    
         
            -
                      case "decimal":
         
     | 
| 
       32604 
     | 
    
         
            -
                      case "bigint": {
         
     | 
| 
       32605 
     | 
    
         
            -
                        return sql2`cast(${name2} as text)`;
         
     | 
| 
       32606 
     | 
    
         
            -
                      }
         
     | 
| 
       32607 
     | 
    
         
            -
                      case "blob": {
         
     | 
| 
       32608 
     | 
    
         
            -
                        return sql2`hex(${name2})`;
         
     | 
| 
       32609 
     | 
    
         
            -
                      }
         
     | 
| 
       32610 
     | 
    
         
            -
                      default: {
         
     | 
| 
       32611 
     | 
    
         
            -
                        return name2;
         
     | 
| 
       32612 
     | 
    
         
            -
                      }
         
     | 
| 
       32613 
     | 
    
         
            -
                    }
         
     | 
| 
       32614 
     | 
    
         
            -
                  }
         
     | 
| 
       32615 
32549 
     | 
    
         
             
                  mapToDriverValue(value) {
         
     | 
| 
       32616 
32550 
     | 
    
         
             
                    return typeof this.mapTo === "function" ? this.mapTo(value) : value;
         
     | 
| 
       32617 
32551 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -33805,9 +33739,6 @@ var init_dialect2 = __esm({ 
     | 
|
| 
       33805 
33739 
     | 
    
         
             
                        case "SQLiteNumericBigInt": {
         
     | 
| 
       33806 
33740 
     | 
    
         
             
                          return sql`cast(${name2} as text) as ${sql.identifier(key)}`;
         
     | 
| 
       33807 
33741 
     | 
    
         
             
                        }
         
     | 
| 
       33808 
     | 
    
         
            -
                        case "SQLiteCustomColumn": {
         
     | 
| 
       33809 
     | 
    
         
            -
                          return sql`${column6.jsonWrapName(name2, sql)} as ${sql.identifier(key)}`;
         
     | 
| 
       33810 
     | 
    
         
            -
                        }
         
     | 
| 
       33811 
33742 
     | 
    
         
             
                        default: {
         
     | 
| 
       33812 
33743 
     | 
    
         
             
                          return sql`${name2} as ${sql.identifier(key)}`;
         
     | 
| 
       33813 
33744 
     | 
    
         
             
                        }
         
     | 
| 
         @@ -37417,13 +37348,9 @@ var init_custom3 = __esm({ 
     | 
|
| 
       37417 
37348 
     | 
    
         
             
                    __publicField(this, "sqlName");
         
     | 
| 
       37418 
37349 
     | 
    
         
             
                    __publicField(this, "mapTo");
         
     | 
| 
       37419 
37350 
     | 
    
         
             
                    __publicField(this, "mapFrom");
         
     | 
| 
       37420 
     | 
    
         
            -
                    __publicField(this, "mapJson");
         
     | 
| 
       37421 
     | 
    
         
            -
                    __publicField(this, "wrapName");
         
     | 
| 
       37422 
37351 
     | 
    
         
             
                    this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
         
     | 
| 
       37423 
37352 
     | 
    
         
             
                    this.mapTo = config.customTypeParams.toDriver;
         
     | 
| 
       37424 
37353 
     | 
    
         
             
                    this.mapFrom = config.customTypeParams.fromDriver;
         
     | 
| 
       37425 
     | 
    
         
            -
                    this.mapJson = config.customTypeParams.fromJson;
         
     | 
| 
       37426 
     | 
    
         
            -
                    this.wrapName = config.customTypeParams.jsonWrap;
         
     | 
| 
       37427 
37354 
     | 
    
         
             
                  }
         
     | 
| 
       37428 
37355 
     | 
    
         
             
                  getSQLType() {
         
     | 
| 
       37429 
37356 
     | 
    
         
             
                    return this.sqlName;
         
     | 
| 
         @@ -37431,30 +37358,6 @@ var init_custom3 = __esm({ 
     | 
|
| 
       37431 
37358 
     | 
    
         
             
                  mapFromDriverValue(value) {
         
     | 
| 
       37432 
37359 
     | 
    
         
             
                    return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
         
     | 
| 
       37433 
37360 
     | 
    
         
             
                  }
         
     | 
| 
       37434 
     | 
    
         
            -
                  mapFromJsonValue(value) {
         
     | 
| 
       37435 
     | 
    
         
            -
                    return typeof this.mapJson === "function" ? this.mapJson(value) : this.mapFromDriverValue(value);
         
     | 
| 
       37436 
     | 
    
         
            -
                  }
         
     | 
| 
       37437 
     | 
    
         
            -
                  jsonWrapName(name2, sql2) {
         
     | 
| 
       37438 
     | 
    
         
            -
                    if (typeof this.wrapName === "function")
         
     | 
| 
       37439 
     | 
    
         
            -
                      return this.wrapName(name2, sql2);
         
     | 
| 
       37440 
     | 
    
         
            -
                    const rawType = this.getSQLType().toLowerCase();
         
     | 
| 
       37441 
     | 
    
         
            -
                    const parenPos = rawType.indexOf("(");
         
     | 
| 
       37442 
     | 
    
         
            -
                    const type = parenPos + 1 ? rawType.slice(0, parenPos) : rawType;
         
     | 
| 
       37443 
     | 
    
         
            -
                    switch (type) {
         
     | 
| 
       37444 
     | 
    
         
            -
                      case "binary":
         
     | 
| 
       37445 
     | 
    
         
            -
                      case "varbinary":
         
     | 
| 
       37446 
     | 
    
         
            -
                      case "time":
         
     | 
| 
       37447 
     | 
    
         
            -
                      case "datetime":
         
     | 
| 
       37448 
     | 
    
         
            -
                      case "decimal":
         
     | 
| 
       37449 
     | 
    
         
            -
                      case "float":
         
     | 
| 
       37450 
     | 
    
         
            -
                      case "bigint": {
         
     | 
| 
       37451 
     | 
    
         
            -
                        return sql2`cast(${name2} as char)`;
         
     | 
| 
       37452 
     | 
    
         
            -
                      }
         
     | 
| 
       37453 
     | 
    
         
            -
                      default: {
         
     | 
| 
       37454 
     | 
    
         
            -
                        return name2;
         
     | 
| 
       37455 
     | 
    
         
            -
                      }
         
     | 
| 
       37456 
     | 
    
         
            -
                    }
         
     | 
| 
       37457 
     | 
    
         
            -
                  }
         
     | 
| 
       37458 
37361 
     | 
    
         
             
                  mapToDriverValue(value) {
         
     | 
| 
       37459 
37362 
     | 
    
         
             
                    return typeof this.mapTo === "function" ? this.mapTo(value) : value;
         
     | 
| 
       37460 
37363 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -39813,9 +39716,6 @@ var init_dialect3 = __esm({ 
     | 
|
| 
       39813 
39716 
     | 
    
         
             
                        case "MySqlBigInt64": {
         
     | 
| 
       39814 
39717 
     | 
    
         
             
                          return sql`cast(${name2} as char) as ${sql.identifier(key)}`;
         
     | 
| 
       39815 
39718 
     | 
    
         
             
                        }
         
     | 
| 
       39816 
     | 
    
         
            -
                        case "MySqlCustomColumn": {
         
     | 
| 
       39817 
     | 
    
         
            -
                          return sql`${column6.jsonWrapName(name2, sql)} as ${sql.identifier(key)}`;
         
     | 
| 
       39818 
     | 
    
         
            -
                        }
         
     | 
| 
       39819 
39719 
     | 
    
         
             
                        default: {
         
     | 
| 
       39820 
39720 
     | 
    
         
             
                          return sql`${name2} as ${sql.identifier(key)}`;
         
     | 
| 
       39821 
39721 
     | 
    
         
             
                        }
         
     | 
| 
         @@ -43418,13 +43318,9 @@ var init_custom4 = __esm({ 
     | 
|
| 
       43418 
43318 
     | 
    
         
             
                    __publicField(this, "sqlName");
         
     | 
| 
       43419 
43319 
     | 
    
         
             
                    __publicField(this, "mapTo");
         
     | 
| 
       43420 
43320 
     | 
    
         
             
                    __publicField(this, "mapFrom");
         
     | 
| 
       43421 
     | 
    
         
            -
                    __publicField(this, "mapJson");
         
     | 
| 
       43422 
     | 
    
         
            -
                    __publicField(this, "wrapName");
         
     | 
| 
       43423 
43321 
     | 
    
         
             
                    this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
         
     | 
| 
       43424 
43322 
     | 
    
         
             
                    this.mapTo = config.customTypeParams.toDriver;
         
     | 
| 
       43425 
43323 
     | 
    
         
             
                    this.mapFrom = config.customTypeParams.fromDriver;
         
     | 
| 
       43426 
     | 
    
         
            -
                    this.mapJson = config.customTypeParams.fromJson;
         
     | 
| 
       43427 
     | 
    
         
            -
                    this.wrapName = config.customTypeParams.jsonWrap;
         
     | 
| 
       43428 
43324 
     | 
    
         
             
                  }
         
     | 
| 
       43429 
43325 
     | 
    
         
             
                  getSQLType() {
         
     | 
| 
       43430 
43326 
     | 
    
         
             
                    return this.sqlName;
         
     | 
| 
         @@ -43432,30 +43328,6 @@ var init_custom4 = __esm({ 
     | 
|
| 
       43432 
43328 
     | 
    
         
             
                  mapFromDriverValue(value) {
         
     | 
| 
       43433 
43329 
     | 
    
         
             
                    return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
         
     | 
| 
       43434 
43330 
     | 
    
         
             
                  }
         
     | 
| 
       43435 
     | 
    
         
            -
                  mapFromJsonValue(value) {
         
     | 
| 
       43436 
     | 
    
         
            -
                    return typeof this.mapJson === "function" ? this.mapJson(value) : this.mapFromDriverValue(value);
         
     | 
| 
       43437 
     | 
    
         
            -
                  }
         
     | 
| 
       43438 
     | 
    
         
            -
                  jsonWrapName(name2, sql2) {
         
     | 
| 
       43439 
     | 
    
         
            -
                    if (typeof this.wrapName === "function")
         
     | 
| 
       43440 
     | 
    
         
            -
                      return this.wrapName(name2, sql2);
         
     | 
| 
       43441 
     | 
    
         
            -
                    const rawType = this.getSQLType().toLowerCase();
         
     | 
| 
       43442 
     | 
    
         
            -
                    const parenPos = rawType.indexOf("(");
         
     | 
| 
       43443 
     | 
    
         
            -
                    const type = parenPos + 1 ? rawType.slice(0, parenPos) : rawType;
         
     | 
| 
       43444 
     | 
    
         
            -
                    switch (type) {
         
     | 
| 
       43445 
     | 
    
         
            -
                      case "binary":
         
     | 
| 
       43446 
     | 
    
         
            -
                      case "varbinary":
         
     | 
| 
       43447 
     | 
    
         
            -
                      case "time":
         
     | 
| 
       43448 
     | 
    
         
            -
                      case "datetime":
         
     | 
| 
       43449 
     | 
    
         
            -
                      case "decimal":
         
     | 
| 
       43450 
     | 
    
         
            -
                      case "float":
         
     | 
| 
       43451 
     | 
    
         
            -
                      case "bigint": {
         
     | 
| 
       43452 
     | 
    
         
            -
                        return sql2`cast(${name2} as char)`;
         
     | 
| 
       43453 
     | 
    
         
            -
                      }
         
     | 
| 
       43454 
     | 
    
         
            -
                      default: {
         
     | 
| 
       43455 
     | 
    
         
            -
                        return name2;
         
     | 
| 
       43456 
     | 
    
         
            -
                      }
         
     | 
| 
       43457 
     | 
    
         
            -
                    }
         
     | 
| 
       43458 
     | 
    
         
            -
                  }
         
     | 
| 
       43459 
43331 
     | 
    
         
             
                  mapToDriverValue(value) {
         
     | 
| 
       43460 
43332 
     | 
    
         
             
                    return typeof this.mapTo === "function" ? this.mapTo(value) : value;
         
     | 
| 
       43461 
43333 
     | 
    
         
             
                  }
         
     | 
    
        package/bin.cjs
    CHANGED
    
    | 
         @@ -85706,6 +85706,70 @@ __export(introspect_exports, { 
     | 
|
| 
       85706 
85706 
     | 
    
         
             
              introspectSqlite: () => introspectSqlite,
         
     | 
| 
       85707 
85707 
     | 
    
         
             
              relationsToTypeScript: () => relationsToTypeScript
         
     | 
| 
       85708 
85708 
     | 
    
         
             
            });
         
     | 
| 
      
 85709 
     | 
    
         
            +
            function postgresToRelationsPull(schema6) {
         
     | 
| 
      
 85710 
     | 
    
         
            +
              return Object.values(schema6.tables).map((table6) => ({
         
     | 
| 
      
 85711 
     | 
    
         
            +
                schema: table6.schema,
         
     | 
| 
      
 85712 
     | 
    
         
            +
                foreignKeys: Object.values(table6.foreignKeys),
         
     | 
| 
      
 85713 
     | 
    
         
            +
                uniques: [
         
     | 
| 
      
 85714 
     | 
    
         
            +
                  ...Object.values(table6.uniqueConstraints).map((unq) => ({
         
     | 
| 
      
 85715 
     | 
    
         
            +
                    columns: unq.columns
         
     | 
| 
      
 85716 
     | 
    
         
            +
                  })),
         
     | 
| 
      
 85717 
     | 
    
         
            +
                  ...Object.values(table6.indexes).map((idx) => ({
         
     | 
| 
      
 85718 
     | 
    
         
            +
                    columns: idx.columns.map((idxc) => {
         
     | 
| 
      
 85719 
     | 
    
         
            +
                      if (!idxc.isExpression && idx.isUnique) {
         
     | 
| 
      
 85720 
     | 
    
         
            +
                        return idxc.expression;
         
     | 
| 
      
 85721 
     | 
    
         
            +
                      }
         
     | 
| 
      
 85722 
     | 
    
         
            +
                    }).filter((item) => item !== void 0)
         
     | 
| 
      
 85723 
     | 
    
         
            +
                  }))
         
     | 
| 
      
 85724 
     | 
    
         
            +
                ]
         
     | 
| 
      
 85725 
     | 
    
         
            +
              }));
         
     | 
| 
      
 85726 
     | 
    
         
            +
            }
         
     | 
| 
      
 85727 
     | 
    
         
            +
            function gelToRelationsPull(schema6) {
         
     | 
| 
      
 85728 
     | 
    
         
            +
              return Object.values(schema6.tables).map((table6) => ({
         
     | 
| 
      
 85729 
     | 
    
         
            +
                schema: table6.schema,
         
     | 
| 
      
 85730 
     | 
    
         
            +
                foreignKeys: Object.values(table6.foreignKeys),
         
     | 
| 
      
 85731 
     | 
    
         
            +
                uniques: [
         
     | 
| 
      
 85732 
     | 
    
         
            +
                  ...Object.values(table6.uniqueConstraints).map((unq) => ({
         
     | 
| 
      
 85733 
     | 
    
         
            +
                    columns: unq.columns
         
     | 
| 
      
 85734 
     | 
    
         
            +
                  })),
         
     | 
| 
      
 85735 
     | 
    
         
            +
                  ...Object.values(table6.indexes).map((idx) => ({
         
     | 
| 
      
 85736 
     | 
    
         
            +
                    columns: idx.columns.map((idxc) => {
         
     | 
| 
      
 85737 
     | 
    
         
            +
                      if (!idxc.isExpression && idx.isUnique) {
         
     | 
| 
      
 85738 
     | 
    
         
            +
                        return idxc.expression;
         
     | 
| 
      
 85739 
     | 
    
         
            +
                      }
         
     | 
| 
      
 85740 
     | 
    
         
            +
                    }).filter((item) => item !== void 0)
         
     | 
| 
      
 85741 
     | 
    
         
            +
                  }))
         
     | 
| 
      
 85742 
     | 
    
         
            +
                ]
         
     | 
| 
      
 85743 
     | 
    
         
            +
              }));
         
     | 
| 
      
 85744 
     | 
    
         
            +
            }
         
     | 
| 
      
 85745 
     | 
    
         
            +
            function mysqlToRelationsPull(schema6) {
         
     | 
| 
      
 85746 
     | 
    
         
            +
              return Object.values(schema6.tables).map((table6) => ({
         
     | 
| 
      
 85747 
     | 
    
         
            +
                schema: void 0,
         
     | 
| 
      
 85748 
     | 
    
         
            +
                foreignKeys: Object.values(table6.foreignKeys),
         
     | 
| 
      
 85749 
     | 
    
         
            +
                uniques: [
         
     | 
| 
      
 85750 
     | 
    
         
            +
                  ...Object.values(table6.uniqueConstraints).map((unq) => ({
         
     | 
| 
      
 85751 
     | 
    
         
            +
                    columns: unq.columns
         
     | 
| 
      
 85752 
     | 
    
         
            +
                  })),
         
     | 
| 
      
 85753 
     | 
    
         
            +
                  ...Object.values(table6.indexes).map((idx) => ({
         
     | 
| 
      
 85754 
     | 
    
         
            +
                    columns: idx.columns
         
     | 
| 
      
 85755 
     | 
    
         
            +
                  }))
         
     | 
| 
      
 85756 
     | 
    
         
            +
                ]
         
     | 
| 
      
 85757 
     | 
    
         
            +
              }));
         
     | 
| 
      
 85758 
     | 
    
         
            +
            }
         
     | 
| 
      
 85759 
     | 
    
         
            +
            function sqliteToRelationsPull(schema6) {
         
     | 
| 
      
 85760 
     | 
    
         
            +
              return Object.values(schema6.tables).map((table6) => ({
         
     | 
| 
      
 85761 
     | 
    
         
            +
                schema: void 0,
         
     | 
| 
      
 85762 
     | 
    
         
            +
                foreignKeys: Object.values(table6.foreignKeys),
         
     | 
| 
      
 85763 
     | 
    
         
            +
                uniques: [
         
     | 
| 
      
 85764 
     | 
    
         
            +
                  ...Object.values(table6.uniqueConstraints).map((unq) => ({
         
     | 
| 
      
 85765 
     | 
    
         
            +
                    columns: unq.columns
         
     | 
| 
      
 85766 
     | 
    
         
            +
                  })),
         
     | 
| 
      
 85767 
     | 
    
         
            +
                  ...Object.values(table6.indexes).map((idx) => ({
         
     | 
| 
      
 85768 
     | 
    
         
            +
                    columns: idx.columns
         
     | 
| 
      
 85769 
     | 
    
         
            +
                  }))
         
     | 
| 
      
 85770 
     | 
    
         
            +
                ]
         
     | 
| 
      
 85771 
     | 
    
         
            +
              }));
         
     | 
| 
      
 85772 
     | 
    
         
            +
            }
         
     | 
| 
       85709 
85773 
     | 
    
         
             
            var import_fs11, import_hanji14, import_path7, import_pluralize, introspectPostgres, introspectGel, introspectMysql, introspectSingleStore, introspectSqlite, introspectLibSQL, withCasing4, relationsToTypeScript;
         
     | 
| 
       85710 
85774 
     | 
    
         
             
            var init_introspect = __esm({
         
     | 
| 
       85711 
85775 
     | 
    
         
             
              "src/cli/commands/introspect.ts"() {
         
     | 
| 
         @@ -85775,7 +85839,7 @@ var init_introspect = __esm({ 
     | 
|
| 
       85775 
85839 
     | 
    
         
             
                  );
         
     | 
| 
       85776 
85840 
     | 
    
         
             
                  const schema6 = { id: originUUID, prevId: "", ...res };
         
     | 
| 
       85777 
85841 
     | 
    
         
             
                  const ts = schemaToTypeScript4(schema6, casing2);
         
     | 
| 
       85778 
     | 
    
         
            -
                  const relationsTs = relationsToTypeScript(schema6, casing2);
         
     | 
| 
      
 85842 
     | 
    
         
            +
                  const relationsTs = relationsToTypeScript(postgresToRelationsPull(schema6), casing2);
         
     | 
| 
       85779 
85843 
     | 
    
         
             
                  const { internal, ...schemaWithoutInternals } = schema6;
         
     | 
| 
       85780 
85844 
     | 
    
         
             
                  const schemaFile = (0, import_path7.join)(out, "schema.ts");
         
     | 
| 
       85781 
85845 
     | 
    
         
             
                  (0, import_fs11.writeFileSync)(schemaFile, ts.file);
         
     | 
| 
         @@ -85870,7 +85934,7 @@ var init_introspect = __esm({ 
     | 
|
| 
       85870 
85934 
     | 
    
         
             
                  );
         
     | 
| 
       85871 
85935 
     | 
    
         
             
                  const schema6 = { id: originUUID, prevId: "", ...res };
         
     | 
| 
       85872 
85936 
     | 
    
         
             
                  const ts = schemaToTypeScript2(schema6, casing2);
         
     | 
| 
       85873 
     | 
    
         
            -
                  const relationsTs = relationsToTypeScript(schema6, casing2);
         
     | 
| 
      
 85937 
     | 
    
         
            +
                  const relationsTs = relationsToTypeScript(gelToRelationsPull(schema6), casing2);
         
     | 
| 
       85874 
85938 
     | 
    
         
             
                  const { internal, ...schemaWithoutInternals } = schema6;
         
     | 
| 
       85875 
85939 
     | 
    
         
             
                  const schemaFile = (0, import_path7.join)(out, "schema.ts");
         
     | 
| 
       85876 
85940 
     | 
    
         
             
                  (0, import_fs11.writeFileSync)(schemaFile, ts.file);
         
     | 
| 
         @@ -85925,7 +85989,7 @@ var init_introspect = __esm({ 
     | 
|
| 
       85925 
85989 
     | 
    
         
             
                  );
         
     | 
| 
       85926 
85990 
     | 
    
         
             
                  const schema6 = { id: originUUID, prevId: "", ...res };
         
     | 
| 
       85927 
85991 
     | 
    
         
             
                  const ts = schemaToTypeScript3(schema6, casing2);
         
     | 
| 
       85928 
     | 
    
         
            -
                  const relationsTs = relationsToTypeScript(schema6, casing2);
         
     | 
| 
      
 85992 
     | 
    
         
            +
                  const relationsTs = relationsToTypeScript(mysqlToRelationsPull(schema6), casing2);
         
     | 
| 
       85929 
85993 
     | 
    
         
             
                  const { internal, ...schemaWithoutInternals } = schema6;
         
     | 
| 
       85930 
85994 
     | 
    
         
             
                  const schemaFile = (0, import_path7.join)(out, "schema.ts");
         
     | 
| 
       85931 
85995 
     | 
    
         
             
                  (0, import_fs11.writeFileSync)(schemaFile, ts.file);
         
     | 
| 
         @@ -86081,7 +86145,7 @@ var init_introspect = __esm({ 
     | 
|
| 
       86081 
86145 
     | 
    
         
             
                  );
         
     | 
| 
       86082 
86146 
     | 
    
         
             
                  const schema6 = { id: originUUID, prevId: "", ...res };
         
     | 
| 
       86083 
86147 
     | 
    
         
             
                  const ts = schemaToTypeScript(schema6, casing2);
         
     | 
| 
       86084 
     | 
    
         
            -
                  const relationsTs = relationsToTypeScript(schema6, casing2);
         
     | 
| 
      
 86148 
     | 
    
         
            +
                  const relationsTs = relationsToTypeScript(sqliteToRelationsPull(schema6), casing2);
         
     | 
| 
       86085 
86149 
     | 
    
         
             
                  const schemaFile = (0, import_path7.join)(out, "schema.ts");
         
     | 
| 
       86086 
86150 
     | 
    
         
             
                  (0, import_fs11.writeFileSync)(schemaFile, ts.file);
         
     | 
| 
       86087 
86151 
     | 
    
         
             
                  const relationsFile = (0, import_path7.join)(out, "relations.ts");
         
     | 
| 
         @@ -86163,7 +86227,7 @@ var init_introspect = __esm({ 
     | 
|
| 
       86163 
86227 
     | 
    
         
             
                  );
         
     | 
| 
       86164 
86228 
     | 
    
         
             
                  const schema6 = { id: originUUID, prevId: "", ...res };
         
     | 
| 
       86165 
86229 
     | 
    
         
             
                  const ts = schemaToTypeScript(schema6, casing2);
         
     | 
| 
       86166 
     | 
    
         
            -
                  const relationsTs = relationsToTypeScript(schema6, casing2);
         
     | 
| 
      
 86230 
     | 
    
         
            +
                  const relationsTs = relationsToTypeScript(sqliteToRelationsPull(schema6), casing2);
         
     | 
| 
       86167 
86231 
     | 
    
         
             
                  const schemaFile = (0, import_path7.join)(out, "schema.ts");
         
     | 
| 
       86168 
86232 
     | 
    
         
             
                  (0, import_fs11.writeFileSync)(schemaFile, ts.file);
         
     | 
| 
       86169 
86233 
     | 
    
         
             
                  const relationsFile = (0, import_path7.join)(out, "relations.ts");
         
     | 
| 
         @@ -86223,7 +86287,7 @@ var init_introspect = __esm({ 
     | 
|
| 
       86223 
86287 
     | 
    
         
             
                relationsToTypeScript = (schema6, casing2) => {
         
     | 
| 
       86224 
86288 
     | 
    
         
             
                  const imports = [];
         
     | 
| 
       86225 
86289 
     | 
    
         
             
                  const tableRelations = {};
         
     | 
| 
       86226 
     | 
    
         
            -
                   
     | 
| 
      
 86290 
     | 
    
         
            +
                  schema6.forEach((table6) => {
         
     | 
| 
       86227 
86291 
     | 
    
         
             
                    const fks = Object.values(table6.foreignKeys);
         
     | 
| 
       86228 
86292 
     | 
    
         
             
                    if (fks.length === 2) {
         
     | 
| 
       86229 
86293 
     | 
    
         
             
                      const [fk1, fk22] = fks;
         
     | 
| 
         @@ -86255,6 +86319,7 @@ var init_introspect = __esm({ 
     | 
|
| 
       86255 
86319 
     | 
    
         
             
                        }
         
     | 
| 
       86256 
86320 
     | 
    
         
             
                        tableRelations[toTable2].push({
         
     | 
| 
       86257 
86321 
     | 
    
         
             
                          name: (0, import_pluralize.plural)(toTable1),
         
     | 
| 
      
 86322 
     | 
    
         
            +
                          // this type is used for .many() side of relation, when another side has .through() with from and to fields
         
     | 
| 
       86258 
86323 
     | 
    
         
             
                          type: "many-through",
         
     | 
| 
       86259 
86324 
     | 
    
         
             
                          tableFrom: toTable2,
         
     | 
| 
       86260 
86325 
     | 
    
         
             
                          columnsFrom: fk22.columnsTo,
         
     | 
| 
         @@ -86290,14 +86355,27 @@ var init_introspect = __esm({ 
     | 
|
| 
       86290 
86355 
     | 
    
         
             
                        if (!tableRelations[keyTo]) {
         
     | 
| 
       86291 
86356 
     | 
    
         
             
                          tableRelations[keyTo] = [];
         
     | 
| 
       86292 
86357 
     | 
    
         
             
                        }
         
     | 
| 
       86293 
     | 
    
         
            -
                         
     | 
| 
       86294 
     | 
    
         
            -
                           
     | 
| 
       86295 
     | 
    
         
            -
             
     | 
| 
       86296 
     | 
    
         
            -
                           
     | 
| 
       86297 
     | 
    
         
            -
             
     | 
| 
       86298 
     | 
    
         
            -
             
     | 
| 
       86299 
     | 
    
         
            -
             
     | 
| 
       86300 
     | 
    
         
            -
             
     | 
| 
      
 86358 
     | 
    
         
            +
                        if (table6.uniques.find(
         
     | 
| 
      
 86359 
     | 
    
         
            +
                          (constraint) => constraint.columns.length === columnsFrom.length && constraint.columns.every((col, i2) => col === columnsFrom[i2])
         
     | 
| 
      
 86360 
     | 
    
         
            +
                        )) {
         
     | 
| 
      
 86361 
     | 
    
         
            +
                          tableRelations[keyTo].push({
         
     | 
| 
      
 86362 
     | 
    
         
            +
                            name: (0, import_pluralize.plural)(tableFrom),
         
     | 
| 
      
 86363 
     | 
    
         
            +
                            type: "one-one",
         
     | 
| 
      
 86364 
     | 
    
         
            +
                            tableFrom: tableTo,
         
     | 
| 
      
 86365 
     | 
    
         
            +
                            columnsFrom: columnsTo,
         
     | 
| 
      
 86366 
     | 
    
         
            +
                            tableTo: tableFrom,
         
     | 
| 
      
 86367 
     | 
    
         
            +
                            columnsTo: columnsFrom
         
     | 
| 
      
 86368 
     | 
    
         
            +
                          });
         
     | 
| 
      
 86369 
     | 
    
         
            +
                        } else {
         
     | 
| 
      
 86370 
     | 
    
         
            +
                          tableRelations[keyTo].push({
         
     | 
| 
      
 86371 
     | 
    
         
            +
                            name: (0, import_pluralize.plural)(tableFrom),
         
     | 
| 
      
 86372 
     | 
    
         
            +
                            type: "many",
         
     | 
| 
      
 86373 
     | 
    
         
            +
                            tableFrom: tableTo,
         
     | 
| 
      
 86374 
     | 
    
         
            +
                            columnsFrom: columnsTo,
         
     | 
| 
      
 86375 
     | 
    
         
            +
                            tableTo: tableFrom,
         
     | 
| 
      
 86376 
     | 
    
         
            +
                            columnsTo: columnsFrom
         
     | 
| 
      
 86377 
     | 
    
         
            +
                          });
         
     | 
| 
      
 86378 
     | 
    
         
            +
                        }
         
     | 
| 
       86301 
86379 
     | 
    
         
             
                      });
         
     | 
| 
       86302 
86380 
     | 
    
         
             
                    }
         
     | 
| 
       86303 
86381 
     | 
    
         
             
                  });
         
     | 
| 
         @@ -86317,7 +86395,7 @@ import * as schema from "./schema"; 
     | 
|
| 
       86317 
86395 
     | 
    
         
             
                        if (hasMultipleRelations) {
         
     | 
| 
       86318 
86396 
     | 
    
         
             
                          if (relation.type === "one") {
         
     | 
| 
       86319 
86397 
     | 
    
         
             
                            relationName = `${relation.tableFrom}_${relation.columnsFrom.join("_")}_${relation.tableTo}_${relation.columnsTo.join("_")}`;
         
     | 
| 
       86320 
     | 
    
         
            -
                          } else if (relation.type === "many") {
         
     | 
| 
      
 86398 
     | 
    
         
            +
                          } else if (relation.type === "many" || relation.type === "one-one") {
         
     | 
| 
       86321 
86399 
     | 
    
         
             
                            relationName = `${relation.tableTo}_${relation.columnsTo.join("_")}_${relation.tableFrom}_${relation.columnsFrom.join("_")}`;
         
     | 
| 
       86322 
86400 
     | 
    
         
             
                          } else if (relation.type === "through") {
         
     | 
| 
       86323 
86401 
     | 
    
         
             
                            relationName = `${relation.tableFrom}_${relation.columnsFrom.join("_")}_${relation.tableTo}_${relation.columnsTo.join("_")}_via_${relation.tableThrough}`;
         
     | 
| 
         @@ -86355,6 +86433,11 @@ import * as schema from "./schema"; 
     | 
|
| 
       86355 
86433 
     | 
    
         
             
            		${relation.name}: r.many.${relation.tableTo}(` + (relation.relationName ? `{
         
     | 
| 
       86356 
86434 
     | 
    
         
             
            			alias: "${relation.relationName}"
         
     | 
| 
       86357 
86435 
     | 
    
         
             
            		}` : "") + `),`;
         
     | 
| 
      
 86436 
     | 
    
         
            +
                      } else if (relation.type === "one-one") {
         
     | 
| 
      
 86437 
     | 
    
         
            +
                        relationString += `
         
     | 
| 
      
 86438 
     | 
    
         
            +
            		${relation.name}: r.one.${relation.tableTo}(` + (relation.relationName ? `{
         
     | 
| 
      
 86439 
     | 
    
         
            +
            			alias: "${relation.relationName}"
         
     | 
| 
      
 86440 
     | 
    
         
            +
            		}` : "") + `),`;
         
     | 
| 
       86358 
86441 
     | 
    
         
             
                      } else {
         
     | 
| 
       86359 
86442 
     | 
    
         
             
                        const from = relation.columnsThroughFrom.length === 1 ? `r.${relation.tableFrom}.${relation.columnsFrom[0]}.through(r.${relation.tableThrough}.${relation.columnsThroughFrom[0]})` : `[${relation.columnsThroughFrom.map((it) => `r.${relation.tableFrom}.${it}.through(${relation.tableThrough}.${it})`).join(", ")}]`;
         
     | 
| 
       86360 
86443 
     | 
    
         
             
                        const to = relation.columnsThroughTo.length === 1 ? `r.${relation.tableTo}.${relation.columnsTo[0]}.through(r.${relation.tableThrough}.${relation.columnsThroughTo[0]})` : `[${relation.columnsThroughTo.map((it) => `r.${relation.tableTo}.${it}.through(${relation.tableThrough}.${it})`).join(", ")}]`;
         
     | 
| 
         @@ -92729,7 +92812,7 @@ init_utils5(); 
     | 
|
| 
       92729 
92812 
     | 
    
         
             
            var version2 = async () => {
         
     | 
| 
       92730 
92813 
     | 
    
         
             
              const { npmVersion } = await ormCoreVersions();
         
     | 
| 
       92731 
92814 
     | 
    
         
             
              const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
         
     | 
| 
       92732 
     | 
    
         
            -
              const envVersion = "1.0.0-beta.1- 
     | 
| 
      
 92815 
     | 
    
         
            +
              const envVersion = "1.0.0-beta.1-7946562";
         
     | 
| 
       92733 
92816 
     | 
    
         
             
              const kitVersion = envVersion ? `v${envVersion}` : "--";
         
     | 
| 
       92734 
92817 
     | 
    
         
             
              const versions = `drizzle-kit: ${kitVersion}
         
     | 
| 
       92735 
92818 
     | 
    
         
             
            ${ormVersion}`;
         
     |