drizzle-kit 1.0.0-beta.1-94774b0 → 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 +534 -128
- package/api.mjs +534 -128
- 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 = {}));
|
|
@@ -23568,37 +23568,65 @@ function processRelations(tablesConfig, tables) {
|
|
|
23568
23568
|
if (!is(relation, Relation)) {
|
|
23569
23569
|
continue;
|
|
23570
23570
|
}
|
|
23571
|
-
|
|
23572
|
-
|
|
23571
|
+
let reverseRelation;
|
|
23572
|
+
const {
|
|
23573
|
+
targetTableName,
|
|
23574
|
+
alias,
|
|
23575
|
+
sourceColumns,
|
|
23576
|
+
targetColumns,
|
|
23577
|
+
throughTable,
|
|
23578
|
+
sourceTable,
|
|
23579
|
+
through,
|
|
23580
|
+
targetTable,
|
|
23581
|
+
where,
|
|
23582
|
+
sourceColumnTableNames,
|
|
23583
|
+
targetColumnTableNames
|
|
23584
|
+
} = relation;
|
|
23585
|
+
const relationPrintName = `relations -> ${tableConfig.name}: { ${relationFieldName}: r.${is(relation, One) ? "one" : "many"}.${targetTableName}(...) }`;
|
|
23586
|
+
if (typeof alias === "string" && !alias) {
|
|
23573
23587
|
throw new Error(`${relationPrintName}: "alias" cannot be an empty string - omit it if you don't need it`);
|
|
23574
23588
|
}
|
|
23575
|
-
if (
|
|
23576
|
-
throw new Error(`${relationPrintName}: "from" cannot be
|
|
23589
|
+
if (sourceColumns?.length === 0) {
|
|
23590
|
+
throw new Error(`${relationPrintName}: "from" cannot be empty`);
|
|
23577
23591
|
}
|
|
23578
|
-
if (
|
|
23579
|
-
throw new Error(`${relationPrintName}: "to" cannot be
|
|
23592
|
+
if (targetColumns?.length === 0) {
|
|
23593
|
+
throw new Error(`${relationPrintName}: "to" cannot be empty`);
|
|
23580
23594
|
}
|
|
23581
|
-
if (
|
|
23582
|
-
if (
|
|
23595
|
+
if (sourceColumns && targetColumns) {
|
|
23596
|
+
if (sourceColumns.length !== targetColumns.length && !throughTable) {
|
|
23583
23597
|
throw new Error(
|
|
23584
23598
|
`${relationPrintName}: "from" and "to" fields without "through" must have the same length`
|
|
23585
23599
|
);
|
|
23586
23600
|
}
|
|
23587
|
-
|
|
23588
|
-
if (
|
|
23601
|
+
for (const sName of sourceColumnTableNames) {
|
|
23602
|
+
if (sName !== sourceTableName) {
|
|
23603
|
+
throw new Error(
|
|
23604
|
+
`${relationPrintName}: all "from" columns must belong to table "${sourceTableName}", found column of table "${sName}"`
|
|
23605
|
+
);
|
|
23606
|
+
}
|
|
23607
|
+
}
|
|
23608
|
+
for (const tName of targetColumnTableNames) {
|
|
23609
|
+
if (tName !== targetTableName) {
|
|
23610
|
+
throw new Error(
|
|
23611
|
+
`${relationPrintName}: all "to" columns must belong to table "${targetTable}", found column of table "${tName}"`
|
|
23612
|
+
);
|
|
23613
|
+
}
|
|
23614
|
+
}
|
|
23615
|
+
if (through) {
|
|
23616
|
+
if (through.source.length !== sourceColumns.length || through.target.length !== targetColumns.length) {
|
|
23589
23617
|
throw new Error(
|
|
23590
23618
|
`${relationPrintName}: ".through(column)" must be used either on all columns in "from" and "to" or not defined on any of them`
|
|
23591
23619
|
);
|
|
23592
23620
|
}
|
|
23593
|
-
for (const column6 of
|
|
23594
|
-
if (tables[column6._.tableName] !==
|
|
23621
|
+
for (const column6 of through.source) {
|
|
23622
|
+
if (tables[column6._.tableName] !== throughTable) {
|
|
23595
23623
|
throw new Error(
|
|
23596
23624
|
`${relationPrintName}: ".through(column)" must be used on the same table by all columns of the relation`
|
|
23597
23625
|
);
|
|
23598
23626
|
}
|
|
23599
23627
|
}
|
|
23600
|
-
for (const column6 of
|
|
23601
|
-
if (tables[column6._.tableName] !==
|
|
23628
|
+
for (const column6 of through.target) {
|
|
23629
|
+
if (tables[column6._.tableName] !== throughTable) {
|
|
23602
23630
|
throw new Error(
|
|
23603
23631
|
`${relationPrintName}: ".through(column)" must be used on the same table by all columns of the relation`
|
|
23604
23632
|
);
|
|
@@ -23607,54 +23635,52 @@ function processRelations(tablesConfig, tables) {
|
|
|
23607
23635
|
}
|
|
23608
23636
|
continue;
|
|
23609
23637
|
}
|
|
23610
|
-
if (
|
|
23638
|
+
if (sourceColumns || targetColumns) {
|
|
23611
23639
|
throw new Error(
|
|
23612
23640
|
`${relationPrintName}: relation must have either both "from" and "to" defined, or none of them`
|
|
23613
23641
|
);
|
|
23614
23642
|
}
|
|
23615
|
-
|
|
23616
|
-
const targetTableTsName = relation.targetTableName;
|
|
23617
|
-
const reverseTableConfig = tablesConfig[targetTableTsName];
|
|
23643
|
+
const reverseTableConfig = tablesConfig[targetTableName];
|
|
23618
23644
|
if (!reverseTableConfig) {
|
|
23619
23645
|
throw new Error(
|
|
23620
|
-
`${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relations of table "${
|
|
23646
|
+
`${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relations of table "${targetTableName}" were found"`
|
|
23621
23647
|
);
|
|
23622
23648
|
}
|
|
23623
|
-
if (
|
|
23649
|
+
if (alias) {
|
|
23624
23650
|
const reverseRelations = Object.values(reverseTableConfig.relations).filter(
|
|
23625
|
-
(it) => is(it, Relation) && it.alias ===
|
|
23651
|
+
(it) => is(it, Relation) && it.alias === alias && it !== relation
|
|
23626
23652
|
);
|
|
23627
23653
|
if (reverseRelations.length > 1) {
|
|
23628
23654
|
throw new Error(
|
|
23629
|
-
`${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and multiple relations with alias "${
|
|
23655
|
+
`${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and multiple relations with alias "${alias}" found in table "${targetTableName}": ${reverseRelations.map((it) => `"${it.fieldName}"`).join(", ")}`
|
|
23630
23656
|
);
|
|
23631
23657
|
}
|
|
23632
23658
|
reverseRelation = reverseRelations[0];
|
|
23633
23659
|
if (!reverseRelation) {
|
|
23634
23660
|
throw new Error(
|
|
23635
|
-
`${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and there is no reverse relation of table "${
|
|
23661
|
+
`${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and there is no reverse relation of table "${targetTableName}" with alias "${alias}"`
|
|
23636
23662
|
);
|
|
23637
23663
|
}
|
|
23638
23664
|
} else {
|
|
23639
23665
|
const reverseRelations = Object.values(reverseTableConfig.relations).filter(
|
|
23640
|
-
(it) => is(it, Relation) && it.targetTable ===
|
|
23666
|
+
(it) => is(it, Relation) && it.targetTable === sourceTable && !it.alias && it !== relation
|
|
23641
23667
|
);
|
|
23642
23668
|
if (reverseRelations.length > 1) {
|
|
23643
23669
|
throw new Error(
|
|
23644
|
-
`${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and multiple relations between "${
|
|
23670
|
+
`${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and multiple relations between "${targetTableName}" and "${sourceTableName}" were found.
|
|
23645
23671
|
Hint: you can specify "alias" on both sides of the relation with the same value`
|
|
23646
23672
|
);
|
|
23647
23673
|
}
|
|
23648
23674
|
reverseRelation = reverseRelations[0];
|
|
23649
23675
|
if (!reverseRelation) {
|
|
23650
23676
|
throw new Error(
|
|
23651
|
-
`${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relation of table "${
|
|
23677
|
+
`${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relation of table "${targetTableName}" with target table "${sourceTableName}" was found`
|
|
23652
23678
|
);
|
|
23653
23679
|
}
|
|
23654
23680
|
}
|
|
23655
23681
|
if (!reverseRelation.sourceColumns || !reverseRelation.targetColumns) {
|
|
23656
23682
|
throw new Error(
|
|
23657
|
-
`${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and reverse relation "${
|
|
23683
|
+
`${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and reverse relation "${targetTableName}.${reverseRelation.fieldName}" does not have "from"/"to" defined`
|
|
23658
23684
|
);
|
|
23659
23685
|
}
|
|
23660
23686
|
relation.sourceColumns = reverseRelation.targetColumns;
|
|
@@ -23664,8 +23690,8 @@ Hint: you can specify "alias" on both sides of the relation with the same value`
|
|
|
23664
23690
|
target: reverseRelation.through.source
|
|
23665
23691
|
} : void 0;
|
|
23666
23692
|
relation.throughTable = reverseRelation.throughTable;
|
|
23667
|
-
relation.isReversed = !
|
|
23668
|
-
relation.where =
|
|
23693
|
+
relation.isReversed = !where;
|
|
23694
|
+
relation.where = where ?? reverseRelation.where;
|
|
23669
23695
|
}
|
|
23670
23696
|
}
|
|
23671
23697
|
return tablesConfig;
|
|
@@ -23696,12 +23722,15 @@ function buildRelationsParts(tables, config) {
|
|
|
23696
23722
|
function getOrderByOperators() {
|
|
23697
23723
|
return orderByOperators;
|
|
23698
23724
|
}
|
|
23699
|
-
function mapRelationalRow(row, buildQueryResultSelection, mapColumnValue = (value) => value, parseJson = false, path2) {
|
|
23725
|
+
function mapRelationalRow(row, buildQueryResultSelection, mapColumnValue = (value) => value, parseJson = false, parseJsonIfString = false, path2) {
|
|
23700
23726
|
for (const selectionItem of buildQueryResultSelection) {
|
|
23701
23727
|
if (selectionItem.selection) {
|
|
23702
23728
|
const currentPath = `${path2 ? `${path2}.` : ""}${selectionItem.key}`;
|
|
23703
23729
|
if (row[selectionItem.key] === null) continue;
|
|
23704
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
|
+
}
|
|
23705
23734
|
if (selectionItem.isArray) {
|
|
23706
23735
|
for (const item of row[selectionItem.key]) {
|
|
23707
23736
|
mapRelationalRow(
|
|
@@ -23709,6 +23738,7 @@ function mapRelationalRow(row, buildQueryResultSelection, mapColumnValue = (valu
|
|
|
23709
23738
|
selectionItem.selection,
|
|
23710
23739
|
mapColumnValue,
|
|
23711
23740
|
false,
|
|
23741
|
+
parseJsonIfString,
|
|
23712
23742
|
currentPath
|
|
23713
23743
|
);
|
|
23714
23744
|
}
|
|
@@ -23719,6 +23749,7 @@ function mapRelationalRow(row, buildQueryResultSelection, mapColumnValue = (valu
|
|
|
23719
23749
|
selectionItem.selection,
|
|
23720
23750
|
mapColumnValue,
|
|
23721
23751
|
false,
|
|
23752
|
+
parseJsonIfString,
|
|
23722
23753
|
currentPath
|
|
23723
23754
|
);
|
|
23724
23755
|
continue;
|
|
@@ -24025,6 +24056,10 @@ var init_relations = __esm({
|
|
|
24025
24056
|
__publicField(this, "through");
|
|
24026
24057
|
__publicField(this, "throughTable");
|
|
24027
24058
|
__publicField(this, "isReversed");
|
|
24059
|
+
/** @internal */
|
|
24060
|
+
__publicField(this, "sourceColumnTableNames", []);
|
|
24061
|
+
/** @internal */
|
|
24062
|
+
__publicField(this, "targetColumnTableNames", []);
|
|
24028
24063
|
this.targetTableName = targetTableName;
|
|
24029
24064
|
this.targetTable = targetTable;
|
|
24030
24065
|
}
|
|
@@ -24040,12 +24075,14 @@ var init_relations = __esm({
|
|
|
24040
24075
|
if (config?.from) {
|
|
24041
24076
|
this.sourceColumns = (Array.isArray(config.from) ? config.from : [config.from]).map((it) => {
|
|
24042
24077
|
this.throughTable ??= it._.through ? tables[it._.through._.tableName] : void 0;
|
|
24078
|
+
this.sourceColumnTableNames.push(it._.tableName);
|
|
24043
24079
|
return it._.column;
|
|
24044
24080
|
});
|
|
24045
24081
|
}
|
|
24046
24082
|
if (config?.to) {
|
|
24047
24083
|
this.targetColumns = (Array.isArray(config.to) ? config.to : [config.to]).map((it) => {
|
|
24048
24084
|
this.throughTable ??= it._.through ? tables[it._.through._.tableName] : void 0;
|
|
24085
|
+
this.targetColumnTableNames.push(it._.tableName);
|
|
24049
24086
|
return it._.column;
|
|
24050
24087
|
});
|
|
24051
24088
|
}
|
|
@@ -24069,12 +24106,14 @@ var init_relations = __esm({
|
|
|
24069
24106
|
if (config?.from) {
|
|
24070
24107
|
this.sourceColumns = (Array.isArray(config.from) ? config.from : [config.from]).map((it) => {
|
|
24071
24108
|
this.throughTable ??= it._.through ? tables[it._.through._.tableName] : void 0;
|
|
24109
|
+
this.sourceColumnTableNames.push(it._.tableName);
|
|
24072
24110
|
return it._.column;
|
|
24073
24111
|
});
|
|
24074
24112
|
}
|
|
24075
24113
|
if (config?.to) {
|
|
24076
24114
|
this.targetColumns = (Array.isArray(config.to) ? config.to : [config.to]).map((it) => {
|
|
24077
24115
|
this.throughTable ??= it._.through ? tables[it._.through._.tableName] : void 0;
|
|
24116
|
+
this.targetColumnTableNames.push(it._.tableName);
|
|
24078
24117
|
return it._.column;
|
|
24079
24118
|
});
|
|
24080
24119
|
}
|
|
@@ -40567,7 +40606,7 @@ var init_dialect3 = __esm({
|
|
|
40567
40606
|
mode,
|
|
40568
40607
|
errorPath,
|
|
40569
40608
|
depth,
|
|
40570
|
-
|
|
40609
|
+
isNestedMany,
|
|
40571
40610
|
throughJoin
|
|
40572
40611
|
}) {
|
|
40573
40612
|
const selection = [];
|
|
@@ -40616,7 +40655,7 @@ var init_dialect3 = __esm({
|
|
|
40616
40655
|
relationWhere: filter2,
|
|
40617
40656
|
errorPath: `${currentPath.length ? `${currentPath}.` : ""}${k}`,
|
|
40618
40657
|
depth: currentDepth + 1,
|
|
40619
|
-
|
|
40658
|
+
isNestedMany: !isSingle2,
|
|
40620
40659
|
throughJoin: throughJoin2
|
|
40621
40660
|
});
|
|
40622
40661
|
selection.push({
|
|
@@ -40641,7 +40680,7 @@ var init_dialect3 = __esm({
|
|
|
40641
40680
|
message: `No fields selected for table "${tableConfig.name}"${currentPath ? ` ("${currentPath}")` : ""}`
|
|
40642
40681
|
});
|
|
40643
40682
|
}
|
|
40644
|
-
if (
|
|
40683
|
+
if (isNestedMany && order) {
|
|
40645
40684
|
selectionArr.push(sql`row_number() over (order by ${order})`);
|
|
40646
40685
|
}
|
|
40647
40686
|
const selectionSet = sql.join(selectionArr, sql`, `);
|
|
@@ -44571,6 +44610,10 @@ var init_float2 = __esm({
|
|
|
44571
44610
|
}
|
|
44572
44611
|
return this.unsigned ? `${type} unsigned` : type;
|
|
44573
44612
|
}
|
|
44613
|
+
mapFromDriverValue(value) {
|
|
44614
|
+
if (typeof value !== "number") return Number(value);
|
|
44615
|
+
return value;
|
|
44616
|
+
}
|
|
44574
44617
|
};
|
|
44575
44618
|
__publicField(SingleStoreFloat, _a401, "SingleStoreFloat");
|
|
44576
44619
|
}
|
|
@@ -45152,9 +45195,9 @@ var init_varchar3 = __esm({
|
|
|
45152
45195
|
// ../drizzle-orm/dist/singlestore-core/columns/vector.js
|
|
45153
45196
|
function vector2(a, b) {
|
|
45154
45197
|
const { name: name2, config } = getColumnNameAndConfig(a, b);
|
|
45155
|
-
return new SingleStoreVectorBuilder(name2, config);
|
|
45198
|
+
return config.elementType === "I64" ? new SingleStoreBigIntVectorBuilder(name2, config) : new SingleStoreVectorBuilder(name2, config);
|
|
45156
45199
|
}
|
|
45157
|
-
var _a430, _b324, SingleStoreVectorBuilder, _a431, _b325, SingleStoreVector;
|
|
45200
|
+
var _a430, _b324, SingleStoreVectorBuilder, _a431, _b325, SingleStoreVector, _a432, _b326, SingleStoreBigIntVectorBuilder, _a433, _b327, SingleStoreBigIntVector;
|
|
45158
45201
|
var init_vector4 = __esm({
|
|
45159
45202
|
"../drizzle-orm/dist/singlestore-core/columns/vector.js"() {
|
|
45160
45203
|
"use strict";
|
|
@@ -45190,13 +45233,81 @@ var init_vector4 = __esm({
|
|
|
45190
45233
|
return `vector(${this.config.length}, ${this.elementType || "F32"})`;
|
|
45191
45234
|
}
|
|
45192
45235
|
mapToDriverValue(value) {
|
|
45193
|
-
return
|
|
45236
|
+
return `[${value.map((e) => e.toString()).join(",")}]`;
|
|
45194
45237
|
}
|
|
45195
45238
|
mapFromDriverValue(value) {
|
|
45196
|
-
|
|
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;
|
|
45197
45265
|
}
|
|
45198
45266
|
};
|
|
45199
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");
|
|
45200
45311
|
}
|
|
45201
45312
|
});
|
|
45202
45313
|
|
|
@@ -45204,13 +45315,13 @@ var init_vector4 = __esm({
|
|
|
45204
45315
|
function year2(name2) {
|
|
45205
45316
|
return new SingleStoreYearBuilder(name2 ?? "");
|
|
45206
45317
|
}
|
|
45207
|
-
var
|
|
45318
|
+
var _a434, _b328, SingleStoreYearBuilder, _a435, _b329, SingleStoreYear;
|
|
45208
45319
|
var init_year2 = __esm({
|
|
45209
45320
|
"../drizzle-orm/dist/singlestore-core/columns/year.js"() {
|
|
45210
45321
|
"use strict";
|
|
45211
45322
|
init_entity();
|
|
45212
45323
|
init_common5();
|
|
45213
|
-
SingleStoreYearBuilder = class extends (
|
|
45324
|
+
SingleStoreYearBuilder = class extends (_b328 = SingleStoreColumnBuilder, _a434 = entityKind, _b328) {
|
|
45214
45325
|
constructor(name2) {
|
|
45215
45326
|
super(name2, "number year", "SingleStoreYear");
|
|
45216
45327
|
}
|
|
@@ -45222,13 +45333,17 @@ var init_year2 = __esm({
|
|
|
45222
45333
|
);
|
|
45223
45334
|
}
|
|
45224
45335
|
};
|
|
45225
|
-
__publicField(SingleStoreYearBuilder,
|
|
45226
|
-
SingleStoreYear = class extends (
|
|
45336
|
+
__publicField(SingleStoreYearBuilder, _a434, "SingleStoreYearBuilder");
|
|
45337
|
+
SingleStoreYear = class extends (_b329 = SingleStoreColumn, _a435 = entityKind, _b329) {
|
|
45227
45338
|
getSQLType() {
|
|
45228
45339
|
return `year`;
|
|
45229
45340
|
}
|
|
45341
|
+
mapFromDriverValue(value) {
|
|
45342
|
+
if (typeof value !== "number") return Number(value);
|
|
45343
|
+
return value;
|
|
45344
|
+
}
|
|
45230
45345
|
};
|
|
45231
|
-
__publicField(SingleStoreYear,
|
|
45346
|
+
__publicField(SingleStoreYear, _a435, "SingleStoreYear");
|
|
45232
45347
|
}
|
|
45233
45348
|
});
|
|
45234
45349
|
|
|
@@ -45266,17 +45381,17 @@ var init_columns4 = __esm({
|
|
|
45266
45381
|
});
|
|
45267
45382
|
|
|
45268
45383
|
// ../drizzle-orm/dist/singlestore-core/query-builders/count.js
|
|
45269
|
-
var
|
|
45384
|
+
var _a436, _b330, _c12, _SingleStoreCountBuilder, SingleStoreCountBuilder;
|
|
45270
45385
|
var init_count4 = __esm({
|
|
45271
45386
|
"../drizzle-orm/dist/singlestore-core/query-builders/count.js"() {
|
|
45272
45387
|
"use strict";
|
|
45273
45388
|
init_entity();
|
|
45274
45389
|
init_sql();
|
|
45275
|
-
_SingleStoreCountBuilder = class _SingleStoreCountBuilder extends (_c12 = SQL,
|
|
45390
|
+
_SingleStoreCountBuilder = class _SingleStoreCountBuilder extends (_c12 = SQL, _b330 = entityKind, _a436 = Symbol.toStringTag, _c12) {
|
|
45276
45391
|
constructor(params) {
|
|
45277
45392
|
super(_SingleStoreCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
|
|
45278
45393
|
__publicField(this, "sql");
|
|
45279
|
-
__publicField(this,
|
|
45394
|
+
__publicField(this, _a436, "SingleStoreCountBuilder");
|
|
45280
45395
|
__publicField(this, "session");
|
|
45281
45396
|
this.params = params;
|
|
45282
45397
|
this.mapWith(Number);
|
|
@@ -45314,18 +45429,18 @@ var init_count4 = __esm({
|
|
|
45314
45429
|
);
|
|
45315
45430
|
}
|
|
45316
45431
|
};
|
|
45317
|
-
__publicField(_SingleStoreCountBuilder,
|
|
45432
|
+
__publicField(_SingleStoreCountBuilder, _b330, "SingleStoreCountBuilder");
|
|
45318
45433
|
SingleStoreCountBuilder = _SingleStoreCountBuilder;
|
|
45319
45434
|
}
|
|
45320
45435
|
});
|
|
45321
45436
|
|
|
45322
45437
|
// ../drizzle-orm/dist/singlestore-core/indexes.js
|
|
45323
|
-
var
|
|
45438
|
+
var _a437, IndexBuilderOn4, _a438, IndexBuilder4, _a439, Index6;
|
|
45324
45439
|
var init_indexes4 = __esm({
|
|
45325
45440
|
"../drizzle-orm/dist/singlestore-core/indexes.js"() {
|
|
45326
45441
|
"use strict";
|
|
45327
45442
|
init_entity();
|
|
45328
|
-
|
|
45443
|
+
_a437 = entityKind;
|
|
45329
45444
|
IndexBuilderOn4 = class {
|
|
45330
45445
|
constructor(name2, unique) {
|
|
45331
45446
|
this.name = name2;
|
|
@@ -45335,8 +45450,8 @@ var init_indexes4 = __esm({
|
|
|
45335
45450
|
return new IndexBuilder4(this.name, columns, this.unique);
|
|
45336
45451
|
}
|
|
45337
45452
|
};
|
|
45338
|
-
__publicField(IndexBuilderOn4,
|
|
45339
|
-
|
|
45453
|
+
__publicField(IndexBuilderOn4, _a437, "SingleStoreIndexBuilderOn");
|
|
45454
|
+
_a438 = entityKind;
|
|
45340
45455
|
IndexBuilder4 = class {
|
|
45341
45456
|
constructor(name2, columns, unique) {
|
|
45342
45457
|
/** @internal */
|
|
@@ -45364,15 +45479,15 @@ var init_indexes4 = __esm({
|
|
|
45364
45479
|
return new Index6(this.config, table6);
|
|
45365
45480
|
}
|
|
45366
45481
|
};
|
|
45367
|
-
__publicField(IndexBuilder4,
|
|
45368
|
-
|
|
45482
|
+
__publicField(IndexBuilder4, _a438, "SingleStoreIndexBuilder");
|
|
45483
|
+
_a439 = entityKind;
|
|
45369
45484
|
Index6 = class {
|
|
45370
45485
|
constructor(config, table6) {
|
|
45371
45486
|
__publicField(this, "config");
|
|
45372
45487
|
this.config = { ...config, table: table6 };
|
|
45373
45488
|
}
|
|
45374
45489
|
};
|
|
45375
|
-
__publicField(Index6,
|
|
45490
|
+
__publicField(Index6, _a439, "SingleStoreIndex");
|
|
45376
45491
|
}
|
|
45377
45492
|
});
|
|
45378
45493
|
|
|
@@ -45460,20 +45575,20 @@ function singlestoreTableWithSchema(name2, columns, extraConfig, schema5, baseNa
|
|
|
45460
45575
|
}
|
|
45461
45576
|
return table6;
|
|
45462
45577
|
}
|
|
45463
|
-
var
|
|
45578
|
+
var _a440, _b331, _c13, _d5, SingleStoreTable;
|
|
45464
45579
|
var init_table5 = __esm({
|
|
45465
45580
|
"../drizzle-orm/dist/singlestore-core/table.js"() {
|
|
45466
45581
|
"use strict";
|
|
45467
45582
|
init_entity();
|
|
45468
45583
|
init_table();
|
|
45469
45584
|
init_all4();
|
|
45470
|
-
SingleStoreTable = class extends (_d5 = Table2, _c13 = entityKind,
|
|
45585
|
+
SingleStoreTable = class extends (_d5 = Table2, _c13 = entityKind, _b331 = Table2.Symbol.Columns, _a440 = Table2.Symbol.ExtraConfigBuilder, _d5) {
|
|
45471
45586
|
constructor() {
|
|
45472
45587
|
super(...arguments);
|
|
45473
45588
|
/** @internal */
|
|
45474
|
-
__publicField(this,
|
|
45589
|
+
__publicField(this, _b331);
|
|
45475
45590
|
/** @internal */
|
|
45476
|
-
__publicField(this,
|
|
45591
|
+
__publicField(this, _a440);
|
|
45477
45592
|
}
|
|
45478
45593
|
};
|
|
45479
45594
|
__publicField(SingleStoreTable, _c13, "SingleStoreTable");
|
|
@@ -45483,13 +45598,13 @@ var init_table5 = __esm({
|
|
|
45483
45598
|
});
|
|
45484
45599
|
|
|
45485
45600
|
// ../drizzle-orm/dist/singlestore-core/primary-keys.js
|
|
45486
|
-
var
|
|
45601
|
+
var _a441, PrimaryKeyBuilder4, _a442, PrimaryKey4;
|
|
45487
45602
|
var init_primary_keys4 = __esm({
|
|
45488
45603
|
"../drizzle-orm/dist/singlestore-core/primary-keys.js"() {
|
|
45489
45604
|
"use strict";
|
|
45490
45605
|
init_entity();
|
|
45491
45606
|
init_table5();
|
|
45492
|
-
|
|
45607
|
+
_a441 = entityKind;
|
|
45493
45608
|
PrimaryKeyBuilder4 = class {
|
|
45494
45609
|
constructor(columns, name2) {
|
|
45495
45610
|
/** @internal */
|
|
@@ -45504,8 +45619,8 @@ var init_primary_keys4 = __esm({
|
|
|
45504
45619
|
return new PrimaryKey4(table6, this.columns, this.name);
|
|
45505
45620
|
}
|
|
45506
45621
|
};
|
|
45507
|
-
__publicField(PrimaryKeyBuilder4,
|
|
45508
|
-
|
|
45622
|
+
__publicField(PrimaryKeyBuilder4, _a441, "SingleStorePrimaryKeyBuilder");
|
|
45623
|
+
_a442 = entityKind;
|
|
45509
45624
|
PrimaryKey4 = class {
|
|
45510
45625
|
constructor(table6, columns, name2) {
|
|
45511
45626
|
__publicField(this, "columns");
|
|
@@ -45518,7 +45633,7 @@ var init_primary_keys4 = __esm({
|
|
|
45518
45633
|
return this.name ?? `${this.table[SingleStoreTable.Symbol.Name]}_${this.columns.map((column6) => column6.name).join("_")}_pk`;
|
|
45519
45634
|
}
|
|
45520
45635
|
};
|
|
45521
|
-
__publicField(PrimaryKey4,
|
|
45636
|
+
__publicField(PrimaryKey4, _a442, "SingleStorePrimaryKey");
|
|
45522
45637
|
}
|
|
45523
45638
|
});
|
|
45524
45639
|
|
|
@@ -45582,7 +45697,7 @@ var init_utils10 = __esm({
|
|
|
45582
45697
|
});
|
|
45583
45698
|
|
|
45584
45699
|
// ../drizzle-orm/dist/singlestore-core/query-builders/delete.js
|
|
45585
|
-
var
|
|
45700
|
+
var _a443, _b332, SingleStoreDeleteBase;
|
|
45586
45701
|
var init_delete4 = __esm({
|
|
45587
45702
|
"../drizzle-orm/dist/singlestore-core/query-builders/delete.js"() {
|
|
45588
45703
|
"use strict";
|
|
@@ -45591,7 +45706,7 @@ var init_delete4 = __esm({
|
|
|
45591
45706
|
init_selection_proxy();
|
|
45592
45707
|
init_table();
|
|
45593
45708
|
init_utils10();
|
|
45594
|
-
SingleStoreDeleteBase = class extends (
|
|
45709
|
+
SingleStoreDeleteBase = class extends (_b332 = QueryPromise, _a443 = entityKind, _b332) {
|
|
45595
45710
|
constructor(table6, session, dialect6, withList) {
|
|
45596
45711
|
super();
|
|
45597
45712
|
__publicField(this, "config");
|
|
@@ -45688,12 +45803,12 @@ var init_delete4 = __esm({
|
|
|
45688
45803
|
return this;
|
|
45689
45804
|
}
|
|
45690
45805
|
};
|
|
45691
|
-
__publicField(SingleStoreDeleteBase,
|
|
45806
|
+
__publicField(SingleStoreDeleteBase, _a443, "SingleStoreDelete");
|
|
45692
45807
|
}
|
|
45693
45808
|
});
|
|
45694
45809
|
|
|
45695
45810
|
// ../drizzle-orm/dist/singlestore-core/query-builders/insert.js
|
|
45696
|
-
var
|
|
45811
|
+
var _a444, SingleStoreInsertBuilder, _a445, _b333, SingleStoreInsertBase;
|
|
45697
45812
|
var init_insert4 = __esm({
|
|
45698
45813
|
"../drizzle-orm/dist/singlestore-core/query-builders/insert.js"() {
|
|
45699
45814
|
"use strict";
|
|
@@ -45703,7 +45818,7 @@ var init_insert4 = __esm({
|
|
|
45703
45818
|
init_table();
|
|
45704
45819
|
init_utils2();
|
|
45705
45820
|
init_utils10();
|
|
45706
|
-
|
|
45821
|
+
_a444 = entityKind;
|
|
45707
45822
|
SingleStoreInsertBuilder = class {
|
|
45708
45823
|
constructor(table6, session, dialect6) {
|
|
45709
45824
|
__publicField(this, "shouldIgnore", false);
|
|
@@ -45732,8 +45847,8 @@ var init_insert4 = __esm({
|
|
|
45732
45847
|
return new SingleStoreInsertBase(this.table, mappedValues, this.shouldIgnore, this.session, this.dialect);
|
|
45733
45848
|
}
|
|
45734
45849
|
};
|
|
45735
|
-
__publicField(SingleStoreInsertBuilder,
|
|
45736
|
-
SingleStoreInsertBase = class extends (
|
|
45850
|
+
__publicField(SingleStoreInsertBuilder, _a444, "SingleStoreInsertBuilder");
|
|
45851
|
+
SingleStoreInsertBase = class extends (_b333 = QueryPromise, _a445 = entityKind, _b333) {
|
|
45737
45852
|
constructor(table6, values, ignore, session, dialect6) {
|
|
45738
45853
|
super();
|
|
45739
45854
|
__publicField(this, "config");
|
|
@@ -45818,12 +45933,12 @@ var init_insert4 = __esm({
|
|
|
45818
45933
|
return this;
|
|
45819
45934
|
}
|
|
45820
45935
|
};
|
|
45821
|
-
__publicField(SingleStoreInsertBase,
|
|
45936
|
+
__publicField(SingleStoreInsertBase, _a445, "SingleStoreInsert");
|
|
45822
45937
|
}
|
|
45823
45938
|
});
|
|
45824
45939
|
|
|
45825
45940
|
// ../drizzle-orm/dist/singlestore-core/dialect.js
|
|
45826
|
-
var
|
|
45941
|
+
var _a446, SingleStoreDialect;
|
|
45827
45942
|
var init_dialect4 = __esm({
|
|
45828
45943
|
"../drizzle-orm/dist/singlestore-core/dialect.js"() {
|
|
45829
45944
|
"use strict";
|
|
@@ -45833,6 +45948,7 @@ var init_dialect4 = __esm({
|
|
|
45833
45948
|
init_column();
|
|
45834
45949
|
init_entity();
|
|
45835
45950
|
init_errors();
|
|
45951
|
+
init_relations();
|
|
45836
45952
|
init_expressions();
|
|
45837
45953
|
init_sql();
|
|
45838
45954
|
init_subquery();
|
|
@@ -45841,11 +45957,62 @@ var init_dialect4 = __esm({
|
|
|
45841
45957
|
init_view_common();
|
|
45842
45958
|
init_common5();
|
|
45843
45959
|
init_table5();
|
|
45844
|
-
|
|
45960
|
+
_a446 = entityKind;
|
|
45845
45961
|
SingleStoreDialect = class {
|
|
45846
45962
|
constructor(config) {
|
|
45847
45963
|
/** @internal */
|
|
45848
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));
|
|
45849
46016
|
this.casing = new CasingCache(config?.casing);
|
|
45850
46017
|
}
|
|
45851
46018
|
async migrate(migrations, session, config) {
|
|
@@ -46180,7 +46347,7 @@ var init_dialect4 = __esm({
|
|
|
46180
46347
|
invokeSource
|
|
46181
46348
|
});
|
|
46182
46349
|
}
|
|
46183
|
-
|
|
46350
|
+
_buildRelationalQuery({
|
|
46184
46351
|
fullSchema,
|
|
46185
46352
|
schema: schema5,
|
|
46186
46353
|
tableNamesMap,
|
|
@@ -46290,7 +46457,7 @@ var init_dialect4 = __esm({
|
|
|
46290
46457
|
)
|
|
46291
46458
|
)
|
|
46292
46459
|
);
|
|
46293
|
-
const builtRelation = this.
|
|
46460
|
+
const builtRelation = this._buildRelationalQuery({
|
|
46294
46461
|
fullSchema,
|
|
46295
46462
|
schema: schema5,
|
|
46296
46463
|
tableNamesMap,
|
|
@@ -46405,8 +46572,140 @@ var init_dialect4 = __esm({
|
|
|
46405
46572
|
selection
|
|
46406
46573
|
};
|
|
46407
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
|
+
}
|
|
46408
46707
|
};
|
|
46409
|
-
__publicField(SingleStoreDialect,
|
|
46708
|
+
__publicField(SingleStoreDialect, _a446, "SingleStoreDialect");
|
|
46410
46709
|
}
|
|
46411
46710
|
});
|
|
46412
46711
|
|
|
@@ -46428,7 +46727,7 @@ function createSetOperator4(type, isAll) {
|
|
|
46428
46727
|
return leftSelect.addSetOperators(setOperators);
|
|
46429
46728
|
};
|
|
46430
46729
|
}
|
|
46431
|
-
var
|
|
46730
|
+
var _a447, SingleStoreSelectBuilder, _a448, _b334, SingleStoreSelectQueryBuilderBase, _a449, _b335, SingleStoreSelectBase, getSingleStoreSetOperators, union5, unionAll4, intersect4, except4, minus;
|
|
46432
46731
|
var init_select5 = __esm({
|
|
46433
46732
|
"../drizzle-orm/dist/singlestore-core/query-builders/select.js"() {
|
|
46434
46733
|
"use strict";
|
|
@@ -46441,7 +46740,7 @@ var init_select5 = __esm({
|
|
|
46441
46740
|
init_table();
|
|
46442
46741
|
init_utils2();
|
|
46443
46742
|
init_utils10();
|
|
46444
|
-
|
|
46743
|
+
_a447 = entityKind;
|
|
46445
46744
|
SingleStoreSelectBuilder = class {
|
|
46446
46745
|
constructor(config) {
|
|
46447
46746
|
__publicField(this, "fields");
|
|
@@ -46484,8 +46783,8 @@ var init_select5 = __esm({
|
|
|
46484
46783
|
);
|
|
46485
46784
|
}
|
|
46486
46785
|
};
|
|
46487
|
-
__publicField(SingleStoreSelectBuilder,
|
|
46488
|
-
SingleStoreSelectQueryBuilderBase = class extends (
|
|
46786
|
+
__publicField(SingleStoreSelectBuilder, _a447, "SingleStoreSelectBuilder");
|
|
46787
|
+
SingleStoreSelectQueryBuilderBase = class extends (_b334 = TypedQueryBuilder, _a448 = entityKind, _b334) {
|
|
46489
46788
|
constructor({ table: table6, fields, isPartialSelect, session, dialect: dialect6, withList, distinct }) {
|
|
46490
46789
|
super();
|
|
46491
46790
|
__publicField(this, "_");
|
|
@@ -47106,8 +47405,8 @@ var init_select5 = __esm({
|
|
|
47106
47405
|
return this;
|
|
47107
47406
|
}
|
|
47108
47407
|
};
|
|
47109
|
-
__publicField(SingleStoreSelectQueryBuilderBase,
|
|
47110
|
-
SingleStoreSelectBase = class extends (
|
|
47408
|
+
__publicField(SingleStoreSelectQueryBuilderBase, _a448, "SingleStoreSelectQueryBuilder");
|
|
47409
|
+
SingleStoreSelectBase = class extends (_b335 = SingleStoreSelectQueryBuilderBase, _a449 = entityKind, _b335) {
|
|
47111
47410
|
constructor() {
|
|
47112
47411
|
super(...arguments);
|
|
47113
47412
|
__publicField(this, "execute", (placeholderValues) => {
|
|
@@ -47138,7 +47437,7 @@ var init_select5 = __esm({
|
|
|
47138
47437
|
return this;
|
|
47139
47438
|
}
|
|
47140
47439
|
};
|
|
47141
|
-
__publicField(SingleStoreSelectBase,
|
|
47440
|
+
__publicField(SingleStoreSelectBase, _a449, "SingleStoreSelect");
|
|
47142
47441
|
applyMixins(SingleStoreSelectBase, [QueryPromise]);
|
|
47143
47442
|
getSingleStoreSetOperators = () => ({
|
|
47144
47443
|
union: union5,
|
|
@@ -47156,7 +47455,7 @@ var init_select5 = __esm({
|
|
|
47156
47455
|
});
|
|
47157
47456
|
|
|
47158
47457
|
// ../drizzle-orm/dist/singlestore-core/query-builders/query-builder.js
|
|
47159
|
-
var
|
|
47458
|
+
var _a450, QueryBuilder4;
|
|
47160
47459
|
var init_query_builder5 = __esm({
|
|
47161
47460
|
"../drizzle-orm/dist/singlestore-core/query-builders/query-builder.js"() {
|
|
47162
47461
|
"use strict";
|
|
@@ -47165,7 +47464,7 @@ var init_query_builder5 = __esm({
|
|
|
47165
47464
|
init_dialect4();
|
|
47166
47465
|
init_subquery();
|
|
47167
47466
|
init_select5();
|
|
47168
|
-
|
|
47467
|
+
_a450 = entityKind;
|
|
47169
47468
|
QueryBuilder4 = class {
|
|
47170
47469
|
constructor(dialect6) {
|
|
47171
47470
|
__publicField(this, "dialect");
|
|
@@ -47235,7 +47534,7 @@ var init_query_builder5 = __esm({
|
|
|
47235
47534
|
return this.dialect;
|
|
47236
47535
|
}
|
|
47237
47536
|
};
|
|
47238
|
-
__publicField(QueryBuilder4,
|
|
47537
|
+
__publicField(QueryBuilder4, _a450, "SingleStoreQueryBuilder");
|
|
47239
47538
|
}
|
|
47240
47539
|
});
|
|
47241
47540
|
|
|
@@ -47247,7 +47546,7 @@ var init_select_types4 = __esm({
|
|
|
47247
47546
|
});
|
|
47248
47547
|
|
|
47249
47548
|
// ../drizzle-orm/dist/singlestore-core/query-builders/update.js
|
|
47250
|
-
var
|
|
47549
|
+
var _a451, SingleStoreUpdateBuilder, _a452, _b336, SingleStoreUpdateBase;
|
|
47251
47550
|
var init_update4 = __esm({
|
|
47252
47551
|
"../drizzle-orm/dist/singlestore-core/query-builders/update.js"() {
|
|
47253
47552
|
"use strict";
|
|
@@ -47257,7 +47556,7 @@ var init_update4 = __esm({
|
|
|
47257
47556
|
init_table();
|
|
47258
47557
|
init_utils2();
|
|
47259
47558
|
init_utils10();
|
|
47260
|
-
|
|
47559
|
+
_a451 = entityKind;
|
|
47261
47560
|
SingleStoreUpdateBuilder = class {
|
|
47262
47561
|
constructor(table6, session, dialect6, withList) {
|
|
47263
47562
|
this.table = table6;
|
|
@@ -47275,8 +47574,8 @@ var init_update4 = __esm({
|
|
|
47275
47574
|
);
|
|
47276
47575
|
}
|
|
47277
47576
|
};
|
|
47278
|
-
__publicField(SingleStoreUpdateBuilder,
|
|
47279
|
-
SingleStoreUpdateBase = class extends (
|
|
47577
|
+
__publicField(SingleStoreUpdateBuilder, _a451, "SingleStoreUpdateBuilder");
|
|
47578
|
+
SingleStoreUpdateBase = class extends (_b336 = QueryPromise, _a452 = entityKind, _b336) {
|
|
47280
47579
|
constructor(table6, set, session, dialect6, withList) {
|
|
47281
47580
|
super();
|
|
47282
47581
|
__publicField(this, "config");
|
|
@@ -47376,7 +47675,7 @@ var init_update4 = __esm({
|
|
|
47376
47675
|
return this;
|
|
47377
47676
|
}
|
|
47378
47677
|
};
|
|
47379
|
-
__publicField(SingleStoreUpdateBase,
|
|
47678
|
+
__publicField(SingleStoreUpdateBase, _a452, "SingleStoreUpdate");
|
|
47380
47679
|
}
|
|
47381
47680
|
});
|
|
47382
47681
|
|
|
@@ -47393,8 +47692,103 @@ var init_query_builders4 = __esm({
|
|
|
47393
47692
|
}
|
|
47394
47693
|
});
|
|
47395
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
|
+
|
|
47396
47790
|
// ../drizzle-orm/dist/singlestore-core/db.js
|
|
47397
|
-
var
|
|
47791
|
+
var _a455, SingleStoreDatabase;
|
|
47398
47792
|
var init_db4 = __esm({
|
|
47399
47793
|
"../drizzle-orm/dist/singlestore-core/db.js"() {
|
|
47400
47794
|
"use strict";
|
|
@@ -47404,11 +47798,11 @@ var init_db4 = __esm({
|
|
|
47404
47798
|
init_subquery();
|
|
47405
47799
|
init_count4();
|
|
47406
47800
|
init_query_builders4();
|
|
47407
|
-
|
|
47801
|
+
init_query7();
|
|
47802
|
+
_a455 = entityKind;
|
|
47408
47803
|
SingleStoreDatabase = class {
|
|
47409
|
-
constructor(dialect6, session, schema5) {
|
|
47410
|
-
//
|
|
47411
|
-
/**@inrernal */
|
|
47804
|
+
constructor(dialect6, session, relations, schema5) {
|
|
47805
|
+
// TO-DO: Figure out how to pass DrizzleTypeError without breaking withReplicas
|
|
47412
47806
|
__publicField(this, "query");
|
|
47413
47807
|
/**
|
|
47414
47808
|
* Creates a subquery that defines a temporary named result set as a CTE.
|
|
@@ -47466,13 +47860,24 @@ var init_db4 = __esm({
|
|
|
47466
47860
|
this._ = schema5 ? {
|
|
47467
47861
|
schema: schema5.schema,
|
|
47468
47862
|
fullSchema: schema5.fullSchema,
|
|
47469
|
-
tableNamesMap: schema5.tableNamesMap
|
|
47863
|
+
tableNamesMap: schema5.tableNamesMap,
|
|
47864
|
+
relations
|
|
47470
47865
|
} : {
|
|
47471
47866
|
schema: void 0,
|
|
47472
47867
|
fullSchema: {},
|
|
47473
|
-
tableNamesMap: {}
|
|
47868
|
+
tableNamesMap: {},
|
|
47869
|
+
relations
|
|
47474
47870
|
};
|
|
47475
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
|
+
}
|
|
47476
47881
|
this.$cache = { invalidate: async (_params) => {
|
|
47477
47882
|
} };
|
|
47478
47883
|
}
|
|
@@ -47611,18 +48016,18 @@ var init_db4 = __esm({
|
|
|
47611
48016
|
return this.session.transaction(transaction, config);
|
|
47612
48017
|
}
|
|
47613
48018
|
};
|
|
47614
|
-
__publicField(SingleStoreDatabase,
|
|
48019
|
+
__publicField(SingleStoreDatabase, _a455, "SingleStoreDatabase");
|
|
47615
48020
|
}
|
|
47616
48021
|
});
|
|
47617
48022
|
|
|
47618
48023
|
// ../drizzle-orm/dist/singlestore-core/schema.js
|
|
47619
|
-
var
|
|
48024
|
+
var _a456, SingleStoreSchema5;
|
|
47620
48025
|
var init_schema3 = __esm({
|
|
47621
48026
|
"../drizzle-orm/dist/singlestore-core/schema.js"() {
|
|
47622
48027
|
"use strict";
|
|
47623
48028
|
init_entity();
|
|
47624
48029
|
init_table5();
|
|
47625
|
-
|
|
48030
|
+
_a456 = entityKind;
|
|
47626
48031
|
SingleStoreSchema5 = class {
|
|
47627
48032
|
constructor(schemaName) {
|
|
47628
48033
|
__publicField(this, "table", (name2, columns, extraConfig) => {
|
|
@@ -47635,12 +48040,12 @@ var init_schema3 = __esm({
|
|
|
47635
48040
|
return singlestoreViewWithSchema(name, columns, this.schemaName);
|
|
47636
48041
|
}) as typeof singlestoreView; */
|
|
47637
48042
|
};
|
|
47638
|
-
__publicField(SingleStoreSchema5,
|
|
48043
|
+
__publicField(SingleStoreSchema5, _a456, "SingleStoreSchema");
|
|
47639
48044
|
}
|
|
47640
48045
|
});
|
|
47641
48046
|
|
|
47642
48047
|
// ../drizzle-orm/dist/singlestore-core/session.js
|
|
47643
|
-
var
|
|
48048
|
+
var _a457, SingleStorePreparedQuery, _a458, SingleStoreSession, _a459, _b338, SingleStoreTransaction;
|
|
47644
48049
|
var init_session4 = __esm({
|
|
47645
48050
|
"../drizzle-orm/dist/singlestore-core/session.js"() {
|
|
47646
48051
|
"use strict";
|
|
@@ -47649,7 +48054,7 @@ var init_session4 = __esm({
|
|
|
47649
48054
|
init_errors();
|
|
47650
48055
|
init_sql();
|
|
47651
48056
|
init_db4();
|
|
47652
|
-
|
|
48057
|
+
_a457 = entityKind;
|
|
47653
48058
|
SingleStorePreparedQuery = class {
|
|
47654
48059
|
constructor(cache, queryMetadata, cacheConfig) {
|
|
47655
48060
|
/** @internal */
|
|
@@ -47731,8 +48136,8 @@ var init_session4 = __esm({
|
|
|
47731
48136
|
}
|
|
47732
48137
|
}
|
|
47733
48138
|
};
|
|
47734
|
-
__publicField(SingleStorePreparedQuery,
|
|
47735
|
-
|
|
48139
|
+
__publicField(SingleStorePreparedQuery, _a457, "SingleStorePreparedQuery");
|
|
48140
|
+
_a458 = entityKind;
|
|
47736
48141
|
SingleStoreSession = class {
|
|
47737
48142
|
constructor(dialect6) {
|
|
47738
48143
|
this.dialect = dialect6;
|
|
@@ -47767,10 +48172,11 @@ var init_session4 = __esm({
|
|
|
47767
48172
|
return parts.length ? sql`start transaction ${sql.raw(parts.join(" "))}` : void 0;
|
|
47768
48173
|
}
|
|
47769
48174
|
};
|
|
47770
|
-
__publicField(SingleStoreSession,
|
|
47771
|
-
SingleStoreTransaction = class extends (
|
|
47772
|
-
constructor(dialect6, session, schema5, nestedIndex) {
|
|
47773
|
-
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;
|
|
47774
48180
|
this.schema = schema5;
|
|
47775
48181
|
this.nestedIndex = nestedIndex;
|
|
47776
48182
|
}
|
|
@@ -47778,7 +48184,7 @@ var init_session4 = __esm({
|
|
|
47778
48184
|
throw new TransactionRollbackError();
|
|
47779
48185
|
}
|
|
47780
48186
|
};
|
|
47781
|
-
__publicField(SingleStoreTransaction,
|
|
48187
|
+
__publicField(SingleStoreTransaction, _a459, "SingleStoreTransaction");
|
|
47782
48188
|
}
|
|
47783
48189
|
});
|
|
47784
48190
|
|