mutano 2.6.2 → 2.6.4
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 +1 -1
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
|
@@ -396,7 +396,7 @@ export interface ${camelCase(table, { pascalCase: true })} {`;
|
|
|
396
396
|
kyselyType = `Generated<${kyselyType}>`;
|
|
397
397
|
}
|
|
398
398
|
} else if (isJsonField) {
|
|
399
|
-
kyselyType = "Json";
|
|
399
|
+
kyselyType = isNullable ? "Json | null" : "Json";
|
|
400
400
|
} else {
|
|
401
401
|
if (isNullable && !isJsonField) {
|
|
402
402
|
if (!kyselyType.includes("| null")) {
|
|
@@ -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 = [];
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mutano",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.6.
|
|
4
|
+
"version": "2.6.4",
|
|
5
5
|
"description": "Converts Prisma/MySQL/PostgreSQL/SQLite schemas to Zod/TS/Kysely interfaces",
|
|
6
6
|
"author": "Alisson Cavalcante Agiani <thelinuxlich@gmail.com>",
|
|
7
7
|
"license": "MIT",
|