drizzle-kit 1.0.0-beta.1-cacd055 → 1.0.0-beta.1-fd5d1e8
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 +33 -20
 - package/api.mjs +33 -20
 - package/bin.cjs +1 -1
 - package/package.json +1 -1
 
    
        package/api.js
    CHANGED
    
    | 
         @@ -23811,14 +23811,14 @@ var init_relations = __esm({ 
     | 
|
| 
       23811 
23811 
     | 
    
         
             
                          );
         
     | 
| 
       23812 
23812 
     | 
    
         
             
                          if (reverseRelations.length > 1) {
         
     | 
| 
       23813 
23813 
     | 
    
         
             
                            throw new Error(
         
     | 
| 
       23814 
     | 
    
         
            -
                              `${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and multiple relations between "${targetTableTsName}" and "${getTableUniqueName(relation.sourceTable)}" were found.
         
     | 
| 
      
 23814 
     | 
    
         
            +
                              `${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and multiple relations between "${targetTableTsName}" and "${this.tableNamesMap[getTableUniqueName(relation.sourceTable)] ?? getTableUniqueName(relation.sourceTable)}" were found.
         
     | 
| 
       23815 
23815 
     | 
    
         
             
            Hint: you can specify "alias" on both sides of the relation with the same value`
         
     | 
| 
       23816 
23816 
     | 
    
         
             
                            );
         
     | 
| 
       23817 
23817 
     | 
    
         
             
                          }
         
     | 
| 
       23818 
23818 
     | 
    
         
             
                          reverseRelation = reverseRelations[0];
         
     | 
| 
       23819 
23819 
     | 
    
         
             
                          if (!reverseRelation) {
         
     | 
| 
       23820 
23820 
     | 
    
         
             
                            throw new Error(
         
     | 
| 
       23821 
     | 
    
         
            -
                              `${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relation of table "${targetTableTsName}" with target table "${getTableUniqueName(relation.sourceTable)}" was found`
         
     | 
| 
      
 23821 
     | 
    
         
            +
                              `${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relation of table "${targetTableTsName}" with target table "${this.tableNamesMap[getTableUniqueName(relation.sourceTable)] ?? getTableUniqueName(relation.sourceTable)}" was found`
         
     | 
| 
       23822 
23822 
     | 
    
         
             
                            );
         
     | 
| 
       23823 
23823 
     | 
    
         
             
                          }
         
     | 
| 
       23824 
23824 
     | 
    
         
             
                        }
         
     | 
| 
         @@ -33531,7 +33531,8 @@ var init_dialect2 = __esm({ 
     | 
|
| 
       33531 
33531 
     | 
    
         
             
                    isNested,
         
     | 
| 
       33532 
33532 
     | 
    
         
             
                    errorPath,
         
     | 
| 
       33533 
33533 
     | 
    
         
             
                    depth,
         
     | 
| 
       33534 
     | 
    
         
            -
                    throughJoin
         
     | 
| 
      
 33534 
     | 
    
         
            +
                    throughJoin,
         
     | 
| 
      
 33535 
     | 
    
         
            +
                    jsonb: jsonb2
         
     | 
| 
       33535 
33536 
     | 
    
         
             
                  }) {
         
     | 
| 
       33536 
33537 
     | 
    
         
             
                    const selection = [];
         
     | 
| 
       33537 
33538 
     | 
    
         
             
                    const isSingle = mode === "first";
         
     | 
| 
         @@ -33584,7 +33585,8 @@ var init_dialect2 = __esm({ 
     | 
|
| 
       33584 
33585 
     | 
    
         
             
                            isNested: true,
         
     | 
| 
       33585 
33586 
     | 
    
         
             
                            errorPath: `${currentPath.length ? `${currentPath}.` : ""}${k}`,
         
     | 
| 
       33586 
33587 
     | 
    
         
             
                            depth: currentDepth + 1,
         
     | 
| 
       33587 
     | 
    
         
            -
                            throughJoin: throughJoin2
         
     | 
| 
      
 33588 
     | 
    
         
            +
                            throughJoin: throughJoin2,
         
     | 
| 
      
 33589 
     | 
    
         
            +
                            jsonb: jsonb2
         
     | 
| 
       33588 
33590 
     | 
    
         
             
                          });
         
     | 
| 
       33589 
33591 
     | 
    
         
             
                          selection.push({
         
     | 
| 
       33590 
33592 
     | 
    
         
             
                            field: targetTable,
         
     | 
| 
         @@ -33595,12 +33597,12 @@ var init_dialect2 = __esm({ 
     | 
|
| 
       33595 
33597 
     | 
    
         
             
                          });
         
     | 
| 
       33596 
33598 
     | 
    
         
             
                          const jsonColumns = sql.join(
         
     | 
| 
       33597 
33599 
     | 
    
         
             
                            innerQuery.selection.map((s) => {
         
     | 
| 
       33598 
     | 
    
         
            -
                              return sql`${sql.raw(this.escapeString(s.key))}, ${s.selection ? sql 
     | 
| 
      
 33600 
     | 
    
         
            +
                              return sql`${sql.raw(this.escapeString(s.key))}, ${s.selection ? sql`${jsonb2}(${sql.identifier(s.key)})` : sql.identifier(s.key)}`;
         
     | 
| 
       33599 
33601 
     | 
    
         
             
                            }),
         
     | 
| 
       33600 
33602 
     | 
    
         
             
                            sql`, `
         
     | 
| 
       33601 
33603 
     | 
    
         
             
                          );
         
     | 
| 
       33602 
     | 
    
         
            -
                          const json4 = isNested ?  
     | 
| 
       33603 
     | 
    
         
            -
                          const joinQuery = isSingle2 ? sql`(select ${json4}_object(${jsonColumns}) as ${sql.identifier("r")} from (${innerQuery.sql}) as ${sql.identifier("t")}) as ${sql.identifier(k)}` : sql`coalesce((select ${json4}_group_array(json_object(${jsonColumns})) as ${sql.identifier("r")} from (${innerQuery.sql}) as ${sql.identifier("t")}),  
     | 
| 
      
 33604 
     | 
    
         
            +
                          const json4 = isNested ? jsonb2 : sql`json`;
         
     | 
| 
      
 33605 
     | 
    
         
            +
                          const joinQuery = isSingle2 ? sql`(select ${json4}_object(${jsonColumns}) as ${sql.identifier("r")} from (${innerQuery.sql}) as ${sql.identifier("t")}) as ${sql.identifier(k)}` : sql`coalesce((select ${json4}_group_array(json_object(${jsonColumns})) as ${sql.identifier("r")} from (${innerQuery.sql}) as ${sql.identifier("t")}), ${jsonb2}_array()) as ${sql.identifier(k)}`;
         
     | 
| 
       33604 
33606 
     | 
    
         
             
                          return joinQuery;
         
     | 
| 
       33605 
33607 
     | 
    
         
             
                        }),
         
     | 
| 
       33606 
33608 
     | 
    
         
             
                        sql`, `
         
     | 
| 
         @@ -35001,7 +35003,7 @@ var init_query4 = __esm({ 
     | 
|
| 
       35001 
35003 
     | 
    
         
             
                init_sql();
         
     | 
| 
       35002 
35004 
     | 
    
         
             
                _a225 = entityKind;
         
     | 
| 
       35003 
35005 
     | 
    
         
             
                RelationalQueryBuilder2 = class {
         
     | 
| 
       35004 
     | 
    
         
            -
                  constructor(mode, tables, schema5, tableNamesMap, table6, tableConfig, dialect6, session, rowMode) {
         
     | 
| 
      
 35006 
     | 
    
         
            +
                  constructor(mode, tables, schema5, tableNamesMap, table6, tableConfig, dialect6, session, rowMode, forbidJsonb) {
         
     | 
| 
       35005 
35007 
     | 
    
         
             
                    this.mode = mode;
         
     | 
| 
       35006 
35008 
     | 
    
         
             
                    this.tables = tables;
         
     | 
| 
       35007 
35009 
     | 
    
         
             
                    this.schema = schema5;
         
     | 
| 
         @@ -35011,6 +35013,7 @@ var init_query4 = __esm({ 
     | 
|
| 
       35011 
35013 
     | 
    
         
             
                    this.dialect = dialect6;
         
     | 
| 
       35012 
35014 
     | 
    
         
             
                    this.session = session;
         
     | 
| 
       35013 
35015 
     | 
    
         
             
                    this.rowMode = rowMode;
         
     | 
| 
      
 35016 
     | 
    
         
            +
                    this.forbidJsonb = forbidJsonb;
         
     | 
| 
       35014 
35017 
     | 
    
         
             
                  }
         
     | 
| 
       35015 
35018 
     | 
    
         
             
                  findMany(config) {
         
     | 
| 
       35016 
35019 
     | 
    
         
             
                    return this.mode === "sync" ? new SQLiteSyncRelationalQuery2(
         
     | 
| 
         @@ -35023,7 +35026,8 @@ var init_query4 = __esm({ 
     | 
|
| 
       35023 
35026 
     | 
    
         
             
                      this.session,
         
     | 
| 
       35024 
35027 
     | 
    
         
             
                      config ?? true,
         
     | 
| 
       35025 
35028 
     | 
    
         
             
                      "many",
         
     | 
| 
       35026 
     | 
    
         
            -
                      this.rowMode
         
     | 
| 
      
 35029 
     | 
    
         
            +
                      this.rowMode,
         
     | 
| 
      
 35030 
     | 
    
         
            +
                      this.forbidJsonb
         
     | 
| 
       35027 
35031 
     | 
    
         
             
                    ) : new SQLiteRelationalQuery2(
         
     | 
| 
       35028 
35032 
     | 
    
         
             
                      this.tables,
         
     | 
| 
       35029 
35033 
     | 
    
         
             
                      this.schema,
         
     | 
| 
         @@ -35034,7 +35038,8 @@ var init_query4 = __esm({ 
     | 
|
| 
       35034 
35038 
     | 
    
         
             
                      this.session,
         
     | 
| 
       35035 
35039 
     | 
    
         
             
                      config ?? true,
         
     | 
| 
       35036 
35040 
     | 
    
         
             
                      "many",
         
     | 
| 
       35037 
     | 
    
         
            -
                      this.rowMode
         
     | 
| 
      
 35041 
     | 
    
         
            +
                      this.rowMode,
         
     | 
| 
      
 35042 
     | 
    
         
            +
                      this.forbidJsonb
         
     | 
| 
       35038 
35043 
     | 
    
         
             
                    );
         
     | 
| 
       35039 
35044 
     | 
    
         
             
                  }
         
     | 
| 
       35040 
35045 
     | 
    
         
             
                  findFirst(config) {
         
     | 
| 
         @@ -35048,7 +35053,8 @@ var init_query4 = __esm({ 
     | 
|
| 
       35048 
35053 
     | 
    
         
             
                      this.session,
         
     | 
| 
       35049 
35054 
     | 
    
         
             
                      config ?? true,
         
     | 
| 
       35050 
35055 
     | 
    
         
             
                      "first",
         
     | 
| 
       35051 
     | 
    
         
            -
                      this.rowMode
         
     | 
| 
      
 35056 
     | 
    
         
            +
                      this.rowMode,
         
     | 
| 
      
 35057 
     | 
    
         
            +
                      this.forbidJsonb
         
     | 
| 
       35052 
35058 
     | 
    
         
             
                    ) : new SQLiteRelationalQuery2(
         
     | 
| 
       35053 
35059 
     | 
    
         
             
                      this.tables,
         
     | 
| 
       35054 
35060 
     | 
    
         
             
                      this.schema,
         
     | 
| 
         @@ -35059,13 +35065,14 @@ var init_query4 = __esm({ 
     | 
|
| 
       35059 
35065 
     | 
    
         
             
                      this.session,
         
     | 
| 
       35060 
35066 
     | 
    
         
             
                      config ?? true,
         
     | 
| 
       35061 
35067 
     | 
    
         
             
                      "first",
         
     | 
| 
       35062 
     | 
    
         
            -
                      this.rowMode
         
     | 
| 
      
 35068 
     | 
    
         
            +
                      this.rowMode,
         
     | 
| 
      
 35069 
     | 
    
         
            +
                      this.forbidJsonb
         
     | 
| 
       35063 
35070 
     | 
    
         
             
                    );
         
     | 
| 
       35064 
35071 
     | 
    
         
             
                  }
         
     | 
| 
       35065 
35072 
     | 
    
         
             
                };
         
     | 
| 
       35066 
35073 
     | 
    
         
             
                __publicField(RelationalQueryBuilder2, _a225, "SQLiteAsyncRelationalQueryBuilderV2");
         
     | 
| 
       35067 
35074 
     | 
    
         
             
                SQLiteRelationalQuery2 = class extends (_b156 = QueryPromise, _a226 = entityKind, _b156) {
         
     | 
| 
       35068 
     | 
    
         
            -
                  constructor(tables, schema5, tableNamesMap, table6, tableConfig, dialect6, session, config, mode, rowMode) {
         
     | 
| 
      
 35075 
     | 
    
         
            +
                  constructor(tables, schema5, tableNamesMap, table6, tableConfig, dialect6, session, config, mode, rowMode, forbidJsonb) {
         
     | 
| 
       35069 
35076 
     | 
    
         
             
                    super();
         
     | 
| 
       35070 
35077 
     | 
    
         
             
                    /** @internal */
         
     | 
| 
       35071 
35078 
     | 
    
         
             
                    __publicField(this, "mode");
         
     | 
| 
         @@ -35079,6 +35086,7 @@ var init_query4 = __esm({ 
     | 
|
| 
       35079 
35086 
     | 
    
         
             
                    this.session = session;
         
     | 
| 
       35080 
35087 
     | 
    
         
             
                    this.config = config;
         
     | 
| 
       35081 
35088 
     | 
    
         
             
                    this.rowMode = rowMode;
         
     | 
| 
      
 35089 
     | 
    
         
            +
                    this.forbidJsonb = forbidJsonb;
         
     | 
| 
       35082 
35090 
     | 
    
         
             
                    this.mode = mode;
         
     | 
| 
       35083 
35091 
     | 
    
         
             
                    this.table = table6;
         
     | 
| 
       35084 
35092 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -35091,7 +35099,8 @@ var init_query4 = __esm({ 
     | 
|
| 
       35091 
35099 
     | 
    
         
             
                      tableConfig: this.tableConfig,
         
     | 
| 
       35092 
35100 
     | 
    
         
             
                      queryConfig: this.config,
         
     | 
| 
       35093 
35101 
     | 
    
         
             
                      tables: this.tables,
         
     | 
| 
       35094 
     | 
    
         
            -
                      mode: this.mode
         
     | 
| 
      
 35102 
     | 
    
         
            +
                      mode: this.mode,
         
     | 
| 
      
 35103 
     | 
    
         
            +
                      jsonb: this.forbidJsonb ? sql`json` : sql`jsonb`
         
     | 
| 
       35095 
35104 
     | 
    
         
             
                    });
         
     | 
| 
       35096 
35105 
     | 
    
         
             
                    return query.sql;
         
     | 
| 
       35097 
35106 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -35115,6 +35124,7 @@ var init_query4 = __esm({ 
     | 
|
| 
       35115 
35124 
     | 
    
         
             
                    return this._prepare(false);
         
     | 
| 
       35116 
35125 
     | 
    
         
             
                  }
         
     | 
| 
       35117 
35126 
     | 
    
         
             
                  _getQuery() {
         
     | 
| 
      
 35127 
     | 
    
         
            +
                    const jsonb2 = this.forbidJsonb ? sql`json` : sql`jsonb`;
         
     | 
| 
       35118 
35128 
     | 
    
         
             
                    const query = this.dialect.buildRelationalQuery({
         
     | 
| 
       35119 
35129 
     | 
    
         
             
                      schema: this.schema,
         
     | 
| 
       35120 
35130 
     | 
    
         
             
                      tableNamesMap: this.tableNamesMap,
         
     | 
| 
         @@ -35123,12 +35133,13 @@ var init_query4 = __esm({ 
     | 
|
| 
       35123 
35133 
     | 
    
         
             
                      queryConfig: this.config,
         
     | 
| 
       35124 
35134 
     | 
    
         
             
                      tables: this.tables,
         
     | 
| 
       35125 
35135 
     | 
    
         
             
                      mode: this.mode,
         
     | 
| 
       35126 
     | 
    
         
            -
                      isNested: this.rowMode
         
     | 
| 
      
 35136 
     | 
    
         
            +
                      isNested: this.rowMode,
         
     | 
| 
      
 35137 
     | 
    
         
            +
                      jsonb: jsonb2
         
     | 
| 
       35127 
35138 
     | 
    
         
             
                    });
         
     | 
| 
       35128 
35139 
     | 
    
         
             
                    if (this.rowMode) {
         
     | 
| 
       35129 
35140 
     | 
    
         
             
                      const jsonColumns = sql.join(
         
     | 
| 
       35130 
35141 
     | 
    
         
             
                        query.selection.map((s) => {
         
     | 
| 
       35131 
     | 
    
         
            -
                          return sql`${sql.raw(this.dialect.escapeString(s.key))}, ${s.selection ? sql 
     | 
| 
      
 35142 
     | 
    
         
            +
                          return sql`${sql.raw(this.dialect.escapeString(s.key))}, ${s.selection ? sql`${jsonb2}(${sql.identifier(s.key)})` : sql.identifier(s.key)}`;
         
     | 
| 
       35132 
35143 
     | 
    
         
             
                        }),
         
     | 
| 
       35133 
35144 
     | 
    
         
             
                        sql`, `
         
     | 
| 
       35134 
35145 
     | 
    
         
             
                      );
         
     | 
| 
         @@ -35217,7 +35228,7 @@ var init_db2 = __esm({ 
     | 
|
| 
       35217 
35228 
     | 
    
         
             
                init_raw2();
         
     | 
| 
       35218 
35229 
     | 
    
         
             
                _a229 = entityKind;
         
     | 
| 
       35219 
35230 
     | 
    
         
             
                BaseSQLiteDatabase = class {
         
     | 
| 
       35220 
     | 
    
         
            -
                  constructor(resultKind, dialect6, session, relations, _schema, rowModeRQB) {
         
     | 
| 
      
 35231 
     | 
    
         
            +
                  constructor(resultKind, dialect6, session, relations, _schema, rowModeRQB, forbidJsonb) {
         
     | 
| 
       35221 
35232 
     | 
    
         
             
                    /** @deprecated */
         
     | 
| 
       35222 
35233 
     | 
    
         
             
                    __publicField(this, "_query");
         
     | 
| 
       35223 
35234 
     | 
    
         
             
                    // TO-DO: Figure out how to pass DrizzleTypeError without breaking withReplicas
         
     | 
| 
         @@ -35276,6 +35287,7 @@ var init_db2 = __esm({ 
     | 
|
| 
       35276 
35287 
     | 
    
         
             
                    this.dialect = dialect6;
         
     | 
| 
       35277 
35288 
     | 
    
         
             
                    this.session = session;
         
     | 
| 
       35278 
35289 
     | 
    
         
             
                    this.rowModeRQB = rowModeRQB;
         
     | 
| 
      
 35290 
     | 
    
         
            +
                    this.forbidJsonb = forbidJsonb;
         
     | 
| 
       35279 
35291 
     | 
    
         
             
                    const rel = relations ?? {};
         
     | 
| 
       35280 
35292 
     | 
    
         
             
                    this._ = _schema ? {
         
     | 
| 
       35281 
35293 
     | 
    
         
             
                      schema: _schema.schema,
         
     | 
| 
         @@ -35316,7 +35328,8 @@ var init_db2 = __esm({ 
     | 
|
| 
       35316 
35328 
     | 
    
         
             
                          relation,
         
     | 
| 
       35317 
35329 
     | 
    
         
             
                          dialect6,
         
     | 
| 
       35318 
35330 
     | 
    
         
             
                          session,
         
     | 
| 
       35319 
     | 
    
         
            -
                          rowModeRQB
         
     | 
| 
      
 35331 
     | 
    
         
            +
                          rowModeRQB,
         
     | 
| 
      
 35332 
     | 
    
         
            +
                          forbidJsonb
         
     | 
| 
       35320 
35333 
     | 
    
         
             
                        );
         
     | 
| 
       35321 
35334 
     | 
    
         
             
                      }
         
     | 
| 
       35322 
35335 
     | 
    
         
             
                    }
         
     | 
| 
         @@ -35736,8 +35749,8 @@ var init_session2 = __esm({ 
     | 
|
| 
       35736 
35749 
     | 
    
         
             
                };
         
     | 
| 
       35737 
35750 
     | 
    
         
             
                __publicField(SQLiteSession, _a237, "SQLiteSession");
         
     | 
| 
       35738 
35751 
     | 
    
         
             
                SQLiteTransaction = class extends (_b160 = BaseSQLiteDatabase, _a238 = entityKind, _b160) {
         
     | 
| 
       35739 
     | 
    
         
            -
                  constructor(resultType, dialect6, session, relations, schema5, nestedIndex = 0, rowModeRQB) {
         
     | 
| 
       35740 
     | 
    
         
            -
                    super(resultType, dialect6, session, relations, schema5, rowModeRQB);
         
     | 
| 
      
 35752 
     | 
    
         
            +
                  constructor(resultType, dialect6, session, relations, schema5, nestedIndex = 0, rowModeRQB, forbidJsonb) {
         
     | 
| 
      
 35753 
     | 
    
         
            +
                    super(resultType, dialect6, session, relations, schema5, rowModeRQB, forbidJsonb);
         
     | 
| 
       35741 
35754 
     | 
    
         
             
                    this.relations = relations;
         
     | 
| 
       35742 
35755 
     | 
    
         
             
                    this.schema = schema5;
         
     | 
| 
       35743 
35756 
     | 
    
         
             
                    this.nestedIndex = nestedIndex;
         
     | 
    
        package/api.mjs
    CHANGED
    
    | 
         @@ -23816,14 +23816,14 @@ var init_relations = __esm({ 
     | 
|
| 
       23816 
23816 
     | 
    
         
             
                          );
         
     | 
| 
       23817 
23817 
     | 
    
         
             
                          if (reverseRelations.length > 1) {
         
     | 
| 
       23818 
23818 
     | 
    
         
             
                            throw new Error(
         
     | 
| 
       23819 
     | 
    
         
            -
                              `${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and multiple relations between "${targetTableTsName}" and "${getTableUniqueName(relation.sourceTable)}" were found.
         
     | 
| 
      
 23819 
     | 
    
         
            +
                              `${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and multiple relations between "${targetTableTsName}" and "${this.tableNamesMap[getTableUniqueName(relation.sourceTable)] ?? getTableUniqueName(relation.sourceTable)}" were found.
         
     | 
| 
       23820 
23820 
     | 
    
         
             
            Hint: you can specify "alias" on both sides of the relation with the same value`
         
     | 
| 
       23821 
23821 
     | 
    
         
             
                            );
         
     | 
| 
       23822 
23822 
     | 
    
         
             
                          }
         
     | 
| 
       23823 
23823 
     | 
    
         
             
                          reverseRelation = reverseRelations[0];
         
     | 
| 
       23824 
23824 
     | 
    
         
             
                          if (!reverseRelation) {
         
     | 
| 
       23825 
23825 
     | 
    
         
             
                            throw new Error(
         
     | 
| 
       23826 
     | 
    
         
            -
                              `${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relation of table "${targetTableTsName}" with target table "${getTableUniqueName(relation.sourceTable)}" was found`
         
     | 
| 
      
 23826 
     | 
    
         
            +
                              `${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relation of table "${targetTableTsName}" with target table "${this.tableNamesMap[getTableUniqueName(relation.sourceTable)] ?? getTableUniqueName(relation.sourceTable)}" was found`
         
     | 
| 
       23827 
23827 
     | 
    
         
             
                            );
         
     | 
| 
       23828 
23828 
     | 
    
         
             
                          }
         
     | 
| 
       23829 
23829 
     | 
    
         
             
                        }
         
     | 
| 
         @@ -33536,7 +33536,8 @@ var init_dialect2 = __esm({ 
     | 
|
| 
       33536 
33536 
     | 
    
         
             
                    isNested,
         
     | 
| 
       33537 
33537 
     | 
    
         
             
                    errorPath,
         
     | 
| 
       33538 
33538 
     | 
    
         
             
                    depth,
         
     | 
| 
       33539 
     | 
    
         
            -
                    throughJoin
         
     | 
| 
      
 33539 
     | 
    
         
            +
                    throughJoin,
         
     | 
| 
      
 33540 
     | 
    
         
            +
                    jsonb: jsonb2
         
     | 
| 
       33540 
33541 
     | 
    
         
             
                  }) {
         
     | 
| 
       33541 
33542 
     | 
    
         
             
                    const selection = [];
         
     | 
| 
       33542 
33543 
     | 
    
         
             
                    const isSingle = mode === "first";
         
     | 
| 
         @@ -33589,7 +33590,8 @@ var init_dialect2 = __esm({ 
     | 
|
| 
       33589 
33590 
     | 
    
         
             
                            isNested: true,
         
     | 
| 
       33590 
33591 
     | 
    
         
             
                            errorPath: `${currentPath.length ? `${currentPath}.` : ""}${k}`,
         
     | 
| 
       33591 
33592 
     | 
    
         
             
                            depth: currentDepth + 1,
         
     | 
| 
       33592 
     | 
    
         
            -
                            throughJoin: throughJoin2
         
     | 
| 
      
 33593 
     | 
    
         
            +
                            throughJoin: throughJoin2,
         
     | 
| 
      
 33594 
     | 
    
         
            +
                            jsonb: jsonb2
         
     | 
| 
       33593 
33595 
     | 
    
         
             
                          });
         
     | 
| 
       33594 
33596 
     | 
    
         
             
                          selection.push({
         
     | 
| 
       33595 
33597 
     | 
    
         
             
                            field: targetTable,
         
     | 
| 
         @@ -33600,12 +33602,12 @@ var init_dialect2 = __esm({ 
     | 
|
| 
       33600 
33602 
     | 
    
         
             
                          });
         
     | 
| 
       33601 
33603 
     | 
    
         
             
                          const jsonColumns = sql.join(
         
     | 
| 
       33602 
33604 
     | 
    
         
             
                            innerQuery.selection.map((s) => {
         
     | 
| 
       33603 
     | 
    
         
            -
                              return sql`${sql.raw(this.escapeString(s.key))}, ${s.selection ? sql 
     | 
| 
      
 33605 
     | 
    
         
            +
                              return sql`${sql.raw(this.escapeString(s.key))}, ${s.selection ? sql`${jsonb2}(${sql.identifier(s.key)})` : sql.identifier(s.key)}`;
         
     | 
| 
       33604 
33606 
     | 
    
         
             
                            }),
         
     | 
| 
       33605 
33607 
     | 
    
         
             
                            sql`, `
         
     | 
| 
       33606 
33608 
     | 
    
         
             
                          );
         
     | 
| 
       33607 
     | 
    
         
            -
                          const json4 = isNested ?  
     | 
| 
       33608 
     | 
    
         
            -
                          const joinQuery = isSingle2 ? sql`(select ${json4}_object(${jsonColumns}) as ${sql.identifier("r")} from (${innerQuery.sql}) as ${sql.identifier("t")}) as ${sql.identifier(k)}` : sql`coalesce((select ${json4}_group_array(json_object(${jsonColumns})) as ${sql.identifier("r")} from (${innerQuery.sql}) as ${sql.identifier("t")}),  
     | 
| 
      
 33609 
     | 
    
         
            +
                          const json4 = isNested ? jsonb2 : sql`json`;
         
     | 
| 
      
 33610 
     | 
    
         
            +
                          const joinQuery = isSingle2 ? sql`(select ${json4}_object(${jsonColumns}) as ${sql.identifier("r")} from (${innerQuery.sql}) as ${sql.identifier("t")}) as ${sql.identifier(k)}` : sql`coalesce((select ${json4}_group_array(json_object(${jsonColumns})) as ${sql.identifier("r")} from (${innerQuery.sql}) as ${sql.identifier("t")}), ${jsonb2}_array()) as ${sql.identifier(k)}`;
         
     | 
| 
       33609 
33611 
     | 
    
         
             
                          return joinQuery;
         
     | 
| 
       33610 
33612 
     | 
    
         
             
                        }),
         
     | 
| 
       33611 
33613 
     | 
    
         
             
                        sql`, `
         
     | 
| 
         @@ -35006,7 +35008,7 @@ var init_query4 = __esm({ 
     | 
|
| 
       35006 
35008 
     | 
    
         
             
                init_sql();
         
     | 
| 
       35007 
35009 
     | 
    
         
             
                _a225 = entityKind;
         
     | 
| 
       35008 
35010 
     | 
    
         
             
                RelationalQueryBuilder2 = class {
         
     | 
| 
       35009 
     | 
    
         
            -
                  constructor(mode, tables, schema5, tableNamesMap, table6, tableConfig, dialect6, session, rowMode) {
         
     | 
| 
      
 35011 
     | 
    
         
            +
                  constructor(mode, tables, schema5, tableNamesMap, table6, tableConfig, dialect6, session, rowMode, forbidJsonb) {
         
     | 
| 
       35010 
35012 
     | 
    
         
             
                    this.mode = mode;
         
     | 
| 
       35011 
35013 
     | 
    
         
             
                    this.tables = tables;
         
     | 
| 
       35012 
35014 
     | 
    
         
             
                    this.schema = schema5;
         
     | 
| 
         @@ -35016,6 +35018,7 @@ var init_query4 = __esm({ 
     | 
|
| 
       35016 
35018 
     | 
    
         
             
                    this.dialect = dialect6;
         
     | 
| 
       35017 
35019 
     | 
    
         
             
                    this.session = session;
         
     | 
| 
       35018 
35020 
     | 
    
         
             
                    this.rowMode = rowMode;
         
     | 
| 
      
 35021 
     | 
    
         
            +
                    this.forbidJsonb = forbidJsonb;
         
     | 
| 
       35019 
35022 
     | 
    
         
             
                  }
         
     | 
| 
       35020 
35023 
     | 
    
         
             
                  findMany(config) {
         
     | 
| 
       35021 
35024 
     | 
    
         
             
                    return this.mode === "sync" ? new SQLiteSyncRelationalQuery2(
         
     | 
| 
         @@ -35028,7 +35031,8 @@ var init_query4 = __esm({ 
     | 
|
| 
       35028 
35031 
     | 
    
         
             
                      this.session,
         
     | 
| 
       35029 
35032 
     | 
    
         
             
                      config ?? true,
         
     | 
| 
       35030 
35033 
     | 
    
         
             
                      "many",
         
     | 
| 
       35031 
     | 
    
         
            -
                      this.rowMode
         
     | 
| 
      
 35034 
     | 
    
         
            +
                      this.rowMode,
         
     | 
| 
      
 35035 
     | 
    
         
            +
                      this.forbidJsonb
         
     | 
| 
       35032 
35036 
     | 
    
         
             
                    ) : new SQLiteRelationalQuery2(
         
     | 
| 
       35033 
35037 
     | 
    
         
             
                      this.tables,
         
     | 
| 
       35034 
35038 
     | 
    
         
             
                      this.schema,
         
     | 
| 
         @@ -35039,7 +35043,8 @@ var init_query4 = __esm({ 
     | 
|
| 
       35039 
35043 
     | 
    
         
             
                      this.session,
         
     | 
| 
       35040 
35044 
     | 
    
         
             
                      config ?? true,
         
     | 
| 
       35041 
35045 
     | 
    
         
             
                      "many",
         
     | 
| 
       35042 
     | 
    
         
            -
                      this.rowMode
         
     | 
| 
      
 35046 
     | 
    
         
            +
                      this.rowMode,
         
     | 
| 
      
 35047 
     | 
    
         
            +
                      this.forbidJsonb
         
     | 
| 
       35043 
35048 
     | 
    
         
             
                    );
         
     | 
| 
       35044 
35049 
     | 
    
         
             
                  }
         
     | 
| 
       35045 
35050 
     | 
    
         
             
                  findFirst(config) {
         
     | 
| 
         @@ -35053,7 +35058,8 @@ var init_query4 = __esm({ 
     | 
|
| 
       35053 
35058 
     | 
    
         
             
                      this.session,
         
     | 
| 
       35054 
35059 
     | 
    
         
             
                      config ?? true,
         
     | 
| 
       35055 
35060 
     | 
    
         
             
                      "first",
         
     | 
| 
       35056 
     | 
    
         
            -
                      this.rowMode
         
     | 
| 
      
 35061 
     | 
    
         
            +
                      this.rowMode,
         
     | 
| 
      
 35062 
     | 
    
         
            +
                      this.forbidJsonb
         
     | 
| 
       35057 
35063 
     | 
    
         
             
                    ) : new SQLiteRelationalQuery2(
         
     | 
| 
       35058 
35064 
     | 
    
         
             
                      this.tables,
         
     | 
| 
       35059 
35065 
     | 
    
         
             
                      this.schema,
         
     | 
| 
         @@ -35064,13 +35070,14 @@ var init_query4 = __esm({ 
     | 
|
| 
       35064 
35070 
     | 
    
         
             
                      this.session,
         
     | 
| 
       35065 
35071 
     | 
    
         
             
                      config ?? true,
         
     | 
| 
       35066 
35072 
     | 
    
         
             
                      "first",
         
     | 
| 
       35067 
     | 
    
         
            -
                      this.rowMode
         
     | 
| 
      
 35073 
     | 
    
         
            +
                      this.rowMode,
         
     | 
| 
      
 35074 
     | 
    
         
            +
                      this.forbidJsonb
         
     | 
| 
       35068 
35075 
     | 
    
         
             
                    );
         
     | 
| 
       35069 
35076 
     | 
    
         
             
                  }
         
     | 
| 
       35070 
35077 
     | 
    
         
             
                };
         
     | 
| 
       35071 
35078 
     | 
    
         
             
                __publicField(RelationalQueryBuilder2, _a225, "SQLiteAsyncRelationalQueryBuilderV2");
         
     | 
| 
       35072 
35079 
     | 
    
         
             
                SQLiteRelationalQuery2 = class extends (_b156 = QueryPromise, _a226 = entityKind, _b156) {
         
     | 
| 
       35073 
     | 
    
         
            -
                  constructor(tables, schema5, tableNamesMap, table6, tableConfig, dialect6, session, config, mode, rowMode) {
         
     | 
| 
      
 35080 
     | 
    
         
            +
                  constructor(tables, schema5, tableNamesMap, table6, tableConfig, dialect6, session, config, mode, rowMode, forbidJsonb) {
         
     | 
| 
       35074 
35081 
     | 
    
         
             
                    super();
         
     | 
| 
       35075 
35082 
     | 
    
         
             
                    /** @internal */
         
     | 
| 
       35076 
35083 
     | 
    
         
             
                    __publicField(this, "mode");
         
     | 
| 
         @@ -35084,6 +35091,7 @@ var init_query4 = __esm({ 
     | 
|
| 
       35084 
35091 
     | 
    
         
             
                    this.session = session;
         
     | 
| 
       35085 
35092 
     | 
    
         
             
                    this.config = config;
         
     | 
| 
       35086 
35093 
     | 
    
         
             
                    this.rowMode = rowMode;
         
     | 
| 
      
 35094 
     | 
    
         
            +
                    this.forbidJsonb = forbidJsonb;
         
     | 
| 
       35087 
35095 
     | 
    
         
             
                    this.mode = mode;
         
     | 
| 
       35088 
35096 
     | 
    
         
             
                    this.table = table6;
         
     | 
| 
       35089 
35097 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -35096,7 +35104,8 @@ var init_query4 = __esm({ 
     | 
|
| 
       35096 
35104 
     | 
    
         
             
                      tableConfig: this.tableConfig,
         
     | 
| 
       35097 
35105 
     | 
    
         
             
                      queryConfig: this.config,
         
     | 
| 
       35098 
35106 
     | 
    
         
             
                      tables: this.tables,
         
     | 
| 
       35099 
     | 
    
         
            -
                      mode: this.mode
         
     | 
| 
      
 35107 
     | 
    
         
            +
                      mode: this.mode,
         
     | 
| 
      
 35108 
     | 
    
         
            +
                      jsonb: this.forbidJsonb ? sql`json` : sql`jsonb`
         
     | 
| 
       35100 
35109 
     | 
    
         
             
                    });
         
     | 
| 
       35101 
35110 
     | 
    
         
             
                    return query.sql;
         
     | 
| 
       35102 
35111 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -35120,6 +35129,7 @@ var init_query4 = __esm({ 
     | 
|
| 
       35120 
35129 
     | 
    
         
             
                    return this._prepare(false);
         
     | 
| 
       35121 
35130 
     | 
    
         
             
                  }
         
     | 
| 
       35122 
35131 
     | 
    
         
             
                  _getQuery() {
         
     | 
| 
      
 35132 
     | 
    
         
            +
                    const jsonb2 = this.forbidJsonb ? sql`json` : sql`jsonb`;
         
     | 
| 
       35123 
35133 
     | 
    
         
             
                    const query = this.dialect.buildRelationalQuery({
         
     | 
| 
       35124 
35134 
     | 
    
         
             
                      schema: this.schema,
         
     | 
| 
       35125 
35135 
     | 
    
         
             
                      tableNamesMap: this.tableNamesMap,
         
     | 
| 
         @@ -35128,12 +35138,13 @@ var init_query4 = __esm({ 
     | 
|
| 
       35128 
35138 
     | 
    
         
             
                      queryConfig: this.config,
         
     | 
| 
       35129 
35139 
     | 
    
         
             
                      tables: this.tables,
         
     | 
| 
       35130 
35140 
     | 
    
         
             
                      mode: this.mode,
         
     | 
| 
       35131 
     | 
    
         
            -
                      isNested: this.rowMode
         
     | 
| 
      
 35141 
     | 
    
         
            +
                      isNested: this.rowMode,
         
     | 
| 
      
 35142 
     | 
    
         
            +
                      jsonb: jsonb2
         
     | 
| 
       35132 
35143 
     | 
    
         
             
                    });
         
     | 
| 
       35133 
35144 
     | 
    
         
             
                    if (this.rowMode) {
         
     | 
| 
       35134 
35145 
     | 
    
         
             
                      const jsonColumns = sql.join(
         
     | 
| 
       35135 
35146 
     | 
    
         
             
                        query.selection.map((s) => {
         
     | 
| 
       35136 
     | 
    
         
            -
                          return sql`${sql.raw(this.dialect.escapeString(s.key))}, ${s.selection ? sql 
     | 
| 
      
 35147 
     | 
    
         
            +
                          return sql`${sql.raw(this.dialect.escapeString(s.key))}, ${s.selection ? sql`${jsonb2}(${sql.identifier(s.key)})` : sql.identifier(s.key)}`;
         
     | 
| 
       35137 
35148 
     | 
    
         
             
                        }),
         
     | 
| 
       35138 
35149 
     | 
    
         
             
                        sql`, `
         
     | 
| 
       35139 
35150 
     | 
    
         
             
                      );
         
     | 
| 
         @@ -35222,7 +35233,7 @@ var init_db2 = __esm({ 
     | 
|
| 
       35222 
35233 
     | 
    
         
             
                init_raw2();
         
     | 
| 
       35223 
35234 
     | 
    
         
             
                _a229 = entityKind;
         
     | 
| 
       35224 
35235 
     | 
    
         
             
                BaseSQLiteDatabase = class {
         
     | 
| 
       35225 
     | 
    
         
            -
                  constructor(resultKind, dialect6, session, relations, _schema, rowModeRQB) {
         
     | 
| 
      
 35236 
     | 
    
         
            +
                  constructor(resultKind, dialect6, session, relations, _schema, rowModeRQB, forbidJsonb) {
         
     | 
| 
       35226 
35237 
     | 
    
         
             
                    /** @deprecated */
         
     | 
| 
       35227 
35238 
     | 
    
         
             
                    __publicField(this, "_query");
         
     | 
| 
       35228 
35239 
     | 
    
         
             
                    // TO-DO: Figure out how to pass DrizzleTypeError without breaking withReplicas
         
     | 
| 
         @@ -35281,6 +35292,7 @@ var init_db2 = __esm({ 
     | 
|
| 
       35281 
35292 
     | 
    
         
             
                    this.dialect = dialect6;
         
     | 
| 
       35282 
35293 
     | 
    
         
             
                    this.session = session;
         
     | 
| 
       35283 
35294 
     | 
    
         
             
                    this.rowModeRQB = rowModeRQB;
         
     | 
| 
      
 35295 
     | 
    
         
            +
                    this.forbidJsonb = forbidJsonb;
         
     | 
| 
       35284 
35296 
     | 
    
         
             
                    const rel = relations ?? {};
         
     | 
| 
       35285 
35297 
     | 
    
         
             
                    this._ = _schema ? {
         
     | 
| 
       35286 
35298 
     | 
    
         
             
                      schema: _schema.schema,
         
     | 
| 
         @@ -35321,7 +35333,8 @@ var init_db2 = __esm({ 
     | 
|
| 
       35321 
35333 
     | 
    
         
             
                          relation,
         
     | 
| 
       35322 
35334 
     | 
    
         
             
                          dialect6,
         
     | 
| 
       35323 
35335 
     | 
    
         
             
                          session,
         
     | 
| 
       35324 
     | 
    
         
            -
                          rowModeRQB
         
     | 
| 
      
 35336 
     | 
    
         
            +
                          rowModeRQB,
         
     | 
| 
      
 35337 
     | 
    
         
            +
                          forbidJsonb
         
     | 
| 
       35325 
35338 
     | 
    
         
             
                        );
         
     | 
| 
       35326 
35339 
     | 
    
         
             
                      }
         
     | 
| 
       35327 
35340 
     | 
    
         
             
                    }
         
     | 
| 
         @@ -35741,8 +35754,8 @@ var init_session2 = __esm({ 
     | 
|
| 
       35741 
35754 
     | 
    
         
             
                };
         
     | 
| 
       35742 
35755 
     | 
    
         
             
                __publicField(SQLiteSession, _a237, "SQLiteSession");
         
     | 
| 
       35743 
35756 
     | 
    
         
             
                SQLiteTransaction = class extends (_b160 = BaseSQLiteDatabase, _a238 = entityKind, _b160) {
         
     | 
| 
       35744 
     | 
    
         
            -
                  constructor(resultType, dialect6, session, relations, schema5, nestedIndex = 0, rowModeRQB) {
         
     | 
| 
       35745 
     | 
    
         
            -
                    super(resultType, dialect6, session, relations, schema5, rowModeRQB);
         
     | 
| 
      
 35757 
     | 
    
         
            +
                  constructor(resultType, dialect6, session, relations, schema5, nestedIndex = 0, rowModeRQB, forbidJsonb) {
         
     | 
| 
      
 35758 
     | 
    
         
            +
                    super(resultType, dialect6, session, relations, schema5, rowModeRQB, forbidJsonb);
         
     | 
| 
       35746 
35759 
     | 
    
         
             
                    this.relations = relations;
         
     | 
| 
       35747 
35760 
     | 
    
         
             
                    this.schema = schema5;
         
     | 
| 
       35748 
35761 
     | 
    
         
             
                    this.nestedIndex = nestedIndex;
         
     | 
    
        package/bin.cjs
    CHANGED
    
    | 
         @@ -92669,7 +92669,7 @@ init_utils5(); 
     | 
|
| 
       92669 
92669 
     | 
    
         
             
            var version2 = async () => {
         
     | 
| 
       92670 
92670 
     | 
    
         
             
              const { npmVersion } = await ormCoreVersions();
         
     | 
| 
       92671 
92671 
     | 
    
         
             
              const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
         
     | 
| 
       92672 
     | 
    
         
            -
              const envVersion = "1.0.0-beta.1- 
     | 
| 
      
 92672 
     | 
    
         
            +
              const envVersion = "1.0.0-beta.1-fd5d1e8";
         
     | 
| 
       92673 
92673 
     | 
    
         
             
              const kitVersion = envVersion ? `v${envVersion}` : "--";
         
     | 
| 
       92674 
92674 
     | 
    
         
             
              const versions = `drizzle-kit: ${kitVersion}
         
     | 
| 
       92675 
92675 
     | 
    
         
             
            ${ormVersion}`;
         
     |