drizzle-kit 0.23.2-5be2712 → 0.23.2-ab12f1d
Sign up to get free protection for your applications and to get access to all the features.
- package/api.js +481 -131
- package/api.mjs +481 -131
- package/bin.cjs +4047 -49641
- package/package.json +1 -2
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, coerce;
|
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,6 +7189,16 @@ 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
|
+
};
|
7192
7202
|
}
|
7193
7203
|
});
|
7194
7204
|
|
@@ -8337,6 +8347,11 @@ var copy, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey
|
|
8337
8347
|
var init_utils = __esm({
|
8338
8348
|
"src/utils.ts"() {
|
8339
8349
|
"use strict";
|
8350
|
+
init_views();
|
8351
|
+
init_global();
|
8352
|
+
init_mysqlSchema();
|
8353
|
+
init_pgSchema();
|
8354
|
+
init_sqliteSchema();
|
8340
8355
|
copy = (it) => {
|
8341
8356
|
return JSON.parse(JSON.stringify(it));
|
8342
8357
|
};
|
@@ -8384,6 +8399,7 @@ var init_views = __esm({
|
|
8384
8399
|
"use strict";
|
8385
8400
|
init_source();
|
8386
8401
|
import_hanji = __toESM(require_hanji());
|
8402
|
+
init_utils();
|
8387
8403
|
warning = (msg) => {
|
8388
8404
|
(0, import_hanji.render)(`[${source_default.yellow("Warning")}] ${msg}`);
|
8389
8405
|
};
|
@@ -8580,6 +8596,7 @@ var init_serializer = __esm({
|
|
8580
8596
|
"src/serializer/index.ts"() {
|
8581
8597
|
"use strict";
|
8582
8598
|
glob = __toESM(require_glob());
|
8599
|
+
init_views();
|
8583
8600
|
sqlToStr = (sql2) => {
|
8584
8601
|
return sql2.toQuery({
|
8585
8602
|
escapeName: () => {
|
@@ -8601,6 +8618,10 @@ var fillPgSnapshot;
|
|
8601
8618
|
var init_migrationPreparator = __esm({
|
8602
8619
|
"src/migrationPreparator.ts"() {
|
8603
8620
|
"use strict";
|
8621
|
+
init_serializer();
|
8622
|
+
init_mysqlSchema();
|
8623
|
+
init_pgSchema();
|
8624
|
+
init_sqliteSchema();
|
8604
8625
|
fillPgSnapshot = ({
|
8605
8626
|
serialized,
|
8606
8627
|
id,
|
@@ -15798,6 +15819,13 @@ var init_snapshotsDiffer = __esm({
|
|
15798
15819
|
}
|
15799
15820
|
});
|
15800
15821
|
|
15822
|
+
// src/utils/words.ts
|
15823
|
+
var init_words = __esm({
|
15824
|
+
"src/utils/words.ts"() {
|
15825
|
+
"use strict";
|
15826
|
+
}
|
15827
|
+
});
|
15828
|
+
|
15801
15829
|
// src/schemaValidator.ts
|
15802
15830
|
var dialects, dialect3, commonSquashedSchema, commonSchema;
|
15803
15831
|
var init_schemaValidator = __esm({
|
@@ -15825,6 +15853,7 @@ var init_common = __esm({
|
|
15825
15853
|
"use strict";
|
15826
15854
|
init_lib();
|
15827
15855
|
init_schemaValidator();
|
15856
|
+
init_outputs();
|
15828
15857
|
sqliteDriversLiterals = [
|
15829
15858
|
literalType("turso"),
|
15830
15859
|
literalType("d1-http"),
|
@@ -15907,6 +15936,7 @@ var init_outputs = __esm({
|
|
15907
15936
|
"src/cli/validations/outputs.ts"() {
|
15908
15937
|
"use strict";
|
15909
15938
|
init_source();
|
15939
|
+
init_common();
|
15910
15940
|
withStyle = {
|
15911
15941
|
error: (str) => `${source_default.red(`${source_default.white.bgRed(" Invalid input ")} ${str}`)}`,
|
15912
15942
|
warning: (str) => `${source_default.white.bgGray(" Warning ")} ${str}`,
|
@@ -15923,8 +15953,16 @@ var import_hanji2, schemasResolver, tablesResolver, sequencesResolver, enumsReso
|
|
15923
15953
|
var init_migrate = __esm({
|
15924
15954
|
"src/cli/commands/migrate.ts"() {
|
15925
15955
|
"use strict";
|
15956
|
+
init_migrationPreparator();
|
15926
15957
|
init_source();
|
15927
15958
|
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();
|
15928
15966
|
init_views();
|
15929
15967
|
schemasResolver = async (input) => {
|
15930
15968
|
try {
|
@@ -17273,13 +17311,13 @@ var init_entity = __esm({
|
|
17273
17311
|
});
|
17274
17312
|
|
17275
17313
|
// ../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
|
17276
|
-
var _a,
|
17314
|
+
var _a, Column2;
|
17277
17315
|
var init_column = __esm({
|
17278
17316
|
"../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"() {
|
17279
17317
|
"use strict";
|
17280
17318
|
init_entity();
|
17281
17319
|
_a = entityKind;
|
17282
|
-
|
17320
|
+
Column2 = class {
|
17283
17321
|
constructor(table4, config) {
|
17284
17322
|
__publicField(this, "name");
|
17285
17323
|
__publicField(this, "primary");
|
@@ -17325,7 +17363,7 @@ var init_column = __esm({
|
|
17325
17363
|
return this.config.generated !== void 0 && this.config.generated.type !== "byDefault";
|
17326
17364
|
}
|
17327
17365
|
};
|
17328
|
-
__publicField(
|
17366
|
+
__publicField(Column2, _a, "Column");
|
17329
17367
|
}
|
17330
17368
|
});
|
17331
17369
|
|
@@ -17444,7 +17482,7 @@ function getTableName(table4) {
|
|
17444
17482
|
function getTableUniqueName(table4) {
|
17445
17483
|
return `${table4[Schema] ?? "public"}.${table4[TableName]}`;
|
17446
17484
|
}
|
17447
|
-
var TableName, Schema, Columns, ExtraConfigColumns, OriginalName, BaseName, IsAlias, ExtraConfigBuilder, IsDrizzleTable, _a3, _b, _c, _d, _e, _f, _g, _h, _i,
|
17485
|
+
var TableName, Schema, Columns, ExtraConfigColumns, OriginalName, BaseName, IsAlias, ExtraConfigBuilder, IsDrizzleTable, _a3, _b, _c, _d, _e, _f, _g, _h, _i, Table2;
|
17448
17486
|
var init_table = __esm({
|
17449
17487
|
"../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"() {
|
17450
17488
|
"use strict";
|
@@ -17459,7 +17497,7 @@ var init_table = __esm({
|
|
17459
17497
|
ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
|
17460
17498
|
IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
|
17461
17499
|
_i = entityKind, _h = TableName, _g = OriginalName, _f = Schema, _e = Columns, _d = ExtraConfigColumns, _c = BaseName, _b = IsAlias, _a3 = ExtraConfigBuilder;
|
17462
|
-
|
17500
|
+
Table2 = class {
|
17463
17501
|
constructor(name2, schema4, baseName) {
|
17464
17502
|
/**
|
17465
17503
|
* @internal
|
@@ -17491,9 +17529,9 @@ var init_table = __esm({
|
|
17491
17529
|
this[BaseName] = baseName;
|
17492
17530
|
}
|
17493
17531
|
};
|
17494
|
-
__publicField(
|
17532
|
+
__publicField(Table2, _i, "Table");
|
17495
17533
|
/** @internal */
|
17496
|
-
__publicField(
|
17534
|
+
__publicField(Table2, "Symbol", {
|
17497
17535
|
Name: TableName,
|
17498
17536
|
Schema,
|
17499
17537
|
OriginalName,
|
@@ -17525,8 +17563,8 @@ function pgTableWithSchema(name2, columns, extraConfig, schema4, baseName = name
|
|
17525
17563
|
})
|
17526
17564
|
);
|
17527
17565
|
const table4 = Object.assign(rawTable, builtColumns);
|
17528
|
-
table4[
|
17529
|
-
table4[
|
17566
|
+
table4[Table2.Symbol.Columns] = builtColumns;
|
17567
|
+
table4[Table2.Symbol.ExtraConfigColumns] = builtColumnsForExtraConfig;
|
17530
17568
|
if (extraConfig) {
|
17531
17569
|
table4[PgTable.Symbol.ExtraConfigBuilder] = extraConfig;
|
17532
17570
|
}
|
@@ -17539,7 +17577,7 @@ var init_table2 = __esm({
|
|
17539
17577
|
init_entity();
|
17540
17578
|
init_table();
|
17541
17579
|
InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
|
17542
|
-
PgTable = class extends (_d2 =
|
17580
|
+
PgTable = class extends (_d2 = Table2, _c2 = entityKind, _b2 = InlineForeignKeys, _a4 = Table2.Symbol.ExtraConfigBuilder, _d2) {
|
17543
17581
|
constructor() {
|
17544
17582
|
super(...arguments);
|
17545
17583
|
/**@internal */
|
@@ -17550,7 +17588,7 @@ var init_table2 = __esm({
|
|
17550
17588
|
};
|
17551
17589
|
__publicField(PgTable, _c2, "PgTable");
|
17552
17590
|
/** @internal */
|
17553
|
-
__publicField(PgTable, "Symbol", Object.assign({},
|
17591
|
+
__publicField(PgTable, "Symbol", Object.assign({}, Table2.Symbol, {
|
17554
17592
|
InlineForeignKeys
|
17555
17593
|
}));
|
17556
17594
|
pgTable = (name2, columns, extraConfig) => {
|
@@ -17844,7 +17882,7 @@ var init_common2 = __esm({
|
|
17844
17882
|
}
|
17845
17883
|
};
|
17846
17884
|
__publicField(PgColumnBuilder, _a10, "PgColumnBuilder");
|
17847
|
-
PgColumn = class extends (_b4 =
|
17885
|
+
PgColumn = class extends (_b4 = Column2, _a11 = entityKind, _b4) {
|
17848
17886
|
constructor(table4, config) {
|
17849
17887
|
if (!config.uniqueName) {
|
17850
17888
|
config.uniqueName = uniqueKeyName(table4, [config.name]);
|
@@ -18259,19 +18297,19 @@ var init_sql = __esm({
|
|
18259
18297
|
inlineParams: inlineParams || chunk.shouldInlineParams
|
18260
18298
|
});
|
18261
18299
|
}
|
18262
|
-
if (is(chunk,
|
18263
|
-
const schemaName = chunk[
|
18264
|
-
const tableName = chunk[
|
18300
|
+
if (is(chunk, Table2)) {
|
18301
|
+
const schemaName = chunk[Table2.Symbol.Schema];
|
18302
|
+
const tableName = chunk[Table2.Symbol.Name];
|
18265
18303
|
return {
|
18266
18304
|
sql: schemaName === void 0 ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
|
18267
18305
|
params: []
|
18268
18306
|
};
|
18269
18307
|
}
|
18270
|
-
if (is(chunk,
|
18308
|
+
if (is(chunk, Column2)) {
|
18271
18309
|
if (_config.invokeSource === "indexes") {
|
18272
18310
|
return { sql: escapeName(chunk.name), params: [] };
|
18273
18311
|
}
|
18274
|
-
return { sql: escapeName(chunk.table[
|
18312
|
+
return { sql: escapeName(chunk.table[Table2.Symbol.Name]) + "." + escapeName(chunk.name), params: [] };
|
18275
18313
|
}
|
18276
18314
|
if (is(chunk, View)) {
|
18277
18315
|
const schemaName = chunk[ViewBaseConfig].schema;
|
@@ -18508,10 +18546,10 @@ var init_sql = __esm({
|
|
18508
18546
|
}
|
18509
18547
|
};
|
18510
18548
|
__publicField(View, _b11, "View");
|
18511
|
-
|
18549
|
+
Column2.prototype.getSQL = function() {
|
18512
18550
|
return new SQL([this]);
|
18513
18551
|
};
|
18514
|
-
|
18552
|
+
Table2.prototype.getSQL = function() {
|
18515
18553
|
return new SQL([this]);
|
18516
18554
|
};
|
18517
18555
|
Subquery.prototype.getSQL = function() {
|
@@ -18538,7 +18576,7 @@ function mapColumnsInAliasedSQLToAlias(query, alias) {
|
|
18538
18576
|
}
|
18539
18577
|
function mapColumnsInSQLToAlias(query, alias) {
|
18540
18578
|
return sql.join(query.queryChunks.map((c) => {
|
18541
|
-
if (is(c,
|
18579
|
+
if (is(c, Column2)) {
|
18542
18580
|
return aliasedTableColumn(c, alias);
|
18543
18581
|
}
|
18544
18582
|
if (is(c, SQL)) {
|
@@ -18579,13 +18617,13 @@ var init_alias = __esm({
|
|
18579
18617
|
this.replaceOriginalName = replaceOriginalName;
|
18580
18618
|
}
|
18581
18619
|
get(target, prop) {
|
18582
|
-
if (prop ===
|
18620
|
+
if (prop === Table2.Symbol.IsAlias) {
|
18583
18621
|
return true;
|
18584
18622
|
}
|
18585
|
-
if (prop ===
|
18623
|
+
if (prop === Table2.Symbol.Name) {
|
18586
18624
|
return this.alias;
|
18587
18625
|
}
|
18588
|
-
if (this.replaceOriginalName && prop ===
|
18626
|
+
if (this.replaceOriginalName && prop === Table2.Symbol.OriginalName) {
|
18589
18627
|
return this.alias;
|
18590
18628
|
}
|
18591
18629
|
if (prop === ViewBaseConfig) {
|
@@ -18595,8 +18633,8 @@ var init_alias = __esm({
|
|
18595
18633
|
isAlias: true
|
18596
18634
|
};
|
18597
18635
|
}
|
18598
|
-
if (prop ===
|
18599
|
-
const columns = target[
|
18636
|
+
if (prop === Table2.Symbol.Columns) {
|
18637
|
+
const columns = target[Table2.Symbol.Columns];
|
18600
18638
|
if (!columns) {
|
18601
18639
|
return columns;
|
18602
18640
|
}
|
@@ -18610,7 +18648,7 @@ var init_alias = __esm({
|
|
18610
18648
|
return proxiedColumns;
|
18611
18649
|
}
|
18612
18650
|
const value = target[prop];
|
18613
|
-
if (is(value,
|
18651
|
+
if (is(value, Column2)) {
|
18614
18652
|
return new Proxy(value, new ColumnAliasProxyHandler(new Proxy(target, this)));
|
18615
18653
|
}
|
18616
18654
|
return value;
|
@@ -18658,7 +18696,7 @@ var init_errors = __esm({
|
|
18658
18696
|
|
18659
18697
|
// ../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
|
18660
18698
|
function bindIfParam(value, column4) {
|
18661
|
-
if (isDriverValueEncoder(column4) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value,
|
18699
|
+
if (isDriverValueEncoder(column4) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value, Column2) && !is(value, Table2) && !is(value, View)) {
|
18662
18700
|
return new Param(value, column4);
|
18663
18701
|
}
|
18664
18702
|
return value;
|
@@ -18999,33 +19037,33 @@ function getOrderByOperators() {
|
|
18999
19037
|
};
|
19000
19038
|
}
|
19001
19039
|
function extractTablesRelationalConfig(schema4, configHelpers) {
|
19002
|
-
if (Object.keys(schema4).length === 1 && "default" in schema4 && !is(schema4["default"],
|
19040
|
+
if (Object.keys(schema4).length === 1 && "default" in schema4 && !is(schema4["default"], Table2)) {
|
19003
19041
|
schema4 = schema4["default"];
|
19004
19042
|
}
|
19005
19043
|
const tableNamesMap = {};
|
19006
19044
|
const relationsBuffer = {};
|
19007
19045
|
const tablesConfig = {};
|
19008
19046
|
for (const [key, value] of Object.entries(schema4)) {
|
19009
|
-
if (is(value,
|
19047
|
+
if (is(value, Table2)) {
|
19010
19048
|
const dbName = getTableUniqueName(value);
|
19011
19049
|
const bufferedRelations = relationsBuffer[dbName];
|
19012
19050
|
tableNamesMap[dbName] = key;
|
19013
19051
|
tablesConfig[key] = {
|
19014
19052
|
tsName: key,
|
19015
|
-
dbName: value[
|
19016
|
-
schema: value[
|
19017
|
-
columns: value[
|
19053
|
+
dbName: value[Table2.Symbol.Name],
|
19054
|
+
schema: value[Table2.Symbol.Schema],
|
19055
|
+
columns: value[Table2.Symbol.Columns],
|
19018
19056
|
relations: bufferedRelations?.relations ?? {},
|
19019
19057
|
primaryKey: bufferedRelations?.primaryKey ?? []
|
19020
19058
|
};
|
19021
19059
|
for (const column4 of Object.values(
|
19022
|
-
value[
|
19060
|
+
value[Table2.Symbol.Columns]
|
19023
19061
|
)) {
|
19024
19062
|
if (column4.primary) {
|
19025
19063
|
tablesConfig[key].primaryKey.push(column4);
|
19026
19064
|
}
|
19027
19065
|
}
|
19028
|
-
const extraConfig = value[
|
19066
|
+
const extraConfig = value[Table2.Symbol.ExtraConfigBuilder]?.(value[Table2.Symbol.ExtraConfigColumns]);
|
19029
19067
|
if (extraConfig) {
|
19030
19068
|
for (const configEntry of Object.values(extraConfig)) {
|
19031
19069
|
if (is(configEntry, PrimaryKeyBuilder)) {
|
@@ -19097,7 +19135,7 @@ function normalizeRelation(schema4, tableNamesMap, relation) {
|
|
19097
19135
|
const referencedTableTsName = tableNamesMap[getTableUniqueName(relation.referencedTable)];
|
19098
19136
|
if (!referencedTableTsName) {
|
19099
19137
|
throw new Error(
|
19100
|
-
`Table "${relation.referencedTable[
|
19138
|
+
`Table "${relation.referencedTable[Table2.Symbol.Name]}" not found in schema`
|
19101
19139
|
);
|
19102
19140
|
}
|
19103
19141
|
const referencedTableConfig = schema4[referencedTableTsName];
|
@@ -19108,7 +19146,7 @@ function normalizeRelation(schema4, tableNamesMap, relation) {
|
|
19108
19146
|
const sourceTableTsName = tableNamesMap[getTableUniqueName(sourceTable)];
|
19109
19147
|
if (!sourceTableTsName) {
|
19110
19148
|
throw new Error(
|
19111
|
-
`Table "${sourceTable[
|
19149
|
+
`Table "${sourceTable[Table2.Symbol.Name]}" not found in schema`
|
19112
19150
|
);
|
19113
19151
|
}
|
19114
19152
|
const reverseRelations = [];
|
@@ -19123,7 +19161,7 @@ function normalizeRelation(schema4, tableNamesMap, relation) {
|
|
19123
19161
|
throw relation.relationName ? new Error(
|
19124
19162
|
`There are multiple relations with name "${relation.relationName}" in table "${referencedTableTsName}"`
|
19125
19163
|
) : new Error(
|
19126
|
-
`There are multiple relations between "${referencedTableTsName}" and "${relation.sourceTable[
|
19164
|
+
`There are multiple relations between "${referencedTableTsName}" and "${relation.sourceTable[Table2.Symbol.Name]}". Please specify relation name`
|
19127
19165
|
);
|
19128
19166
|
}
|
19129
19167
|
if (reverseRelations[0] && is(reverseRelations[0], One) && reverseRelations[0].config) {
|
@@ -19171,7 +19209,7 @@ function mapRelationalRow(tablesConfig, tableConfig, row, buildQueryResultSelect
|
|
19171
19209
|
const value = mapColumnValue(row[selectionItemIndex]);
|
19172
19210
|
const field = selectionItem.field;
|
19173
19211
|
let decoder;
|
19174
|
-
if (is(field,
|
19212
|
+
if (is(field, Column2)) {
|
19175
19213
|
decoder = field;
|
19176
19214
|
} else if (is(field, SQL)) {
|
19177
19215
|
decoder = field.decoder;
|
@@ -19201,7 +19239,7 @@ var init_relations = __esm({
|
|
19201
19239
|
this.sourceTable = sourceTable;
|
19202
19240
|
this.referencedTable = referencedTable;
|
19203
19241
|
this.relationName = relationName;
|
19204
|
-
this.referencedTableName = referencedTable[
|
19242
|
+
this.referencedTableName = referencedTable[Table2.Symbol.Name];
|
19205
19243
|
}
|
19206
19244
|
};
|
19207
19245
|
__publicField(Relation, _a38, "Relation");
|
@@ -19272,10 +19310,10 @@ function sumDistinct(expression) {
|
|
19272
19310
|
return sql`sum(distinct ${expression})`.mapWith(String);
|
19273
19311
|
}
|
19274
19312
|
function max(expression) {
|
19275
|
-
return sql`max(${expression})`.mapWith(is(expression,
|
19313
|
+
return sql`max(${expression})`.mapWith(is(expression, Column2) ? expression : String);
|
19276
19314
|
}
|
19277
19315
|
function min(expression) {
|
19278
|
-
return sql`min(${expression})`.mapWith(is(expression,
|
19316
|
+
return sql`min(${expression})`.mapWith(is(expression, Column2) ? expression : String);
|
19279
19317
|
}
|
19280
19318
|
var init_aggregate = __esm({
|
19281
19319
|
"../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"() {
|
@@ -19358,7 +19396,7 @@ function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
19358
19396
|
const result = columns.reduce(
|
19359
19397
|
(result2, { path: path2, field }, columnIndex) => {
|
19360
19398
|
let decoder;
|
19361
|
-
if (is(field,
|
19399
|
+
if (is(field, Column2)) {
|
19362
19400
|
decoder = field;
|
19363
19401
|
} else if (is(field, SQL)) {
|
19364
19402
|
decoder = field.decoder;
|
@@ -19375,7 +19413,7 @@ function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
19375
19413
|
} else {
|
19376
19414
|
const rawValue = row[columnIndex];
|
19377
19415
|
const value = node[pathChunk] = rawValue === null ? null : decoder.mapFromDriverValue(rawValue);
|
19378
|
-
if (joinsNotNullableMap && is(field,
|
19416
|
+
if (joinsNotNullableMap && is(field, Column2) && path2.length === 2) {
|
19379
19417
|
const objectName = path2[0];
|
19380
19418
|
if (!(objectName in nullifyMap)) {
|
19381
19419
|
nullifyMap[objectName] = value === null ? getTableName(field.table) : false;
|
@@ -19404,10 +19442,10 @@ function orderSelectedFields(fields, pathPrefix) {
|
|
19404
19442
|
return result;
|
19405
19443
|
}
|
19406
19444
|
const newPath = pathPrefix ? [...pathPrefix, name2] : [name2];
|
19407
|
-
if (is(field,
|
19445
|
+
if (is(field, Column2) || is(field, SQL) || is(field, SQL.Aliased)) {
|
19408
19446
|
result.push({ path: newPath, field });
|
19409
|
-
} else if (is(field,
|
19410
|
-
result.push(...orderSelectedFields(field[
|
19447
|
+
} else if (is(field, Table2)) {
|
19448
|
+
result.push(...orderSelectedFields(field[Table2.Symbol.Columns], newPath));
|
19411
19449
|
} else {
|
19412
19450
|
result.push(...orderSelectedFields(field, newPath));
|
19413
19451
|
}
|
@@ -19432,7 +19470,7 @@ function mapUpdateSet(table4, values) {
|
|
19432
19470
|
if (is(value, SQL)) {
|
19433
19471
|
return [key, value];
|
19434
19472
|
} else {
|
19435
|
-
return [key, new Param(value, table4[
|
19473
|
+
return [key, new Param(value, table4[Table2.Symbol.Columns][key])];
|
19436
19474
|
}
|
19437
19475
|
});
|
19438
19476
|
if (entries.length === 0) {
|
@@ -19454,10 +19492,10 @@ function applyMixins(baseClass, extendedClasses) {
|
|
19454
19492
|
}
|
19455
19493
|
}
|
19456
19494
|
function getTableColumns(table4) {
|
19457
|
-
return table4[
|
19495
|
+
return table4[Table2.Symbol.Columns];
|
19458
19496
|
}
|
19459
19497
|
function getTableLikeName(table4) {
|
19460
|
-
return is(table4, Subquery) ? table4._.alias : is(table4, View) ? table4[ViewBaseConfig].name : is(table4, SQL) ? void 0 : table4[
|
19498
|
+
return is(table4, Subquery) ? table4._.alias : is(table4, View) ? table4[ViewBaseConfig].name : is(table4, SQL) ? void 0 : table4[Table2.Symbol.IsAlias] ? table4[Table2.Symbol.Name] : table4[Table2.Symbol.BaseName];
|
19461
19499
|
}
|
19462
19500
|
var init_utils2 = __esm({
|
19463
19501
|
"../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"() {
|
@@ -19475,7 +19513,7 @@ var init_utils2 = __esm({
|
|
19475
19513
|
var drizzle_orm_exports = {};
|
19476
19514
|
__export(drizzle_orm_exports, {
|
19477
19515
|
BaseName: () => BaseName,
|
19478
|
-
Column: () =>
|
19516
|
+
Column: () => Column2,
|
19479
19517
|
ColumnAliasProxyHandler: () => ColumnAliasProxyHandler,
|
19480
19518
|
ColumnBuilder: () => ColumnBuilder,
|
19481
19519
|
Columns: () => Columns,
|
@@ -19501,7 +19539,7 @@ __export(drizzle_orm_exports, {
|
|
19501
19539
|
Schema: () => Schema,
|
19502
19540
|
StringChunk: () => StringChunk,
|
19503
19541
|
Subquery: () => Subquery,
|
19504
|
-
Table: () =>
|
19542
|
+
Table: () => Table2,
|
19505
19543
|
TableAliasProxyHandler: () => TableAliasProxyHandler,
|
19506
19544
|
TableName: () => TableName,
|
19507
19545
|
TransactionRollbackError: () => TransactionRollbackError,
|
@@ -21134,7 +21172,7 @@ var init_delete = __esm({
|
|
21134
21172
|
this.config.where = where;
|
21135
21173
|
return this;
|
21136
21174
|
}
|
21137
|
-
returning(fields = this.config.table[
|
21175
|
+
returning(fields = this.config.table[Table2.Symbol.Columns]) {
|
21138
21176
|
this.config.returning = orderSelectedFields(fields);
|
21139
21177
|
return this;
|
21140
21178
|
}
|
@@ -21189,7 +21227,7 @@ var init_insert = __esm({
|
|
21189
21227
|
}
|
21190
21228
|
const mappedValues = values.map((entry) => {
|
21191
21229
|
const result = {};
|
21192
|
-
const cols = this.table[
|
21230
|
+
const cols = this.table[Table2.Symbol.Columns];
|
21193
21231
|
for (const colKey of Object.keys(entry)) {
|
21194
21232
|
const colValue = entry[colKey];
|
21195
21233
|
result[colKey] = is(colValue, SQL) ? colValue : new Param(colValue, cols[colKey]);
|
@@ -21213,7 +21251,7 @@ var init_insert = __esm({
|
|
21213
21251
|
this.dialect = dialect7;
|
21214
21252
|
this.config = { table: table4, values, withList };
|
21215
21253
|
}
|
21216
|
-
returning(fields = this.config.table[
|
21254
|
+
returning(fields = this.config.table[Table2.Symbol.Columns]) {
|
21217
21255
|
this.config.returning = orderSelectedFields(fields);
|
21218
21256
|
return this;
|
21219
21257
|
}
|
@@ -21411,7 +21449,7 @@ var init_dialect = __esm({
|
|
21411
21449
|
return sql`${withSql}delete from ${table4}${whereSql}${returningSql}`;
|
21412
21450
|
}
|
21413
21451
|
buildUpdateSet(table4, set) {
|
21414
|
-
const tableColumns = table4[
|
21452
|
+
const tableColumns = table4[Table2.Symbol.Columns];
|
21415
21453
|
const columnNames = Object.keys(tableColumns).filter(
|
21416
21454
|
(colName) => set[colName] !== void 0 || tableColumns[colName]?.onUpdateFn !== void 0
|
21417
21455
|
);
|
@@ -21469,7 +21507,7 @@ var init_dialect = __esm({
|
|
21469
21507
|
if (is(field, SQL.Aliased)) {
|
21470
21508
|
chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
|
21471
21509
|
}
|
21472
|
-
} else if (is(field,
|
21510
|
+
} else if (is(field, Column2)) {
|
21473
21511
|
if (isSingleTable) {
|
21474
21512
|
chunk.push(sql.identifier(field.name));
|
21475
21513
|
} else {
|
@@ -21501,8 +21539,8 @@ var init_dialect = __esm({
|
|
21501
21539
|
}) {
|
21502
21540
|
const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
|
21503
21541
|
for (const f of fieldsList) {
|
21504
|
-
if (is(f.field,
|
21505
|
-
({ alias }) => alias === (table22[
|
21542
|
+
if (is(f.field, Column2) && 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(
|
21543
|
+
({ alias }) => alias === (table22[Table2.Symbol.IsAlias] ? getTableName(table22) : table22[Table2.Symbol.BaseName])
|
21506
21544
|
))(f.field.table)) {
|
21507
21545
|
const tableName = getTableName(f.field.table);
|
21508
21546
|
throw new Error(
|
@@ -21518,12 +21556,12 @@ var init_dialect = __esm({
|
|
21518
21556
|
}
|
21519
21557
|
const selection = this.buildSelection(fieldsList, { isSingleTable });
|
21520
21558
|
const tableSql = (() => {
|
21521
|
-
if (is(table4,
|
21522
|
-
let fullName = sql`${sql.identifier(table4[
|
21523
|
-
if (table4[
|
21524
|
-
fullName = sql`${sql.identifier(table4[
|
21559
|
+
if (is(table4, Table2) && table4[Table2.Symbol.OriginalName] !== table4[Table2.Symbol.Name]) {
|
21560
|
+
let fullName = sql`${sql.identifier(table4[Table2.Symbol.OriginalName])}`;
|
21561
|
+
if (table4[Table2.Symbol.Schema]) {
|
21562
|
+
fullName = sql`${sql.identifier(table4[Table2.Symbol.Schema])}.${fullName}`;
|
21525
21563
|
}
|
21526
|
-
return sql`${fullName} ${sql.identifier(table4[
|
21564
|
+
return sql`${fullName} ${sql.identifier(table4[Table2.Symbol.Name])}`;
|
21527
21565
|
}
|
21528
21566
|
return table4;
|
21529
21567
|
})();
|
@@ -21644,7 +21682,7 @@ var init_dialect = __esm({
|
|
21644
21682
|
}
|
21645
21683
|
buildInsertQuery({ table: table4, values, onConflict, returning, withList }) {
|
21646
21684
|
const valuesSqlList = [];
|
21647
|
-
const columns = table4[
|
21685
|
+
const columns = table4[Table2.Symbol.Columns];
|
21648
21686
|
const colEntries = Object.entries(columns).filter(([_2, col]) => !col.shouldDisableInsert());
|
21649
21687
|
const insertOrder = colEntries.map(([, column4]) => sql.identifier(column4.name));
|
21650
21688
|
for (const [valueIndex, value] of values.entries()) {
|
@@ -22265,7 +22303,7 @@ var init_dialect = __esm({
|
|
22265
22303
|
selection.push({
|
22266
22304
|
dbKey: is(value, SQL.Aliased) ? value.fieldAlias : tableConfig.columns[tsKey].name,
|
22267
22305
|
tsKey,
|
22268
|
-
field: is(value,
|
22306
|
+
field: is(value, Column2) ? aliasedTableColumn(value, tableAlias) : value,
|
22269
22307
|
relationTableTsKey: void 0,
|
22270
22308
|
isJson: false,
|
22271
22309
|
selection: []
|
@@ -22276,7 +22314,7 @@ var init_dialect = __esm({
|
|
22276
22314
|
orderByOrig = [orderByOrig];
|
22277
22315
|
}
|
22278
22316
|
orderBy = orderByOrig.map((orderByValue) => {
|
22279
|
-
if (is(orderByValue,
|
22317
|
+
if (is(orderByValue, Column2)) {
|
22280
22318
|
return aliasedTableColumn(orderByValue, tableAlias);
|
22281
22319
|
}
|
22282
22320
|
return mapColumnsInSQLToAlias(orderByValue, tableAlias);
|
@@ -22379,7 +22417,7 @@ var init_dialect = __esm({
|
|
22379
22417
|
fields: {},
|
22380
22418
|
fieldsFlat: nestedSelection.map(({ field: field2 }) => ({
|
22381
22419
|
path: [],
|
22382
|
-
field: is(field2,
|
22420
|
+
field: is(field2, Column2) ? aliasedTableColumn(field2, tableAlias) : field2
|
22383
22421
|
})),
|
22384
22422
|
joins,
|
22385
22423
|
where,
|
@@ -22394,7 +22432,7 @@ var init_dialect = __esm({
|
|
22394
22432
|
fields: {},
|
22395
22433
|
fieldsFlat: selection.map(({ field }) => ({
|
22396
22434
|
path: [],
|
22397
|
-
field: is(field,
|
22435
|
+
field: is(field, Column2) ? aliasedTableColumn(field, tableAlias) : field
|
22398
22436
|
})),
|
22399
22437
|
joins,
|
22400
22438
|
where,
|
@@ -22472,7 +22510,7 @@ var init_selection_proxy = __esm({
|
|
22472
22510
|
`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.`
|
22473
22511
|
);
|
22474
22512
|
}
|
22475
|
-
if (is(value,
|
22513
|
+
if (is(value, Column2)) {
|
22476
22514
|
if (this.config.alias) {
|
22477
22515
|
return new Proxy(
|
22478
22516
|
value,
|
@@ -22936,7 +22974,7 @@ var init_select2 = __esm({
|
|
22936
22974
|
};
|
22937
22975
|
}
|
22938
22976
|
if (typeof tableName === "string" && !is(table4, SQL)) {
|
22939
|
-
const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View) ? table4[ViewBaseConfig].selectedFields : table4[
|
22977
|
+
const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View) ? table4[ViewBaseConfig].selectedFields : table4[Table2.Symbol.Columns];
|
22940
22978
|
this.config.fields[tableName] = selection;
|
22941
22979
|
}
|
22942
22980
|
}
|
@@ -23483,7 +23521,7 @@ var init_update = __esm({
|
|
23483
23521
|
this.config.where = where;
|
23484
23522
|
return this;
|
23485
23523
|
}
|
23486
|
-
returning(fields = this.config.table[
|
23524
|
+
returning(fields = this.config.table[Table2.Symbol.Columns]) {
|
23487
23525
|
this.config.returning = orderSelectedFields(fields);
|
23488
23526
|
return this;
|
23489
23527
|
}
|
@@ -24354,7 +24392,7 @@ var init_view = __esm({
|
|
24354
24392
|
});
|
24355
24393
|
|
24356
24394
|
// ../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
|
24357
|
-
var _a154,
|
24395
|
+
var _a154, PgSchema5;
|
24358
24396
|
var init_schema = __esm({
|
24359
24397
|
"../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"() {
|
24360
24398
|
"use strict";
|
@@ -24365,7 +24403,7 @@ var init_schema = __esm({
|
|
24365
24403
|
init_table2();
|
24366
24404
|
init_view();
|
24367
24405
|
_a154 = entityKind;
|
24368
|
-
|
24406
|
+
PgSchema5 = class {
|
24369
24407
|
constructor(schemaName) {
|
24370
24408
|
__publicField(this, "table", (name2, columns, extraConfig) => {
|
24371
24409
|
return pgTableWithSchema(name2, columns, extraConfig, this.schemaName);
|
@@ -24391,7 +24429,7 @@ var init_schema = __esm({
|
|
24391
24429
|
return true;
|
24392
24430
|
}
|
24393
24431
|
};
|
24394
|
-
__publicField(
|
24432
|
+
__publicField(PgSchema5, _a154, "PgSchema");
|
24395
24433
|
}
|
24396
24434
|
});
|
24397
24435
|
|
@@ -24488,17 +24526,17 @@ var init_subquery2 = __esm({
|
|
24488
24526
|
|
24489
24527
|
// ../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
|
24490
24528
|
function getTableConfig(table4) {
|
24491
|
-
const columns = Object.values(table4[
|
24529
|
+
const columns = Object.values(table4[Table2.Symbol.Columns]);
|
24492
24530
|
const indexes = [];
|
24493
24531
|
const checks = [];
|
24494
24532
|
const primaryKeys = [];
|
24495
24533
|
const foreignKeys = Object.values(table4[PgTable.Symbol.InlineForeignKeys]);
|
24496
24534
|
const uniqueConstraints = [];
|
24497
|
-
const name2 = table4[
|
24498
|
-
const schema4 = table4[
|
24535
|
+
const name2 = table4[Table2.Symbol.Name];
|
24536
|
+
const schema4 = table4[Table2.Symbol.Schema];
|
24499
24537
|
const extraConfigBuilder = table4[PgTable.Symbol.ExtraConfigBuilder];
|
24500
24538
|
if (extraConfigBuilder !== void 0) {
|
24501
|
-
const extraConfig = extraConfigBuilder(table4[
|
24539
|
+
const extraConfig = extraConfigBuilder(table4[Table2.Symbol.ExtraConfigColumns]);
|
24502
24540
|
for (const builder of Object.values(extraConfig)) {
|
24503
24541
|
if (is(builder, IndexBuilder)) {
|
24504
24542
|
indexes.push(builder.build(table4));
|
@@ -25568,8 +25606,8 @@ function sqliteTableBase(name2, columns, extraConfig, schema4, baseName = name2)
|
|
25568
25606
|
})
|
25569
25607
|
);
|
25570
25608
|
const table4 = Object.assign(rawTable, builtColumns);
|
25571
|
-
table4[
|
25572
|
-
table4[
|
25609
|
+
table4[Table2.Symbol.Columns] = builtColumns;
|
25610
|
+
table4[Table2.Symbol.ExtraConfigColumns] = builtColumns;
|
25573
25611
|
if (extraConfig) {
|
25574
25612
|
table4[SQLiteTable.Symbol.ExtraConfigBuilder] = extraConfig;
|
25575
25613
|
}
|
@@ -25582,7 +25620,7 @@ var init_table3 = __esm({
|
|
25582
25620
|
init_entity();
|
25583
25621
|
init_table();
|
25584
25622
|
InlineForeignKeys2 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
|
25585
|
-
SQLiteTable = class extends (_e2 =
|
25623
|
+
SQLiteTable = class extends (_e2 = Table2, _d3 = entityKind, _c5 = Table2.Symbol.Columns, _b113 = InlineForeignKeys2, _a160 = Table2.Symbol.ExtraConfigBuilder, _e2) {
|
25586
25624
|
constructor() {
|
25587
25625
|
super(...arguments);
|
25588
25626
|
/** @internal */
|
@@ -25595,7 +25633,7 @@ var init_table3 = __esm({
|
|
25595
25633
|
};
|
25596
25634
|
__publicField(SQLiteTable, _d3, "SQLiteTable");
|
25597
25635
|
/** @internal */
|
25598
|
-
__publicField(SQLiteTable, "Symbol", Object.assign({},
|
25636
|
+
__publicField(SQLiteTable, "Symbol", Object.assign({}, Table2.Symbol, {
|
25599
25637
|
InlineForeignKeys: InlineForeignKeys2
|
25600
25638
|
}));
|
25601
25639
|
sqliteTable = (name2, columns, extraConfig) => {
|
@@ -25776,7 +25814,7 @@ var init_common3 = __esm({
|
|
25776
25814
|
}
|
25777
25815
|
};
|
25778
25816
|
__publicField(SQLiteColumnBuilder, _a166, "SQLiteColumnBuilder");
|
25779
|
-
SQLiteColumn = class extends (_b115 =
|
25817
|
+
SQLiteColumn = class extends (_b115 = Column2, _a167 = entityKind, _b115) {
|
25780
25818
|
constructor(table4, config) {
|
25781
25819
|
if (!config.uniqueName) {
|
25782
25820
|
config.uniqueName = uniqueKeyName2(table4, [config.name]);
|
@@ -26277,7 +26315,7 @@ var init_insert2 = __esm({
|
|
26277
26315
|
}
|
26278
26316
|
const mappedValues = values.map((entry) => {
|
26279
26317
|
const result = {};
|
26280
|
-
const cols = this.table[
|
26318
|
+
const cols = this.table[Table2.Symbol.Columns];
|
26281
26319
|
for (const colKey of Object.keys(entry)) {
|
26282
26320
|
const colValue = entry[colKey];
|
26283
26321
|
result[colKey] = is(colValue, SQL) ? colValue : new Param(colValue, cols[colKey]);
|
@@ -26482,7 +26520,7 @@ var init_dialect2 = __esm({
|
|
26482
26520
|
return sql`${withSql}delete from ${table4}${whereSql}${returningSql}`;
|
26483
26521
|
}
|
26484
26522
|
buildUpdateSet(table4, set) {
|
26485
|
-
const tableColumns = table4[
|
26523
|
+
const tableColumns = table4[Table2.Symbol.Columns];
|
26486
26524
|
const columnNames = Object.keys(tableColumns).filter(
|
26487
26525
|
(colName) => set[colName] !== void 0 || tableColumns[colName]?.onUpdateFn !== void 0
|
26488
26526
|
);
|
@@ -26527,7 +26565,7 @@ var init_dialect2 = __esm({
|
|
26527
26565
|
chunk.push(
|
26528
26566
|
new SQL(
|
26529
26567
|
query.queryChunks.map((c) => {
|
26530
|
-
if (is(c,
|
26568
|
+
if (is(c, Column2)) {
|
26531
26569
|
return sql.identifier(c.name);
|
26532
26570
|
}
|
26533
26571
|
return c;
|
@@ -26540,8 +26578,8 @@ var init_dialect2 = __esm({
|
|
26540
26578
|
if (is(field, SQL.Aliased)) {
|
26541
26579
|
chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
|
26542
26580
|
}
|
26543
|
-
} else if (is(field,
|
26544
|
-
const tableName = field.table[
|
26581
|
+
} else if (is(field, Column2)) {
|
26582
|
+
const tableName = field.table[Table2.Symbol.Name];
|
26545
26583
|
const columnName = field.name;
|
26546
26584
|
if (isSingleTable) {
|
26547
26585
|
chunk.push(sql.identifier(columnName));
|
@@ -26573,8 +26611,8 @@ var init_dialect2 = __esm({
|
|
26573
26611
|
}) {
|
26574
26612
|
const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
|
26575
26613
|
for (const f of fieldsList) {
|
26576
|
-
if (is(f.field,
|
26577
|
-
({ alias }) => alias === (table22[
|
26614
|
+
if (is(f.field, Column2) && 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(
|
26615
|
+
({ alias }) => alias === (table22[Table2.Symbol.IsAlias] ? getTableName(table22) : table22[Table2.Symbol.BaseName])
|
26578
26616
|
))(f.field.table)) {
|
26579
26617
|
const tableName = getTableName(f.field.table);
|
26580
26618
|
throw new Error(
|
@@ -26587,8 +26625,8 @@ var init_dialect2 = __esm({
|
|
26587
26625
|
const distinctSql = distinct ? sql` distinct` : void 0;
|
26588
26626
|
const selection = this.buildSelection(fieldsList, { isSingleTable });
|
26589
26627
|
const tableSql = (() => {
|
26590
|
-
if (is(table4,
|
26591
|
-
return sql`${sql.identifier(table4[
|
26628
|
+
if (is(table4, Table2) && table4[Table2.Symbol.OriginalName] !== table4[Table2.Symbol.Name]) {
|
26629
|
+
return sql`${sql.identifier(table4[Table2.Symbol.OriginalName])} ${sql.identifier(table4[Table2.Symbol.Name])}`;
|
26592
26630
|
}
|
26593
26631
|
return table4;
|
26594
26632
|
})();
|
@@ -26694,7 +26732,7 @@ var init_dialect2 = __esm({
|
|
26694
26732
|
}
|
26695
26733
|
buildInsertQuery({ table: table4, values, onConflict, returning, withList }) {
|
26696
26734
|
const valuesSqlList = [];
|
26697
|
-
const columns = table4[
|
26735
|
+
const columns = table4[Table2.Symbol.Columns];
|
26698
26736
|
const colEntries = Object.entries(columns).filter(
|
26699
26737
|
([_2, col]) => !col.shouldDisableInsert()
|
26700
26738
|
);
|
@@ -26815,7 +26853,7 @@ var init_dialect2 = __esm({
|
|
26815
26853
|
selection.push({
|
26816
26854
|
dbKey: is(value, SQL.Aliased) ? value.fieldAlias : tableConfig.columns[tsKey].name,
|
26817
26855
|
tsKey,
|
26818
|
-
field: is(value,
|
26856
|
+
field: is(value, Column2) ? aliasedTableColumn(value, tableAlias) : value,
|
26819
26857
|
relationTableTsKey: void 0,
|
26820
26858
|
isJson: false,
|
26821
26859
|
selection: []
|
@@ -26826,7 +26864,7 @@ var init_dialect2 = __esm({
|
|
26826
26864
|
orderByOrig = [orderByOrig];
|
26827
26865
|
}
|
26828
26866
|
orderBy = orderByOrig.map((orderByValue) => {
|
26829
|
-
if (is(orderByValue,
|
26867
|
+
if (is(orderByValue, Column2)) {
|
26830
26868
|
return aliasedTableColumn(orderByValue, tableAlias);
|
26831
26869
|
}
|
26832
26870
|
return mapColumnsInSQLToAlias(orderByValue, tableAlias);
|
@@ -26926,7 +26964,7 @@ var init_dialect2 = __esm({
|
|
26926
26964
|
fields: {},
|
26927
26965
|
fieldsFlat: nestedSelection.map(({ field: field2 }) => ({
|
26928
26966
|
path: [],
|
26929
|
-
field: is(field2,
|
26967
|
+
field: is(field2, Column2) ? aliasedTableColumn(field2, tableAlias) : field2
|
26930
26968
|
})),
|
26931
26969
|
joins,
|
26932
26970
|
where,
|
@@ -26941,7 +26979,7 @@ var init_dialect2 = __esm({
|
|
26941
26979
|
fields: {},
|
26942
26980
|
fieldsFlat: selection.map(({ field }) => ({
|
26943
26981
|
path: [],
|
26944
|
-
field: is(field,
|
26982
|
+
field: is(field, Column2) ? aliasedTableColumn(field, tableAlias) : field
|
26945
26983
|
})),
|
26946
26984
|
joins,
|
26947
26985
|
where,
|
@@ -27358,7 +27396,7 @@ var init_select3 = __esm({
|
|
27358
27396
|
};
|
27359
27397
|
}
|
27360
27398
|
if (typeof tableName === "string" && !is(table4, SQL)) {
|
27361
|
-
const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View) ? table4[ViewBaseConfig].selectedFields : table4[
|
27399
|
+
const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View) ? table4[ViewBaseConfig].selectedFields : table4[Table2.Symbol.Columns];
|
27362
27400
|
this.config.fields[tableName] = selection;
|
27363
27401
|
}
|
27364
27402
|
}
|
@@ -28595,7 +28633,7 @@ function getTableConfig2(table4) {
|
|
28595
28633
|
const primaryKeys = [];
|
28596
28634
|
const uniqueConstraints = [];
|
28597
28635
|
const foreignKeys = Object.values(table4[SQLiteTable.Symbol.InlineForeignKeys]);
|
28598
|
-
const name2 = table4[
|
28636
|
+
const name2 = table4[Table2.Symbol.Name];
|
28599
28637
|
const extraConfigBuilder = table4[SQLiteTable.Symbol.ExtraConfigBuilder];
|
28600
28638
|
if (extraConfigBuilder !== void 0) {
|
28601
28639
|
const extraConfig = extraConfigBuilder(table4[SQLiteTable.Symbol.Columns]);
|
@@ -29296,8 +29334,8 @@ function mysqlTableWithSchema(name2, columns, extraConfig, schema4, baseName = n
|
|
29296
29334
|
})
|
29297
29335
|
);
|
29298
29336
|
const table4 = Object.assign(rawTable, builtColumns);
|
29299
|
-
table4[
|
29300
|
-
table4[
|
29337
|
+
table4[Table2.Symbol.Columns] = builtColumns;
|
29338
|
+
table4[Table2.Symbol.ExtraConfigColumns] = builtColumns;
|
29301
29339
|
if (extraConfig) {
|
29302
29340
|
table4[MySqlTable.Symbol.ExtraConfigBuilder] = extraConfig;
|
29303
29341
|
}
|
@@ -29310,7 +29348,7 @@ var init_table4 = __esm({
|
|
29310
29348
|
init_entity();
|
29311
29349
|
init_table();
|
29312
29350
|
InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys");
|
29313
|
-
MySqlTable = class extends (_e3 =
|
29351
|
+
MySqlTable = class extends (_e3 = Table2, _d4 = entityKind, _c7 = Table2.Symbol.Columns, _b156 = InlineForeignKeys3, _a225 = Table2.Symbol.ExtraConfigBuilder, _e3) {
|
29314
29352
|
constructor() {
|
29315
29353
|
super(...arguments);
|
29316
29354
|
/** @internal */
|
@@ -29323,7 +29361,7 @@ var init_table4 = __esm({
|
|
29323
29361
|
};
|
29324
29362
|
__publicField(MySqlTable, _d4, "MySqlTable");
|
29325
29363
|
/** @internal */
|
29326
|
-
__publicField(MySqlTable, "Symbol", Object.assign({},
|
29364
|
+
__publicField(MySqlTable, "Symbol", Object.assign({}, Table2.Symbol, {
|
29327
29365
|
InlineForeignKeys: InlineForeignKeys3
|
29328
29366
|
}));
|
29329
29367
|
mysqlTable = (name2, columns, extraConfig) => {
|
@@ -29505,7 +29543,7 @@ var init_common4 = __esm({
|
|
29505
29543
|
}
|
29506
29544
|
};
|
29507
29545
|
__publicField(MySqlColumnBuilder, _a231, "MySqlColumnBuilder");
|
29508
|
-
MySqlColumn = class extends (_b158 =
|
29546
|
+
MySqlColumn = class extends (_b158 = Column2, _a232 = entityKind, _b158) {
|
29509
29547
|
constructor(table4, config) {
|
29510
29548
|
if (!config.uniqueName) {
|
29511
29549
|
config.uniqueName = uniqueKeyName3(table4, [config.name]);
|
@@ -30652,7 +30690,7 @@ var init_insert3 = __esm({
|
|
30652
30690
|
}
|
30653
30691
|
const mappedValues = values.map((entry) => {
|
30654
30692
|
const result = {};
|
30655
|
-
const cols = this.table[
|
30693
|
+
const cols = this.table[Table2.Symbol.Columns];
|
30656
30694
|
for (const colKey of Object.keys(entry)) {
|
30657
30695
|
const colValue = entry[colKey];
|
30658
30696
|
result[colKey] = is(colValue, SQL) ? colValue : new Param(colValue, cols[colKey]);
|
@@ -30714,12 +30752,12 @@ var init_insert3 = __esm({
|
|
30714
30752
|
}
|
30715
30753
|
$returningId() {
|
30716
30754
|
const returning = [];
|
30717
|
-
for (const [key, value] of Object.entries(this.config.table[
|
30755
|
+
for (const [key, value] of Object.entries(this.config.table[Table2.Symbol.Columns])) {
|
30718
30756
|
if (value.primary) {
|
30719
30757
|
returning.push({ field: value, path: [key] });
|
30720
30758
|
}
|
30721
30759
|
}
|
30722
|
-
this.config.returning = orderSelectedFields(this.config.table[
|
30760
|
+
this.config.returning = orderSelectedFields(this.config.table[Table2.Symbol.Columns]);
|
30723
30761
|
return this;
|
30724
30762
|
}
|
30725
30763
|
/** @internal */
|
@@ -30838,7 +30876,7 @@ var init_dialect3 = __esm({
|
|
30838
30876
|
return sql`${withSql}delete from ${table4}${whereSql}${returningSql}`;
|
30839
30877
|
}
|
30840
30878
|
buildUpdateSet(table4, set) {
|
30841
|
-
const tableColumns = table4[
|
30879
|
+
const tableColumns = table4[Table2.Symbol.Columns];
|
30842
30880
|
const columnNames = Object.keys(tableColumns).filter(
|
30843
30881
|
(colName) => set[colName] !== void 0 || tableColumns[colName]?.onUpdateFn !== void 0
|
30844
30882
|
);
|
@@ -30896,7 +30934,7 @@ var init_dialect3 = __esm({
|
|
30896
30934
|
if (is(field, SQL.Aliased)) {
|
30897
30935
|
chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
|
30898
30936
|
}
|
30899
|
-
} else if (is(field,
|
30937
|
+
} else if (is(field, Column2)) {
|
30900
30938
|
if (isSingleTable) {
|
30901
30939
|
chunk.push(sql.identifier(field.name));
|
30902
30940
|
} else {
|
@@ -30928,8 +30966,8 @@ var init_dialect3 = __esm({
|
|
30928
30966
|
}) {
|
30929
30967
|
const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
|
30930
30968
|
for (const f of fieldsList) {
|
30931
|
-
if (is(f.field,
|
30932
|
-
({ alias }) => alias === (table22[
|
30969
|
+
if (is(f.field, Column2) && 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(
|
30970
|
+
({ alias }) => alias === (table22[Table2.Symbol.IsAlias] ? getTableName(table22) : table22[Table2.Symbol.BaseName])
|
30933
30971
|
))(f.field.table)) {
|
30934
30972
|
const tableName = getTableName(f.field.table);
|
30935
30973
|
throw new Error(
|
@@ -30942,8 +30980,8 @@ var init_dialect3 = __esm({
|
|
30942
30980
|
const distinctSql = distinct ? sql` distinct` : void 0;
|
30943
30981
|
const selection = this.buildSelection(fieldsList, { isSingleTable });
|
30944
30982
|
const tableSql = (() => {
|
30945
|
-
if (is(table4,
|
30946
|
-
return sql`${sql.identifier(table4[
|
30983
|
+
if (is(table4, Table2) && table4[Table2.Symbol.OriginalName] !== table4[Table2.Symbol.Name]) {
|
30984
|
+
return sql`${sql.identifier(table4[Table2.Symbol.OriginalName])} ${sql.identifier(table4[Table2.Symbol.Name])}`;
|
30947
30985
|
}
|
30948
30986
|
return table4;
|
30949
30987
|
})();
|
@@ -31056,7 +31094,7 @@ var init_dialect3 = __esm({
|
|
31056
31094
|
}
|
31057
31095
|
buildInsertQuery({ table: table4, values, ignore, onConflict }) {
|
31058
31096
|
const valuesSqlList = [];
|
31059
|
-
const columns = table4[
|
31097
|
+
const columns = table4[Table2.Symbol.Columns];
|
31060
31098
|
const colEntries = Object.entries(columns).filter(
|
31061
31099
|
([_2, col]) => !col.shouldDisableInsert()
|
31062
31100
|
);
|
@@ -31184,7 +31222,7 @@ var init_dialect3 = __esm({
|
|
31184
31222
|
selection.push({
|
31185
31223
|
dbKey: is(value, SQL.Aliased) ? value.fieldAlias : tableConfig.columns[tsKey].name,
|
31186
31224
|
tsKey,
|
31187
|
-
field: is(value,
|
31225
|
+
field: is(value, Column2) ? aliasedTableColumn(value, tableAlias) : value,
|
31188
31226
|
relationTableTsKey: void 0,
|
31189
31227
|
isJson: false,
|
31190
31228
|
selection: []
|
@@ -31195,7 +31233,7 @@ var init_dialect3 = __esm({
|
|
31195
31233
|
orderByOrig = [orderByOrig];
|
31196
31234
|
}
|
31197
31235
|
orderBy = orderByOrig.map((orderByValue) => {
|
31198
|
-
if (is(orderByValue,
|
31236
|
+
if (is(orderByValue, Column2)) {
|
31199
31237
|
return aliasedTableColumn(orderByValue, tableAlias);
|
31200
31238
|
}
|
31201
31239
|
return mapColumnsInSQLToAlias(orderByValue, tableAlias);
|
@@ -31303,7 +31341,7 @@ var init_dialect3 = __esm({
|
|
31303
31341
|
fields: {},
|
31304
31342
|
fieldsFlat: nestedSelection.map(({ field: field2 }) => ({
|
31305
31343
|
path: [],
|
31306
|
-
field: is(field2,
|
31344
|
+
field: is(field2, Column2) ? aliasedTableColumn(field2, tableAlias) : field2
|
31307
31345
|
})),
|
31308
31346
|
joins,
|
31309
31347
|
where,
|
@@ -31318,7 +31356,7 @@ var init_dialect3 = __esm({
|
|
31318
31356
|
fields: {},
|
31319
31357
|
fieldsFlat: selection.map(({ field }) => ({
|
31320
31358
|
path: [],
|
31321
|
-
field: is(field,
|
31359
|
+
field: is(field, Column2) ? aliasedTableColumn(field, tableAlias) : field
|
31322
31360
|
})),
|
31323
31361
|
joins,
|
31324
31362
|
where,
|
@@ -31408,7 +31446,7 @@ var init_dialect3 = __esm({
|
|
31408
31446
|
selection.push({
|
31409
31447
|
dbKey: is(value, SQL.Aliased) ? value.fieldAlias : tableConfig.columns[tsKey].name,
|
31410
31448
|
tsKey,
|
31411
|
-
field: is(value,
|
31449
|
+
field: is(value, Column2) ? aliasedTableColumn(value, tableAlias) : value,
|
31412
31450
|
relationTableTsKey: void 0,
|
31413
31451
|
isJson: false,
|
31414
31452
|
selection: []
|
@@ -31419,7 +31457,7 @@ var init_dialect3 = __esm({
|
|
31419
31457
|
orderByOrig = [orderByOrig];
|
31420
31458
|
}
|
31421
31459
|
orderBy = orderByOrig.map((orderByValue) => {
|
31422
|
-
if (is(orderByValue,
|
31460
|
+
if (is(orderByValue, Column2)) {
|
31423
31461
|
return aliasedTableColumn(orderByValue, tableAlias);
|
31424
31462
|
}
|
31425
31463
|
return mapColumnsInSQLToAlias(orderByValue, tableAlias);
|
@@ -31526,7 +31564,7 @@ var init_dialect3 = __esm({
|
|
31526
31564
|
fields: {},
|
31527
31565
|
fieldsFlat: nestedSelection.map(({ field: field2 }) => ({
|
31528
31566
|
path: [],
|
31529
|
-
field: is(field2,
|
31567
|
+
field: is(field2, Column2) ? aliasedTableColumn(field2, tableAlias) : field2
|
31530
31568
|
})),
|
31531
31569
|
where,
|
31532
31570
|
limit,
|
@@ -31540,7 +31578,7 @@ var init_dialect3 = __esm({
|
|
31540
31578
|
fields: {},
|
31541
31579
|
fieldsFlat: selection.map(({ field }) => ({
|
31542
31580
|
path: [],
|
31543
|
-
field: is(field,
|
31581
|
+
field: is(field, Column2) ? aliasedTableColumn(field, tableAlias) : field
|
31544
31582
|
})),
|
31545
31583
|
where,
|
31546
31584
|
limit,
|
@@ -31978,7 +32016,7 @@ var init_select4 = __esm({
|
|
31978
32016
|
};
|
31979
32017
|
}
|
31980
32018
|
if (typeof tableName === "string" && !is(table4, SQL)) {
|
31981
|
-
const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View) ? table4[ViewBaseConfig].selectedFields : table4[
|
32019
|
+
const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View) ? table4[ViewBaseConfig].selectedFields : table4[Table2.Symbol.Columns];
|
31982
32020
|
this.config.fields[tableName] = selection;
|
31983
32021
|
}
|
31984
32022
|
}
|
@@ -33050,7 +33088,7 @@ var init_view3 = __esm({
|
|
33050
33088
|
});
|
33051
33089
|
|
33052
33090
|
// ../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
|
33053
|
-
var _a316,
|
33091
|
+
var _a316, MySqlSchema5;
|
33054
33092
|
var init_schema2 = __esm({
|
33055
33093
|
"../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"() {
|
33056
33094
|
"use strict";
|
@@ -33058,7 +33096,7 @@ var init_schema2 = __esm({
|
|
33058
33096
|
init_table4();
|
33059
33097
|
init_view3();
|
33060
33098
|
_a316 = entityKind;
|
33061
|
-
|
33099
|
+
MySqlSchema5 = class {
|
33062
33100
|
constructor(schemaName) {
|
33063
33101
|
__publicField(this, "table", (name2, columns, extraConfig) => {
|
33064
33102
|
return mysqlTableWithSchema(name2, columns, extraConfig, this.schemaName);
|
@@ -33069,7 +33107,7 @@ var init_schema2 = __esm({
|
|
33069
33107
|
this.schemaName = schemaName;
|
33070
33108
|
}
|
33071
33109
|
};
|
33072
|
-
__publicField(
|
33110
|
+
__publicField(MySqlSchema5, _a316, "MySqlSchema");
|
33073
33111
|
}
|
33074
33112
|
});
|
33075
33113
|
|
@@ -33149,9 +33187,9 @@ function getTableConfig3(table4) {
|
|
33149
33187
|
const primaryKeys = [];
|
33150
33188
|
const uniqueConstraints = [];
|
33151
33189
|
const foreignKeys = Object.values(table4[MySqlTable.Symbol.InlineForeignKeys]);
|
33152
|
-
const name2 = table4[
|
33153
|
-
const schema4 = table4[
|
33154
|
-
const baseName = table4[
|
33190
|
+
const name2 = table4[Table2.Symbol.Name];
|
33191
|
+
const schema4 = table4[Table2.Symbol.Schema];
|
33192
|
+
const baseName = table4[Table2.Symbol.BaseName];
|
33155
33193
|
const extraConfigBuilder = table4[MySqlTable.Symbol.ExtraConfigBuilder];
|
33156
33194
|
if (extraConfigBuilder !== void 0) {
|
33157
33195
|
const extraConfig = extraConfigBuilder(table4[MySqlTable.Symbol.Columns]);
|
@@ -33770,6 +33808,200 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
33770
33808
|
}
|
33771
33809
|
});
|
33772
33810
|
|
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
|
+
|
33773
34005
|
// src/cli/commands/_es5.ts
|
33774
34006
|
var es5_exports = {};
|
33775
34007
|
__export(es5_exports, {
|
@@ -33791,8 +34023,16 @@ var init_utils8 = __esm({
|
|
33791
34023
|
"use strict";
|
33792
34024
|
import_hanji7 = __toESM(require_hanji());
|
33793
34025
|
init_lib();
|
34026
|
+
init_global();
|
33794
34027
|
init_schemaValidator();
|
34028
|
+
init_serializer();
|
34029
|
+
init_cli();
|
33795
34030
|
init_common();
|
34031
|
+
init_mysql();
|
34032
|
+
init_outputs();
|
34033
|
+
init_postgres();
|
34034
|
+
init_sqlite();
|
34035
|
+
init_studio();
|
33796
34036
|
init_views();
|
33797
34037
|
assertES5 = async (unregister) => {
|
33798
34038
|
try {
|
@@ -33845,6 +34085,7 @@ var init_pgImports = __esm({
|
|
33845
34085
|
"use strict";
|
33846
34086
|
init_drizzle_orm();
|
33847
34087
|
init_pg_core();
|
34088
|
+
init_utils8();
|
33848
34089
|
prepareFromExports = (exports) => {
|
33849
34090
|
const tables = [];
|
33850
34091
|
const enums = [];
|
@@ -33859,7 +34100,7 @@ var init_pgImports = __esm({
|
|
33859
34100
|
if (is(t, PgTable)) {
|
33860
34101
|
tables.push(t);
|
33861
34102
|
}
|
33862
|
-
if (is(t,
|
34103
|
+
if (is(t, PgSchema5)) {
|
33863
34104
|
schemas.push(t);
|
33864
34105
|
}
|
33865
34106
|
if (isPgSequence(t)) {
|
@@ -34536,6 +34777,7 @@ var pgSuggestions = async (db, statements) => {
|
|
34536
34777
|
|
34537
34778
|
// src/cli/commands/pgUp.ts
|
34538
34779
|
init_pgSchema();
|
34780
|
+
init_utils();
|
34539
34781
|
var updateUpToV6 = (json) => {
|
34540
34782
|
const schema4 = pgSchemaV5.parse(json);
|
34541
34783
|
const tables = Object.fromEntries(
|
@@ -34571,6 +34813,114 @@ var updateUpToV6 = (json) => {
|
|
34571
34813
|
var import_hanji6 = __toESM(require_hanji());
|
34572
34814
|
init_mjs();
|
34573
34815
|
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
|
34574
34924
|
init_sqliteSerializer();
|
34575
34925
|
init_views();
|
34576
34926
|
var sqlitePushIntrospect = async (db, filters) => {
|