drizzle-kit 0.28.1-44b6c8a → 0.28.1-4b33aac
Sign up to get free protection for your applications and to get access to all the features.
- package/api.js +130 -27
- package/api.mjs +130 -27
- package/bin.cjs +637 -42
- package/package.json +1 -1
package/api.mjs
CHANGED
@@ -21126,7 +21126,7 @@ var version;
|
|
21126
21126
|
var init_version = __esm({
|
21127
21127
|
"../drizzle-orm/dist/version.js"() {
|
21128
21128
|
"use strict";
|
21129
|
-
version = "0.36.
|
21129
|
+
version = "0.36.4";
|
21130
21130
|
}
|
21131
21131
|
});
|
21132
21132
|
|
@@ -22197,13 +22197,13 @@ function isConfig(data) {
|
|
22197
22197
|
return true;
|
22198
22198
|
}
|
22199
22199
|
if ("schema" in data) {
|
22200
|
-
const type = typeof data["
|
22200
|
+
const type = typeof data["schema"];
|
22201
22201
|
if (type !== "object" && type !== "undefined")
|
22202
22202
|
return false;
|
22203
22203
|
return true;
|
22204
22204
|
}
|
22205
22205
|
if ("casing" in data) {
|
22206
|
-
const type = typeof data["
|
22206
|
+
const type = typeof data["casing"];
|
22207
22207
|
if (type !== "string" && type !== "undefined")
|
22208
22208
|
return false;
|
22209
22209
|
return true;
|
@@ -24588,9 +24588,10 @@ var init_delete = __esm({
|
|
24588
24588
|
constructor(table4, session, dialect4, withList) {
|
24589
24589
|
super();
|
24590
24590
|
__publicField(this, "config");
|
24591
|
+
__publicField(this, "authToken");
|
24591
24592
|
__publicField(this, "execute", (placeholderValues) => {
|
24592
24593
|
return tracer.startActiveSpan("drizzle.operation", () => {
|
24593
|
-
return this._prepare().execute(placeholderValues);
|
24594
|
+
return this._prepare().execute(placeholderValues, this.authToken);
|
24594
24595
|
});
|
24595
24596
|
});
|
24596
24597
|
this.session = session;
|
@@ -24651,6 +24652,11 @@ var init_delete = __esm({
|
|
24651
24652
|
prepare(name2) {
|
24652
24653
|
return this._prepare(name2);
|
24653
24654
|
}
|
24655
|
+
/** @internal */
|
24656
|
+
setToken(token) {
|
24657
|
+
this.authToken = token;
|
24658
|
+
return this;
|
24659
|
+
}
|
24654
24660
|
$dynamic() {
|
24655
24661
|
return this;
|
24656
24662
|
}
|
@@ -25062,7 +25068,7 @@ var init_dialect = __esm({
|
|
25062
25068
|
const offsetSql = offset ? sql` offset ${offset}` : void 0;
|
25063
25069
|
return sql`${leftChunk}${operatorChunk}${rightChunk}${orderBySql}${limitSql}${offsetSql}`;
|
25064
25070
|
}
|
25065
|
-
buildInsertQuery({ table: table4, values: valuesOrSelect, onConflict, returning, withList, select }) {
|
25071
|
+
buildInsertQuery({ table: table4, values: valuesOrSelect, onConflict, returning, withList, select, overridingSystemValue_ }) {
|
25066
25072
|
const valuesSqlList = [];
|
25067
25073
|
const columns = table4[Table2.Symbol.Columns];
|
25068
25074
|
const colEntries = Object.entries(columns).filter(([_2, col]) => !col.shouldDisableInsert());
|
@@ -25109,7 +25115,8 @@ var init_dialect = __esm({
|
|
25109
25115
|
const valuesSql = sql.join(valuesSqlList);
|
25110
25116
|
const returningSql = returning ? sql` returning ${this.buildSelection(returning, { isSingleTable: true })}` : void 0;
|
25111
25117
|
const onConflictSql = onConflict ? sql` on conflict ${onConflict}` : void 0;
|
25112
|
-
|
25118
|
+
const overridingSql = overridingSystemValue_ === true ? sql`overriding system value ` : void 0;
|
25119
|
+
return sql`${withSql}insert into ${table4} ${insertOrder} ${overridingSql}${valuesSql}${onConflictSql}${returningSql}`;
|
25113
25120
|
}
|
25114
25121
|
buildRefreshMaterializedViewQuery({ view: view4, concurrently, withNoData }) {
|
25115
25122
|
const concurrentlySql = concurrently ? sql` concurrently` : void 0;
|
@@ -25990,6 +25997,7 @@ var init_select2 = __esm({
|
|
25990
25997
|
__publicField(this, "dialect");
|
25991
25998
|
__publicField(this, "withList", []);
|
25992
25999
|
__publicField(this, "distinct");
|
26000
|
+
__publicField(this, "authToken");
|
25993
26001
|
this.fields = config.fields;
|
25994
26002
|
this.session = config.session;
|
25995
26003
|
this.dialect = config.dialect;
|
@@ -25998,6 +26006,11 @@ var init_select2 = __esm({
|
|
25998
26006
|
}
|
25999
26007
|
this.distinct = config.distinct;
|
26000
26008
|
}
|
26009
|
+
/** @internal */
|
26010
|
+
setToken(token) {
|
26011
|
+
this.authToken = token;
|
26012
|
+
return this;
|
26013
|
+
}
|
26001
26014
|
/**
|
26002
26015
|
* Specify the table, subquery, or other target that you're
|
26003
26016
|
* building a select query against.
|
@@ -26020,7 +26033,7 @@ var init_select2 = __esm({
|
|
26020
26033
|
} else {
|
26021
26034
|
fields = getTableColumns(source);
|
26022
26035
|
}
|
26023
|
-
return new PgSelectBase({
|
26036
|
+
return this.authToken === void 0 ? new PgSelectBase({
|
26024
26037
|
table: source,
|
26025
26038
|
fields,
|
26026
26039
|
isPartialSelect,
|
@@ -26028,7 +26041,15 @@ var init_select2 = __esm({
|
|
26028
26041
|
dialect: this.dialect,
|
26029
26042
|
withList: this.withList,
|
26030
26043
|
distinct: this.distinct
|
26031
|
-
})
|
26044
|
+
}) : new PgSelectBase({
|
26045
|
+
table: source,
|
26046
|
+
fields,
|
26047
|
+
isPartialSelect,
|
26048
|
+
session: this.session,
|
26049
|
+
dialect: this.dialect,
|
26050
|
+
withList: this.withList,
|
26051
|
+
distinct: this.distinct
|
26052
|
+
}).setToken(this.authToken);
|
26032
26053
|
}
|
26033
26054
|
};
|
26034
26055
|
__publicField(PgSelectBuilder, _a130, "PgSelectBuilder");
|
@@ -26636,15 +26657,16 @@ var init_select2 = __esm({
|
|
26636
26657
|
PgSelectBase = class extends (_b100 = PgSelectQueryBuilderBase, _a132 = entityKind, _b100) {
|
26637
26658
|
constructor() {
|
26638
26659
|
super(...arguments);
|
26660
|
+
__publicField(this, "authToken");
|
26639
26661
|
__publicField(this, "execute", (placeholderValues) => {
|
26640
26662
|
return tracer.startActiveSpan("drizzle.operation", () => {
|
26641
|
-
return this._prepare().execute(placeholderValues);
|
26663
|
+
return this._prepare().execute(placeholderValues, this.authToken);
|
26642
26664
|
});
|
26643
26665
|
});
|
26644
26666
|
}
|
26645
26667
|
/** @internal */
|
26646
26668
|
_prepare(name2) {
|
26647
|
-
const { session, config, dialect: dialect4, joinsNotNullableMap } = this;
|
26669
|
+
const { session, config, dialect: dialect4, joinsNotNullableMap, authToken } = this;
|
26648
26670
|
if (!session) {
|
26649
26671
|
throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");
|
26650
26672
|
}
|
@@ -26652,7 +26674,7 @@ var init_select2 = __esm({
|
|
26652
26674
|
const fieldsList = orderSelectedFields(config.fields);
|
26653
26675
|
const query = session.prepareQuery(dialect4.sqlToQuery(this.getSQL()), fieldsList, name2, true);
|
26654
26676
|
query.joinsNotNullableMap = joinsNotNullableMap;
|
26655
|
-
return query;
|
26677
|
+
return authToken === void 0 ? query : query.setToken(authToken);
|
26656
26678
|
});
|
26657
26679
|
}
|
26658
26680
|
/**
|
@@ -26665,6 +26687,11 @@ var init_select2 = __esm({
|
|
26665
26687
|
prepare(name2) {
|
26666
26688
|
return this._prepare(name2);
|
26667
26689
|
}
|
26690
|
+
/** @internal */
|
26691
|
+
setToken(token) {
|
26692
|
+
this.authToken = token;
|
26693
|
+
return this;
|
26694
|
+
}
|
26668
26695
|
};
|
26669
26696
|
__publicField(PgSelectBase, _a132, "PgSelect");
|
26670
26697
|
applyMixins(PgSelectBase, [QueryPromise]);
|
@@ -26794,11 +26821,22 @@ var init_insert = __esm({
|
|
26794
26821
|
init_query_builder2();
|
26795
26822
|
_a134 = entityKind;
|
26796
26823
|
PgInsertBuilder = class {
|
26797
|
-
constructor(table4, session, dialect4, withList) {
|
26824
|
+
constructor(table4, session, dialect4, withList, overridingSystemValue_) {
|
26825
|
+
__publicField(this, "authToken");
|
26798
26826
|
this.table = table4;
|
26799
26827
|
this.session = session;
|
26800
26828
|
this.dialect = dialect4;
|
26801
26829
|
this.withList = withList;
|
26830
|
+
this.overridingSystemValue_ = overridingSystemValue_;
|
26831
|
+
}
|
26832
|
+
/** @internal */
|
26833
|
+
setToken(token) {
|
26834
|
+
this.authToken = token;
|
26835
|
+
return this;
|
26836
|
+
}
|
26837
|
+
overridingSystemValue() {
|
26838
|
+
this.overridingSystemValue_ = true;
|
26839
|
+
return this;
|
26802
26840
|
}
|
26803
26841
|
values(values) {
|
26804
26842
|
values = Array.isArray(values) ? values : [values];
|
@@ -26814,7 +26852,23 @@ var init_insert = __esm({
|
|
26814
26852
|
}
|
26815
26853
|
return result;
|
26816
26854
|
});
|
26817
|
-
return
|
26855
|
+
return this.authToken === void 0 ? new PgInsertBase(
|
26856
|
+
this.table,
|
26857
|
+
mappedValues,
|
26858
|
+
this.session,
|
26859
|
+
this.dialect,
|
26860
|
+
this.withList,
|
26861
|
+
false,
|
26862
|
+
this.overridingSystemValue_
|
26863
|
+
) : new PgInsertBase(
|
26864
|
+
this.table,
|
26865
|
+
mappedValues,
|
26866
|
+
this.session,
|
26867
|
+
this.dialect,
|
26868
|
+
this.withList,
|
26869
|
+
false,
|
26870
|
+
this.overridingSystemValue_
|
26871
|
+
).setToken(this.authToken);
|
26818
26872
|
}
|
26819
26873
|
select(selectQuery) {
|
26820
26874
|
const select = typeof selectQuery === "function" ? selectQuery(new QueryBuilder()) : selectQuery;
|
@@ -26828,17 +26882,18 @@ var init_insert = __esm({
|
|
26828
26882
|
};
|
26829
26883
|
__publicField(PgInsertBuilder, _a134, "PgInsertBuilder");
|
26830
26884
|
PgInsertBase = class extends (_b101 = QueryPromise, _a135 = entityKind, _b101) {
|
26831
|
-
constructor(table4, values, session, dialect4, withList, select) {
|
26885
|
+
constructor(table4, values, session, dialect4, withList, select, overridingSystemValue_) {
|
26832
26886
|
super();
|
26833
26887
|
__publicField(this, "config");
|
26888
|
+
__publicField(this, "authToken");
|
26834
26889
|
__publicField(this, "execute", (placeholderValues) => {
|
26835
26890
|
return tracer.startActiveSpan("drizzle.operation", () => {
|
26836
|
-
return this._prepare().execute(placeholderValues);
|
26891
|
+
return this._prepare().execute(placeholderValues, this.authToken);
|
26837
26892
|
});
|
26838
26893
|
});
|
26839
26894
|
this.session = session;
|
26840
26895
|
this.dialect = dialect4;
|
26841
|
-
this.config = { table: table4, values, withList, select };
|
26896
|
+
this.config = { table: table4, values, withList, select, overridingSystemValue_ };
|
26842
26897
|
}
|
26843
26898
|
returning(fields = this.config.table[Table2.Symbol.Columns]) {
|
26844
26899
|
this.config.returning = orderSelectedFields(fields);
|
@@ -26938,6 +26993,11 @@ var init_insert = __esm({
|
|
26938
26993
|
prepare(name2) {
|
26939
26994
|
return this._prepare(name2);
|
26940
26995
|
}
|
26996
|
+
/** @internal */
|
26997
|
+
setToken(token) {
|
26998
|
+
this.authToken = token;
|
26999
|
+
return this;
|
27000
|
+
}
|
26941
27001
|
$dynamic() {
|
26942
27002
|
return this;
|
26943
27003
|
}
|
@@ -26958,9 +27018,10 @@ var init_refresh_materialized_view = __esm({
|
|
26958
27018
|
constructor(view4, session, dialect4) {
|
26959
27019
|
super();
|
26960
27020
|
__publicField(this, "config");
|
27021
|
+
__publicField(this, "authToken");
|
26961
27022
|
__publicField(this, "execute", (placeholderValues) => {
|
26962
27023
|
return tracer.startActiveSpan("drizzle.operation", () => {
|
26963
|
-
return this._prepare().execute(placeholderValues);
|
27024
|
+
return this._prepare().execute(placeholderValues, this.authToken);
|
26964
27025
|
});
|
26965
27026
|
});
|
26966
27027
|
this.session = session;
|
@@ -26998,6 +27059,11 @@ var init_refresh_materialized_view = __esm({
|
|
26998
27059
|
prepare(name2) {
|
26999
27060
|
return this._prepare(name2);
|
27000
27061
|
}
|
27062
|
+
/** @internal */
|
27063
|
+
setToken(token) {
|
27064
|
+
this.authToken = token;
|
27065
|
+
return this;
|
27066
|
+
}
|
27001
27067
|
};
|
27002
27068
|
__publicField(PgRefreshMaterializedView, _a136, "PgRefreshMaterializedView");
|
27003
27069
|
}
|
@@ -27027,19 +27093,30 @@ var init_update = __esm({
|
|
27027
27093
|
_a137 = entityKind;
|
27028
27094
|
PgUpdateBuilder = class {
|
27029
27095
|
constructor(table4, session, dialect4, withList) {
|
27096
|
+
__publicField(this, "authToken");
|
27030
27097
|
this.table = table4;
|
27031
27098
|
this.session = session;
|
27032
27099
|
this.dialect = dialect4;
|
27033
27100
|
this.withList = withList;
|
27034
27101
|
}
|
27102
|
+
setToken(token) {
|
27103
|
+
this.authToken = token;
|
27104
|
+
return this;
|
27105
|
+
}
|
27035
27106
|
set(values) {
|
27036
|
-
return new PgUpdateBase(
|
27107
|
+
return this.authToken === void 0 ? new PgUpdateBase(
|
27037
27108
|
this.table,
|
27038
27109
|
mapUpdateSet(this.table, values),
|
27039
27110
|
this.session,
|
27040
27111
|
this.dialect,
|
27041
27112
|
this.withList
|
27042
|
-
)
|
27113
|
+
) : new PgUpdateBase(
|
27114
|
+
this.table,
|
27115
|
+
mapUpdateSet(this.table, values),
|
27116
|
+
this.session,
|
27117
|
+
this.dialect,
|
27118
|
+
this.withList
|
27119
|
+
).setToken(this.authToken);
|
27043
27120
|
}
|
27044
27121
|
};
|
27045
27122
|
__publicField(PgUpdateBuilder, _a137, "PgUpdateBuilder");
|
@@ -27053,8 +27130,9 @@ var init_update = __esm({
|
|
27053
27130
|
__publicField(this, "rightJoin", this.createJoin("right"));
|
27054
27131
|
__publicField(this, "innerJoin", this.createJoin("inner"));
|
27055
27132
|
__publicField(this, "fullJoin", this.createJoin("full"));
|
27133
|
+
__publicField(this, "authToken");
|
27056
27134
|
__publicField(this, "execute", (placeholderValues) => {
|
27057
|
-
return this._prepare().execute(placeholderValues);
|
27135
|
+
return this._prepare().execute(placeholderValues, this.authToken);
|
27058
27136
|
});
|
27059
27137
|
this.session = session;
|
27060
27138
|
this.dialect = dialect4;
|
@@ -27202,6 +27280,11 @@ var init_update = __esm({
|
|
27202
27280
|
prepare(name2) {
|
27203
27281
|
return this._prepare(name2);
|
27204
27282
|
}
|
27283
|
+
/** @internal */
|
27284
|
+
setToken(token) {
|
27285
|
+
this.authToken = token;
|
27286
|
+
return this;
|
27287
|
+
}
|
27205
27288
|
$dynamic() {
|
27206
27289
|
return this;
|
27207
27290
|
}
|
@@ -27235,6 +27318,7 @@ var init_count = __esm({
|
|
27235
27318
|
constructor(params) {
|
27236
27319
|
super(_PgCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
|
27237
27320
|
__publicField(this, "sql");
|
27321
|
+
__publicField(this, "token");
|
27238
27322
|
__publicField(this, _a139, "PgCountBuilder");
|
27239
27323
|
__publicField(this, "session");
|
27240
27324
|
this.params = params;
|
@@ -27251,8 +27335,12 @@ var init_count = __esm({
|
|
27251
27335
|
static buildCount(source, filters) {
|
27252
27336
|
return sql`select count(*) as count from ${source}${sql.raw(" where ").if(filters)}${filters};`;
|
27253
27337
|
}
|
27338
|
+
/** @intrnal */
|
27339
|
+
setToken(token) {
|
27340
|
+
this.token = token;
|
27341
|
+
}
|
27254
27342
|
then(onfulfilled, onrejected) {
|
27255
|
-
return Promise.resolve(this.session.count(this.sql)).then(
|
27343
|
+
return Promise.resolve(this.session.count(this.sql, this.token)).then(
|
27256
27344
|
onfulfilled,
|
27257
27345
|
onrejected
|
27258
27346
|
);
|
@@ -27329,6 +27417,7 @@ var init_query = __esm({
|
|
27329
27417
|
PgRelationalQuery = class extends (_b105 = QueryPromise, _a141 = entityKind, _b105) {
|
27330
27418
|
constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, mode) {
|
27331
27419
|
super();
|
27420
|
+
__publicField(this, "authToken");
|
27332
27421
|
this.fullSchema = fullSchema;
|
27333
27422
|
this.schema = schema4;
|
27334
27423
|
this.tableNamesMap = tableNamesMap;
|
@@ -27386,9 +27475,14 @@ var init_query = __esm({
|
|
27386
27475
|
toSQL() {
|
27387
27476
|
return this._toSQL().builtQuery;
|
27388
27477
|
}
|
27478
|
+
/** @internal */
|
27479
|
+
setToken(token) {
|
27480
|
+
this.authToken = token;
|
27481
|
+
return this;
|
27482
|
+
}
|
27389
27483
|
execute() {
|
27390
27484
|
return tracer.startActiveSpan("drizzle.operation", () => {
|
27391
|
-
return this._prepare().execute();
|
27485
|
+
return this._prepare().execute(void 0, this.authToken);
|
27392
27486
|
});
|
27393
27487
|
}
|
27394
27488
|
};
|
@@ -27451,6 +27545,7 @@ var init_db = __esm({
|
|
27451
27545
|
PgDatabase = class {
|
27452
27546
|
constructor(dialect4, session, schema4) {
|
27453
27547
|
__publicField(this, "query");
|
27548
|
+
__publicField(this, "authToken");
|
27454
27549
|
this.dialect = dialect4;
|
27455
27550
|
this.session = session;
|
27456
27551
|
this._ = schema4 ? {
|
@@ -27706,7 +27801,7 @@ var init_db = __esm({
|
|
27706
27801
|
false
|
27707
27802
|
);
|
27708
27803
|
return new PgRaw(
|
27709
|
-
() => prepared.execute(),
|
27804
|
+
() => prepared.execute(void 0, this.authToken),
|
27710
27805
|
sequel,
|
27711
27806
|
builtQuery,
|
27712
27807
|
(result) => prepared.mapResult(result, true)
|
@@ -28251,6 +28346,7 @@ var init_session = __esm({
|
|
28251
28346
|
_a159 = entityKind;
|
28252
28347
|
PgPreparedQuery = class {
|
28253
28348
|
constructor(query) {
|
28349
|
+
__publicField(this, "authToken");
|
28254
28350
|
/** @internal */
|
28255
28351
|
__publicField(this, "joinsNotNullableMap");
|
28256
28352
|
this.query = query;
|
@@ -28261,6 +28357,11 @@ var init_session = __esm({
|
|
28261
28357
|
mapResult(response, _isFromBatch) {
|
28262
28358
|
return response;
|
28263
28359
|
}
|
28360
|
+
/** @internal */
|
28361
|
+
setToken(token) {
|
28362
|
+
this.authToken = token;
|
28363
|
+
return this;
|
28364
|
+
}
|
28264
28365
|
};
|
28265
28366
|
__publicField(PgPreparedQuery, _a159, "PgPreparedQuery");
|
28266
28367
|
_a160 = entityKind;
|
@@ -28268,7 +28369,8 @@ var init_session = __esm({
|
|
28268
28369
|
constructor(dialect4) {
|
28269
28370
|
this.dialect = dialect4;
|
28270
28371
|
}
|
28271
|
-
|
28372
|
+
/** @internal */
|
28373
|
+
execute(query, token) {
|
28272
28374
|
return tracer.startActiveSpan("drizzle.operation", () => {
|
28273
28375
|
const prepared = tracer.startActiveSpan("drizzle.prepareQuery", () => {
|
28274
28376
|
return this.prepareQuery(
|
@@ -28278,7 +28380,7 @@ var init_session = __esm({
|
|
28278
28380
|
false
|
28279
28381
|
);
|
28280
28382
|
});
|
28281
|
-
return prepared.execute();
|
28383
|
+
return prepared.setToken(token).execute(void 0, token);
|
28282
28384
|
});
|
28283
28385
|
}
|
28284
28386
|
all(query) {
|
@@ -28289,8 +28391,9 @@ var init_session = __esm({
|
|
28289
28391
|
false
|
28290
28392
|
).all();
|
28291
28393
|
}
|
28292
|
-
|
28293
|
-
|
28394
|
+
/** @internal */
|
28395
|
+
async count(sql2, token) {
|
28396
|
+
const res = await this.execute(sql2, token);
|
28294
28397
|
return Number(
|
28295
28398
|
res[0]["count"]
|
28296
28399
|
);
|