uql-orm 0.105.0 → 0.105.1

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.
Files changed (43) hide show
  1. package/dist/browser/querier/httpQuerier.d.ts +3 -3
  2. package/dist/browser/type/clientQuerier.d.ts +1 -1
  3. package/dist/browser/uql-browser.min.js +2 -2
  4. package/dist/browser/uql-browser.min.js.map +5 -5
  5. package/dist/cockroachdb/cockroachDialect.d.ts +2 -2
  6. package/dist/dialect/abstractDialect.d.ts +3 -3
  7. package/dist/dialect/abstractSqlDialect.d.ts +35 -35
  8. package/dist/dialect/mergeSqlDialect.d.ts +2 -2
  9. package/dist/dialect/mysqlLikeSqlDialect.d.ts +6 -6
  10. package/dist/dialect/queryJoins.d.ts +2 -2
  11. package/dist/entity/decorator/bag.d.ts +2 -2
  12. package/dist/entity/decorator/entity.d.ts +2 -2
  13. package/dist/entity/metadata/definition.d.ts +9 -6
  14. package/dist/entity/metadata/definition.js +18 -4
  15. package/dist/entity/metadata/schemaFixture/author.d.ts +2 -2
  16. package/dist/entity/metadata/schemaFixture/book.d.ts +1 -1
  17. package/dist/entity/metadata/schemaFixture/book.js +2 -1
  18. package/dist/http/contract.d.ts +2 -2
  19. package/dist/http/handler.d.ts +2 -2
  20. package/dist/mariadb/mariaDialect.d.ts +2 -2
  21. package/dist/migrate/codegen/entityTypes.d.ts +2 -2
  22. package/dist/migrate/migrator.d.ts +2 -2
  23. package/dist/migrate/schemaGenerator.d.ts +5 -5
  24. package/dist/mongodb/mongoDialect.d.ts +12 -12
  25. package/dist/mongodb/mongoSchemaGenerator.d.ts +4 -4
  26. package/dist/mssql/mssqlDialect.d.ts +4 -4
  27. package/dist/postgres/postgresDialect.d.ts +2 -2
  28. package/dist/querier/abstractSqlQuerier.d.ts +1 -1
  29. package/dist/schema/schemaASTBuilder.d.ts +4 -4
  30. package/dist/type/column.d.ts +2 -2
  31. package/dist/type/config.d.ts +2 -2
  32. package/dist/type/dialect.d.ts +13 -13
  33. package/dist/type/entity.d.ts +2 -2
  34. package/dist/type/migration.d.ts +7 -7
  35. package/dist/type/querier.d.ts +2 -2
  36. package/dist/type/querySql.d.ts +2 -2
  37. package/dist/type/schemaEntity.d.ts +20 -16
  38. package/dist/type/utility.d.ts +4 -1
  39. package/dist/util/hook.util.d.ts +2 -2
  40. package/dist/util/sql.d.ts +4 -4
  41. package/dist/util/triggerWrite.d.ts +5 -5
  42. package/package.json +1 -1
  43. package/skills/uql-orm/SKILL.md +2 -2
@@ -1,6 +1,6 @@
1
1
  import { type Document, type Filter, type Sort } from 'mongodb';
2
2
  import { AbstractDialect } from '../dialect/abstractDialect.js';
3
- import type { DialectFeatures, EntityData, EntityMeta, Query, QueryAggregate, QueryOptions, QueryPager, QuerySelectValue, QuerySortMap, QueryWhere, Type } from '../type/index.js';
3
+ import type { DialectFeatures, EntityData, EntityMeta, Query, QueryAggregate, QueryOptions, QueryPager, QuerySelectValue, QuerySortMap, QueryWhere, AbstractType } from '../type/index.js';
4
4
  import { type CallbackKey } from '../util/index.js';
5
5
  /** How a read runs: its pipeline, or the ordering of the `find` cursor where one expresses it. */
6
6
  export type MongoRead = {
@@ -25,20 +25,20 @@ export declare class MongoDialect extends AbstractDialect {
25
25
  * the document does not use.
26
26
  */
27
27
  columnOf<E>(meta: EntityMeta<E>, key: string): string;
28
- where<E extends Document>(entity: Type<E>, where?: QueryWhere<E>, opts?: QueryOptions): Filter<E>;
28
+ where<E extends Document>(entity: AbstractType<E>, where?: QueryWhere<E>, opts?: QueryOptions): Filter<E>;
29
29
  /**
30
30
  * The stages every pipeline starts with: the `$lookup` each relation condition needs, into a temporary
31
31
  * field so `$or` keeps its meaning, the `$match` reading them, and the temporaries taken back out. Each
32
32
  * relation aggregate the `$where` or `fields` reads is left on the document, once, under its column.
33
33
  * `lookup` keeps the temporaries used, so a later lookup neither repeats nor reuses one.
34
34
  */
35
- matchStages<E extends Document>(entity: Type<E>, where?: QueryWhere<E>, opts?: QueryOptions, fields?: readonly string[], lookup?: Lookup): MongoAggregationPipelineEntry<Document>[];
35
+ matchStages<E extends Document>(entity: AbstractType<E>, where?: QueryWhere<E>, opts?: QueryOptions, fields?: readonly string[], lookup?: Lookup): MongoAggregationPipelineEntry<Document>[];
36
36
  /**
37
37
  * Renders a `$where` tree without applying entity filters (used for same-scope group-operator
38
38
  * recursion). A relation, or a relation aggregate, needs `$lookup` stages, so it is only accepted
39
39
  * when `lookup` is given - a plain `find`/`updateMany` filter has nowhere to put them.
40
40
  */
41
- protected renderFilter<E extends Document>(entity: Type<E>, where?: QueryWhere<E>, lookup?: Lookup): Filter<E>;
41
+ protected renderFilter<E extends Document>(entity: AbstractType<E>, where?: QueryWhere<E>, lookup?: Lookup): Filter<E>;
42
42
  /**
43
43
  * Renders `$and`/`$or`/`$not`/`$nor` into `filter`, both negations as MongoDB's `$nor` (a `$not`'s clauses
44
44
  * wrapped in one `$and`), dropping empty clauses, since MongoDB refuses an empty operator.
@@ -84,7 +84,7 @@ export declare class MongoDialect extends AbstractDialect {
84
84
  private allHolding;
85
85
  /** An object's keys as {@link held} reads each, a nested object's by its dotted path rather than whole. */
86
86
  private containment;
87
- select<E extends Document>(entity: Type<E>, select?: QuerySelectValue<E>): Record<string, 0 | 1>;
87
+ select<E extends Document>(entity: AbstractType<E>, select?: QuerySelectValue<E>): Record<string, 0 | 1>;
88
88
  /**
89
89
  * The `$sort` stage. A relation key reads the document a `$lookup` unwound onto the parent, so - as
90
90
  * on the SQL dialects - it is only addressable when the statement joins that relation. Here that
@@ -108,7 +108,7 @@ export declare class MongoDialect extends AbstractDialect {
108
108
  * correlated `$lookup` reading it per parent, and the `$set` that lifts it onto the document as the
109
109
  * field the `$sort` then orders by. A parent with no related row reads a zero tally and no distance.
110
110
  */
111
- sortAggregateStages<E extends Document>(entity: Type<E>, sort: QuerySortMap<E> | undefined): Lookup & {
111
+ sortAggregateStages<E extends Document>(entity: AbstractType<E>, sort: QuerySortMap<E> | undefined): Lookup & {
112
112
  readonly fields: string[];
113
113
  };
114
114
  /** The relation aggregates a read projects or sorts by; its `$where` puts its own on the document. */
@@ -146,7 +146,7 @@ export declare class MongoDialect extends AbstractDialect {
146
146
  */
147
147
  private toManyLookup;
148
148
  /** Whether a `$sort` reads a relation, which is what forces the lookups to run before it. */
149
- sortsRelations<E extends Document>(entity: Type<E>, sort: QuerySortMap<E> | undefined): boolean;
149
+ sortsRelations<E extends Document>(entity: AbstractType<E>, sort: QuerySortMap<E> | undefined): boolean;
150
150
  /**
151
151
  * Aggregate results are keyed by `$group`/`$select` alias rather than by column, so an aggregate
152
152
  * `$sort` addresses those aliases as-is - the same reason the SQL dialects sort by alias there.
@@ -161,7 +161,7 @@ export declare class MongoDialect extends AbstractDialect {
161
161
  * How a read runs, its ordering and aggregates read once for both the routing and the run: the one place
162
162
  * deciding how a read is scored and ranked, a root vector search through Atlas.
163
163
  */
164
- readPlan<E extends Document>(entity: Type<E>, q: Query<E>, opts?: QueryOptions): MongoRead;
164
+ readPlan<E extends Document>(entity: AbstractType<E>, q: Query<E>, opts?: QueryOptions): MongoRead;
165
165
  /**
166
166
  * Whether a read needs stages a `find` cursor cannot express: a lookup to populate, count, filter or
167
167
  * order by a relation, one to build a relation aggregate, and the grouping `$distinct` is.
@@ -173,7 +173,7 @@ export declare class MongoDialect extends AbstractDialect {
173
173
  */
174
174
  private vectorSearchPipeline;
175
175
  /** A read as a pipeline, whether or not a `find` cursor would express it. */
176
- aggregationPipeline<E extends Document>(entity: Type<E>, q: Query<E>, opts?: QueryOptions): MongoAggregationPipelineEntry<Document>[];
176
+ aggregationPipeline<E extends Document>(entity: AbstractType<E>, q: Query<E>, opts?: QueryOptions): MongoAggregationPipelineEntry<Document>[];
177
177
  /** The pipeline of a read no `$vectorSearch` enters, given its ordering, aggregates and vector score. */
178
178
  private scanPipeline;
179
179
  /** A vector search's exact distance, by its metric, as a score to rank by: its `$project`, else a temporary field. */
@@ -196,7 +196,7 @@ export declare class MongoDialect extends AbstractDialect {
196
196
  * The projection a narrowing query asks for, widened by what the pipeline produced (each populated
197
197
  * relation and the tallies); last, once the lookups have read the join keys.
198
198
  */
199
- pipelineProjection<E extends Document>(entity: Type<E>, q: Query<E>): Record<string, 0 | 1> | undefined;
199
+ pipelineProjection<E extends Document>(entity: AbstractType<E>, q: Query<E>): Record<string, 0 | 1> | undefined;
200
200
  /**
201
201
  * The `$lookup`/`$unwind` pair for each relation joined below `parent`, its own relations nested
202
202
  * inside its pipeline and resolved before the projection that reads them.
@@ -219,7 +219,7 @@ export declare class MongoDialect extends AbstractDialect {
219
219
  normalizeId<E extends Document>(meta: EntityMeta<E>, doc: Document): E;
220
220
  normalizeId<E extends Document>(meta: EntityMeta<E>, doc: Document | undefined): E | undefined;
221
221
  /** An aggregate's rows with each 64-bit integer decoded as a document's is: a `bigint` only where the column reads a `BigInt` field. */
222
- normalizeAggregateRows<E extends Document, R extends Document>(entity: Type<E>, q: QueryAggregate<E>, rows: R[]): R[];
222
+ normalizeAggregateRows<E extends Document, R extends Document>(entity: AbstractType<E>, q: QueryAggregate<E>, rows: R[]): R[];
223
223
  /**
224
224
  * A key as MongoDB stores it: a 24-hex string as an `ObjectId`, so a write matches the filter looking for
225
225
  * it, and anything else as given. Only 24-hex, not any 12-byte string. Arrays convert element-wise.
@@ -243,7 +243,7 @@ export declare class MongoDialect extends AbstractDialect {
243
243
  /**
244
244
  * Build MongoDB aggregation pipeline stages from a QueryAggregate.
245
245
  */
246
- buildAggregateStages<E extends Document>(entity: Type<E>, q: QueryAggregate<E>, opts?: QueryOptions): MongoAggregationPipelineEntry<Document>[];
246
+ buildAggregateStages<E extends Document>(entity: AbstractType<E>, q: QueryAggregate<E>, opts?: QueryOptions): MongoAggregationPipelineEntry<Document>[];
247
247
  /**
248
248
  * Resolve parsed group entries into the `_id` keys and accumulators of a `$group` stage, and the
249
249
  * `columns` its `$project` reads each result from: a group key out of `_id`, a DISTINCT set by its
@@ -1,6 +1,6 @@
1
1
  import type { AnyMigrationOperation } from '../migrate/builder/types.js';
2
2
  import type { TableNode } from '../schema/types.js';
3
- import { type CreateSchemaOptions, type IndexSchema, type NamingStrategy, type SchemaDiff, type SchemaGenerator, type Type } from '../type/index.js';
3
+ import { type CreateSchemaOptions, type IndexSchema, type NamingStrategy, type SchemaDiff, type SchemaGenerator, type AbstractType } from '../type/index.js';
4
4
  import { MongoDialect } from './mongoDialect.js';
5
5
  export declare class MongoSchemaGenerator extends MongoDialect implements SchemaGenerator {
6
6
  /** Takes no default foreign key action, since a document store has no foreign keys. */
@@ -9,8 +9,8 @@ export declare class MongoSchemaGenerator extends MongoDialect implements Schema
9
9
  * A document store has no cross-collection constraint, so unlike the SQL generator there is nothing to
10
10
  * defer and no order to respect: this is each collection and nothing more.
11
11
  */
12
- generateCreateSchema(entities: readonly Type<object>[], options?: CreateSchemaOptions): string[];
13
- generateDropSchema(entities: readonly Type<object>[]): string[];
12
+ generateCreateSchema(entities: readonly AbstractType<object>[], options?: CreateSchemaOptions): string[];
13
+ generateDropSchema(entities: readonly AbstractType<object>[]): string[];
14
14
  /** A collection, and one `createIndex` command for each of its indexes, as SQL's `[CREATE TABLE, ...CREATE INDEX]`. */
15
15
  private createCollection;
16
16
  /**
@@ -41,5 +41,5 @@ export declare class MongoSchemaGenerator extends MongoDialect implements Schema
41
41
  private generateCreateSearchIndex;
42
42
  /** A collection and its indexes, which is all a document store has: a column, a constraint or SQL throws. */
43
43
  generateOperation(operation: AnyMigrationOperation): string[];
44
- diffSchema(entity: Type<object>, currentTable: TableNode | undefined): SchemaDiff | undefined;
44
+ diffSchema(entity: AbstractType<object>, currentTable: TableNode | undefined): SchemaDiff | undefined;
45
45
  }
@@ -1,7 +1,7 @@
1
1
  import { type RelationRows, type SelectTerm } from '../dialect/abstractSqlDialect.js';
2
2
  import { type JsonAccessMode, type JsonContainer, type JsonKeyWrite, type JsonSlot } from '../dialect/jsonSql.js';
3
3
  import { MergeSqlDialect } from '../dialect/mergeSqlDialect.js';
4
- import type { EntityMeta, SavepointCommand, FieldOptions, Query, QueryConflictPaths, QueryContext, QueryOptions, QueryPager, SqlDialectFeatures, SqlValues, TriggerRows, Type, UpdatePayload, VectorDistance, VectorMetric, TransactionOptions } from '../type/index.js';
4
+ import type { EntityMeta, SavepointCommand, FieldOptions, Query, QueryConflictPaths, QueryContext, QueryOptions, QueryPager, SqlDialectFeatures, SqlValues, TriggerRows, AbstractType, UpdatePayload, VectorDistance, VectorMetric, TransactionOptions } from '../type/index.js';
5
5
  /** Microsoft SQL Server 2017 and up. Identifiers are `"`-quoted, the ANSI spelling `tedious` enables. */
6
6
  export declare class MsSqlDialect extends MergeSqlDialect {
7
7
  #private;
@@ -48,7 +48,7 @@ export declare class MsSqlDialect extends MergeSqlDialect {
48
48
  pager(ctx: QueryContext, opts: QueryPager & {
49
49
  $distinct?: boolean;
50
50
  }, sorted?: boolean): void;
51
- insert<E>(ctx: QueryContext, entity: Type<E>, payload: E | E[], opts?: QueryOptions): void;
51
+ insert<E>(ctx: QueryContext, entity: AbstractType<E>, payload: E | E[], opts?: QueryOptions): void;
52
52
  /** The table to toggle, or nothing when no record writes a key the engine would have generated. */
53
53
  private identityInsertTarget;
54
54
  /** An exact decimal, converted before it crosses the wire, where `tedious` would round it. */
@@ -76,7 +76,7 @@ export declare class MsSqlDialect extends MergeSqlDialect {
76
76
  * carrying a trigger, and through a table it works whether one is there or not.
77
77
  */
78
78
  returningId<E>(meta: EntityMeta<E>): string;
79
- upsert<E>(ctx: QueryContext, entity: Type<E>, conflictPaths: QueryConflictPaths<E>, payload: E | E[], update?: UpdatePayload<E>): void;
79
+ upsert<E>(ctx: QueryContext, entity: AbstractType<E>, conflictPaths: QueryConflictPaths<E>, payload: E | E[], update?: UpdatePayload<E>): void;
80
80
  /**
81
81
  * A statement writing rows, `write`, wrapped in what SQL Server needs around one. The table variable its
82
82
  * `OUTPUT` fills, typed as the id column is, and the read handing that back, uncounted so the batch
@@ -113,7 +113,7 @@ export declare class MsSqlDialect extends MergeSqlDialect {
113
113
  /** There is no `CREATE SCHEMA IF NOT EXISTS`, and `CREATE SCHEMA` has to be alone in its batch. */
114
114
  createSchemaSql(schema: string): string;
115
115
  /** The estimate the engine already keeps per partition, live without a stats refresh. */
116
- estimatedCount<E>(ctx: QueryContext, entity: Type<E>): void;
116
+ estimatedCount<E>(ctx: QueryContext, entity: AbstractType<E>): void;
117
117
  /** Null-safe on every version, `EXCEPT` comparing NULLs as equal: `IS DISTINCT FROM` needs 2022. */
118
118
  neExpr(field: string, ph: string): string;
119
119
  protected numericCast(expr: string): string;
@@ -1,5 +1,5 @@
1
1
  import { PgLikeSqlDialect } from '../dialect/pgLikeSqlDialect.js';
2
- import type { QueryContext, SqlDialectFeatures, SqlDialectName, SqlValues, Type } from '../type/index.js';
2
+ import type { QueryContext, SqlDialectFeatures, SqlDialectName, SqlValues, AbstractType } from '../type/index.js';
3
3
  /** What Postgres has: pgvector, the only engine with `halfvec` and `sparsevec`. */
4
4
  export declare const POSTGRES_FEATURES: SqlDialectFeatures;
5
5
  /** PostgreSQL, under every driver: `pg`, Neon, PGlite, `bun:sql`. Adds pgvector. */
@@ -15,5 +15,5 @@ export declare class PostgresDialect extends PgLikeSqlDialect {
15
15
  * carries `reltuples = -1`, Postgres' "no statistic" (not `NULL`, and not `0`) since PG 14 - handed
16
16
  * back raw it would read as a negative row count.
17
17
  */
18
- estimatedCount<E>(ctx: QueryContext, entity: Type<E>): void;
18
+ estimatedCount<E>(ctx: QueryContext, entity: AbstractType<E>): void;
19
19
  }
@@ -1,5 +1,5 @@
1
1
  import type { AbstractSqlDialect } from '../dialect/index.js';
2
- import type { EntityData, ExtraOptions, Query, QueryAggregate, QueryConflictPaths, QueryPage, QueryOptions, QuerySearch, QueryUpdateResult, RawRow, SavepointCommand, SqlQuerier, SqlStatement, TransactionOptions, Type, UpdatePayload } from '../type/index.js';
2
+ import type { EntityData, ExtraOptions, Query, QueryAggregate, QueryConflictPaths, QueryPage, QueryOptions, QuerySearch, QueryUpdateResult, RawRow, SavepointCommand, SqlQuerier, SqlStatement, Type, TransactionOptions, UpdatePayload } from '../type/index.js';
3
3
  import type { SqlExecution } from '../util/sql.util.js';
4
4
  import { AbstractQuerier, type UpsertedId, type WritesReturning } from './abstractQuerier.js';
5
5
  /** A statement as it is sent: its SQL and the values it binds. */
@@ -1,4 +1,4 @@
1
- import type { EntityMeta, EntityWhereMeta, FieldOptions, Type } from '../type/index.js';
1
+ import type { EntityMeta, EntityWhereMeta, FieldOptions, AbstractType } from '../type/index.js';
2
2
  import { SchemaAST } from './schemaAST.js';
3
3
  import { type ForeignKeyAction, type TriggerSchema } from './types.js';
4
4
  /**
@@ -17,9 +17,9 @@ export interface BuildSchemaASTOptions {
17
17
  * The text of SQL an entity declares - a check, a stored computed column, an index expression or
18
18
  * predicate - which only a dialect can render. `SqlSchemaGenerator.buildAST` supplies it.
19
19
  */
20
- compileDdl?: (sql: EntityWhereMeta<object>, entity: Type<object>) => string;
20
+ compileDdl?: (sql: EntityWhereMeta<object>, entity: AbstractType<object>) => string;
21
21
  /** A partial index's predicate as the engine writes it, `compileDdl` where none is given. */
22
- compileIndexPredicate?: (where: EntityWhereMeta<object>, entity: Type<object>, indexName: string) => string;
22
+ compileIndexPredicate?: (where: EntityWhereMeta<object>, entity: AbstractType<object>, indexName: string) => string;
23
23
  /** Whether a weighted fulltext index declares one of its own for each heavier column, as MySQL scores through one. */
24
24
  textScoreIndexes?: boolean;
25
25
  /** Whether a column a vector index covers is `NOT NULL` whatever the entity declares, as MariaDB demands. */
@@ -33,4 +33,4 @@ export interface BuildSchemaASTOptions {
33
33
  * Three passes, because each needs the one before it to have finished for *every* entity: a relation
34
34
  * resolves against a table another entity declares, and an index against the columns of its own.
35
35
  */
36
- export declare function buildSchemaAST(entities: readonly Type<object>[], options?: BuildSchemaASTOptions): SchemaAST;
36
+ export declare function buildSchemaAST(entities: readonly AbstractType<object>[], options?: BuildSchemaASTOptions): SchemaAST;
@@ -3,7 +3,7 @@ import type { TYPE_BOUNDS, VALUE_DECIDERS } from '../util/fieldOption.util.js';
3
3
  import type { BlobColumnType, BooleanColumnType, ColumnType, DateColumnType, DdlDefault, JsonColumnType, NumericColumnType, StringColumnType, VectorColumnType, FieldOptions, HasCompositeKey, IdValue, JsonShape, OnFieldCallback, ShapeValue, StampEvent } from './entity.js';
4
4
  import type { QuerySql } from './querySql.js';
5
5
  import type { ReferencedKey } from './schemaEntity.js';
6
- import type { Json, Type } from './utility.js';
6
+ import type { Type, Json, AbstractType } from './utility.js';
7
7
  import type { VectorDistance } from './vector.js';
8
8
  /** Where a column builder holds its options, so every string key of a builder is a method. */
9
9
  export declare const COLUMN_OPTIONS: unique symbol;
@@ -210,7 +210,7 @@ type DecimalType = 'decimal' | 'numeric';
210
210
  /** What a JSON column holds: its shape's payload, or any document. */
211
211
  type JsonValue<S> = [S] extends [never] ? Json : ShapeValue<S> extends infer P extends object | string | number | boolean ? Json<P> : Json;
212
212
  /** The key a column referencing `C` holds, or a named complaint for a composite one, which no one column holds. */
213
- type ReferenceValue<C> = C extends Type<infer E> ? HasCompositeKey<E> extends true ? {
213
+ type ReferenceValue<C> = C extends AbstractType<infer E> ? HasCompositeKey<E> extends true ? {
214
214
  readonly __compositeKeyNeedsAColumnPerKey: true;
215
215
  } : NonNullable<IdValue<E>> : never;
216
216
  /** The builders, one per value a column holds; `column` takes any SQL type, its family deciding what it offers. */
@@ -2,7 +2,7 @@ import type { ForeignKeyAction } from '../schema/types.js';
2
2
  import type { MigratorDialect } from './migratorDialect.js';
3
3
  import type { Querier } from './querier.js';
4
4
  import type { QuerierPool } from './querierPool.js';
5
- import type { Type } from './utility.js';
5
+ import type { AbstractType } from './utility.js';
6
6
  /**
7
7
  * Configuration options for the UQL ORM and Migrator.
8
8
  */
@@ -17,7 +17,7 @@ export interface Config {
17
17
  * List of entity classes to be managed by the ORM.
18
18
  * If omitted, every registered entity (`@Entity()` or `defineEntity`) is discovered via `getEntities()`.
19
19
  */
20
- entities?: Type<object>[];
20
+ entities?: AbstractType<object>[];
21
21
  /**
22
22
  * The directory where migration files are stored.
23
23
  * @default './migrations'
@@ -4,7 +4,7 @@ import type { Query, QueryConflictPaths, QueryPage, QueryRenderOptions, QuerySea
4
4
  import type { QueryAggregate, QueryAggregateOp } from './queryAggregate.js';
5
5
  import type { QuerySqlRenderOptions } from './querySql.js';
6
6
  import type { QueryWhere } from './queryWhere.js';
7
- import type { Type } from './utility.js';
7
+ import type { AbstractType } from './utility.js';
8
8
  import type { QueryVectorQuery } from './vector.js';
9
9
  /** The values the database computes that uql exports by name: `currentTimestamp`, `uuid`, ... */
10
10
  export declare const SQL_VALUE_NAMES: readonly ['currentTimestamp', 'currentDate', 'currentTime', 'uuid', 'uuidv7'];
@@ -276,22 +276,22 @@ export type DdlRenderOptions = Pick<QueryComparisonOptions, 'escapedPrefix' | 'o
276
276
  */
277
277
  export type TriggerWrite = {
278
278
  readonly kind: 'insert';
279
- readonly entity: Type<object>;
279
+ readonly entity: AbstractType<object>;
280
280
  readonly row: Readonly<Record<string, unknown>>;
281
281
  } | {
282
282
  readonly kind: 'upsert';
283
- readonly entity: Type<object>;
283
+ readonly entity: AbstractType<object>;
284
284
  readonly conflictPaths: Readonly<Record<string, unknown>>;
285
285
  readonly row: Readonly<Record<string, unknown>>;
286
286
  readonly update?: Readonly<Record<string, unknown>>;
287
287
  } | {
288
288
  readonly kind: 'update';
289
- readonly entity: Type<object>;
289
+ readonly entity: AbstractType<object>;
290
290
  readonly set: Readonly<Record<string, unknown>>;
291
291
  readonly where: EntityPredicate<object>;
292
292
  } | {
293
293
  readonly kind: 'delete';
294
- readonly entity: Type<object>;
294
+ readonly entity: AbstractType<object>;
295
295
  readonly where: EntityPredicate<object>;
296
296
  } | {
297
297
  readonly kind: 'refuse';
@@ -327,19 +327,19 @@ export interface SqlQueryDialect {
327
327
  */
328
328
  readonly sqlValues: SqlValues;
329
329
  /** A read; with `totalAlias`, every row also carries the unpaged match count under that alias. */
330
- find<E>(ctx: QueryContext, entity: Type<E>, q: Query<E>, opts?: QueryRenderOptions, totalAlias?: string): void;
330
+ find<E>(ctx: QueryContext, entity: AbstractType<E>, q: Query<E>, opts?: QueryRenderOptions, totalAlias?: string): void;
331
331
  /** A count of the records matching the filter, or of those a page of it takes. */
332
- count<E>(ctx: QueryContext, entity: Type<E>, q: QueryPage<E>, opts?: QueryRenderOptions): void;
332
+ count<E>(ctx: QueryContext, entity: AbstractType<E>, q: QueryPage<E>, opts?: QueryRenderOptions): void;
333
333
  /** An insert of one record or many. */
334
- insert<E>(ctx: QueryContext, entity: Type<E>, payload: E | E[], opts?: QueryRenderOptions): void;
334
+ insert<E>(ctx: QueryContext, entity: AbstractType<E>, payload: E | E[], opts?: QueryRenderOptions): void;
335
335
  /** An update of the records the query matches. */
336
- update<E>(ctx: QueryContext, entity: Type<E>, q: QuerySearch<E>, payload: UpdatePayload<E>, opts?: QueryRenderOptions): void;
336
+ update<E>(ctx: QueryContext, entity: AbstractType<E>, q: QuerySearch<E>, payload: UpdatePayload<E>, opts?: QueryRenderOptions): void;
337
337
  /** An upsert of one record or many by their conflict paths, a conflicting row taking `update` where given. */
338
- upsert<E>(ctx: QueryContext, entity: Type<E>, conflictPaths: QueryConflictPaths<E>, payload: E | E[], update?: UpdatePayload<E>): void;
338
+ upsert<E>(ctx: QueryContext, entity: AbstractType<E>, conflictPaths: QueryConflictPaths<E>, payload: E | E[], update?: UpdatePayload<E>): void;
339
339
  /** A write in a trigger's body; `rows` are what a set-based engine's body reads, narrowed to the ones it fires for. */
340
340
  triggerWrite(ctx: QueryContext, write: TriggerWrite, rows?: TriggerRows): void;
341
341
  /** A delete of the records the query matches, a soft delete where the entity has one. */
342
- delete<E>(ctx: QueryContext, entity: Type<E>, q: QuerySearch<E>, opts?: QueryRenderOptions): void;
342
+ delete<E>(ctx: QueryContext, entity: AbstractType<E>, q: QuerySearch<E>, opts?: QueryRenderOptions): void;
343
343
  /**
344
344
  * escape an identifier.
345
345
  * @param val the value to be escaped
@@ -373,7 +373,7 @@ export interface SqlQueryDialect {
373
373
  /**
374
374
  * Build an aggregate query.
375
375
  */
376
- aggregate<E>(ctx: QueryContext, entity: Type<E>, q: QueryAggregate<E>, opts?: QueryRenderOptions): void;
376
+ aggregate<E>(ctx: QueryContext, entity: AbstractType<E>, q: QueryAggregate<E>, opts?: QueryRenderOptions): void;
377
377
  /**
378
378
  * Get the placeholder for a parameter at the given index (1-based).
379
379
  * Default: '?' for MySQL/MariaDB/SQLite, '$n' for PostgreSQL.
@@ -383,7 +383,7 @@ export interface SqlQueryDialect {
383
383
  * A relation aggregate as a correlated subquery, correlated to the row under `prefix`: what a field
384
384
  * declaring `computed: (user) => user.resources.count()` renders as, wherever a clause names it.
385
385
  */
386
- appendRelationAggregate<E>(ctx: QueryContext, entity: Type<E>, aggregate: RelationAggregateSpec, prefix: string): void;
386
+ appendRelationAggregate<E>(ctx: QueryContext, entity: AbstractType<E>, aggregate: RelationAggregateSpec, prefix: string): void;
387
387
  }
388
388
  /**
389
389
  * The aggregates a relation reads, spelled as the query language spells them, so a `computed` field, an
@@ -4,7 +4,7 @@ import type { Querier } from './querier.js';
4
4
  import type { FilterOptions, RelationQuery } from './query.js';
5
5
  import type { ColumnRef, JsonPathRef, QuerySql, SqlFor, RelationAggregate } from './querySql.js';
6
6
  import type { QueryWhere } from './queryWhere.js';
7
- import type { AtLeastOne, Except, ExactlyOne, IsEqual, IsJson, JsonBrand, IsMany, Json, JsonScalar, Scalar, Type, Unpacked, Writable } from './utility.js';
7
+ import type { AtLeastOne, Except, ExactlyOne, IsEqual, IsJson, JsonBrand, IsMany, Json, JsonScalar, Scalar, Type, AbstractType, Unpacked, Writable } from './utility.js';
8
8
  import type { VectorDistance, VectorIndexOptions, VectorIndexType } from './vector.js';
9
9
  /** Brands the property an entity is identified by, where it is not `id`, `_id` or `uuid`. */
10
10
  export declare const idKey: unique symbol;
@@ -740,7 +740,7 @@ export type EntityIndexMeta<E = object> = {
740
740
  include?: readonly string[];
741
741
  } & VectorIndexOptions & IndexTypeOptions;
742
742
  export type EntityMeta<E> = {
743
- readonly entity: Type<E>;
743
+ readonly entity: AbstractType<E>;
744
744
  /** The table, which is the class's own name where the entity named none - see {@link derivedName}. */
745
745
  name?: string;
746
746
  /** Whether {@link name} came from the class rather than from the author, so a naming strategy applies. */
@@ -2,7 +2,7 @@ import type { AnyMigrationOperation } from '../migrate/builder/types.js';
2
2
  import type { SchemaAST } from '../schema/schemaAST.js';
3
3
  import type { DiffOptions } from '../schema/schemaASTDiffer.js';
4
4
  import type { CheckSchema, ColumnNode, ForeignKeyAction, IndexType, TableNode, TriggerSchema } from '../schema/types.js';
5
- import type { Except, IndexEntry, IndexedVectorField, LoggingOptions, Querier, SqlQuerier, Type, VectorIndexOptions } from './index.js';
5
+ import type { Except, IndexEntry, IndexedVectorField, LoggingOptions, Querier, SqlQuerier, AbstractType, VectorIndexOptions } from './index.js';
6
6
  /**
7
7
  * Defines a migration using a simple object literal. `Q` is `MongoQuerier` for a MongoDB migration.
8
8
  */
@@ -59,7 +59,7 @@ export interface MigratorOptions {
59
59
  /**
60
60
  * Entities to use for schema generation
61
61
  */
62
- readonly entities?: Type<object>[];
62
+ readonly entities?: AbstractType<object>[];
63
63
  /**
64
64
  * Default action for foreign key ON DELETE and ON UPDATE clauses.
65
65
  */
@@ -225,7 +225,7 @@ export interface SyncOptions {
225
225
  readonly drop?: boolean;
226
226
  readonly logging?: boolean;
227
227
  /** One entity instead of every registered one, for a schema that grows while the process runs. */
228
- readonly entity?: Type<object>;
228
+ readonly entity?: AbstractType<object>;
229
229
  /** Drop every table and recreate it. Development only: it is the one option that loses data. */
230
230
  readonly force?: boolean;
231
231
  }
@@ -250,13 +250,13 @@ export interface DropSchemaOptions {
250
250
  */
251
251
  export interface SchemaGenerator {
252
252
  /** The whole schema for `entities`, tables then the foreign keys between them, which need every entity at once. */
253
- generateCreateSchema(entities: readonly Type<object>[], options?: CreateSchemaOptions): string[];
253
+ generateCreateSchema(entities: readonly AbstractType<object>[], options?: CreateSchemaOptions): string[];
254
254
  /**
255
255
  * Every `DROP TABLE` for `entities`, dependents first. The inverse of {@link generateCreateSchema},
256
256
  * and the reason it takes the whole set: dropping in any order that ignores the relation graph is
257
257
  * rejected once the foreign keys are really there.
258
258
  */
259
- generateDropSchema(entities: readonly Type<object>[], options?: DropSchemaOptions): string[];
259
+ generateDropSchema(entities: readonly AbstractType<object>[], options?: DropSchemaOptions): string[];
260
260
  /** The statements taking a table through `diff`; its rollback is `rollbackDiff(diff)`. */
261
261
  generateAlterTable(diff: SchemaDiff): string[];
262
262
  /**
@@ -269,9 +269,9 @@ export interface SchemaGenerator {
269
269
  * a foreign key here points at, or those keys read as matching.
270
270
  * `renamedColumns` are columns `currentTable` already holds under their new names.
271
271
  */
272
- diffSchema(entity: Type<object>, currentTable: TableNode | undefined, desiredAst?: SchemaAST, renamedColumns?: readonly Rename[]): SchemaDiff | undefined;
272
+ diffSchema(entity: AbstractType<object>, currentTable: TableNode | undefined, desiredAst?: SchemaAST, renamedColumns?: readonly Rename[]): SchemaDiff | undefined;
273
273
  /** The entities as one AST, built once per run for every {@link diffSchema}. Absent on MongoDB, which diffs only indexes and a validator. */
274
- buildAST?(entities: readonly Type<object>[]): SchemaAST;
274
+ buildAST?(entities: readonly AbstractType<object>[]): SchemaAST;
275
275
  /** How this engine's diff compares types and defaults. Absent where {@link buildAST} is. */
276
276
  diffOptions?(): DiffOptions;
277
277
  }
@@ -6,7 +6,7 @@ import type { NamingStrategy } from './namingStrategy.js';
6
6
  import type { Captured, QueryFilter, QueryFindResult, QueryOptions, QueryPage, QuerySearch, QueryUpdateResult, WriteResults, WriteOptions } from './query.js';
7
7
  import type { QuerySql, SqlStatement } from './querySql.js';
8
8
  import type { EntityRead, ReadResults, ReadQueries, UniversalQuerier } from './universalQuerier.js';
9
- import type { BooleanLike, RawRow, Type } from './utility.js';
9
+ import type { BooleanLike, Type, RawRow, AbstractType } from './utility.js';
10
10
  /**
11
11
  * Isolation levels for transactions.
12
12
  */
@@ -136,7 +136,7 @@ export declare function isSqlQuerier(querier: Querier): querier is SqlQuerier;
136
136
  * Context passed to global querier listeners.
137
137
  */
138
138
  export type ListenerContext<E extends object = object> = {
139
- readonly entity: Type<E>;
139
+ readonly entity: AbstractType<E>;
140
140
  readonly querier: Querier;
141
141
  readonly payloads: readonly E[];
142
142
  readonly event: HookEvent;
@@ -1,5 +1,5 @@
1
1
  import type { QueryContext, RelationAggregateSpec, SqlQueryDialect, TriggerRows } from './dialect.js';
2
- import type { Scalar, Type } from './utility.js';
2
+ import type { Scalar, AbstractType } from './utility.js';
3
3
  /** What a `sql` callback receives. See {@link QuerySqlFn}. */
4
4
  export type QuerySqlRenderOptions = {
5
5
  /** The dialect rendering the SQL. */
@@ -14,7 +14,7 @@ export type QuerySqlRenderOptions = {
14
14
  * The entity being rendered, which a ref read off a definition's map resolves its column against: a
15
15
  * computed field's own, or the one whose schema is built. Absent where a statement renders SQL.
16
16
  */
17
- entity?: Type<unknown>;
17
+ entity?: AbstractType<unknown>;
18
18
  /**
19
19
  * The rows a set-based trigger's writes read. Absent where the body reads `NEW` and `OLD` bare, and
20
20
  * outside a trigger.
@@ -2,7 +2,7 @@ import type { ForeignKeyAction } from '../schema/types.js';
2
2
  import type { Column, ColumnOptionsOf, ColumnValueOf, FilledOptions, NullOf } from './column.js';
3
3
  import type { CheckSection, FilterSection, filledKey, HookContext, HookEvent, idKey, IdValue, IndexSection, IsUnion, RefMap, RelationCardinality, RelationInverseOptions, RelationJoinOptions, RelationOwnerOptions, RelationRef, ToManyRefs, ToManyRelationKey, TriggerSection, versionKey } from './entity.js';
4
4
  import type { QuerySql, RelationAggregate } from './querySql.js';
5
- import type { Type } from './utility.js';
5
+ import type { Type, AbstractType } from './utility.js';
6
6
  /**
7
7
  * A schema entity's columns, each an `f` builder. A foreign key is declared in `.references()`, once every entity
8
8
  * exists: one written here would read its target while that target's own type is still being inferred. A computed
@@ -22,7 +22,7 @@ export type ReferencedKey<C> = C extends {
22
22
  readonly key: infer K;
23
23
  };
24
24
  } ? unknown extends K ? RowKey<C> : K : RowKey<C>;
25
- type RowKey<C> = C extends Type<infer R> ? NonNullable<IdValue<R>> : never;
25
+ type RowKey<C> = C extends AbstractType<infer R> ? NonNullable<IdValue<R>> : never;
26
26
  /** The keys of `F` whose column is a `C`. */
27
27
  type FlagKeys<F, C> = {
28
28
  [K in keyof F]-?: F[K] extends C ? K : never;
@@ -120,7 +120,7 @@ export type SchemaEntityOptions<F extends SchemaFields, B = object, BK = unknown
120
120
  /** A base that is never a table: the entities extending it take what it declares. */
121
121
  readonly abstract?: true;
122
122
  /** The entity it inherits from, which the declared class extends, so its methods and `super` work. */
123
- readonly extends?: SchemaClass<B, BK, BC>;
123
+ readonly extends?: SchemaClass<B, BK, BC, boolean>;
124
124
  readonly fields: F;
125
125
  };
126
126
  /** A hook a schema runs on a row; a promise it returns is awaited. */
@@ -140,31 +140,35 @@ type SchemaReferences<Columns> = {
140
140
  type LazyTarget = () => void;
141
141
  /**
142
142
  * What a schema declares after its columns, each section typed by the columns now fixed, so none is inferred
143
- * again. `relations` comes last: what follows a relation would read its target while that target is inferred.
143
+ * again. `relations` comes last but for `filters`, which reads the row they complete.
144
144
  */
145
- type SchemaSections<Row, Key, Columns, B> = {
145
+ type SchemaSections<Row, Key, Columns, B, Abstract> = {
146
146
  /** Columns the database computes off the stored ones, `(post) => ({ slug: f.string().as(sql`...`) })`. */
147
- computed<const C extends SchemaComputed>(computed: (refs: RefMap<Columns>) => C): SchemaEntity<Row & ComputedRow<C>, Key, Columns & ComputedRow<C>, B>;
148
- indexes(indexes: IndexSection<Columns>): SchemaEntity<Row, Key, Columns, B>;
149
- checks(checks: CheckSection<Columns>): SchemaEntity<Row, Key, Columns, B>;
150
- triggers(triggers: TriggerSection<Columns>): SchemaEntity<Row, Key, Columns, B>;
151
- filters(filters: FilterSection<Row>): SchemaEntity<Row, Key, Columns, B>;
147
+ computed<const C extends SchemaComputed>(computed: (refs: RefMap<Columns>) => C): SchemaEntity<Row & ComputedRow<C>, Key, Columns & ComputedRow<C>, B, Abstract>;
148
+ indexes(indexes: IndexSection<Columns>): SchemaEntity<Row, Key, Columns, B, Abstract>;
149
+ checks(checks: CheckSection<Columns>): SchemaEntity<Row, Key, Columns, B, Abstract>;
150
+ triggers(triggers: TriggerSection<Columns>): SchemaEntity<Row, Key, Columns, B, Abstract>;
151
+ filters(filters: FilterSection<Row>): SchemaEntity<Row, Key, Columns, B, Abstract>;
152
152
  /** Functions each lifecycle event runs on the row, in order, given the querier writing it. */
153
153
  hooks(hooks: {
154
154
  readonly [E in HookEvent]?: readonly SchemaHook<Row>[];
155
- }): SchemaEntity<Row, Key, Columns, B>;
155
+ }): SchemaEntity<Row, Key, Columns, B, Abstract>;
156
156
  /** The foreign keys no relation joins on, each column's target: `{ authorId: () => Author }`. */
157
- references(references: SchemaReferences<Columns>): SchemaEntity<Row, Key, Columns, B>;
157
+ references(references: SchemaReferences<Columns>): SchemaEntity<Row, Key, Columns, B, Abstract>;
158
158
  /**
159
159
  * The relations, each read lazily so entities pointing at each other declare in either order, and the values
160
160
  * read over the to-many ones, its base's too: `(agg) => ({ postCount: () => agg.posts.count() })`.
161
161
  */
162
- relations<const R, const A = {}>(relations: (rel: RelationBuilder<Columns>) => R, aggregates?: (agg: AggregateRefs<R> & ToManyRefs<B, Exclude<ToManyRelationKey<B>, keyof R>>) => A): SchemaClass<Row & RelationRow<R> & AggregateRow<A>, Key, Columns>;
162
+ relations<const R, const A = {}>(relations: (rel: RelationBuilder<Columns>) => R, aggregates?: (agg: AggregateRefs<R> & ToManyRefs<B, Exclude<ToManyRelationKey<B>, keyof R>>) => A): RelatedEntity<Row & RelationRow<R> & AggregateRow<A>, Key, Columns, Abstract>;
163
+ };
164
+ /** A schema entity's class once its relations are in: its filters may follow, and read through them. */
165
+ export type RelatedEntity<Row, Key, Columns, Abstract = false> = SchemaClass<Row, Key, Columns, Abstract> & {
166
+ filters(filters: FilterSection<Row>): SchemaClass<Row, Key, Columns, Abstract>;
163
167
  };
164
168
  /** A schema entity's class while its sections may still be declared. */
165
- export type SchemaEntity<Row, Key, Columns, B> = SchemaClass<Row, Key, Columns> & SchemaSections<Row, Key, Columns, B>;
166
- /** The class a schema declares, to use as it is or to extend with behaviour. */
167
- export type SchemaClass<Row, Key = unknown, Columns = unknown> = (new () => Row) & SchemaShape<Key, Columns>;
169
+ export type SchemaEntity<Row, Key, Columns, B, Abstract = false> = SchemaClass<Row, Key, Columns, Abstract> & SchemaSections<Row, Key, Columns, B, Abstract>;
170
+ /** The class a schema declares, to use as it is or to extend with behaviour; abstract for a base never a table. */
171
+ export type SchemaClass<Row, Key = unknown, Columns = unknown, Abstract = false> = (Abstract extends true ? abstract new () => Row : new () => Row) & SchemaShape<Key, Columns>;
168
172
  declare const schemaShape: unique symbol;
169
173
  /**
170
174
  * What a relation or an aggregate pointing at a schema reads of it, its key's type and its columns, carried beside
@@ -1,4 +1,7 @@
1
- export type Type<T> = (new (...args: unknown[]) => T) | (abstract new (...args: unknown[]) => T);
1
+ /** An entity's class, an abstract base included. */
2
+ export type AbstractType<T> = abstract new (...args: unknown[]) => T;
3
+ /** A concrete entity: an abstract base is never a table, so a query or write does not take one. */
4
+ export type Type<T> = new (...args: unknown[]) => T;
2
5
  export type BooleanLike = boolean | 0 | 1;
3
6
  export type MongoId = {
4
7
  toHexString: () => string;
@@ -1,3 +1,3 @@
1
- import type { HookContext, HookEvent, Type } from '../type/index.js';
1
+ import type { HookContext, HookEvent, AbstractType } from '../type/index.js';
2
2
  /** Runs each hook registered for `event` on each payload, in order, awaiting each: a hook mutates the payload itself. */
3
- export declare function runHooks<E extends object>(entity: Type<E>, event: HookEvent, payloads: readonly E[], ctx: HookContext): Promise<void>;
3
+ export declare function runHooks<E extends object>(entity: AbstractType<E>, event: HookEvent, payloads: readonly E[], ctx: HookContext): Promise<void>;
@@ -1,4 +1,4 @@
1
- import { ColumnRef, type IndexRefMap, QuerySql, type QuerySqlFn, type ComputedRefs, type RefMap, type RelationRef, type SqlArg, type SqlStatement, type SqlValueName, type TriggerRowName, type Type } from '../type/index.js';
1
+ import { ColumnRef, type IndexRefMap, QuerySql, type QuerySqlFn, type ComputedRefs, type RefMap, type RelationRef, type SqlArg, type SqlStatement, type SqlValueName, type TriggerRowName, type AbstractType } from '../type/index.js';
2
2
  /**
3
3
  * Raw SQL, where an interpolated value binds, a `refs` field renders its column, and a `sql` renders
4
4
  * in place: `sql`GREATEST(0, ${user.credits} - ${amount})``. A callback writes whatever it writes, so
@@ -37,7 +37,7 @@ export declare const SQL_VALUES: Readonly<Record<SqlValueName, QuerySql>>;
37
37
  * the dialect names it, so the naming strategy and `.name()` apply, and qualified by the alias
38
38
  * in scope. Metadata is read when a ref renders, so the map serves before the fields are registered.
39
39
  */
40
- export declare function refs<E>(entity: Type<E>): RefMap<E>;
40
+ export declare function refs<E>(entity: AbstractType<E>): RefMap<E>;
41
41
  /**
42
42
  * The refs a definition's callbacks read: a check's, a computed field's, a predicate's. A member decorator
43
43
  * sees no class, so these name no entity and resolve against the one rendering them.
@@ -56,11 +56,11 @@ export declare function indexRefs<E>(): IndexRefMap<E>;
56
56
  * {@link refs} are, so each names its own column wherever it renders, a write to another table included.
57
57
  * Columns only: a relation's aggregate is a subquery, and a trigger fires on one row, not over a table.
58
58
  */
59
- export declare function rowRefs<E>(entity: Type<E>, qualifier: TriggerRowName): RefMap<E>;
59
+ export declare function rowRefs<E>(entity: AbstractType<E>, qualifier: TriggerRowName): RefMap<E>;
60
60
  /**
61
61
  * One field as SQL, against its own entity or, read off a definition, the entity rendering it. A
62
62
  * `qualifier` names the row it reads from, `NEW` or `OLD`, instead of the alias in scope.
63
63
  */
64
- export declare function columnRef(entity: Type<unknown> | undefined, key: string, qualifier?: string): ColumnRef;
64
+ export declare function columnRef(entity: AbstractType<unknown> | undefined, key: string, qualifier?: string): ColumnRef;
65
65
  /** @deprecated Renamed to {@link sql}, the tag editors recognise for SQL highlighting. */
66
66
  export declare const raw: typeof sql;
@@ -1,21 +1,21 @@
1
- import { type EntityPredicate, type QueryConflictPaths, type QuerySql, type TriggerWrite, type Type, type UpdatePayload, type WritableKey, type WriteRow } from '../type/index.js';
1
+ import { type EntityPredicate, type QueryConflictPaths, type QuerySql, type TriggerWrite, type AbstractType, type UpdatePayload, type WritableKey, type WriteRow } from '../type/index.js';
2
2
  /**
3
3
  * A row inserted by a trigger's body, into any table: `insertInto(PostAudit, { postId: newRow.id })`.
4
4
  * Each value is a literal or SQL, a row's ref most often, and every engine renders it, SQL Server's
5
5
  * set-based trigger included, where it inserts one row for each the statement touched.
6
6
  */
7
- export declare function insertInto<E extends object>(entity: Type<E>, row: WriteRow<E>): QuerySql;
7
+ export declare function insertInto<E extends object>(entity: AbstractType<E>, row: WriteRow<E>): QuerySql;
8
8
  /**
9
9
  * A row inserted by a trigger's body, or what its conflict paths find taking `update` instead, as `upsertOne`
10
10
  * does: `upsertInto(Tally, { postId: true }, { postId: newRow.id, count: 1 }, { count: { $inc: 1 } })`.
11
11
  */
12
- export declare function upsertInto<E extends object>(entity: Type<E>, conflictPaths: QueryConflictPaths<E>, row: WriteRow<E>, update?: UpdatePayload<E, QuerySql, WritableKey<E>, never>): QuerySql;
12
+ export declare function upsertInto<E extends object>(entity: AbstractType<E>, conflictPaths: QueryConflictPaths<E>, row: WriteRow<E>, update?: UpdatePayload<E, QuerySql, WritableKey<E>, never>): QuerySql;
13
13
  /** The rows `q.$where` names updated by a trigger's body: `updateTable(Post, { $where: { id: newRow.postId } }, set)`. */
14
- export declare function updateTable<E extends object>(entity: Type<E>, q: {
14
+ export declare function updateTable<E extends object>(entity: AbstractType<E>, q: {
15
15
  readonly $where: EntityPredicate<E>;
16
16
  }, set: UpdatePayload<E, QuerySql, WritableKey<E>, never>): QuerySql;
17
17
  /** The rows `q.$where` names deleted by a trigger's body, outright: a soft delete is an `updateTable`. */
18
- export declare function deleteFrom<E extends object>(entity: Type<E>, q: {
18
+ export declare function deleteFrom<E extends object>(entity: AbstractType<E>, q: {
19
19
  readonly $where: EntityPredicate<E>;
20
20
  }): QuerySql;
21
21
  /**
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "homepage": "https://uql-orm.dev",
4
4
  "description": "JSON-native TypeScript ORM for Bun, Browsers, Edge, Node, Workers. Supports PostgreSQL, PGlite, MySQL, MariaDB, SQLite, CockroachDB, SQL Server, Turso, Neon, Cloudflare D1 and MongoDB. Queries are plain JSON, typed to the leaf.",
5
5
  "license": "MIT",
6
- "version": "0.105.0",
6
+ "version": "0.105.1",
7
7
  "type": "module",
8
8
  "engines": {
9
9
  "node": ">=22.18"