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.js
CHANGED
@@ -3592,7 +3592,7 @@ function createZodEnum(values, params) {
|
|
3592
3592
|
...processCreateParams(params)
|
3593
3593
|
});
|
3594
3594
|
}
|
3595
|
-
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
|
3595
|
+
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;
|
3596
3596
|
var init_lib = __esm({
|
3597
3597
|
"../node_modules/.pnpm/zod@3.23.7/node_modules/zod/lib/index.mjs"() {
|
3598
3598
|
"use strict";
|
@@ -7184,16 +7184,6 @@ var init_lib = __esm({
|
|
7184
7184
|
nullableType = ZodNullable.create;
|
7185
7185
|
preprocessType = ZodEffects.createWithPreprocess;
|
7186
7186
|
pipelineType = ZodPipeline.create;
|
7187
|
-
coerce = {
|
7188
|
-
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
7189
|
-
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
7190
|
-
boolean: (arg) => ZodBoolean.create({
|
7191
|
-
...arg,
|
7192
|
-
coerce: true
|
7193
|
-
}),
|
7194
|
-
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
7195
|
-
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
7196
|
-
};
|
7197
7187
|
}
|
7198
7188
|
});
|
7199
7189
|
|
@@ -8342,11 +8332,6 @@ var copy, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey
|
|
8342
8332
|
var init_utils = __esm({
|
8343
8333
|
"src/utils.ts"() {
|
8344
8334
|
"use strict";
|
8345
|
-
init_views();
|
8346
|
-
init_global();
|
8347
|
-
init_mysqlSchema();
|
8348
|
-
init_pgSchema();
|
8349
|
-
init_sqliteSchema();
|
8350
8335
|
copy = (it) => {
|
8351
8336
|
return JSON.parse(JSON.stringify(it));
|
8352
8337
|
};
|
@@ -8394,7 +8379,6 @@ var init_views = __esm({
|
|
8394
8379
|
"use strict";
|
8395
8380
|
init_source();
|
8396
8381
|
import_hanji = __toESM(require_hanji());
|
8397
|
-
init_utils();
|
8398
8382
|
warning = (msg) => {
|
8399
8383
|
(0, import_hanji.render)(`[${source_default.yellow("Warning")}] ${msg}`);
|
8400
8384
|
};
|
@@ -8591,7 +8575,6 @@ var init_serializer = __esm({
|
|
8591
8575
|
"src/serializer/index.ts"() {
|
8592
8576
|
"use strict";
|
8593
8577
|
glob = __toESM(require_glob());
|
8594
|
-
init_views();
|
8595
8578
|
sqlToStr = (sql2) => {
|
8596
8579
|
return sql2.toQuery({
|
8597
8580
|
escapeName: () => {
|
@@ -8613,10 +8596,6 @@ var fillPgSnapshot;
|
|
8613
8596
|
var init_migrationPreparator = __esm({
|
8614
8597
|
"src/migrationPreparator.ts"() {
|
8615
8598
|
"use strict";
|
8616
|
-
init_serializer();
|
8617
|
-
init_mysqlSchema();
|
8618
|
-
init_pgSchema();
|
8619
|
-
init_sqliteSchema();
|
8620
8599
|
fillPgSnapshot = ({
|
8621
8600
|
serialized,
|
8622
8601
|
id,
|
@@ -15814,13 +15793,6 @@ var init_snapshotsDiffer = __esm({
|
|
15814
15793
|
}
|
15815
15794
|
});
|
15816
15795
|
|
15817
|
-
// src/utils/words.ts
|
15818
|
-
var init_words = __esm({
|
15819
|
-
"src/utils/words.ts"() {
|
15820
|
-
"use strict";
|
15821
|
-
}
|
15822
|
-
});
|
15823
|
-
|
15824
15796
|
// src/schemaValidator.ts
|
15825
15797
|
var dialects, dialect3, commonSquashedSchema, commonSchema;
|
15826
15798
|
var init_schemaValidator = __esm({
|
@@ -15848,7 +15820,6 @@ var init_common = __esm({
|
|
15848
15820
|
"use strict";
|
15849
15821
|
init_lib();
|
15850
15822
|
init_schemaValidator();
|
15851
|
-
init_outputs();
|
15852
15823
|
sqliteDriversLiterals = [
|
15853
15824
|
literalType("turso"),
|
15854
15825
|
literalType("d1-http"),
|
@@ -15931,7 +15902,6 @@ var init_outputs = __esm({
|
|
15931
15902
|
"src/cli/validations/outputs.ts"() {
|
15932
15903
|
"use strict";
|
15933
15904
|
init_source();
|
15934
|
-
init_common();
|
15935
15905
|
withStyle = {
|
15936
15906
|
error: (str) => `${source_default.red(`${source_default.white.bgRed(" Invalid input ")} ${str}`)}`,
|
15937
15907
|
warning: (str) => `${source_default.white.bgGray(" Warning ")} ${str}`,
|
@@ -15948,16 +15918,8 @@ var import_hanji2, schemasResolver, tablesResolver, sequencesResolver, enumsReso
|
|
15948
15918
|
var init_migrate = __esm({
|
15949
15919
|
"src/cli/commands/migrate.ts"() {
|
15950
15920
|
"use strict";
|
15951
|
-
init_migrationPreparator();
|
15952
15921
|
init_source();
|
15953
15922
|
import_hanji2 = __toESM(require_hanji());
|
15954
|
-
init_mysqlSchema();
|
15955
|
-
init_pgSchema();
|
15956
|
-
init_sqliteSchema();
|
15957
|
-
init_snapshotsDiffer();
|
15958
|
-
init_utils();
|
15959
|
-
init_words();
|
15960
|
-
init_outputs();
|
15961
15923
|
init_views();
|
15962
15924
|
schemasResolver = async (input) => {
|
15963
15925
|
try {
|
@@ -17306,13 +17268,13 @@ var init_entity = __esm({
|
|
17306
17268
|
});
|
17307
17269
|
|
17308
17270
|
// ../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
|
17309
|
-
var _a,
|
17271
|
+
var _a, Column;
|
17310
17272
|
var init_column = __esm({
|
17311
17273
|
"../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"() {
|
17312
17274
|
"use strict";
|
17313
17275
|
init_entity();
|
17314
17276
|
_a = entityKind;
|
17315
|
-
|
17277
|
+
Column = class {
|
17316
17278
|
constructor(table4, config) {
|
17317
17279
|
__publicField(this, "name");
|
17318
17280
|
__publicField(this, "primary");
|
@@ -17358,7 +17320,7 @@ var init_column = __esm({
|
|
17358
17320
|
return this.config.generated !== void 0 && this.config.generated.type !== "byDefault";
|
17359
17321
|
}
|
17360
17322
|
};
|
17361
|
-
__publicField(
|
17323
|
+
__publicField(Column, _a, "Column");
|
17362
17324
|
}
|
17363
17325
|
});
|
17364
17326
|
|
@@ -17477,7 +17439,7 @@ function getTableName(table4) {
|
|
17477
17439
|
function getTableUniqueName(table4) {
|
17478
17440
|
return `${table4[Schema] ?? "public"}.${table4[TableName]}`;
|
17479
17441
|
}
|
17480
|
-
var TableName, Schema, Columns, ExtraConfigColumns, OriginalName, BaseName, IsAlias, ExtraConfigBuilder, IsDrizzleTable, _a3, _b, _c, _d, _e, _f, _g, _h, _i,
|
17442
|
+
var TableName, Schema, Columns, ExtraConfigColumns, OriginalName, BaseName, IsAlias, ExtraConfigBuilder, IsDrizzleTable, _a3, _b, _c, _d, _e, _f, _g, _h, _i, Table;
|
17481
17443
|
var init_table = __esm({
|
17482
17444
|
"../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"() {
|
17483
17445
|
"use strict";
|
@@ -17492,7 +17454,7 @@ var init_table = __esm({
|
|
17492
17454
|
ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
|
17493
17455
|
IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
|
17494
17456
|
_i = entityKind, _h = TableName, _g = OriginalName, _f = Schema, _e = Columns, _d = ExtraConfigColumns, _c = BaseName, _b = IsAlias, _a3 = ExtraConfigBuilder;
|
17495
|
-
|
17457
|
+
Table = class {
|
17496
17458
|
constructor(name2, schema4, baseName) {
|
17497
17459
|
/**
|
17498
17460
|
* @internal
|
@@ -17524,9 +17486,9 @@ var init_table = __esm({
|
|
17524
17486
|
this[BaseName] = baseName;
|
17525
17487
|
}
|
17526
17488
|
};
|
17527
|
-
__publicField(
|
17489
|
+
__publicField(Table, _i, "Table");
|
17528
17490
|
/** @internal */
|
17529
|
-
__publicField(
|
17491
|
+
__publicField(Table, "Symbol", {
|
17530
17492
|
Name: TableName,
|
17531
17493
|
Schema,
|
17532
17494
|
OriginalName,
|
@@ -17558,8 +17520,8 @@ function pgTableWithSchema(name2, columns, extraConfig, schema4, baseName = name
|
|
17558
17520
|
})
|
17559
17521
|
);
|
17560
17522
|
const table4 = Object.assign(rawTable, builtColumns);
|
17561
|
-
table4[
|
17562
|
-
table4[
|
17523
|
+
table4[Table.Symbol.Columns] = builtColumns;
|
17524
|
+
table4[Table.Symbol.ExtraConfigColumns] = builtColumnsForExtraConfig;
|
17563
17525
|
if (extraConfig) {
|
17564
17526
|
table4[PgTable.Symbol.ExtraConfigBuilder] = extraConfig;
|
17565
17527
|
}
|
@@ -17572,7 +17534,7 @@ var init_table2 = __esm({
|
|
17572
17534
|
init_entity();
|
17573
17535
|
init_table();
|
17574
17536
|
InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
|
17575
|
-
PgTable = class extends (_d2 =
|
17537
|
+
PgTable = class extends (_d2 = Table, _c2 = entityKind, _b2 = InlineForeignKeys, _a4 = Table.Symbol.ExtraConfigBuilder, _d2) {
|
17576
17538
|
constructor() {
|
17577
17539
|
super(...arguments);
|
17578
17540
|
/**@internal */
|
@@ -17583,7 +17545,7 @@ var init_table2 = __esm({
|
|
17583
17545
|
};
|
17584
17546
|
__publicField(PgTable, _c2, "PgTable");
|
17585
17547
|
/** @internal */
|
17586
|
-
__publicField(PgTable, "Symbol", Object.assign({},
|
17548
|
+
__publicField(PgTable, "Symbol", Object.assign({}, Table.Symbol, {
|
17587
17549
|
InlineForeignKeys
|
17588
17550
|
}));
|
17589
17551
|
pgTable = (name2, columns, extraConfig) => {
|
@@ -17877,7 +17839,7 @@ var init_common2 = __esm({
|
|
17877
17839
|
}
|
17878
17840
|
};
|
17879
17841
|
__publicField(PgColumnBuilder, _a10, "PgColumnBuilder");
|
17880
|
-
PgColumn = class extends (_b4 =
|
17842
|
+
PgColumn = class extends (_b4 = Column, _a11 = entityKind, _b4) {
|
17881
17843
|
constructor(table4, config) {
|
17882
17844
|
if (!config.uniqueName) {
|
17883
17845
|
config.uniqueName = uniqueKeyName(table4, [config.name]);
|
@@ -18292,19 +18254,19 @@ var init_sql = __esm({
|
|
18292
18254
|
inlineParams: inlineParams || chunk.shouldInlineParams
|
18293
18255
|
});
|
18294
18256
|
}
|
18295
|
-
if (is(chunk,
|
18296
|
-
const schemaName = chunk[
|
18297
|
-
const tableName = chunk[
|
18257
|
+
if (is(chunk, Table)) {
|
18258
|
+
const schemaName = chunk[Table.Symbol.Schema];
|
18259
|
+
const tableName = chunk[Table.Symbol.Name];
|
18298
18260
|
return {
|
18299
18261
|
sql: schemaName === void 0 ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
|
18300
18262
|
params: []
|
18301
18263
|
};
|
18302
18264
|
}
|
18303
|
-
if (is(chunk,
|
18265
|
+
if (is(chunk, Column)) {
|
18304
18266
|
if (_config.invokeSource === "indexes") {
|
18305
18267
|
return { sql: escapeName(chunk.name), params: [] };
|
18306
18268
|
}
|
18307
|
-
return { sql: escapeName(chunk.table[
|
18269
|
+
return { sql: escapeName(chunk.table[Table.Symbol.Name]) + "." + escapeName(chunk.name), params: [] };
|
18308
18270
|
}
|
18309
18271
|
if (is(chunk, View)) {
|
18310
18272
|
const schemaName = chunk[ViewBaseConfig].schema;
|
@@ -18541,10 +18503,10 @@ var init_sql = __esm({
|
|
18541
18503
|
}
|
18542
18504
|
};
|
18543
18505
|
__publicField(View, _b11, "View");
|
18544
|
-
|
18506
|
+
Column.prototype.getSQL = function() {
|
18545
18507
|
return new SQL([this]);
|
18546
18508
|
};
|
18547
|
-
|
18509
|
+
Table.prototype.getSQL = function() {
|
18548
18510
|
return new SQL([this]);
|
18549
18511
|
};
|
18550
18512
|
Subquery.prototype.getSQL = function() {
|
@@ -18571,7 +18533,7 @@ function mapColumnsInAliasedSQLToAlias(query, alias) {
|
|
18571
18533
|
}
|
18572
18534
|
function mapColumnsInSQLToAlias(query, alias) {
|
18573
18535
|
return sql.join(query.queryChunks.map((c) => {
|
18574
|
-
if (is(c,
|
18536
|
+
if (is(c, Column)) {
|
18575
18537
|
return aliasedTableColumn(c, alias);
|
18576
18538
|
}
|
18577
18539
|
if (is(c, SQL)) {
|
@@ -18612,13 +18574,13 @@ var init_alias = __esm({
|
|
18612
18574
|
this.replaceOriginalName = replaceOriginalName;
|
18613
18575
|
}
|
18614
18576
|
get(target, prop) {
|
18615
|
-
if (prop ===
|
18577
|
+
if (prop === Table.Symbol.IsAlias) {
|
18616
18578
|
return true;
|
18617
18579
|
}
|
18618
|
-
if (prop ===
|
18580
|
+
if (prop === Table.Symbol.Name) {
|
18619
18581
|
return this.alias;
|
18620
18582
|
}
|
18621
|
-
if (this.replaceOriginalName && prop ===
|
18583
|
+
if (this.replaceOriginalName && prop === Table.Symbol.OriginalName) {
|
18622
18584
|
return this.alias;
|
18623
18585
|
}
|
18624
18586
|
if (prop === ViewBaseConfig) {
|
@@ -18628,8 +18590,8 @@ var init_alias = __esm({
|
|
18628
18590
|
isAlias: true
|
18629
18591
|
};
|
18630
18592
|
}
|
18631
|
-
if (prop ===
|
18632
|
-
const columns = target[
|
18593
|
+
if (prop === Table.Symbol.Columns) {
|
18594
|
+
const columns = target[Table.Symbol.Columns];
|
18633
18595
|
if (!columns) {
|
18634
18596
|
return columns;
|
18635
18597
|
}
|
@@ -18643,7 +18605,7 @@ var init_alias = __esm({
|
|
18643
18605
|
return proxiedColumns;
|
18644
18606
|
}
|
18645
18607
|
const value = target[prop];
|
18646
|
-
if (is(value,
|
18608
|
+
if (is(value, Column)) {
|
18647
18609
|
return new Proxy(value, new ColumnAliasProxyHandler(new Proxy(target, this)));
|
18648
18610
|
}
|
18649
18611
|
return value;
|
@@ -18691,7 +18653,7 @@ var init_errors = __esm({
|
|
18691
18653
|
|
18692
18654
|
// ../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
|
18693
18655
|
function bindIfParam(value, column4) {
|
18694
|
-
if (isDriverValueEncoder(column4) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value,
|
18656
|
+
if (isDriverValueEncoder(column4) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value, Column) && !is(value, Table) && !is(value, View)) {
|
18695
18657
|
return new Param(value, column4);
|
18696
18658
|
}
|
18697
18659
|
return value;
|
@@ -19032,33 +18994,33 @@ function getOrderByOperators() {
|
|
19032
18994
|
};
|
19033
18995
|
}
|
19034
18996
|
function extractTablesRelationalConfig(schema4, configHelpers) {
|
19035
|
-
if (Object.keys(schema4).length === 1 && "default" in schema4 && !is(schema4["default"],
|
18997
|
+
if (Object.keys(schema4).length === 1 && "default" in schema4 && !is(schema4["default"], Table)) {
|
19036
18998
|
schema4 = schema4["default"];
|
19037
18999
|
}
|
19038
19000
|
const tableNamesMap = {};
|
19039
19001
|
const relationsBuffer = {};
|
19040
19002
|
const tablesConfig = {};
|
19041
19003
|
for (const [key, value] of Object.entries(schema4)) {
|
19042
|
-
if (is(value,
|
19004
|
+
if (is(value, Table)) {
|
19043
19005
|
const dbName = getTableUniqueName(value);
|
19044
19006
|
const bufferedRelations = relationsBuffer[dbName];
|
19045
19007
|
tableNamesMap[dbName] = key;
|
19046
19008
|
tablesConfig[key] = {
|
19047
19009
|
tsName: key,
|
19048
|
-
dbName: value[
|
19049
|
-
schema: value[
|
19050
|
-
columns: value[
|
19010
|
+
dbName: value[Table.Symbol.Name],
|
19011
|
+
schema: value[Table.Symbol.Schema],
|
19012
|
+
columns: value[Table.Symbol.Columns],
|
19051
19013
|
relations: bufferedRelations?.relations ?? {},
|
19052
19014
|
primaryKey: bufferedRelations?.primaryKey ?? []
|
19053
19015
|
};
|
19054
19016
|
for (const column4 of Object.values(
|
19055
|
-
value[
|
19017
|
+
value[Table.Symbol.Columns]
|
19056
19018
|
)) {
|
19057
19019
|
if (column4.primary) {
|
19058
19020
|
tablesConfig[key].primaryKey.push(column4);
|
19059
19021
|
}
|
19060
19022
|
}
|
19061
|
-
const extraConfig = value[
|
19023
|
+
const extraConfig = value[Table.Symbol.ExtraConfigBuilder]?.(value[Table.Symbol.ExtraConfigColumns]);
|
19062
19024
|
if (extraConfig) {
|
19063
19025
|
for (const configEntry of Object.values(extraConfig)) {
|
19064
19026
|
if (is(configEntry, PrimaryKeyBuilder)) {
|
@@ -19130,7 +19092,7 @@ function normalizeRelation(schema4, tableNamesMap, relation) {
|
|
19130
19092
|
const referencedTableTsName = tableNamesMap[getTableUniqueName(relation.referencedTable)];
|
19131
19093
|
if (!referencedTableTsName) {
|
19132
19094
|
throw new Error(
|
19133
|
-
`Table "${relation.referencedTable[
|
19095
|
+
`Table "${relation.referencedTable[Table.Symbol.Name]}" not found in schema`
|
19134
19096
|
);
|
19135
19097
|
}
|
19136
19098
|
const referencedTableConfig = schema4[referencedTableTsName];
|
@@ -19141,7 +19103,7 @@ function normalizeRelation(schema4, tableNamesMap, relation) {
|
|
19141
19103
|
const sourceTableTsName = tableNamesMap[getTableUniqueName(sourceTable)];
|
19142
19104
|
if (!sourceTableTsName) {
|
19143
19105
|
throw new Error(
|
19144
|
-
`Table "${sourceTable[
|
19106
|
+
`Table "${sourceTable[Table.Symbol.Name]}" not found in schema`
|
19145
19107
|
);
|
19146
19108
|
}
|
19147
19109
|
const reverseRelations = [];
|
@@ -19156,7 +19118,7 @@ function normalizeRelation(schema4, tableNamesMap, relation) {
|
|
19156
19118
|
throw relation.relationName ? new Error(
|
19157
19119
|
`There are multiple relations with name "${relation.relationName}" in table "${referencedTableTsName}"`
|
19158
19120
|
) : new Error(
|
19159
|
-
`There are multiple relations between "${referencedTableTsName}" and "${relation.sourceTable[
|
19121
|
+
`There are multiple relations between "${referencedTableTsName}" and "${relation.sourceTable[Table.Symbol.Name]}". Please specify relation name`
|
19160
19122
|
);
|
19161
19123
|
}
|
19162
19124
|
if (reverseRelations[0] && is(reverseRelations[0], One) && reverseRelations[0].config) {
|
@@ -19204,7 +19166,7 @@ function mapRelationalRow(tablesConfig, tableConfig, row, buildQueryResultSelect
|
|
19204
19166
|
const value = mapColumnValue(row[selectionItemIndex]);
|
19205
19167
|
const field = selectionItem.field;
|
19206
19168
|
let decoder;
|
19207
|
-
if (is(field,
|
19169
|
+
if (is(field, Column)) {
|
19208
19170
|
decoder = field;
|
19209
19171
|
} else if (is(field, SQL)) {
|
19210
19172
|
decoder = field.decoder;
|
@@ -19234,7 +19196,7 @@ var init_relations = __esm({
|
|
19234
19196
|
this.sourceTable = sourceTable;
|
19235
19197
|
this.referencedTable = referencedTable;
|
19236
19198
|
this.relationName = relationName;
|
19237
|
-
this.referencedTableName = referencedTable[
|
19199
|
+
this.referencedTableName = referencedTable[Table.Symbol.Name];
|
19238
19200
|
}
|
19239
19201
|
};
|
19240
19202
|
__publicField(Relation, _a38, "Relation");
|
@@ -19305,10 +19267,10 @@ function sumDistinct(expression) {
|
|
19305
19267
|
return sql`sum(distinct ${expression})`.mapWith(String);
|
19306
19268
|
}
|
19307
19269
|
function max(expression) {
|
19308
|
-
return sql`max(${expression})`.mapWith(is(expression,
|
19270
|
+
return sql`max(${expression})`.mapWith(is(expression, Column) ? expression : String);
|
19309
19271
|
}
|
19310
19272
|
function min(expression) {
|
19311
|
-
return sql`min(${expression})`.mapWith(is(expression,
|
19273
|
+
return sql`min(${expression})`.mapWith(is(expression, Column) ? expression : String);
|
19312
19274
|
}
|
19313
19275
|
var init_aggregate = __esm({
|
19314
19276
|
"../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"() {
|
@@ -19391,7 +19353,7 @@ function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
19391
19353
|
const result = columns.reduce(
|
19392
19354
|
(result2, { path: path2, field }, columnIndex) => {
|
19393
19355
|
let decoder;
|
19394
|
-
if (is(field,
|
19356
|
+
if (is(field, Column)) {
|
19395
19357
|
decoder = field;
|
19396
19358
|
} else if (is(field, SQL)) {
|
19397
19359
|
decoder = field.decoder;
|
@@ -19408,7 +19370,7 @@ function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
19408
19370
|
} else {
|
19409
19371
|
const rawValue = row[columnIndex];
|
19410
19372
|
const value = node[pathChunk] = rawValue === null ? null : decoder.mapFromDriverValue(rawValue);
|
19411
|
-
if (joinsNotNullableMap && is(field,
|
19373
|
+
if (joinsNotNullableMap && is(field, Column) && path2.length === 2) {
|
19412
19374
|
const objectName = path2[0];
|
19413
19375
|
if (!(objectName in nullifyMap)) {
|
19414
19376
|
nullifyMap[objectName] = value === null ? getTableName(field.table) : false;
|
@@ -19437,10 +19399,10 @@ function orderSelectedFields(fields, pathPrefix) {
|
|
19437
19399
|
return result;
|
19438
19400
|
}
|
19439
19401
|
const newPath = pathPrefix ? [...pathPrefix, name2] : [name2];
|
19440
|
-
if (is(field,
|
19402
|
+
if (is(field, Column) || is(field, SQL) || is(field, SQL.Aliased)) {
|
19441
19403
|
result.push({ path: newPath, field });
|
19442
|
-
} else if (is(field,
|
19443
|
-
result.push(...orderSelectedFields(field[
|
19404
|
+
} else if (is(field, Table)) {
|
19405
|
+
result.push(...orderSelectedFields(field[Table.Symbol.Columns], newPath));
|
19444
19406
|
} else {
|
19445
19407
|
result.push(...orderSelectedFields(field, newPath));
|
19446
19408
|
}
|
@@ -19465,7 +19427,7 @@ function mapUpdateSet(table4, values) {
|
|
19465
19427
|
if (is(value, SQL)) {
|
19466
19428
|
return [key, value];
|
19467
19429
|
} else {
|
19468
|
-
return [key, new Param(value, table4[
|
19430
|
+
return [key, new Param(value, table4[Table.Symbol.Columns][key])];
|
19469
19431
|
}
|
19470
19432
|
});
|
19471
19433
|
if (entries.length === 0) {
|
@@ -19487,10 +19449,10 @@ function applyMixins(baseClass, extendedClasses) {
|
|
19487
19449
|
}
|
19488
19450
|
}
|
19489
19451
|
function getTableColumns(table4) {
|
19490
|
-
return table4[
|
19452
|
+
return table4[Table.Symbol.Columns];
|
19491
19453
|
}
|
19492
19454
|
function getTableLikeName(table4) {
|
19493
|
-
return is(table4, Subquery) ? table4._.alias : is(table4, View) ? table4[ViewBaseConfig].name : is(table4, SQL) ? void 0 : table4[
|
19455
|
+
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];
|
19494
19456
|
}
|
19495
19457
|
var init_utils2 = __esm({
|
19496
19458
|
"../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"() {
|
@@ -19508,7 +19470,7 @@ var init_utils2 = __esm({
|
|
19508
19470
|
var drizzle_orm_exports = {};
|
19509
19471
|
__export(drizzle_orm_exports, {
|
19510
19472
|
BaseName: () => BaseName,
|
19511
|
-
Column: () =>
|
19473
|
+
Column: () => Column,
|
19512
19474
|
ColumnAliasProxyHandler: () => ColumnAliasProxyHandler,
|
19513
19475
|
ColumnBuilder: () => ColumnBuilder,
|
19514
19476
|
Columns: () => Columns,
|
@@ -19534,7 +19496,7 @@ __export(drizzle_orm_exports, {
|
|
19534
19496
|
Schema: () => Schema,
|
19535
19497
|
StringChunk: () => StringChunk,
|
19536
19498
|
Subquery: () => Subquery,
|
19537
|
-
Table: () =>
|
19499
|
+
Table: () => Table,
|
19538
19500
|
TableAliasProxyHandler: () => TableAliasProxyHandler,
|
19539
19501
|
TableName: () => TableName,
|
19540
19502
|
TransactionRollbackError: () => TransactionRollbackError,
|
@@ -21167,7 +21129,7 @@ var init_delete = __esm({
|
|
21167
21129
|
this.config.where = where;
|
21168
21130
|
return this;
|
21169
21131
|
}
|
21170
|
-
returning(fields = this.config.table[
|
21132
|
+
returning(fields = this.config.table[Table.Symbol.Columns]) {
|
21171
21133
|
this.config.returning = orderSelectedFields(fields);
|
21172
21134
|
return this;
|
21173
21135
|
}
|
@@ -21222,7 +21184,7 @@ var init_insert = __esm({
|
|
21222
21184
|
}
|
21223
21185
|
const mappedValues = values.map((entry) => {
|
21224
21186
|
const result = {};
|
21225
|
-
const cols = this.table[
|
21187
|
+
const cols = this.table[Table.Symbol.Columns];
|
21226
21188
|
for (const colKey of Object.keys(entry)) {
|
21227
21189
|
const colValue = entry[colKey];
|
21228
21190
|
result[colKey] = is(colValue, SQL) ? colValue : new Param(colValue, cols[colKey]);
|
@@ -21246,7 +21208,7 @@ var init_insert = __esm({
|
|
21246
21208
|
this.dialect = dialect7;
|
21247
21209
|
this.config = { table: table4, values, withList };
|
21248
21210
|
}
|
21249
|
-
returning(fields = this.config.table[
|
21211
|
+
returning(fields = this.config.table[Table.Symbol.Columns]) {
|
21250
21212
|
this.config.returning = orderSelectedFields(fields);
|
21251
21213
|
return this;
|
21252
21214
|
}
|
@@ -21444,7 +21406,7 @@ var init_dialect = __esm({
|
|
21444
21406
|
return sql`${withSql}delete from ${table4}${whereSql}${returningSql}`;
|
21445
21407
|
}
|
21446
21408
|
buildUpdateSet(table4, set) {
|
21447
|
-
const tableColumns = table4[
|
21409
|
+
const tableColumns = table4[Table.Symbol.Columns];
|
21448
21410
|
const columnNames = Object.keys(tableColumns).filter(
|
21449
21411
|
(colName) => set[colName] !== void 0 || tableColumns[colName]?.onUpdateFn !== void 0
|
21450
21412
|
);
|
@@ -21502,7 +21464,7 @@ var init_dialect = __esm({
|
|
21502
21464
|
if (is(field, SQL.Aliased)) {
|
21503
21465
|
chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
|
21504
21466
|
}
|
21505
|
-
} else if (is(field,
|
21467
|
+
} else if (is(field, Column)) {
|
21506
21468
|
if (isSingleTable) {
|
21507
21469
|
chunk.push(sql.identifier(field.name));
|
21508
21470
|
} else {
|
@@ -21534,8 +21496,8 @@ var init_dialect = __esm({
|
|
21534
21496
|
}) {
|
21535
21497
|
const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
|
21536
21498
|
for (const f of fieldsList) {
|
21537
|
-
if (is(f.field,
|
21538
|
-
({ alias }) => alias === (table22[
|
21499
|
+
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(
|
21500
|
+
({ alias }) => alias === (table22[Table.Symbol.IsAlias] ? getTableName(table22) : table22[Table.Symbol.BaseName])
|
21539
21501
|
))(f.field.table)) {
|
21540
21502
|
const tableName = getTableName(f.field.table);
|
21541
21503
|
throw new Error(
|
@@ -21551,12 +21513,12 @@ var init_dialect = __esm({
|
|
21551
21513
|
}
|
21552
21514
|
const selection = this.buildSelection(fieldsList, { isSingleTable });
|
21553
21515
|
const tableSql = (() => {
|
21554
|
-
if (is(table4,
|
21555
|
-
let fullName = sql`${sql.identifier(table4[
|
21556
|
-
if (table4[
|
21557
|
-
fullName = sql`${sql.identifier(table4[
|
21516
|
+
if (is(table4, Table) && table4[Table.Symbol.OriginalName] !== table4[Table.Symbol.Name]) {
|
21517
|
+
let fullName = sql`${sql.identifier(table4[Table.Symbol.OriginalName])}`;
|
21518
|
+
if (table4[Table.Symbol.Schema]) {
|
21519
|
+
fullName = sql`${sql.identifier(table4[Table.Symbol.Schema])}.${fullName}`;
|
21558
21520
|
}
|
21559
|
-
return sql`${fullName} ${sql.identifier(table4[
|
21521
|
+
return sql`${fullName} ${sql.identifier(table4[Table.Symbol.Name])}`;
|
21560
21522
|
}
|
21561
21523
|
return table4;
|
21562
21524
|
})();
|
@@ -21677,7 +21639,7 @@ var init_dialect = __esm({
|
|
21677
21639
|
}
|
21678
21640
|
buildInsertQuery({ table: table4, values, onConflict, returning, withList }) {
|
21679
21641
|
const valuesSqlList = [];
|
21680
|
-
const columns = table4[
|
21642
|
+
const columns = table4[Table.Symbol.Columns];
|
21681
21643
|
const colEntries = Object.entries(columns).filter(([_2, col]) => !col.shouldDisableInsert());
|
21682
21644
|
const insertOrder = colEntries.map(([, column4]) => sql.identifier(column4.name));
|
21683
21645
|
for (const [valueIndex, value] of values.entries()) {
|
@@ -22298,7 +22260,7 @@ var init_dialect = __esm({
|
|
22298
22260
|
selection.push({
|
22299
22261
|
dbKey: is(value, SQL.Aliased) ? value.fieldAlias : tableConfig.columns[tsKey].name,
|
22300
22262
|
tsKey,
|
22301
|
-
field: is(value,
|
22263
|
+
field: is(value, Column) ? aliasedTableColumn(value, tableAlias) : value,
|
22302
22264
|
relationTableTsKey: void 0,
|
22303
22265
|
isJson: false,
|
22304
22266
|
selection: []
|
@@ -22309,7 +22271,7 @@ var init_dialect = __esm({
|
|
22309
22271
|
orderByOrig = [orderByOrig];
|
22310
22272
|
}
|
22311
22273
|
orderBy = orderByOrig.map((orderByValue) => {
|
22312
|
-
if (is(orderByValue,
|
22274
|
+
if (is(orderByValue, Column)) {
|
22313
22275
|
return aliasedTableColumn(orderByValue, tableAlias);
|
22314
22276
|
}
|
22315
22277
|
return mapColumnsInSQLToAlias(orderByValue, tableAlias);
|
@@ -22412,7 +22374,7 @@ var init_dialect = __esm({
|
|
22412
22374
|
fields: {},
|
22413
22375
|
fieldsFlat: nestedSelection.map(({ field: field2 }) => ({
|
22414
22376
|
path: [],
|
22415
|
-
field: is(field2,
|
22377
|
+
field: is(field2, Column) ? aliasedTableColumn(field2, tableAlias) : field2
|
22416
22378
|
})),
|
22417
22379
|
joins,
|
22418
22380
|
where,
|
@@ -22427,7 +22389,7 @@ var init_dialect = __esm({
|
|
22427
22389
|
fields: {},
|
22428
22390
|
fieldsFlat: selection.map(({ field }) => ({
|
22429
22391
|
path: [],
|
22430
|
-
field: is(field,
|
22392
|
+
field: is(field, Column) ? aliasedTableColumn(field, tableAlias) : field
|
22431
22393
|
})),
|
22432
22394
|
joins,
|
22433
22395
|
where,
|
@@ -22505,7 +22467,7 @@ var init_selection_proxy = __esm({
|
|
22505
22467
|
`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.`
|
22506
22468
|
);
|
22507
22469
|
}
|
22508
|
-
if (is(value,
|
22470
|
+
if (is(value, Column)) {
|
22509
22471
|
if (this.config.alias) {
|
22510
22472
|
return new Proxy(
|
22511
22473
|
value,
|
@@ -22969,7 +22931,7 @@ var init_select2 = __esm({
|
|
22969
22931
|
};
|
22970
22932
|
}
|
22971
22933
|
if (typeof tableName === "string" && !is(table4, SQL)) {
|
22972
|
-
const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View) ? table4[ViewBaseConfig].selectedFields : table4[
|
22934
|
+
const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View) ? table4[ViewBaseConfig].selectedFields : table4[Table.Symbol.Columns];
|
22973
22935
|
this.config.fields[tableName] = selection;
|
22974
22936
|
}
|
22975
22937
|
}
|
@@ -23516,7 +23478,7 @@ var init_update = __esm({
|
|
23516
23478
|
this.config.where = where;
|
23517
23479
|
return this;
|
23518
23480
|
}
|
23519
|
-
returning(fields = this.config.table[
|
23481
|
+
returning(fields = this.config.table[Table.Symbol.Columns]) {
|
23520
23482
|
this.config.returning = orderSelectedFields(fields);
|
23521
23483
|
return this;
|
23522
23484
|
}
|
@@ -24387,7 +24349,7 @@ var init_view = __esm({
|
|
24387
24349
|
});
|
24388
24350
|
|
24389
24351
|
// ../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
|
24390
|
-
var _a154,
|
24352
|
+
var _a154, PgSchema3;
|
24391
24353
|
var init_schema = __esm({
|
24392
24354
|
"../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"() {
|
24393
24355
|
"use strict";
|
@@ -24398,7 +24360,7 @@ var init_schema = __esm({
|
|
24398
24360
|
init_table2();
|
24399
24361
|
init_view();
|
24400
24362
|
_a154 = entityKind;
|
24401
|
-
|
24363
|
+
PgSchema3 = class {
|
24402
24364
|
constructor(schemaName) {
|
24403
24365
|
__publicField(this, "table", (name2, columns, extraConfig) => {
|
24404
24366
|
return pgTableWithSchema(name2, columns, extraConfig, this.schemaName);
|
@@ -24424,7 +24386,7 @@ var init_schema = __esm({
|
|
24424
24386
|
return true;
|
24425
24387
|
}
|
24426
24388
|
};
|
24427
|
-
__publicField(
|
24389
|
+
__publicField(PgSchema3, _a154, "PgSchema");
|
24428
24390
|
}
|
24429
24391
|
});
|
24430
24392
|
|
@@ -24521,17 +24483,17 @@ var init_subquery2 = __esm({
|
|
24521
24483
|
|
24522
24484
|
// ../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
|
24523
24485
|
function getTableConfig(table4) {
|
24524
|
-
const columns = Object.values(table4[
|
24486
|
+
const columns = Object.values(table4[Table.Symbol.Columns]);
|
24525
24487
|
const indexes = [];
|
24526
24488
|
const checks = [];
|
24527
24489
|
const primaryKeys = [];
|
24528
24490
|
const foreignKeys = Object.values(table4[PgTable.Symbol.InlineForeignKeys]);
|
24529
24491
|
const uniqueConstraints = [];
|
24530
|
-
const name2 = table4[
|
24531
|
-
const schema4 = table4[
|
24492
|
+
const name2 = table4[Table.Symbol.Name];
|
24493
|
+
const schema4 = table4[Table.Symbol.Schema];
|
24532
24494
|
const extraConfigBuilder = table4[PgTable.Symbol.ExtraConfigBuilder];
|
24533
24495
|
if (extraConfigBuilder !== void 0) {
|
24534
|
-
const extraConfig = extraConfigBuilder(table4[
|
24496
|
+
const extraConfig = extraConfigBuilder(table4[Table.Symbol.ExtraConfigColumns]);
|
24535
24497
|
for (const builder of Object.values(extraConfig)) {
|
24536
24498
|
if (is(builder, IndexBuilder)) {
|
24537
24499
|
indexes.push(builder.build(table4));
|
@@ -25601,8 +25563,8 @@ function sqliteTableBase(name2, columns, extraConfig, schema4, baseName = name2)
|
|
25601
25563
|
})
|
25602
25564
|
);
|
25603
25565
|
const table4 = Object.assign(rawTable, builtColumns);
|
25604
|
-
table4[
|
25605
|
-
table4[
|
25566
|
+
table4[Table.Symbol.Columns] = builtColumns;
|
25567
|
+
table4[Table.Symbol.ExtraConfigColumns] = builtColumns;
|
25606
25568
|
if (extraConfig) {
|
25607
25569
|
table4[SQLiteTable.Symbol.ExtraConfigBuilder] = extraConfig;
|
25608
25570
|
}
|
@@ -25615,7 +25577,7 @@ var init_table3 = __esm({
|
|
25615
25577
|
init_entity();
|
25616
25578
|
init_table();
|
25617
25579
|
InlineForeignKeys2 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
|
25618
|
-
SQLiteTable = class extends (_e2 =
|
25580
|
+
SQLiteTable = class extends (_e2 = Table, _d3 = entityKind, _c5 = Table.Symbol.Columns, _b113 = InlineForeignKeys2, _a160 = Table.Symbol.ExtraConfigBuilder, _e2) {
|
25619
25581
|
constructor() {
|
25620
25582
|
super(...arguments);
|
25621
25583
|
/** @internal */
|
@@ -25628,7 +25590,7 @@ var init_table3 = __esm({
|
|
25628
25590
|
};
|
25629
25591
|
__publicField(SQLiteTable, _d3, "SQLiteTable");
|
25630
25592
|
/** @internal */
|
25631
|
-
__publicField(SQLiteTable, "Symbol", Object.assign({},
|
25593
|
+
__publicField(SQLiteTable, "Symbol", Object.assign({}, Table.Symbol, {
|
25632
25594
|
InlineForeignKeys: InlineForeignKeys2
|
25633
25595
|
}));
|
25634
25596
|
sqliteTable = (name2, columns, extraConfig) => {
|
@@ -25809,7 +25771,7 @@ var init_common3 = __esm({
|
|
25809
25771
|
}
|
25810
25772
|
};
|
25811
25773
|
__publicField(SQLiteColumnBuilder, _a166, "SQLiteColumnBuilder");
|
25812
|
-
SQLiteColumn = class extends (_b115 =
|
25774
|
+
SQLiteColumn = class extends (_b115 = Column, _a167 = entityKind, _b115) {
|
25813
25775
|
constructor(table4, config) {
|
25814
25776
|
if (!config.uniqueName) {
|
25815
25777
|
config.uniqueName = uniqueKeyName2(table4, [config.name]);
|
@@ -26310,7 +26272,7 @@ var init_insert2 = __esm({
|
|
26310
26272
|
}
|
26311
26273
|
const mappedValues = values.map((entry) => {
|
26312
26274
|
const result = {};
|
26313
|
-
const cols = this.table[
|
26275
|
+
const cols = this.table[Table.Symbol.Columns];
|
26314
26276
|
for (const colKey of Object.keys(entry)) {
|
26315
26277
|
const colValue = entry[colKey];
|
26316
26278
|
result[colKey] = is(colValue, SQL) ? colValue : new Param(colValue, cols[colKey]);
|
@@ -26515,7 +26477,7 @@ var init_dialect2 = __esm({
|
|
26515
26477
|
return sql`${withSql}delete from ${table4}${whereSql}${returningSql}`;
|
26516
26478
|
}
|
26517
26479
|
buildUpdateSet(table4, set) {
|
26518
|
-
const tableColumns = table4[
|
26480
|
+
const tableColumns = table4[Table.Symbol.Columns];
|
26519
26481
|
const columnNames = Object.keys(tableColumns).filter(
|
26520
26482
|
(colName) => set[colName] !== void 0 || tableColumns[colName]?.onUpdateFn !== void 0
|
26521
26483
|
);
|
@@ -26560,7 +26522,7 @@ var init_dialect2 = __esm({
|
|
26560
26522
|
chunk.push(
|
26561
26523
|
new SQL(
|
26562
26524
|
query.queryChunks.map((c) => {
|
26563
|
-
if (is(c,
|
26525
|
+
if (is(c, Column)) {
|
26564
26526
|
return sql.identifier(c.name);
|
26565
26527
|
}
|
26566
26528
|
return c;
|
@@ -26573,8 +26535,8 @@ var init_dialect2 = __esm({
|
|
26573
26535
|
if (is(field, SQL.Aliased)) {
|
26574
26536
|
chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
|
26575
26537
|
}
|
26576
|
-
} else if (is(field,
|
26577
|
-
const tableName = field.table[
|
26538
|
+
} else if (is(field, Column)) {
|
26539
|
+
const tableName = field.table[Table.Symbol.Name];
|
26578
26540
|
const columnName = field.name;
|
26579
26541
|
if (isSingleTable) {
|
26580
26542
|
chunk.push(sql.identifier(columnName));
|
@@ -26606,8 +26568,8 @@ var init_dialect2 = __esm({
|
|
26606
26568
|
}) {
|
26607
26569
|
const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
|
26608
26570
|
for (const f of fieldsList) {
|
26609
|
-
if (is(f.field,
|
26610
|
-
({ alias }) => alias === (table22[
|
26571
|
+
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(
|
26572
|
+
({ alias }) => alias === (table22[Table.Symbol.IsAlias] ? getTableName(table22) : table22[Table.Symbol.BaseName])
|
26611
26573
|
))(f.field.table)) {
|
26612
26574
|
const tableName = getTableName(f.field.table);
|
26613
26575
|
throw new Error(
|
@@ -26620,8 +26582,8 @@ var init_dialect2 = __esm({
|
|
26620
26582
|
const distinctSql = distinct ? sql` distinct` : void 0;
|
26621
26583
|
const selection = this.buildSelection(fieldsList, { isSingleTable });
|
26622
26584
|
const tableSql = (() => {
|
26623
|
-
if (is(table4,
|
26624
|
-
return sql`${sql.identifier(table4[
|
26585
|
+
if (is(table4, Table) && table4[Table.Symbol.OriginalName] !== table4[Table.Symbol.Name]) {
|
26586
|
+
return sql`${sql.identifier(table4[Table.Symbol.OriginalName])} ${sql.identifier(table4[Table.Symbol.Name])}`;
|
26625
26587
|
}
|
26626
26588
|
return table4;
|
26627
26589
|
})();
|
@@ -26727,7 +26689,7 @@ var init_dialect2 = __esm({
|
|
26727
26689
|
}
|
26728
26690
|
buildInsertQuery({ table: table4, values, onConflict, returning, withList }) {
|
26729
26691
|
const valuesSqlList = [];
|
26730
|
-
const columns = table4[
|
26692
|
+
const columns = table4[Table.Symbol.Columns];
|
26731
26693
|
const colEntries = Object.entries(columns).filter(
|
26732
26694
|
([_2, col]) => !col.shouldDisableInsert()
|
26733
26695
|
);
|
@@ -26848,7 +26810,7 @@ var init_dialect2 = __esm({
|
|
26848
26810
|
selection.push({
|
26849
26811
|
dbKey: is(value, SQL.Aliased) ? value.fieldAlias : tableConfig.columns[tsKey].name,
|
26850
26812
|
tsKey,
|
26851
|
-
field: is(value,
|
26813
|
+
field: is(value, Column) ? aliasedTableColumn(value, tableAlias) : value,
|
26852
26814
|
relationTableTsKey: void 0,
|
26853
26815
|
isJson: false,
|
26854
26816
|
selection: []
|
@@ -26859,7 +26821,7 @@ var init_dialect2 = __esm({
|
|
26859
26821
|
orderByOrig = [orderByOrig];
|
26860
26822
|
}
|
26861
26823
|
orderBy = orderByOrig.map((orderByValue) => {
|
26862
|
-
if (is(orderByValue,
|
26824
|
+
if (is(orderByValue, Column)) {
|
26863
26825
|
return aliasedTableColumn(orderByValue, tableAlias);
|
26864
26826
|
}
|
26865
26827
|
return mapColumnsInSQLToAlias(orderByValue, tableAlias);
|
@@ -26959,7 +26921,7 @@ var init_dialect2 = __esm({
|
|
26959
26921
|
fields: {},
|
26960
26922
|
fieldsFlat: nestedSelection.map(({ field: field2 }) => ({
|
26961
26923
|
path: [],
|
26962
|
-
field: is(field2,
|
26924
|
+
field: is(field2, Column) ? aliasedTableColumn(field2, tableAlias) : field2
|
26963
26925
|
})),
|
26964
26926
|
joins,
|
26965
26927
|
where,
|
@@ -26974,7 +26936,7 @@ var init_dialect2 = __esm({
|
|
26974
26936
|
fields: {},
|
26975
26937
|
fieldsFlat: selection.map(({ field }) => ({
|
26976
26938
|
path: [],
|
26977
|
-
field: is(field,
|
26939
|
+
field: is(field, Column) ? aliasedTableColumn(field, tableAlias) : field
|
26978
26940
|
})),
|
26979
26941
|
joins,
|
26980
26942
|
where,
|
@@ -27391,7 +27353,7 @@ var init_select3 = __esm({
|
|
27391
27353
|
};
|
27392
27354
|
}
|
27393
27355
|
if (typeof tableName === "string" && !is(table4, SQL)) {
|
27394
|
-
const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View) ? table4[ViewBaseConfig].selectedFields : table4[
|
27356
|
+
const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View) ? table4[ViewBaseConfig].selectedFields : table4[Table.Symbol.Columns];
|
27395
27357
|
this.config.fields[tableName] = selection;
|
27396
27358
|
}
|
27397
27359
|
}
|
@@ -28628,7 +28590,7 @@ function getTableConfig2(table4) {
|
|
28628
28590
|
const primaryKeys = [];
|
28629
28591
|
const uniqueConstraints = [];
|
28630
28592
|
const foreignKeys = Object.values(table4[SQLiteTable.Symbol.InlineForeignKeys]);
|
28631
|
-
const name2 = table4[
|
28593
|
+
const name2 = table4[Table.Symbol.Name];
|
28632
28594
|
const extraConfigBuilder = table4[SQLiteTable.Symbol.ExtraConfigBuilder];
|
28633
28595
|
if (extraConfigBuilder !== void 0) {
|
28634
28596
|
const extraConfig = extraConfigBuilder(table4[SQLiteTable.Symbol.Columns]);
|
@@ -29329,8 +29291,8 @@ function mysqlTableWithSchema(name2, columns, extraConfig, schema4, baseName = n
|
|
29329
29291
|
})
|
29330
29292
|
);
|
29331
29293
|
const table4 = Object.assign(rawTable, builtColumns);
|
29332
|
-
table4[
|
29333
|
-
table4[
|
29294
|
+
table4[Table.Symbol.Columns] = builtColumns;
|
29295
|
+
table4[Table.Symbol.ExtraConfigColumns] = builtColumns;
|
29334
29296
|
if (extraConfig) {
|
29335
29297
|
table4[MySqlTable.Symbol.ExtraConfigBuilder] = extraConfig;
|
29336
29298
|
}
|
@@ -29343,7 +29305,7 @@ var init_table4 = __esm({
|
|
29343
29305
|
init_entity();
|
29344
29306
|
init_table();
|
29345
29307
|
InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys");
|
29346
|
-
MySqlTable = class extends (_e3 =
|
29308
|
+
MySqlTable = class extends (_e3 = Table, _d4 = entityKind, _c7 = Table.Symbol.Columns, _b156 = InlineForeignKeys3, _a225 = Table.Symbol.ExtraConfigBuilder, _e3) {
|
29347
29309
|
constructor() {
|
29348
29310
|
super(...arguments);
|
29349
29311
|
/** @internal */
|
@@ -29356,7 +29318,7 @@ var init_table4 = __esm({
|
|
29356
29318
|
};
|
29357
29319
|
__publicField(MySqlTable, _d4, "MySqlTable");
|
29358
29320
|
/** @internal */
|
29359
|
-
__publicField(MySqlTable, "Symbol", Object.assign({},
|
29321
|
+
__publicField(MySqlTable, "Symbol", Object.assign({}, Table.Symbol, {
|
29360
29322
|
InlineForeignKeys: InlineForeignKeys3
|
29361
29323
|
}));
|
29362
29324
|
mysqlTable = (name2, columns, extraConfig) => {
|
@@ -29538,7 +29500,7 @@ var init_common4 = __esm({
|
|
29538
29500
|
}
|
29539
29501
|
};
|
29540
29502
|
__publicField(MySqlColumnBuilder, _a231, "MySqlColumnBuilder");
|
29541
|
-
MySqlColumn = class extends (_b158 =
|
29503
|
+
MySqlColumn = class extends (_b158 = Column, _a232 = entityKind, _b158) {
|
29542
29504
|
constructor(table4, config) {
|
29543
29505
|
if (!config.uniqueName) {
|
29544
29506
|
config.uniqueName = uniqueKeyName3(table4, [config.name]);
|
@@ -30685,7 +30647,7 @@ var init_insert3 = __esm({
|
|
30685
30647
|
}
|
30686
30648
|
const mappedValues = values.map((entry) => {
|
30687
30649
|
const result = {};
|
30688
|
-
const cols = this.table[
|
30650
|
+
const cols = this.table[Table.Symbol.Columns];
|
30689
30651
|
for (const colKey of Object.keys(entry)) {
|
30690
30652
|
const colValue = entry[colKey];
|
30691
30653
|
result[colKey] = is(colValue, SQL) ? colValue : new Param(colValue, cols[colKey]);
|
@@ -30747,12 +30709,12 @@ var init_insert3 = __esm({
|
|
30747
30709
|
}
|
30748
30710
|
$returningId() {
|
30749
30711
|
const returning = [];
|
30750
|
-
for (const [key, value] of Object.entries(this.config.table[
|
30712
|
+
for (const [key, value] of Object.entries(this.config.table[Table.Symbol.Columns])) {
|
30751
30713
|
if (value.primary) {
|
30752
30714
|
returning.push({ field: value, path: [key] });
|
30753
30715
|
}
|
30754
30716
|
}
|
30755
|
-
this.config.returning = orderSelectedFields(this.config.table[
|
30717
|
+
this.config.returning = orderSelectedFields(this.config.table[Table.Symbol.Columns]);
|
30756
30718
|
return this;
|
30757
30719
|
}
|
30758
30720
|
/** @internal */
|
@@ -30871,7 +30833,7 @@ var init_dialect3 = __esm({
|
|
30871
30833
|
return sql`${withSql}delete from ${table4}${whereSql}${returningSql}`;
|
30872
30834
|
}
|
30873
30835
|
buildUpdateSet(table4, set) {
|
30874
|
-
const tableColumns = table4[
|
30836
|
+
const tableColumns = table4[Table.Symbol.Columns];
|
30875
30837
|
const columnNames = Object.keys(tableColumns).filter(
|
30876
30838
|
(colName) => set[colName] !== void 0 || tableColumns[colName]?.onUpdateFn !== void 0
|
30877
30839
|
);
|
@@ -30929,7 +30891,7 @@ var init_dialect3 = __esm({
|
|
30929
30891
|
if (is(field, SQL.Aliased)) {
|
30930
30892
|
chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
|
30931
30893
|
}
|
30932
|
-
} else if (is(field,
|
30894
|
+
} else if (is(field, Column)) {
|
30933
30895
|
if (isSingleTable) {
|
30934
30896
|
chunk.push(sql.identifier(field.name));
|
30935
30897
|
} else {
|
@@ -30961,8 +30923,8 @@ var init_dialect3 = __esm({
|
|
30961
30923
|
}) {
|
30962
30924
|
const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
|
30963
30925
|
for (const f of fieldsList) {
|
30964
|
-
if (is(f.field,
|
30965
|
-
({ alias }) => alias === (table22[
|
30926
|
+
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(
|
30927
|
+
({ alias }) => alias === (table22[Table.Symbol.IsAlias] ? getTableName(table22) : table22[Table.Symbol.BaseName])
|
30966
30928
|
))(f.field.table)) {
|
30967
30929
|
const tableName = getTableName(f.field.table);
|
30968
30930
|
throw new Error(
|
@@ -30975,8 +30937,8 @@ var init_dialect3 = __esm({
|
|
30975
30937
|
const distinctSql = distinct ? sql` distinct` : void 0;
|
30976
30938
|
const selection = this.buildSelection(fieldsList, { isSingleTable });
|
30977
30939
|
const tableSql = (() => {
|
30978
|
-
if (is(table4,
|
30979
|
-
return sql`${sql.identifier(table4[
|
30940
|
+
if (is(table4, Table) && table4[Table.Symbol.OriginalName] !== table4[Table.Symbol.Name]) {
|
30941
|
+
return sql`${sql.identifier(table4[Table.Symbol.OriginalName])} ${sql.identifier(table4[Table.Symbol.Name])}`;
|
30980
30942
|
}
|
30981
30943
|
return table4;
|
30982
30944
|
})();
|
@@ -31089,7 +31051,7 @@ var init_dialect3 = __esm({
|
|
31089
31051
|
}
|
31090
31052
|
buildInsertQuery({ table: table4, values, ignore, onConflict }) {
|
31091
31053
|
const valuesSqlList = [];
|
31092
|
-
const columns = table4[
|
31054
|
+
const columns = table4[Table.Symbol.Columns];
|
31093
31055
|
const colEntries = Object.entries(columns).filter(
|
31094
31056
|
([_2, col]) => !col.shouldDisableInsert()
|
31095
31057
|
);
|
@@ -31217,7 +31179,7 @@ var init_dialect3 = __esm({
|
|
31217
31179
|
selection.push({
|
31218
31180
|
dbKey: is(value, SQL.Aliased) ? value.fieldAlias : tableConfig.columns[tsKey].name,
|
31219
31181
|
tsKey,
|
31220
|
-
field: is(value,
|
31182
|
+
field: is(value, Column) ? aliasedTableColumn(value, tableAlias) : value,
|
31221
31183
|
relationTableTsKey: void 0,
|
31222
31184
|
isJson: false,
|
31223
31185
|
selection: []
|
@@ -31228,7 +31190,7 @@ var init_dialect3 = __esm({
|
|
31228
31190
|
orderByOrig = [orderByOrig];
|
31229
31191
|
}
|
31230
31192
|
orderBy = orderByOrig.map((orderByValue) => {
|
31231
|
-
if (is(orderByValue,
|
31193
|
+
if (is(orderByValue, Column)) {
|
31232
31194
|
return aliasedTableColumn(orderByValue, tableAlias);
|
31233
31195
|
}
|
31234
31196
|
return mapColumnsInSQLToAlias(orderByValue, tableAlias);
|
@@ -31336,7 +31298,7 @@ var init_dialect3 = __esm({
|
|
31336
31298
|
fields: {},
|
31337
31299
|
fieldsFlat: nestedSelection.map(({ field: field2 }) => ({
|
31338
31300
|
path: [],
|
31339
|
-
field: is(field2,
|
31301
|
+
field: is(field2, Column) ? aliasedTableColumn(field2, tableAlias) : field2
|
31340
31302
|
})),
|
31341
31303
|
joins,
|
31342
31304
|
where,
|
@@ -31351,7 +31313,7 @@ var init_dialect3 = __esm({
|
|
31351
31313
|
fields: {},
|
31352
31314
|
fieldsFlat: selection.map(({ field }) => ({
|
31353
31315
|
path: [],
|
31354
|
-
field: is(field,
|
31316
|
+
field: is(field, Column) ? aliasedTableColumn(field, tableAlias) : field
|
31355
31317
|
})),
|
31356
31318
|
joins,
|
31357
31319
|
where,
|
@@ -31441,7 +31403,7 @@ var init_dialect3 = __esm({
|
|
31441
31403
|
selection.push({
|
31442
31404
|
dbKey: is(value, SQL.Aliased) ? value.fieldAlias : tableConfig.columns[tsKey].name,
|
31443
31405
|
tsKey,
|
31444
|
-
field: is(value,
|
31406
|
+
field: is(value, Column) ? aliasedTableColumn(value, tableAlias) : value,
|
31445
31407
|
relationTableTsKey: void 0,
|
31446
31408
|
isJson: false,
|
31447
31409
|
selection: []
|
@@ -31452,7 +31414,7 @@ var init_dialect3 = __esm({
|
|
31452
31414
|
orderByOrig = [orderByOrig];
|
31453
31415
|
}
|
31454
31416
|
orderBy = orderByOrig.map((orderByValue) => {
|
31455
|
-
if (is(orderByValue,
|
31417
|
+
if (is(orderByValue, Column)) {
|
31456
31418
|
return aliasedTableColumn(orderByValue, tableAlias);
|
31457
31419
|
}
|
31458
31420
|
return mapColumnsInSQLToAlias(orderByValue, tableAlias);
|
@@ -31559,7 +31521,7 @@ var init_dialect3 = __esm({
|
|
31559
31521
|
fields: {},
|
31560
31522
|
fieldsFlat: nestedSelection.map(({ field: field2 }) => ({
|
31561
31523
|
path: [],
|
31562
|
-
field: is(field2,
|
31524
|
+
field: is(field2, Column) ? aliasedTableColumn(field2, tableAlias) : field2
|
31563
31525
|
})),
|
31564
31526
|
where,
|
31565
31527
|
limit,
|
@@ -31573,7 +31535,7 @@ var init_dialect3 = __esm({
|
|
31573
31535
|
fields: {},
|
31574
31536
|
fieldsFlat: selection.map(({ field }) => ({
|
31575
31537
|
path: [],
|
31576
|
-
field: is(field,
|
31538
|
+
field: is(field, Column) ? aliasedTableColumn(field, tableAlias) : field
|
31577
31539
|
})),
|
31578
31540
|
where,
|
31579
31541
|
limit,
|
@@ -32011,7 +31973,7 @@ var init_select4 = __esm({
|
|
32011
31973
|
};
|
32012
31974
|
}
|
32013
31975
|
if (typeof tableName === "string" && !is(table4, SQL)) {
|
32014
|
-
const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View) ? table4[ViewBaseConfig].selectedFields : table4[
|
31976
|
+
const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View) ? table4[ViewBaseConfig].selectedFields : table4[Table.Symbol.Columns];
|
32015
31977
|
this.config.fields[tableName] = selection;
|
32016
31978
|
}
|
32017
31979
|
}
|
@@ -33083,7 +33045,7 @@ var init_view3 = __esm({
|
|
33083
33045
|
});
|
33084
33046
|
|
33085
33047
|
// ../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
|
33086
|
-
var _a316,
|
33048
|
+
var _a316, MySqlSchema3;
|
33087
33049
|
var init_schema2 = __esm({
|
33088
33050
|
"../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"() {
|
33089
33051
|
"use strict";
|
@@ -33091,7 +33053,7 @@ var init_schema2 = __esm({
|
|
33091
33053
|
init_table4();
|
33092
33054
|
init_view3();
|
33093
33055
|
_a316 = entityKind;
|
33094
|
-
|
33056
|
+
MySqlSchema3 = class {
|
33095
33057
|
constructor(schemaName) {
|
33096
33058
|
__publicField(this, "table", (name2, columns, extraConfig) => {
|
33097
33059
|
return mysqlTableWithSchema(name2, columns, extraConfig, this.schemaName);
|
@@ -33102,7 +33064,7 @@ var init_schema2 = __esm({
|
|
33102
33064
|
this.schemaName = schemaName;
|
33103
33065
|
}
|
33104
33066
|
};
|
33105
|
-
__publicField(
|
33067
|
+
__publicField(MySqlSchema3, _a316, "MySqlSchema");
|
33106
33068
|
}
|
33107
33069
|
});
|
33108
33070
|
|
@@ -33182,9 +33144,9 @@ function getTableConfig3(table4) {
|
|
33182
33144
|
const primaryKeys = [];
|
33183
33145
|
const uniqueConstraints = [];
|
33184
33146
|
const foreignKeys = Object.values(table4[MySqlTable.Symbol.InlineForeignKeys]);
|
33185
|
-
const name2 = table4[
|
33186
|
-
const schema4 = table4[
|
33187
|
-
const baseName = table4[
|
33147
|
+
const name2 = table4[Table.Symbol.Name];
|
33148
|
+
const schema4 = table4[Table.Symbol.Schema];
|
33149
|
+
const baseName = table4[Table.Symbol.BaseName];
|
33188
33150
|
const extraConfigBuilder = table4[MySqlTable.Symbol.ExtraConfigBuilder];
|
33189
33151
|
if (extraConfigBuilder !== void 0) {
|
33190
33152
|
const extraConfig = extraConfigBuilder(table4[MySqlTable.Symbol.Columns]);
|
@@ -33803,200 +33765,6 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
33803
33765
|
}
|
33804
33766
|
});
|
33805
33767
|
|
33806
|
-
// src/cli/validations/cli.ts
|
33807
|
-
var cliConfigGenerate, pushParams, pullParams, configCheck, cliConfigCheck;
|
33808
|
-
var init_cli = __esm({
|
33809
|
-
"src/cli/validations/cli.ts"() {
|
33810
|
-
"use strict";
|
33811
|
-
init_lib();
|
33812
|
-
init_schemaValidator();
|
33813
|
-
init_common();
|
33814
|
-
cliConfigGenerate = objectType({
|
33815
|
-
dialect: dialect3.optional(),
|
33816
|
-
schema: unionType([stringType(), stringType().array()]).optional(),
|
33817
|
-
out: stringType().optional().default("./drizzle"),
|
33818
|
-
config: stringType().optional(),
|
33819
|
-
name: stringType().optional(),
|
33820
|
-
prefix: prefix.optional(),
|
33821
|
-
breakpoints: booleanType().optional().default(true),
|
33822
|
-
custom: booleanType().optional().default(false)
|
33823
|
-
}).strict();
|
33824
|
-
pushParams = objectType({
|
33825
|
-
dialect: dialect3,
|
33826
|
-
schema: unionType([stringType(), stringType().array()]),
|
33827
|
-
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
33828
|
-
schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
|
33829
|
-
extensionsFilters: literalType("postgis").array().optional(),
|
33830
|
-
verbose: booleanType().optional(),
|
33831
|
-
strict: booleanType().optional()
|
33832
|
-
}).passthrough();
|
33833
|
-
pullParams = objectType({
|
33834
|
-
config: stringType().optional(),
|
33835
|
-
dialect: dialect3,
|
33836
|
-
out: stringType().optional().default("drizzle"),
|
33837
|
-
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
33838
|
-
schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
|
33839
|
-
extensionsFilters: literalType("postgis").array().optional(),
|
33840
|
-
introspectCasing: casing,
|
33841
|
-
breakpoints: booleanType().optional().default(true),
|
33842
|
-
database: objectType({
|
33843
|
-
prefix: prefix.optional().default("index")
|
33844
|
-
}).optional()
|
33845
|
-
}).passthrough();
|
33846
|
-
configCheck = objectType({
|
33847
|
-
dialect: dialect3.optional(),
|
33848
|
-
out: stringType().optional()
|
33849
|
-
});
|
33850
|
-
cliConfigCheck = intersectionType(
|
33851
|
-
objectType({
|
33852
|
-
config: stringType().optional()
|
33853
|
-
}),
|
33854
|
-
configCheck
|
33855
|
-
);
|
33856
|
-
}
|
33857
|
-
});
|
33858
|
-
|
33859
|
-
// src/cli/validations/mysql.ts
|
33860
|
-
var mysqlCredentials;
|
33861
|
-
var init_mysql = __esm({
|
33862
|
-
"src/cli/validations/mysql.ts"() {
|
33863
|
-
"use strict";
|
33864
|
-
init_lib();
|
33865
|
-
init_views();
|
33866
|
-
init_common();
|
33867
|
-
init_outputs();
|
33868
|
-
mysqlCredentials = unionType([
|
33869
|
-
objectType({
|
33870
|
-
host: stringType().min(1),
|
33871
|
-
port: coerce.number().min(1).optional(),
|
33872
|
-
user: stringType().min(1).optional(),
|
33873
|
-
password: stringType().min(1).optional(),
|
33874
|
-
database: stringType().min(1),
|
33875
|
-
ssl: unionType([
|
33876
|
-
stringType(),
|
33877
|
-
objectType({
|
33878
|
-
pfx: stringType().optional(),
|
33879
|
-
key: stringType().optional(),
|
33880
|
-
passphrase: stringType().optional(),
|
33881
|
-
cert: stringType().optional(),
|
33882
|
-
ca: unionType([stringType(), stringType().array()]).optional(),
|
33883
|
-
crl: unionType([stringType(), stringType().array()]).optional(),
|
33884
|
-
ciphers: stringType().optional(),
|
33885
|
-
rejectUnauthorized: booleanType().optional()
|
33886
|
-
})
|
33887
|
-
]).optional()
|
33888
|
-
}),
|
33889
|
-
objectType({
|
33890
|
-
url: stringType().min(1)
|
33891
|
-
})
|
33892
|
-
]);
|
33893
|
-
}
|
33894
|
-
});
|
33895
|
-
|
33896
|
-
// src/cli/validations/postgres.ts
|
33897
|
-
var postgresCredentials;
|
33898
|
-
var init_postgres = __esm({
|
33899
|
-
"src/cli/validations/postgres.ts"() {
|
33900
|
-
"use strict";
|
33901
|
-
init_lib();
|
33902
|
-
init_views();
|
33903
|
-
init_common();
|
33904
|
-
postgresCredentials = unionType([
|
33905
|
-
objectType({
|
33906
|
-
driver: undefinedType(),
|
33907
|
-
host: stringType().min(1),
|
33908
|
-
port: coerce.number().min(1).optional(),
|
33909
|
-
user: stringType().min(1).optional(),
|
33910
|
-
password: stringType().min(1).optional(),
|
33911
|
-
database: stringType().min(1),
|
33912
|
-
ssl: unionType([
|
33913
|
-
literalType("require"),
|
33914
|
-
literalType("allow"),
|
33915
|
-
literalType("prefer"),
|
33916
|
-
literalType("verify-full"),
|
33917
|
-
booleanType(),
|
33918
|
-
objectType({}).passthrough()
|
33919
|
-
]).optional()
|
33920
|
-
}).transform((o) => {
|
33921
|
-
delete o.driver;
|
33922
|
-
return o;
|
33923
|
-
}),
|
33924
|
-
objectType({
|
33925
|
-
driver: undefinedType(),
|
33926
|
-
url: stringType().min(1)
|
33927
|
-
}).transform((o) => {
|
33928
|
-
delete o.driver;
|
33929
|
-
return o;
|
33930
|
-
}),
|
33931
|
-
objectType({
|
33932
|
-
driver: literalType("aws-data-api"),
|
33933
|
-
database: stringType().min(1),
|
33934
|
-
secretArn: stringType().min(1),
|
33935
|
-
resourceArn: stringType().min(1)
|
33936
|
-
})
|
33937
|
-
]);
|
33938
|
-
}
|
33939
|
-
});
|
33940
|
-
|
33941
|
-
// src/cli/validations/sqlite.ts
|
33942
|
-
var sqliteCredentials;
|
33943
|
-
var init_sqlite = __esm({
|
33944
|
-
"src/cli/validations/sqlite.ts"() {
|
33945
|
-
"use strict";
|
33946
|
-
init_global();
|
33947
|
-
init_lib();
|
33948
|
-
init_views();
|
33949
|
-
init_common();
|
33950
|
-
sqliteCredentials = unionType([
|
33951
|
-
objectType({
|
33952
|
-
driver: literalType("turso"),
|
33953
|
-
url: stringType().min(1),
|
33954
|
-
authToken: stringType().min(1).optional()
|
33955
|
-
}),
|
33956
|
-
objectType({
|
33957
|
-
driver: literalType("d1-http"),
|
33958
|
-
accountId: stringType().min(1),
|
33959
|
-
databaseId: stringType().min(1),
|
33960
|
-
token: stringType().min(1)
|
33961
|
-
}),
|
33962
|
-
objectType({
|
33963
|
-
driver: undefinedType(),
|
33964
|
-
url: stringType().min(1)
|
33965
|
-
}).transform((o) => {
|
33966
|
-
delete o.driver;
|
33967
|
-
return o;
|
33968
|
-
})
|
33969
|
-
]);
|
33970
|
-
}
|
33971
|
-
});
|
33972
|
-
|
33973
|
-
// src/cli/validations/studio.ts
|
33974
|
-
var credentials, studioCliParams, studioConfig;
|
33975
|
-
var init_studio = __esm({
|
33976
|
-
"src/cli/validations/studio.ts"() {
|
33977
|
-
"use strict";
|
33978
|
-
init_lib();
|
33979
|
-
init_schemaValidator();
|
33980
|
-
init_mysql();
|
33981
|
-
init_postgres();
|
33982
|
-
init_sqlite();
|
33983
|
-
credentials = intersectionType(
|
33984
|
-
postgresCredentials,
|
33985
|
-
mysqlCredentials,
|
33986
|
-
sqliteCredentials
|
33987
|
-
);
|
33988
|
-
studioCliParams = objectType({
|
33989
|
-
port: coerce.number().optional().default(4983),
|
33990
|
-
host: stringType().optional().default("127.0.0.1"),
|
33991
|
-
config: stringType().optional()
|
33992
|
-
});
|
33993
|
-
studioConfig = objectType({
|
33994
|
-
dialect: dialect3,
|
33995
|
-
schema: unionType([stringType(), stringType().array()]).optional()
|
33996
|
-
});
|
33997
|
-
}
|
33998
|
-
});
|
33999
|
-
|
34000
33768
|
// src/cli/commands/_es5.ts
|
34001
33769
|
var es5_exports = {};
|
34002
33770
|
__export(es5_exports, {
|
@@ -34018,16 +33786,8 @@ var init_utils8 = __esm({
|
|
34018
33786
|
"use strict";
|
34019
33787
|
import_hanji7 = __toESM(require_hanji());
|
34020
33788
|
init_lib();
|
34021
|
-
init_global();
|
34022
33789
|
init_schemaValidator();
|
34023
|
-
init_serializer();
|
34024
|
-
init_cli();
|
34025
33790
|
init_common();
|
34026
|
-
init_mysql();
|
34027
|
-
init_outputs();
|
34028
|
-
init_postgres();
|
34029
|
-
init_sqlite();
|
34030
|
-
init_studio();
|
34031
33791
|
init_views();
|
34032
33792
|
assertES5 = async (unregister) => {
|
34033
33793
|
try {
|
@@ -34080,7 +33840,6 @@ var init_pgImports = __esm({
|
|
34080
33840
|
"use strict";
|
34081
33841
|
init_drizzle_orm();
|
34082
33842
|
init_pg_core();
|
34083
|
-
init_utils8();
|
34084
33843
|
prepareFromExports = (exports2) => {
|
34085
33844
|
const tables = [];
|
34086
33845
|
const enums = [];
|
@@ -34095,7 +33854,7 @@ var init_pgImports = __esm({
|
|
34095
33854
|
if (is(t, PgTable)) {
|
34096
33855
|
tables.push(t);
|
34097
33856
|
}
|
34098
|
-
if (is(t,
|
33857
|
+
if (is(t, PgSchema3)) {
|
34099
33858
|
schemas.push(t);
|
34100
33859
|
}
|
34101
33860
|
if (isPgSequence(t)) {
|
@@ -34786,7 +34545,6 @@ var pgSuggestions = async (db, statements) => {
|
|
34786
34545
|
|
34787
34546
|
// src/cli/commands/pgUp.ts
|
34788
34547
|
init_pgSchema();
|
34789
|
-
init_utils();
|
34790
34548
|
var updateUpToV6 = (json) => {
|
34791
34549
|
const schema4 = pgSchemaV5.parse(json);
|
34792
34550
|
const tables = Object.fromEntries(
|
@@ -34822,114 +34580,6 @@ var updateUpToV6 = (json) => {
|
|
34822
34580
|
var import_hanji6 = __toESM(require_hanji());
|
34823
34581
|
init_mjs();
|
34824
34582
|
init_global();
|
34825
|
-
|
34826
|
-
// ../node_modules/.pnpm/camelcase@7.0.1/node_modules/camelcase/index.js
|
34827
|
-
var UPPERCASE = /[\p{Lu}]/u;
|
34828
|
-
var LOWERCASE = /[\p{Ll}]/u;
|
34829
|
-
var LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
|
34830
|
-
var IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
34831
|
-
var SEPARATORS = /[_.\- ]+/;
|
34832
|
-
var LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
|
34833
|
-
var SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
|
34834
|
-
var NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
|
34835
|
-
var preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase2) => {
|
34836
|
-
let isLastCharLower = false;
|
34837
|
-
let isLastCharUpper = false;
|
34838
|
-
let isLastLastCharUpper = false;
|
34839
|
-
let isLastLastCharPreserved = false;
|
34840
|
-
for (let index4 = 0; index4 < string.length; index4++) {
|
34841
|
-
const character = string[index4];
|
34842
|
-
isLastLastCharPreserved = index4 > 2 ? string[index4 - 3] === "-" : true;
|
34843
|
-
if (isLastCharLower && UPPERCASE.test(character)) {
|
34844
|
-
string = string.slice(0, index4) + "-" + string.slice(index4);
|
34845
|
-
isLastCharLower = false;
|
34846
|
-
isLastLastCharUpper = isLastCharUpper;
|
34847
|
-
isLastCharUpper = true;
|
34848
|
-
index4++;
|
34849
|
-
} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase2)) {
|
34850
|
-
string = string.slice(0, index4 - 1) + "-" + string.slice(index4 - 1);
|
34851
|
-
isLastLastCharUpper = isLastCharUpper;
|
34852
|
-
isLastCharUpper = false;
|
34853
|
-
isLastCharLower = true;
|
34854
|
-
} else {
|
34855
|
-
isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
|
34856
|
-
isLastLastCharUpper = isLastCharUpper;
|
34857
|
-
isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
|
34858
|
-
}
|
34859
|
-
}
|
34860
|
-
return string;
|
34861
|
-
};
|
34862
|
-
var preserveConsecutiveUppercase = (input, toLowerCase) => {
|
34863
|
-
LEADING_CAPITAL.lastIndex = 0;
|
34864
|
-
return input.replace(LEADING_CAPITAL, (m1) => toLowerCase(m1));
|
34865
|
-
};
|
34866
|
-
var postProcess = (input, toUpperCase) => {
|
34867
|
-
SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
|
34868
|
-
NUMBERS_AND_IDENTIFIER.lastIndex = 0;
|
34869
|
-
return input.replace(SEPARATORS_AND_IDENTIFIER, (_2, identifier) => toUpperCase(identifier)).replace(NUMBERS_AND_IDENTIFIER, (m) => toUpperCase(m));
|
34870
|
-
};
|
34871
|
-
function camelCase(input, options) {
|
34872
|
-
if (!(typeof input === "string" || Array.isArray(input))) {
|
34873
|
-
throw new TypeError("Expected the input to be `string | string[]`");
|
34874
|
-
}
|
34875
|
-
options = {
|
34876
|
-
pascalCase: false,
|
34877
|
-
preserveConsecutiveUppercase: false,
|
34878
|
-
...options
|
34879
|
-
};
|
34880
|
-
if (Array.isArray(input)) {
|
34881
|
-
input = input.map((x) => x.trim()).filter((x) => x.length).join("-");
|
34882
|
-
} else {
|
34883
|
-
input = input.trim();
|
34884
|
-
}
|
34885
|
-
if (input.length === 0) {
|
34886
|
-
return "";
|
34887
|
-
}
|
34888
|
-
const toLowerCase = options.locale === false ? (string) => string.toLowerCase() : (string) => string.toLocaleLowerCase(options.locale);
|
34889
|
-
const toUpperCase = options.locale === false ? (string) => string.toUpperCase() : (string) => string.toLocaleUpperCase(options.locale);
|
34890
|
-
if (input.length === 1) {
|
34891
|
-
if (SEPARATORS.test(input)) {
|
34892
|
-
return "";
|
34893
|
-
}
|
34894
|
-
return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
|
34895
|
-
}
|
34896
|
-
const hasUpperCase = input !== toLowerCase(input);
|
34897
|
-
if (hasUpperCase) {
|
34898
|
-
input = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase);
|
34899
|
-
}
|
34900
|
-
input = input.replace(LEADING_SEPARATORS, "");
|
34901
|
-
input = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);
|
34902
|
-
if (options.pascalCase) {
|
34903
|
-
input = toUpperCase(input.charAt(0)) + input.slice(1);
|
34904
|
-
}
|
34905
|
-
return postProcess(input, toUpperCase);
|
34906
|
-
}
|
34907
|
-
|
34908
|
-
// src/@types/utils.ts
|
34909
|
-
String.prototype.trimChar = function(char) {
|
34910
|
-
let start = 0;
|
34911
|
-
let end = this.length;
|
34912
|
-
while (start < end && this[start] === char) ++start;
|
34913
|
-
while (end > start && this[end - 1] === char) --end;
|
34914
|
-
return start > 0 || end < this.length ? this.substring(start, end) : this.toString();
|
34915
|
-
};
|
34916
|
-
String.prototype.squashSpaces = function() {
|
34917
|
-
return this.replace(/ +/g, " ").trim();
|
34918
|
-
};
|
34919
|
-
String.prototype.camelCase = function() {
|
34920
|
-
return camelCase(String(this));
|
34921
|
-
};
|
34922
|
-
String.prototype.capitalise = function() {
|
34923
|
-
return this && this.length > 0 ? `${this[0].toUpperCase()}${this.slice(1)}` : String(this);
|
34924
|
-
};
|
34925
|
-
String.prototype.concatIf = function(it, condition) {
|
34926
|
-
return condition ? `${this}${it}` : String(this);
|
34927
|
-
};
|
34928
|
-
Array.prototype.random = function() {
|
34929
|
-
return this[~~(Math.random() * this.length)];
|
34930
|
-
};
|
34931
|
-
|
34932
|
-
// src/cli/commands/sqliteIntrospect.ts
|
34933
34583
|
init_sqliteSerializer();
|
34934
34584
|
init_views();
|
34935
34585
|
var sqlitePushIntrospect = async (db, filters) => {
|