drizzle-kit 0.20.17-b08243d → 0.20.17-b2e8c7f
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/bin.cjs +137 -31
- package/cli/validations/cli.d.ts +1 -1
- package/package.json +1 -1
- package/payload.js +1 -1
- package/payload.mjs +1 -1
package/bin.cjs
CHANGED
|
@@ -8700,7 +8700,7 @@ var init_cli = __esm({
|
|
|
8700
8700
|
authToken: stringType().optional(),
|
|
8701
8701
|
introspectCasing: casing,
|
|
8702
8702
|
breakpoints: booleanType().optional().default(true)
|
|
8703
|
-
})
|
|
8703
|
+
});
|
|
8704
8704
|
configCheck = objectType({
|
|
8705
8705
|
dialect: dialect3.optional(),
|
|
8706
8706
|
out: stringType().optional()
|
|
@@ -99674,7 +99674,7 @@ __export(connections_exports, {
|
|
|
99674
99674
|
connectToSQLite: () => connectToSQLite,
|
|
99675
99675
|
preparePostgresDB: () => preparePostgresDB
|
|
99676
99676
|
});
|
|
99677
|
-
var
|
|
99677
|
+
var preparePostgresDB, parseMysqlCredentials, connectToMySQL, prepareSqliteParams, connectToSQLite;
|
|
99678
99678
|
var init_connections = __esm({
|
|
99679
99679
|
"src/cli/connections.ts"() {
|
|
99680
99680
|
"use strict";
|
|
@@ -99682,37 +99682,143 @@ var init_connections = __esm({
|
|
|
99682
99682
|
init_utils2();
|
|
99683
99683
|
init_global();
|
|
99684
99684
|
init_outputs();
|
|
99685
|
-
import_pg_core4 = require("drizzle-orm/pg-core");
|
|
99686
99685
|
preparePostgresDB = async (credentials2) => {
|
|
99687
99686
|
if ("driver" in credentials2) {
|
|
99688
99687
|
if (credentials2.driver === "aws-data-api") {
|
|
99688
|
+
let getValueFromDataApi2 = function(field) {
|
|
99689
|
+
if (field.stringValue !== void 0) {
|
|
99690
|
+
return field.stringValue;
|
|
99691
|
+
} else if (field.booleanValue !== void 0) {
|
|
99692
|
+
return field.booleanValue;
|
|
99693
|
+
} else if (field.doubleValue !== void 0) {
|
|
99694
|
+
return field.doubleValue;
|
|
99695
|
+
} else if (field.isNull !== void 0) {
|
|
99696
|
+
return null;
|
|
99697
|
+
} else if (field.longValue !== void 0) {
|
|
99698
|
+
return field.longValue;
|
|
99699
|
+
} else if (field.blobValue !== void 0) {
|
|
99700
|
+
return field.blobValue;
|
|
99701
|
+
} else if (field.arrayValue !== void 0) {
|
|
99702
|
+
if (field.arrayValue.stringValues !== void 0) {
|
|
99703
|
+
return field.arrayValue.stringValues;
|
|
99704
|
+
}
|
|
99705
|
+
if (field.arrayValue.longValues !== void 0) {
|
|
99706
|
+
return field.arrayValue.longValues;
|
|
99707
|
+
}
|
|
99708
|
+
if (field.arrayValue.doubleValues !== void 0) {
|
|
99709
|
+
return field.arrayValue.doubleValues;
|
|
99710
|
+
}
|
|
99711
|
+
if (field.arrayValue.booleanValues !== void 0) {
|
|
99712
|
+
return field.arrayValue.booleanValues;
|
|
99713
|
+
}
|
|
99714
|
+
if (field.arrayValue.arrayValues !== void 0) {
|
|
99715
|
+
return field.arrayValue.arrayValues;
|
|
99716
|
+
}
|
|
99717
|
+
throw new Error("Unknown array type");
|
|
99718
|
+
} else {
|
|
99719
|
+
throw new Error("Unknown type");
|
|
99720
|
+
}
|
|
99721
|
+
}, typingsToAwsTypeHint2 = function(typings) {
|
|
99722
|
+
if (typings === "date") {
|
|
99723
|
+
return TypeHint.DATE;
|
|
99724
|
+
} else if (typings === "decimal") {
|
|
99725
|
+
return TypeHint.DECIMAL;
|
|
99726
|
+
} else if (typings === "json") {
|
|
99727
|
+
return TypeHint.JSON;
|
|
99728
|
+
} else if (typings === "time") {
|
|
99729
|
+
return TypeHint.TIME;
|
|
99730
|
+
} else if (typings === "timestamp") {
|
|
99731
|
+
return TypeHint.TIMESTAMP;
|
|
99732
|
+
} else if (typings === "uuid") {
|
|
99733
|
+
return TypeHint.UUID;
|
|
99734
|
+
} else {
|
|
99735
|
+
return void 0;
|
|
99736
|
+
}
|
|
99737
|
+
}, toValueParam2 = function(value, typings) {
|
|
99738
|
+
const response = {
|
|
99739
|
+
value: {},
|
|
99740
|
+
typeHint: typingsToAwsTypeHint2(typings)
|
|
99741
|
+
};
|
|
99742
|
+
if (value === null) {
|
|
99743
|
+
response.value = { isNull: true };
|
|
99744
|
+
} else if (typeof value === "string") {
|
|
99745
|
+
switch (response.typeHint) {
|
|
99746
|
+
case TypeHint.DATE: {
|
|
99747
|
+
response.value = { stringValue: value.split("T")[0] };
|
|
99748
|
+
break;
|
|
99749
|
+
}
|
|
99750
|
+
case TypeHint.TIMESTAMP: {
|
|
99751
|
+
response.value = {
|
|
99752
|
+
stringValue: value.replace("T", " ").replace("Z", "")
|
|
99753
|
+
};
|
|
99754
|
+
break;
|
|
99755
|
+
}
|
|
99756
|
+
default: {
|
|
99757
|
+
response.value = { stringValue: value };
|
|
99758
|
+
break;
|
|
99759
|
+
}
|
|
99760
|
+
}
|
|
99761
|
+
} else if (typeof value === "number" && Number.isInteger(value)) {
|
|
99762
|
+
response.value = { longValue: value };
|
|
99763
|
+
} else if (typeof value === "number" && !Number.isInteger(value)) {
|
|
99764
|
+
response.value = { doubleValue: value };
|
|
99765
|
+
} else if (typeof value === "boolean") {
|
|
99766
|
+
response.value = { booleanValue: value };
|
|
99767
|
+
} else if (value instanceof Date) {
|
|
99768
|
+
response.value = {
|
|
99769
|
+
stringValue: value.toISOString().replace("T", " ").replace("Z", "")
|
|
99770
|
+
};
|
|
99771
|
+
} else {
|
|
99772
|
+
throw new Error(`Unknown type for ${value}`);
|
|
99773
|
+
}
|
|
99774
|
+
return response;
|
|
99775
|
+
};
|
|
99776
|
+
var getValueFromDataApi = getValueFromDataApi2, typingsToAwsTypeHint = typingsToAwsTypeHint2, toValueParam = toValueParam2;
|
|
99689
99777
|
assertPackages("@aws-sdk/client-rds-data");
|
|
99690
99778
|
const { RDSDataClient, ExecuteStatementCommand, TypeHint } = await Promise.resolve().then(() => __toESM(require_dist_cjs54()));
|
|
99691
|
-
const { AwsDataApiSession } = await import("drizzle-orm/aws-data-api/pg");
|
|
99692
99779
|
const rdsClient = new RDSDataClient();
|
|
99693
|
-
const
|
|
99694
|
-
|
|
99695
|
-
|
|
99696
|
-
|
|
99697
|
-
|
|
99698
|
-
|
|
99699
|
-
|
|
99700
|
-
|
|
99701
|
-
|
|
99702
|
-
|
|
99703
|
-
|
|
99704
|
-
|
|
99705
|
-
|
|
99706
|
-
|
|
99707
|
-
|
|
99708
|
-
return
|
|
99709
|
-
}
|
|
99710
|
-
|
|
99711
|
-
|
|
99712
|
-
|
|
99713
|
-
|
|
99780
|
+
const query = async (sql2, params = []) => {
|
|
99781
|
+
var _a;
|
|
99782
|
+
const result = await rdsClient.send(
|
|
99783
|
+
new ExecuteStatementCommand({
|
|
99784
|
+
sql: sql2,
|
|
99785
|
+
parameters: params.map((param, index4) => ({
|
|
99786
|
+
name: `${index4 + 1}`,
|
|
99787
|
+
...toValueParam2(param, void 0)
|
|
99788
|
+
})),
|
|
99789
|
+
secretArn: credentials2.secretArn,
|
|
99790
|
+
resourceArn: credentials2.resourceArn,
|
|
99791
|
+
database: credentials2.database
|
|
99792
|
+
})
|
|
99793
|
+
);
|
|
99794
|
+
const rows = ((_a = result.records) == null ? void 0 : _a.map((row) => {
|
|
99795
|
+
return row.map((field) => getValueFromDataApi2(field));
|
|
99796
|
+
})) ?? [];
|
|
99797
|
+
return rows;
|
|
99798
|
+
};
|
|
99799
|
+
const proxy = async (params) => {
|
|
99800
|
+
var _a;
|
|
99801
|
+
const result = await rdsClient.send(
|
|
99802
|
+
new ExecuteStatementCommand({
|
|
99803
|
+
sql: params.sql,
|
|
99804
|
+
parameters: params.params.map((param, index4) => ({
|
|
99805
|
+
name: `${index4 + 1}`,
|
|
99806
|
+
...toValueParam2(param, void 0)
|
|
99807
|
+
})),
|
|
99808
|
+
secretArn: credentials2.secretArn,
|
|
99809
|
+
resourceArn: credentials2.resourceArn,
|
|
99810
|
+
database: credentials2.database
|
|
99811
|
+
})
|
|
99812
|
+
);
|
|
99813
|
+
if (params.mode === "array") {
|
|
99814
|
+
const rows = ((_a = result.records) == null ? void 0 : _a.map((row) => {
|
|
99815
|
+
return row.map((field) => getValueFromDataApi2(field));
|
|
99816
|
+
})) ?? [];
|
|
99817
|
+
return rows;
|
|
99714
99818
|
}
|
|
99819
|
+
return result.records;
|
|
99715
99820
|
};
|
|
99821
|
+
return { query, proxy };
|
|
99716
99822
|
}
|
|
99717
99823
|
assertUnreachable(credentials2.driver);
|
|
99718
99824
|
}
|
|
@@ -99994,7 +100100,7 @@ __export(studio_exports, {
|
|
|
99994
100100
|
prepareSQLiteSchema: () => prepareSQLiteSchema,
|
|
99995
100101
|
prepareServer: () => prepareServer
|
|
99996
100102
|
});
|
|
99997
|
-
var import_node_https,
|
|
100103
|
+
var import_node_https, import_pg_core4, import_drizzle_orm8, import_mysql_core4, import_sqlite_core3, preparePgSchema, prepareMySqlSchema, prepareSQLiteSchema, getCustomDefaults, drizzleForPostgres, drizzleForMySQL, drizzleForSQLite, init, proxySchema, defaultsSchema, schema4, jsonStringify, prepareServer;
|
|
99998
100104
|
var init_studio = __esm({
|
|
99999
100105
|
"src/serializer/studio.ts"() {
|
|
100000
100106
|
"use strict";
|
|
@@ -100006,7 +100112,7 @@ var init_studio = __esm({
|
|
|
100006
100112
|
init_dist5();
|
|
100007
100113
|
init_lib();
|
|
100008
100114
|
init_serializer();
|
|
100009
|
-
|
|
100115
|
+
import_pg_core4 = require("drizzle-orm/pg-core");
|
|
100010
100116
|
import_drizzle_orm8 = require("drizzle-orm");
|
|
100011
100117
|
init_utils4();
|
|
100012
100118
|
import_mysql_core4 = require("drizzle-orm/mysql-core");
|
|
@@ -100021,8 +100127,8 @@ var init_studio = __esm({
|
|
|
100021
100127
|
const i0 = require(`${it}`);
|
|
100022
100128
|
const i0values = Object.entries(i0);
|
|
100023
100129
|
i0values.forEach(([k2, t]) => {
|
|
100024
|
-
if ((0, import_drizzle_orm8.is)(t,
|
|
100025
|
-
const schema5 = (0,
|
|
100130
|
+
if ((0, import_drizzle_orm8.is)(t, import_pg_core4.PgTable)) {
|
|
100131
|
+
const schema5 = (0, import_pg_core4.getTableConfig)(t).schema || "public";
|
|
100026
100132
|
pgSchema2[schema5] = pgSchema2[schema5] || {};
|
|
100027
100133
|
pgSchema2[schema5][k2] = t;
|
|
100028
100134
|
}
|
|
@@ -100087,8 +100193,8 @@ var init_studio = __esm({
|
|
|
100087
100193
|
Object.entries(schema5).map(([schema6, tables]) => {
|
|
100088
100194
|
Object.entries(tables).map(([, table4]) => {
|
|
100089
100195
|
let tableConfig;
|
|
100090
|
-
if ((0, import_drizzle_orm8.is)(table4,
|
|
100091
|
-
tableConfig = (0,
|
|
100196
|
+
if ((0, import_drizzle_orm8.is)(table4, import_pg_core4.PgTable)) {
|
|
100197
|
+
tableConfig = (0, import_pg_core4.getTableConfig)(table4);
|
|
100092
100198
|
} else if ((0, import_drizzle_orm8.is)(table4, import_mysql_core4.MySqlTable)) {
|
|
100093
100199
|
tableConfig = (0, import_mysql_core4.getTableConfig)(table4);
|
|
100094
100200
|
} else {
|
package/cli/validations/cli.d.ts
CHANGED
|
@@ -100,7 +100,7 @@ export declare const pullParams: import("zod").ZodObject<{
|
|
|
100
100
|
authToken: import("zod").ZodOptional<import("zod").ZodString>;
|
|
101
101
|
introspectCasing: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodLiteral<"camel">, import("zod").ZodLiteral<"preserve">]>>;
|
|
102
102
|
breakpoints: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodBoolean>>;
|
|
103
|
-
}, "
|
|
103
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
104
104
|
dialect?: "mysql" | "postgresql" | "sqlite" | undefined;
|
|
105
105
|
url?: string | undefined;
|
|
106
106
|
host?: string | undefined;
|
package/package.json
CHANGED
package/payload.js
CHANGED
|
@@ -5550,7 +5550,7 @@ var init_cli = __esm({
|
|
|
5550
5550
|
authToken: stringType().optional(),
|
|
5551
5551
|
introspectCasing: casing,
|
|
5552
5552
|
breakpoints: booleanType().optional().default(true)
|
|
5553
|
-
})
|
|
5553
|
+
});
|
|
5554
5554
|
configCheck = objectType({
|
|
5555
5555
|
dialect: dialect3.optional(),
|
|
5556
5556
|
out: stringType().optional()
|
package/payload.mjs
CHANGED
|
@@ -5556,7 +5556,7 @@ var init_cli = __esm({
|
|
|
5556
5556
|
authToken: stringType().optional(),
|
|
5557
5557
|
introspectCasing: casing,
|
|
5558
5558
|
breakpoints: booleanType().optional().default(true)
|
|
5559
|
-
})
|
|
5559
|
+
});
|
|
5560
5560
|
configCheck = objectType({
|
|
5561
5561
|
dialect: dialect3.optional(),
|
|
5562
5562
|
out: stringType().optional()
|