drizzle-kit 0.23.2-ab12f1d → 0.23.2-e30226e
Sign up to get free protection for your applications and to get access to all the features.
- package/api.js +131 -481
- package/api.mjs +131 -481
- package/bin.cjs +7 -132
- package/package.json +2 -1
package/api.mjs
CHANGED
@@ -3597,7 +3597,7 @@ function createZodEnum(values, params) {
|
|
3597
3597
|
...processCreateParams(params)
|
3598
3598
|
});
|
3599
3599
|
}
|
3600
|
-
var util, objectUtil, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, _ZodEnum_cache, _ZodNativeEnum_cache, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv6Regex, base64Regex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType
|
3600
|
+
var util, objectUtil, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, _ZodEnum_cache, _ZodNativeEnum_cache, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv6Regex, base64Regex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType;
|
3601
3601
|
var init_lib = __esm({
|
3602
3602
|
"../node_modules/.pnpm/zod@3.23.7/node_modules/zod/lib/index.mjs"() {
|
3603
3603
|
"use strict";
|
@@ -7189,16 +7189,6 @@ var init_lib = __esm({
|
|
7189
7189
|
nullableType = ZodNullable.create;
|
7190
7190
|
preprocessType = ZodEffects.createWithPreprocess;
|
7191
7191
|
pipelineType = ZodPipeline.create;
|
7192
|
-
coerce = {
|
7193
|
-
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
7194
|
-
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
7195
|
-
boolean: (arg) => ZodBoolean.create({
|
7196
|
-
...arg,
|
7197
|
-
coerce: true
|
7198
|
-
}),
|
7199
|
-
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
7200
|
-
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
7201
|
-
};
|
7202
7192
|
}
|
7203
7193
|
});
|
7204
7194
|
|
@@ -8347,11 +8337,6 @@ var copy, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey
|
|
8347
8337
|
var init_utils = __esm({
|
8348
8338
|
"src/utils.ts"() {
|
8349
8339
|
"use strict";
|
8350
|
-
init_views();
|
8351
|
-
init_global();
|
8352
|
-
init_mysqlSchema();
|
8353
|
-
init_pgSchema();
|
8354
|
-
init_sqliteSchema();
|
8355
8340
|
copy = (it) => {
|
8356
8341
|
return JSON.parse(JSON.stringify(it));
|
8357
8342
|
};
|
@@ -8399,7 +8384,6 @@ var init_views = __esm({
|
|
8399
8384
|
"use strict";
|
8400
8385
|
init_source();
|
8401
8386
|
import_hanji = __toESM(require_hanji());
|
8402
|
-
init_utils();
|
8403
8387
|
warning = (msg) => {
|
8404
8388
|
(0, import_hanji.render)(`[${source_default.yellow("Warning")}] ${msg}`);
|
8405
8389
|
};
|
@@ -8596,7 +8580,6 @@ var init_serializer = __esm({
|
|
8596
8580
|
"src/serializer/index.ts"() {
|
8597
8581
|
"use strict";
|
8598
8582
|
glob = __toESM(require_glob());
|
8599
|
-
init_views();
|
8600
8583
|
sqlToStr = (sql2) => {
|
8601
8584
|
return sql2.toQuery({
|
8602
8585
|
escapeName: () => {
|
@@ -8618,10 +8601,6 @@ var fillPgSnapshot;
|
|
8618
8601
|
var init_migrationPreparator = __esm({
|
8619
8602
|
"src/migrationPreparator.ts"() {
|
8620
8603
|
"use strict";
|
8621
|
-
init_serializer();
|
8622
|
-
init_mysqlSchema();
|
8623
|
-
init_pgSchema();
|
8624
|
-
init_sqliteSchema();
|
8625
8604
|
fillPgSnapshot = ({
|
8626
8605
|
serialized,
|
8627
8606
|
id,
|
@@ -15819,13 +15798,6 @@ var init_snapshotsDiffer = __esm({
|
|
15819
15798
|
}
|
15820
15799
|
});
|
15821
15800
|
|
15822
|
-
// src/utils/words.ts
|
15823
|
-
var init_words = __esm({
|
15824
|
-
"src/utils/words.ts"() {
|
15825
|
-
"use strict";
|
15826
|
-
}
|
15827
|
-
});
|
15828
|
-
|
15829
15801
|
// src/schemaValidator.ts
|
15830
15802
|
var dialects, dialect3, commonSquashedSchema, commonSchema;
|
15831
15803
|
var init_schemaValidator = __esm({
|
@@ -15853,7 +15825,6 @@ var init_common = __esm({
|
|
15853
15825
|
"use strict";
|
15854
15826
|
init_lib();
|
15855
15827
|
init_schemaValidator();
|
15856
|
-
init_outputs();
|
15857
15828
|
sqliteDriversLiterals = [
|
15858
15829
|
literalType("turso"),
|
15859
15830
|
literalType("d1-http"),
|
@@ -15936,7 +15907,6 @@ var init_outputs = __esm({
|
|
15936
15907
|
"src/cli/validations/outputs.ts"() {
|
15937
15908
|
"use strict";
|
15938
15909
|
init_source();
|
15939
|
-
init_common();
|
15940
15910
|
withStyle = {
|
15941
15911
|
error: (str) => `${source_default.red(`${source_default.white.bgRed(" Invalid input ")} ${str}`)}`,
|
15942
15912
|
warning: (str) => `${source_default.white.bgGray(" Warning ")} ${str}`,
|
@@ -15953,16 +15923,8 @@ var import_hanji2, schemasResolver, tablesResolver, sequencesResolver, enumsReso
|
|
15953
15923
|
var init_migrate = __esm({
|
15954
15924
|
"src/cli/commands/migrate.ts"() {
|
15955
15925
|
"use strict";
|
15956
|
-
init_migrationPreparator();
|
15957
15926
|
init_source();
|
15958
15927
|
import_hanji2 = __toESM(require_hanji());
|
15959
|
-
init_mysqlSchema();
|
15960
|
-
init_pgSchema();
|
15961
|
-
init_sqliteSchema();
|
15962
|
-
init_snapshotsDiffer();
|
15963
|
-
init_utils();
|
15964
|
-
init_words();
|
15965
|
-
init_outputs();
|
15966
15928
|
init_views();
|
15967
15929
|
schemasResolver = async (input) => {
|
15968
15930
|
try {
|
@@ -17311,13 +17273,13 @@ var init_entity = __esm({
|
|
17311
17273
|
});
|
17312
17274
|
|
17313
17275
|
// ../node_modules/.pnpm/drizzle-orm@0.32.1_@aws-sdk+client-rds-data@3.583.0_@cloudflare+workers-types@4.20240524.0_@e_b4cdnxy7l6gc3lxxx27eybv3eu/node_modules/drizzle-orm/column.js
|
17314
|
-
var _a,
|
17276
|
+
var _a, Column;
|
17315
17277
|
var init_column = __esm({
|
17316
17278
|
"../node_modules/.pnpm/drizzle-orm@0.32.1_@aws-sdk+client-rds-data@3.583.0_@cloudflare+workers-types@4.20240524.0_@e_b4cdnxy7l6gc3lxxx27eybv3eu/node_modules/drizzle-orm/column.js"() {
|
17317
17279
|
"use strict";
|
17318
17280
|
init_entity();
|
17319
17281
|
_a = entityKind;
|
17320
|
-
|
17282
|
+
Column = class {
|
17321
17283
|
constructor(table4, config) {
|
17322
17284
|
__publicField(this, "name");
|
17323
17285
|
__publicField(this, "primary");
|
@@ -17363,7 +17325,7 @@ var init_column = __esm({
|
|
17363
17325
|
return this.config.generated !== void 0 && this.config.generated.type !== "byDefault";
|
17364
17326
|
}
|
17365
17327
|
};
|
17366
|
-
__publicField(
|
17328
|
+
__publicField(Column, _a, "Column");
|
17367
17329
|
}
|
17368
17330
|
});
|
17369
17331
|
|
@@ -17482,7 +17444,7 @@ function getTableName(table4) {
|
|
17482
17444
|
function getTableUniqueName(table4) {
|
17483
17445
|
return `${table4[Schema] ?? "public"}.${table4[TableName]}`;
|
17484
17446
|
}
|
17485
|
-
var TableName, Schema, Columns, ExtraConfigColumns, OriginalName, BaseName, IsAlias, ExtraConfigBuilder, IsDrizzleTable, _a3, _b, _c, _d, _e, _f, _g, _h, _i,
|
17447
|
+
var TableName, Schema, Columns, ExtraConfigColumns, OriginalName, BaseName, IsAlias, ExtraConfigBuilder, IsDrizzleTable, _a3, _b, _c, _d, _e, _f, _g, _h, _i, Table;
|
17486
17448
|
var init_table = __esm({
|
17487
17449
|
"../node_modules/.pnpm/drizzle-orm@0.32.1_@aws-sdk+client-rds-data@3.583.0_@cloudflare+workers-types@4.20240524.0_@e_b4cdnxy7l6gc3lxxx27eybv3eu/node_modules/drizzle-orm/table.js"() {
|
17488
17450
|
"use strict";
|
@@ -17497,7 +17459,7 @@ var init_table = __esm({
|
|
17497
17459
|
ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
|
17498
17460
|
IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
|
17499
17461
|
_i = entityKind, _h = TableName, _g = OriginalName, _f = Schema, _e = Columns, _d = ExtraConfigColumns, _c = BaseName, _b = IsAlias, _a3 = ExtraConfigBuilder;
|
17500
|
-
|
17462
|
+
Table = class {
|
17501
17463
|
constructor(name2, schema4, baseName) {
|
17502
17464
|
/**
|
17503
17465
|
* @internal
|
@@ -17529,9 +17491,9 @@ var init_table = __esm({
|
|
17529
17491
|
this[BaseName] = baseName;
|
17530
17492
|
}
|
17531
17493
|
};
|
17532
|
-
__publicField(
|
17494
|
+
__publicField(Table, _i, "Table");
|
17533
17495
|
/** @internal */
|
17534
|
-
__publicField(
|
17496
|
+
__publicField(Table, "Symbol", {
|
17535
17497
|
Name: TableName,
|
17536
17498
|
Schema,
|
17537
17499
|
OriginalName,
|
@@ -17563,8 +17525,8 @@ function pgTableWithSchema(name2, columns, extraConfig, schema4, baseName = name
|
|
17563
17525
|
})
|
17564
17526
|
);
|
17565
17527
|
const table4 = Object.assign(rawTable, builtColumns);
|
17566
|
-
table4[
|
17567
|
-
table4[
|
17528
|
+
table4[Table.Symbol.Columns] = builtColumns;
|
17529
|
+
table4[Table.Symbol.ExtraConfigColumns] = builtColumnsForExtraConfig;
|
17568
17530
|
if (extraConfig) {
|
17569
17531
|
table4[PgTable.Symbol.ExtraConfigBuilder] = extraConfig;
|
17570
17532
|
}
|
@@ -17577,7 +17539,7 @@ var init_table2 = __esm({
|
|
17577
17539
|
init_entity();
|
17578
17540
|
init_table();
|
17579
17541
|
InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
|
17580
|
-
PgTable = class extends (_d2 =
|
17542
|
+
PgTable = class extends (_d2 = Table, _c2 = entityKind, _b2 = InlineForeignKeys, _a4 = Table.Symbol.ExtraConfigBuilder, _d2) {
|
17581
17543
|
constructor() {
|
17582
17544
|
super(...arguments);
|
17583
17545
|
/**@internal */
|
@@ -17588,7 +17550,7 @@ var init_table2 = __esm({
|
|
17588
17550
|
};
|
17589
17551
|
__publicField(PgTable, _c2, "PgTable");
|
17590
17552
|
/** @internal */
|
17591
|
-
__publicField(PgTable, "Symbol", Object.assign({},
|
17553
|
+
__publicField(PgTable, "Symbol", Object.assign({}, Table.Symbol, {
|
17592
17554
|
InlineForeignKeys
|
17593
17555
|
}));
|
17594
17556
|
pgTable = (name2, columns, extraConfig) => {
|
@@ -17882,7 +17844,7 @@ var init_common2 = __esm({
|
|
17882
17844
|
}
|
17883
17845
|
};
|
17884
17846
|
__publicField(PgColumnBuilder, _a10, "PgColumnBuilder");
|
17885
|
-
PgColumn = class extends (_b4 =
|
17847
|
+
PgColumn = class extends (_b4 = Column, _a11 = entityKind, _b4) {
|
17886
17848
|
constructor(table4, config) {
|
17887
17849
|
if (!config.uniqueName) {
|
17888
17850
|
config.uniqueName = uniqueKeyName(table4, [config.name]);
|
@@ -18297,19 +18259,19 @@ var init_sql = __esm({
|
|
18297
18259
|
inlineParams: inlineParams || chunk.shouldInlineParams
|
18298
18260
|
});
|
18299
18261
|
}
|
18300
|
-
if (is(chunk,
|
18301
|
-
const schemaName = chunk[
|
18302
|
-
const tableName = chunk[
|
18262
|
+
if (is(chunk, Table)) {
|
18263
|
+
const schemaName = chunk[Table.Symbol.Schema];
|
18264
|
+
const tableName = chunk[Table.Symbol.Name];
|
18303
18265
|
return {
|
18304
18266
|
sql: schemaName === void 0 ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
|
18305
18267
|
params: []
|
18306
18268
|
};
|
18307
18269
|
}
|
18308
|
-
if (is(chunk,
|
18270
|
+
if (is(chunk, Column)) {
|
18309
18271
|
if (_config.invokeSource === "indexes") {
|
18310
18272
|
return { sql: escapeName(chunk.name), params: [] };
|
18311
18273
|
}
|
18312
|
-
return { sql: escapeName(chunk.table[
|
18274
|
+
return { sql: escapeName(chunk.table[Table.Symbol.Name]) + "." + escapeName(chunk.name), params: [] };
|
18313
18275
|
}
|
18314
18276
|
if (is(chunk, View)) {
|
18315
18277
|
const schemaName = chunk[ViewBaseConfig].schema;
|
@@ -18546,10 +18508,10 @@ var init_sql = __esm({
|
|
18546
18508
|
}
|
18547
18509
|
};
|
18548
18510
|
__publicField(View, _b11, "View");
|
18549
|
-
|
18511
|
+
Column.prototype.getSQL = function() {
|
18550
18512
|
return new SQL([this]);
|
18551
18513
|
};
|
18552
|
-
|
18514
|
+
Table.prototype.getSQL = function() {
|
18553
18515
|
return new SQL([this]);
|
18554
18516
|
};
|
18555
18517
|
Subquery.prototype.getSQL = function() {
|
@@ -18576,7 +18538,7 @@ function mapColumnsInAliasedSQLToAlias(query, alias) {
|
|
18576
18538
|
}
|
18577
18539
|
function mapColumnsInSQLToAlias(query, alias) {
|
18578
18540
|
return sql.join(query.queryChunks.map((c) => {
|
18579
|
-
if (is(c,
|
18541
|
+
if (is(c, Column)) {
|
18580
18542
|
return aliasedTableColumn(c, alias);
|
18581
18543
|
}
|
18582
18544
|
if (is(c, SQL)) {
|
@@ -18617,13 +18579,13 @@ var init_alias = __esm({
|
|
18617
18579
|
this.replaceOriginalName = replaceOriginalName;
|
18618
18580
|
}
|
18619
18581
|
get(target, prop) {
|
18620
|
-
if (prop ===
|
18582
|
+
if (prop === Table.Symbol.IsAlias) {
|
18621
18583
|
return true;
|
18622
18584
|
}
|
18623
|
-
if (prop ===
|
18585
|
+
if (prop === Table.Symbol.Name) {
|
18624
18586
|
return this.alias;
|
18625
18587
|
}
|
18626
|
-
if (this.replaceOriginalName && prop ===
|
18588
|
+
if (this.replaceOriginalName && prop === Table.Symbol.OriginalName) {
|
18627
18589
|
return this.alias;
|
18628
18590
|
}
|
18629
18591
|
if (prop === ViewBaseConfig) {
|
@@ -18633,8 +18595,8 @@ var init_alias = __esm({
|
|
18633
18595
|
isAlias: true
|
18634
18596
|
};
|
18635
18597
|
}
|
18636
|
-
if (prop ===
|
18637
|
-
const columns = target[
|
18598
|
+
if (prop === Table.Symbol.Columns) {
|
18599
|
+
const columns = target[Table.Symbol.Columns];
|
18638
18600
|
if (!columns) {
|
18639
18601
|
return columns;
|
18640
18602
|
}
|
@@ -18648,7 +18610,7 @@ var init_alias = __esm({
|
|
18648
18610
|
return proxiedColumns;
|
18649
18611
|
}
|
18650
18612
|
const value = target[prop];
|
18651
|
-
if (is(value,
|
18613
|
+
if (is(value, Column)) {
|
18652
18614
|
return new Proxy(value, new ColumnAliasProxyHandler(new Proxy(target, this)));
|
18653
18615
|
}
|
18654
18616
|
return value;
|
@@ -18696,7 +18658,7 @@ var init_errors = __esm({
|
|
18696
18658
|
|
18697
18659
|
// ../node_modules/.pnpm/drizzle-orm@0.32.1_@aws-sdk+client-rds-data@3.583.0_@cloudflare+workers-types@4.20240524.0_@e_b4cdnxy7l6gc3lxxx27eybv3eu/node_modules/drizzle-orm/sql/expressions/conditions.js
|
18698
18660
|
function bindIfParam(value, column4) {
|
18699
|
-
if (isDriverValueEncoder(column4) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value,
|
18661
|
+
if (isDriverValueEncoder(column4) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value, Column) && !is(value, Table) && !is(value, View)) {
|
18700
18662
|
return new Param(value, column4);
|
18701
18663
|
}
|
18702
18664
|
return value;
|
@@ -19037,33 +18999,33 @@ function getOrderByOperators() {
|
|
19037
18999
|
};
|
19038
19000
|
}
|
19039
19001
|
function extractTablesRelationalConfig(schema4, configHelpers) {
|
19040
|
-
if (Object.keys(schema4).length === 1 && "default" in schema4 && !is(schema4["default"],
|
19002
|
+
if (Object.keys(schema4).length === 1 && "default" in schema4 && !is(schema4["default"], Table)) {
|
19041
19003
|
schema4 = schema4["default"];
|
19042
19004
|
}
|
19043
19005
|
const tableNamesMap = {};
|
19044
19006
|
const relationsBuffer = {};
|
19045
19007
|
const tablesConfig = {};
|
19046
19008
|
for (const [key, value] of Object.entries(schema4)) {
|
19047
|
-
if (is(value,
|
19009
|
+
if (is(value, Table)) {
|
19048
19010
|
const dbName = getTableUniqueName(value);
|
19049
19011
|
const bufferedRelations = relationsBuffer[dbName];
|
19050
19012
|
tableNamesMap[dbName] = key;
|
19051
19013
|
tablesConfig[key] = {
|
19052
19014
|
tsName: key,
|
19053
|
-
dbName: value[
|
19054
|
-
schema: value[
|
19055
|
-
columns: value[
|
19015
|
+
dbName: value[Table.Symbol.Name],
|
19016
|
+
schema: value[Table.Symbol.Schema],
|
19017
|
+
columns: value[Table.Symbol.Columns],
|
19056
19018
|
relations: bufferedRelations?.relations ?? {},
|
19057
19019
|
primaryKey: bufferedRelations?.primaryKey ?? []
|
19058
19020
|
};
|
19059
19021
|
for (const column4 of Object.values(
|
19060
|
-
value[
|
19022
|
+
value[Table.Symbol.Columns]
|
19061
19023
|
)) {
|
19062
19024
|
if (column4.primary) {
|
19063
19025
|
tablesConfig[key].primaryKey.push(column4);
|
19064
19026
|
}
|
19065
19027
|
}
|
19066
|
-
const extraConfig = value[
|
19028
|
+
const extraConfig = value[Table.Symbol.ExtraConfigBuilder]?.(value[Table.Symbol.ExtraConfigColumns]);
|
19067
19029
|
if (extraConfig) {
|
19068
19030
|
for (const configEntry of Object.values(extraConfig)) {
|
19069
19031
|
if (is(configEntry, PrimaryKeyBuilder)) {
|
@@ -19135,7 +19097,7 @@ function normalizeRelation(schema4, tableNamesMap, relation) {
|
|
19135
19097
|
const referencedTableTsName = tableNamesMap[getTableUniqueName(relation.referencedTable)];
|
19136
19098
|
if (!referencedTableTsName) {
|
19137
19099
|
throw new Error(
|
19138
|
-
`Table "${relation.referencedTable[
|
19100
|
+
`Table "${relation.referencedTable[Table.Symbol.Name]}" not found in schema`
|
19139
19101
|
);
|
19140
19102
|
}
|
19141
19103
|
const referencedTableConfig = schema4[referencedTableTsName];
|
@@ -19146,7 +19108,7 @@ function normalizeRelation(schema4, tableNamesMap, relation) {
|
|
19146
19108
|
const sourceTableTsName = tableNamesMap[getTableUniqueName(sourceTable)];
|
19147
19109
|
if (!sourceTableTsName) {
|
19148
19110
|
throw new Error(
|
19149
|
-
`Table "${sourceTable[
|
19111
|
+
`Table "${sourceTable[Table.Symbol.Name]}" not found in schema`
|
19150
19112
|
);
|
19151
19113
|
}
|
19152
19114
|
const reverseRelations = [];
|
@@ -19161,7 +19123,7 @@ function normalizeRelation(schema4, tableNamesMap, relation) {
|
|
19161
19123
|
throw relation.relationName ? new Error(
|
19162
19124
|
`There are multiple relations with name "${relation.relationName}" in table "${referencedTableTsName}"`
|
19163
19125
|
) : new Error(
|
19164
|
-
`There are multiple relations between "${referencedTableTsName}" and "${relation.sourceTable[
|
19126
|
+
`There are multiple relations between "${referencedTableTsName}" and "${relation.sourceTable[Table.Symbol.Name]}". Please specify relation name`
|
19165
19127
|
);
|
19166
19128
|
}
|
19167
19129
|
if (reverseRelations[0] && is(reverseRelations[0], One) && reverseRelations[0].config) {
|
@@ -19209,7 +19171,7 @@ function mapRelationalRow(tablesConfig, tableConfig, row, buildQueryResultSelect
|
|
19209
19171
|
const value = mapColumnValue(row[selectionItemIndex]);
|
19210
19172
|
const field = selectionItem.field;
|
19211
19173
|
let decoder;
|
19212
|
-
if (is(field,
|
19174
|
+
if (is(field, Column)) {
|
19213
19175
|
decoder = field;
|
19214
19176
|
} else if (is(field, SQL)) {
|
19215
19177
|
decoder = field.decoder;
|
@@ -19239,7 +19201,7 @@ var init_relations = __esm({
|
|
19239
19201
|
this.sourceTable = sourceTable;
|
19240
19202
|
this.referencedTable = referencedTable;
|
19241
19203
|
this.relationName = relationName;
|
19242
|
-
this.referencedTableName = referencedTable[
|
19204
|
+
this.referencedTableName = referencedTable[Table.Symbol.Name];
|
19243
19205
|
}
|
19244
19206
|
};
|
19245
19207
|
__publicField(Relation, _a38, "Relation");
|
@@ -19310,10 +19272,10 @@ function sumDistinct(expression) {
|
|
19310
19272
|
return sql`sum(distinct ${expression})`.mapWith(String);
|
19311
19273
|
}
|
19312
19274
|
function max(expression) {
|
19313
|
-
return sql`max(${expression})`.mapWith(is(expression,
|
19275
|
+
return sql`max(${expression})`.mapWith(is(expression, Column) ? expression : String);
|
19314
19276
|
}
|
19315
19277
|
function min(expression) {
|
19316
|
-
return sql`min(${expression})`.mapWith(is(expression,
|
19278
|
+
return sql`min(${expression})`.mapWith(is(expression, Column) ? expression : String);
|
19317
19279
|
}
|
19318
19280
|
var init_aggregate = __esm({
|
19319
19281
|
"../node_modules/.pnpm/drizzle-orm@0.32.1_@aws-sdk+client-rds-data@3.583.0_@cloudflare+workers-types@4.20240524.0_@e_b4cdnxy7l6gc3lxxx27eybv3eu/node_modules/drizzle-orm/sql/functions/aggregate.js"() {
|
@@ -19396,7 +19358,7 @@ function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
19396
19358
|
const result = columns.reduce(
|
19397
19359
|
(result2, { path: path2, field }, columnIndex) => {
|
19398
19360
|
let decoder;
|
19399
|
-
if (is(field,
|
19361
|
+
if (is(field, Column)) {
|
19400
19362
|
decoder = field;
|
19401
19363
|
} else if (is(field, SQL)) {
|
19402
19364
|
decoder = field.decoder;
|
@@ -19413,7 +19375,7 @@ function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
19413
19375
|
} else {
|
19414
19376
|
const rawValue = row[columnIndex];
|
19415
19377
|
const value = node[pathChunk] = rawValue === null ? null : decoder.mapFromDriverValue(rawValue);
|
19416
|
-
if (joinsNotNullableMap && is(field,
|
19378
|
+
if (joinsNotNullableMap && is(field, Column) && path2.length === 2) {
|
19417
19379
|
const objectName = path2[0];
|
19418
19380
|
if (!(objectName in nullifyMap)) {
|
19419
19381
|
nullifyMap[objectName] = value === null ? getTableName(field.table) : false;
|
@@ -19442,10 +19404,10 @@ function orderSelectedFields(fields, pathPrefix) {
|
|
19442
19404
|
return result;
|
19443
19405
|
}
|
19444
19406
|
const newPath = pathPrefix ? [...pathPrefix, name2] : [name2];
|
19445
|
-
if (is(field,
|
19407
|
+
if (is(field, Column) || is(field, SQL) || is(field, SQL.Aliased)) {
|
19446
19408
|
result.push({ path: newPath, field });
|
19447
|
-
} else if (is(field,
|
19448
|
-
result.push(...orderSelectedFields(field[
|
19409
|
+
} else if (is(field, Table)) {
|
19410
|
+
result.push(...orderSelectedFields(field[Table.Symbol.Columns], newPath));
|
19449
19411
|
} else {
|
19450
19412
|
result.push(...orderSelectedFields(field, newPath));
|
19451
19413
|
}
|
@@ -19470,7 +19432,7 @@ function mapUpdateSet(table4, values) {
|
|
19470
19432
|
if (is(value, SQL)) {
|
19471
19433
|
return [key, value];
|
19472
19434
|
} else {
|
19473
|
-
return [key, new Param(value, table4[
|
19435
|
+
return [key, new Param(value, table4[Table.Symbol.Columns][key])];
|
19474
19436
|
}
|
19475
19437
|
});
|
19476
19438
|
if (entries.length === 0) {
|
@@ -19492,10 +19454,10 @@ function applyMixins(baseClass, extendedClasses) {
|
|
19492
19454
|
}
|
19493
19455
|
}
|
19494
19456
|
function getTableColumns(table4) {
|
19495
|
-
return table4[
|
19457
|
+
return table4[Table.Symbol.Columns];
|
19496
19458
|
}
|
19497
19459
|
function getTableLikeName(table4) {
|
19498
|
-
return is(table4, Subquery) ? table4._.alias : is(table4, View) ? table4[ViewBaseConfig].name : is(table4, SQL) ? void 0 : table4[
|
19460
|
+
return is(table4, Subquery) ? table4._.alias : is(table4, View) ? table4[ViewBaseConfig].name : is(table4, SQL) ? void 0 : table4[Table.Symbol.IsAlias] ? table4[Table.Symbol.Name] : table4[Table.Symbol.BaseName];
|
19499
19461
|
}
|
19500
19462
|
var init_utils2 = __esm({
|
19501
19463
|
"../node_modules/.pnpm/drizzle-orm@0.32.1_@aws-sdk+client-rds-data@3.583.0_@cloudflare+workers-types@4.20240524.0_@e_b4cdnxy7l6gc3lxxx27eybv3eu/node_modules/drizzle-orm/utils.js"() {
|
@@ -19513,7 +19475,7 @@ var init_utils2 = __esm({
|
|
19513
19475
|
var drizzle_orm_exports = {};
|
19514
19476
|
__export(drizzle_orm_exports, {
|
19515
19477
|
BaseName: () => BaseName,
|
19516
|
-
Column: () =>
|
19478
|
+
Column: () => Column,
|
19517
19479
|
ColumnAliasProxyHandler: () => ColumnAliasProxyHandler,
|
19518
19480
|
ColumnBuilder: () => ColumnBuilder,
|
19519
19481
|
Columns: () => Columns,
|
@@ -19539,7 +19501,7 @@ __export(drizzle_orm_exports, {
|
|
19539
19501
|
Schema: () => Schema,
|
19540
19502
|
StringChunk: () => StringChunk,
|
19541
19503
|
Subquery: () => Subquery,
|
19542
|
-
Table: () =>
|
19504
|
+
Table: () => Table,
|
19543
19505
|
TableAliasProxyHandler: () => TableAliasProxyHandler,
|
19544
19506
|
TableName: () => TableName,
|
19545
19507
|
TransactionRollbackError: () => TransactionRollbackError,
|
@@ -21172,7 +21134,7 @@ var init_delete = __esm({
|
|
21172
21134
|
this.config.where = where;
|
21173
21135
|
return this;
|
21174
21136
|
}
|
21175
|
-
returning(fields = this.config.table[
|
21137
|
+
returning(fields = this.config.table[Table.Symbol.Columns]) {
|
21176
21138
|
this.config.returning = orderSelectedFields(fields);
|
21177
21139
|
return this;
|
21178
21140
|
}
|
@@ -21227,7 +21189,7 @@ var init_insert = __esm({
|
|
21227
21189
|
}
|
21228
21190
|
const mappedValues = values.map((entry) => {
|
21229
21191
|
const result = {};
|
21230
|
-
const cols = this.table[
|
21192
|
+
const cols = this.table[Table.Symbol.Columns];
|
21231
21193
|
for (const colKey of Object.keys(entry)) {
|
21232
21194
|
const colValue = entry[colKey];
|
21233
21195
|
result[colKey] = is(colValue, SQL) ? colValue : new Param(colValue, cols[colKey]);
|
@@ -21251,7 +21213,7 @@ var init_insert = __esm({
|
|
21251
21213
|
this.dialect = dialect7;
|
21252
21214
|
this.config = { table: table4, values, withList };
|
21253
21215
|
}
|
21254
|
-
returning(fields = this.config.table[
|
21216
|
+
returning(fields = this.config.table[Table.Symbol.Columns]) {
|
21255
21217
|
this.config.returning = orderSelectedFields(fields);
|
21256
21218
|
return this;
|
21257
21219
|
}
|
@@ -21449,7 +21411,7 @@ var init_dialect = __esm({
|
|
21449
21411
|
return sql`${withSql}delete from ${table4}${whereSql}${returningSql}`;
|
21450
21412
|
}
|
21451
21413
|
buildUpdateSet(table4, set) {
|
21452
|
-
const tableColumns = table4[
|
21414
|
+
const tableColumns = table4[Table.Symbol.Columns];
|
21453
21415
|
const columnNames = Object.keys(tableColumns).filter(
|
21454
21416
|
(colName) => set[colName] !== void 0 || tableColumns[colName]?.onUpdateFn !== void 0
|
21455
21417
|
);
|
@@ -21507,7 +21469,7 @@ var init_dialect = __esm({
|
|
21507
21469
|
if (is(field, SQL.Aliased)) {
|
21508
21470
|
chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
|
21509
21471
|
}
|
21510
|
-
} else if (is(field,
|
21472
|
+
} else if (is(field, Column)) {
|
21511
21473
|
if (isSingleTable) {
|
21512
21474
|
chunk.push(sql.identifier(field.name));
|
21513
21475
|
} else {
|
@@ -21539,8 +21501,8 @@ var init_dialect = __esm({
|
|
21539
21501
|
}) {
|
21540
21502
|
const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
|
21541
21503
|
for (const f of fieldsList) {
|
21542
|
-
if (is(f.field,
|
21543
|
-
({ alias }) => alias === (table22[
|
21504
|
+
if (is(f.field, Column) && getTableName(f.field.table) !== (is(table4, Subquery) ? table4._.alias : is(table4, PgViewBase) ? table4[ViewBaseConfig].name : is(table4, SQL) ? void 0 : getTableName(table4)) && !((table22) => joins?.some(
|
21505
|
+
({ alias }) => alias === (table22[Table.Symbol.IsAlias] ? getTableName(table22) : table22[Table.Symbol.BaseName])
|
21544
21506
|
))(f.field.table)) {
|
21545
21507
|
const tableName = getTableName(f.field.table);
|
21546
21508
|
throw new Error(
|
@@ -21556,12 +21518,12 @@ var init_dialect = __esm({
|
|
21556
21518
|
}
|
21557
21519
|
const selection = this.buildSelection(fieldsList, { isSingleTable });
|
21558
21520
|
const tableSql = (() => {
|
21559
|
-
if (is(table4,
|
21560
|
-
let fullName = sql`${sql.identifier(table4[
|
21561
|
-
if (table4[
|
21562
|
-
fullName = sql`${sql.identifier(table4[
|
21521
|
+
if (is(table4, Table) && table4[Table.Symbol.OriginalName] !== table4[Table.Symbol.Name]) {
|
21522
|
+
let fullName = sql`${sql.identifier(table4[Table.Symbol.OriginalName])}`;
|
21523
|
+
if (table4[Table.Symbol.Schema]) {
|
21524
|
+
fullName = sql`${sql.identifier(table4[Table.Symbol.Schema])}.${fullName}`;
|
21563
21525
|
}
|
21564
|
-
return sql`${fullName} ${sql.identifier(table4[
|
21526
|
+
return sql`${fullName} ${sql.identifier(table4[Table.Symbol.Name])}`;
|
21565
21527
|
}
|
21566
21528
|
return table4;
|
21567
21529
|
})();
|
@@ -21682,7 +21644,7 @@ var init_dialect = __esm({
|
|
21682
21644
|
}
|
21683
21645
|
buildInsertQuery({ table: table4, values, onConflict, returning, withList }) {
|
21684
21646
|
const valuesSqlList = [];
|
21685
|
-
const columns = table4[
|
21647
|
+
const columns = table4[Table.Symbol.Columns];
|
21686
21648
|
const colEntries = Object.entries(columns).filter(([_2, col]) => !col.shouldDisableInsert());
|
21687
21649
|
const insertOrder = colEntries.map(([, column4]) => sql.identifier(column4.name));
|
21688
21650
|
for (const [valueIndex, value] of values.entries()) {
|
@@ -22303,7 +22265,7 @@ var init_dialect = __esm({
|
|
22303
22265
|
selection.push({
|
22304
22266
|
dbKey: is(value, SQL.Aliased) ? value.fieldAlias : tableConfig.columns[tsKey].name,
|
22305
22267
|
tsKey,
|
22306
|
-
field: is(value,
|
22268
|
+
field: is(value, Column) ? aliasedTableColumn(value, tableAlias) : value,
|
22307
22269
|
relationTableTsKey: void 0,
|
22308
22270
|
isJson: false,
|
22309
22271
|
selection: []
|
@@ -22314,7 +22276,7 @@ var init_dialect = __esm({
|
|
22314
22276
|
orderByOrig = [orderByOrig];
|
22315
22277
|
}
|
22316
22278
|
orderBy = orderByOrig.map((orderByValue) => {
|
22317
|
-
if (is(orderByValue,
|
22279
|
+
if (is(orderByValue, Column)) {
|
22318
22280
|
return aliasedTableColumn(orderByValue, tableAlias);
|
22319
22281
|
}
|
22320
22282
|
return mapColumnsInSQLToAlias(orderByValue, tableAlias);
|
@@ -22417,7 +22379,7 @@ var init_dialect = __esm({
|
|
22417
22379
|
fields: {},
|
22418
22380
|
fieldsFlat: nestedSelection.map(({ field: field2 }) => ({
|
22419
22381
|
path: [],
|
22420
|
-
field: is(field2,
|
22382
|
+
field: is(field2, Column) ? aliasedTableColumn(field2, tableAlias) : field2
|
22421
22383
|
})),
|
22422
22384
|
joins,
|
22423
22385
|
where,
|
@@ -22432,7 +22394,7 @@ var init_dialect = __esm({
|
|
22432
22394
|
fields: {},
|
22433
22395
|
fieldsFlat: selection.map(({ field }) => ({
|
22434
22396
|
path: [],
|
22435
|
-
field: is(field,
|
22397
|
+
field: is(field, Column) ? aliasedTableColumn(field, tableAlias) : field
|
22436
22398
|
})),
|
22437
22399
|
joins,
|
22438
22400
|
where,
|
@@ -22510,7 +22472,7 @@ var init_selection_proxy = __esm({
|
|
22510
22472
|
`You tried to reference "${prop}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`
|
22511
22473
|
);
|
22512
22474
|
}
|
22513
|
-
if (is(value,
|
22475
|
+
if (is(value, Column)) {
|
22514
22476
|
if (this.config.alias) {
|
22515
22477
|
return new Proxy(
|
22516
22478
|
value,
|
@@ -22974,7 +22936,7 @@ var init_select2 = __esm({
|
|
22974
22936
|
};
|
22975
22937
|
}
|
22976
22938
|
if (typeof tableName === "string" && !is(table4, SQL)) {
|
22977
|
-
const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View) ? table4[ViewBaseConfig].selectedFields : table4[
|
22939
|
+
const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View) ? table4[ViewBaseConfig].selectedFields : table4[Table.Symbol.Columns];
|
22978
22940
|
this.config.fields[tableName] = selection;
|
22979
22941
|
}
|
22980
22942
|
}
|
@@ -23521,7 +23483,7 @@ var init_update = __esm({
|
|
23521
23483
|
this.config.where = where;
|
23522
23484
|
return this;
|
23523
23485
|
}
|
23524
|
-
returning(fields = this.config.table[
|
23486
|
+
returning(fields = this.config.table[Table.Symbol.Columns]) {
|
23525
23487
|
this.config.returning = orderSelectedFields(fields);
|
23526
23488
|
return this;
|
23527
23489
|
}
|
@@ -24392,7 +24354,7 @@ var init_view = __esm({
|
|
24392
24354
|
});
|
24393
24355
|
|
24394
24356
|
// ../node_modules/.pnpm/drizzle-orm@0.32.1_@aws-sdk+client-rds-data@3.583.0_@cloudflare+workers-types@4.20240524.0_@e_b4cdnxy7l6gc3lxxx27eybv3eu/node_modules/drizzle-orm/pg-core/schema.js
|
24395
|
-
var _a154,
|
24357
|
+
var _a154, PgSchema3;
|
24396
24358
|
var init_schema = __esm({
|
24397
24359
|
"../node_modules/.pnpm/drizzle-orm@0.32.1_@aws-sdk+client-rds-data@3.583.0_@cloudflare+workers-types@4.20240524.0_@e_b4cdnxy7l6gc3lxxx27eybv3eu/node_modules/drizzle-orm/pg-core/schema.js"() {
|
24398
24360
|
"use strict";
|
@@ -24403,7 +24365,7 @@ var init_schema = __esm({
|
|
24403
24365
|
init_table2();
|
24404
24366
|
init_view();
|
24405
24367
|
_a154 = entityKind;
|
24406
|
-
|
24368
|
+
PgSchema3 = class {
|
24407
24369
|
constructor(schemaName) {
|
24408
24370
|
__publicField(this, "table", (name2, columns, extraConfig) => {
|
24409
24371
|
return pgTableWithSchema(name2, columns, extraConfig, this.schemaName);
|
@@ -24429,7 +24391,7 @@ var init_schema = __esm({
|
|
24429
24391
|
return true;
|
24430
24392
|
}
|
24431
24393
|
};
|
24432
|
-
__publicField(
|
24394
|
+
__publicField(PgSchema3, _a154, "PgSchema");
|
24433
24395
|
}
|
24434
24396
|
});
|
24435
24397
|
|
@@ -24526,17 +24488,17 @@ var init_subquery2 = __esm({
|
|
24526
24488
|
|
24527
24489
|
// ../node_modules/.pnpm/drizzle-orm@0.32.1_@aws-sdk+client-rds-data@3.583.0_@cloudflare+workers-types@4.20240524.0_@e_b4cdnxy7l6gc3lxxx27eybv3eu/node_modules/drizzle-orm/pg-core/utils.js
|
24528
24490
|
function getTableConfig(table4) {
|
24529
|
-
const columns = Object.values(table4[
|
24491
|
+
const columns = Object.values(table4[Table.Symbol.Columns]);
|
24530
24492
|
const indexes = [];
|
24531
24493
|
const checks = [];
|
24532
24494
|
const primaryKeys = [];
|
24533
24495
|
const foreignKeys = Object.values(table4[PgTable.Symbol.InlineForeignKeys]);
|
24534
24496
|
const uniqueConstraints = [];
|
24535
|
-
const name2 = table4[
|
24536
|
-
const schema4 = table4[
|
24497
|
+
const name2 = table4[Table.Symbol.Name];
|
24498
|
+
const schema4 = table4[Table.Symbol.Schema];
|
24537
24499
|
const extraConfigBuilder = table4[PgTable.Symbol.ExtraConfigBuilder];
|
24538
24500
|
if (extraConfigBuilder !== void 0) {
|
24539
|
-
const extraConfig = extraConfigBuilder(table4[
|
24501
|
+
const extraConfig = extraConfigBuilder(table4[Table.Symbol.ExtraConfigColumns]);
|
24540
24502
|
for (const builder of Object.values(extraConfig)) {
|
24541
24503
|
if (is(builder, IndexBuilder)) {
|
24542
24504
|
indexes.push(builder.build(table4));
|
@@ -25606,8 +25568,8 @@ function sqliteTableBase(name2, columns, extraConfig, schema4, baseName = name2)
|
|
25606
25568
|
})
|
25607
25569
|
);
|
25608
25570
|
const table4 = Object.assign(rawTable, builtColumns);
|
25609
|
-
table4[
|
25610
|
-
table4[
|
25571
|
+
table4[Table.Symbol.Columns] = builtColumns;
|
25572
|
+
table4[Table.Symbol.ExtraConfigColumns] = builtColumns;
|
25611
25573
|
if (extraConfig) {
|
25612
25574
|
table4[SQLiteTable.Symbol.ExtraConfigBuilder] = extraConfig;
|
25613
25575
|
}
|
@@ -25620,7 +25582,7 @@ var init_table3 = __esm({
|
|
25620
25582
|
init_entity();
|
25621
25583
|
init_table();
|
25622
25584
|
InlineForeignKeys2 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
|
25623
|
-
SQLiteTable = class extends (_e2 =
|
25585
|
+
SQLiteTable = class extends (_e2 = Table, _d3 = entityKind, _c5 = Table.Symbol.Columns, _b113 = InlineForeignKeys2, _a160 = Table.Symbol.ExtraConfigBuilder, _e2) {
|
25624
25586
|
constructor() {
|
25625
25587
|
super(...arguments);
|
25626
25588
|
/** @internal */
|
@@ -25633,7 +25595,7 @@ var init_table3 = __esm({
|
|
25633
25595
|
};
|
25634
25596
|
__publicField(SQLiteTable, _d3, "SQLiteTable");
|
25635
25597
|
/** @internal */
|
25636
|
-
__publicField(SQLiteTable, "Symbol", Object.assign({},
|
25598
|
+
__publicField(SQLiteTable, "Symbol", Object.assign({}, Table.Symbol, {
|
25637
25599
|
InlineForeignKeys: InlineForeignKeys2
|
25638
25600
|
}));
|
25639
25601
|
sqliteTable = (name2, columns, extraConfig) => {
|
@@ -25814,7 +25776,7 @@ var init_common3 = __esm({
|
|
25814
25776
|
}
|
25815
25777
|
};
|
25816
25778
|
__publicField(SQLiteColumnBuilder, _a166, "SQLiteColumnBuilder");
|
25817
|
-
SQLiteColumn = class extends (_b115 =
|
25779
|
+
SQLiteColumn = class extends (_b115 = Column, _a167 = entityKind, _b115) {
|
25818
25780
|
constructor(table4, config) {
|
25819
25781
|
if (!config.uniqueName) {
|
25820
25782
|
config.uniqueName = uniqueKeyName2(table4, [config.name]);
|
@@ -26315,7 +26277,7 @@ var init_insert2 = __esm({
|
|
26315
26277
|
}
|
26316
26278
|
const mappedValues = values.map((entry) => {
|
26317
26279
|
const result = {};
|
26318
|
-
const cols = this.table[
|
26280
|
+
const cols = this.table[Table.Symbol.Columns];
|
26319
26281
|
for (const colKey of Object.keys(entry)) {
|
26320
26282
|
const colValue = entry[colKey];
|
26321
26283
|
result[colKey] = is(colValue, SQL) ? colValue : new Param(colValue, cols[colKey]);
|
@@ -26520,7 +26482,7 @@ var init_dialect2 = __esm({
|
|
26520
26482
|
return sql`${withSql}delete from ${table4}${whereSql}${returningSql}`;
|
26521
26483
|
}
|
26522
26484
|
buildUpdateSet(table4, set) {
|
26523
|
-
const tableColumns = table4[
|
26485
|
+
const tableColumns = table4[Table.Symbol.Columns];
|
26524
26486
|
const columnNames = Object.keys(tableColumns).filter(
|
26525
26487
|
(colName) => set[colName] !== void 0 || tableColumns[colName]?.onUpdateFn !== void 0
|
26526
26488
|
);
|
@@ -26565,7 +26527,7 @@ var init_dialect2 = __esm({
|
|
26565
26527
|
chunk.push(
|
26566
26528
|
new SQL(
|
26567
26529
|
query.queryChunks.map((c) => {
|
26568
|
-
if (is(c,
|
26530
|
+
if (is(c, Column)) {
|
26569
26531
|
return sql.identifier(c.name);
|
26570
26532
|
}
|
26571
26533
|
return c;
|
@@ -26578,8 +26540,8 @@ var init_dialect2 = __esm({
|
|
26578
26540
|
if (is(field, SQL.Aliased)) {
|
26579
26541
|
chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
|
26580
26542
|
}
|
26581
|
-
} else if (is(field,
|
26582
|
-
const tableName = field.table[
|
26543
|
+
} else if (is(field, Column)) {
|
26544
|
+
const tableName = field.table[Table.Symbol.Name];
|
26583
26545
|
const columnName = field.name;
|
26584
26546
|
if (isSingleTable) {
|
26585
26547
|
chunk.push(sql.identifier(columnName));
|
@@ -26611,8 +26573,8 @@ var init_dialect2 = __esm({
|
|
26611
26573
|
}) {
|
26612
26574
|
const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
|
26613
26575
|
for (const f of fieldsList) {
|
26614
|
-
if (is(f.field,
|
26615
|
-
({ alias }) => alias === (table22[
|
26576
|
+
if (is(f.field, Column) && getTableName(f.field.table) !== (is(table4, Subquery) ? table4._.alias : is(table4, SQLiteViewBase) ? table4[ViewBaseConfig].name : is(table4, SQL) ? void 0 : getTableName(table4)) && !((table22) => joins?.some(
|
26577
|
+
({ alias }) => alias === (table22[Table.Symbol.IsAlias] ? getTableName(table22) : table22[Table.Symbol.BaseName])
|
26616
26578
|
))(f.field.table)) {
|
26617
26579
|
const tableName = getTableName(f.field.table);
|
26618
26580
|
throw new Error(
|
@@ -26625,8 +26587,8 @@ var init_dialect2 = __esm({
|
|
26625
26587
|
const distinctSql = distinct ? sql` distinct` : void 0;
|
26626
26588
|
const selection = this.buildSelection(fieldsList, { isSingleTable });
|
26627
26589
|
const tableSql = (() => {
|
26628
|
-
if (is(table4,
|
26629
|
-
return sql`${sql.identifier(table4[
|
26590
|
+
if (is(table4, Table) && table4[Table.Symbol.OriginalName] !== table4[Table.Symbol.Name]) {
|
26591
|
+
return sql`${sql.identifier(table4[Table.Symbol.OriginalName])} ${sql.identifier(table4[Table.Symbol.Name])}`;
|
26630
26592
|
}
|
26631
26593
|
return table4;
|
26632
26594
|
})();
|
@@ -26732,7 +26694,7 @@ var init_dialect2 = __esm({
|
|
26732
26694
|
}
|
26733
26695
|
buildInsertQuery({ table: table4, values, onConflict, returning, withList }) {
|
26734
26696
|
const valuesSqlList = [];
|
26735
|
-
const columns = table4[
|
26697
|
+
const columns = table4[Table.Symbol.Columns];
|
26736
26698
|
const colEntries = Object.entries(columns).filter(
|
26737
26699
|
([_2, col]) => !col.shouldDisableInsert()
|
26738
26700
|
);
|
@@ -26853,7 +26815,7 @@ var init_dialect2 = __esm({
|
|
26853
26815
|
selection.push({
|
26854
26816
|
dbKey: is(value, SQL.Aliased) ? value.fieldAlias : tableConfig.columns[tsKey].name,
|
26855
26817
|
tsKey,
|
26856
|
-
field: is(value,
|
26818
|
+
field: is(value, Column) ? aliasedTableColumn(value, tableAlias) : value,
|
26857
26819
|
relationTableTsKey: void 0,
|
26858
26820
|
isJson: false,
|
26859
26821
|
selection: []
|
@@ -26864,7 +26826,7 @@ var init_dialect2 = __esm({
|
|
26864
26826
|
orderByOrig = [orderByOrig];
|
26865
26827
|
}
|
26866
26828
|
orderBy = orderByOrig.map((orderByValue) => {
|
26867
|
-
if (is(orderByValue,
|
26829
|
+
if (is(orderByValue, Column)) {
|
26868
26830
|
return aliasedTableColumn(orderByValue, tableAlias);
|
26869
26831
|
}
|
26870
26832
|
return mapColumnsInSQLToAlias(orderByValue, tableAlias);
|
@@ -26964,7 +26926,7 @@ var init_dialect2 = __esm({
|
|
26964
26926
|
fields: {},
|
26965
26927
|
fieldsFlat: nestedSelection.map(({ field: field2 }) => ({
|
26966
26928
|
path: [],
|
26967
|
-
field: is(field2,
|
26929
|
+
field: is(field2, Column) ? aliasedTableColumn(field2, tableAlias) : field2
|
26968
26930
|
})),
|
26969
26931
|
joins,
|
26970
26932
|
where,
|
@@ -26979,7 +26941,7 @@ var init_dialect2 = __esm({
|
|
26979
26941
|
fields: {},
|
26980
26942
|
fieldsFlat: selection.map(({ field }) => ({
|
26981
26943
|
path: [],
|
26982
|
-
field: is(field,
|
26944
|
+
field: is(field, Column) ? aliasedTableColumn(field, tableAlias) : field
|
26983
26945
|
})),
|
26984
26946
|
joins,
|
26985
26947
|
where,
|
@@ -27396,7 +27358,7 @@ var init_select3 = __esm({
|
|
27396
27358
|
};
|
27397
27359
|
}
|
27398
27360
|
if (typeof tableName === "string" && !is(table4, SQL)) {
|
27399
|
-
const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View) ? table4[ViewBaseConfig].selectedFields : table4[
|
27361
|
+
const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View) ? table4[ViewBaseConfig].selectedFields : table4[Table.Symbol.Columns];
|
27400
27362
|
this.config.fields[tableName] = selection;
|
27401
27363
|
}
|
27402
27364
|
}
|
@@ -28633,7 +28595,7 @@ function getTableConfig2(table4) {
|
|
28633
28595
|
const primaryKeys = [];
|
28634
28596
|
const uniqueConstraints = [];
|
28635
28597
|
const foreignKeys = Object.values(table4[SQLiteTable.Symbol.InlineForeignKeys]);
|
28636
|
-
const name2 = table4[
|
28598
|
+
const name2 = table4[Table.Symbol.Name];
|
28637
28599
|
const extraConfigBuilder = table4[SQLiteTable.Symbol.ExtraConfigBuilder];
|
28638
28600
|
if (extraConfigBuilder !== void 0) {
|
28639
28601
|
const extraConfig = extraConfigBuilder(table4[SQLiteTable.Symbol.Columns]);
|
@@ -29334,8 +29296,8 @@ function mysqlTableWithSchema(name2, columns, extraConfig, schema4, baseName = n
|
|
29334
29296
|
})
|
29335
29297
|
);
|
29336
29298
|
const table4 = Object.assign(rawTable, builtColumns);
|
29337
|
-
table4[
|
29338
|
-
table4[
|
29299
|
+
table4[Table.Symbol.Columns] = builtColumns;
|
29300
|
+
table4[Table.Symbol.ExtraConfigColumns] = builtColumns;
|
29339
29301
|
if (extraConfig) {
|
29340
29302
|
table4[MySqlTable.Symbol.ExtraConfigBuilder] = extraConfig;
|
29341
29303
|
}
|
@@ -29348,7 +29310,7 @@ var init_table4 = __esm({
|
|
29348
29310
|
init_entity();
|
29349
29311
|
init_table();
|
29350
29312
|
InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys");
|
29351
|
-
MySqlTable = class extends (_e3 =
|
29313
|
+
MySqlTable = class extends (_e3 = Table, _d4 = entityKind, _c7 = Table.Symbol.Columns, _b156 = InlineForeignKeys3, _a225 = Table.Symbol.ExtraConfigBuilder, _e3) {
|
29352
29314
|
constructor() {
|
29353
29315
|
super(...arguments);
|
29354
29316
|
/** @internal */
|
@@ -29361,7 +29323,7 @@ var init_table4 = __esm({
|
|
29361
29323
|
};
|
29362
29324
|
__publicField(MySqlTable, _d4, "MySqlTable");
|
29363
29325
|
/** @internal */
|
29364
|
-
__publicField(MySqlTable, "Symbol", Object.assign({},
|
29326
|
+
__publicField(MySqlTable, "Symbol", Object.assign({}, Table.Symbol, {
|
29365
29327
|
InlineForeignKeys: InlineForeignKeys3
|
29366
29328
|
}));
|
29367
29329
|
mysqlTable = (name2, columns, extraConfig) => {
|
@@ -29543,7 +29505,7 @@ var init_common4 = __esm({
|
|
29543
29505
|
}
|
29544
29506
|
};
|
29545
29507
|
__publicField(MySqlColumnBuilder, _a231, "MySqlColumnBuilder");
|
29546
|
-
MySqlColumn = class extends (_b158 =
|
29508
|
+
MySqlColumn = class extends (_b158 = Column, _a232 = entityKind, _b158) {
|
29547
29509
|
constructor(table4, config) {
|
29548
29510
|
if (!config.uniqueName) {
|
29549
29511
|
config.uniqueName = uniqueKeyName3(table4, [config.name]);
|
@@ -30690,7 +30652,7 @@ var init_insert3 = __esm({
|
|
30690
30652
|
}
|
30691
30653
|
const mappedValues = values.map((entry) => {
|
30692
30654
|
const result = {};
|
30693
|
-
const cols = this.table[
|
30655
|
+
const cols = this.table[Table.Symbol.Columns];
|
30694
30656
|
for (const colKey of Object.keys(entry)) {
|
30695
30657
|
const colValue = entry[colKey];
|
30696
30658
|
result[colKey] = is(colValue, SQL) ? colValue : new Param(colValue, cols[colKey]);
|
@@ -30752,12 +30714,12 @@ var init_insert3 = __esm({
|
|
30752
30714
|
}
|
30753
30715
|
$returningId() {
|
30754
30716
|
const returning = [];
|
30755
|
-
for (const [key, value] of Object.entries(this.config.table[
|
30717
|
+
for (const [key, value] of Object.entries(this.config.table[Table.Symbol.Columns])) {
|
30756
30718
|
if (value.primary) {
|
30757
30719
|
returning.push({ field: value, path: [key] });
|
30758
30720
|
}
|
30759
30721
|
}
|
30760
|
-
this.config.returning = orderSelectedFields(this.config.table[
|
30722
|
+
this.config.returning = orderSelectedFields(this.config.table[Table.Symbol.Columns]);
|
30761
30723
|
return this;
|
30762
30724
|
}
|
30763
30725
|
/** @internal */
|
@@ -30876,7 +30838,7 @@ var init_dialect3 = __esm({
|
|
30876
30838
|
return sql`${withSql}delete from ${table4}${whereSql}${returningSql}`;
|
30877
30839
|
}
|
30878
30840
|
buildUpdateSet(table4, set) {
|
30879
|
-
const tableColumns = table4[
|
30841
|
+
const tableColumns = table4[Table.Symbol.Columns];
|
30880
30842
|
const columnNames = Object.keys(tableColumns).filter(
|
30881
30843
|
(colName) => set[colName] !== void 0 || tableColumns[colName]?.onUpdateFn !== void 0
|
30882
30844
|
);
|
@@ -30934,7 +30896,7 @@ var init_dialect3 = __esm({
|
|
30934
30896
|
if (is(field, SQL.Aliased)) {
|
30935
30897
|
chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
|
30936
30898
|
}
|
30937
|
-
} else if (is(field,
|
30899
|
+
} else if (is(field, Column)) {
|
30938
30900
|
if (isSingleTable) {
|
30939
30901
|
chunk.push(sql.identifier(field.name));
|
30940
30902
|
} else {
|
@@ -30966,8 +30928,8 @@ var init_dialect3 = __esm({
|
|
30966
30928
|
}) {
|
30967
30929
|
const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
|
30968
30930
|
for (const f of fieldsList) {
|
30969
|
-
if (is(f.field,
|
30970
|
-
({ alias }) => alias === (table22[
|
30931
|
+
if (is(f.field, Column) && getTableName(f.field.table) !== (is(table4, Subquery) ? table4._.alias : is(table4, MySqlViewBase) ? table4[ViewBaseConfig].name : is(table4, SQL) ? void 0 : getTableName(table4)) && !((table22) => joins?.some(
|
30932
|
+
({ alias }) => alias === (table22[Table.Symbol.IsAlias] ? getTableName(table22) : table22[Table.Symbol.BaseName])
|
30971
30933
|
))(f.field.table)) {
|
30972
30934
|
const tableName = getTableName(f.field.table);
|
30973
30935
|
throw new Error(
|
@@ -30980,8 +30942,8 @@ var init_dialect3 = __esm({
|
|
30980
30942
|
const distinctSql = distinct ? sql` distinct` : void 0;
|
30981
30943
|
const selection = this.buildSelection(fieldsList, { isSingleTable });
|
30982
30944
|
const tableSql = (() => {
|
30983
|
-
if (is(table4,
|
30984
|
-
return sql`${sql.identifier(table4[
|
30945
|
+
if (is(table4, Table) && table4[Table.Symbol.OriginalName] !== table4[Table.Symbol.Name]) {
|
30946
|
+
return sql`${sql.identifier(table4[Table.Symbol.OriginalName])} ${sql.identifier(table4[Table.Symbol.Name])}`;
|
30985
30947
|
}
|
30986
30948
|
return table4;
|
30987
30949
|
})();
|
@@ -31094,7 +31056,7 @@ var init_dialect3 = __esm({
|
|
31094
31056
|
}
|
31095
31057
|
buildInsertQuery({ table: table4, values, ignore, onConflict }) {
|
31096
31058
|
const valuesSqlList = [];
|
31097
|
-
const columns = table4[
|
31059
|
+
const columns = table4[Table.Symbol.Columns];
|
31098
31060
|
const colEntries = Object.entries(columns).filter(
|
31099
31061
|
([_2, col]) => !col.shouldDisableInsert()
|
31100
31062
|
);
|
@@ -31222,7 +31184,7 @@ var init_dialect3 = __esm({
|
|
31222
31184
|
selection.push({
|
31223
31185
|
dbKey: is(value, SQL.Aliased) ? value.fieldAlias : tableConfig.columns[tsKey].name,
|
31224
31186
|
tsKey,
|
31225
|
-
field: is(value,
|
31187
|
+
field: is(value, Column) ? aliasedTableColumn(value, tableAlias) : value,
|
31226
31188
|
relationTableTsKey: void 0,
|
31227
31189
|
isJson: false,
|
31228
31190
|
selection: []
|
@@ -31233,7 +31195,7 @@ var init_dialect3 = __esm({
|
|
31233
31195
|
orderByOrig = [orderByOrig];
|
31234
31196
|
}
|
31235
31197
|
orderBy = orderByOrig.map((orderByValue) => {
|
31236
|
-
if (is(orderByValue,
|
31198
|
+
if (is(orderByValue, Column)) {
|
31237
31199
|
return aliasedTableColumn(orderByValue, tableAlias);
|
31238
31200
|
}
|
31239
31201
|
return mapColumnsInSQLToAlias(orderByValue, tableAlias);
|
@@ -31341,7 +31303,7 @@ var init_dialect3 = __esm({
|
|
31341
31303
|
fields: {},
|
31342
31304
|
fieldsFlat: nestedSelection.map(({ field: field2 }) => ({
|
31343
31305
|
path: [],
|
31344
|
-
field: is(field2,
|
31306
|
+
field: is(field2, Column) ? aliasedTableColumn(field2, tableAlias) : field2
|
31345
31307
|
})),
|
31346
31308
|
joins,
|
31347
31309
|
where,
|
@@ -31356,7 +31318,7 @@ var init_dialect3 = __esm({
|
|
31356
31318
|
fields: {},
|
31357
31319
|
fieldsFlat: selection.map(({ field }) => ({
|
31358
31320
|
path: [],
|
31359
|
-
field: is(field,
|
31321
|
+
field: is(field, Column) ? aliasedTableColumn(field, tableAlias) : field
|
31360
31322
|
})),
|
31361
31323
|
joins,
|
31362
31324
|
where,
|
@@ -31446,7 +31408,7 @@ var init_dialect3 = __esm({
|
|
31446
31408
|
selection.push({
|
31447
31409
|
dbKey: is(value, SQL.Aliased) ? value.fieldAlias : tableConfig.columns[tsKey].name,
|
31448
31410
|
tsKey,
|
31449
|
-
field: is(value,
|
31411
|
+
field: is(value, Column) ? aliasedTableColumn(value, tableAlias) : value,
|
31450
31412
|
relationTableTsKey: void 0,
|
31451
31413
|
isJson: false,
|
31452
31414
|
selection: []
|
@@ -31457,7 +31419,7 @@ var init_dialect3 = __esm({
|
|
31457
31419
|
orderByOrig = [orderByOrig];
|
31458
31420
|
}
|
31459
31421
|
orderBy = orderByOrig.map((orderByValue) => {
|
31460
|
-
if (is(orderByValue,
|
31422
|
+
if (is(orderByValue, Column)) {
|
31461
31423
|
return aliasedTableColumn(orderByValue, tableAlias);
|
31462
31424
|
}
|
31463
31425
|
return mapColumnsInSQLToAlias(orderByValue, tableAlias);
|
@@ -31564,7 +31526,7 @@ var init_dialect3 = __esm({
|
|
31564
31526
|
fields: {},
|
31565
31527
|
fieldsFlat: nestedSelection.map(({ field: field2 }) => ({
|
31566
31528
|
path: [],
|
31567
|
-
field: is(field2,
|
31529
|
+
field: is(field2, Column) ? aliasedTableColumn(field2, tableAlias) : field2
|
31568
31530
|
})),
|
31569
31531
|
where,
|
31570
31532
|
limit,
|
@@ -31578,7 +31540,7 @@ var init_dialect3 = __esm({
|
|
31578
31540
|
fields: {},
|
31579
31541
|
fieldsFlat: selection.map(({ field }) => ({
|
31580
31542
|
path: [],
|
31581
|
-
field: is(field,
|
31543
|
+
field: is(field, Column) ? aliasedTableColumn(field, tableAlias) : field
|
31582
31544
|
})),
|
31583
31545
|
where,
|
31584
31546
|
limit,
|
@@ -32016,7 +31978,7 @@ var init_select4 = __esm({
|
|
32016
31978
|
};
|
32017
31979
|
}
|
32018
31980
|
if (typeof tableName === "string" && !is(table4, SQL)) {
|
32019
|
-
const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View) ? table4[ViewBaseConfig].selectedFields : table4[
|
31981
|
+
const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View) ? table4[ViewBaseConfig].selectedFields : table4[Table.Symbol.Columns];
|
32020
31982
|
this.config.fields[tableName] = selection;
|
32021
31983
|
}
|
32022
31984
|
}
|
@@ -33088,7 +33050,7 @@ var init_view3 = __esm({
|
|
33088
33050
|
});
|
33089
33051
|
|
33090
33052
|
// ../node_modules/.pnpm/drizzle-orm@0.32.1_@aws-sdk+client-rds-data@3.583.0_@cloudflare+workers-types@4.20240524.0_@e_b4cdnxy7l6gc3lxxx27eybv3eu/node_modules/drizzle-orm/mysql-core/schema.js
|
33091
|
-
var _a316,
|
33053
|
+
var _a316, MySqlSchema3;
|
33092
33054
|
var init_schema2 = __esm({
|
33093
33055
|
"../node_modules/.pnpm/drizzle-orm@0.32.1_@aws-sdk+client-rds-data@3.583.0_@cloudflare+workers-types@4.20240524.0_@e_b4cdnxy7l6gc3lxxx27eybv3eu/node_modules/drizzle-orm/mysql-core/schema.js"() {
|
33094
33056
|
"use strict";
|
@@ -33096,7 +33058,7 @@ var init_schema2 = __esm({
|
|
33096
33058
|
init_table4();
|
33097
33059
|
init_view3();
|
33098
33060
|
_a316 = entityKind;
|
33099
|
-
|
33061
|
+
MySqlSchema3 = class {
|
33100
33062
|
constructor(schemaName) {
|
33101
33063
|
__publicField(this, "table", (name2, columns, extraConfig) => {
|
33102
33064
|
return mysqlTableWithSchema(name2, columns, extraConfig, this.schemaName);
|
@@ -33107,7 +33069,7 @@ var init_schema2 = __esm({
|
|
33107
33069
|
this.schemaName = schemaName;
|
33108
33070
|
}
|
33109
33071
|
};
|
33110
|
-
__publicField(
|
33072
|
+
__publicField(MySqlSchema3, _a316, "MySqlSchema");
|
33111
33073
|
}
|
33112
33074
|
});
|
33113
33075
|
|
@@ -33187,9 +33149,9 @@ function getTableConfig3(table4) {
|
|
33187
33149
|
const primaryKeys = [];
|
33188
33150
|
const uniqueConstraints = [];
|
33189
33151
|
const foreignKeys = Object.values(table4[MySqlTable.Symbol.InlineForeignKeys]);
|
33190
|
-
const name2 = table4[
|
33191
|
-
const schema4 = table4[
|
33192
|
-
const baseName = table4[
|
33152
|
+
const name2 = table4[Table.Symbol.Name];
|
33153
|
+
const schema4 = table4[Table.Symbol.Schema];
|
33154
|
+
const baseName = table4[Table.Symbol.BaseName];
|
33193
33155
|
const extraConfigBuilder = table4[MySqlTable.Symbol.ExtraConfigBuilder];
|
33194
33156
|
if (extraConfigBuilder !== void 0) {
|
33195
33157
|
const extraConfig = extraConfigBuilder(table4[MySqlTable.Symbol.Columns]);
|
@@ -33808,200 +33770,6 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
33808
33770
|
}
|
33809
33771
|
});
|
33810
33772
|
|
33811
|
-
// src/cli/validations/cli.ts
|
33812
|
-
var cliConfigGenerate, pushParams, pullParams, configCheck, cliConfigCheck;
|
33813
|
-
var init_cli = __esm({
|
33814
|
-
"src/cli/validations/cli.ts"() {
|
33815
|
-
"use strict";
|
33816
|
-
init_lib();
|
33817
|
-
init_schemaValidator();
|
33818
|
-
init_common();
|
33819
|
-
cliConfigGenerate = objectType({
|
33820
|
-
dialect: dialect3.optional(),
|
33821
|
-
schema: unionType([stringType(), stringType().array()]).optional(),
|
33822
|
-
out: stringType().optional().default("./drizzle"),
|
33823
|
-
config: stringType().optional(),
|
33824
|
-
name: stringType().optional(),
|
33825
|
-
prefix: prefix.optional(),
|
33826
|
-
breakpoints: booleanType().optional().default(true),
|
33827
|
-
custom: booleanType().optional().default(false)
|
33828
|
-
}).strict();
|
33829
|
-
pushParams = objectType({
|
33830
|
-
dialect: dialect3,
|
33831
|
-
schema: unionType([stringType(), stringType().array()]),
|
33832
|
-
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
33833
|
-
schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
|
33834
|
-
extensionsFilters: literalType("postgis").array().optional(),
|
33835
|
-
verbose: booleanType().optional(),
|
33836
|
-
strict: booleanType().optional()
|
33837
|
-
}).passthrough();
|
33838
|
-
pullParams = objectType({
|
33839
|
-
config: stringType().optional(),
|
33840
|
-
dialect: dialect3,
|
33841
|
-
out: stringType().optional().default("drizzle"),
|
33842
|
-
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
33843
|
-
schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
|
33844
|
-
extensionsFilters: literalType("postgis").array().optional(),
|
33845
|
-
introspectCasing: casing,
|
33846
|
-
breakpoints: booleanType().optional().default(true),
|
33847
|
-
database: objectType({
|
33848
|
-
prefix: prefix.optional().default("index")
|
33849
|
-
}).optional()
|
33850
|
-
}).passthrough();
|
33851
|
-
configCheck = objectType({
|
33852
|
-
dialect: dialect3.optional(),
|
33853
|
-
out: stringType().optional()
|
33854
|
-
});
|
33855
|
-
cliConfigCheck = intersectionType(
|
33856
|
-
objectType({
|
33857
|
-
config: stringType().optional()
|
33858
|
-
}),
|
33859
|
-
configCheck
|
33860
|
-
);
|
33861
|
-
}
|
33862
|
-
});
|
33863
|
-
|
33864
|
-
// src/cli/validations/mysql.ts
|
33865
|
-
var mysqlCredentials;
|
33866
|
-
var init_mysql = __esm({
|
33867
|
-
"src/cli/validations/mysql.ts"() {
|
33868
|
-
"use strict";
|
33869
|
-
init_lib();
|
33870
|
-
init_views();
|
33871
|
-
init_common();
|
33872
|
-
init_outputs();
|
33873
|
-
mysqlCredentials = unionType([
|
33874
|
-
objectType({
|
33875
|
-
host: stringType().min(1),
|
33876
|
-
port: coerce.number().min(1).optional(),
|
33877
|
-
user: stringType().min(1).optional(),
|
33878
|
-
password: stringType().min(1).optional(),
|
33879
|
-
database: stringType().min(1),
|
33880
|
-
ssl: unionType([
|
33881
|
-
stringType(),
|
33882
|
-
objectType({
|
33883
|
-
pfx: stringType().optional(),
|
33884
|
-
key: stringType().optional(),
|
33885
|
-
passphrase: stringType().optional(),
|
33886
|
-
cert: stringType().optional(),
|
33887
|
-
ca: unionType([stringType(), stringType().array()]).optional(),
|
33888
|
-
crl: unionType([stringType(), stringType().array()]).optional(),
|
33889
|
-
ciphers: stringType().optional(),
|
33890
|
-
rejectUnauthorized: booleanType().optional()
|
33891
|
-
})
|
33892
|
-
]).optional()
|
33893
|
-
}),
|
33894
|
-
objectType({
|
33895
|
-
url: stringType().min(1)
|
33896
|
-
})
|
33897
|
-
]);
|
33898
|
-
}
|
33899
|
-
});
|
33900
|
-
|
33901
|
-
// src/cli/validations/postgres.ts
|
33902
|
-
var postgresCredentials;
|
33903
|
-
var init_postgres = __esm({
|
33904
|
-
"src/cli/validations/postgres.ts"() {
|
33905
|
-
"use strict";
|
33906
|
-
init_lib();
|
33907
|
-
init_views();
|
33908
|
-
init_common();
|
33909
|
-
postgresCredentials = unionType([
|
33910
|
-
objectType({
|
33911
|
-
driver: undefinedType(),
|
33912
|
-
host: stringType().min(1),
|
33913
|
-
port: coerce.number().min(1).optional(),
|
33914
|
-
user: stringType().min(1).optional(),
|
33915
|
-
password: stringType().min(1).optional(),
|
33916
|
-
database: stringType().min(1),
|
33917
|
-
ssl: unionType([
|
33918
|
-
literalType("require"),
|
33919
|
-
literalType("allow"),
|
33920
|
-
literalType("prefer"),
|
33921
|
-
literalType("verify-full"),
|
33922
|
-
booleanType(),
|
33923
|
-
objectType({}).passthrough()
|
33924
|
-
]).optional()
|
33925
|
-
}).transform((o) => {
|
33926
|
-
delete o.driver;
|
33927
|
-
return o;
|
33928
|
-
}),
|
33929
|
-
objectType({
|
33930
|
-
driver: undefinedType(),
|
33931
|
-
url: stringType().min(1)
|
33932
|
-
}).transform((o) => {
|
33933
|
-
delete o.driver;
|
33934
|
-
return o;
|
33935
|
-
}),
|
33936
|
-
objectType({
|
33937
|
-
driver: literalType("aws-data-api"),
|
33938
|
-
database: stringType().min(1),
|
33939
|
-
secretArn: stringType().min(1),
|
33940
|
-
resourceArn: stringType().min(1)
|
33941
|
-
})
|
33942
|
-
]);
|
33943
|
-
}
|
33944
|
-
});
|
33945
|
-
|
33946
|
-
// src/cli/validations/sqlite.ts
|
33947
|
-
var sqliteCredentials;
|
33948
|
-
var init_sqlite = __esm({
|
33949
|
-
"src/cli/validations/sqlite.ts"() {
|
33950
|
-
"use strict";
|
33951
|
-
init_global();
|
33952
|
-
init_lib();
|
33953
|
-
init_views();
|
33954
|
-
init_common();
|
33955
|
-
sqliteCredentials = unionType([
|
33956
|
-
objectType({
|
33957
|
-
driver: literalType("turso"),
|
33958
|
-
url: stringType().min(1),
|
33959
|
-
authToken: stringType().min(1).optional()
|
33960
|
-
}),
|
33961
|
-
objectType({
|
33962
|
-
driver: literalType("d1-http"),
|
33963
|
-
accountId: stringType().min(1),
|
33964
|
-
databaseId: stringType().min(1),
|
33965
|
-
token: stringType().min(1)
|
33966
|
-
}),
|
33967
|
-
objectType({
|
33968
|
-
driver: undefinedType(),
|
33969
|
-
url: stringType().min(1)
|
33970
|
-
}).transform((o) => {
|
33971
|
-
delete o.driver;
|
33972
|
-
return o;
|
33973
|
-
})
|
33974
|
-
]);
|
33975
|
-
}
|
33976
|
-
});
|
33977
|
-
|
33978
|
-
// src/cli/validations/studio.ts
|
33979
|
-
var credentials, studioCliParams, studioConfig;
|
33980
|
-
var init_studio = __esm({
|
33981
|
-
"src/cli/validations/studio.ts"() {
|
33982
|
-
"use strict";
|
33983
|
-
init_lib();
|
33984
|
-
init_schemaValidator();
|
33985
|
-
init_mysql();
|
33986
|
-
init_postgres();
|
33987
|
-
init_sqlite();
|
33988
|
-
credentials = intersectionType(
|
33989
|
-
postgresCredentials,
|
33990
|
-
mysqlCredentials,
|
33991
|
-
sqliteCredentials
|
33992
|
-
);
|
33993
|
-
studioCliParams = objectType({
|
33994
|
-
port: coerce.number().optional().default(4983),
|
33995
|
-
host: stringType().optional().default("127.0.0.1"),
|
33996
|
-
config: stringType().optional()
|
33997
|
-
});
|
33998
|
-
studioConfig = objectType({
|
33999
|
-
dialect: dialect3,
|
34000
|
-
schema: unionType([stringType(), stringType().array()]).optional()
|
34001
|
-
});
|
34002
|
-
}
|
34003
|
-
});
|
34004
|
-
|
34005
33773
|
// src/cli/commands/_es5.ts
|
34006
33774
|
var es5_exports = {};
|
34007
33775
|
__export(es5_exports, {
|
@@ -34023,16 +33791,8 @@ var init_utils8 = __esm({
|
|
34023
33791
|
"use strict";
|
34024
33792
|
import_hanji7 = __toESM(require_hanji());
|
34025
33793
|
init_lib();
|
34026
|
-
init_global();
|
34027
33794
|
init_schemaValidator();
|
34028
|
-
init_serializer();
|
34029
|
-
init_cli();
|
34030
33795
|
init_common();
|
34031
|
-
init_mysql();
|
34032
|
-
init_outputs();
|
34033
|
-
init_postgres();
|
34034
|
-
init_sqlite();
|
34035
|
-
init_studio();
|
34036
33796
|
init_views();
|
34037
33797
|
assertES5 = async (unregister) => {
|
34038
33798
|
try {
|
@@ -34085,7 +33845,6 @@ var init_pgImports = __esm({
|
|
34085
33845
|
"use strict";
|
34086
33846
|
init_drizzle_orm();
|
34087
33847
|
init_pg_core();
|
34088
|
-
init_utils8();
|
34089
33848
|
prepareFromExports = (exports) => {
|
34090
33849
|
const tables = [];
|
34091
33850
|
const enums = [];
|
@@ -34100,7 +33859,7 @@ var init_pgImports = __esm({
|
|
34100
33859
|
if (is(t, PgTable)) {
|
34101
33860
|
tables.push(t);
|
34102
33861
|
}
|
34103
|
-
if (is(t,
|
33862
|
+
if (is(t, PgSchema3)) {
|
34104
33863
|
schemas.push(t);
|
34105
33864
|
}
|
34106
33865
|
if (isPgSequence(t)) {
|
@@ -34777,7 +34536,6 @@ var pgSuggestions = async (db, statements) => {
|
|
34777
34536
|
|
34778
34537
|
// src/cli/commands/pgUp.ts
|
34779
34538
|
init_pgSchema();
|
34780
|
-
init_utils();
|
34781
34539
|
var updateUpToV6 = (json) => {
|
34782
34540
|
const schema4 = pgSchemaV5.parse(json);
|
34783
34541
|
const tables = Object.fromEntries(
|
@@ -34813,114 +34571,6 @@ var updateUpToV6 = (json) => {
|
|
34813
34571
|
var import_hanji6 = __toESM(require_hanji());
|
34814
34572
|
init_mjs();
|
34815
34573
|
init_global();
|
34816
|
-
|
34817
|
-
// ../node_modules/.pnpm/camelcase@7.0.1/node_modules/camelcase/index.js
|
34818
|
-
var UPPERCASE = /[\p{Lu}]/u;
|
34819
|
-
var LOWERCASE = /[\p{Ll}]/u;
|
34820
|
-
var LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
|
34821
|
-
var IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
34822
|
-
var SEPARATORS = /[_.\- ]+/;
|
34823
|
-
var LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
|
34824
|
-
var SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
|
34825
|
-
var NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
|
34826
|
-
var preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase2) => {
|
34827
|
-
let isLastCharLower = false;
|
34828
|
-
let isLastCharUpper = false;
|
34829
|
-
let isLastLastCharUpper = false;
|
34830
|
-
let isLastLastCharPreserved = false;
|
34831
|
-
for (let index4 = 0; index4 < string.length; index4++) {
|
34832
|
-
const character = string[index4];
|
34833
|
-
isLastLastCharPreserved = index4 > 2 ? string[index4 - 3] === "-" : true;
|
34834
|
-
if (isLastCharLower && UPPERCASE.test(character)) {
|
34835
|
-
string = string.slice(0, index4) + "-" + string.slice(index4);
|
34836
|
-
isLastCharLower = false;
|
34837
|
-
isLastLastCharUpper = isLastCharUpper;
|
34838
|
-
isLastCharUpper = true;
|
34839
|
-
index4++;
|
34840
|
-
} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase2)) {
|
34841
|
-
string = string.slice(0, index4 - 1) + "-" + string.slice(index4 - 1);
|
34842
|
-
isLastLastCharUpper = isLastCharUpper;
|
34843
|
-
isLastCharUpper = false;
|
34844
|
-
isLastCharLower = true;
|
34845
|
-
} else {
|
34846
|
-
isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
|
34847
|
-
isLastLastCharUpper = isLastCharUpper;
|
34848
|
-
isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
|
34849
|
-
}
|
34850
|
-
}
|
34851
|
-
return string;
|
34852
|
-
};
|
34853
|
-
var preserveConsecutiveUppercase = (input, toLowerCase) => {
|
34854
|
-
LEADING_CAPITAL.lastIndex = 0;
|
34855
|
-
return input.replace(LEADING_CAPITAL, (m1) => toLowerCase(m1));
|
34856
|
-
};
|
34857
|
-
var postProcess = (input, toUpperCase) => {
|
34858
|
-
SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
|
34859
|
-
NUMBERS_AND_IDENTIFIER.lastIndex = 0;
|
34860
|
-
return input.replace(SEPARATORS_AND_IDENTIFIER, (_2, identifier) => toUpperCase(identifier)).replace(NUMBERS_AND_IDENTIFIER, (m) => toUpperCase(m));
|
34861
|
-
};
|
34862
|
-
function camelCase(input, options) {
|
34863
|
-
if (!(typeof input === "string" || Array.isArray(input))) {
|
34864
|
-
throw new TypeError("Expected the input to be `string | string[]`");
|
34865
|
-
}
|
34866
|
-
options = {
|
34867
|
-
pascalCase: false,
|
34868
|
-
preserveConsecutiveUppercase: false,
|
34869
|
-
...options
|
34870
|
-
};
|
34871
|
-
if (Array.isArray(input)) {
|
34872
|
-
input = input.map((x) => x.trim()).filter((x) => x.length).join("-");
|
34873
|
-
} else {
|
34874
|
-
input = input.trim();
|
34875
|
-
}
|
34876
|
-
if (input.length === 0) {
|
34877
|
-
return "";
|
34878
|
-
}
|
34879
|
-
const toLowerCase = options.locale === false ? (string) => string.toLowerCase() : (string) => string.toLocaleLowerCase(options.locale);
|
34880
|
-
const toUpperCase = options.locale === false ? (string) => string.toUpperCase() : (string) => string.toLocaleUpperCase(options.locale);
|
34881
|
-
if (input.length === 1) {
|
34882
|
-
if (SEPARATORS.test(input)) {
|
34883
|
-
return "";
|
34884
|
-
}
|
34885
|
-
return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
|
34886
|
-
}
|
34887
|
-
const hasUpperCase = input !== toLowerCase(input);
|
34888
|
-
if (hasUpperCase) {
|
34889
|
-
input = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase);
|
34890
|
-
}
|
34891
|
-
input = input.replace(LEADING_SEPARATORS, "");
|
34892
|
-
input = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);
|
34893
|
-
if (options.pascalCase) {
|
34894
|
-
input = toUpperCase(input.charAt(0)) + input.slice(1);
|
34895
|
-
}
|
34896
|
-
return postProcess(input, toUpperCase);
|
34897
|
-
}
|
34898
|
-
|
34899
|
-
// src/@types/utils.ts
|
34900
|
-
String.prototype.trimChar = function(char) {
|
34901
|
-
let start = 0;
|
34902
|
-
let end = this.length;
|
34903
|
-
while (start < end && this[start] === char) ++start;
|
34904
|
-
while (end > start && this[end - 1] === char) --end;
|
34905
|
-
return start > 0 || end < this.length ? this.substring(start, end) : this.toString();
|
34906
|
-
};
|
34907
|
-
String.prototype.squashSpaces = function() {
|
34908
|
-
return this.replace(/ +/g, " ").trim();
|
34909
|
-
};
|
34910
|
-
String.prototype.camelCase = function() {
|
34911
|
-
return camelCase(String(this));
|
34912
|
-
};
|
34913
|
-
String.prototype.capitalise = function() {
|
34914
|
-
return this && this.length > 0 ? `${this[0].toUpperCase()}${this.slice(1)}` : String(this);
|
34915
|
-
};
|
34916
|
-
String.prototype.concatIf = function(it, condition) {
|
34917
|
-
return condition ? `${this}${it}` : String(this);
|
34918
|
-
};
|
34919
|
-
Array.prototype.random = function() {
|
34920
|
-
return this[~~(Math.random() * this.length)];
|
34921
|
-
};
|
34922
|
-
|
34923
|
-
// src/cli/commands/sqliteIntrospect.ts
|
34924
34574
|
init_sqliteSerializer();
|
34925
34575
|
init_views();
|
34926
34576
|
var sqlitePushIntrospect = async (db, filters) => {
|