mutano 2.6.3 → 2.6.5
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/dist/main.d.ts +1 -1
- package/dist/main.js +6 -2
- package/package.json +31 -31
package/dist/main.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface GenerateContentParams {
|
|
|
13
13
|
defaultZodHeader: string;
|
|
14
14
|
}
|
|
15
15
|
export declare function generateContent({ table, describes, config, destination, isCamelCase, enumDeclarations, defaultZodHeader, }: GenerateContentParams): string;
|
|
16
|
-
export declare const defaultKyselyHeader = "import {
|
|
16
|
+
export declare const defaultKyselyHeader = "import { ColumnType, Selectable, Insertable, Updateable } from 'kysely';\n\n";
|
|
17
17
|
export declare const defaultZodHeader = "import { z } from 'zod';\n\n";
|
|
18
18
|
export declare function generate(config: Config): Promise<Record<string, string>>;
|
|
19
19
|
type MySQLValidTypes = 'date' | 'datetime' | 'timestamp' | 'time' | 'year' | 'char' | 'varchar' | 'tinytext' | 'text' | 'mediumtext' | 'longtext' | 'json' | 'decimal' | 'tinyint' | 'smallint' | 'mediumint' | 'int' | 'bigint' | 'float' | 'double' | 'enum';
|
package/dist/main.js
CHANGED
|
@@ -573,7 +573,7 @@ export type Selectable${camelCase(`${table}Type`, {
|
|
|
573
573
|
}
|
|
574
574
|
return content;
|
|
575
575
|
}
|
|
576
|
-
const defaultKyselyHeader = "import {
|
|
576
|
+
const defaultKyselyHeader = "import { ColumnType, Selectable, Insertable, Updateable } from 'kysely';\n\n";
|
|
577
577
|
const defaultZodHeader = "import { z } from 'zod';\n\n";
|
|
578
578
|
async function generate(config) {
|
|
579
579
|
let tables = [];
|
|
@@ -667,7 +667,7 @@ async function generate(config) {
|
|
|
667
667
|
});
|
|
668
668
|
}
|
|
669
669
|
let describes = [];
|
|
670
|
-
for (let table of tables) {
|
|
670
|
+
for (let table of tables.sort((a, b) => a.localeCompare(b))) {
|
|
671
671
|
if (config.origin.type === "mysql" && db) {
|
|
672
672
|
const d = await db.raw(`SHOW FULL COLUMNS FROM ${table}`);
|
|
673
673
|
describes = d[0];
|
|
@@ -873,6 +873,10 @@ export type JsonPrimitive = boolean | number | string | null;
|
|
|
873
873
|
|
|
874
874
|
export type JsonValue = JsonArray | JsonObject | JsonPrimitive;
|
|
875
875
|
|
|
876
|
+
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U>
|
|
877
|
+
? ColumnType<S, I | undefined, U>
|
|
878
|
+
: ColumnType<T, T | undefined, T>
|
|
879
|
+
|
|
876
880
|
export type Decimal = ColumnType<string, number | string, number | string>
|
|
877
881
|
|
|
878
882
|
export type BigInt = ColumnType<string, number | string, number | string>
|
package/package.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
2
|
+
"name": "mutano",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "2.6.5",
|
|
5
|
+
"description": "Converts Prisma/MySQL/PostgreSQL/SQLite schemas to Zod/TS/Kysely interfaces",
|
|
6
|
+
"author": "Alisson Cavalcante Agiani <thelinuxlich@gmail.com>",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": "git@github.com:thelinuxlich/mutano.git",
|
|
9
|
+
"main": "dist/main.js",
|
|
10
|
+
"types": "dist/main.d.ts",
|
|
11
|
+
"files": ["dist"],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "esbuild src/main.ts --format=esm --platform=node --outfile=dist/main.js && tsc src/main.ts -d --emitDeclarationOnly --esModuleInterop --outDir dist",
|
|
14
|
+
"test": "vitest run"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@mrleebo/prisma-ast": "^0.12.1",
|
|
18
|
+
"camelcase": "^8.0.0",
|
|
19
|
+
"fs-extra": "^11.3.0",
|
|
20
|
+
"knex": "^3.1.0",
|
|
21
|
+
"mysql2": "^3.14.1",
|
|
22
|
+
"pg": "^8.16.0",
|
|
23
|
+
"sqlite3": "^5.1.7"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/fs-extra": "^11.0.4",
|
|
27
|
+
"esbuild": "^0.25.4",
|
|
28
|
+
"ts-node": "^10.9.2",
|
|
29
|
+
"tsx": "^4.19.4",
|
|
30
|
+
"typescript": "^5.8.3",
|
|
31
|
+
"vitest": "^3.1.3"
|
|
32
|
+
}
|
|
33
33
|
}
|