From 7b59d02fdee96e3af2227f2ebddc656de9ece2dc Mon Sep 17 00:00:00 2001 From: Logan Snow <4197432+lsnow99@users.noreply.github.com> Date: Sat, 17 Feb 2024 20:06:43 -0500 Subject: [PATCH 01/23] feat: runtime enum support --- src/ast/export-statement-node.ts | 13 +++- src/ast/index.ts | 1 + src/ast/node-type.ts | 1 + src/ast/runtime-enum-declaration-node.ts | 13 ++++ src/cli/cli.test.ts | 1 + src/cli/cli.ts | 5 ++ src/generator/generator.ts | 4 +- src/serializer/serializer.test.ts | 25 +++++++ src/serializer/serializer.ts | 41 +++++++++++ src/transformer/symbol-collection.ts | 2 + src/transformer/transformer.test.ts | 92 +++++++++++++++++++++++- src/transformer/transformer.ts | 34 ++++++++- 12 files changed, 225 insertions(+), 7 deletions(-) create mode 100644 src/ast/runtime-enum-declaration-node.ts diff --git a/src/ast/export-statement-node.ts b/src/ast/export-statement-node.ts index 3a7830b..f99346f 100644 --- a/src/ast/export-statement-node.ts +++ b/src/ast/export-statement-node.ts @@ -1,12 +1,21 @@ import type { AliasDeclarationNode } from './alias-declaration-node'; import type { InterfaceDeclarationNode } from './interface-declaration-node'; import { NodeType } from './node-type'; +import type { RuntimeEnumDeclarationNode } from './runtime-enum-declaration-node'; export class ExportStatementNode { - readonly argument: AliasDeclarationNode | InterfaceDeclarationNode; + readonly argument: + | AliasDeclarationNode + | InterfaceDeclarationNode + | RuntimeEnumDeclarationNode; readonly type = NodeType.EXPORT_STATEMENT; - constructor(argument: AliasDeclarationNode | InterfaceDeclarationNode) { + constructor( + argument: + | AliasDeclarationNode + | InterfaceDeclarationNode + | RuntimeEnumDeclarationNode, + ) { this.argument = argument; } } diff --git a/src/ast/index.ts b/src/ast/index.ts index 0b152ee..69d6ef2 100644 --- a/src/ast/index.ts +++ b/src/ast/index.ts @@ -18,6 +18,7 @@ export * from './module-reference-node'; export * from './node-type'; export * from './object-expression-node'; export * from './property-node'; +export * from './runtime-enum-declaration-node'; export * from './statement-node'; export * from './template-node'; export * from './union-expression-node'; diff --git a/src/ast/node-type.ts b/src/ast/node-type.ts index fec65d6..5810cdc 100644 --- a/src/ast/node-type.ts +++ b/src/ast/node-type.ts @@ -14,6 +14,7 @@ export const enum NodeType { MODULE_REFERENCE = 'ModuleReference', OBJECT_EXPRESSION = 'ObjectExpression', PROPERTY = 'Property', + RUNTIME_ENUM_DECLARATION = 'RuntimeEnumDeclaration', TEMPLATE = 'Template', UNION_EXPRESSION = 'UnionExpression', VALUE = 'Value', diff --git a/src/ast/runtime-enum-declaration-node.ts b/src/ast/runtime-enum-declaration-node.ts new file mode 100644 index 0000000..cc07f91 --- /dev/null +++ b/src/ast/runtime-enum-declaration-node.ts @@ -0,0 +1,13 @@ +import type { ExpressionNode } from './expression-node'; +import { NodeType } from './node-type'; + +export class RuntimeEnumDeclarationNode { + readonly body: ExpressionNode; + readonly name: string; + readonly type = NodeType.RUNTIME_ENUM_DECLARATION; + + constructor(name: string, body: ExpressionNode) { + this.name = name; + this.body = body; + } +} diff --git a/src/cli/cli.test.ts b/src/cli/cli.test.ts index 777a593..b3b8e45 100644 --- a/src/cli/cli.test.ts +++ b/src/cli/cli.test.ts @@ -17,6 +17,7 @@ export const testCli = () => { logLevel: DEFAULT_LOG_LEVEL, outFile: DEFAULT_OUT_FILE, print: false, + runtimeEnums: false, schema: undefined, typeOnlyImports: true, url: DEFAULT_URL, diff --git a/src/cli/cli.ts b/src/cli/cli.ts index ae176a1..06ea09e 100644 --- a/src/cli/cli.ts +++ b/src/cli/cli.ts @@ -25,6 +25,7 @@ export type CliOptions = { logLevel?: LogLevel; outFile?: string | undefined; print?: boolean; + runtimeEnums?: boolean; schema?: string | undefined; typeOnlyImports?: boolean; url: string; @@ -42,6 +43,7 @@ export class Cli { const outFile = options.outFile; const excludePattern = options.excludePattern; const includePattern = options.includePattern; + const runtimeEnums = options.runtimeEnums; const schema = options.schema; const typeOnlyImports = options.typeOnlyImports; @@ -82,6 +84,7 @@ export class Cli { includePattern, logger, outFile, + runtimeEnums, schema, typeOnlyImports, verify: options.verify, @@ -158,6 +161,7 @@ export class Cli { (argv['out-file'] as string | undefined) ?? (argv.print ? undefined : DEFAULT_OUT_FILE); const print = this.#parseBoolean(argv.print); + const runtimeEnums = this.#parseBoolean(argv.runtimeEnums); const schema = argv.schema as string | undefined; const typeOnlyImports = this.#parseBoolean( argv['type-only-imports'] ?? true, @@ -219,6 +223,7 @@ export class Cli { logLevel, outFile, print, + runtimeEnums, schema, typeOnlyImports, url, diff --git a/src/generator/generator.ts b/src/generator/generator.ts index 586b990..95094c6 100644 --- a/src/generator/generator.ts +++ b/src/generator/generator.ts @@ -16,6 +16,7 @@ export type GenerateOptions = { logger?: Logger; outFile?: string; print?: boolean; + runtimeEnums?: boolean; schema?: string; serializer?: Serializer; transformer?: Transformer; @@ -53,11 +54,12 @@ export class Generator { defaultSchema: options.schema, dialect: options.dialect, metadata, + runtimeEnums: !!options.runtimeEnums, }); const serializer = options.serializer ?? - new Serializer({ typeOnlyImports: options.typeOnlyImports }); + new Serializer({ typeOnlyImports: options.typeOnlyImports, camelCase: !!options.camelCase }); const data = serializer.serialize(nodes); const relativeOutDir = options.outFile diff --git a/src/serializer/serializer.test.ts b/src/serializer/serializer.test.ts index 5035d05..02ee2ca 100644 --- a/src/serializer/serializer.test.ts +++ b/src/serializer/serializer.test.ts @@ -14,6 +14,7 @@ import { MappedTypeNode, ObjectExpressionNode, PropertyNode, + RuntimeEnumDeclarationNode, TemplateNode, UnionExpressionNode, } from '../ast'; @@ -289,6 +290,7 @@ export const testSerializer = () => { ], enums, ), + runtimeEnums: false, }); strictEqual( @@ -345,6 +347,7 @@ export const testSerializer = () => { ], enums, ), + runtimeEnums: false, }); strictEqual( @@ -371,5 +374,27 @@ export const testSerializer = () => { ); }); }); + + void describe('serialize', () => { + const enumSerializer = new Serializer({ camelCase: true }); + void it('should serialize runtime enums properly', () => + strictEqual( + enumSerializer.serializeRuntimeEnum( + new RuntimeEnumDeclarationNode( + 'Mood', + new UnionExpressionNode([ + new LiteralNode('sad'), + new LiteralNode('happy'), + new LiteralNode('happy_or_sad'), + ]), + ), + ), + 'enum Mood {\n' + + ' happy = "happy",\n' + + ' happyOrSad = "happy_or_sad",\n' + + ' sad = "sad",\n' + + '}\n', + )); + }); }); }; diff --git a/src/serializer/serializer.ts b/src/serializer/serializer.ts index cc9afa8..2516868 100644 --- a/src/serializer/serializer.ts +++ b/src/serializer/serializer.ts @@ -14,15 +14,18 @@ import type { MappedTypeNode, ObjectExpressionNode, PropertyNode, + RuntimeEnumDeclarationNode, StatementNode, UnionExpressionNode, } from '../ast'; import { NodeType } from '../ast'; +import { toCamelCase } from '../transformer'; const IDENTIFIER_REGEXP = /^[$A-Z_a-z][\w$]*$/; export type SerializerOptions = { typeOnlyImports?: boolean; + camelCase?: boolean; }; /** @@ -30,9 +33,11 @@ export type SerializerOptions = { */ export class Serializer { readonly typeOnlyImports: boolean; + readonly camelCase: boolean; constructor(options: SerializerOptions = {}) { this.typeOnlyImports = options.typeOnlyImports ?? true; + this.camelCase = options.camelCase ?? false; } serialize(nodes: StatementNode[]) { @@ -65,6 +70,39 @@ export class Serializer { return data; } + serializeRuntimeEnum(node: RuntimeEnumDeclarationNode) { + let data = 'enum '; + data += node.name; + data += ' {\n'; + + if (node.body.type === NodeType.UNION_EXPRESSION) { + const sortedArgs = node.body.args.sort((a, b) => + (a as LiteralNode).value.localeCompare( + (b as LiteralNode).value, + ), + ); + for (const arg of sortedArgs) { + if (arg.type === NodeType.LITERAL && typeof arg.value === 'string') { + const serializedArg = this.serializeLiteral(arg); + const enumValueName = this.camelCase + ? toCamelCase(arg.value) + : arg.value; + data += ' '; + data += enumValueName; + data += ' = '; + data += serializedArg; + data += ','; + data += '\n'; + } + } + } + + data += '}'; + data += '\n'; + + return data; + } + serializeAliasDeclaration(node: AliasDeclarationNode) { const expression = node.body.type === NodeType.TEMPLATE ? node.body.expression : node.body; @@ -127,6 +165,9 @@ export class Serializer { case NodeType.INTERFACE_DECLARATION: data += this.serializeInterfaceDeclaration(node.argument); break; + case NodeType.RUNTIME_ENUM_DECLARATION: + data += this.serializeRuntimeEnum(node.argument); + break; } return data; diff --git a/src/transformer/symbol-collection.ts b/src/transformer/symbol-collection.ts index a1cbb8d..9539a9a 100644 --- a/src/transformer/symbol-collection.ts +++ b/src/transformer/symbol-collection.ts @@ -12,10 +12,12 @@ export type SymbolNameMap = { export type SymbolNode = | { node: ExpressionNode | TemplateNode; type: SymbolType.DEFINITION } | { node: ModuleReferenceNode; type: SymbolType.MODULE_REFERENCE } + | { node: ExpressionNode; type: SymbolType.RUNTIME_ENUM_DEFINITION } | { type: SymbolType.TABLE }; export const enum SymbolType { DEFINITION = 'Definition', + RUNTIME_ENUM_DEFINITION = 'RuntimeEnumDefinition', MODULE_REFERENCE = 'ModuleReference', TABLE = 'Table', } diff --git a/src/transformer/transformer.test.ts b/src/transformer/transformer.test.ts index e48b3cb..e03bae3 100644 --- a/src/transformer/transformer.test.ts +++ b/src/transformer/transformer.test.ts @@ -11,6 +11,7 @@ import { LiteralNode, ObjectExpressionNode, PropertyNode, + RuntimeEnumDeclarationNode, UnionExpressionNode, } from '../ast'; import { @@ -31,11 +32,20 @@ export const testTransformer = () => { 'public.mood_': ['', ',', "'", "'','"], }); - const transform = (tables: TableMetadata[], camelCase: boolean) => { + const transform = ( + tables: TableMetadata[], + camelCase: boolean, + runtimeEnums: boolean, + ) => { const dialect = new PostgresDialect(); const transformer = new Transformer(); const metadata = new DatabaseMetadata(tables, enums); - return transformer.transform({ camelCase, dialect, metadata }); + return transformer.transform({ + camelCase, + dialect, + metadata, + runtimeEnums, + }); }; void it('should transform correctly', () => { @@ -68,6 +78,7 @@ export const testTransformer = () => { }), ], false, + false, ); deepStrictEqual(nodes, [ @@ -148,6 +159,7 @@ export const testTransformer = () => { }), ], true, + false, ); deepStrictEqual(nodes, [ @@ -200,6 +212,7 @@ export const testTransformer = () => { }), ], false, + false, ); deepStrictEqual(nodes, [ @@ -252,5 +265,80 @@ export const testTransformer = () => { ), ]); }); + + void it('should transform runtime enums correctly', () => { + const nodes = transform( + [ + new TableMetadata({ + columns: [ + new ColumnMetadata({ + dataType: 'mood', + hasDefaultValue: false, + name: 'column1', + }), + new ColumnMetadata({ + dataType: 'mood_', + hasDefaultValue: true, + name: 'column2', + }), + ], + name: 'table', + schema: 'public', + }), + ], + false, + true, + ); + + deepStrictEqual(nodes, [ + new ImportStatementNode('kysely', [new ImportClauseNode('ColumnType')]), + new ExportStatementNode( + new RuntimeEnumDeclarationNode( + 'Mood', + new UnionExpressionNode([ + new LiteralNode('happy'), + new LiteralNode('ok'), + new LiteralNode('sad'), + ]), + ), + ), + new ExportStatementNode( + new RuntimeEnumDeclarationNode( + 'Mood2', + new UnionExpressionNode([ + new LiteralNode(''), + new LiteralNode(','), + new LiteralNode("'"), + new LiteralNode("'','"), + ]), + ), + ), + new ExportStatementNode( + new AliasDeclarationNode('Generated', GLOBAL_DEFINITIONS.Generated), + ), + new ExportStatementNode( + new InterfaceDeclarationNode( + 'Table', + new ObjectExpressionNode([ + new PropertyNode('column1', new IdentifierNode('Mood')), + new PropertyNode( + 'column2', + new GenericExpressionNode('Generated', [ + new IdentifierNode('Mood2'), + ]), + ), + ]), + ), + ), + new ExportStatementNode( + new InterfaceDeclarationNode( + 'DB', + new ObjectExpressionNode([ + new PropertyNode('table', new IdentifierNode('Table')), + ]), + ), + ), + ]); + }); }); }; diff --git a/src/transformer/transformer.ts b/src/transformer/transformer.ts index 7f24151..e02fd8f 100644 --- a/src/transformer/transformer.ts +++ b/src/transformer/transformer.ts @@ -12,6 +12,7 @@ import { NodeType, ObjectExpressionNode, PropertyNode, + RuntimeEnumDeclarationNode, UnionExpressionNode, } from '../ast'; import type { @@ -48,6 +49,7 @@ export type TransformContext = { enums: EnumCollection; imports: Imports; metadata: DatabaseMetadata; + runtimeEnums: boolean; scalars: Scalars; symbols: SymbolCollection; }; @@ -57,6 +59,7 @@ export type TransformOptions = { defaultSchema?: string; dialect: Dialect; metadata: DatabaseMetadata; + runtimeEnums: boolean; }; /** @@ -158,6 +161,7 @@ export class Transformer { ...options.dialect.adapter.imports, }, metadata: options.metadata, + runtimeEnums: options.runtimeEnums, scalars: { ...options.dialect.adapter.scalars, }, @@ -186,6 +190,22 @@ export class Transformer { return new ExportStatementNode(argument); } + #createRuntimeEnumDefinitionNodes(context: TransformContext) { + const runtimeEnumDefinitionNodes: ExportStatementNode[] = []; + + for (const { name, symbol } of context.symbols.entries()) { + if (symbol.type === SymbolType.RUNTIME_ENUM_DEFINITION) { + const argument = new RuntimeEnumDeclarationNode(name, symbol.node); + const runtimeEnumDefinitionNode = new ExportStatementNode(argument); + runtimeEnumDefinitionNodes.push(runtimeEnumDefinitionNode); + } + } + + return runtimeEnumDefinitionNodes.sort((a, b) => + a.argument.name.localeCompare(b.argument.name), + ); + } + #createDefinitionNodes(context: TransformContext) { const definitionNodes: ExportStatementNode[] = []; @@ -285,7 +305,9 @@ export class Transformer { const enumNode = unionize(this.#transformEnum(enumValues)); const symbolName = context.symbols.set(symbolId, { node: enumNode, - type: SymbolType.DEFINITION, + type: context.runtimeEnums + ? SymbolType.RUNTIME_ENUM_DEFINITION + : SymbolType.DEFINITION, }); const node = new IdentifierNode(symbolName); return [node]; @@ -346,9 +368,17 @@ export class Transformer { const context = this.#createContext(options); const tableNodes = this.#transformTables(context); const importNodes = this.#createImportNodes(context); + const runtimeEnumDefinitionNodes = + this.#createRuntimeEnumDefinitionNodes(context); const definitionNodes = this.#createDefinitionNodes(context); const databaseNode = this.#createDatabaseExportNode(context); - return [...importNodes, ...definitionNodes, ...tableNodes, databaseNode]; + return [ + ...importNodes, + ...runtimeEnumDefinitionNodes, + ...definitionNodes, + ...tableNodes, + databaseNode, + ]; } } From c8e4a3e14abd3f71dbffb21efdea10c9af191db2 Mon Sep 17 00:00:00 2001 From: Logan Snow <4197432+lsnow99@users.noreply.github.com> Date: Sat, 17 Feb 2024 20:34:20 -0500 Subject: [PATCH 02/23] add cli flag description --- src/cli/flags.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cli/flags.ts b/src/cli/flags.ts index 8d2b4d0..b613ac7 100644 --- a/src/cli/flags.ts +++ b/src/cli/flags.ts @@ -51,6 +51,10 @@ export const FLAGS: Flag[] = [ description: 'Print the generated output to the terminal.', longName: 'print', }, + { + description: 'Generate runtime enums instead of string unions.', + longName: 'runtime-enums', + }, { description: 'Generate TypeScript 3.8+ `import type` syntax (default: true).', From d6a9b951bfccdea9446ded9229e29521dab37c22 Mon Sep 17 00:00:00 2001 From: Logan Snow <4197432+lsnow99@users.noreply.github.com> Date: Sat, 17 Feb 2024 20:40:13 -0500 Subject: [PATCH 03/23] support single enum value --- src/cli/cli.ts | 2 +- src/serializer/serializer.test.ts | 2 +- src/serializer/serializer.ts | 42 ++++++++++++++++--------------- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/cli/cli.ts b/src/cli/cli.ts index 06ea09e..5ad48e5 100644 --- a/src/cli/cli.ts +++ b/src/cli/cli.ts @@ -161,7 +161,7 @@ export class Cli { (argv['out-file'] as string | undefined) ?? (argv.print ? undefined : DEFAULT_OUT_FILE); const print = this.#parseBoolean(argv.print); - const runtimeEnums = this.#parseBoolean(argv.runtimeEnums); + const runtimeEnums = this.#parseBoolean(argv['runtime-enums']); const schema = argv.schema as string | undefined; const typeOnlyImports = this.#parseBoolean( argv['type-only-imports'] ?? true, diff --git a/src/serializer/serializer.test.ts b/src/serializer/serializer.test.ts index 02ee2ca..adb8d1a 100644 --- a/src/serializer/serializer.test.ts +++ b/src/serializer/serializer.test.ts @@ -393,7 +393,7 @@ export const testSerializer = () => { ' happy = "happy",\n' + ' happyOrSad = "happy_or_sad",\n' + ' sad = "sad",\n' + - '}\n', + '}', )); }); }); diff --git a/src/serializer/serializer.ts b/src/serializer/serializer.ts index 2516868..6f4f936 100644 --- a/src/serializer/serializer.ts +++ b/src/serializer/serializer.ts @@ -75,30 +75,32 @@ export class Serializer { data += node.name; data += ' {\n'; - if (node.body.type === NodeType.UNION_EXPRESSION) { - const sortedArgs = node.body.args.sort((a, b) => - (a as LiteralNode).value.localeCompare( - (b as LiteralNode).value, - ), - ); - for (const arg of sortedArgs) { - if (arg.type === NodeType.LITERAL && typeof arg.value === 'string') { - const serializedArg = this.serializeLiteral(arg); - const enumValueName = this.camelCase - ? toCamelCase(arg.value) - : arg.value; - data += ' '; - data += enumValueName; - data += ' = '; - data += serializedArg; - data += ','; - data += '\n'; - } + const args = + node.body.type === NodeType.UNION_EXPRESSION + ? node.body.args + : [node.body]; + const sortedArgs = args.sort((a, b) => + (a as LiteralNode).value.localeCompare( + (b as LiteralNode).value, + ), + ); + + for (const arg of sortedArgs) { + if (arg.type === NodeType.LITERAL && typeof arg.value === 'string') { + const serializedArg = this.serializeLiteral(arg); + const enumValueName = this.camelCase + ? toCamelCase(arg.value) + : arg.value; + data += ' '; + data += enumValueName; + data += ' = '; + data += serializedArg; + data += ','; + data += '\n'; } } data += '}'; - data += '\n'; return data; } From 0ebd72a0cdf0296564a2b50ea4705bbfbdca8843 Mon Sep 17 00:00:00 2001 From: Robin Clowers Date: Fri, 8 Mar 2024 12:22:09 -0800 Subject: [PATCH 04/23] feat: add skip-domains flag --- src/cli/cli.ts | 5 ++++- src/cli/flags.ts | 5 +++++ src/core/dialect-manager.ts | 12 +++++++++++- src/core/e2e.test.ts | 2 +- src/dialects/postgres/postgres-dialect.ts | 13 ++++++++++++- src/dialects/postgres/postgres-introspector.ts | 11 ++++++++++- src/serializer/serializer.test.ts | 2 +- src/transformer/transformer.test.ts | 2 +- 8 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/cli/cli.ts b/src/cli/cli.ts index ae176a1..7d2166c 100644 --- a/src/cli/cli.ts +++ b/src/cli/cli.ts @@ -26,6 +26,7 @@ export type CliOptions = { outFile?: string | undefined; print?: boolean; schema?: string | undefined; + skipDomains?: boolean; typeOnlyImports?: boolean; url: string; verify?: boolean | undefined; @@ -62,7 +63,9 @@ export class Cli { logger.info(`No dialect specified. Assuming '${inferredDialectName}'.`); } - const dialectManager = new DialectManager(); + const dialectManager = new DialectManager({ + skipDomains: options.skipDomains ?? false, + }); const dialect = dialectManager.getDialect( options.dialectName ?? inferredDialectName, ); diff --git a/src/cli/flags.ts b/src/cli/flags.ts index 8d2b4d0..dbaa2db 100644 --- a/src/cli/flags.ts +++ b/src/cli/flags.ts @@ -66,6 +66,11 @@ export const FLAGS: Flag[] = [ description: 'Set the default schema of the database connection.', longName: 'schema', }, + { + description: + 'Skip generating type information for postgres domains. (default: false)', + longName: 'skip-domains', + }, { description: 'Verify that the generated types are up-to-date. (default: false)', diff --git a/src/core/dialect-manager.ts b/src/core/dialect-manager.ts index c094224..cbbdc02 100644 --- a/src/core/dialect-manager.ts +++ b/src/core/dialect-manager.ts @@ -16,10 +16,20 @@ export type DialectName = | 'postgres' | 'sqlite'; +export type DialectManagerOptions = { + skipDomains: boolean; +}; + /** * Returns a dialect instance for a pre-defined dialect name. */ export class DialectManager { + readonly #options: DialectManagerOptions; + + constructor(opts: DialectManagerOptions) { + this.#options = opts; + } + getDialect(name: DialectName): Dialect { switch (name) { case 'bun-sqlite': @@ -31,7 +41,7 @@ export class DialectManager { case 'mysql': return new MysqlDialect(); case 'postgres': - return new PostgresDialect(); + return new PostgresDialect(this.#options); default: return new SqliteDialect(); } diff --git a/src/core/e2e.test.ts b/src/core/e2e.test.ts index a516552..bcc60c7 100644 --- a/src/core/e2e.test.ts +++ b/src/core/e2e.test.ts @@ -35,7 +35,7 @@ const TESTS: Test[] = [ }, { connectionString: 'postgres://user:password@localhost:5433/database', - dialect: new PostgresDialect(), + dialect: new PostgresDialect({ skipDomains: false }), values: { false: false, id: 1, true: true }, }, { diff --git a/src/dialects/postgres/postgres-dialect.ts b/src/dialects/postgres/postgres-dialect.ts index 78a513c..637f560 100644 --- a/src/dialects/postgres/postgres-dialect.ts +++ b/src/dialects/postgres/postgres-dialect.ts @@ -4,9 +4,20 @@ import { Dialect } from '../../core'; import { PostgresAdapter } from './postgres-adapter'; import { PostgresIntrospector } from './postgres-introspector'; +export type PostgresDialectOptions = { + skipDomains: boolean; +}; + export class PostgresDialect extends Dialect { + readonly #options: PostgresDialectOptions; readonly adapter = new PostgresAdapter(); - readonly introspector = new PostgresIntrospector(this.adapter); + readonly introspector; + + constructor(opts: PostgresDialectOptions) { + super(); + this.#options = opts; + this.introspector = new PostgresIntrospector(this.adapter, this.#options); + } async createKyselyDialect(options: CreateKyselyDialectOptions) { const { Pool } = await import('pg'); diff --git a/src/dialects/postgres/postgres-introspector.ts b/src/dialects/postgres/postgres-introspector.ts index 1a8cae6..32cb0a4 100644 --- a/src/dialects/postgres/postgres-introspector.ts +++ b/src/dialects/postgres/postgres-introspector.ts @@ -17,12 +17,18 @@ type PostgresDomainInspector = { rootType: string; }; +export type PostgresIntrospectorOptions = { + skipDomains: boolean; +}; + export class PostgresIntrospector extends Introspector { readonly adapter: PostgresAdapter; + readonly #options: PostgresIntrospectorOptions; - constructor(adapter: PostgresAdapter) { + constructor(adapter: PostgresAdapter, opts: PostgresIntrospectorOptions) { super(); this.adapter = adapter; + this.#options = opts; } #createDatabaseMetadata( @@ -94,6 +100,9 @@ export class PostgresIntrospector extends Introspector { } async #introspectDomains(db: Kysely) { + if (this.#options.skipDomains) { + return []; + } const result = await sql` with recursive domain_hierarchy as ( select oid, typbasetype diff --git a/src/serializer/serializer.test.ts b/src/serializer/serializer.test.ts index 757c310..4307ebd 100644 --- a/src/serializer/serializer.test.ts +++ b/src/serializer/serializer.test.ts @@ -320,7 +320,7 @@ export const testSerializer = () => { void describe('serialize', () => { void it('should serialize Postgres JSON fields properly', () => { - const dialect = new PostgresDialect(); + const dialect = new PostgresDialect({ skipDomains: false }); const enums = new EnumCollection(); const transformer = new Transformer(); diff --git a/src/transformer/transformer.test.ts b/src/transformer/transformer.test.ts index 0220f7d..c6cde8a 100644 --- a/src/transformer/transformer.test.ts +++ b/src/transformer/transformer.test.ts @@ -32,7 +32,7 @@ export const testTransformer = () => { }); const transform = (tables: TableMetadata[], camelCase: boolean) => { - const dialect = new PostgresDialect(); + const dialect = new PostgresDialect({ skipDomains: false }); const transformer = new Transformer(); const metadata = new DatabaseMetadata(tables, enums); return transformer.transform({ camelCase, dialect, metadata }); From b0b85d75f2b115ab687200ade08869ebdd14833b Mon Sep 17 00:00:00 2001 From: Johan Eliasson Date: Sun, 17 Mar 2024 13:37:15 +0100 Subject: [PATCH 05/23] column comments --- package.json | 2 +- pnpm-lock.yaml | 20 ++++++++++---------- src/ast/property-node.ts | 4 +++- src/core/metadata/column-metadata.ts | 3 +++ src/serializer/serializer.ts | 10 +++++++++- src/transformer/transformer.ts | 3 ++- 6 files changed, 28 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 3f6ac40..c10f5d8 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "@typescript-eslint/parser": "^7.1.1", "better-sqlite3": "^9.4.3", "eslint": "^8.57.0", - "kysely": "^0.27.2", + "kysely": "^0.27.3", "kysely-bun-worker": "^0.5.7", "mysql2": "^3.9.2", "npm-run-all": "^4.1.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 824bf4b..e132d59 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -36,7 +36,7 @@ dependencies: devDependencies: '@libsql/kysely-libsql': specifier: ^0.3.0 - version: 0.3.0(kysely@0.27.2) + version: 0.3.0(kysely@0.27.3) '@robinblomberg/eslint-config-prettier': specifier: ^0.1.4 version: 0.1.4 @@ -77,11 +77,11 @@ devDependencies: specifier: ^8.57.0 version: 8.57.0 kysely: - specifier: ^0.27.2 - version: 0.27.2 + specifier: ^0.27.3 + version: 0.27.3 kysely-bun-worker: specifier: ^0.5.7 - version: 0.5.7(kysely@0.27.2) + version: 0.5.7(kysely@0.27.3) mysql2: specifier: ^3.9.2 version: 3.9.2 @@ -877,13 +877,13 @@ packages: - utf-8-validate dev: true - /@libsql/kysely-libsql@0.3.0(kysely@0.27.2): + /@libsql/kysely-libsql@0.3.0(kysely@0.27.3): resolution: {integrity: sha512-UEZB2giBFSR0NPwx2a8TxdnBEq20u7LfHupiwFc0t0VXAP1URdrSVv84rjMl/EAEs1tC6/Ex6O+OppwoKoJRbg==} peerDependencies: kysely: '*' dependencies: '@libsql/hrana-client': 0.4.4 - kysely: 0.27.2 + kysely: 0.27.3 transitivePeerDependencies: - bufferutil - encoding @@ -3405,16 +3405,16 @@ packages: json-buffer: 3.0.1 dev: true - /kysely-bun-worker@0.5.7(kysely@0.27.2): + /kysely-bun-worker@0.5.7(kysely@0.27.3): resolution: {integrity: sha512-P4W5moWU6A1xJ2GvGbdrPDiasSKTjuBfItU1vj+wZlA+A6AXv8Nxk0nScuBu8F12UnalrIDDu+oLCF5wC3Z4EA==} peerDependencies: kysely: '>=0.26' dependencies: - kysely: 0.27.2 + kysely: 0.27.3 dev: true - /kysely@0.27.2: - resolution: {integrity: sha512-DmRvEfiR/NLpgsTbSxma2ldekhsdcd65+MNiKXyd/qj7w7X5e3cLkXxcj+MypsRDjPhHQ/CD5u3Eq1sBYzX0bw==} + /kysely@0.27.3: + resolution: {integrity: sha512-lG03Ru+XyOJFsjH3OMY6R/9U38IjDPfnOfDgO3ynhbDr+Dz8fak+X6L62vqu3iybQnj+lG84OttBuU9KY3L9kA==} engines: {node: '>=14.0.0'} dev: true diff --git a/src/ast/property-node.ts b/src/ast/property-node.ts index a21f1ea..e47b9ef 100644 --- a/src/ast/property-node.ts +++ b/src/ast/property-node.ts @@ -5,9 +5,11 @@ export class PropertyNode { readonly key: string; readonly type = NodeType.PROPERTY; readonly value: ExpressionNode; + readonly comment?: string; - constructor(key: string, value: ExpressionNode) { + constructor(key: string, value: ExpressionNode, comment?: string) { this.key = key; this.value = value; + this.comment = comment; } } diff --git a/src/core/metadata/column-metadata.ts b/src/core/metadata/column-metadata.ts index 8382a8a..e9c7d75 100644 --- a/src/core/metadata/column-metadata.ts +++ b/src/core/metadata/column-metadata.ts @@ -7,6 +7,7 @@ export type ColumnMetadataOptions = { isAutoIncrementing?: boolean; isNullable?: boolean; name: string; + comment?: string; }; export class ColumnMetadata { @@ -18,6 +19,7 @@ export class ColumnMetadata { readonly isAutoIncrementing: boolean; readonly isNullable: boolean; readonly name: string; + readonly comment?: string; constructor(options: ColumnMetadataOptions) { this.dataType = options.dataType; @@ -28,5 +30,6 @@ export class ColumnMetadata { this.isAutoIncrementing = options.isAutoIncrementing ?? false; this.isNullable = options.isNullable ?? false; this.name = options.name; + this.comment = options.comment; } } diff --git a/src/serializer/serializer.ts b/src/serializer/serializer.ts index 411b9db..8f663a4 100644 --- a/src/serializer/serializer.ts +++ b/src/serializer/serializer.ts @@ -286,7 +286,6 @@ export class Serializer { ); for (const property of sortedProperties) { - data += ' '; data += this.serializeProperty(property); } } @@ -299,6 +298,15 @@ export class Serializer { serializeProperty(node: PropertyNode) { let data = ''; + console.log('node1:', node); + + if (node.comment) { + data += ` /**\n`; + data += ` * ${node.comment}\n`; + data += ` */\n`; + } + + data += ' '; data += this.serializeKey(node.key); data += ': '; data += this.serializeExpression(node.value); diff --git a/src/transformer/transformer.ts b/src/transformer/transformer.ts index 30c23d7..5c92a22 100644 --- a/src/transformer/transformer.ts +++ b/src/transformer/transformer.ts @@ -322,7 +322,8 @@ export class Transformer { for (const column of table.columns) { const key = this.#transformName(column.name, context); const value = this.#transformColumn(column, context); - const tableProperty = new PropertyNode(key, value); + const comment = column.comment; + const tableProperty = new PropertyNode(key, value, comment); tableProperties.push(tableProperty); } From 633599f3a164fae3330ebfb56f2caa05a3329d2c Mon Sep 17 00:00:00 2001 From: Johan Eliasson Date: Sun, 17 Mar 2024 13:41:04 +0100 Subject: [PATCH 06/23] fix --- src/serializer/serializer.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/serializer/serializer.ts b/src/serializer/serializer.ts index 8f663a4..fd2d8bb 100644 --- a/src/serializer/serializer.ts +++ b/src/serializer/serializer.ts @@ -298,8 +298,6 @@ export class Serializer { serializeProperty(node: PropertyNode) { let data = ''; - console.log('node1:', node); - if (node.comment) { data += ` /**\n`; data += ` * ${node.comment}\n`; From fea605a51e64c0c97cebc261eeb6a2d6b94178b7 Mon Sep 17 00:00:00 2001 From: Robin Blomberg Date: Sun, 17 Mar 2024 21:00:30 +0100 Subject: [PATCH 07/23] feat: adjust API for --no-domains flag --- src/cli/cli.test.ts | 3 +++ src/cli/cli.ts | 24 +++++++++++++------ src/cli/flags.ts | 10 ++++---- src/core/dialect-manager.ts | 6 ++--- src/core/e2e.test.ts | 2 +- src/dialects/postgres/postgres-dialect.ts | 6 ++--- .../postgres/postgres-introspector.ts | 10 +++++--- src/serializer/serializer.test.ts | 2 +- src/transformer/transformer.test.ts | 2 +- 9 files changed, 41 insertions(+), 24 deletions(-) diff --git a/src/cli/cli.test.ts b/src/cli/cli.test.ts index 777a593..c3ce136 100644 --- a/src/cli/cli.test.ts +++ b/src/cli/cli.test.ts @@ -11,6 +11,7 @@ export const testCli = () => { const DEFAULT_CLI_OPTIONS: CliOptions = { camelCase: false, dialectName: undefined, + domains: false, envFile: undefined, excludePattern: undefined, includePattern: undefined, @@ -36,6 +37,8 @@ export const testCli = () => { assert(['--camel-case'], { camelCase: true }); assert(['--dialect=mysql'], { dialectName: 'mysql' }); + assert(['--domains'], { domains: true }); + assert(['--no-domains'], { domains: false }); assert(['--exclude-pattern=public._*'], { excludePattern: 'public._*' }); assert(['--help'], {}); assert(['-h'], {}); diff --git a/src/cli/cli.ts b/src/cli/cli.ts index 7d2166c..64ad382 100644 --- a/src/cli/cli.ts +++ b/src/cli/cli.ts @@ -19,6 +19,7 @@ import { FLAGS } from './flags'; export type CliOptions = { camelCase?: boolean; dialectName?: DialectName | undefined; + domains?: boolean; envFile?: string | undefined; excludePattern?: string | undefined; includePattern?: string | undefined; @@ -26,7 +27,6 @@ export type CliOptions = { outFile?: string | undefined; print?: boolean; schema?: string | undefined; - skipDomains?: boolean; typeOnlyImports?: boolean; url: string; verify?: boolean | undefined; @@ -40,9 +40,9 @@ export type LogLevelName = (typeof LOG_LEVEL_NAMES)[number]; export class Cli { async generate(options: CliOptions) { const camelCase = !!options.camelCase; - const outFile = options.outFile; const excludePattern = options.excludePattern; const includePattern = options.includePattern; + const outFile = options.outFile; const schema = options.schema; const typeOnlyImports = options.typeOnlyImports; @@ -53,8 +53,8 @@ export class Cli { connectionStringParser.parse({ connectionString: options.url ?? DEFAULT_URL, dialectName: options.dialectName, - logger, envFile: options.envFile, + logger, }); if (options.dialectName) { @@ -64,7 +64,7 @@ export class Cli { } const dialectManager = new DialectManager({ - skipDomains: options.skipDomains ?? false, + skipDomains: !!options.domains, }); const dialect = dialectManager.getDialect( options.dialectName ?? inferredDialectName, @@ -151,10 +151,11 @@ export class Cli { const _: string[] = argv._; const camelCase = this.#parseBoolean(argv['camel-case']); const dialectName = argv.dialect; - const help = - !!argv.h || !!argv.help || _.includes('-h') || _.includes('--help'); + const domains = this.#parseBoolean(argv.domains); const envFile = argv['env-file'] as string | undefined; const excludePattern = argv['exclude-pattern'] as string | undefined; + const help = + !!argv.h || !!argv.help || _.includes('-h') || _.includes('--help'); const includePattern = argv['include-pattern'] as string | undefined; const logLevel = this.#getLogLevel(argv['log-level']); const outFile = @@ -172,7 +173,15 @@ export class Cli { for (const key in argv) { if ( key !== '_' && - !FLAGS.some((flag) => [flag.longName, flag.shortName].includes(key)) + !FLAGS.some((flag) => { + return [ + flag.shortName, + flag.longName, + ...(flag.longName.startsWith('no-') + ? [flag.longName.slice(3)] + : []), + ].includes(key); + }) ) { throw new RangeError(`Invalid flag: "${key}"`); } @@ -216,6 +225,7 @@ export class Cli { return { camelCase, dialectName, + domains, envFile, excludePattern, includePattern, diff --git a/src/cli/flags.ts b/src/cli/flags.ts index dbaa2db..317eb07 100644 --- a/src/cli/flags.ts +++ b/src/cli/flags.ts @@ -43,6 +43,11 @@ export const FLAGS: Flag[] = [ 'Set the terminal log level. (values: [debug, info, warn, error, silent], default: warn)', longName: 'log-level', }, + { + description: + 'Skip generating types for PostgreSQL domains. (default: false)', + longName: 'no-domains', + }, { description: `Set the file build path. (default: ${DEFAULT_OUT_FILE})`, longName: 'out-file', @@ -66,11 +71,6 @@ export const FLAGS: Flag[] = [ description: 'Set the default schema of the database connection.', longName: 'schema', }, - { - description: - 'Skip generating type information for postgres domains. (default: false)', - longName: 'skip-domains', - }, { description: 'Verify that the generated types are up-to-date. (default: false)', diff --git a/src/core/dialect-manager.ts b/src/core/dialect-manager.ts index cbbdc02..b64e85e 100644 --- a/src/core/dialect-manager.ts +++ b/src/core/dialect-manager.ts @@ -17,7 +17,7 @@ export type DialectName = | 'sqlite'; export type DialectManagerOptions = { - skipDomains: boolean; + skipDomains?: boolean; }; /** @@ -26,8 +26,8 @@ export type DialectManagerOptions = { export class DialectManager { readonly #options: DialectManagerOptions; - constructor(opts: DialectManagerOptions) { - this.#options = opts; + constructor(options: DialectManagerOptions = {}) { + this.#options = options; } getDialect(name: DialectName): Dialect { diff --git a/src/core/e2e.test.ts b/src/core/e2e.test.ts index bcc60c7..a516552 100644 --- a/src/core/e2e.test.ts +++ b/src/core/e2e.test.ts @@ -35,7 +35,7 @@ const TESTS: Test[] = [ }, { connectionString: 'postgres://user:password@localhost:5433/database', - dialect: new PostgresDialect({ skipDomains: false }), + dialect: new PostgresDialect(), values: { false: false, id: 1, true: true }, }, { diff --git a/src/dialects/postgres/postgres-dialect.ts b/src/dialects/postgres/postgres-dialect.ts index 637f560..a61d6f0 100644 --- a/src/dialects/postgres/postgres-dialect.ts +++ b/src/dialects/postgres/postgres-dialect.ts @@ -5,7 +5,7 @@ import { PostgresAdapter } from './postgres-adapter'; import { PostgresIntrospector } from './postgres-introspector'; export type PostgresDialectOptions = { - skipDomains: boolean; + skipDomains?: boolean; }; export class PostgresDialect extends Dialect { @@ -13,9 +13,9 @@ export class PostgresDialect extends Dialect { readonly adapter = new PostgresAdapter(); readonly introspector; - constructor(opts: PostgresDialectOptions) { + constructor(options: PostgresDialectOptions = {}) { super(); - this.#options = opts; + this.#options = options; this.introspector = new PostgresIntrospector(this.adapter, this.#options); } diff --git a/src/dialects/postgres/postgres-introspector.ts b/src/dialects/postgres/postgres-introspector.ts index 32cb0a4..6e57618 100644 --- a/src/dialects/postgres/postgres-introspector.ts +++ b/src/dialects/postgres/postgres-introspector.ts @@ -18,17 +18,20 @@ type PostgresDomainInspector = { }; export type PostgresIntrospectorOptions = { - skipDomains: boolean; + skipDomains?: boolean; }; export class PostgresIntrospector extends Introspector { readonly adapter: PostgresAdapter; readonly #options: PostgresIntrospectorOptions; - constructor(adapter: PostgresAdapter, opts: PostgresIntrospectorOptions) { + constructor( + adapter: PostgresAdapter, + options: PostgresIntrospectorOptions = {}, + ) { super(); this.adapter = adapter; - this.#options = opts; + this.#options = options; } #createDatabaseMetadata( @@ -103,6 +106,7 @@ export class PostgresIntrospector extends Introspector { if (this.#options.skipDomains) { return []; } + const result = await sql` with recursive domain_hierarchy as ( select oid, typbasetype diff --git a/src/serializer/serializer.test.ts b/src/serializer/serializer.test.ts index 4307ebd..757c310 100644 --- a/src/serializer/serializer.test.ts +++ b/src/serializer/serializer.test.ts @@ -320,7 +320,7 @@ export const testSerializer = () => { void describe('serialize', () => { void it('should serialize Postgres JSON fields properly', () => { - const dialect = new PostgresDialect({ skipDomains: false }); + const dialect = new PostgresDialect(); const enums = new EnumCollection(); const transformer = new Transformer(); diff --git a/src/transformer/transformer.test.ts b/src/transformer/transformer.test.ts index c6cde8a..0220f7d 100644 --- a/src/transformer/transformer.test.ts +++ b/src/transformer/transformer.test.ts @@ -32,7 +32,7 @@ export const testTransformer = () => { }); const transform = (tables: TableMetadata[], camelCase: boolean) => { - const dialect = new PostgresDialect({ skipDomains: false }); + const dialect = new PostgresDialect(); const transformer = new Transformer(); const metadata = new DatabaseMetadata(tables, enums); return transformer.transform({ camelCase, dialect, metadata }); From 997bd93554c4292552c661826a9d9a0b2fcc9752 Mon Sep 17 00:00:00 2001 From: Tim Clark Date: Tue, 12 Mar 2024 08:59:15 -0400 Subject: [PATCH 08/23] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3f6ac40..9ab9a1a 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "mysql2": "^2.3.3 || ^3.0.0", "pg": "^8.8.0", "tarn": "^3.0.0", - "tedious": "^16.6.0" + "tedious": "^16.6.0 || ^17.0.0" }, "peerDependenciesMeta": { "@libsql/kysely-libsql": { From 2b3d30f487e30fa095f2b9e840500e5889d80c68 Mon Sep 17 00:00:00 2001 From: Tim Clark Date: Tue, 12 Mar 2024 09:21:30 -0400 Subject: [PATCH 09/23] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9ab9a1a..61afaf9 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "mysql2": "^2.3.3 || ^3.0.0", "pg": "^8.8.0", "tarn": "^3.0.0", - "tedious": "^16.6.0 || ^17.0.0" + "tedious": "^16.6.0 || ^17.0.0 || ^18.0.0" }, "peerDependenciesMeta": { "@libsql/kysely-libsql": { From 501666254746d83a73ad879326545a72bf6ecb17 Mon Sep 17 00:00:00 2001 From: Tim Clark Date: Tue, 12 Mar 2024 09:34:01 -0400 Subject: [PATCH 10/23] dont support v18 --- package.json | 2 +- pnpm-lock.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 61afaf9..9ab9a1a 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "mysql2": "^2.3.3 || ^3.0.0", "pg": "^8.8.0", "tarn": "^3.0.0", - "tedious": "^16.6.0 || ^17.0.0 || ^18.0.0" + "tedious": "^16.6.0 || ^17.0.0" }, "peerDependenciesMeta": { "@libsql/kysely-libsql": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 824bf4b..97e8873 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -30,7 +30,7 @@ dependencies: specifier: ^3.0.0 version: 3.0.2 tedious: - specifier: ^16.6.0 + specifier: ^16.6.0 || ^17.0.0 version: 16.7.1 devDependencies: @@ -1749,7 +1749,7 @@ packages: dev: true /buffer-equal-constant-time@1.0.1: - resolution: {integrity: sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=} + resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==} dev: false /buffer-from@1.1.2: From 7fb5ef9e63ace2ad84e4ad48b8b504dee065fed7 Mon Sep 17 00:00:00 2001 From: Andrew Rempe Date: Sat, 16 Mar 2024 22:45:46 -0500 Subject: [PATCH 11/23] Set kysely-bun-worker as an optional peer dep --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9ab9a1a..9be8ed0 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "optional": false }, "kysely-bun-worker": { - "optional": false + "optional": true }, "mysql2": { "optional": true From e3676dc0b0584f991c42c594bbaa32b647bb4c46 Mon Sep 17 00:00:00 2001 From: Robin Blomberg Date: Sun, 17 Mar 2024 21:02:26 +0100 Subject: [PATCH 12/23] chore: bump deps --- package.json | 10 +-- pnpm-lock.yaml | 230 ++++++++++++++++++++++++------------------------- 2 files changed, 120 insertions(+), 120 deletions(-) diff --git a/package.json b/package.json index 9be8ed0..31b1c51 100644 --- a/package.json +++ b/package.json @@ -49,19 +49,19 @@ "devDependencies": { "@libsql/kysely-libsql": "^0.3.0", "@robinblomberg/eslint-config-prettier": "^0.1.4", - "@robinblomberg/eslint-config-robinblomberg": "0.26.0", + "@robinblomberg/eslint-config-robinblomberg": "0.27.0", "@robinblomberg/prettier-config": "^0.1.2", "@types/better-sqlite3": "^7.6.9", "@types/git-diff": "^2.0.7", "@types/micromatch": "^4.0.6", "@types/minimist": "^1.2.5", - "@types/node": "^20.11.25", + "@types/node": "^20.11.28", "@types/pg": "^8.11.2", "@types/tedious": "^4.0.14", - "@typescript-eslint/parser": "^7.1.1", + "@typescript-eslint/parser": "^7.2.0", "better-sqlite3": "^9.4.3", "eslint": "^8.57.0", - "kysely": "^0.27.2", + "kysely": "^0.27.3", "kysely-bun-worker": "^0.5.7", "mysql2": "^3.9.2", "npm-run-all": "^4.1.5", @@ -72,7 +72,7 @@ "ts-node-dev": "^2.0.0", "tsx": "^4.7.1", "typescript": "^5.4.2", - "vitest": "^1.3.1" + "vitest": "^1.4.0" }, "peerDependencies": { "@libsql/kysely-libsql": "^0.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 97e8873..5b8dfa7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -36,13 +36,13 @@ dependencies: devDependencies: '@libsql/kysely-libsql': specifier: ^0.3.0 - version: 0.3.0(kysely@0.27.2) + version: 0.3.0(kysely@0.27.3) '@robinblomberg/eslint-config-prettier': specifier: ^0.1.4 version: 0.1.4 '@robinblomberg/eslint-config-robinblomberg': - specifier: 0.26.0 - version: 0.26.0(eslint@8.57.0)(typescript@5.4.2) + specifier: 0.27.0 + version: 0.27.0(eslint@8.57.0)(typescript@5.4.2) '@robinblomberg/prettier-config': specifier: ^0.1.2 version: 0.1.2 @@ -59,8 +59,8 @@ devDependencies: specifier: ^1.2.5 version: 1.2.5 '@types/node': - specifier: ^20.11.25 - version: 20.11.25 + specifier: ^20.11.28 + version: 20.11.28 '@types/pg': specifier: ^8.11.2 version: 8.11.2 @@ -68,8 +68,8 @@ devDependencies: specifier: ^4.0.14 version: 4.0.14 '@typescript-eslint/parser': - specifier: ^7.1.1 - version: 7.1.1(eslint@8.57.0)(typescript@5.4.2) + specifier: ^7.2.0 + version: 7.2.0(eslint@8.57.0)(typescript@5.4.2) better-sqlite3: specifier: ^9.4.3 version: 9.4.3 @@ -77,11 +77,11 @@ devDependencies: specifier: ^8.57.0 version: 8.57.0 kysely: - specifier: ^0.27.2 - version: 0.27.2 + specifier: ^0.27.3 + version: 0.27.3 kysely-bun-worker: specifier: ^0.5.7 - version: 0.5.7(kysely@0.27.2) + version: 0.5.7(kysely@0.27.3) mysql2: specifier: ^3.9.2 version: 3.9.2 @@ -102,7 +102,7 @@ devDependencies: version: 5.0.5 ts-node-dev: specifier: ^2.0.0 - version: 2.0.0(@types/node@20.11.25)(typescript@5.4.2) + version: 2.0.0(@types/node@20.11.28)(typescript@5.4.2) tsx: specifier: ^4.7.1 version: 4.7.1 @@ -110,8 +110,8 @@ devDependencies: specifier: ^5.4.2 version: 5.4.2 vitest: - specifier: ^1.3.1 - version: 1.3.1(@types/node@20.11.25) + specifier: ^1.4.0 + version: 1.4.0(@types/node@20.11.28) packages: @@ -877,13 +877,13 @@ packages: - utf-8-validate dev: true - /@libsql/kysely-libsql@0.3.0(kysely@0.27.2): + /@libsql/kysely-libsql@0.3.0(kysely@0.27.3): resolution: {integrity: sha512-UEZB2giBFSR0NPwx2a8TxdnBEq20u7LfHupiwFc0t0VXAP1URdrSVv84rjMl/EAEs1tC6/Ex6O+OppwoKoJRbg==} peerDependencies: kysely: '*' dependencies: '@libsql/hrana-client': 0.4.4 - kysely: 0.27.2 + kysely: 0.27.3 transitivePeerDependencies: - bufferutil - encoding @@ -928,24 +928,24 @@ packages: resolution: {integrity: sha512-gAGbmxj3fJFS2VQWfhyNCQ/GS96BrEDak+Axh1usVLkibVh7fTPIulR3RkttQP84BT8EP0OF+Uast4pqpDTKzg==} dev: true - /@robinblomberg/eslint-config-robinblomberg@0.26.0(eslint@8.57.0)(typescript@5.4.2): - resolution: {integrity: sha512-RRU1au5VDEUCaa2R9SE1/H6udSDOjB2kpZeYNbc2mBJSEgGGneKDHhx8fwMboApW8Mtz+rWscRmBf8KduDqj6w==} + /@robinblomberg/eslint-config-robinblomberg@0.27.0(eslint@8.57.0)(typescript@5.4.2): + resolution: {integrity: sha512-YgBFXy9DmeVcC4gjK53FEhBDy9Kr+4W7qSoZY1jjTHd+4FhfY50EbCc3dcqbFqfqeFoLA7CfSqJX3dCpdE+UBg==} peerDependencies: eslint: ^8.43.0 typescript: '>=4.2.0' dependencies: '@babel/core': 7.24.0 '@babel/eslint-parser': 7.23.10(@babel/core@7.24.0)(eslint@8.57.0) - '@typescript-eslint/eslint-plugin': 7.1.1(@typescript-eslint/parser@7.1.1)(eslint@8.57.0)(typescript@5.4.2) - '@typescript-eslint/parser': 7.1.1(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/eslint-plugin': 7.2.0(@typescript-eslint/parser@7.2.0)(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/parser': 7.2.0(eslint@8.57.0)(typescript@5.4.2) eslint: 8.57.0 eslint-define-config: 2.1.0 - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.1.1)(eslint@8.57.0) - eslint-plugin-jsdoc: 48.2.0(eslint@8.57.0) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.2.0)(eslint@8.57.0) + eslint-plugin-jsdoc: 48.2.1(eslint@8.57.0) eslint-plugin-jsx-a11y: 6.8.0(eslint@8.57.0) - eslint-plugin-react: 7.34.0(eslint@8.57.0) + eslint-plugin-react: 7.34.1(eslint@8.57.0) eslint-plugin-react-hooks: 4.6.0(eslint@8.57.0) - eslint-plugin-react-refresh: 0.4.5(eslint@8.57.0) + eslint-plugin-react-refresh: 0.4.6(eslint@8.57.0) eslint-plugin-sonarjs: 0.24.0(eslint@8.57.0) eslint-plugin-sort-exports: 0.9.1(eslint@8.57.0) eslint-plugin-sort-keys: 2.3.5 @@ -1106,7 +1106,7 @@ packages: /@types/better-sqlite3@7.6.9: resolution: {integrity: sha512-FvktcujPDj9XKMJQWFcl2vVl7OdRIqsSRX9b0acWwTmwLK9CF2eqo/FRcmMLNpugKoX/avA6pb7TorDLmpgTnQ==} dependencies: - '@types/node': 20.11.25 + '@types/node': 20.11.28 dev: true /@types/braces@3.0.4: @@ -1142,12 +1142,12 @@ packages: /@types/node-fetch@2.6.11: resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==} dependencies: - '@types/node': 20.11.25 + '@types/node': 20.11.28 form-data: 4.0.0 dev: true - /@types/node@20.11.25: - resolution: {integrity: sha512-TBHyJxk2b7HceLVGFcpAUjsa5zIdsPWlR6XHfyGzd0SFu+/NFgQgMAl96MSDZgQDvJAvV6BKsFOrt6zIL09JDw==} + /@types/node@20.11.28: + resolution: {integrity: sha512-M/GPWVS2wLkSkNHVeLkrF2fD5Lx5UC4PxA0uZcKc6QqbIQUJyW1jVjueJYi1z8n0I5PxYrtpnPnWglE+y9A0KA==} dependencies: undici-types: 5.26.5 @@ -1158,7 +1158,7 @@ packages: /@types/pg@8.11.2: resolution: {integrity: sha512-G2Mjygf2jFMU/9hCaTYxJrwdObdcnuQde1gndooZSOHsNSaCehAuwc7EIuSA34Do8Jx2yZ19KtvW8P0j4EuUXw==} dependencies: - '@types/node': 20.11.25 + '@types/node': 20.11.28 pg-protocol: 1.6.0 pg-types: 4.0.2 dev: true @@ -1166,7 +1166,7 @@ packages: /@types/readable-stream@4.0.10: resolution: {integrity: sha512-AbUKBjcC8SHmImNi4yK2bbjogQlkFSg7shZCcicxPQapniOlajG8GCc39lvXzCWX4lLRRs7DM3VAeSlqmEVZUA==} dependencies: - '@types/node': 20.11.25 + '@types/node': 20.11.28 safe-buffer: 5.1.2 dev: false @@ -1185,17 +1185,17 @@ packages: /@types/tedious@4.0.14: resolution: {integrity: sha512-KHPsfX/FoVbUGbyYvk1q9MMQHLPeRZhRJZdO45Q4YjvFkv4hMNghCWTvy7rdKessBsmtz4euWCWAB6/tVpI1Iw==} dependencies: - '@types/node': 20.11.25 + '@types/node': 20.11.28 dev: true /@types/ws@8.5.10: resolution: {integrity: sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==} dependencies: - '@types/node': 20.11.25 + '@types/node': 20.11.28 dev: true - /@typescript-eslint/eslint-plugin@7.1.1(@typescript-eslint/parser@7.1.1)(eslint@8.57.0)(typescript@5.4.2): - resolution: {integrity: sha512-zioDz623d0RHNhvx0eesUmGfIjzrk18nSBC8xewepKXbBvN/7c1qImV7Hg8TI1URTxKax7/zxfxj3Uph8Chcuw==} + /@typescript-eslint/eslint-plugin@7.2.0(@typescript-eslint/parser@7.2.0)(eslint@8.57.0)(typescript@5.4.2): + resolution: {integrity: sha512-mdekAHOqS9UjlmyF/LSs6AIEvfceV749GFxoBAjwAv0nkevfKHWQFDMcBZWUiIC5ft6ePWivXoS36aKQ0Cy3sw==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: '@typescript-eslint/parser': ^7.0.0 @@ -1206,11 +1206,11 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 7.1.1(eslint@8.57.0)(typescript@5.4.2) - '@typescript-eslint/scope-manager': 7.1.1 - '@typescript-eslint/type-utils': 7.1.1(eslint@8.57.0)(typescript@5.4.2) - '@typescript-eslint/utils': 7.1.1(eslint@8.57.0)(typescript@5.4.2) - '@typescript-eslint/visitor-keys': 7.1.1 + '@typescript-eslint/parser': 7.2.0(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/scope-manager': 7.2.0 + '@typescript-eslint/type-utils': 7.2.0(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/utils': 7.2.0(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/visitor-keys': 7.2.0 debug: 4.3.4 eslint: 8.57.0 graphemer: 1.4.0 @@ -1223,8 +1223,8 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@7.1.1(eslint@8.57.0)(typescript@5.4.2): - resolution: {integrity: sha512-ZWUFyL0z04R1nAEgr9e79YtV5LbafdOtN7yapNbn1ansMyaegl2D4bL7vHoJ4HPSc4CaLwuCVas8CVuneKzplQ==} + /@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.4.2): + resolution: {integrity: sha512-5FKsVcHTk6TafQKQbuIVkXq58Fnbkd2wDL4LB7AURN7RUOu1utVP+G8+6u3ZhEroW3DF6hyo3ZEXxgKgp4KeCg==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^8.56.0 @@ -1233,10 +1233,10 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 7.1.1 - '@typescript-eslint/types': 7.1.1 - '@typescript-eslint/typescript-estree': 7.1.1(typescript@5.4.2) - '@typescript-eslint/visitor-keys': 7.1.1 + '@typescript-eslint/scope-manager': 7.2.0 + '@typescript-eslint/types': 7.2.0 + '@typescript-eslint/typescript-estree': 7.2.0(typescript@5.4.2) + '@typescript-eslint/visitor-keys': 7.2.0 debug: 4.3.4 eslint: 8.57.0 typescript: 5.4.2 @@ -1252,16 +1252,16 @@ packages: '@typescript-eslint/visitor-keys': 5.62.0 dev: true - /@typescript-eslint/scope-manager@7.1.1: - resolution: {integrity: sha512-cirZpA8bJMRb4WZ+rO6+mnOJrGFDd38WoXCEI57+CYBqta8Yc8aJym2i7vyqLL1vVYljgw0X27axkUXz32T8TA==} + /@typescript-eslint/scope-manager@7.2.0: + resolution: {integrity: sha512-Qh976RbQM/fYtjx9hs4XkayYujB/aPwglw2choHmf3zBjB4qOywWSdt9+KLRdHubGcoSwBnXUH2sR3hkyaERRg==} engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 7.1.1 - '@typescript-eslint/visitor-keys': 7.1.1 + '@typescript-eslint/types': 7.2.0 + '@typescript-eslint/visitor-keys': 7.2.0 dev: true - /@typescript-eslint/type-utils@7.1.1(eslint@8.57.0)(typescript@5.4.2): - resolution: {integrity: sha512-5r4RKze6XHEEhlZnJtR3GYeCh1IueUHdbrukV2KSlLXaTjuSfeVF8mZUVPLovidCuZfbVjfhi4c0DNSa/Rdg5g==} + /@typescript-eslint/type-utils@7.2.0(eslint@8.57.0)(typescript@5.4.2): + resolution: {integrity: sha512-xHi51adBHo9O9330J8GQYQwrKBqbIPJGZZVQTHHmy200hvkLZFWJIFtAG/7IYTWUyun6DE6w5InDReePJYJlJA==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^8.56.0 @@ -1270,8 +1270,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 7.1.1(typescript@5.4.2) - '@typescript-eslint/utils': 7.1.1(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/typescript-estree': 7.2.0(typescript@5.4.2) + '@typescript-eslint/utils': 7.2.0(eslint@8.57.0)(typescript@5.4.2) debug: 4.3.4 eslint: 8.57.0 ts-api-utils: 1.2.1(typescript@5.4.2) @@ -1285,8 +1285,8 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/types@7.1.1: - resolution: {integrity: sha512-KhewzrlRMrgeKm1U9bh2z5aoL4s7K3tK5DwHDn8MHv0yQfWFz/0ZR6trrIHHa5CsF83j/GgHqzdbzCXJ3crx0Q==} + /@typescript-eslint/types@7.2.0: + resolution: {integrity: sha512-XFtUHPI/abFhm4cbCDc5Ykc8npOKBSJePY3a3s+lwumt7XWJuzP5cZcfZ610MIPHjQjNsOLlYK8ASPaNG8UiyA==} engines: {node: ^16.0.0 || >=18.0.0} dev: true @@ -1311,8 +1311,8 @@ packages: - supports-color dev: true - /@typescript-eslint/typescript-estree@7.1.1(typescript@5.4.2): - resolution: {integrity: sha512-9ZOncVSfr+sMXVxxca2OJOPagRwT0u/UHikM2Rd6L/aB+kL/QAuTnsv6MeXtjzCJYb8PzrXarypSGIPx3Jemxw==} + /@typescript-eslint/typescript-estree@7.2.0(typescript@5.4.2): + resolution: {integrity: sha512-cyxS5WQQCoBwSakpMrvMXuMDEbhOo9bNHHrNcEWis6XHx6KF518tkF1wBvKIn/tpq5ZpUYK7Bdklu8qY0MsFIA==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: typescript: '*' @@ -1320,8 +1320,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 7.1.1 - '@typescript-eslint/visitor-keys': 7.1.1 + '@typescript-eslint/types': 7.2.0 + '@typescript-eslint/visitor-keys': 7.2.0 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 @@ -1353,8 +1353,8 @@ packages: - typescript dev: true - /@typescript-eslint/utils@7.1.1(eslint@8.57.0)(typescript@5.4.2): - resolution: {integrity: sha512-thOXM89xA03xAE0lW7alstvnyoBUbBX38YtY+zAUcpRPcq9EIhXPuJ0YTv948MbzmKh6e1AUszn5cBFK49Umqg==} + /@typescript-eslint/utils@7.2.0(eslint@8.57.0)(typescript@5.4.2): + resolution: {integrity: sha512-YfHpnMAGb1Eekpm3XRK8hcMwGLGsnT6L+7b2XyRv6ouDuJU1tZir1GS2i0+VXRatMwSI1/UfcyPe53ADkU+IuA==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^8.56.0 @@ -1362,9 +1362,9 @@ packages: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) '@types/json-schema': 7.0.15 '@types/semver': 7.5.8 - '@typescript-eslint/scope-manager': 7.1.1 - '@typescript-eslint/types': 7.1.1 - '@typescript-eslint/typescript-estree': 7.1.1(typescript@5.4.2) + '@typescript-eslint/scope-manager': 7.2.0 + '@typescript-eslint/types': 7.2.0 + '@typescript-eslint/typescript-estree': 7.2.0(typescript@5.4.2) eslint: 8.57.0 semver: 7.6.0 transitivePeerDependencies: @@ -1380,11 +1380,11 @@ packages: eslint-visitor-keys: 3.4.3 dev: true - /@typescript-eslint/visitor-keys@7.1.1: - resolution: {integrity: sha512-yTdHDQxY7cSoCcAtiBzVzxleJhkGB9NncSIyMYe2+OGON1ZsP9zOPws/Pqgopa65jvknOjlk/w7ulPlZ78PiLQ==} + /@typescript-eslint/visitor-keys@7.2.0: + resolution: {integrity: sha512-c6EIQRHhcpl6+tO8EMR+kjkkV+ugUNXOmeASA1rlzkd8EPIriavpWoiEz1HR/VLhbVIdhqnV6E7JZm00cBDx2A==} engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 7.1.1 + '@typescript-eslint/types': 7.2.0 eslint-visitor-keys: 3.4.3 dev: true @@ -1392,38 +1392,38 @@ packages: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: true - /@vitest/expect@1.3.1: - resolution: {integrity: sha512-xofQFwIzfdmLLlHa6ag0dPV8YsnKOCP1KdAeVVh34vSjN2dcUiXYCD9htu/9eM7t8Xln4v03U9HLxLpPlsXdZw==} + /@vitest/expect@1.4.0: + resolution: {integrity: sha512-Jths0sWCJZ8BxjKe+p+eKsoqev1/T8lYcrjavEaz8auEJ4jAVY0GwW3JKmdVU4mmNPLPHixh4GNXP7GFtAiDHA==} dependencies: - '@vitest/spy': 1.3.1 - '@vitest/utils': 1.3.1 + '@vitest/spy': 1.4.0 + '@vitest/utils': 1.4.0 chai: 4.4.1 dev: true - /@vitest/runner@1.3.1: - resolution: {integrity: sha512-5FzF9c3jG/z5bgCnjr8j9LNq/9OxV2uEBAITOXfoe3rdZJTdO7jzThth7FXv/6b+kdY65tpRQB7WaKhNZwX+Kg==} + /@vitest/runner@1.4.0: + resolution: {integrity: sha512-EDYVSmesqlQ4RD2VvWo3hQgTJ7ZrFQ2VSJdfiJiArkCerDAGeyF1i6dHkmySqk573jLp6d/cfqCN+7wUB5tLgg==} dependencies: - '@vitest/utils': 1.3.1 + '@vitest/utils': 1.4.0 p-limit: 5.0.0 pathe: 1.1.2 dev: true - /@vitest/snapshot@1.3.1: - resolution: {integrity: sha512-EF++BZbt6RZmOlE3SuTPu/NfwBF6q4ABS37HHXzs2LUVPBLx2QoY/K0fKpRChSo8eLiuxcbCVfqKgx/dplCDuQ==} + /@vitest/snapshot@1.4.0: + resolution: {integrity: sha512-saAFnt5pPIA5qDGxOHxJ/XxhMFKkUSBJmVt5VgDsAqPTX6JP326r5C/c9UuCMPoXNzuudTPsYDZCoJ5ilpqG2A==} dependencies: magic-string: 0.30.8 pathe: 1.1.2 pretty-format: 29.7.0 dev: true - /@vitest/spy@1.3.1: - resolution: {integrity: sha512-xAcW+S099ylC9VLU7eZfdT9myV67Nor9w9zhf0mGCYJSO+zM2839tOeROTdikOi/8Qeusffvxb/MyBSOja1Uig==} + /@vitest/spy@1.4.0: + resolution: {integrity: sha512-Ywau/Qs1DzM/8Uc+yA77CwSegizMlcgTJuYGAi0jujOteJOUf1ujunHThYo243KG9nAyWT3L9ifPYZ5+As/+6Q==} dependencies: tinyspy: 2.2.1 dev: true - /@vitest/utils@1.3.1: - resolution: {integrity: sha512-d3Waie/299qqRyHTm2DjADeTaNdNSVsnwHPWrs20JMpjh6eiVq7ggggweO8rc4arhf6rRkWuHKwvxGvejUXZZQ==} + /@vitest/utils@1.4.0: + resolution: {integrity: sha512-mx3Yd1/6e2Vt/PUC98DcqTirtfxUyAZ32uK82r8rZzbtBeBo+nqgnjx/LvqQdWsrvNtm14VmurNgcf4nqY5gJg==} dependencies: diff-sequences: 29.6.3 estree-walker: 3.0.3 @@ -2290,7 +2290,7 @@ packages: - supports-color dev: true - /eslint-module-utils@2.8.1(@typescript-eslint/parser@7.1.1)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0): + /eslint-module-utils@2.8.1(@typescript-eslint/parser@7.2.0)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0): resolution: {integrity: sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==} engines: {node: '>=4'} peerDependencies: @@ -2311,7 +2311,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 7.1.1(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/parser': 7.2.0(eslint@8.57.0)(typescript@5.4.2) debug: 3.2.7 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 @@ -2319,7 +2319,7 @@ packages: - supports-color dev: true - /eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.1.1)(eslint@8.57.0): + /eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.2.0)(eslint@8.57.0): resolution: {integrity: sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==} engines: {node: '>=4'} peerDependencies: @@ -2329,7 +2329,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 7.1.1(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/parser': 7.2.0(eslint@8.57.0)(typescript@5.4.2) array-includes: 3.1.7 array.prototype.findlastindex: 1.2.4 array.prototype.flat: 1.3.2 @@ -2338,7 +2338,7 @@ packages: doctrine: 2.1.0 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.1(@typescript-eslint/parser@7.1.1)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0) + eslint-module-utils: 2.8.1(@typescript-eslint/parser@7.2.0)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0) hasown: 2.0.1 is-core-module: 2.13.1 is-glob: 4.0.3 @@ -2354,8 +2354,8 @@ packages: - supports-color dev: true - /eslint-plugin-jsdoc@48.2.0(eslint@8.57.0): - resolution: {integrity: sha512-O2B1XLBJnUCRkggFzUQ+PBYJDit8iAgXdlu8ucolqGrbmOWPvttZQZX8d1sC0MbqDMSLs8SHSQxaNPRY1RQREg==} + /eslint-plugin-jsdoc@48.2.1(eslint@8.57.0): + resolution: {integrity: sha512-iUvbcyDZSO/9xSuRv2HQBw++8VkV/pt3UWtX9cpPH0l7GKPq78QC/6+PmyQHHvNZaTjAce6QVciEbnc6J/zH5g==} engines: {node: '>=18'} peerDependencies: eslint: ^7.0.0 || ^8.0.0 || ^9.0.0 @@ -2408,16 +2408,16 @@ packages: eslint: 8.57.0 dev: true - /eslint-plugin-react-refresh@0.4.5(eslint@8.57.0): - resolution: {integrity: sha512-D53FYKJa+fDmZMtriODxvhwrO+IOqrxoEo21gMA0sjHdU6dPVH4OhyFip9ypl8HOF5RV5KdTo+rBQLvnY2cO8w==} + /eslint-plugin-react-refresh@0.4.6(eslint@8.57.0): + resolution: {integrity: sha512-NjGXdm7zgcKRkKMua34qVO9doI7VOxZ6ancSvBELJSSoX97jyndXcSoa8XBh69JoB31dNz3EEzlMcizZl7LaMA==} peerDependencies: eslint: '>=7' dependencies: eslint: 8.57.0 dev: true - /eslint-plugin-react@7.34.0(eslint@8.57.0): - resolution: {integrity: sha512-MeVXdReleBTdkz/bvcQMSnCXGi+c9kvy51IpinjnJgutl3YTHWsDdke7Z1ufZpGfDG8xduBDKyjtB9JH1eBKIQ==} + /eslint-plugin-react@7.34.1(eslint@8.57.0): + resolution: {integrity: sha512-N97CxlouPT1AHt8Jn0mhhN2RrADlUAsk1/atcT2KyA/l9Q/E6ll7OIGwNumFmWfZ9skV3XXccYS19h80rHtgkw==} engines: {node: '>=4'} peerDependencies: eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 @@ -3405,16 +3405,16 @@ packages: json-buffer: 3.0.1 dev: true - /kysely-bun-worker@0.5.7(kysely@0.27.2): + /kysely-bun-worker@0.5.7(kysely@0.27.3): resolution: {integrity: sha512-P4W5moWU6A1xJ2GvGbdrPDiasSKTjuBfItU1vj+wZlA+A6AXv8Nxk0nScuBu8F12UnalrIDDu+oLCF5wC3Z4EA==} peerDependencies: kysely: '>=0.26' dependencies: - kysely: 0.27.2 + kysely: 0.27.3 dev: true - /kysely@0.27.2: - resolution: {integrity: sha512-DmRvEfiR/NLpgsTbSxma2ldekhsdcd65+MNiKXyd/qj7w7X5e3cLkXxcj+MypsRDjPhHQ/CD5u3Eq1sBYzX0bw==} + /kysely@0.27.3: + resolution: {integrity: sha512-lG03Ru+XyOJFsjH3OMY6R/9U38IjDPfnOfDgO3ynhbDr+Dz8fak+X6L62vqu3iybQnj+lG84OttBuU9KY3L9kA==} engines: {node: '>=14.0.0'} dev: true @@ -4901,7 +4901,7 @@ packages: engines: {node: '>=6.10'} dev: true - /ts-node-dev@2.0.0(@types/node@20.11.25)(typescript@5.4.2): + /ts-node-dev@2.0.0(@types/node@20.11.28)(typescript@5.4.2): resolution: {integrity: sha512-ywMrhCfH6M75yftYvrvNarLEY+SUXtUvU8/0Z6llrHQVBx12GiFk5sStF8UdfE/yfzk9IAq7O5EEbTQsxlBI8w==} engines: {node: '>=0.8.0'} hasBin: true @@ -4920,7 +4920,7 @@ packages: rimraf: 2.7.1 source-map-support: 0.5.21 tree-kill: 1.2.2 - ts-node: 10.9.2(@types/node@20.11.25)(typescript@5.4.2) + ts-node: 10.9.2(@types/node@20.11.28)(typescript@5.4.2) tsconfig: 7.0.0 typescript: 5.4.2 transitivePeerDependencies: @@ -4929,7 +4929,7 @@ packages: - '@types/node' dev: true - /ts-node@10.9.2(@types/node@20.11.25)(typescript@5.4.2): + /ts-node@10.9.2(@types/node@20.11.28)(typescript@5.4.2): resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} hasBin: true peerDependencies: @@ -4948,7 +4948,7 @@ packages: '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 20.11.25 + '@types/node': 20.11.28 acorn: 8.11.3 acorn-walk: 8.3.2 arg: 4.1.3 @@ -5138,8 +5138,8 @@ packages: spdx-expression-parse: 3.0.1 dev: true - /vite-node@1.3.1(@types/node@20.11.25): - resolution: {integrity: sha512-azbRrqRxlWTJEVbzInZCTchx0X69M/XPTCz4H+TLvlTcR/xH/3hkRqhOakT41fMJCMzXTu4UvegkZiEoJAWvng==} + /vite-node@1.4.0(@types/node@20.11.28): + resolution: {integrity: sha512-VZDAseqjrHgNd4Kh8icYHWzTKSCZMhia7GyHfhtzLW33fZlG9SwsB6CEhgyVOWkJfJ2pFLrp/Gj1FSfAiqH9Lw==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true dependencies: @@ -5147,7 +5147,7 @@ packages: debug: 4.3.4 pathe: 1.1.2 picocolors: 1.0.0 - vite: 5.1.5(@types/node@20.11.25) + vite: 5.1.5(@types/node@20.11.28) transitivePeerDependencies: - '@types/node' - less @@ -5159,7 +5159,7 @@ packages: - terser dev: true - /vite@5.1.5(@types/node@20.11.25): + /vite@5.1.5(@types/node@20.11.28): resolution: {integrity: sha512-BdN1xh0Of/oQafhU+FvopafUp6WaYenLU/NFoL5WyJL++GxkNfieKzBhM24H3HVsPQrlAqB7iJYTHabzaRed5Q==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true @@ -5187,7 +5187,7 @@ packages: terser: optional: true dependencies: - '@types/node': 20.11.25 + '@types/node': 20.11.28 esbuild: 0.19.12 postcss: 8.4.35 rollup: 4.12.1 @@ -5195,15 +5195,15 @@ packages: fsevents: 2.3.3 dev: true - /vitest@1.3.1(@types/node@20.11.25): - resolution: {integrity: sha512-/1QJqXs8YbCrfv/GPQ05wAZf2eakUPLPa18vkJAKE7RXOKfVHqMZZ1WlTjiwl6Gcn65M5vpNUB6EFLnEdRdEXQ==} + /vitest@1.4.0(@types/node@20.11.28): + resolution: {integrity: sha512-gujzn0g7fmwf83/WzrDTnncZt2UiXP41mHuFYFrdwaLRVQ6JYQEiME2IfEjU3vcFL3VKa75XhI3lFgn+hfVsQw==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: '@edge-runtime/vm': '*' '@types/node': ^18.0.0 || >=20.0.0 - '@vitest/browser': 1.3.1 - '@vitest/ui': 1.3.1 + '@vitest/browser': 1.4.0 + '@vitest/ui': 1.4.0 happy-dom: '*' jsdom: '*' peerDependenciesMeta: @@ -5220,12 +5220,12 @@ packages: jsdom: optional: true dependencies: - '@types/node': 20.11.25 - '@vitest/expect': 1.3.1 - '@vitest/runner': 1.3.1 - '@vitest/snapshot': 1.3.1 - '@vitest/spy': 1.3.1 - '@vitest/utils': 1.3.1 + '@types/node': 20.11.28 + '@vitest/expect': 1.4.0 + '@vitest/runner': 1.4.0 + '@vitest/snapshot': 1.4.0 + '@vitest/spy': 1.4.0 + '@vitest/utils': 1.4.0 acorn-walk: 8.3.2 chai: 4.4.1 debug: 4.3.4 @@ -5238,8 +5238,8 @@ packages: strip-literal: 2.0.0 tinybench: 2.6.0 tinypool: 0.8.2 - vite: 5.1.5(@types/node@20.11.25) - vite-node: 1.3.1(@types/node@20.11.25) + vite: 5.1.5(@types/node@20.11.28) + vite-node: 1.4.0(@types/node@20.11.28) why-is-node-running: 2.2.2 transitivePeerDependencies: - less From d199d825c2d6a44a88781399b9f2c0b109090e52 Mon Sep 17 00:00:00 2001 From: Robin Blomberg Date: Sun, 17 Mar 2024 21:21:43 +0100 Subject: [PATCH 13/23] feat: adjust comment serialization --- src/ast/property-node.ts | 10 +++++++--- src/core/fixtures/migrate.ts | 9 +++++++++ src/core/metadata/column-metadata.ts | 6 +++--- src/core/outputs/postgres.output.ts | 5 +++++ src/dialects/postgres/postgres-introspector.ts | 1 + src/serializer/serializer.test.ts | 5 +++++ src/serializer/serializer.ts | 12 ++++++++---- 7 files changed, 38 insertions(+), 10 deletions(-) diff --git a/src/ast/property-node.ts b/src/ast/property-node.ts index e47b9ef..9682332 100644 --- a/src/ast/property-node.ts +++ b/src/ast/property-node.ts @@ -2,14 +2,18 @@ import type { ExpressionNode } from './expression-node'; import { NodeType } from './node-type'; export class PropertyNode { + readonly comment: string | null; readonly key: string; readonly type = NodeType.PROPERTY; readonly value: ExpressionNode; - readonly comment?: string; - constructor(key: string, value: ExpressionNode, comment?: string) { + constructor( + key: string, + value: ExpressionNode, + comment: string | null = null, + ) { + this.comment = comment; this.key = key; this.value = value; - this.comment = comment; } } diff --git a/src/core/fixtures/migrate.ts b/src/core/fixtures/migrate.ts index b6fe7a3..62d5a89 100644 --- a/src/core/fixtures/migrate.ts +++ b/src/core/fixtures/migrate.ts @@ -83,6 +83,15 @@ const up = async (db: Kysely, dialect: Dialect) => { } await builder.execute(); + + if (dialect instanceof PostgresDialect) { + await trx.executeQuery( + sql` + comment on column foo_bar.false is + 'This is a comment on a column.\r\n\r\nIt''s nice, isn''t it?'; + `.compile(trx), + ); + } }); }; diff --git a/src/core/metadata/column-metadata.ts b/src/core/metadata/column-metadata.ts index e9c7d75..2f9b10a 100644 --- a/src/core/metadata/column-metadata.ts +++ b/src/core/metadata/column-metadata.ts @@ -1,4 +1,5 @@ export type ColumnMetadataOptions = { + comment?: string | null; dataType: string; dataTypeSchema?: string; enumValues?: string[] | null; @@ -7,10 +8,10 @@ export type ColumnMetadataOptions = { isAutoIncrementing?: boolean; isNullable?: boolean; name: string; - comment?: string; }; export class ColumnMetadata { + readonly comment: string | null; readonly dataType: string; readonly dataTypeSchema: string | undefined; readonly enumValues: string[] | null; @@ -19,9 +20,9 @@ export class ColumnMetadata { readonly isAutoIncrementing: boolean; readonly isNullable: boolean; readonly name: string; - readonly comment?: string; constructor(options: ColumnMetadataOptions) { + this.comment = options.comment ?? null; this.dataType = options.dataType; this.dataTypeSchema = options.dataTypeSchema; this.enumValues = options.enumValues ?? null; @@ -30,6 +31,5 @@ export class ColumnMetadata { this.isAutoIncrementing = options.isAutoIncrementing ?? false; this.isNullable = options.isNullable ?? false; this.name = options.name; - this.comment = options.comment; } } diff --git a/src/core/outputs/postgres.output.ts b/src/core/outputs/postgres.output.ts index 3719419..14b1288 100644 --- a/src/core/outputs/postgres.output.ts +++ b/src/core/outputs/postgres.output.ts @@ -23,6 +23,11 @@ export interface FooBar { childDomain: number | null; defaultedNullablePosInt: Generated; defaultedRequiredPosInt: Generated; + /** + * This is a comment on a column. + * + * It's nice, isn't it? + */ false: boolean; id: Generated; nullablePosInt: number | null; diff --git a/src/dialects/postgres/postgres-introspector.ts b/src/dialects/postgres/postgres-introspector.ts index 6e57618..e2dd79e 100644 --- a/src/dialects/postgres/postgres-introspector.ts +++ b/src/dialects/postgres/postgres-introspector.ts @@ -48,6 +48,7 @@ export class PostgresIntrospector extends Introspector { return { ...column, + comment: column.comment ?? null, dataType: isArray ? dataType.slice(1) : dataType, dataTypeSchema: column.dataTypeSchema, enumValues: enums.get( diff --git a/src/serializer/serializer.test.ts b/src/serializer/serializer.test.ts index 757c310..89079af 100644 --- a/src/serializer/serializer.test.ts +++ b/src/serializer/serializer.test.ts @@ -276,6 +276,7 @@ export const testSerializer = () => { new TableMetadata({ columns: [ new ColumnMetadata({ + comment: 'Hello!\nThis is a comment.', dataType: 'json', hasDefaultValue: false, isAutoIncrementing: false, @@ -308,6 +309,10 @@ export const testSerializer = () => { 'export type JsonValue = JsonArray | JsonObject | JsonPrimitive;\n' + '\n' + 'export interface Foo {\n' + + ' /**\n' + + ' * Hello!\n' + + ' * This is a comment.\n' + + ' */\n' + ' json: Json;\n' + '}\n' + '\n' + diff --git a/src/serializer/serializer.ts b/src/serializer/serializer.ts index fd2d8bb..16bc885 100644 --- a/src/serializer/serializer.ts +++ b/src/serializer/serializer.ts @@ -286,6 +286,7 @@ export class Serializer { ); for (const property of sortedProperties) { + data += ' '; data += this.serializeProperty(property); } } @@ -299,12 +300,15 @@ export class Serializer { let data = ''; if (node.comment) { - data += ` /**\n`; - data += ` * ${node.comment}\n`; - data += ` */\n`; + data += '/**\n'; + + for (const line of node.comment.split(/\r?\n/)) { + data += ` *${line ? ` ${line}` : ''}\n`; + } + + data += ' */\n '; } - data += ' '; data += this.serializeKey(node.key); data += ': '; data += this.serializeExpression(node.value); From 3a5fc56cc7791ba320bda577c087f33ddc6b943f Mon Sep 17 00:00:00 2001 From: Robin Blomberg Date: Sun, 17 Mar 2024 21:34:25 +0100 Subject: [PATCH 14/23] refactor: adjust code for runtime enums --- src/generator/generator.ts | 5 +- src/serializer/serializer.test.ts | 13 +---- src/serializer/serializer.ts | 78 ++++++++++++++-------------- src/transformer/symbol-collection.ts | 4 +- src/transformer/transformer.ts | 14 ++--- 5 files changed, 54 insertions(+), 60 deletions(-) diff --git a/src/generator/generator.ts b/src/generator/generator.ts index 95094c6..9350bf8 100644 --- a/src/generator/generator.ts +++ b/src/generator/generator.ts @@ -59,7 +59,10 @@ export class Generator { const serializer = options.serializer ?? - new Serializer({ typeOnlyImports: options.typeOnlyImports, camelCase: !!options.camelCase }); + new Serializer({ + camelCase: !!options.camelCase, + typeOnlyImports: options.typeOnlyImports, + }); const data = serializer.serialize(nodes); const relativeOutDir = options.outFile diff --git a/src/serializer/serializer.test.ts b/src/serializer/serializer.test.ts index 857399e..7346fac 100644 --- a/src/serializer/serializer.test.ts +++ b/src/serializer/serializer.test.ts @@ -279,9 +279,6 @@ export const testSerializer = () => { new ColumnMetadata({ comment: 'Hello!\nThis is a comment.', dataType: 'json', - hasDefaultValue: false, - isAutoIncrementing: false, - isNullable: false, name: 'json', }), ], @@ -291,7 +288,6 @@ export const testSerializer = () => { ], enums, ), - runtimeEnums: false, }); strictEqual( @@ -338,13 +334,7 @@ export const testSerializer = () => { [ new TableMetadata({ columns: [ - new ColumnMetadata({ - dataType: 'json', - hasDefaultValue: false, - isAutoIncrementing: false, - isNullable: false, - name: 'json', - }), + new ColumnMetadata({ dataType: 'json', name: 'json' }), ], name: 'foo', schema: 'public', @@ -352,7 +342,6 @@ export const testSerializer = () => { ], enums, ), - runtimeEnums: false, }); strictEqual( diff --git a/src/serializer/serializer.ts b/src/serializer/serializer.ts index ecd109d..cd031af 100644 --- a/src/serializer/serializer.ts +++ b/src/serializer/serializer.ts @@ -24,20 +24,20 @@ import { toCamelCase } from '../transformer'; const IDENTIFIER_REGEXP = /^[$A-Z_a-z][\w$]*$/; export type SerializerOptions = { - typeOnlyImports?: boolean; camelCase?: boolean; + typeOnlyImports?: boolean; }; /** * Creates a TypeScript output string from a codegen AST. */ export class Serializer { - readonly typeOnlyImports: boolean; readonly camelCase: boolean; + readonly typeOnlyImports: boolean; constructor(options: SerializerOptions = {}) { - this.typeOnlyImports = options.typeOnlyImports ?? true; this.camelCase = options.camelCase ?? false; + this.typeOnlyImports = options.typeOnlyImports ?? true; } serialize(nodes: StatementNode[]) { @@ -70,41 +70,6 @@ export class Serializer { return data; } - serializeRuntimeEnum(node: RuntimeEnumDeclarationNode) { - let data = 'enum '; - data += node.name; - data += ' {\n'; - - const args = - node.body.type === NodeType.UNION_EXPRESSION - ? node.body.args - : [node.body]; - const sortedArgs = args.sort((a, b) => - (a as LiteralNode).value.localeCompare( - (b as LiteralNode).value, - ), - ); - - for (const arg of sortedArgs) { - if (arg.type === NodeType.LITERAL && typeof arg.value === 'string') { - const serializedArg = this.serializeLiteral(arg); - const enumValueName = this.camelCase - ? toCamelCase(arg.value) - : arg.value; - data += ' '; - data += enumValueName; - data += ' = '; - data += serializedArg; - data += ','; - data += '\n'; - } - } - - data += '}'; - - return data; - } - serializeAliasDeclaration(node: AliasDeclarationNode) { const expression = node.body.type === NodeType.TEMPLATE ? node.body.expression : node.body; @@ -360,6 +325,43 @@ export class Serializer { return data; } + serializeRuntimeEnum(node: RuntimeEnumDeclarationNode) { + let data = 'enum '; + + data += node.name; + data += ' {\n'; + + const args = + node.body.type === NodeType.UNION_EXPRESSION + ? node.body.args + : [node.body]; + + args.sort((a, b) => { + return (a as LiteralNode).value.localeCompare( + (b as LiteralNode).value, + ); + }); + + for (const arg of args) { + if (arg.type === NodeType.LITERAL && typeof arg.value === 'string') { + const serializedArg = this.serializeLiteral(arg); + const enumValueName = this.camelCase + ? toCamelCase(arg.value) + : arg.value; + data += ' '; + data += enumValueName; + data += ' = '; + data += serializedArg; + data += ','; + data += '\n'; + } + } + + data += '}'; + + return data; + } + serializeUnionExpression(node: UnionExpressionNode) { let data = ''; let i = 0; diff --git a/src/transformer/symbol-collection.ts b/src/transformer/symbol-collection.ts index 9539a9a..e5df7cd 100644 --- a/src/transformer/symbol-collection.ts +++ b/src/transformer/symbol-collection.ts @@ -11,14 +11,14 @@ export type SymbolNameMap = { export type SymbolNode = | { node: ExpressionNode | TemplateNode; type: SymbolType.DEFINITION } - | { node: ModuleReferenceNode; type: SymbolType.MODULE_REFERENCE } | { node: ExpressionNode; type: SymbolType.RUNTIME_ENUM_DEFINITION } + | { node: ModuleReferenceNode; type: SymbolType.MODULE_REFERENCE } | { type: SymbolType.TABLE }; export const enum SymbolType { DEFINITION = 'Definition', - RUNTIME_ENUM_DEFINITION = 'RuntimeEnumDefinition', MODULE_REFERENCE = 'ModuleReference', + RUNTIME_ENUM_DEFINITION = 'RuntimeEnumDefinition', TABLE = 'Table', } diff --git a/src/transformer/transformer.ts b/src/transformer/transformer.ts index 77b1b42..31bd482 100644 --- a/src/transformer/transformer.ts +++ b/src/transformer/transformer.ts @@ -55,11 +55,11 @@ export type TransformContext = { }; export type TransformOptions = { - camelCase: boolean; + camelCase?: boolean; defaultSchema?: string; dialect: Dialect; metadata: DatabaseMetadata; - runtimeEnums: boolean; + runtimeEnums?: boolean; }; /** @@ -146,7 +146,7 @@ export class Transformer { #createContext(options: TransformOptions): TransformContext { return { - camelCase: options.camelCase, + camelCase: !!options.camelCase, defaultScalar: options.dialect.adapter.defaultScalar ?? new IdentifierNode('unknown'), defaultSchema: @@ -161,7 +161,7 @@ export class Transformer { ...options.dialect.adapter.imports, }, metadata: options.metadata, - runtimeEnums: options.runtimeEnums, + runtimeEnums: !!options.runtimeEnums, scalars: { ...options.dialect.adapter.scalars, }, @@ -201,9 +201,9 @@ export class Transformer { } } - return runtimeEnumDefinitionNodes.sort((a, b) => - a.argument.name.localeCompare(b.argument.name), - ); + return runtimeEnumDefinitionNodes.sort((a, b) => { + return a.argument.name.localeCompare(b.argument.name); + }); } #createDefinitionNodes(context: TransformContext) { From bd18848d4ffabf137eba4c92ca37af4ecc44ed30 Mon Sep 17 00:00:00 2001 From: Robin Blomberg Date: Sun, 17 Mar 2024 21:35:14 +0100 Subject: [PATCH 15/23] chore: bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 31b1c51..b5f285e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kysely-codegen", - "version": "0.13.1", + "version": "0.14.0", "author": "Robin Blomberg", "license": "MIT", "main": "./dist/index.js", From 684d30a67b068eff5faccd228b63748370c6e7f1 Mon Sep 17 00:00:00 2001 From: Robin Clowers Date: Mon, 18 Mar 2024 14:05:37 -0700 Subject: [PATCH 16/23] fix: domain flag is respected --- src/cli/cli.ts | 2 +- src/core/dialect-manager.ts | 4 ++-- src/dialects/postgres/postgres-dialect.ts | 4 ++-- src/dialects/postgres/postgres-introspector.ts | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cli/cli.ts b/src/cli/cli.ts index 3c24b4a..8eb6850 100644 --- a/src/cli/cli.ts +++ b/src/cli/cli.ts @@ -66,7 +66,7 @@ export class Cli { } const dialectManager = new DialectManager({ - skipDomains: !!options.domains, + domains: !!options.domains, }); const dialect = dialectManager.getDialect( options.dialectName ?? inferredDialectName, diff --git a/src/core/dialect-manager.ts b/src/core/dialect-manager.ts index b64e85e..aed560f 100644 --- a/src/core/dialect-manager.ts +++ b/src/core/dialect-manager.ts @@ -17,7 +17,7 @@ export type DialectName = | 'sqlite'; export type DialectManagerOptions = { - skipDomains?: boolean; + domains: boolean; }; /** @@ -26,7 +26,7 @@ export type DialectManagerOptions = { export class DialectManager { readonly #options: DialectManagerOptions; - constructor(options: DialectManagerOptions = {}) { + constructor(options: DialectManagerOptions = { domains: true }) { this.#options = options; } diff --git a/src/dialects/postgres/postgres-dialect.ts b/src/dialects/postgres/postgres-dialect.ts index a61d6f0..50120c3 100644 --- a/src/dialects/postgres/postgres-dialect.ts +++ b/src/dialects/postgres/postgres-dialect.ts @@ -5,7 +5,7 @@ import { PostgresAdapter } from './postgres-adapter'; import { PostgresIntrospector } from './postgres-introspector'; export type PostgresDialectOptions = { - skipDomains?: boolean; + domains: boolean; }; export class PostgresDialect extends Dialect { @@ -13,7 +13,7 @@ export class PostgresDialect extends Dialect { readonly adapter = new PostgresAdapter(); readonly introspector; - constructor(options: PostgresDialectOptions = {}) { + constructor(options: PostgresDialectOptions = { domains: true }) { super(); this.#options = options; this.introspector = new PostgresIntrospector(this.adapter, this.#options); diff --git a/src/dialects/postgres/postgres-introspector.ts b/src/dialects/postgres/postgres-introspector.ts index e2dd79e..1600a7a 100644 --- a/src/dialects/postgres/postgres-introspector.ts +++ b/src/dialects/postgres/postgres-introspector.ts @@ -18,7 +18,7 @@ type PostgresDomainInspector = { }; export type PostgresIntrospectorOptions = { - skipDomains?: boolean; + domains: boolean; }; export class PostgresIntrospector extends Introspector { @@ -27,7 +27,7 @@ export class PostgresIntrospector extends Introspector { constructor( adapter: PostgresAdapter, - options: PostgresIntrospectorOptions = {}, + options: PostgresIntrospectorOptions = { domains: true }, ) { super(); this.adapter = adapter; @@ -104,7 +104,7 @@ export class PostgresIntrospector extends Introspector { } async #introspectDomains(db: Kysely) { - if (this.#options.skipDomains) { + if (!this.#options.domains) { return []; } From 2faec07b24f41111030bfdadd2243f1b2d6de1be Mon Sep 17 00:00:00 2001 From: Robin Blomberg Date: Tue, 19 Mar 2024 06:42:24 +0100 Subject: [PATCH 17/23] chore: bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b5f285e..fc93419 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kysely-codegen", - "version": "0.14.0", + "version": "0.14.1", "author": "Robin Blomberg", "license": "MIT", "main": "./dist/index.js", From 569096cdcf6ee94d83d27566bc4f4a5b8302071e Mon Sep 17 00:00:00 2001 From: jrhizor Date: Tue, 26 Mar 2024 17:53:06 -0700 Subject: [PATCH 18/23] fix flags in readme --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6d617b0..e86f33b 100644 --- a/README.md +++ b/README.md @@ -99,21 +99,21 @@ export interface DB { ## Include/exclude patterns -You can choose which tables should be included during code generation by providing a glob pattern to the `--include` and `--exclude` flags. We use [micromatch](https://github.com/micromatch/micromatch) under the hood which provides advanced glob support. For instance, if you only want to include your public tables: +You can choose which tables should be included during code generation by providing a glob pattern to the `--include-pattern` and `--exclude-pattern` flags. We use [micromatch](https://github.com/micromatch/micromatch) under the hood which provides advanced glob support. For instance, if you only want to include your public tables: ```bash -kysely-codegen --include="public.*" +kysely-codegen --include-pattern="public.*" ``` You can also include only certain tables within a schema: ```bash -kysely-codegen --include="public.+(user|post)" +kysely-codegen --include-pattern="public.+(user|post)" ``` Or exclude an entire class of tables: ```bash -kysely-codegen --exclude="documents.*" +kysely-codegen --exclude-pattern="documents.*" ``` ## Help From be70e2556d9e80313b693288f9328a113458e290 Mon Sep 17 00:00:00 2001 From: Robin Blomberg Date: Sun, 31 Mar 2024 11:06:08 +0200 Subject: [PATCH 19/23] docs: add polar.sh funding information --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index e86f33b..51f61d0 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,10 @@ - [Installation](#installation) - [Generating type definitions](#generating-type-definitions) +- [Include/exclude patterns](#includeexclude-patterns) +- [Help](#help) - [Using the type definitions](#using-the-type-definitions) +- [Issue funding](#issue-funding) ## Installation @@ -112,11 +115,13 @@ kysely-codegen --include-pattern="public.+(user|post)" ``` Or exclude an entire class of tables: + ```bash kysely-codegen --exclude-pattern="documents.*" ``` ## Help + For more options, run `kysely-codegen --help`. ## Using the type definitions @@ -139,3 +144,9 @@ const db = new Kysely({ const rows = await db.selectFrom('user').selectAll().execute(); // ^ { company_id: number | null; created_at: Date; email: string; id: number; ... }[] ``` + +## Issue funding + +We use [Polar.sh](https://polar.sh/RobinBlomberg) to upvote and promote specific features that you would like to see implemented. Check the backlog and help out: + + From 8ff7048957d6ba7793b4faabc033ca360bc803b4 Mon Sep 17 00:00:00 2001 From: Robin Blomberg Date: Sun, 31 Mar 2024 16:08:34 +0200 Subject: [PATCH 20/23] fix(cli): make --print work again --- package.json | 2 +- src/cli/cli.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index fc93419..621bad2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kysely-codegen", - "version": "0.14.1", + "version": "0.14.2", "author": "Robin Blomberg", "license": "MIT", "main": "./dist/index.js", diff --git a/src/cli/cli.ts b/src/cli/cli.ts index 8eb6850..f8eec9d 100644 --- a/src/cli/cli.ts +++ b/src/cli/cli.ts @@ -44,6 +44,7 @@ export class Cli { const excludePattern = options.excludePattern; const includePattern = options.includePattern; const outFile = options.outFile; + const print = !!options.print; const runtimeEnums = options.runtimeEnums; const schema = options.schema; const typeOnlyImports = options.typeOnlyImports; @@ -87,6 +88,7 @@ export class Cli { includePattern, logger, outFile, + print, runtimeEnums, schema, typeOnlyImports, From e7f8d145dff481c25a86c516d88d062dc57aa908 Mon Sep 17 00:00:00 2001 From: Robin Blomberg Date: Sun, 31 Mar 2024 16:40:14 +0200 Subject: [PATCH 21/23] chore: bump dependencies --- package.json | 23 ++- pnpm-lock.yaml | 276 ++++++++++++++++------------ src/dialects/mssql/mssql-dialect.ts | 4 +- 3 files changed, 172 insertions(+), 131 deletions(-) diff --git a/package.json b/package.json index 621bad2..dc75865 100644 --- a/package.json +++ b/package.json @@ -49,29 +49,29 @@ "devDependencies": { "@libsql/kysely-libsql": "^0.3.0", "@robinblomberg/eslint-config-prettier": "^0.1.4", - "@robinblomberg/eslint-config-robinblomberg": "0.27.0", + "@robinblomberg/eslint-config-robinblomberg": "0.28.0", "@robinblomberg/prettier-config": "^0.1.2", "@types/better-sqlite3": "^7.6.9", "@types/git-diff": "^2.0.7", "@types/micromatch": "^4.0.6", "@types/minimist": "^1.2.5", - "@types/node": "^20.11.28", - "@types/pg": "^8.11.2", + "@types/node": "^20.12.2", + "@types/pg": "^8.11.4", "@types/tedious": "^4.0.14", - "@typescript-eslint/parser": "^7.2.0", + "@typescript-eslint/parser": "^7.4.0", "better-sqlite3": "^9.4.3", "eslint": "^8.57.0", "kysely": "^0.27.3", - "kysely-bun-worker": "^0.5.7", - "mysql2": "^3.9.2", + "kysely-bun-worker": "^0.6.0", + "mysql2": "^3.9.3", "npm-run-all": "^4.1.5", - "pg": "^8.11.3", - "pnpm": "^8.15.4", + "pg": "^8.11.4", + "pnpm": "^8.15.5", "prettier": "^3.2.5", "rimraf": "^5.0.5", "ts-node-dev": "^2.0.0", "tsx": "^4.7.1", - "typescript": "^5.4.2", + "typescript": "^5.4.3", "vitest": "^1.4.0" }, "peerDependencies": { @@ -119,7 +119,10 @@ "@robinblomberg/robinblomberg", "@robinblomberg/prettier" ], - "ignorePatterns": "**/src/core/outputs/*.ts" + "ignorePatterns": "**/src/core/outputs/*.ts", + "rules": { + "unicorn/prefer-node-protocol": 0 + } }, "prettier": "@robinblomberg/prettier-config" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5b8dfa7..7b049bc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -41,8 +41,8 @@ devDependencies: specifier: ^0.1.4 version: 0.1.4 '@robinblomberg/eslint-config-robinblomberg': - specifier: 0.27.0 - version: 0.27.0(eslint@8.57.0)(typescript@5.4.2) + specifier: 0.28.0 + version: 0.28.0(eslint@8.57.0)(typescript@5.4.3) '@robinblomberg/prettier-config': specifier: ^0.1.2 version: 0.1.2 @@ -59,17 +59,17 @@ devDependencies: specifier: ^1.2.5 version: 1.2.5 '@types/node': - specifier: ^20.11.28 - version: 20.11.28 + specifier: ^20.12.2 + version: 20.12.2 '@types/pg': - specifier: ^8.11.2 - version: 8.11.2 + specifier: ^8.11.4 + version: 8.11.4 '@types/tedious': specifier: ^4.0.14 version: 4.0.14 '@typescript-eslint/parser': - specifier: ^7.2.0 - version: 7.2.0(eslint@8.57.0)(typescript@5.4.2) + specifier: ^7.4.0 + version: 7.4.0(eslint@8.57.0)(typescript@5.4.3) better-sqlite3: specifier: ^9.4.3 version: 9.4.3 @@ -80,20 +80,20 @@ devDependencies: specifier: ^0.27.3 version: 0.27.3 kysely-bun-worker: - specifier: ^0.5.7 - version: 0.5.7(kysely@0.27.3) + specifier: ^0.6.0 + version: 0.6.0(kysely@0.27.3) mysql2: - specifier: ^3.9.2 - version: 3.9.2 + specifier: ^3.9.3 + version: 3.9.3 npm-run-all: specifier: ^4.1.5 version: 4.1.5 pg: - specifier: ^8.11.3 - version: 8.11.3 + specifier: ^8.11.4 + version: 8.11.4 pnpm: - specifier: ^8.15.4 - version: 8.15.4 + specifier: ^8.15.5 + version: 8.15.5 prettier: specifier: ^3.2.5 version: 3.2.5 @@ -102,16 +102,16 @@ devDependencies: version: 5.0.5 ts-node-dev: specifier: ^2.0.0 - version: 2.0.0(@types/node@20.11.28)(typescript@5.4.2) + version: 2.0.0(@types/node@20.12.2)(typescript@5.4.3) tsx: specifier: ^4.7.1 version: 4.7.1 typescript: - specifier: ^5.4.2 - version: 5.4.2 + specifier: ^5.4.3 + version: 5.4.3 vitest: specifier: ^1.4.0 - version: 1.4.0(@types/node@20.11.28) + version: 1.4.0(@types/node@20.12.2) packages: @@ -928,19 +928,19 @@ packages: resolution: {integrity: sha512-gAGbmxj3fJFS2VQWfhyNCQ/GS96BrEDak+Axh1usVLkibVh7fTPIulR3RkttQP84BT8EP0OF+Uast4pqpDTKzg==} dev: true - /@robinblomberg/eslint-config-robinblomberg@0.27.0(eslint@8.57.0)(typescript@5.4.2): - resolution: {integrity: sha512-YgBFXy9DmeVcC4gjK53FEhBDy9Kr+4W7qSoZY1jjTHd+4FhfY50EbCc3dcqbFqfqeFoLA7CfSqJX3dCpdE+UBg==} + /@robinblomberg/eslint-config-robinblomberg@0.28.0(eslint@8.57.0)(typescript@5.4.3): + resolution: {integrity: sha512-QjDPHYVR0YqA4M3Y/gvgP9pi1WqHZjnXhzkwwHreF+odRb/m3FwJm1oqyTKjVflce5Ct3HJ5JTLD4MLJWI4cRQ==} peerDependencies: eslint: ^8.43.0 typescript: '>=4.2.0' dependencies: '@babel/core': 7.24.0 '@babel/eslint-parser': 7.23.10(@babel/core@7.24.0)(eslint@8.57.0) - '@typescript-eslint/eslint-plugin': 7.2.0(@typescript-eslint/parser@7.2.0)(eslint@8.57.0)(typescript@5.4.2) - '@typescript-eslint/parser': 7.2.0(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/eslint-plugin': 7.2.0(@typescript-eslint/parser@7.4.0)(eslint@8.57.0)(typescript@5.4.3) + '@typescript-eslint/parser': 7.4.0(eslint@8.57.0)(typescript@5.4.3) eslint: 8.57.0 eslint-define-config: 2.1.0 - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.2.0)(eslint@8.57.0) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.4.0)(eslint@8.57.0) eslint-plugin-jsdoc: 48.2.1(eslint@8.57.0) eslint-plugin-jsx-a11y: 6.8.0(eslint@8.57.0) eslint-plugin-react: 7.34.1(eslint@8.57.0) @@ -949,9 +949,9 @@ packages: eslint-plugin-sonarjs: 0.24.0(eslint@8.57.0) eslint-plugin-sort-exports: 0.9.1(eslint@8.57.0) eslint-plugin-sort-keys: 2.3.5 - eslint-plugin-storybook: 0.8.0(eslint@8.57.0)(typescript@5.4.2) + eslint-plugin-storybook: 0.8.0(eslint@8.57.0)(typescript@5.4.3) eslint-plugin-unicorn: 51.0.1(eslint@8.57.0) - typescript: 5.4.2 + typescript: 5.4.3 transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack @@ -1106,7 +1106,7 @@ packages: /@types/better-sqlite3@7.6.9: resolution: {integrity: sha512-FvktcujPDj9XKMJQWFcl2vVl7OdRIqsSRX9b0acWwTmwLK9CF2eqo/FRcmMLNpugKoX/avA6pb7TorDLmpgTnQ==} dependencies: - '@types/node': 20.11.28 + '@types/node': 20.12.2 dev: true /@types/braces@3.0.4: @@ -1142,12 +1142,12 @@ packages: /@types/node-fetch@2.6.11: resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==} dependencies: - '@types/node': 20.11.28 + '@types/node': 20.12.2 form-data: 4.0.0 dev: true - /@types/node@20.11.28: - resolution: {integrity: sha512-M/GPWVS2wLkSkNHVeLkrF2fD5Lx5UC4PxA0uZcKc6QqbIQUJyW1jVjueJYi1z8n0I5PxYrtpnPnWglE+y9A0KA==} + /@types/node@20.12.2: + resolution: {integrity: sha512-zQ0NYO87hyN6Xrclcqp7f8ZbXNbRfoGWNcMvHTPQp9UUrwI0mI7XBz+cu7/W6/VClYo2g63B0cjull/srU7LgQ==} dependencies: undici-types: 5.26.5 @@ -1155,10 +1155,10 @@ packages: resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} dev: true - /@types/pg@8.11.2: - resolution: {integrity: sha512-G2Mjygf2jFMU/9hCaTYxJrwdObdcnuQde1gndooZSOHsNSaCehAuwc7EIuSA34Do8Jx2yZ19KtvW8P0j4EuUXw==} + /@types/pg@8.11.4: + resolution: {integrity: sha512-yw3Bwbda6vO+NvI1Ue/YKOwtl31AYvvd/e73O3V4ZkNzuGpTDndLSyc0dQRB2xrQqDePd20pEGIfqSp/GH3pRw==} dependencies: - '@types/node': 20.11.28 + '@types/node': 20.12.2 pg-protocol: 1.6.0 pg-types: 4.0.2 dev: true @@ -1166,7 +1166,7 @@ packages: /@types/readable-stream@4.0.10: resolution: {integrity: sha512-AbUKBjcC8SHmImNi4yK2bbjogQlkFSg7shZCcicxPQapniOlajG8GCc39lvXzCWX4lLRRs7DM3VAeSlqmEVZUA==} dependencies: - '@types/node': 20.11.28 + '@types/node': 20.12.2 safe-buffer: 5.1.2 dev: false @@ -1185,16 +1185,16 @@ packages: /@types/tedious@4.0.14: resolution: {integrity: sha512-KHPsfX/FoVbUGbyYvk1q9MMQHLPeRZhRJZdO45Q4YjvFkv4hMNghCWTvy7rdKessBsmtz4euWCWAB6/tVpI1Iw==} dependencies: - '@types/node': 20.11.28 + '@types/node': 20.12.2 dev: true /@types/ws@8.5.10: resolution: {integrity: sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==} dependencies: - '@types/node': 20.11.28 + '@types/node': 20.12.2 dev: true - /@typescript-eslint/eslint-plugin@7.2.0(@typescript-eslint/parser@7.2.0)(eslint@8.57.0)(typescript@5.4.2): + /@typescript-eslint/eslint-plugin@7.2.0(@typescript-eslint/parser@7.4.0)(eslint@8.57.0)(typescript@5.4.3): resolution: {integrity: sha512-mdekAHOqS9UjlmyF/LSs6AIEvfceV749GFxoBAjwAv0nkevfKHWQFDMcBZWUiIC5ft6ePWivXoS36aKQ0Cy3sw==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -1206,10 +1206,10 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 7.2.0(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/parser': 7.4.0(eslint@8.57.0)(typescript@5.4.3) '@typescript-eslint/scope-manager': 7.2.0 - '@typescript-eslint/type-utils': 7.2.0(eslint@8.57.0)(typescript@5.4.2) - '@typescript-eslint/utils': 7.2.0(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/type-utils': 7.2.0(eslint@8.57.0)(typescript@5.4.3) + '@typescript-eslint/utils': 7.2.0(eslint@8.57.0)(typescript@5.4.3) '@typescript-eslint/visitor-keys': 7.2.0 debug: 4.3.4 eslint: 8.57.0 @@ -1217,15 +1217,15 @@ packages: ignore: 5.3.1 natural-compare: 1.4.0 semver: 7.6.0 - ts-api-utils: 1.2.1(typescript@5.4.2) - typescript: 5.4.2 + ts-api-utils: 1.2.1(typescript@5.4.3) + typescript: 5.4.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.4.2): - resolution: {integrity: sha512-5FKsVcHTk6TafQKQbuIVkXq58Fnbkd2wDL4LB7AURN7RUOu1utVP+G8+6u3ZhEroW3DF6hyo3ZEXxgKgp4KeCg==} - engines: {node: ^16.0.0 || >=18.0.0} + /@typescript-eslint/parser@7.4.0(eslint@8.57.0)(typescript@5.4.3): + resolution: {integrity: sha512-ZvKHxHLusweEUVwrGRXXUVzFgnWhigo4JurEj0dGF1tbcGh6buL+ejDdjxOQxv6ytcY1uhun1p2sm8iWStlgLQ==} + engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: ^8.56.0 typescript: '*' @@ -1233,13 +1233,13 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 7.2.0 - '@typescript-eslint/types': 7.2.0 - '@typescript-eslint/typescript-estree': 7.2.0(typescript@5.4.2) - '@typescript-eslint/visitor-keys': 7.2.0 + '@typescript-eslint/scope-manager': 7.4.0 + '@typescript-eslint/types': 7.4.0 + '@typescript-eslint/typescript-estree': 7.4.0(typescript@5.4.3) + '@typescript-eslint/visitor-keys': 7.4.0 debug: 4.3.4 eslint: 8.57.0 - typescript: 5.4.2 + typescript: 5.4.3 transitivePeerDependencies: - supports-color dev: true @@ -1260,7 +1260,15 @@ packages: '@typescript-eslint/visitor-keys': 7.2.0 dev: true - /@typescript-eslint/type-utils@7.2.0(eslint@8.57.0)(typescript@5.4.2): + /@typescript-eslint/scope-manager@7.4.0: + resolution: {integrity: sha512-68VqENG5HK27ypafqLVs8qO+RkNc7TezCduYrx8YJpXq2QGZ30vmNZGJJJC48+MVn4G2dCV8m5ZTVnzRexTVtw==} + engines: {node: ^18.18.0 || >=20.0.0} + dependencies: + '@typescript-eslint/types': 7.4.0 + '@typescript-eslint/visitor-keys': 7.4.0 + dev: true + + /@typescript-eslint/type-utils@7.2.0(eslint@8.57.0)(typescript@5.4.3): resolution: {integrity: sha512-xHi51adBHo9O9330J8GQYQwrKBqbIPJGZZVQTHHmy200hvkLZFWJIFtAG/7IYTWUyun6DE6w5InDReePJYJlJA==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -1270,12 +1278,12 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 7.2.0(typescript@5.4.2) - '@typescript-eslint/utils': 7.2.0(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/typescript-estree': 7.2.0(typescript@5.4.3) + '@typescript-eslint/utils': 7.2.0(eslint@8.57.0)(typescript@5.4.3) debug: 4.3.4 eslint: 8.57.0 - ts-api-utils: 1.2.1(typescript@5.4.2) - typescript: 5.4.2 + ts-api-utils: 1.2.1(typescript@5.4.3) + typescript: 5.4.3 transitivePeerDependencies: - supports-color dev: true @@ -1290,7 +1298,12 @@ packages: engines: {node: ^16.0.0 || >=18.0.0} dev: true - /@typescript-eslint/typescript-estree@5.62.0(typescript@5.4.2): + /@typescript-eslint/types@7.4.0: + resolution: {integrity: sha512-mjQopsbffzJskos5B4HmbsadSJQWaRK0UxqQ7GuNA9Ga4bEKeiO6b2DnB6cM6bpc8lemaPseh0H9B/wyg+J7rw==} + engines: {node: ^18.18.0 || >=20.0.0} + dev: true + + /@typescript-eslint/typescript-estree@5.62.0(typescript@5.4.3): resolution: {integrity: sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -1305,13 +1318,13 @@ packages: globby: 11.1.0 is-glob: 4.0.3 semver: 7.6.0 - tsutils: 3.21.0(typescript@5.4.2) - typescript: 5.4.2 + tsutils: 3.21.0(typescript@5.4.3) + typescript: 5.4.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/typescript-estree@7.2.0(typescript@5.4.2): + /@typescript-eslint/typescript-estree@7.2.0(typescript@5.4.3): resolution: {integrity: sha512-cyxS5WQQCoBwSakpMrvMXuMDEbhOo9bNHHrNcEWis6XHx6KF518tkF1wBvKIn/tpq5ZpUYK7Bdklu8qY0MsFIA==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -1327,13 +1340,35 @@ packages: is-glob: 4.0.3 minimatch: 9.0.3 semver: 7.6.0 - ts-api-utils: 1.2.1(typescript@5.4.2) - typescript: 5.4.2 + ts-api-utils: 1.2.1(typescript@5.4.3) + typescript: 5.4.3 + transitivePeerDependencies: + - supports-color + dev: true + + /@typescript-eslint/typescript-estree@7.4.0(typescript@5.4.3): + resolution: {integrity: sha512-A99j5AYoME/UBQ1ucEbbMEmGkN7SE0BvZFreSnTd1luq7yulcHdyGamZKizU7canpGDWGJ+Q6ZA9SyQobipePg==} + engines: {node: ^18.18.0 || >=20.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/types': 7.4.0 + '@typescript-eslint/visitor-keys': 7.4.0 + debug: 4.3.4 + globby: 11.1.0 + is-glob: 4.0.3 + minimatch: 9.0.3 + semver: 7.6.0 + ts-api-utils: 1.2.1(typescript@5.4.3) + typescript: 5.4.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils@5.62.0(eslint@8.57.0)(typescript@5.4.2): + /@typescript-eslint/utils@5.62.0(eslint@8.57.0)(typescript@5.4.3): resolution: {integrity: sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -1344,7 +1379,7 @@ packages: '@types/semver': 7.5.8 '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.4.2) + '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.4.3) eslint: 8.57.0 eslint-scope: 5.1.1 semver: 7.6.0 @@ -1353,7 +1388,7 @@ packages: - typescript dev: true - /@typescript-eslint/utils@7.2.0(eslint@8.57.0)(typescript@5.4.2): + /@typescript-eslint/utils@7.2.0(eslint@8.57.0)(typescript@5.4.3): resolution: {integrity: sha512-YfHpnMAGb1Eekpm3XRK8hcMwGLGsnT6L+7b2XyRv6ouDuJU1tZir1GS2i0+VXRatMwSI1/UfcyPe53ADkU+IuA==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -1364,7 +1399,7 @@ packages: '@types/semver': 7.5.8 '@typescript-eslint/scope-manager': 7.2.0 '@typescript-eslint/types': 7.2.0 - '@typescript-eslint/typescript-estree': 7.2.0(typescript@5.4.2) + '@typescript-eslint/typescript-estree': 7.2.0(typescript@5.4.3) eslint: 8.57.0 semver: 7.6.0 transitivePeerDependencies: @@ -1388,6 +1423,14 @@ packages: eslint-visitor-keys: 3.4.3 dev: true + /@typescript-eslint/visitor-keys@7.4.0: + resolution: {integrity: sha512-0zkC7YM0iX5Y41homUUeW1CHtZR01K3ybjM1l6QczoMuay0XKtrb93kv95AxUGwdjGr64nNqnOCwmEl616N8CA==} + engines: {node: ^18.18.0 || >=20.0.0} + dependencies: + '@typescript-eslint/types': 7.4.0 + eslint-visitor-keys: 3.4.3 + dev: true + /@ungap/structured-clone@1.2.0: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: true @@ -1756,11 +1799,6 @@ packages: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} dev: true - /buffer-writer@2.0.0: - resolution: {integrity: sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==} - engines: {node: '>=4'} - dev: true - /buffer@5.7.1: resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} dependencies: @@ -2290,7 +2328,7 @@ packages: - supports-color dev: true - /eslint-module-utils@2.8.1(@typescript-eslint/parser@7.2.0)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0): + /eslint-module-utils@2.8.1(@typescript-eslint/parser@7.4.0)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0): resolution: {integrity: sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==} engines: {node: '>=4'} peerDependencies: @@ -2311,7 +2349,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 7.2.0(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/parser': 7.4.0(eslint@8.57.0)(typescript@5.4.3) debug: 3.2.7 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 @@ -2319,7 +2357,7 @@ packages: - supports-color dev: true - /eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.2.0)(eslint@8.57.0): + /eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.4.0)(eslint@8.57.0): resolution: {integrity: sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==} engines: {node: '>=4'} peerDependencies: @@ -2329,7 +2367,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 7.2.0(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/parser': 7.4.0(eslint@8.57.0)(typescript@5.4.3) array-includes: 3.1.7 array.prototype.findlastindex: 1.2.4 array.prototype.flat: 1.3.2 @@ -2338,7 +2376,7 @@ packages: doctrine: 2.1.0 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.1(@typescript-eslint/parser@7.2.0)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0) + eslint-module-utils: 2.8.1(@typescript-eslint/parser@7.4.0)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0) hasown: 2.0.1 is-core-module: 2.13.1 is-glob: 4.0.3 @@ -2467,14 +2505,14 @@ packages: natural-compare: 1.4.0 dev: true - /eslint-plugin-storybook@0.8.0(eslint@8.57.0)(typescript@5.4.2): + /eslint-plugin-storybook@0.8.0(eslint@8.57.0)(typescript@5.4.3): resolution: {integrity: sha512-CZeVO5EzmPY7qghO2t64oaFM+8FTaD4uzOEjHKp516exyTKo+skKAL9GI3QALS2BXhyALJjNtwbmr1XinGE8bA==} engines: {node: '>= 18'} peerDependencies: eslint: '>=6' dependencies: '@storybook/csf': 0.0.1 - '@typescript-eslint/utils': 5.62.0(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/utils': 5.62.0(eslint@8.57.0)(typescript@5.4.3) eslint: 8.57.0 requireindex: 1.2.0 ts-dedent: 2.2.0 @@ -3405,8 +3443,8 @@ packages: json-buffer: 3.0.1 dev: true - /kysely-bun-worker@0.5.7(kysely@0.27.3): - resolution: {integrity: sha512-P4W5moWU6A1xJ2GvGbdrPDiasSKTjuBfItU1vj+wZlA+A6AXv8Nxk0nScuBu8F12UnalrIDDu+oLCF5wC3Z4EA==} + /kysely-bun-worker@0.6.0(kysely@0.27.3): + resolution: {integrity: sha512-EqxoVSJdKhvXq7tTP7K/d6eUsL/g0K9h9syDOGN9dBiSMcFj2EzMAppLZ1JwuVH0CYAJqlKm0wB8hHUvOwQmHQ==} peerDependencies: kysely: '>=0.26' dependencies: @@ -3662,8 +3700,8 @@ packages: /ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - /mysql2@3.9.2: - resolution: {integrity: sha512-3Cwg/UuRkAv/wm6RhtPE5L7JlPB877vwSF6gfLAS68H+zhH+u5oa3AieqEd0D0/kC3W7qIhYbH419f7O9i/5nw==} + /mysql2@3.9.3: + resolution: {integrity: sha512-+ZaoF0llESUy7BffccHG+urErHcWPZ/WuzYAA9TEeLaDYyke3/3D+VQDzK9xzRnXpd0eMtRf0WNOeo4Q1Baung==} engines: {node: '>= 8.0'} dependencies: denque: 2.1.0 @@ -3911,10 +3949,6 @@ packages: engines: {node: '>=6'} dev: true - /packet-reader@1.0.0: - resolution: {integrity: sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ==} - dev: true - /parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} @@ -4001,8 +4035,8 @@ packages: dev: true optional: true - /pg-connection-string@2.6.2: - resolution: {integrity: sha512-ch6OwaeaPYcova4kKZ15sbJ2hKb/VP48ZD2gE7i1J+L4MspCtBMAx8nMgz7bksc7IojCIIWuEhHibSMFH8m8oA==} + /pg-connection-string@2.6.3: + resolution: {integrity: sha512-77FxhhKJQH+xJx6tDqkhhMa0nZvv3U1HYLDQgwZxZafVD583++O5LXn5oo5HaQZ0vXwYcZA1koYAJM3JvD6Gtw==} dev: true /pg-int8@1.0.1: @@ -4015,18 +4049,22 @@ packages: engines: {node: '>=4'} dev: true - /pg-pool@3.6.1(pg@8.11.3): - resolution: {integrity: sha512-jizsIzhkIitxCGfPRzJn1ZdcosIt3pz9Sh3V01fm1vZnbnCMgmGl5wvGGdNN2EL9Rmb0EcFoCkixH4Pu+sP9Og==} + /pg-pool@3.6.2(pg@8.11.4): + resolution: {integrity: sha512-Htjbg8BlwXqSBQ9V8Vjtc+vzf/6fVUuak/3/XXKA9oxZprwW3IMDQTGHP+KDmVL7rtd+R1QjbnCFPuTHm3G4hg==} peerDependencies: pg: '>=8.0' dependencies: - pg: 8.11.3 + pg: 8.11.4 dev: true /pg-protocol@1.6.0: resolution: {integrity: sha512-M+PDm637OY5WM307051+bsDia5Xej6d9IR4GwJse1qA1DIhiKlksvrneZOYQq42OM+spubpcNYEo2FcKQrDk+Q==} dev: true + /pg-protocol@1.6.1: + resolution: {integrity: sha512-jPIlvgoD63hrEuihvIg+tJhoGjUsLPn6poJY9N5CnlPd91c2T18T/9zBtLxZSb1EhYxBRoZJtzScCaWlYLtktg==} + dev: true + /pg-types@2.2.0: resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==} engines: {node: '>=4'} @@ -4051,8 +4089,8 @@ packages: postgres-range: 1.1.4 dev: true - /pg@8.11.3: - resolution: {integrity: sha512-+9iuvG8QfaaUrrph+kpF24cXkH1YOOUeArRNYIxq1viYHZagBxrTno7cecY1Fa44tJeZvaoG+Djpkc3JwehN5g==} + /pg@8.11.4: + resolution: {integrity: sha512-pWb7JKPxGk1UFbtq7jQ0m3IfPpb7LLACCEyN8/u9DYEom+Q/BSKy+4TRl4+Hh003AOYhppB/z+QK87/hx/bk0w==} engines: {node: '>= 8.0.0'} peerDependencies: pg-native: '>=3.0.1' @@ -4060,11 +4098,9 @@ packages: pg-native: optional: true dependencies: - buffer-writer: 2.0.0 - packet-reader: 1.0.0 - pg-connection-string: 2.6.2 - pg-pool: 3.6.1(pg@8.11.3) - pg-protocol: 1.6.0 + pg-connection-string: 2.6.3 + pg-pool: 3.6.2(pg@8.11.4) + pg-protocol: 1.6.1 pg-types: 2.2.0 pgpass: 1.0.5 optionalDependencies: @@ -4109,8 +4145,8 @@ packages: engines: {node: '>=4'} dev: true - /pnpm@8.15.4: - resolution: {integrity: sha512-C9Opvp6w6aaSZ23uwAowO6IYuiedmSQUdWFrOY267t0RFG+SwoQ0WPVXsdEn4J1MFx4QW9zWthACs5aFqAFrng==} + /pnpm@8.15.5: + resolution: {integrity: sha512-sFGjLH5pWDO4SSbTspuMylclS1ifBknYmcbp0O22cLkex+KkNFm65zdZu1zmGcMmbxFr+THOItHvF1mn5Fqpbw==} engines: {node: '>=16.14'} hasBin: true dev: true @@ -4887,13 +4923,13 @@ packages: hasBin: true dev: true - /ts-api-utils@1.2.1(typescript@5.4.2): + /ts-api-utils@1.2.1(typescript@5.4.3): resolution: {integrity: sha512-RIYA36cJn2WiH9Hy77hdF9r7oEwxAtB/TS9/S4Qd90Ap4z5FSiin5zEiTL44OII1Y3IIlEvxwxFUVgrHSZ/UpA==} engines: {node: '>=16'} peerDependencies: typescript: '>=4.2.0' dependencies: - typescript: 5.4.2 + typescript: 5.4.3 dev: true /ts-dedent@2.2.0: @@ -4901,7 +4937,7 @@ packages: engines: {node: '>=6.10'} dev: true - /ts-node-dev@2.0.0(@types/node@20.11.28)(typescript@5.4.2): + /ts-node-dev@2.0.0(@types/node@20.12.2)(typescript@5.4.3): resolution: {integrity: sha512-ywMrhCfH6M75yftYvrvNarLEY+SUXtUvU8/0Z6llrHQVBx12GiFk5sStF8UdfE/yfzk9IAq7O5EEbTQsxlBI8w==} engines: {node: '>=0.8.0'} hasBin: true @@ -4920,16 +4956,16 @@ packages: rimraf: 2.7.1 source-map-support: 0.5.21 tree-kill: 1.2.2 - ts-node: 10.9.2(@types/node@20.11.28)(typescript@5.4.2) + ts-node: 10.9.2(@types/node@20.12.2)(typescript@5.4.3) tsconfig: 7.0.0 - typescript: 5.4.2 + typescript: 5.4.3 transitivePeerDependencies: - '@swc/core' - '@swc/wasm' - '@types/node' dev: true - /ts-node@10.9.2(@types/node@20.11.28)(typescript@5.4.2): + /ts-node@10.9.2(@types/node@20.12.2)(typescript@5.4.3): resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} hasBin: true peerDependencies: @@ -4948,14 +4984,14 @@ packages: '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 20.11.28 + '@types/node': 20.12.2 acorn: 8.11.3 acorn-walk: 8.3.2 arg: 4.1.3 create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 5.4.2 + typescript: 5.4.3 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 dev: true @@ -4986,14 +5022,14 @@ packages: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} dev: false - /tsutils@3.21.0(typescript@5.4.2): + /tsutils@3.21.0(typescript@5.4.3): resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} peerDependencies: typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' dependencies: tslib: 1.14.1 - typescript: 5.4.2 + typescript: 5.4.3 dev: true /tsx@4.7.1: @@ -5080,8 +5116,8 @@ packages: is-typed-array: 1.1.13 possible-typed-array-names: 1.0.0 - /typescript@5.4.2: - resolution: {integrity: sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==} + /typescript@5.4.3: + resolution: {integrity: sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==} engines: {node: '>=14.17'} hasBin: true dev: true @@ -5138,7 +5174,7 @@ packages: spdx-expression-parse: 3.0.1 dev: true - /vite-node@1.4.0(@types/node@20.11.28): + /vite-node@1.4.0(@types/node@20.12.2): resolution: {integrity: sha512-VZDAseqjrHgNd4Kh8icYHWzTKSCZMhia7GyHfhtzLW33fZlG9SwsB6CEhgyVOWkJfJ2pFLrp/Gj1FSfAiqH9Lw==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true @@ -5147,7 +5183,7 @@ packages: debug: 4.3.4 pathe: 1.1.2 picocolors: 1.0.0 - vite: 5.1.5(@types/node@20.11.28) + vite: 5.1.5(@types/node@20.12.2) transitivePeerDependencies: - '@types/node' - less @@ -5159,7 +5195,7 @@ packages: - terser dev: true - /vite@5.1.5(@types/node@20.11.28): + /vite@5.1.5(@types/node@20.12.2): resolution: {integrity: sha512-BdN1xh0Of/oQafhU+FvopafUp6WaYenLU/NFoL5WyJL++GxkNfieKzBhM24H3HVsPQrlAqB7iJYTHabzaRed5Q==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true @@ -5187,7 +5223,7 @@ packages: terser: optional: true dependencies: - '@types/node': 20.11.28 + '@types/node': 20.12.2 esbuild: 0.19.12 postcss: 8.4.35 rollup: 4.12.1 @@ -5195,7 +5231,7 @@ packages: fsevents: 2.3.3 dev: true - /vitest@1.4.0(@types/node@20.11.28): + /vitest@1.4.0(@types/node@20.12.2): resolution: {integrity: sha512-gujzn0g7fmwf83/WzrDTnncZt2UiXP41mHuFYFrdwaLRVQ6JYQEiME2IfEjU3vcFL3VKa75XhI3lFgn+hfVsQw==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true @@ -5220,7 +5256,7 @@ packages: jsdom: optional: true dependencies: - '@types/node': 20.11.28 + '@types/node': 20.12.2 '@vitest/expect': 1.4.0 '@vitest/runner': 1.4.0 '@vitest/snapshot': 1.4.0 @@ -5238,8 +5274,8 @@ packages: strip-literal: 2.0.0 tinybench: 2.6.0 tinypool: 0.8.2 - vite: 5.1.5(@types/node@20.11.28) - vite-node: 1.4.0(@types/node@20.11.28) + vite: 5.1.5(@types/node@20.12.2) + vite-node: 1.4.0(@types/node@20.12.2) why-is-node-running: 2.2.2 transitivePeerDependencies: - less diff --git a/src/dialects/mssql/mssql-dialect.ts b/src/dialects/mssql/mssql-dialect.ts index 8494e49..e00e1c9 100644 --- a/src/dialects/mssql/mssql-dialect.ts +++ b/src/dialects/mssql/mssql-dialect.ts @@ -24,7 +24,9 @@ export class MssqlDialect extends Dialect { >; const tokens = parsed.server!.split(','); const server = tokens[0]!; - const port = tokens[1] ? parseInt(tokens[1], 10) : DEFAULT_MSSQL_PORT; + const port = tokens[1] + ? Number.parseInt(tokens[1], 10) + : DEFAULT_MSSQL_PORT; return { database: parsed.database!, From 928c3cda57bf725c43fbc921ab64e92f63ea2c67 Mon Sep 17 00:00:00 2001 From: Tyler Gottfredsen Date: Tue, 2 Apr 2024 13:49:36 -0500 Subject: [PATCH 22/23] Fixing bit IdentifierNode to be boolean instead of buffer --- src/dialects/mssql/mssql-adapter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dialects/mssql/mssql-adapter.ts b/src/dialects/mssql/mssql-adapter.ts index 3fa4727..2c92bd4 100644 --- a/src/dialects/mssql/mssql-adapter.ts +++ b/src/dialects/mssql/mssql-adapter.ts @@ -6,7 +6,7 @@ export class MssqlAdapter extends Adapter { override readonly scalars = { bigint: new IdentifierNode('number'), binary: new IdentifierNode('Buffer'), - bit: new IdentifierNode('Buffer'), + bit: new IdentifierNode('boolean'), char: new IdentifierNode('string'), date: new IdentifierNode('Date'), datetime: new IdentifierNode('Date'), From a6a4889d9695723057cc24d1032635756c400eff Mon Sep 17 00:00:00 2001 From: Robin Blomberg Date: Thu, 18 Apr 2024 13:16:43 +0200 Subject: [PATCH 23/23] chore: bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dc75865..adcbaa6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kysely-codegen", - "version": "0.14.2", + "version": "0.15.0", "author": "Robin Blomberg", "license": "MIT", "main": "./dist/index.js",