metal-orm 1.0.79 → 1.0.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -2676,6 +2676,7 @@ type NormalizedRelationIncludeTree = Record<string, NormalizedRelationIncludeNod
2676
2676
  type QueryResult = {
2677
2677
  columns: string[];
2678
2678
  values: unknown[][];
2679
+ insertId?: number;
2679
2680
  };
2680
2681
  interface DbExecutor {
2681
2682
  /** Capability flags so the runtime can make correct decisions without relying on optional methods. */
@@ -3229,6 +3230,7 @@ declare class UnitOfWork {
3229
3230
  * @param results - Query results
3230
3231
  */
3231
3232
  private applyReturningResults;
3233
+ private applyInsertId;
3232
3234
  /**
3233
3235
  * Normalizes a column name by removing quotes and table prefixes.
3234
3236
  * @param column - The column name to normalize
@@ -3777,6 +3779,166 @@ interface PaginatedResult<T> {
3777
3779
  pageSize: number;
3778
3780
  }
3779
3781
 
3782
+ /**
3783
+ * OpenAPI 3.1 JSON Schema type representation
3784
+ */
3785
+ type JsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
3786
+ /**
3787
+ * Common OpenAPI 3.1 JSON Schema formats
3788
+ */
3789
+ type JsonSchemaFormat = 'date-time' | 'date' | 'time' | 'email' | 'uuid' | 'uri' | 'binary' | 'base64';
3790
+ /**
3791
+ * OpenAPI 3.1 JSON Schema property definition
3792
+ */
3793
+ interface JsonSchemaProperty {
3794
+ type?: JsonSchemaType | JsonSchemaType[];
3795
+ format?: JsonSchemaFormat;
3796
+ description?: string;
3797
+ nullable?: boolean;
3798
+ readOnly?: boolean;
3799
+ writeOnly?: boolean;
3800
+ minimum?: number;
3801
+ maximum?: number;
3802
+ minLength?: number;
3803
+ maxLength?: number;
3804
+ pattern?: string;
3805
+ enum?: (string | number | boolean)[];
3806
+ default?: unknown;
3807
+ example?: unknown;
3808
+ properties?: Record<string, JsonSchemaProperty>;
3809
+ required?: string[];
3810
+ items?: JsonSchemaProperty;
3811
+ $ref?: string;
3812
+ anyOf?: JsonSchemaProperty[];
3813
+ allOf?: JsonSchemaProperty[];
3814
+ oneOf?: JsonSchemaProperty[];
3815
+ [key: string]: unknown;
3816
+ }
3817
+ /**
3818
+ * OpenAPI 3.1 parameter definition
3819
+ */
3820
+ interface OpenApiParameter {
3821
+ name: string;
3822
+ in: 'query' | 'path' | 'header' | 'cookie';
3823
+ description?: string;
3824
+ required?: boolean;
3825
+ deprecated?: boolean;
3826
+ allowEmptyValue?: boolean;
3827
+ style?: string;
3828
+ explode?: boolean;
3829
+ schema?: JsonSchemaProperty;
3830
+ [key: string]: unknown;
3831
+ }
3832
+ /**
3833
+ * Complete OpenAPI 3.1 Schema for an entity or query result
3834
+ */
3835
+ interface OpenApiSchema {
3836
+ type: 'object';
3837
+ properties: Record<string, JsonSchemaProperty>;
3838
+ required: string[];
3839
+ description?: string;
3840
+ }
3841
+ /**
3842
+ * Column-level schema flags
3843
+ */
3844
+ interface ColumnSchemaOptions {
3845
+ /** Include description from column comments */
3846
+ includeDescriptions?: boolean;
3847
+ /** Include enum values for enum columns */
3848
+ includeEnums?: boolean;
3849
+ /** Include column examples if available */
3850
+ includeExamples?: boolean;
3851
+ /** Include column defaults */
3852
+ includeDefaults?: boolean;
3853
+ /** Include nullable flag when applicable */
3854
+ includeNullable?: boolean;
3855
+ }
3856
+ /**
3857
+ * Output schema generation options (query result)
3858
+ */
3859
+ interface OutputSchemaOptions extends ColumnSchemaOptions {
3860
+ /** Use selected columns only (from select/include) vs full entity */
3861
+ mode?: 'selected' | 'full';
3862
+ /** Maximum depth for relation recursion */
3863
+ maxDepth?: number;
3864
+ }
3865
+ type InputRelationMode = 'ids' | 'objects' | 'mixed';
3866
+ type InputSchemaMode = 'create' | 'update';
3867
+ /**
3868
+ * Input schema generation options (write payloads)
3869
+ */
3870
+ interface InputSchemaOptions extends ColumnSchemaOptions {
3871
+ /** Create vs update payload shape */
3872
+ mode?: InputSchemaMode;
3873
+ /** Include relation payloads */
3874
+ includeRelations?: boolean;
3875
+ /** How relations are represented (ids, nested objects, or both) */
3876
+ relationMode?: InputRelationMode;
3877
+ /** Maximum depth for relation recursion */
3878
+ maxDepth?: number;
3879
+ /** Omit read-only/generated columns from input */
3880
+ omitReadOnly?: boolean;
3881
+ /** Exclude primary key columns from input */
3882
+ excludePrimaryKey?: boolean;
3883
+ /** Require primary key columns on update payloads */
3884
+ requirePrimaryKey?: boolean;
3885
+ }
3886
+ /**
3887
+ * Schema generation options
3888
+ */
3889
+ interface SchemaOptions extends OutputSchemaOptions {
3890
+ /** Input schema options, or false to skip input generation */
3891
+ input?: InputSchemaOptions | false;
3892
+ }
3893
+ /**
3894
+ * Input + output schema bundle
3895
+ */
3896
+ interface OpenApiSchemaBundle {
3897
+ output: OpenApiSchema;
3898
+ input?: OpenApiSchema;
3899
+ parameters?: OpenApiParameter[];
3900
+ }
3901
+ /**
3902
+ * Schema extraction context for handling circular references
3903
+ */
3904
+ interface SchemaExtractionContext {
3905
+ /** Set of already visited tables to detect cycles */
3906
+ visitedTables: Set<string>;
3907
+ /** Map of table names to their generated schemas */
3908
+ schemaCache: Map<string, OpenApiSchema>;
3909
+ /** Current extraction depth */
3910
+ depth: number;
3911
+ /** Maximum depth to recurse */
3912
+ maxDepth: number;
3913
+ }
3914
+
3915
+ /**
3916
+ * Maps SQL column types to OpenAPI JSON Schema types
3917
+ */
3918
+ declare const mapColumnType: (column: ColumnDef, options?: ColumnSchemaOptions) => JsonSchemaProperty;
3919
+ /**
3920
+ * Maps relation type to array or single object
3921
+ */
3922
+ declare const mapRelationType: (relationType: string) => {
3923
+ type: "object" | "array";
3924
+ isNullable: boolean;
3925
+ };
3926
+ /**
3927
+ * Gets the OpenAPI format for temporal columns
3928
+ */
3929
+ declare const getTemporalFormat: (sqlType: string) => JsonSchemaFormat | undefined;
3930
+
3931
+ /**
3932
+ * Extracts OpenAPI 3.1 schemas for output and optional input payloads.
3933
+ */
3934
+ declare const extractSchema: (table: TableDef, plan: HydrationPlan | undefined, projectionNodes: ProjectionNode[] | undefined, options?: SchemaOptions) => OpenApiSchemaBundle;
3935
+ /**
3936
+ * Converts a schema to a JSON string with optional pretty printing
3937
+ */
3938
+ declare const schemaToJson: (schema: OpenApiSchema, pretty?: boolean) => string;
3939
+
3940
+ declare const buildFilterParameters: (table: TableDef, where: ExpressionNode | undefined, from: TableSourceNode | undefined, options?: ColumnSchemaOptions) => OpenApiParameter[];
3941
+
3780
3942
  type SelectDialectInput = Dialect | DialectKey;
3781
3943
 
3782
3944
  type ColumnSelectionValue = ColumnDef | FunctionNode | CaseExpressionNode | WindowFunctionNode | TypedExpression<unknown>;
@@ -4385,13 +4547,22 @@ declare class SelectQueryBuilder<T = EntityInstance<TableDef>, TTable extends Ta
4385
4547
  */
4386
4548
  toSql(dialect: SelectDialectInput): string;
4387
4549
  /**
4388
- * Gets the hydration plan for the query
4550
+ * Gets hydration plan for query
4389
4551
  * @returns Hydration plan or undefined if none exists
4390
4552
  * @example
4391
4553
  * const plan = qb.include('posts').getHydrationPlan();
4392
4554
  * console.log(plan?.relations); // Information about included relations
4393
4555
  */
4394
4556
  getHydrationPlan(): HydrationPlan | undefined;
4557
+ /**
4558
+ * Gets OpenAPI 3.1 JSON Schemas for query output and optional input payloads
4559
+ * @param options - Schema generation options
4560
+ * @returns OpenAPI 3.1 JSON Schemas for query output and input payloads
4561
+ * @example
4562
+ * const { output } = qb.select('id', 'title', 'author').getSchema();
4563
+ * console.log(JSON.stringify(output, null, 2));
4564
+ */
4565
+ getSchema(options?: SchemaOptions): OpenApiSchemaBundle;
4395
4566
  /**
4396
4567
  * Gets the Abstract Syntax Tree (AST) representation of the query
4397
4568
  * @returns Query AST with hydration applied
@@ -5048,6 +5219,7 @@ declare class PostgresDialect extends SqlDialectBase {
5048
5219
  * @returns Quoted identifier
5049
5220
  */
5050
5221
  quoteIdentifier(id: string): string;
5222
+ protected formatPlaceholder(index: number): string;
5051
5223
  /**
5052
5224
  * Compiles JSON path expression using PostgreSQL syntax
5053
5225
  * @param node - JSON path node
@@ -7015,4 +7187,4 @@ type PooledExecutorFactoryOptions<TConn> = {
7015
7187
  */
7016
7188
  declare function createPooledExecutorFactory<TConn>(opts: PooledExecutorFactoryOptions<TConn>): DbExecutorFactory;
7017
7189
 
7018
- export { type AliasRefNode, type AnyDomainEvent, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToReferenceApi, type BelongsToRelation, type BetweenExpressionNode, type BinaryExpressionNode, type BitwiseExpressionNode, type CascadeMode, type CaseExpressionNode, type CastExpressionNode, type CheckConstraint, type CollateExpressionNode, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, ConstructorMaterializationStrategy, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneReferenceApi, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type InExpressionRight, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, InsertQueryBuilder, type IntrospectOptions, type JsonPathNode, type Jsonify, type JsonifyScalar, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PaginatedResult, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, PrototypeMaterializationStrategy, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey$1 as RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, STANDARD_COLUMN_TYPES, type SaveGraphInputPayload, type SaveGraphInputScalar, type SaveGraphJsonScalar, type SaveGraphSessionOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SelectableKeys, type SimpleQueryRunner, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeScriptGenerator, type TypedExpression, type TypedLike, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, age, aliasRef, and, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, caseWhen, cast, cbrt, ceil, ceiling, char, charLength, chr, clearExpressionDispatchers, clearOperandDispatchers, coalesce, col, collate, columnOperand, concat, concatWs, correlateBy, cos, cot, count, countAll, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, endOfMonth, entityRef, entityRefs, eq, esel, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, generateSchemaSqlFor, getColumn, getDecoratorMetadata, getSchemaIntrospector, getTableDefFromEntity, greatest, groupConcat, gt, gte, hasMany, hasOne, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isOperandNode, isValueOperandInput, isWindowFunctionNode, jsonArrayAgg, jsonContains, jsonLength, jsonPath, jsonSet, jsonify, lag, lastValue, lead, least, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, localTime, localTimestamp, locate, log, log10, log2, logBase, lower, lpad, lt, lte, ltrim, materializeAs, max, md5, min, minute, mod, month, mul, neq, normalizeColumnType, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, nullif, octetLength, or, outerRef, pi, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, second, sel, selectFrom, selectFromEntity, setRelations, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, update, upper, utcNow, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, windowFunction, year };
7190
+ export { type AliasRefNode, type AnyDomainEvent, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToReferenceApi, type BelongsToRelation, type BetweenExpressionNode, type BinaryExpressionNode, type BitwiseExpressionNode, type CascadeMode, type CaseExpressionNode, type CastExpressionNode, type CheckConstraint, type CollateExpressionNode, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnSchemaOptions, type ColumnToTs, type ColumnType, ConstructorMaterializationStrategy, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneReferenceApi, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type InExpressionRight, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, type InputRelationMode, type InputSchemaMode, type InputSchemaOptions, InsertQueryBuilder, InterceptorPipeline, type IntrospectOptions, type JsonPathNode, type JsonSchemaFormat, type JsonSchemaProperty, type JsonSchemaType, type Jsonify, type JsonifyScalar, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OpenApiParameter, type OpenApiSchema, type OpenApiSchemaBundle, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type OutputSchemaOptions, type PaginatedResult, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, PrototypeMaterializationStrategy, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey$1 as RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, STANDARD_COLUMN_TYPES, type SaveGraphInputPayload, type SaveGraphInputScalar, type SaveGraphJsonScalar, type SaveGraphSessionOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaExtractionContext, type SchemaGenerateResult, type SchemaIntrospector, type SchemaOptions, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SelectableKeys, type SimpleQueryRunner, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeScriptGenerator, type TypedExpression, type TypedLike, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, age, aliasRef, and, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, buildFilterParameters, caseWhen, cast, cbrt, ceil, ceiling, char, charLength, chr, clearExpressionDispatchers, clearOperandDispatchers, coalesce, col, collate, columnOperand, concat, concatWs, correlateBy, cos, cot, count, countAll, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, endOfMonth, entityRef, entityRefs, eq, esel, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractSchema, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, generateSchemaSqlFor, getColumn, getDecoratorMetadata, getSchemaIntrospector, getTableDefFromEntity, getTemporalFormat, greatest, groupConcat, gt, gte, hasMany, hasOne, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isOperandNode, isValueOperandInput, isWindowFunctionNode, jsonArrayAgg, jsonContains, jsonLength, jsonPath, jsonSet, jsonify, lag, lastValue, lead, least, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, localTime, localTimestamp, locate, log, log10, log2, logBase, lower, lpad, lt, lte, ltrim, mapColumnType, mapRelationType, materializeAs, max, md5, min, minute, mod, month, mul, neq, normalizeColumnType, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, nullif, octetLength, or, outerRef, pi, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, second, sel, selectFrom, selectFromEntity, setRelations, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, update, upper, utcNow, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, windowFunction, year };
package/dist/index.d.ts CHANGED
@@ -2676,6 +2676,7 @@ type NormalizedRelationIncludeTree = Record<string, NormalizedRelationIncludeNod
2676
2676
  type QueryResult = {
2677
2677
  columns: string[];
2678
2678
  values: unknown[][];
2679
+ insertId?: number;
2679
2680
  };
2680
2681
  interface DbExecutor {
2681
2682
  /** Capability flags so the runtime can make correct decisions without relying on optional methods. */
@@ -3229,6 +3230,7 @@ declare class UnitOfWork {
3229
3230
  * @param results - Query results
3230
3231
  */
3231
3232
  private applyReturningResults;
3233
+ private applyInsertId;
3232
3234
  /**
3233
3235
  * Normalizes a column name by removing quotes and table prefixes.
3234
3236
  * @param column - The column name to normalize
@@ -3777,6 +3779,166 @@ interface PaginatedResult<T> {
3777
3779
  pageSize: number;
3778
3780
  }
3779
3781
 
3782
+ /**
3783
+ * OpenAPI 3.1 JSON Schema type representation
3784
+ */
3785
+ type JsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
3786
+ /**
3787
+ * Common OpenAPI 3.1 JSON Schema formats
3788
+ */
3789
+ type JsonSchemaFormat = 'date-time' | 'date' | 'time' | 'email' | 'uuid' | 'uri' | 'binary' | 'base64';
3790
+ /**
3791
+ * OpenAPI 3.1 JSON Schema property definition
3792
+ */
3793
+ interface JsonSchemaProperty {
3794
+ type?: JsonSchemaType | JsonSchemaType[];
3795
+ format?: JsonSchemaFormat;
3796
+ description?: string;
3797
+ nullable?: boolean;
3798
+ readOnly?: boolean;
3799
+ writeOnly?: boolean;
3800
+ minimum?: number;
3801
+ maximum?: number;
3802
+ minLength?: number;
3803
+ maxLength?: number;
3804
+ pattern?: string;
3805
+ enum?: (string | number | boolean)[];
3806
+ default?: unknown;
3807
+ example?: unknown;
3808
+ properties?: Record<string, JsonSchemaProperty>;
3809
+ required?: string[];
3810
+ items?: JsonSchemaProperty;
3811
+ $ref?: string;
3812
+ anyOf?: JsonSchemaProperty[];
3813
+ allOf?: JsonSchemaProperty[];
3814
+ oneOf?: JsonSchemaProperty[];
3815
+ [key: string]: unknown;
3816
+ }
3817
+ /**
3818
+ * OpenAPI 3.1 parameter definition
3819
+ */
3820
+ interface OpenApiParameter {
3821
+ name: string;
3822
+ in: 'query' | 'path' | 'header' | 'cookie';
3823
+ description?: string;
3824
+ required?: boolean;
3825
+ deprecated?: boolean;
3826
+ allowEmptyValue?: boolean;
3827
+ style?: string;
3828
+ explode?: boolean;
3829
+ schema?: JsonSchemaProperty;
3830
+ [key: string]: unknown;
3831
+ }
3832
+ /**
3833
+ * Complete OpenAPI 3.1 Schema for an entity or query result
3834
+ */
3835
+ interface OpenApiSchema {
3836
+ type: 'object';
3837
+ properties: Record<string, JsonSchemaProperty>;
3838
+ required: string[];
3839
+ description?: string;
3840
+ }
3841
+ /**
3842
+ * Column-level schema flags
3843
+ */
3844
+ interface ColumnSchemaOptions {
3845
+ /** Include description from column comments */
3846
+ includeDescriptions?: boolean;
3847
+ /** Include enum values for enum columns */
3848
+ includeEnums?: boolean;
3849
+ /** Include column examples if available */
3850
+ includeExamples?: boolean;
3851
+ /** Include column defaults */
3852
+ includeDefaults?: boolean;
3853
+ /** Include nullable flag when applicable */
3854
+ includeNullable?: boolean;
3855
+ }
3856
+ /**
3857
+ * Output schema generation options (query result)
3858
+ */
3859
+ interface OutputSchemaOptions extends ColumnSchemaOptions {
3860
+ /** Use selected columns only (from select/include) vs full entity */
3861
+ mode?: 'selected' | 'full';
3862
+ /** Maximum depth for relation recursion */
3863
+ maxDepth?: number;
3864
+ }
3865
+ type InputRelationMode = 'ids' | 'objects' | 'mixed';
3866
+ type InputSchemaMode = 'create' | 'update';
3867
+ /**
3868
+ * Input schema generation options (write payloads)
3869
+ */
3870
+ interface InputSchemaOptions extends ColumnSchemaOptions {
3871
+ /** Create vs update payload shape */
3872
+ mode?: InputSchemaMode;
3873
+ /** Include relation payloads */
3874
+ includeRelations?: boolean;
3875
+ /** How relations are represented (ids, nested objects, or both) */
3876
+ relationMode?: InputRelationMode;
3877
+ /** Maximum depth for relation recursion */
3878
+ maxDepth?: number;
3879
+ /** Omit read-only/generated columns from input */
3880
+ omitReadOnly?: boolean;
3881
+ /** Exclude primary key columns from input */
3882
+ excludePrimaryKey?: boolean;
3883
+ /** Require primary key columns on update payloads */
3884
+ requirePrimaryKey?: boolean;
3885
+ }
3886
+ /**
3887
+ * Schema generation options
3888
+ */
3889
+ interface SchemaOptions extends OutputSchemaOptions {
3890
+ /** Input schema options, or false to skip input generation */
3891
+ input?: InputSchemaOptions | false;
3892
+ }
3893
+ /**
3894
+ * Input + output schema bundle
3895
+ */
3896
+ interface OpenApiSchemaBundle {
3897
+ output: OpenApiSchema;
3898
+ input?: OpenApiSchema;
3899
+ parameters?: OpenApiParameter[];
3900
+ }
3901
+ /**
3902
+ * Schema extraction context for handling circular references
3903
+ */
3904
+ interface SchemaExtractionContext {
3905
+ /** Set of already visited tables to detect cycles */
3906
+ visitedTables: Set<string>;
3907
+ /** Map of table names to their generated schemas */
3908
+ schemaCache: Map<string, OpenApiSchema>;
3909
+ /** Current extraction depth */
3910
+ depth: number;
3911
+ /** Maximum depth to recurse */
3912
+ maxDepth: number;
3913
+ }
3914
+
3915
+ /**
3916
+ * Maps SQL column types to OpenAPI JSON Schema types
3917
+ */
3918
+ declare const mapColumnType: (column: ColumnDef, options?: ColumnSchemaOptions) => JsonSchemaProperty;
3919
+ /**
3920
+ * Maps relation type to array or single object
3921
+ */
3922
+ declare const mapRelationType: (relationType: string) => {
3923
+ type: "object" | "array";
3924
+ isNullable: boolean;
3925
+ };
3926
+ /**
3927
+ * Gets the OpenAPI format for temporal columns
3928
+ */
3929
+ declare const getTemporalFormat: (sqlType: string) => JsonSchemaFormat | undefined;
3930
+
3931
+ /**
3932
+ * Extracts OpenAPI 3.1 schemas for output and optional input payloads.
3933
+ */
3934
+ declare const extractSchema: (table: TableDef, plan: HydrationPlan | undefined, projectionNodes: ProjectionNode[] | undefined, options?: SchemaOptions) => OpenApiSchemaBundle;
3935
+ /**
3936
+ * Converts a schema to a JSON string with optional pretty printing
3937
+ */
3938
+ declare const schemaToJson: (schema: OpenApiSchema, pretty?: boolean) => string;
3939
+
3940
+ declare const buildFilterParameters: (table: TableDef, where: ExpressionNode | undefined, from: TableSourceNode | undefined, options?: ColumnSchemaOptions) => OpenApiParameter[];
3941
+
3780
3942
  type SelectDialectInput = Dialect | DialectKey;
3781
3943
 
3782
3944
  type ColumnSelectionValue = ColumnDef | FunctionNode | CaseExpressionNode | WindowFunctionNode | TypedExpression<unknown>;
@@ -4385,13 +4547,22 @@ declare class SelectQueryBuilder<T = EntityInstance<TableDef>, TTable extends Ta
4385
4547
  */
4386
4548
  toSql(dialect: SelectDialectInput): string;
4387
4549
  /**
4388
- * Gets the hydration plan for the query
4550
+ * Gets hydration plan for query
4389
4551
  * @returns Hydration plan or undefined if none exists
4390
4552
  * @example
4391
4553
  * const plan = qb.include('posts').getHydrationPlan();
4392
4554
  * console.log(plan?.relations); // Information about included relations
4393
4555
  */
4394
4556
  getHydrationPlan(): HydrationPlan | undefined;
4557
+ /**
4558
+ * Gets OpenAPI 3.1 JSON Schemas for query output and optional input payloads
4559
+ * @param options - Schema generation options
4560
+ * @returns OpenAPI 3.1 JSON Schemas for query output and input payloads
4561
+ * @example
4562
+ * const { output } = qb.select('id', 'title', 'author').getSchema();
4563
+ * console.log(JSON.stringify(output, null, 2));
4564
+ */
4565
+ getSchema(options?: SchemaOptions): OpenApiSchemaBundle;
4395
4566
  /**
4396
4567
  * Gets the Abstract Syntax Tree (AST) representation of the query
4397
4568
  * @returns Query AST with hydration applied
@@ -5048,6 +5219,7 @@ declare class PostgresDialect extends SqlDialectBase {
5048
5219
  * @returns Quoted identifier
5049
5220
  */
5050
5221
  quoteIdentifier(id: string): string;
5222
+ protected formatPlaceholder(index: number): string;
5051
5223
  /**
5052
5224
  * Compiles JSON path expression using PostgreSQL syntax
5053
5225
  * @param node - JSON path node
@@ -7015,4 +7187,4 @@ type PooledExecutorFactoryOptions<TConn> = {
7015
7187
  */
7016
7188
  declare function createPooledExecutorFactory<TConn>(opts: PooledExecutorFactoryOptions<TConn>): DbExecutorFactory;
7017
7189
 
7018
- export { type AliasRefNode, type AnyDomainEvent, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToReferenceApi, type BelongsToRelation, type BetweenExpressionNode, type BinaryExpressionNode, type BitwiseExpressionNode, type CascadeMode, type CaseExpressionNode, type CastExpressionNode, type CheckConstraint, type CollateExpressionNode, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, ConstructorMaterializationStrategy, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneReferenceApi, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type InExpressionRight, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, InsertQueryBuilder, type IntrospectOptions, type JsonPathNode, type Jsonify, type JsonifyScalar, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type PaginatedResult, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, PrototypeMaterializationStrategy, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey$1 as RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, STANDARD_COLUMN_TYPES, type SaveGraphInputPayload, type SaveGraphInputScalar, type SaveGraphJsonScalar, type SaveGraphSessionOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SelectableKeys, type SimpleQueryRunner, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeScriptGenerator, type TypedExpression, type TypedLike, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, age, aliasRef, and, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, caseWhen, cast, cbrt, ceil, ceiling, char, charLength, chr, clearExpressionDispatchers, clearOperandDispatchers, coalesce, col, collate, columnOperand, concat, concatWs, correlateBy, cos, cot, count, countAll, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, endOfMonth, entityRef, entityRefs, eq, esel, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, generateSchemaSqlFor, getColumn, getDecoratorMetadata, getSchemaIntrospector, getTableDefFromEntity, greatest, groupConcat, gt, gte, hasMany, hasOne, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isOperandNode, isValueOperandInput, isWindowFunctionNode, jsonArrayAgg, jsonContains, jsonLength, jsonPath, jsonSet, jsonify, lag, lastValue, lead, least, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, localTime, localTimestamp, locate, log, log10, log2, logBase, lower, lpad, lt, lte, ltrim, materializeAs, max, md5, min, minute, mod, month, mul, neq, normalizeColumnType, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, nullif, octetLength, or, outerRef, pi, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, second, sel, selectFrom, selectFromEntity, setRelations, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, update, upper, utcNow, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, windowFunction, year };
7190
+ export { type AliasRefNode, type AnyDomainEvent, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToReferenceApi, type BelongsToRelation, type BetweenExpressionNode, type BinaryExpressionNode, type BitwiseExpressionNode, type CascadeMode, type CaseExpressionNode, type CastExpressionNode, type CheckConstraint, type CollateExpressionNode, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnSchemaOptions, type ColumnToTs, type ColumnType, ConstructorMaterializationStrategy, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, type DecoratedEntityInstance, DefaultBelongsToReference, DefaultEntityMaterializer, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityMaterializationStrategy, type EntityMaterializer, type EntityOptions, type PrimaryKey$1 as EntityPrimaryKey, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneReferenceApi, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type InExpressionRight, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, type InputRelationMode, type InputSchemaMode, type InputSchemaOptions, InsertQueryBuilder, InterceptorPipeline, type IntrospectOptions, type JsonPathNode, type JsonSchemaFormat, type JsonSchemaProperty, type JsonSchemaType, type Jsonify, type JsonifyScalar, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OpenApiParameter, type OpenApiSchema, type OpenApiSchemaBundle, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, type OutputSchemaOptions, type PaginatedResult, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type Primitive, PrototypeMaterializationStrategy, type QueryContext, type QueryInterceptor, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey$1 as RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, STANDARD_COLUMN_TYPES, type SaveGraphInputPayload, type SaveGraphInputScalar, type SaveGraphJsonScalar, type SaveGraphSessionOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaExtractionContext, type SchemaGenerateResult, type SchemaIntrospector, type SchemaOptions, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SelectableKeys, type SimpleQueryRunner, SqlServerDialect, type SqliteClientLike, SqliteDialect, type StandardColumnType, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeScriptGenerator, type TypedExpression, type TypedLike, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, age, aliasRef, and, arrayAppend, asType, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bitAnd, bitLength, bitOr, bitXor, bootstrapEntities, buildFilterParameters, caseWhen, cast, cbrt, ceil, ceiling, char, charLength, chr, clearExpressionDispatchers, clearOperandDispatchers, coalesce, col, collate, columnOperand, concat, concatWs, correlateBy, cos, cot, count, countAll, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, deleteFrom, denseRank, diffSchema, div, endOfMonth, entityRef, entityRefs, eq, esel, executeHydrated, executeHydratedPlain, executeHydratedPlainWithContexts, executeHydratedWithContexts, executeSchemaSql, executeSchemaSqlFor, exists, exp, extract, extractSchema, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, generateSchemaSqlFor, getColumn, getDecoratorMetadata, getSchemaIntrospector, getTableDefFromEntity, getTemporalFormat, greatest, groupConcat, gt, gte, hasMany, hasOne, hour, hydrateRows, ifNull, inList, inSubquery, initcap, insertInto, instr, introspectSchema, isCaseExpressionNode, isCastExpressionNode, isCollateExpressionNode, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isOperandNode, isValueOperandInput, isWindowFunctionNode, jsonArrayAgg, jsonContains, jsonLength, jsonPath, jsonSet, jsonify, lag, lastValue, lead, least, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, localTime, localTimestamp, locate, log, log10, log2, logBase, lower, lpad, lt, lte, ltrim, mapColumnType, mapRelationType, materializeAs, max, md5, min, minute, mod, month, mul, neq, normalizeColumnType, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, nullif, octetLength, or, outerRef, pi, position, pow, power, quarter, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, relationLoaderCache, renderColumnDefinition, renderTypeWithArgs, repeat, replace, reverse, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, schemaToJson, second, sel, selectFrom, selectFromEntity, setRelations, sha1, sha2, shiftLeft, shiftRight, sign, sin, space, sqrt, stddev, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, update, upper, utcNow, valueToOperand, variance, visitExpression, visitOperand, weekOfYear, windowFunction, year };