drizzle-kit 1.0.0-beta.1-34ee105 → 1.0.0-beta.1-69a2ca0
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 +471 -99
- package/api.mjs +471 -99
- package/bin.cjs +1 -1
- package/package.json +1 -1
package/api.js
CHANGED
|
@@ -3479,17 +3479,17 @@ function processCreateParams(params) {
|
|
|
3479
3479
|
if (errorMap2)
|
|
3480
3480
|
return { errorMap: errorMap2, description };
|
|
3481
3481
|
const customMap = (iss, ctx) => {
|
|
3482
|
-
var
|
|
3482
|
+
var _a460, _b339;
|
|
3483
3483
|
const { message } = params;
|
|
3484
3484
|
if (iss.code === "invalid_enum_value") {
|
|
3485
3485
|
return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
|
|
3486
3486
|
}
|
|
3487
3487
|
if (typeof ctx.data === "undefined") {
|
|
3488
|
-
return { message: (
|
|
3488
|
+
return { message: (_a460 = message !== null && message !== void 0 ? message : required_error) !== null && _a460 !== void 0 ? _a460 : ctx.defaultError };
|
|
3489
3489
|
}
|
|
3490
3490
|
if (iss.code !== "invalid_type")
|
|
3491
3491
|
return { message: ctx.defaultError };
|
|
3492
|
-
return { message: (
|
|
3492
|
+
return { message: (_b339 = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b339 !== void 0 ? _b339 : ctx.defaultError };
|
|
3493
3493
|
};
|
|
3494
3494
|
return { errorMap: customMap, description };
|
|
3495
3495
|
}
|
|
@@ -4151,11 +4151,11 @@ var init_lib = __esm({
|
|
|
4151
4151
|
throw result.error;
|
|
4152
4152
|
}
|
|
4153
4153
|
safeParse(data, params) {
|
|
4154
|
-
var
|
|
4154
|
+
var _a460;
|
|
4155
4155
|
const ctx = {
|
|
4156
4156
|
common: {
|
|
4157
4157
|
issues: [],
|
|
4158
|
-
async: (
|
|
4158
|
+
async: (_a460 = params === null || params === void 0 ? void 0 : params.async) !== null && _a460 !== void 0 ? _a460 : false,
|
|
4159
4159
|
contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
|
|
4160
4160
|
},
|
|
4161
4161
|
path: (params === null || params === void 0 ? void 0 : params.path) || [],
|
|
@@ -4477,7 +4477,7 @@ var init_lib = __esm({
|
|
|
4477
4477
|
} else if (check.kind === "url") {
|
|
4478
4478
|
try {
|
|
4479
4479
|
new URL(input.data);
|
|
4480
|
-
} catch (
|
|
4480
|
+
} catch (_a460) {
|
|
4481
4481
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
4482
4482
|
addIssueToContext(ctx, {
|
|
4483
4483
|
validation: "url",
|
|
@@ -4647,7 +4647,7 @@ var init_lib = __esm({
|
|
|
4647
4647
|
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
|
4648
4648
|
}
|
|
4649
4649
|
datetime(options) {
|
|
4650
|
-
var
|
|
4650
|
+
var _a460, _b339;
|
|
4651
4651
|
if (typeof options === "string") {
|
|
4652
4652
|
return this._addCheck({
|
|
4653
4653
|
kind: "datetime",
|
|
@@ -4660,8 +4660,8 @@ var init_lib = __esm({
|
|
|
4660
4660
|
return this._addCheck({
|
|
4661
4661
|
kind: "datetime",
|
|
4662
4662
|
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
4663
|
-
offset: (
|
|
4664
|
-
local: (
|
|
4663
|
+
offset: (_a460 = options === null || options === void 0 ? void 0 : options.offset) !== null && _a460 !== void 0 ? _a460 : false,
|
|
4664
|
+
local: (_b339 = options === null || options === void 0 ? void 0 : options.local) !== null && _b339 !== void 0 ? _b339 : false,
|
|
4665
4665
|
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
4666
4666
|
});
|
|
4667
4667
|
}
|
|
@@ -4824,11 +4824,11 @@ var init_lib = __esm({
|
|
|
4824
4824
|
}
|
|
4825
4825
|
};
|
|
4826
4826
|
ZodString.create = (params) => {
|
|
4827
|
-
var
|
|
4827
|
+
var _a460;
|
|
4828
4828
|
return new ZodString({
|
|
4829
4829
|
checks: [],
|
|
4830
4830
|
typeName: ZodFirstPartyTypeKind.ZodString,
|
|
4831
|
-
coerce: (
|
|
4831
|
+
coerce: (_a460 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a460 !== void 0 ? _a460 : false,
|
|
4832
4832
|
...processCreateParams(params)
|
|
4833
4833
|
});
|
|
4834
4834
|
};
|
|
@@ -5221,11 +5221,11 @@ var init_lib = __esm({
|
|
|
5221
5221
|
}
|
|
5222
5222
|
};
|
|
5223
5223
|
ZodBigInt.create = (params) => {
|
|
5224
|
-
var
|
|
5224
|
+
var _a460;
|
|
5225
5225
|
return new ZodBigInt({
|
|
5226
5226
|
checks: [],
|
|
5227
5227
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
5228
|
-
coerce: (
|
|
5228
|
+
coerce: (_a460 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a460 !== void 0 ? _a460 : false,
|
|
5229
5229
|
...processCreateParams(params)
|
|
5230
5230
|
});
|
|
5231
5231
|
};
|
|
@@ -5705,8 +5705,8 @@ var init_lib = __esm({
|
|
|
5705
5705
|
unknownKeys: "strict",
|
|
5706
5706
|
...message !== void 0 ? {
|
|
5707
5707
|
errorMap: (issue, ctx) => {
|
|
5708
|
-
var
|
|
5709
|
-
const defaultError = (_c14 = (
|
|
5708
|
+
var _a460, _b339, _c14, _d6;
|
|
5709
|
+
const defaultError = (_c14 = (_b339 = (_a460 = this._def).errorMap) === null || _b339 === void 0 ? void 0 : _b339.call(_a460, issue, ctx).message) !== null && _c14 !== void 0 ? _c14 : ctx.defaultError;
|
|
5710
5710
|
if (issue.code === "unrecognized_keys")
|
|
5711
5711
|
return {
|
|
5712
5712
|
message: (_d6 = errorUtil.errToObj(message).message) !== null && _d6 !== void 0 ? _d6 : defaultError
|
|
@@ -23058,8 +23058,8 @@ var init_sql = __esm({
|
|
|
23058
23058
|
sql2.param = param2;
|
|
23059
23059
|
})(sql || (sql = {}));
|
|
23060
23060
|
((SQL2) => {
|
|
23061
|
-
var
|
|
23062
|
-
|
|
23061
|
+
var _a460;
|
|
23062
|
+
_a460 = entityKind;
|
|
23063
23063
|
const _Aliased = class _Aliased {
|
|
23064
23064
|
constructor(sql2, fieldAlias) {
|
|
23065
23065
|
/** @internal */
|
|
@@ -23075,7 +23075,7 @@ var init_sql = __esm({
|
|
|
23075
23075
|
return new _Aliased(this.sql, this.fieldAlias);
|
|
23076
23076
|
}
|
|
23077
23077
|
};
|
|
23078
|
-
__publicField(_Aliased,
|
|
23078
|
+
__publicField(_Aliased, _a460, "SQL.Aliased");
|
|
23079
23079
|
let Aliased = _Aliased;
|
|
23080
23080
|
SQL2.Aliased = Aliased;
|
|
23081
23081
|
})(SQL || (SQL = {}));
|
|
@@ -23722,12 +23722,15 @@ function buildRelationsParts(tables, config) {
|
|
|
23722
23722
|
function getOrderByOperators() {
|
|
23723
23723
|
return orderByOperators;
|
|
23724
23724
|
}
|
|
23725
|
-
function mapRelationalRow(row, buildQueryResultSelection, mapColumnValue = (value) => value, parseJson = false, path2) {
|
|
23725
|
+
function mapRelationalRow(row, buildQueryResultSelection, mapColumnValue = (value) => value, parseJson = false, parseJsonIfString = false, path2) {
|
|
23726
23726
|
for (const selectionItem of buildQueryResultSelection) {
|
|
23727
23727
|
if (selectionItem.selection) {
|
|
23728
23728
|
const currentPath = `${path2 ? `${path2}.` : ""}${selectionItem.key}`;
|
|
23729
23729
|
if (row[selectionItem.key] === null) continue;
|
|
23730
23730
|
if (parseJson) row[selectionItem.key] = JSON.parse(row[selectionItem.key]);
|
|
23731
|
+
if (parseJsonIfString && typeof row[selectionItem.key] === "string") {
|
|
23732
|
+
row[selectionItem.key] = JSON.parse(row[selectionItem.key]);
|
|
23733
|
+
}
|
|
23731
23734
|
if (selectionItem.isArray) {
|
|
23732
23735
|
for (const item of row[selectionItem.key]) {
|
|
23733
23736
|
mapRelationalRow(
|
|
@@ -23735,6 +23738,7 @@ function mapRelationalRow(row, buildQueryResultSelection, mapColumnValue = (valu
|
|
|
23735
23738
|
selectionItem.selection,
|
|
23736
23739
|
mapColumnValue,
|
|
23737
23740
|
false,
|
|
23741
|
+
parseJsonIfString,
|
|
23738
23742
|
currentPath
|
|
23739
23743
|
);
|
|
23740
23744
|
}
|
|
@@ -23745,6 +23749,7 @@ function mapRelationalRow(row, buildQueryResultSelection, mapColumnValue = (valu
|
|
|
23745
23749
|
selectionItem.selection,
|
|
23746
23750
|
mapColumnValue,
|
|
23747
23751
|
false,
|
|
23752
|
+
parseJsonIfString,
|
|
23748
23753
|
currentPath
|
|
23749
23754
|
);
|
|
23750
23755
|
continue;
|
|
@@ -40601,7 +40606,7 @@ var init_dialect3 = __esm({
|
|
|
40601
40606
|
mode,
|
|
40602
40607
|
errorPath,
|
|
40603
40608
|
depth,
|
|
40604
|
-
|
|
40609
|
+
isNestedMany,
|
|
40605
40610
|
throughJoin
|
|
40606
40611
|
}) {
|
|
40607
40612
|
const selection = [];
|
|
@@ -40650,7 +40655,7 @@ var init_dialect3 = __esm({
|
|
|
40650
40655
|
relationWhere: filter2,
|
|
40651
40656
|
errorPath: `${currentPath.length ? `${currentPath}.` : ""}${k}`,
|
|
40652
40657
|
depth: currentDepth + 1,
|
|
40653
|
-
|
|
40658
|
+
isNestedMany: !isSingle2,
|
|
40654
40659
|
throughJoin: throughJoin2
|
|
40655
40660
|
});
|
|
40656
40661
|
selection.push({
|
|
@@ -40675,7 +40680,7 @@ var init_dialect3 = __esm({
|
|
|
40675
40680
|
message: `No fields selected for table "${tableConfig.name}"${currentPath ? ` ("${currentPath}")` : ""}`
|
|
40676
40681
|
});
|
|
40677
40682
|
}
|
|
40678
|
-
if (
|
|
40683
|
+
if (isNestedMany && order) {
|
|
40679
40684
|
selectionArr.push(sql`row_number() over (order by ${order})`);
|
|
40680
40685
|
}
|
|
40681
40686
|
const selectionSet = sql.join(selectionArr, sql`, `);
|
|
@@ -44605,6 +44610,10 @@ var init_float2 = __esm({
|
|
|
44605
44610
|
}
|
|
44606
44611
|
return this.unsigned ? `${type} unsigned` : type;
|
|
44607
44612
|
}
|
|
44613
|
+
mapFromDriverValue(value) {
|
|
44614
|
+
if (typeof value !== "number") return Number(value);
|
|
44615
|
+
return value;
|
|
44616
|
+
}
|
|
44608
44617
|
};
|
|
44609
44618
|
__publicField(SingleStoreFloat, _a401, "SingleStoreFloat");
|
|
44610
44619
|
}
|
|
@@ -45186,9 +45195,9 @@ var init_varchar3 = __esm({
|
|
|
45186
45195
|
// ../drizzle-orm/dist/singlestore-core/columns/vector.js
|
|
45187
45196
|
function vector2(a, b) {
|
|
45188
45197
|
const { name: name2, config } = getColumnNameAndConfig(a, b);
|
|
45189
|
-
return new SingleStoreVectorBuilder(name2, config);
|
|
45198
|
+
return config.elementType === "I64" ? new SingleStoreBigIntVectorBuilder(name2, config) : new SingleStoreVectorBuilder(name2, config);
|
|
45190
45199
|
}
|
|
45191
|
-
var _a430, _b324, SingleStoreVectorBuilder, _a431, _b325, SingleStoreVector;
|
|
45200
|
+
var _a430, _b324, SingleStoreVectorBuilder, _a431, _b325, SingleStoreVector, _a432, _b326, SingleStoreBigIntVectorBuilder, _a433, _b327, SingleStoreBigIntVector;
|
|
45192
45201
|
var init_vector4 = __esm({
|
|
45193
45202
|
"../drizzle-orm/dist/singlestore-core/columns/vector.js"() {
|
|
45194
45203
|
"use strict";
|
|
@@ -45224,13 +45233,81 @@ var init_vector4 = __esm({
|
|
|
45224
45233
|
return `vector(${this.config.length}, ${this.elementType || "F32"})`;
|
|
45225
45234
|
}
|
|
45226
45235
|
mapToDriverValue(value) {
|
|
45227
|
-
return
|
|
45236
|
+
return `[${value.map((e) => e.toString()).join(",")}]`;
|
|
45228
45237
|
}
|
|
45229
45238
|
mapFromDriverValue(value) {
|
|
45230
|
-
|
|
45239
|
+
if (typeof value === "string") {
|
|
45240
|
+
if (value.startsWith("[")) return value.slice(1, -1).split(",").map(Number);
|
|
45241
|
+
value = Buffer.from(value, "hex");
|
|
45242
|
+
}
|
|
45243
|
+
if (Buffer.isBuffer(value)) {
|
|
45244
|
+
const type = this.elementType || "F32";
|
|
45245
|
+
const bytearr = new Uint8Array(value);
|
|
45246
|
+
switch (type) {
|
|
45247
|
+
case "I8": {
|
|
45248
|
+
return Array.from(new Int8Array(bytearr.buffer, 0, bytearr.length / 1));
|
|
45249
|
+
}
|
|
45250
|
+
case "I16": {
|
|
45251
|
+
return Array.from(new Int16Array(bytearr.buffer, 0, bytearr.length / 2));
|
|
45252
|
+
}
|
|
45253
|
+
case "I32": {
|
|
45254
|
+
return Array.from(new Int32Array(bytearr.buffer, 0, bytearr.length / 4));
|
|
45255
|
+
}
|
|
45256
|
+
case "F32": {
|
|
45257
|
+
return Array.from(new Float32Array(bytearr.buffer, 0, bytearr.length / 4));
|
|
45258
|
+
}
|
|
45259
|
+
case "F64": {
|
|
45260
|
+
return Array.from(new Float64Array(bytearr.buffer, 0, bytearr.length / 8));
|
|
45261
|
+
}
|
|
45262
|
+
}
|
|
45263
|
+
}
|
|
45264
|
+
return value;
|
|
45231
45265
|
}
|
|
45232
45266
|
};
|
|
45233
45267
|
__publicField(SingleStoreVector, _a431, "SingleStoreVector");
|
|
45268
|
+
SingleStoreBigIntVectorBuilder = class extends (_b326 = SingleStoreColumnBuilder, _a432 = entityKind, _b326) {
|
|
45269
|
+
constructor(name2, config) {
|
|
45270
|
+
super(name2, "array int64vector", "SingleStoreBigIntVector");
|
|
45271
|
+
this.config.length = config.dimensions;
|
|
45272
|
+
this.config.isLengthExact = true;
|
|
45273
|
+
}
|
|
45274
|
+
/** @internal */
|
|
45275
|
+
build(table6) {
|
|
45276
|
+
return new SingleStoreBigIntVector(
|
|
45277
|
+
table6,
|
|
45278
|
+
this.config
|
|
45279
|
+
);
|
|
45280
|
+
}
|
|
45281
|
+
/** @internal */
|
|
45282
|
+
generatedAlwaysAs(as, config) {
|
|
45283
|
+
throw new Error("Method not implemented.");
|
|
45284
|
+
}
|
|
45285
|
+
};
|
|
45286
|
+
__publicField(SingleStoreBigIntVectorBuilder, _a432, "SingleStoreBigIntVectorBuilder");
|
|
45287
|
+
SingleStoreBigIntVector = class extends (_b327 = SingleStoreColumn, _a433 = entityKind, _b327) {
|
|
45288
|
+
constructor() {
|
|
45289
|
+
super(...arguments);
|
|
45290
|
+
__publicField(this, "elementType", "I64");
|
|
45291
|
+
}
|
|
45292
|
+
getSQLType() {
|
|
45293
|
+
return `vector(${this.config.length}, ${this.elementType}})`;
|
|
45294
|
+
}
|
|
45295
|
+
mapToDriverValue(value) {
|
|
45296
|
+
return `[${value.map((e) => e.toString()).join(",")}]`;
|
|
45297
|
+
}
|
|
45298
|
+
mapFromDriverValue(value) {
|
|
45299
|
+
if (typeof value === "string") {
|
|
45300
|
+
if (value.startsWith("[")) return value.slice(1, -1).split(",").map(BigInt);
|
|
45301
|
+
value = Buffer.from(value, "hex");
|
|
45302
|
+
}
|
|
45303
|
+
if (Buffer.isBuffer(value)) {
|
|
45304
|
+
const bytearr = new Uint8Array(value);
|
|
45305
|
+
return Array.from(new BigInt64Array(bytearr.buffer, 0, bytearr.length / 8));
|
|
45306
|
+
}
|
|
45307
|
+
return value;
|
|
45308
|
+
}
|
|
45309
|
+
};
|
|
45310
|
+
__publicField(SingleStoreBigIntVector, _a433, "SingleStoreBigIntVector");
|
|
45234
45311
|
}
|
|
45235
45312
|
});
|
|
45236
45313
|
|
|
@@ -45238,13 +45315,13 @@ var init_vector4 = __esm({
|
|
|
45238
45315
|
function year2(name2) {
|
|
45239
45316
|
return new SingleStoreYearBuilder(name2 ?? "");
|
|
45240
45317
|
}
|
|
45241
|
-
var
|
|
45318
|
+
var _a434, _b328, SingleStoreYearBuilder, _a435, _b329, SingleStoreYear;
|
|
45242
45319
|
var init_year2 = __esm({
|
|
45243
45320
|
"../drizzle-orm/dist/singlestore-core/columns/year.js"() {
|
|
45244
45321
|
"use strict";
|
|
45245
45322
|
init_entity();
|
|
45246
45323
|
init_common5();
|
|
45247
|
-
SingleStoreYearBuilder = class extends (
|
|
45324
|
+
SingleStoreYearBuilder = class extends (_b328 = SingleStoreColumnBuilder, _a434 = entityKind, _b328) {
|
|
45248
45325
|
constructor(name2) {
|
|
45249
45326
|
super(name2, "number year", "SingleStoreYear");
|
|
45250
45327
|
}
|
|
@@ -45256,13 +45333,17 @@ var init_year2 = __esm({
|
|
|
45256
45333
|
);
|
|
45257
45334
|
}
|
|
45258
45335
|
};
|
|
45259
|
-
__publicField(SingleStoreYearBuilder,
|
|
45260
|
-
SingleStoreYear = class extends (
|
|
45336
|
+
__publicField(SingleStoreYearBuilder, _a434, "SingleStoreYearBuilder");
|
|
45337
|
+
SingleStoreYear = class extends (_b329 = SingleStoreColumn, _a435 = entityKind, _b329) {
|
|
45261
45338
|
getSQLType() {
|
|
45262
45339
|
return `year`;
|
|
45263
45340
|
}
|
|
45341
|
+
mapFromDriverValue(value) {
|
|
45342
|
+
if (typeof value !== "number") return Number(value);
|
|
45343
|
+
return value;
|
|
45344
|
+
}
|
|
45264
45345
|
};
|
|
45265
|
-
__publicField(SingleStoreYear,
|
|
45346
|
+
__publicField(SingleStoreYear, _a435, "SingleStoreYear");
|
|
45266
45347
|
}
|
|
45267
45348
|
});
|
|
45268
45349
|
|
|
@@ -45300,17 +45381,17 @@ var init_columns4 = __esm({
|
|
|
45300
45381
|
});
|
|
45301
45382
|
|
|
45302
45383
|
// ../drizzle-orm/dist/singlestore-core/query-builders/count.js
|
|
45303
|
-
var
|
|
45384
|
+
var _a436, _b330, _c12, _SingleStoreCountBuilder, SingleStoreCountBuilder;
|
|
45304
45385
|
var init_count4 = __esm({
|
|
45305
45386
|
"../drizzle-orm/dist/singlestore-core/query-builders/count.js"() {
|
|
45306
45387
|
"use strict";
|
|
45307
45388
|
init_entity();
|
|
45308
45389
|
init_sql();
|
|
45309
|
-
_SingleStoreCountBuilder = class _SingleStoreCountBuilder extends (_c12 = SQL,
|
|
45390
|
+
_SingleStoreCountBuilder = class _SingleStoreCountBuilder extends (_c12 = SQL, _b330 = entityKind, _a436 = Symbol.toStringTag, _c12) {
|
|
45310
45391
|
constructor(params) {
|
|
45311
45392
|
super(_SingleStoreCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
|
|
45312
45393
|
__publicField(this, "sql");
|
|
45313
|
-
__publicField(this,
|
|
45394
|
+
__publicField(this, _a436, "SingleStoreCountBuilder");
|
|
45314
45395
|
__publicField(this, "session");
|
|
45315
45396
|
this.params = params;
|
|
45316
45397
|
this.mapWith(Number);
|
|
@@ -45348,18 +45429,18 @@ var init_count4 = __esm({
|
|
|
45348
45429
|
);
|
|
45349
45430
|
}
|
|
45350
45431
|
};
|
|
45351
|
-
__publicField(_SingleStoreCountBuilder,
|
|
45432
|
+
__publicField(_SingleStoreCountBuilder, _b330, "SingleStoreCountBuilder");
|
|
45352
45433
|
SingleStoreCountBuilder = _SingleStoreCountBuilder;
|
|
45353
45434
|
}
|
|
45354
45435
|
});
|
|
45355
45436
|
|
|
45356
45437
|
// ../drizzle-orm/dist/singlestore-core/indexes.js
|
|
45357
|
-
var
|
|
45438
|
+
var _a437, IndexBuilderOn4, _a438, IndexBuilder4, _a439, Index6;
|
|
45358
45439
|
var init_indexes4 = __esm({
|
|
45359
45440
|
"../drizzle-orm/dist/singlestore-core/indexes.js"() {
|
|
45360
45441
|
"use strict";
|
|
45361
45442
|
init_entity();
|
|
45362
|
-
|
|
45443
|
+
_a437 = entityKind;
|
|
45363
45444
|
IndexBuilderOn4 = class {
|
|
45364
45445
|
constructor(name2, unique) {
|
|
45365
45446
|
this.name = name2;
|
|
@@ -45369,8 +45450,8 @@ var init_indexes4 = __esm({
|
|
|
45369
45450
|
return new IndexBuilder4(this.name, columns, this.unique);
|
|
45370
45451
|
}
|
|
45371
45452
|
};
|
|
45372
|
-
__publicField(IndexBuilderOn4,
|
|
45373
|
-
|
|
45453
|
+
__publicField(IndexBuilderOn4, _a437, "SingleStoreIndexBuilderOn");
|
|
45454
|
+
_a438 = entityKind;
|
|
45374
45455
|
IndexBuilder4 = class {
|
|
45375
45456
|
constructor(name2, columns, unique) {
|
|
45376
45457
|
/** @internal */
|
|
@@ -45398,15 +45479,15 @@ var init_indexes4 = __esm({
|
|
|
45398
45479
|
return new Index6(this.config, table6);
|
|
45399
45480
|
}
|
|
45400
45481
|
};
|
|
45401
|
-
__publicField(IndexBuilder4,
|
|
45402
|
-
|
|
45482
|
+
__publicField(IndexBuilder4, _a438, "SingleStoreIndexBuilder");
|
|
45483
|
+
_a439 = entityKind;
|
|
45403
45484
|
Index6 = class {
|
|
45404
45485
|
constructor(config, table6) {
|
|
45405
45486
|
__publicField(this, "config");
|
|
45406
45487
|
this.config = { ...config, table: table6 };
|
|
45407
45488
|
}
|
|
45408
45489
|
};
|
|
45409
|
-
__publicField(Index6,
|
|
45490
|
+
__publicField(Index6, _a439, "SingleStoreIndex");
|
|
45410
45491
|
}
|
|
45411
45492
|
});
|
|
45412
45493
|
|
|
@@ -45494,20 +45575,20 @@ function singlestoreTableWithSchema(name2, columns, extraConfig, schema5, baseNa
|
|
|
45494
45575
|
}
|
|
45495
45576
|
return table6;
|
|
45496
45577
|
}
|
|
45497
|
-
var
|
|
45578
|
+
var _a440, _b331, _c13, _d5, SingleStoreTable;
|
|
45498
45579
|
var init_table5 = __esm({
|
|
45499
45580
|
"../drizzle-orm/dist/singlestore-core/table.js"() {
|
|
45500
45581
|
"use strict";
|
|
45501
45582
|
init_entity();
|
|
45502
45583
|
init_table();
|
|
45503
45584
|
init_all4();
|
|
45504
|
-
SingleStoreTable = class extends (_d5 = Table2, _c13 = entityKind,
|
|
45585
|
+
SingleStoreTable = class extends (_d5 = Table2, _c13 = entityKind, _b331 = Table2.Symbol.Columns, _a440 = Table2.Symbol.ExtraConfigBuilder, _d5) {
|
|
45505
45586
|
constructor() {
|
|
45506
45587
|
super(...arguments);
|
|
45507
45588
|
/** @internal */
|
|
45508
|
-
__publicField(this,
|
|
45589
|
+
__publicField(this, _b331);
|
|
45509
45590
|
/** @internal */
|
|
45510
|
-
__publicField(this,
|
|
45591
|
+
__publicField(this, _a440);
|
|
45511
45592
|
}
|
|
45512
45593
|
};
|
|
45513
45594
|
__publicField(SingleStoreTable, _c13, "SingleStoreTable");
|
|
@@ -45517,13 +45598,13 @@ var init_table5 = __esm({
|
|
|
45517
45598
|
});
|
|
45518
45599
|
|
|
45519
45600
|
// ../drizzle-orm/dist/singlestore-core/primary-keys.js
|
|
45520
|
-
var
|
|
45601
|
+
var _a441, PrimaryKeyBuilder4, _a442, PrimaryKey4;
|
|
45521
45602
|
var init_primary_keys4 = __esm({
|
|
45522
45603
|
"../drizzle-orm/dist/singlestore-core/primary-keys.js"() {
|
|
45523
45604
|
"use strict";
|
|
45524
45605
|
init_entity();
|
|
45525
45606
|
init_table5();
|
|
45526
|
-
|
|
45607
|
+
_a441 = entityKind;
|
|
45527
45608
|
PrimaryKeyBuilder4 = class {
|
|
45528
45609
|
constructor(columns, name2) {
|
|
45529
45610
|
/** @internal */
|
|
@@ -45538,8 +45619,8 @@ var init_primary_keys4 = __esm({
|
|
|
45538
45619
|
return new PrimaryKey4(table6, this.columns, this.name);
|
|
45539
45620
|
}
|
|
45540
45621
|
};
|
|
45541
|
-
__publicField(PrimaryKeyBuilder4,
|
|
45542
|
-
|
|
45622
|
+
__publicField(PrimaryKeyBuilder4, _a441, "SingleStorePrimaryKeyBuilder");
|
|
45623
|
+
_a442 = entityKind;
|
|
45543
45624
|
PrimaryKey4 = class {
|
|
45544
45625
|
constructor(table6, columns, name2) {
|
|
45545
45626
|
__publicField(this, "columns");
|
|
@@ -45552,7 +45633,7 @@ var init_primary_keys4 = __esm({
|
|
|
45552
45633
|
return this.name ?? `${this.table[SingleStoreTable.Symbol.Name]}_${this.columns.map((column6) => column6.name).join("_")}_pk`;
|
|
45553
45634
|
}
|
|
45554
45635
|
};
|
|
45555
|
-
__publicField(PrimaryKey4,
|
|
45636
|
+
__publicField(PrimaryKey4, _a442, "SingleStorePrimaryKey");
|
|
45556
45637
|
}
|
|
45557
45638
|
});
|
|
45558
45639
|
|
|
@@ -45616,7 +45697,7 @@ var init_utils10 = __esm({
|
|
|
45616
45697
|
});
|
|
45617
45698
|
|
|
45618
45699
|
// ../drizzle-orm/dist/singlestore-core/query-builders/delete.js
|
|
45619
|
-
var
|
|
45700
|
+
var _a443, _b332, SingleStoreDeleteBase;
|
|
45620
45701
|
var init_delete4 = __esm({
|
|
45621
45702
|
"../drizzle-orm/dist/singlestore-core/query-builders/delete.js"() {
|
|
45622
45703
|
"use strict";
|
|
@@ -45625,7 +45706,7 @@ var init_delete4 = __esm({
|
|
|
45625
45706
|
init_selection_proxy();
|
|
45626
45707
|
init_table();
|
|
45627
45708
|
init_utils10();
|
|
45628
|
-
SingleStoreDeleteBase = class extends (
|
|
45709
|
+
SingleStoreDeleteBase = class extends (_b332 = QueryPromise, _a443 = entityKind, _b332) {
|
|
45629
45710
|
constructor(table6, session, dialect6, withList) {
|
|
45630
45711
|
super();
|
|
45631
45712
|
__publicField(this, "config");
|
|
@@ -45722,12 +45803,12 @@ var init_delete4 = __esm({
|
|
|
45722
45803
|
return this;
|
|
45723
45804
|
}
|
|
45724
45805
|
};
|
|
45725
|
-
__publicField(SingleStoreDeleteBase,
|
|
45806
|
+
__publicField(SingleStoreDeleteBase, _a443, "SingleStoreDelete");
|
|
45726
45807
|
}
|
|
45727
45808
|
});
|
|
45728
45809
|
|
|
45729
45810
|
// ../drizzle-orm/dist/singlestore-core/query-builders/insert.js
|
|
45730
|
-
var
|
|
45811
|
+
var _a444, SingleStoreInsertBuilder, _a445, _b333, SingleStoreInsertBase;
|
|
45731
45812
|
var init_insert4 = __esm({
|
|
45732
45813
|
"../drizzle-orm/dist/singlestore-core/query-builders/insert.js"() {
|
|
45733
45814
|
"use strict";
|
|
@@ -45737,7 +45818,7 @@ var init_insert4 = __esm({
|
|
|
45737
45818
|
init_table();
|
|
45738
45819
|
init_utils2();
|
|
45739
45820
|
init_utils10();
|
|
45740
|
-
|
|
45821
|
+
_a444 = entityKind;
|
|
45741
45822
|
SingleStoreInsertBuilder = class {
|
|
45742
45823
|
constructor(table6, session, dialect6) {
|
|
45743
45824
|
__publicField(this, "shouldIgnore", false);
|
|
@@ -45766,8 +45847,8 @@ var init_insert4 = __esm({
|
|
|
45766
45847
|
return new SingleStoreInsertBase(this.table, mappedValues, this.shouldIgnore, this.session, this.dialect);
|
|
45767
45848
|
}
|
|
45768
45849
|
};
|
|
45769
|
-
__publicField(SingleStoreInsertBuilder,
|
|
45770
|
-
SingleStoreInsertBase = class extends (
|
|
45850
|
+
__publicField(SingleStoreInsertBuilder, _a444, "SingleStoreInsertBuilder");
|
|
45851
|
+
SingleStoreInsertBase = class extends (_b333 = QueryPromise, _a445 = entityKind, _b333) {
|
|
45771
45852
|
constructor(table6, values, ignore, session, dialect6) {
|
|
45772
45853
|
super();
|
|
45773
45854
|
__publicField(this, "config");
|
|
@@ -45852,12 +45933,12 @@ var init_insert4 = __esm({
|
|
|
45852
45933
|
return this;
|
|
45853
45934
|
}
|
|
45854
45935
|
};
|
|
45855
|
-
__publicField(SingleStoreInsertBase,
|
|
45936
|
+
__publicField(SingleStoreInsertBase, _a445, "SingleStoreInsert");
|
|
45856
45937
|
}
|
|
45857
45938
|
});
|
|
45858
45939
|
|
|
45859
45940
|
// ../drizzle-orm/dist/singlestore-core/dialect.js
|
|
45860
|
-
var
|
|
45941
|
+
var _a446, SingleStoreDialect;
|
|
45861
45942
|
var init_dialect4 = __esm({
|
|
45862
45943
|
"../drizzle-orm/dist/singlestore-core/dialect.js"() {
|
|
45863
45944
|
"use strict";
|
|
@@ -45867,6 +45948,7 @@ var init_dialect4 = __esm({
|
|
|
45867
45948
|
init_column();
|
|
45868
45949
|
init_entity();
|
|
45869
45950
|
init_errors();
|
|
45951
|
+
init_relations();
|
|
45870
45952
|
init_expressions();
|
|
45871
45953
|
init_sql();
|
|
45872
45954
|
init_subquery();
|
|
@@ -45875,11 +45957,62 @@ var init_dialect4 = __esm({
|
|
|
45875
45957
|
init_view_common();
|
|
45876
45958
|
init_common5();
|
|
45877
45959
|
init_table5();
|
|
45878
|
-
|
|
45960
|
+
_a446 = entityKind;
|
|
45879
45961
|
SingleStoreDialect = class {
|
|
45880
45962
|
constructor(config) {
|
|
45881
45963
|
/** @internal */
|
|
45882
45964
|
__publicField(this, "casing");
|
|
45965
|
+
__publicField(this, "unwrapAllColumns", (table6, selection) => {
|
|
45966
|
+
return sql.join(
|
|
45967
|
+
Object.entries(table6[TableColumns]).map(([k, v]) => {
|
|
45968
|
+
selection.push({
|
|
45969
|
+
key: k,
|
|
45970
|
+
field: v
|
|
45971
|
+
});
|
|
45972
|
+
return this.buildRqbColumn(table6, v, k);
|
|
45973
|
+
}),
|
|
45974
|
+
sql`, `
|
|
45975
|
+
);
|
|
45976
|
+
});
|
|
45977
|
+
__publicField(this, "getSelectedTableColumns", (table6, columns) => {
|
|
45978
|
+
const selectedColumns = [];
|
|
45979
|
+
const columnContainer = table6[TableColumns];
|
|
45980
|
+
const entries = Object.entries(columns);
|
|
45981
|
+
let colSelectionMode;
|
|
45982
|
+
for (const [k, v] of entries) {
|
|
45983
|
+
if (v === void 0) continue;
|
|
45984
|
+
colSelectionMode = colSelectionMode || v;
|
|
45985
|
+
if (v) {
|
|
45986
|
+
const column6 = columnContainer[k];
|
|
45987
|
+
selectedColumns.push({
|
|
45988
|
+
column: column6,
|
|
45989
|
+
tsName: k
|
|
45990
|
+
});
|
|
45991
|
+
}
|
|
45992
|
+
}
|
|
45993
|
+
if (colSelectionMode === false) {
|
|
45994
|
+
for (const [k, v] of Object.entries(columnContainer)) {
|
|
45995
|
+
if (columns[k] === false) continue;
|
|
45996
|
+
selectedColumns.push({
|
|
45997
|
+
column: v,
|
|
45998
|
+
tsName: k
|
|
45999
|
+
});
|
|
46000
|
+
}
|
|
46001
|
+
}
|
|
46002
|
+
return selectedColumns;
|
|
46003
|
+
});
|
|
46004
|
+
__publicField(this, "buildColumns", (table6, selection, params) => params?.columns ? (() => {
|
|
46005
|
+
const columnIdentifiers = [];
|
|
46006
|
+
const selectedColumns = this.getSelectedTableColumns(table6, params.columns);
|
|
46007
|
+
for (const { column: column6, tsName } of selectedColumns) {
|
|
46008
|
+
columnIdentifiers.push(this.buildRqbColumn(table6, column6, tsName));
|
|
46009
|
+
selection.push({
|
|
46010
|
+
key: tsName,
|
|
46011
|
+
field: column6
|
|
46012
|
+
});
|
|
46013
|
+
}
|
|
46014
|
+
return columnIdentifiers.length ? sql.join(columnIdentifiers, sql`, `) : void 0;
|
|
46015
|
+
})() : this.unwrapAllColumns(table6, selection));
|
|
45883
46016
|
this.casing = new CasingCache(config?.casing);
|
|
45884
46017
|
}
|
|
45885
46018
|
async migrate(migrations, session, config) {
|
|
@@ -46214,7 +46347,7 @@ var init_dialect4 = __esm({
|
|
|
46214
46347
|
invokeSource
|
|
46215
46348
|
});
|
|
46216
46349
|
}
|
|
46217
|
-
|
|
46350
|
+
_buildRelationalQuery({
|
|
46218
46351
|
fullSchema,
|
|
46219
46352
|
schema: schema5,
|
|
46220
46353
|
tableNamesMap,
|
|
@@ -46324,7 +46457,7 @@ var init_dialect4 = __esm({
|
|
|
46324
46457
|
)
|
|
46325
46458
|
)
|
|
46326
46459
|
);
|
|
46327
|
-
const builtRelation = this.
|
|
46460
|
+
const builtRelation = this._buildRelationalQuery({
|
|
46328
46461
|
fullSchema,
|
|
46329
46462
|
schema: schema5,
|
|
46330
46463
|
tableNamesMap,
|
|
@@ -46439,8 +46572,140 @@ var init_dialect4 = __esm({
|
|
|
46439
46572
|
selection
|
|
46440
46573
|
};
|
|
46441
46574
|
}
|
|
46575
|
+
nestedSelectionerror() {
|
|
46576
|
+
throw new DrizzleError({
|
|
46577
|
+
message: `Views with nested selections are not supported by the relational query builder`
|
|
46578
|
+
});
|
|
46579
|
+
}
|
|
46580
|
+
buildRqbColumn(table6, column6, key) {
|
|
46581
|
+
if (is(column6, Column2)) {
|
|
46582
|
+
const name2 = sql`${table6}.${sql.identifier(this.casing.getColumnCasing(column6))}`;
|
|
46583
|
+
switch (column6.columnType) {
|
|
46584
|
+
case "SingleStoreBinary":
|
|
46585
|
+
case "SingleStoreVarBinary":
|
|
46586
|
+
case "SingleStoreTime":
|
|
46587
|
+
case "SingleStoreDateTimeString":
|
|
46588
|
+
case "SingleStoreTimestampString":
|
|
46589
|
+
case "SingleStoreFloat":
|
|
46590
|
+
case "SingleStoreDecimal":
|
|
46591
|
+
case "SingleStoreDecimalNumber":
|
|
46592
|
+
case "SingleStoreDecimalBigInt":
|
|
46593
|
+
case "SingleStoreBigInt64":
|
|
46594
|
+
case "SingleStoreEnumColumn": {
|
|
46595
|
+
return sql`cast(${name2} as char) as ${sql.identifier(key)}`;
|
|
46596
|
+
}
|
|
46597
|
+
case "SingleStoreVector":
|
|
46598
|
+
case "SingleStoreBigIntVector": {
|
|
46599
|
+
return sql`hex(${name2} :> blob) as ${sql.identifier(key)}`;
|
|
46600
|
+
}
|
|
46601
|
+
case "SingleStoreCustomColumn": {
|
|
46602
|
+
return sql`${column6.jsonSelectIdentifier(name2, sql)} as ${sql.identifier(key)}`;
|
|
46603
|
+
}
|
|
46604
|
+
default: {
|
|
46605
|
+
return sql`${name2} as ${sql.identifier(key)}`;
|
|
46606
|
+
}
|
|
46607
|
+
}
|
|
46608
|
+
}
|
|
46609
|
+
return sql`${table6}.${is(column6, SQL.Aliased) ? sql.identifier(column6.fieldAlias) : isSQLWrapper(column6) ? sql.identifier(key) : this.nestedSelectionerror()} as ${sql.identifier(key)}`;
|
|
46610
|
+
}
|
|
46611
|
+
buildRelationalQuery({
|
|
46612
|
+
schema: schema5,
|
|
46613
|
+
table: table6,
|
|
46614
|
+
tableConfig,
|
|
46615
|
+
queryConfig: config,
|
|
46616
|
+
relationWhere,
|
|
46617
|
+
mode,
|
|
46618
|
+
errorPath,
|
|
46619
|
+
depth,
|
|
46620
|
+
isNestedMany,
|
|
46621
|
+
throughJoin
|
|
46622
|
+
}) {
|
|
46623
|
+
const selection = [];
|
|
46624
|
+
const isSingle = mode === "first";
|
|
46625
|
+
const params = config === true ? void 0 : config;
|
|
46626
|
+
const currentPath = errorPath ?? "";
|
|
46627
|
+
const currentDepth = depth ?? 0;
|
|
46628
|
+
if (!currentDepth) table6 = aliasedTable(table6, `d${currentDepth}`);
|
|
46629
|
+
const limit = isSingle ? 1 : params?.limit;
|
|
46630
|
+
const offset = params?.offset;
|
|
46631
|
+
const columns = this.buildColumns(table6, selection, params);
|
|
46632
|
+
const where = params?.where && relationWhere ? and(
|
|
46633
|
+
relationsFilterToSQL(table6, params.where, tableConfig.relations, schema5, this.casing),
|
|
46634
|
+
relationWhere
|
|
46635
|
+
) : params?.where ? relationsFilterToSQL(table6, params.where, tableConfig.relations, schema5, this.casing) : relationWhere;
|
|
46636
|
+
const order = params?.orderBy ? relationsOrderToSQL(table6, params.orderBy) : void 0;
|
|
46637
|
+
const extras = params?.extras ? relationExtrasToSQL(table6, params.extras) : void 0;
|
|
46638
|
+
if (extras) selection.push(...extras.selection);
|
|
46639
|
+
const selectionArr = columns ? [columns] : [];
|
|
46640
|
+
const joins = params ? (() => {
|
|
46641
|
+
const { with: joins2 } = params;
|
|
46642
|
+
if (!joins2) return;
|
|
46643
|
+
const withEntries = Object.entries(joins2).filter(([_2, v]) => v);
|
|
46644
|
+
if (!withEntries.length) return;
|
|
46645
|
+
return sql.join(
|
|
46646
|
+
withEntries.map(([k, join]) => {
|
|
46647
|
+
const relation = tableConfig.relations[k];
|
|
46648
|
+
const isSingle2 = is(relation, One);
|
|
46649
|
+
selectionArr.push(
|
|
46650
|
+
isSingle2 ? sql`${sql.identifier(k)}.${sql.identifier("r")} as ${sql.identifier(k)}` : sql`coalesce(${sql.identifier(k)}.${sql.identifier("r")}, json_build_array()) as ${sql.identifier(k)}`
|
|
46651
|
+
);
|
|
46652
|
+
const targetTable = aliasedTable(relation.targetTable, `d${currentDepth + 1}`);
|
|
46653
|
+
const throughTable = relation.throughTable ? aliasedTable(relation.throughTable, `tr${currentDepth}`) : void 0;
|
|
46654
|
+
const { filter: filter2, joinCondition } = relationToSQL(
|
|
46655
|
+
this.casing,
|
|
46656
|
+
relation,
|
|
46657
|
+
table6,
|
|
46658
|
+
targetTable,
|
|
46659
|
+
throughTable
|
|
46660
|
+
);
|
|
46661
|
+
const throughJoin2 = throughTable ? sql` inner join ${getTableAsAliasSQL(throughTable)} on ${joinCondition}` : void 0;
|
|
46662
|
+
const innerQuery = this.buildRelationalQuery({
|
|
46663
|
+
table: targetTable,
|
|
46664
|
+
mode: isSingle2 ? "first" : "many",
|
|
46665
|
+
schema: schema5,
|
|
46666
|
+
queryConfig: join,
|
|
46667
|
+
tableConfig: schema5[relation.targetTableName],
|
|
46668
|
+
relationWhere: filter2,
|
|
46669
|
+
errorPath: `${currentPath.length ? `${currentPath}.` : ""}${k}`,
|
|
46670
|
+
depth: currentDepth + 1,
|
|
46671
|
+
isNestedMany: !isSingle2,
|
|
46672
|
+
throughJoin: throughJoin2
|
|
46673
|
+
});
|
|
46674
|
+
selection.push({
|
|
46675
|
+
field: targetTable,
|
|
46676
|
+
key: k,
|
|
46677
|
+
selection: innerQuery.selection,
|
|
46678
|
+
isArray: !isSingle2,
|
|
46679
|
+
isOptional: (relation.optional ?? false) || join !== true && !!join.where
|
|
46680
|
+
});
|
|
46681
|
+
const jsonColumns = sql.join(
|
|
46682
|
+
innerQuery.selection.map((s) => sql`${sql.raw(this.escapeString(s.key))}, ${sql.identifier(s.key)}`),
|
|
46683
|
+
sql`, `
|
|
46684
|
+
);
|
|
46685
|
+
const joinQuery = sql` left join lateral(select ${sql`${isSingle2 ? sql`json_build_object(${jsonColumns})` : sql`json_agg(json_build_object(${jsonColumns})${innerQuery.order ? sql` ORDER BY ${sql.identifier(`$drizzle_order_row_number`)}` : void 0})`} as ${sql.identifier("r")}`} from (${innerQuery.sql}) as ${sql.identifier("t")}) as ${sql.identifier(k)} on true`;
|
|
46686
|
+
return joinQuery;
|
|
46687
|
+
})
|
|
46688
|
+
);
|
|
46689
|
+
})() : void 0;
|
|
46690
|
+
if (extras?.sql) selectionArr.push(extras.sql);
|
|
46691
|
+
if (!selectionArr.length) {
|
|
46692
|
+
throw new DrizzleError({
|
|
46693
|
+
message: `No fields selected for table "${tableConfig.name}"${currentPath ? ` ("${currentPath}")` : ""}`
|
|
46694
|
+
});
|
|
46695
|
+
}
|
|
46696
|
+
if (isNestedMany && order) {
|
|
46697
|
+
selectionArr.push(sql`row_number() over (order by ${order}) as ${sql.identifier(`$drizzle_order_row_number`)}`);
|
|
46698
|
+
}
|
|
46699
|
+
const selectionSet = sql.join(selectionArr, sql`, `);
|
|
46700
|
+
const query = sql`select ${selectionSet} from ${getTableAsAliasSQL(table6)}${throughJoin}${sql`${joins}`.if(joins)}${sql` where ${where}`.if(where)}${sql` order by ${order}`.if(order)}${sql` limit ${limit}`.if(limit !== void 0)}${sql` offset ${offset}`.if(offset !== void 0)}`;
|
|
46701
|
+
return {
|
|
46702
|
+
sql: query,
|
|
46703
|
+
selection,
|
|
46704
|
+
order
|
|
46705
|
+
};
|
|
46706
|
+
}
|
|
46442
46707
|
};
|
|
46443
|
-
__publicField(SingleStoreDialect,
|
|
46708
|
+
__publicField(SingleStoreDialect, _a446, "SingleStoreDialect");
|
|
46444
46709
|
}
|
|
46445
46710
|
});
|
|
46446
46711
|
|
|
@@ -46462,7 +46727,7 @@ function createSetOperator4(type, isAll) {
|
|
|
46462
46727
|
return leftSelect.addSetOperators(setOperators);
|
|
46463
46728
|
};
|
|
46464
46729
|
}
|
|
46465
|
-
var
|
|
46730
|
+
var _a447, SingleStoreSelectBuilder, _a448, _b334, SingleStoreSelectQueryBuilderBase, _a449, _b335, SingleStoreSelectBase, getSingleStoreSetOperators, union5, unionAll4, intersect4, except4, minus;
|
|
46466
46731
|
var init_select5 = __esm({
|
|
46467
46732
|
"../drizzle-orm/dist/singlestore-core/query-builders/select.js"() {
|
|
46468
46733
|
"use strict";
|
|
@@ -46475,7 +46740,7 @@ var init_select5 = __esm({
|
|
|
46475
46740
|
init_table();
|
|
46476
46741
|
init_utils2();
|
|
46477
46742
|
init_utils10();
|
|
46478
|
-
|
|
46743
|
+
_a447 = entityKind;
|
|
46479
46744
|
SingleStoreSelectBuilder = class {
|
|
46480
46745
|
constructor(config) {
|
|
46481
46746
|
__publicField(this, "fields");
|
|
@@ -46518,8 +46783,8 @@ var init_select5 = __esm({
|
|
|
46518
46783
|
);
|
|
46519
46784
|
}
|
|
46520
46785
|
};
|
|
46521
|
-
__publicField(SingleStoreSelectBuilder,
|
|
46522
|
-
SingleStoreSelectQueryBuilderBase = class extends (
|
|
46786
|
+
__publicField(SingleStoreSelectBuilder, _a447, "SingleStoreSelectBuilder");
|
|
46787
|
+
SingleStoreSelectQueryBuilderBase = class extends (_b334 = TypedQueryBuilder, _a448 = entityKind, _b334) {
|
|
46523
46788
|
constructor({ table: table6, fields, isPartialSelect, session, dialect: dialect6, withList, distinct }) {
|
|
46524
46789
|
super();
|
|
46525
46790
|
__publicField(this, "_");
|
|
@@ -47140,8 +47405,8 @@ var init_select5 = __esm({
|
|
|
47140
47405
|
return this;
|
|
47141
47406
|
}
|
|
47142
47407
|
};
|
|
47143
|
-
__publicField(SingleStoreSelectQueryBuilderBase,
|
|
47144
|
-
SingleStoreSelectBase = class extends (
|
|
47408
|
+
__publicField(SingleStoreSelectQueryBuilderBase, _a448, "SingleStoreSelectQueryBuilder");
|
|
47409
|
+
SingleStoreSelectBase = class extends (_b335 = SingleStoreSelectQueryBuilderBase, _a449 = entityKind, _b335) {
|
|
47145
47410
|
constructor() {
|
|
47146
47411
|
super(...arguments);
|
|
47147
47412
|
__publicField(this, "execute", (placeholderValues) => {
|
|
@@ -47172,7 +47437,7 @@ var init_select5 = __esm({
|
|
|
47172
47437
|
return this;
|
|
47173
47438
|
}
|
|
47174
47439
|
};
|
|
47175
|
-
__publicField(SingleStoreSelectBase,
|
|
47440
|
+
__publicField(SingleStoreSelectBase, _a449, "SingleStoreSelect");
|
|
47176
47441
|
applyMixins(SingleStoreSelectBase, [QueryPromise]);
|
|
47177
47442
|
getSingleStoreSetOperators = () => ({
|
|
47178
47443
|
union: union5,
|
|
@@ -47190,7 +47455,7 @@ var init_select5 = __esm({
|
|
|
47190
47455
|
});
|
|
47191
47456
|
|
|
47192
47457
|
// ../drizzle-orm/dist/singlestore-core/query-builders/query-builder.js
|
|
47193
|
-
var
|
|
47458
|
+
var _a450, QueryBuilder4;
|
|
47194
47459
|
var init_query_builder5 = __esm({
|
|
47195
47460
|
"../drizzle-orm/dist/singlestore-core/query-builders/query-builder.js"() {
|
|
47196
47461
|
"use strict";
|
|
@@ -47199,7 +47464,7 @@ var init_query_builder5 = __esm({
|
|
|
47199
47464
|
init_dialect4();
|
|
47200
47465
|
init_subquery();
|
|
47201
47466
|
init_select5();
|
|
47202
|
-
|
|
47467
|
+
_a450 = entityKind;
|
|
47203
47468
|
QueryBuilder4 = class {
|
|
47204
47469
|
constructor(dialect6) {
|
|
47205
47470
|
__publicField(this, "dialect");
|
|
@@ -47269,7 +47534,7 @@ var init_query_builder5 = __esm({
|
|
|
47269
47534
|
return this.dialect;
|
|
47270
47535
|
}
|
|
47271
47536
|
};
|
|
47272
|
-
__publicField(QueryBuilder4,
|
|
47537
|
+
__publicField(QueryBuilder4, _a450, "SingleStoreQueryBuilder");
|
|
47273
47538
|
}
|
|
47274
47539
|
});
|
|
47275
47540
|
|
|
@@ -47281,7 +47546,7 @@ var init_select_types4 = __esm({
|
|
|
47281
47546
|
});
|
|
47282
47547
|
|
|
47283
47548
|
// ../drizzle-orm/dist/singlestore-core/query-builders/update.js
|
|
47284
|
-
var
|
|
47549
|
+
var _a451, SingleStoreUpdateBuilder, _a452, _b336, SingleStoreUpdateBase;
|
|
47285
47550
|
var init_update4 = __esm({
|
|
47286
47551
|
"../drizzle-orm/dist/singlestore-core/query-builders/update.js"() {
|
|
47287
47552
|
"use strict";
|
|
@@ -47291,7 +47556,7 @@ var init_update4 = __esm({
|
|
|
47291
47556
|
init_table();
|
|
47292
47557
|
init_utils2();
|
|
47293
47558
|
init_utils10();
|
|
47294
|
-
|
|
47559
|
+
_a451 = entityKind;
|
|
47295
47560
|
SingleStoreUpdateBuilder = class {
|
|
47296
47561
|
constructor(table6, session, dialect6, withList) {
|
|
47297
47562
|
this.table = table6;
|
|
@@ -47309,8 +47574,8 @@ var init_update4 = __esm({
|
|
|
47309
47574
|
);
|
|
47310
47575
|
}
|
|
47311
47576
|
};
|
|
47312
|
-
__publicField(SingleStoreUpdateBuilder,
|
|
47313
|
-
SingleStoreUpdateBase = class extends (
|
|
47577
|
+
__publicField(SingleStoreUpdateBuilder, _a451, "SingleStoreUpdateBuilder");
|
|
47578
|
+
SingleStoreUpdateBase = class extends (_b336 = QueryPromise, _a452 = entityKind, _b336) {
|
|
47314
47579
|
constructor(table6, set, session, dialect6, withList) {
|
|
47315
47580
|
super();
|
|
47316
47581
|
__publicField(this, "config");
|
|
@@ -47410,7 +47675,7 @@ var init_update4 = __esm({
|
|
|
47410
47675
|
return this;
|
|
47411
47676
|
}
|
|
47412
47677
|
};
|
|
47413
|
-
__publicField(SingleStoreUpdateBase,
|
|
47678
|
+
__publicField(SingleStoreUpdateBase, _a452, "SingleStoreUpdate");
|
|
47414
47679
|
}
|
|
47415
47680
|
});
|
|
47416
47681
|
|
|
@@ -47427,8 +47692,103 @@ var init_query_builders4 = __esm({
|
|
|
47427
47692
|
}
|
|
47428
47693
|
});
|
|
47429
47694
|
|
|
47695
|
+
// ../drizzle-orm/dist/singlestore-core/query-builders/query.js
|
|
47696
|
+
var _a453, RelationalQueryBuilder4, _a454, _b337, SingleStoreRelationalQuery;
|
|
47697
|
+
var init_query7 = __esm({
|
|
47698
|
+
"../drizzle-orm/dist/singlestore-core/query-builders/query.js"() {
|
|
47699
|
+
"use strict";
|
|
47700
|
+
init_entity();
|
|
47701
|
+
init_query_promise();
|
|
47702
|
+
init_relations();
|
|
47703
|
+
_a453 = entityKind;
|
|
47704
|
+
RelationalQueryBuilder4 = class {
|
|
47705
|
+
constructor(schema5, table6, tableConfig, dialect6, session) {
|
|
47706
|
+
this.schema = schema5;
|
|
47707
|
+
this.table = table6;
|
|
47708
|
+
this.tableConfig = tableConfig;
|
|
47709
|
+
this.dialect = dialect6;
|
|
47710
|
+
this.session = session;
|
|
47711
|
+
}
|
|
47712
|
+
findMany(config) {
|
|
47713
|
+
return new SingleStoreRelationalQuery(
|
|
47714
|
+
this.schema,
|
|
47715
|
+
this.table,
|
|
47716
|
+
this.tableConfig,
|
|
47717
|
+
this.dialect,
|
|
47718
|
+
this.session,
|
|
47719
|
+
config ?? true,
|
|
47720
|
+
"many"
|
|
47721
|
+
);
|
|
47722
|
+
}
|
|
47723
|
+
findFirst(config) {
|
|
47724
|
+
return new SingleStoreRelationalQuery(
|
|
47725
|
+
this.schema,
|
|
47726
|
+
this.table,
|
|
47727
|
+
this.tableConfig,
|
|
47728
|
+
this.dialect,
|
|
47729
|
+
this.session,
|
|
47730
|
+
config ?? true,
|
|
47731
|
+
"first"
|
|
47732
|
+
);
|
|
47733
|
+
}
|
|
47734
|
+
};
|
|
47735
|
+
__publicField(RelationalQueryBuilder4, _a453, "SingleStoreRelationalQueryBuilderV2");
|
|
47736
|
+
SingleStoreRelationalQuery = class extends (_b337 = QueryPromise, _a454 = entityKind, _b337) {
|
|
47737
|
+
constructor(schema5, table6, tableConfig, dialect6, session, config, mode) {
|
|
47738
|
+
super();
|
|
47739
|
+
this.schema = schema5;
|
|
47740
|
+
this.table = table6;
|
|
47741
|
+
this.tableConfig = tableConfig;
|
|
47742
|
+
this.dialect = dialect6;
|
|
47743
|
+
this.session = session;
|
|
47744
|
+
this.config = config;
|
|
47745
|
+
this.mode = mode;
|
|
47746
|
+
}
|
|
47747
|
+
prepare() {
|
|
47748
|
+
const { query, builtQuery } = this._toSQL();
|
|
47749
|
+
return this.session.prepareRelationalQuery(
|
|
47750
|
+
builtQuery,
|
|
47751
|
+
void 0,
|
|
47752
|
+
(rawRows) => {
|
|
47753
|
+
const rows = rawRows.map((row) => mapRelationalRow(row, query.selection, void 0, void 0, true));
|
|
47754
|
+
if (this.mode === "first") {
|
|
47755
|
+
return rows[0];
|
|
47756
|
+
}
|
|
47757
|
+
return rows;
|
|
47758
|
+
}
|
|
47759
|
+
);
|
|
47760
|
+
}
|
|
47761
|
+
_getQuery() {
|
|
47762
|
+
return this.dialect.buildRelationalQuery({
|
|
47763
|
+
schema: this.schema,
|
|
47764
|
+
table: this.table,
|
|
47765
|
+
tableConfig: this.tableConfig,
|
|
47766
|
+
queryConfig: this.config,
|
|
47767
|
+
mode: this.mode
|
|
47768
|
+
});
|
|
47769
|
+
}
|
|
47770
|
+
_toSQL() {
|
|
47771
|
+
const query = this._getQuery();
|
|
47772
|
+
const builtQuery = this.dialect.sqlToQuery(query.sql);
|
|
47773
|
+
return { builtQuery, query };
|
|
47774
|
+
}
|
|
47775
|
+
/** @internal */
|
|
47776
|
+
getSQL() {
|
|
47777
|
+
return this._getQuery().sql;
|
|
47778
|
+
}
|
|
47779
|
+
toSQL() {
|
|
47780
|
+
return this._toSQL().builtQuery;
|
|
47781
|
+
}
|
|
47782
|
+
execute() {
|
|
47783
|
+
return this.prepare().execute();
|
|
47784
|
+
}
|
|
47785
|
+
};
|
|
47786
|
+
__publicField(SingleStoreRelationalQuery, _a454, "SingleStoreRelationalQueryV2");
|
|
47787
|
+
}
|
|
47788
|
+
});
|
|
47789
|
+
|
|
47430
47790
|
// ../drizzle-orm/dist/singlestore-core/db.js
|
|
47431
|
-
var
|
|
47791
|
+
var _a455, SingleStoreDatabase;
|
|
47432
47792
|
var init_db4 = __esm({
|
|
47433
47793
|
"../drizzle-orm/dist/singlestore-core/db.js"() {
|
|
47434
47794
|
"use strict";
|
|
@@ -47438,11 +47798,11 @@ var init_db4 = __esm({
|
|
|
47438
47798
|
init_subquery();
|
|
47439
47799
|
init_count4();
|
|
47440
47800
|
init_query_builders4();
|
|
47441
|
-
|
|
47801
|
+
init_query7();
|
|
47802
|
+
_a455 = entityKind;
|
|
47442
47803
|
SingleStoreDatabase = class {
|
|
47443
|
-
constructor(dialect6, session, schema5) {
|
|
47444
|
-
//
|
|
47445
|
-
/**@inrernal */
|
|
47804
|
+
constructor(dialect6, session, relations, schema5) {
|
|
47805
|
+
// TO-DO: Figure out how to pass DrizzleTypeError without breaking withReplicas
|
|
47446
47806
|
__publicField(this, "query");
|
|
47447
47807
|
/**
|
|
47448
47808
|
* Creates a subquery that defines a temporary named result set as a CTE.
|
|
@@ -47500,13 +47860,24 @@ var init_db4 = __esm({
|
|
|
47500
47860
|
this._ = schema5 ? {
|
|
47501
47861
|
schema: schema5.schema,
|
|
47502
47862
|
fullSchema: schema5.fullSchema,
|
|
47503
|
-
tableNamesMap: schema5.tableNamesMap
|
|
47863
|
+
tableNamesMap: schema5.tableNamesMap,
|
|
47864
|
+
relations
|
|
47504
47865
|
} : {
|
|
47505
47866
|
schema: void 0,
|
|
47506
47867
|
fullSchema: {},
|
|
47507
|
-
tableNamesMap: {}
|
|
47868
|
+
tableNamesMap: {},
|
|
47869
|
+
relations
|
|
47508
47870
|
};
|
|
47509
47871
|
this.query = {};
|
|
47872
|
+
for (const [tableName, relation] of Object.entries(relations)) {
|
|
47873
|
+
this.query[tableName] = new RelationalQueryBuilder4(
|
|
47874
|
+
relations,
|
|
47875
|
+
relations[relation.name].table,
|
|
47876
|
+
relation,
|
|
47877
|
+
dialect6,
|
|
47878
|
+
session
|
|
47879
|
+
);
|
|
47880
|
+
}
|
|
47510
47881
|
this.$cache = { invalidate: async (_params) => {
|
|
47511
47882
|
} };
|
|
47512
47883
|
}
|
|
@@ -47645,18 +48016,18 @@ var init_db4 = __esm({
|
|
|
47645
48016
|
return this.session.transaction(transaction, config);
|
|
47646
48017
|
}
|
|
47647
48018
|
};
|
|
47648
|
-
__publicField(SingleStoreDatabase,
|
|
48019
|
+
__publicField(SingleStoreDatabase, _a455, "SingleStoreDatabase");
|
|
47649
48020
|
}
|
|
47650
48021
|
});
|
|
47651
48022
|
|
|
47652
48023
|
// ../drizzle-orm/dist/singlestore-core/schema.js
|
|
47653
|
-
var
|
|
48024
|
+
var _a456, SingleStoreSchema5;
|
|
47654
48025
|
var init_schema3 = __esm({
|
|
47655
48026
|
"../drizzle-orm/dist/singlestore-core/schema.js"() {
|
|
47656
48027
|
"use strict";
|
|
47657
48028
|
init_entity();
|
|
47658
48029
|
init_table5();
|
|
47659
|
-
|
|
48030
|
+
_a456 = entityKind;
|
|
47660
48031
|
SingleStoreSchema5 = class {
|
|
47661
48032
|
constructor(schemaName) {
|
|
47662
48033
|
__publicField(this, "table", (name2, columns, extraConfig) => {
|
|
@@ -47669,12 +48040,12 @@ var init_schema3 = __esm({
|
|
|
47669
48040
|
return singlestoreViewWithSchema(name, columns, this.schemaName);
|
|
47670
48041
|
}) as typeof singlestoreView; */
|
|
47671
48042
|
};
|
|
47672
|
-
__publicField(SingleStoreSchema5,
|
|
48043
|
+
__publicField(SingleStoreSchema5, _a456, "SingleStoreSchema");
|
|
47673
48044
|
}
|
|
47674
48045
|
});
|
|
47675
48046
|
|
|
47676
48047
|
// ../drizzle-orm/dist/singlestore-core/session.js
|
|
47677
|
-
var
|
|
48048
|
+
var _a457, SingleStorePreparedQuery, _a458, SingleStoreSession, _a459, _b338, SingleStoreTransaction;
|
|
47678
48049
|
var init_session4 = __esm({
|
|
47679
48050
|
"../drizzle-orm/dist/singlestore-core/session.js"() {
|
|
47680
48051
|
"use strict";
|
|
@@ -47683,7 +48054,7 @@ var init_session4 = __esm({
|
|
|
47683
48054
|
init_errors();
|
|
47684
48055
|
init_sql();
|
|
47685
48056
|
init_db4();
|
|
47686
|
-
|
|
48057
|
+
_a457 = entityKind;
|
|
47687
48058
|
SingleStorePreparedQuery = class {
|
|
47688
48059
|
constructor(cache, queryMetadata, cacheConfig) {
|
|
47689
48060
|
/** @internal */
|
|
@@ -47765,8 +48136,8 @@ var init_session4 = __esm({
|
|
|
47765
48136
|
}
|
|
47766
48137
|
}
|
|
47767
48138
|
};
|
|
47768
|
-
__publicField(SingleStorePreparedQuery,
|
|
47769
|
-
|
|
48139
|
+
__publicField(SingleStorePreparedQuery, _a457, "SingleStorePreparedQuery");
|
|
48140
|
+
_a458 = entityKind;
|
|
47770
48141
|
SingleStoreSession = class {
|
|
47771
48142
|
constructor(dialect6) {
|
|
47772
48143
|
this.dialect = dialect6;
|
|
@@ -47801,10 +48172,11 @@ var init_session4 = __esm({
|
|
|
47801
48172
|
return parts.length ? sql`start transaction ${sql.raw(parts.join(" "))}` : void 0;
|
|
47802
48173
|
}
|
|
47803
48174
|
};
|
|
47804
|
-
__publicField(SingleStoreSession,
|
|
47805
|
-
SingleStoreTransaction = class extends (
|
|
47806
|
-
constructor(dialect6, session, schema5, nestedIndex) {
|
|
47807
|
-
super(dialect6, session, schema5);
|
|
48175
|
+
__publicField(SingleStoreSession, _a458, "SingleStoreSession");
|
|
48176
|
+
SingleStoreTransaction = class extends (_b338 = SingleStoreDatabase, _a459 = entityKind, _b338) {
|
|
48177
|
+
constructor(dialect6, session, relations, schema5, nestedIndex) {
|
|
48178
|
+
super(dialect6, session, relations, schema5);
|
|
48179
|
+
this.relations = relations;
|
|
47808
48180
|
this.schema = schema5;
|
|
47809
48181
|
this.nestedIndex = nestedIndex;
|
|
47810
48182
|
}
|
|
@@ -47812,7 +48184,7 @@ var init_session4 = __esm({
|
|
|
47812
48184
|
throw new TransactionRollbackError();
|
|
47813
48185
|
}
|
|
47814
48186
|
};
|
|
47815
|
-
__publicField(SingleStoreTransaction,
|
|
48187
|
+
__publicField(SingleStoreTransaction, _a459, "SingleStoreTransaction");
|
|
47816
48188
|
}
|
|
47817
48189
|
});
|
|
47818
48190
|
|