drizzle-kit 1.0.0-beta.1-ac4ce44 → 1.0.0-beta.1-f77460a
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.d.mts +265 -1
- package/api.d.ts +265 -1
- package/api.js +163347 -44381
- package/api.mjs +163305 -44349
- package/bin.cjs +42 -28
- package/package.json +1 -1
package/bin.cjs
CHANGED
|
@@ -18457,11 +18457,12 @@ __export(pgImports_exports, {
|
|
|
18457
18457
|
prepareFromExports: () => prepareFromExports2,
|
|
18458
18458
|
prepareFromPgImports: () => prepareFromPgImports
|
|
18459
18459
|
});
|
|
18460
|
-
var import_drizzle_orm3, import_pg_core, prepareFromExports2, prepareFromPgImports;
|
|
18460
|
+
var import_drizzle_orm3, import_relations, import_pg_core, prepareFromExports2, prepareFromPgImports;
|
|
18461
18461
|
var init_pgImports = __esm({
|
|
18462
18462
|
"src/serializer/pgImports.ts"() {
|
|
18463
18463
|
"use strict";
|
|
18464
18464
|
import_drizzle_orm3 = require("drizzle-orm");
|
|
18465
|
+
import_relations = require("drizzle-orm/_relations");
|
|
18465
18466
|
import_pg_core = require("drizzle-orm/pg-core");
|
|
18466
18467
|
init_utils3();
|
|
18467
18468
|
prepareFromExports2 = (exports2) => {
|
|
@@ -18473,6 +18474,7 @@ var init_pgImports = __esm({
|
|
|
18473
18474
|
const policies = [];
|
|
18474
18475
|
const views = [];
|
|
18475
18476
|
const matViews = [];
|
|
18477
|
+
const relations5 = [];
|
|
18476
18478
|
const i0values = Object.values(exports2);
|
|
18477
18479
|
i0values.forEach((t4) => {
|
|
18478
18480
|
if ((0, import_pg_core.isPgEnum)(t4)) {
|
|
@@ -18500,8 +18502,11 @@ var init_pgImports = __esm({
|
|
|
18500
18502
|
if ((0, import_drizzle_orm3.is)(t4, import_pg_core.PgPolicy)) {
|
|
18501
18503
|
policies.push(t4);
|
|
18502
18504
|
}
|
|
18505
|
+
if ((0, import_drizzle_orm3.is)(t4, import_relations.Relations)) {
|
|
18506
|
+
relations5.push(t4);
|
|
18507
|
+
}
|
|
18503
18508
|
});
|
|
18504
|
-
return { tables, enums, schemas, sequences, views, matViews, roles, policies };
|
|
18509
|
+
return { tables, enums, schemas, sequences, views, matViews, roles, policies, relations: relations5 };
|
|
18505
18510
|
};
|
|
18506
18511
|
prepareFromPgImports = async (imports) => {
|
|
18507
18512
|
const tables = [];
|
|
@@ -18512,6 +18517,7 @@ var init_pgImports = __esm({
|
|
|
18512
18517
|
const roles = [];
|
|
18513
18518
|
const policies = [];
|
|
18514
18519
|
const matViews = [];
|
|
18520
|
+
const relations5 = [];
|
|
18515
18521
|
const { unregister } = await safeRegister();
|
|
18516
18522
|
for (let i4 = 0; i4 < imports.length; i4++) {
|
|
18517
18523
|
const it = imports[i4];
|
|
@@ -18525,9 +18531,20 @@ var init_pgImports = __esm({
|
|
|
18525
18531
|
matViews.push(...prepared.matViews);
|
|
18526
18532
|
roles.push(...prepared.roles);
|
|
18527
18533
|
policies.push(...prepared.policies);
|
|
18534
|
+
relations5.push(...prepared.relations);
|
|
18528
18535
|
}
|
|
18529
18536
|
unregister();
|
|
18530
|
-
return {
|
|
18537
|
+
return {
|
|
18538
|
+
tables: Array.from(new Set(tables)),
|
|
18539
|
+
enums,
|
|
18540
|
+
schemas,
|
|
18541
|
+
sequences,
|
|
18542
|
+
views,
|
|
18543
|
+
matViews,
|
|
18544
|
+
roles,
|
|
18545
|
+
policies,
|
|
18546
|
+
relations: relations5
|
|
18547
|
+
};
|
|
18531
18548
|
};
|
|
18532
18549
|
}
|
|
18533
18550
|
});
|
|
@@ -21497,7 +21514,7 @@ ${filenames.join("\n")}
|
|
|
21497
21514
|
});
|
|
21498
21515
|
|
|
21499
21516
|
// src/migrationPreparator.ts
|
|
21500
|
-
var import_crypto, import_fs5, prepareMySqlDbPushSnapshot, prepareSingleStoreDbPushSnapshot, prepareSQLiteDbPushSnapshot, prepareMySqlMigrationSnapshot, prepareSingleStoreMigrationSnapshot, prepareSqliteMigrationSnapshot,
|
|
21517
|
+
var import_crypto, import_fs5, prepareMySqlDbPushSnapshot, prepareSingleStoreDbPushSnapshot, prepareSQLiteDbPushSnapshot, prepareMySqlMigrationSnapshot, prepareSingleStoreMigrationSnapshot, prepareSqliteMigrationSnapshot, preparePgMigrationSnapshot, preparePrevSnapshot;
|
|
21501
21518
|
var init_migrationPreparator = __esm({
|
|
21502
21519
|
"src/migrationPreparator.ts"() {
|
|
21503
21520
|
"use strict";
|
|
@@ -21595,13 +21612,6 @@ var init_migrationPreparator = __esm({
|
|
|
21595
21612
|
};
|
|
21596
21613
|
return { prev: prevSnapshot, cur: result, custom: custom2 };
|
|
21597
21614
|
};
|
|
21598
|
-
fillPgSnapshot = ({
|
|
21599
|
-
serialized,
|
|
21600
|
-
id,
|
|
21601
|
-
idPrev
|
|
21602
|
-
}) => {
|
|
21603
|
-
return { id, prevId: idPrev, ...serialized };
|
|
21604
|
-
};
|
|
21605
21615
|
preparePgMigrationSnapshot = async (snapshots, schemaPath, casing2) => {
|
|
21606
21616
|
const prevSnapshot = pgSchema.parse(preparePrevSnapshot(snapshots, dryPg));
|
|
21607
21617
|
const serialized = await serializePg(schemaPath, casing2);
|
|
@@ -21609,7 +21619,11 @@ var init_migrationPreparator = __esm({
|
|
|
21609
21619
|
const idPrev = prevSnapshot.id;
|
|
21610
21620
|
const result = { id, prevId: idPrev, ...serialized };
|
|
21611
21621
|
const { id: _ignoredId, prevId: _ignoredPrevId, ...prevRest } = prevSnapshot;
|
|
21612
|
-
const custom2 =
|
|
21622
|
+
const custom2 = {
|
|
21623
|
+
id,
|
|
21624
|
+
prevId: idPrev,
|
|
21625
|
+
...prevRest
|
|
21626
|
+
};
|
|
21613
21627
|
return { prev: prevSnapshot, cur: result, custom: custom2 };
|
|
21614
21628
|
};
|
|
21615
21629
|
preparePrevSnapshot = (snapshots, defaultPrev) => {
|
|
@@ -82267,7 +82281,7 @@ var init_connections = __esm({
|
|
|
82267
82281
|
const { PGlite, types: types3 } = await import("@electric-sql/pglite");
|
|
82268
82282
|
const { drizzle } = await import("drizzle-orm/pglite");
|
|
82269
82283
|
const { migrate: migrate2 } = await import("drizzle-orm/pglite/migrator");
|
|
82270
|
-
const pglite = new PGlite(normalisePGliteUrl(credentials2.url));
|
|
82284
|
+
const pglite = "client" in credentials2 ? credentials2.client : new PGlite(normalisePGliteUrl(credentials2.url));
|
|
82271
82285
|
await pglite.waitReady;
|
|
82272
82286
|
const drzl = drizzle(pglite);
|
|
82273
82287
|
const migrateFn = async (config) => {
|
|
@@ -88495,12 +88509,12 @@ function generateIdentityParams2(identity) {
|
|
|
88495
88509
|
}
|
|
88496
88510
|
return `.generatedByDefaultAsIdentity(${paramsObj})`;
|
|
88497
88511
|
}
|
|
88498
|
-
var import_drizzle_orm10,
|
|
88512
|
+
var import_drizzle_orm10, import_relations2, import_casing5, pgImportsList, timeConfig2, possibleIntervals, intervalStrToObj, intervalConfig, mapColumnDefault4, importsPatch2, relations4, escapeColumnKey4, withCasing3, dbColumnName4, paramNameFor2, schemaToTypeScript4, isCyclic4, isSelf4, buildArrayDefault2, mapDefault2, column9, dimensionsInArray2, createTableColumns4, createTableIndexes4, createTablePKs4, createTablePolicies2, createTableUniques4, createTableChecks4, createTableFKs4;
|
|
88499
88513
|
var init_introspect_pg = __esm({
|
|
88500
88514
|
"src/introspect-pg.ts"() {
|
|
88501
88515
|
"use strict";
|
|
88502
88516
|
import_drizzle_orm10 = require("drizzle-orm");
|
|
88503
|
-
|
|
88517
|
+
import_relations2 = require("drizzle-orm/_relations");
|
|
88504
88518
|
init_utils();
|
|
88505
88519
|
import_casing5 = require("drizzle-orm/casing");
|
|
88506
88520
|
init_global();
|
|
@@ -93146,7 +93160,7 @@ __export(studio_exports, {
|
|
|
93146
93160
|
prepareServer: () => prepareServer,
|
|
93147
93161
|
prepareSingleStoreSchema: () => prepareSingleStoreSchema
|
|
93148
93162
|
});
|
|
93149
|
-
var import_crypto9, import_drizzle_orm11,
|
|
93163
|
+
var import_crypto9, import_drizzle_orm11, import_relations3, import_mysql_core3, import_pg_core3, import_singlestore_core3, import_sqlite_core3, import_fs12, import_node_https2, preparePgSchema, prepareMySqlSchema, prepareSQLiteSchema, prepareSingleStoreSchema, getCustomDefaults, drizzleForPostgres, drizzleForMySQL, drizzleForSQLite, drizzleForLibSQL, drizzleForSingleStore, extractRelations, init, proxySchema, transactionProxySchema, defaultsSchema, schema5, jsonStringify, prepareServer;
|
|
93150
93164
|
var init_studio2 = __esm({
|
|
93151
93165
|
"src/serializer/studio.ts"() {
|
|
93152
93166
|
"use strict";
|
|
@@ -93154,7 +93168,7 @@ var init_studio2 = __esm({
|
|
|
93154
93168
|
init_esm2();
|
|
93155
93169
|
import_crypto9 = require("crypto");
|
|
93156
93170
|
import_drizzle_orm11 = require("drizzle-orm");
|
|
93157
|
-
|
|
93171
|
+
import_relations3 = require("drizzle-orm/_relations");
|
|
93158
93172
|
import_mysql_core3 = require("drizzle-orm/mysql-core");
|
|
93159
93173
|
import_pg_core3 = require("drizzle-orm/pg-core");
|
|
93160
93174
|
import_singlestore_core3 = require("drizzle-orm/singlestore-core");
|
|
@@ -93189,7 +93203,7 @@ var init_studio2 = __esm({
|
|
|
93189
93203
|
pgSchema2[schema6] = pgSchema2[schema6] || {};
|
|
93190
93204
|
pgSchema2[schema6][k3] = t4;
|
|
93191
93205
|
}
|
|
93192
|
-
if ((0, import_drizzle_orm11.is)(t4,
|
|
93206
|
+
if ((0, import_drizzle_orm11.is)(t4, import_relations3.Relations)) {
|
|
93193
93207
|
relations5[k3] = t4;
|
|
93194
93208
|
}
|
|
93195
93209
|
});
|
|
@@ -93218,7 +93232,7 @@ var init_studio2 = __esm({
|
|
|
93218
93232
|
const schema6 = (0, import_mysql_core3.getTableConfig)(t4).schema || "public";
|
|
93219
93233
|
mysqlSchema3[schema6][k3] = t4;
|
|
93220
93234
|
}
|
|
93221
|
-
if ((0, import_drizzle_orm11.is)(t4,
|
|
93235
|
+
if ((0, import_drizzle_orm11.is)(t4, import_relations3.Relations)) {
|
|
93222
93236
|
relations5[k3] = t4;
|
|
93223
93237
|
}
|
|
93224
93238
|
});
|
|
@@ -93247,7 +93261,7 @@ var init_studio2 = __esm({
|
|
|
93247
93261
|
const schema6 = "public";
|
|
93248
93262
|
sqliteSchema2[schema6][k3] = t4;
|
|
93249
93263
|
}
|
|
93250
|
-
if ((0, import_drizzle_orm11.is)(t4,
|
|
93264
|
+
if ((0, import_drizzle_orm11.is)(t4, import_relations3.Relations)) {
|
|
93251
93265
|
relations5[k3] = t4;
|
|
93252
93266
|
}
|
|
93253
93267
|
});
|
|
@@ -93276,7 +93290,7 @@ var init_studio2 = __esm({
|
|
|
93276
93290
|
const schema6 = (0, import_singlestore_core3.getTableConfig)(t4).schema || "public";
|
|
93277
93291
|
singlestoreSchema2[schema6][k3] = t4;
|
|
93278
93292
|
}
|
|
93279
|
-
if ((0, import_drizzle_orm11.is)(t4,
|
|
93293
|
+
if ((0, import_drizzle_orm11.is)(t4, import_relations3.Relations)) {
|
|
93280
93294
|
relations5[k3] = t4;
|
|
93281
93295
|
}
|
|
93282
93296
|
});
|
|
@@ -93322,7 +93336,7 @@ var init_studio2 = __esm({
|
|
|
93322
93336
|
if (driver2 === "aws-data-api") {
|
|
93323
93337
|
dbUrl = `aws-data-api://${credentials2.database}/${credentials2.secretArn}/${credentials2.resourceArn}`;
|
|
93324
93338
|
} else if (driver2 === "pglite") {
|
|
93325
|
-
dbUrl = credentials2.url;
|
|
93339
|
+
dbUrl = "client" in credentials2 ? credentials2.client.dataDir || "pglite://custom-client" : credentials2.url;
|
|
93326
93340
|
} else {
|
|
93327
93341
|
assertUnreachable(driver2);
|
|
93328
93342
|
}
|
|
@@ -93450,7 +93464,7 @@ var init_studio2 = __esm({
|
|
|
93450
93464
|
const relations5 = Object.values(tablesConfig.tables).map(
|
|
93451
93465
|
(it) => Object.entries(it.relations).map(([name, relation]) => {
|
|
93452
93466
|
try {
|
|
93453
|
-
const normalized = (0,
|
|
93467
|
+
const normalized = (0, import_relations3.normalizeRelation)(
|
|
93454
93468
|
tablesConfig.tables,
|
|
93455
93469
|
tablesConfig.tableNamesMap,
|
|
93456
93470
|
relation
|
|
@@ -93473,9 +93487,9 @@ var init_studio2 = __esm({
|
|
|
93473
93487
|
throw new Error("unsupported dialect");
|
|
93474
93488
|
}
|
|
93475
93489
|
let type;
|
|
93476
|
-
if ((0, import_drizzle_orm11.is)(rel,
|
|
93490
|
+
if ((0, import_drizzle_orm11.is)(rel, import_relations3.One)) {
|
|
93477
93491
|
type = "one";
|
|
93478
|
-
} else if ((0, import_drizzle_orm11.is)(rel,
|
|
93492
|
+
} else if ((0, import_drizzle_orm11.is)(rel, import_relations3.Many)) {
|
|
93479
93493
|
type = "many";
|
|
93480
93494
|
} else {
|
|
93481
93495
|
throw new Error("unsupported relation type");
|
|
@@ -93604,9 +93618,9 @@ var init_studio2 = __esm({
|
|
|
93604
93618
|
),
|
|
93605
93619
|
...relations5
|
|
93606
93620
|
};
|
|
93607
|
-
const relationsConfig = (0,
|
|
93621
|
+
const relationsConfig = (0, import_relations3.extractTablesRelationalConfig)(
|
|
93608
93622
|
relationalSchema,
|
|
93609
|
-
|
|
93623
|
+
import_relations3.createTableRelationsHelpers
|
|
93610
93624
|
);
|
|
93611
93625
|
app.post("/", zValidator("json", schema5), async (c3) => {
|
|
93612
93626
|
const body = c3.req.valid("json");
|
|
@@ -96210,7 +96224,7 @@ init_utils5();
|
|
|
96210
96224
|
var version2 = async () => {
|
|
96211
96225
|
const { npmVersion } = await ormCoreVersions();
|
|
96212
96226
|
const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
|
|
96213
|
-
const envVersion = "1.0.0-beta.1-
|
|
96227
|
+
const envVersion = "1.0.0-beta.1-f77460a";
|
|
96214
96228
|
const kitVersion = envVersion ? `v${envVersion}` : "--";
|
|
96215
96229
|
const versions = `drizzle-kit: ${kitVersion}
|
|
96216
96230
|
${ormVersion}`;
|