drizzle-kit 0.28.1-44b6c8a → 0.28.1-6f7d345
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 +128 -25
- package/api.mjs +128 -25
- package/bin.cjs +637 -42
- package/package.json +1 -1
package/api.js
CHANGED
@@ -21121,7 +21121,7 @@ var version;
|
|
21121
21121
|
var init_version = __esm({
|
21122
21122
|
"../drizzle-orm/dist/version.js"() {
|
21123
21123
|
"use strict";
|
21124
|
-
version = "0.36.
|
21124
|
+
version = "0.36.4";
|
21125
21125
|
}
|
21126
21126
|
});
|
21127
21127
|
|
@@ -24583,9 +24583,10 @@ var init_delete = __esm({
|
|
24583
24583
|
constructor(table4, session, dialect4, withList) {
|
24584
24584
|
super();
|
24585
24585
|
__publicField(this, "config");
|
24586
|
+
__publicField(this, "authToken");
|
24586
24587
|
__publicField(this, "execute", (placeholderValues) => {
|
24587
24588
|
return tracer.startActiveSpan("drizzle.operation", () => {
|
24588
|
-
return this._prepare().execute(placeholderValues);
|
24589
|
+
return this._prepare().execute(placeholderValues, this.authToken);
|
24589
24590
|
});
|
24590
24591
|
});
|
24591
24592
|
this.session = session;
|
@@ -24646,6 +24647,11 @@ var init_delete = __esm({
|
|
24646
24647
|
prepare(name2) {
|
24647
24648
|
return this._prepare(name2);
|
24648
24649
|
}
|
24650
|
+
/** @internal */
|
24651
|
+
setToken(token) {
|
24652
|
+
this.authToken = token;
|
24653
|
+
return this;
|
24654
|
+
}
|
24649
24655
|
$dynamic() {
|
24650
24656
|
return this;
|
24651
24657
|
}
|
@@ -25057,7 +25063,7 @@ var init_dialect = __esm({
|
|
25057
25063
|
const offsetSql = offset ? sql` offset ${offset}` : void 0;
|
25058
25064
|
return sql`${leftChunk}${operatorChunk}${rightChunk}${orderBySql}${limitSql}${offsetSql}`;
|
25059
25065
|
}
|
25060
|
-
buildInsertQuery({ table: table4, values: valuesOrSelect, onConflict, returning, withList, select }) {
|
25066
|
+
buildInsertQuery({ table: table4, values: valuesOrSelect, onConflict, returning, withList, select, overridingSystemValue_ }) {
|
25061
25067
|
const valuesSqlList = [];
|
25062
25068
|
const columns = table4[Table2.Symbol.Columns];
|
25063
25069
|
const colEntries = Object.entries(columns).filter(([_2, col]) => !col.shouldDisableInsert());
|
@@ -25104,7 +25110,8 @@ var init_dialect = __esm({
|
|
25104
25110
|
const valuesSql = sql.join(valuesSqlList);
|
25105
25111
|
const returningSql = returning ? sql` returning ${this.buildSelection(returning, { isSingleTable: true })}` : void 0;
|
25106
25112
|
const onConflictSql = onConflict ? sql` on conflict ${onConflict}` : void 0;
|
25107
|
-
|
25113
|
+
const overridingSql = overridingSystemValue_ === true ? sql`overriding system value ` : void 0;
|
25114
|
+
return sql`${withSql}insert into ${table4} ${insertOrder} ${overridingSql}${valuesSql}${onConflictSql}${returningSql}`;
|
25108
25115
|
}
|
25109
25116
|
buildRefreshMaterializedViewQuery({ view: view4, concurrently, withNoData }) {
|
25110
25117
|
const concurrentlySql = concurrently ? sql` concurrently` : void 0;
|
@@ -25985,6 +25992,7 @@ var init_select2 = __esm({
|
|
25985
25992
|
__publicField(this, "dialect");
|
25986
25993
|
__publicField(this, "withList", []);
|
25987
25994
|
__publicField(this, "distinct");
|
25995
|
+
__publicField(this, "authToken");
|
25988
25996
|
this.fields = config.fields;
|
25989
25997
|
this.session = config.session;
|
25990
25998
|
this.dialect = config.dialect;
|
@@ -25993,6 +26001,11 @@ var init_select2 = __esm({
|
|
25993
26001
|
}
|
25994
26002
|
this.distinct = config.distinct;
|
25995
26003
|
}
|
26004
|
+
/** @internal */
|
26005
|
+
setToken(token) {
|
26006
|
+
this.authToken = token;
|
26007
|
+
return this;
|
26008
|
+
}
|
25996
26009
|
/**
|
25997
26010
|
* Specify the table, subquery, or other target that you're
|
25998
26011
|
* building a select query against.
|
@@ -26015,7 +26028,7 @@ var init_select2 = __esm({
|
|
26015
26028
|
} else {
|
26016
26029
|
fields = getTableColumns(source);
|
26017
26030
|
}
|
26018
|
-
return new PgSelectBase({
|
26031
|
+
return this.authToken === void 0 ? new PgSelectBase({
|
26019
26032
|
table: source,
|
26020
26033
|
fields,
|
26021
26034
|
isPartialSelect,
|
@@ -26023,7 +26036,15 @@ var init_select2 = __esm({
|
|
26023
26036
|
dialect: this.dialect,
|
26024
26037
|
withList: this.withList,
|
26025
26038
|
distinct: this.distinct
|
26026
|
-
})
|
26039
|
+
}) : new PgSelectBase({
|
26040
|
+
table: source,
|
26041
|
+
fields,
|
26042
|
+
isPartialSelect,
|
26043
|
+
session: this.session,
|
26044
|
+
dialect: this.dialect,
|
26045
|
+
withList: this.withList,
|
26046
|
+
distinct: this.distinct
|
26047
|
+
}).setToken(this.authToken);
|
26027
26048
|
}
|
26028
26049
|
};
|
26029
26050
|
__publicField(PgSelectBuilder, _a130, "PgSelectBuilder");
|
@@ -26631,15 +26652,16 @@ var init_select2 = __esm({
|
|
26631
26652
|
PgSelectBase = class extends (_b100 = PgSelectQueryBuilderBase, _a132 = entityKind, _b100) {
|
26632
26653
|
constructor() {
|
26633
26654
|
super(...arguments);
|
26655
|
+
__publicField(this, "authToken");
|
26634
26656
|
__publicField(this, "execute", (placeholderValues) => {
|
26635
26657
|
return tracer.startActiveSpan("drizzle.operation", () => {
|
26636
|
-
return this._prepare().execute(placeholderValues);
|
26658
|
+
return this._prepare().execute(placeholderValues, this.authToken);
|
26637
26659
|
});
|
26638
26660
|
});
|
26639
26661
|
}
|
26640
26662
|
/** @internal */
|
26641
26663
|
_prepare(name2) {
|
26642
|
-
const { session, config, dialect: dialect4, joinsNotNullableMap } = this;
|
26664
|
+
const { session, config, dialect: dialect4, joinsNotNullableMap, authToken } = this;
|
26643
26665
|
if (!session) {
|
26644
26666
|
throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");
|
26645
26667
|
}
|
@@ -26647,7 +26669,7 @@ var init_select2 = __esm({
|
|
26647
26669
|
const fieldsList = orderSelectedFields(config.fields);
|
26648
26670
|
const query = session.prepareQuery(dialect4.sqlToQuery(this.getSQL()), fieldsList, name2, true);
|
26649
26671
|
query.joinsNotNullableMap = joinsNotNullableMap;
|
26650
|
-
return query;
|
26672
|
+
return authToken === void 0 ? query : query.setToken(authToken);
|
26651
26673
|
});
|
26652
26674
|
}
|
26653
26675
|
/**
|
@@ -26660,6 +26682,11 @@ var init_select2 = __esm({
|
|
26660
26682
|
prepare(name2) {
|
26661
26683
|
return this._prepare(name2);
|
26662
26684
|
}
|
26685
|
+
/** @internal */
|
26686
|
+
setToken(token) {
|
26687
|
+
this.authToken = token;
|
26688
|
+
return this;
|
26689
|
+
}
|
26663
26690
|
};
|
26664
26691
|
__publicField(PgSelectBase, _a132, "PgSelect");
|
26665
26692
|
applyMixins(PgSelectBase, [QueryPromise]);
|
@@ -26789,11 +26816,22 @@ var init_insert = __esm({
|
|
26789
26816
|
init_query_builder2();
|
26790
26817
|
_a134 = entityKind;
|
26791
26818
|
PgInsertBuilder = class {
|
26792
|
-
constructor(table4, session, dialect4, withList) {
|
26819
|
+
constructor(table4, session, dialect4, withList, overridingSystemValue_) {
|
26820
|
+
__publicField(this, "authToken");
|
26793
26821
|
this.table = table4;
|
26794
26822
|
this.session = session;
|
26795
26823
|
this.dialect = dialect4;
|
26796
26824
|
this.withList = withList;
|
26825
|
+
this.overridingSystemValue_ = overridingSystemValue_;
|
26826
|
+
}
|
26827
|
+
/** @internal */
|
26828
|
+
setToken(token) {
|
26829
|
+
this.authToken = token;
|
26830
|
+
return this;
|
26831
|
+
}
|
26832
|
+
overridingSystemValue() {
|
26833
|
+
this.overridingSystemValue_ = true;
|
26834
|
+
return this;
|
26797
26835
|
}
|
26798
26836
|
values(values) {
|
26799
26837
|
values = Array.isArray(values) ? values : [values];
|
@@ -26809,7 +26847,23 @@ var init_insert = __esm({
|
|
26809
26847
|
}
|
26810
26848
|
return result;
|
26811
26849
|
});
|
26812
|
-
return
|
26850
|
+
return this.authToken === void 0 ? new PgInsertBase(
|
26851
|
+
this.table,
|
26852
|
+
mappedValues,
|
26853
|
+
this.session,
|
26854
|
+
this.dialect,
|
26855
|
+
this.withList,
|
26856
|
+
false,
|
26857
|
+
this.overridingSystemValue_
|
26858
|
+
) : new PgInsertBase(
|
26859
|
+
this.table,
|
26860
|
+
mappedValues,
|
26861
|
+
this.session,
|
26862
|
+
this.dialect,
|
26863
|
+
this.withList,
|
26864
|
+
false,
|
26865
|
+
this.overridingSystemValue_
|
26866
|
+
).setToken(this.authToken);
|
26813
26867
|
}
|
26814
26868
|
select(selectQuery) {
|
26815
26869
|
const select = typeof selectQuery === "function" ? selectQuery(new QueryBuilder()) : selectQuery;
|
@@ -26823,17 +26877,18 @@ var init_insert = __esm({
|
|
26823
26877
|
};
|
26824
26878
|
__publicField(PgInsertBuilder, _a134, "PgInsertBuilder");
|
26825
26879
|
PgInsertBase = class extends (_b101 = QueryPromise, _a135 = entityKind, _b101) {
|
26826
|
-
constructor(table4, values, session, dialect4, withList, select) {
|
26880
|
+
constructor(table4, values, session, dialect4, withList, select, overridingSystemValue_) {
|
26827
26881
|
super();
|
26828
26882
|
__publicField(this, "config");
|
26883
|
+
__publicField(this, "authToken");
|
26829
26884
|
__publicField(this, "execute", (placeholderValues) => {
|
26830
26885
|
return tracer.startActiveSpan("drizzle.operation", () => {
|
26831
|
-
return this._prepare().execute(placeholderValues);
|
26886
|
+
return this._prepare().execute(placeholderValues, this.authToken);
|
26832
26887
|
});
|
26833
26888
|
});
|
26834
26889
|
this.session = session;
|
26835
26890
|
this.dialect = dialect4;
|
26836
|
-
this.config = { table: table4, values, withList, select };
|
26891
|
+
this.config = { table: table4, values, withList, select, overridingSystemValue_ };
|
26837
26892
|
}
|
26838
26893
|
returning(fields = this.config.table[Table2.Symbol.Columns]) {
|
26839
26894
|
this.config.returning = orderSelectedFields(fields);
|
@@ -26933,6 +26988,11 @@ var init_insert = __esm({
|
|
26933
26988
|
prepare(name2) {
|
26934
26989
|
return this._prepare(name2);
|
26935
26990
|
}
|
26991
|
+
/** @internal */
|
26992
|
+
setToken(token) {
|
26993
|
+
this.authToken = token;
|
26994
|
+
return this;
|
26995
|
+
}
|
26936
26996
|
$dynamic() {
|
26937
26997
|
return this;
|
26938
26998
|
}
|
@@ -26953,9 +27013,10 @@ var init_refresh_materialized_view = __esm({
|
|
26953
27013
|
constructor(view4, session, dialect4) {
|
26954
27014
|
super();
|
26955
27015
|
__publicField(this, "config");
|
27016
|
+
__publicField(this, "authToken");
|
26956
27017
|
__publicField(this, "execute", (placeholderValues) => {
|
26957
27018
|
return tracer.startActiveSpan("drizzle.operation", () => {
|
26958
|
-
return this._prepare().execute(placeholderValues);
|
27019
|
+
return this._prepare().execute(placeholderValues, this.authToken);
|
26959
27020
|
});
|
26960
27021
|
});
|
26961
27022
|
this.session = session;
|
@@ -26993,6 +27054,11 @@ var init_refresh_materialized_view = __esm({
|
|
26993
27054
|
prepare(name2) {
|
26994
27055
|
return this._prepare(name2);
|
26995
27056
|
}
|
27057
|
+
/** @internal */
|
27058
|
+
setToken(token) {
|
27059
|
+
this.authToken = token;
|
27060
|
+
return this;
|
27061
|
+
}
|
26996
27062
|
};
|
26997
27063
|
__publicField(PgRefreshMaterializedView, _a136, "PgRefreshMaterializedView");
|
26998
27064
|
}
|
@@ -27022,19 +27088,30 @@ var init_update = __esm({
|
|
27022
27088
|
_a137 = entityKind;
|
27023
27089
|
PgUpdateBuilder = class {
|
27024
27090
|
constructor(table4, session, dialect4, withList) {
|
27091
|
+
__publicField(this, "authToken");
|
27025
27092
|
this.table = table4;
|
27026
27093
|
this.session = session;
|
27027
27094
|
this.dialect = dialect4;
|
27028
27095
|
this.withList = withList;
|
27029
27096
|
}
|
27097
|
+
setToken(token) {
|
27098
|
+
this.authToken = token;
|
27099
|
+
return this;
|
27100
|
+
}
|
27030
27101
|
set(values) {
|
27031
|
-
return new PgUpdateBase(
|
27102
|
+
return this.authToken === void 0 ? new PgUpdateBase(
|
27032
27103
|
this.table,
|
27033
27104
|
mapUpdateSet(this.table, values),
|
27034
27105
|
this.session,
|
27035
27106
|
this.dialect,
|
27036
27107
|
this.withList
|
27037
|
-
)
|
27108
|
+
) : new PgUpdateBase(
|
27109
|
+
this.table,
|
27110
|
+
mapUpdateSet(this.table, values),
|
27111
|
+
this.session,
|
27112
|
+
this.dialect,
|
27113
|
+
this.withList
|
27114
|
+
).setToken(this.authToken);
|
27038
27115
|
}
|
27039
27116
|
};
|
27040
27117
|
__publicField(PgUpdateBuilder, _a137, "PgUpdateBuilder");
|
@@ -27048,8 +27125,9 @@ var init_update = __esm({
|
|
27048
27125
|
__publicField(this, "rightJoin", this.createJoin("right"));
|
27049
27126
|
__publicField(this, "innerJoin", this.createJoin("inner"));
|
27050
27127
|
__publicField(this, "fullJoin", this.createJoin("full"));
|
27128
|
+
__publicField(this, "authToken");
|
27051
27129
|
__publicField(this, "execute", (placeholderValues) => {
|
27052
|
-
return this._prepare().execute(placeholderValues);
|
27130
|
+
return this._prepare().execute(placeholderValues, this.authToken);
|
27053
27131
|
});
|
27054
27132
|
this.session = session;
|
27055
27133
|
this.dialect = dialect4;
|
@@ -27197,6 +27275,11 @@ var init_update = __esm({
|
|
27197
27275
|
prepare(name2) {
|
27198
27276
|
return this._prepare(name2);
|
27199
27277
|
}
|
27278
|
+
/** @internal */
|
27279
|
+
setToken(token) {
|
27280
|
+
this.authToken = token;
|
27281
|
+
return this;
|
27282
|
+
}
|
27200
27283
|
$dynamic() {
|
27201
27284
|
return this;
|
27202
27285
|
}
|
@@ -27230,6 +27313,7 @@ var init_count = __esm({
|
|
27230
27313
|
constructor(params) {
|
27231
27314
|
super(_PgCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
|
27232
27315
|
__publicField(this, "sql");
|
27316
|
+
__publicField(this, "token");
|
27233
27317
|
__publicField(this, _a139, "PgCountBuilder");
|
27234
27318
|
__publicField(this, "session");
|
27235
27319
|
this.params = params;
|
@@ -27246,8 +27330,12 @@ var init_count = __esm({
|
|
27246
27330
|
static buildCount(source, filters) {
|
27247
27331
|
return sql`select count(*) as count from ${source}${sql.raw(" where ").if(filters)}${filters};`;
|
27248
27332
|
}
|
27333
|
+
/** @intrnal */
|
27334
|
+
setToken(token) {
|
27335
|
+
this.token = token;
|
27336
|
+
}
|
27249
27337
|
then(onfulfilled, onrejected) {
|
27250
|
-
return Promise.resolve(this.session.count(this.sql)).then(
|
27338
|
+
return Promise.resolve(this.session.count(this.sql, this.token)).then(
|
27251
27339
|
onfulfilled,
|
27252
27340
|
onrejected
|
27253
27341
|
);
|
@@ -27324,6 +27412,7 @@ var init_query = __esm({
|
|
27324
27412
|
PgRelationalQuery = class extends (_b105 = QueryPromise, _a141 = entityKind, _b105) {
|
27325
27413
|
constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, mode) {
|
27326
27414
|
super();
|
27415
|
+
__publicField(this, "authToken");
|
27327
27416
|
this.fullSchema = fullSchema;
|
27328
27417
|
this.schema = schema4;
|
27329
27418
|
this.tableNamesMap = tableNamesMap;
|
@@ -27381,9 +27470,14 @@ var init_query = __esm({
|
|
27381
27470
|
toSQL() {
|
27382
27471
|
return this._toSQL().builtQuery;
|
27383
27472
|
}
|
27473
|
+
/** @internal */
|
27474
|
+
setToken(token) {
|
27475
|
+
this.authToken = token;
|
27476
|
+
return this;
|
27477
|
+
}
|
27384
27478
|
execute() {
|
27385
27479
|
return tracer.startActiveSpan("drizzle.operation", () => {
|
27386
|
-
return this._prepare().execute();
|
27480
|
+
return this._prepare().execute(void 0, this.authToken);
|
27387
27481
|
});
|
27388
27482
|
}
|
27389
27483
|
};
|
@@ -27446,6 +27540,7 @@ var init_db = __esm({
|
|
27446
27540
|
PgDatabase = class {
|
27447
27541
|
constructor(dialect4, session, schema4) {
|
27448
27542
|
__publicField(this, "query");
|
27543
|
+
__publicField(this, "authToken");
|
27449
27544
|
this.dialect = dialect4;
|
27450
27545
|
this.session = session;
|
27451
27546
|
this._ = schema4 ? {
|
@@ -27701,7 +27796,7 @@ var init_db = __esm({
|
|
27701
27796
|
false
|
27702
27797
|
);
|
27703
27798
|
return new PgRaw(
|
27704
|
-
() => prepared.execute(),
|
27799
|
+
() => prepared.execute(void 0, this.authToken),
|
27705
27800
|
sequel,
|
27706
27801
|
builtQuery,
|
27707
27802
|
(result) => prepared.mapResult(result, true)
|
@@ -28246,6 +28341,7 @@ var init_session = __esm({
|
|
28246
28341
|
_a159 = entityKind;
|
28247
28342
|
PgPreparedQuery = class {
|
28248
28343
|
constructor(query) {
|
28344
|
+
__publicField(this, "authToken");
|
28249
28345
|
/** @internal */
|
28250
28346
|
__publicField(this, "joinsNotNullableMap");
|
28251
28347
|
this.query = query;
|
@@ -28256,6 +28352,11 @@ var init_session = __esm({
|
|
28256
28352
|
mapResult(response, _isFromBatch) {
|
28257
28353
|
return response;
|
28258
28354
|
}
|
28355
|
+
/** @internal */
|
28356
|
+
setToken(token) {
|
28357
|
+
this.authToken = token;
|
28358
|
+
return this;
|
28359
|
+
}
|
28259
28360
|
};
|
28260
28361
|
__publicField(PgPreparedQuery, _a159, "PgPreparedQuery");
|
28261
28362
|
_a160 = entityKind;
|
@@ -28263,7 +28364,8 @@ var init_session = __esm({
|
|
28263
28364
|
constructor(dialect4) {
|
28264
28365
|
this.dialect = dialect4;
|
28265
28366
|
}
|
28266
|
-
|
28367
|
+
/** @internal */
|
28368
|
+
execute(query, token) {
|
28267
28369
|
return tracer.startActiveSpan("drizzle.operation", () => {
|
28268
28370
|
const prepared = tracer.startActiveSpan("drizzle.prepareQuery", () => {
|
28269
28371
|
return this.prepareQuery(
|
@@ -28273,7 +28375,7 @@ var init_session = __esm({
|
|
28273
28375
|
false
|
28274
28376
|
);
|
28275
28377
|
});
|
28276
|
-
return prepared.execute();
|
28378
|
+
return prepared.setToken(token).execute(void 0, token);
|
28277
28379
|
});
|
28278
28380
|
}
|
28279
28381
|
all(query) {
|
@@ -28284,8 +28386,9 @@ var init_session = __esm({
|
|
28284
28386
|
false
|
28285
28387
|
).all();
|
28286
28388
|
}
|
28287
|
-
|
28288
|
-
|
28389
|
+
/** @internal */
|
28390
|
+
async count(sql2, token) {
|
28391
|
+
const res = await this.execute(sql2, token);
|
28289
28392
|
return Number(
|
28290
28393
|
res[0]["count"]
|
28291
28394
|
);
|