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