uql-orm 0.91.1 → 0.93.0

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 (165) hide show
  1. package/dist/browser/http/bus.js +3 -4
  2. package/dist/browser/http/http.d.ts +1 -2
  3. package/dist/browser/http/http.js +8 -7
  4. package/dist/browser/index.d.ts +0 -1
  5. package/dist/browser/index.js +0 -1
  6. package/dist/browser/querier/httpQuerier.d.ts +18 -20
  7. package/dist/browser/querier/httpQuerier.js +20 -56
  8. package/dist/browser/type/index.d.ts +0 -1
  9. package/dist/browser/type/index.js +0 -1
  10. package/dist/browser/uql-browser.min.js +2 -2
  11. package/dist/browser/uql-browser.min.js.map +11 -12
  12. package/dist/cockroachdb/cockroachDialect.d.ts +4 -1
  13. package/dist/cockroachdb/cockroachDialect.js +6 -2
  14. package/dist/dialect/abstractDialect.d.ts +1 -1
  15. package/dist/dialect/abstractDialect.js +4 -1
  16. package/dist/dialect/abstractSqlDialect.d.ts +68 -37
  17. package/dist/dialect/abstractSqlDialect.js +185 -107
  18. package/dist/dialect/aliases.d.ts +4 -1
  19. package/dist/dialect/aliases.js +5 -2
  20. package/dist/dialect/hydrateColumn.js +3 -10
  21. package/dist/dialect/jsonSql.d.ts +4 -1
  22. package/dist/dialect/jsonSql.js +4 -1
  23. package/dist/dialect/mergeSqlDialect.d.ts +14 -4
  24. package/dist/dialect/mergeSqlDialect.js +32 -15
  25. package/dist/dialect/mysqlLikeSqlDialect.d.ts +16 -24
  26. package/dist/dialect/mysqlLikeSqlDialect.js +38 -52
  27. package/dist/dialect/pgLikeSqlDialect.d.ts +8 -8
  28. package/dist/dialect/pgLikeSqlDialect.js +19 -22
  29. package/dist/http/contract.d.ts +4 -0
  30. package/dist/http/contract.js +1 -0
  31. package/dist/http/handler.d.ts +2 -2
  32. package/dist/http/handler.js +17 -19
  33. package/dist/http/query.d.ts +5 -3
  34. package/dist/http/query.js +42 -42
  35. package/dist/index.d.ts +2 -2
  36. package/dist/index.js +2 -2
  37. package/dist/maria/mariaDialect.d.ts +4 -3
  38. package/dist/maria/mariaDialect.js +4 -6
  39. package/dist/migrate/builder/columnBuilder.d.ts +5 -15
  40. package/dist/migrate/builder/columnBuilder.js +50 -86
  41. package/dist/migrate/builder/index.d.ts +0 -1
  42. package/dist/migrate/builder/index.js +0 -1
  43. package/dist/migrate/builder/migrationBuilder.d.ts +3 -11
  44. package/dist/migrate/builder/migrationBuilder.js +41 -81
  45. package/dist/migrate/builder/tableBuilder.d.ts +0 -7
  46. package/dist/migrate/builder/tableBuilder.js +19 -30
  47. package/dist/migrate/builder/types.d.ts +2 -2
  48. package/dist/migrate/codegen/entityCodeGenerator.js +3 -3
  49. package/dist/migrate/codegen/entityTypes.js +2 -2
  50. package/dist/migrate/codegen/fieldOptionsSource.d.ts +2 -2
  51. package/dist/migrate/codegen/fieldOptionsSource.js +22 -14
  52. package/dist/migrate/codegen/indexDecoratorSource.js +64 -41
  53. package/dist/migrate/ddl/defaultSql.d.ts +31 -0
  54. package/dist/migrate/ddl/defaultSql.js +109 -0
  55. package/dist/migrate/ddl/index.d.ts +2 -4
  56. package/dist/migrate/ddl/index.js +14 -5
  57. package/dist/migrate/ddl/mssqlTableDdl.d.ts +1 -0
  58. package/dist/migrate/ddl/mssqlTableDdl.js +4 -1
  59. package/dist/migrate/ddl/mysqlTableDdl.d.ts +17 -0
  60. package/dist/migrate/ddl/mysqlTableDdl.js +33 -0
  61. package/dist/migrate/ddl/pgTableDdl.d.ts +7 -0
  62. package/dist/migrate/ddl/pgTableDdl.js +17 -0
  63. package/dist/migrate/ddl/tableDdl.d.ts +15 -10
  64. package/dist/migrate/ddl/tableDdl.js +31 -32
  65. package/dist/migrate/drift/driftDetector.js +46 -59
  66. package/dist/migrate/generator/definitionToNode.d.ts +11 -7
  67. package/dist/migrate/generator/definitionToNode.js +27 -34
  68. package/dist/migrate/generator/indexNodeToSchema.d.ts +3 -3
  69. package/dist/migrate/generator/indexNodeToSchema.js +5 -4
  70. package/dist/migrate/index.js +1 -1
  71. package/dist/migrate/introspection/abstractSqlSchemaIntrospector.d.ts +10 -5
  72. package/dist/migrate/introspection/abstractSqlSchemaIntrospector.js +9 -0
  73. package/dist/migrate/introspection/baseSqlIntrospector.d.ts +0 -1
  74. package/dist/migrate/introspection/baseSqlIntrospector.js +6 -8
  75. package/dist/migrate/introspection/mssqlIntrospector.js +3 -8
  76. package/dist/migrate/introspection/mysqlIntrospector.d.ts +11 -4
  77. package/dist/migrate/introspection/mysqlIntrospector.js +27 -11
  78. package/dist/migrate/introspection/postgresIntrospector.d.ts +2 -2
  79. package/dist/migrate/introspection/postgresIntrospector.js +3 -3
  80. package/dist/migrate/introspection/sqliteIntrospector.d.ts +1 -1
  81. package/dist/migrate/introspection/sqliteIntrospector.js +7 -10
  82. package/dist/migrate/migrationTarget.js +3 -3
  83. package/dist/migrate/schemaGenerator.d.ts +8 -12
  84. package/dist/migrate/schemaGenerator.js +36 -62
  85. package/dist/migrate/storage/databaseStorage.js +2 -2
  86. package/dist/migrate/triggerSql.d.ts +1 -1
  87. package/dist/migrate/triggerSql.js +17 -8
  88. package/dist/mongo/mongoDialect.d.ts +4 -3
  89. package/dist/mongo/mongoDialect.js +52 -38
  90. package/dist/mongo/mongoIntrospector.js +1 -1
  91. package/dist/mongo/mongoSchemaGenerator.d.ts +7 -4
  92. package/dist/mongo/mongoSchemaGenerator.js +18 -21
  93. package/dist/mongo/mongodbQuerier.d.ts +15 -8
  94. package/dist/mongo/mongodbQuerier.js +48 -33
  95. package/dist/mssql/mssqlDialect.d.ts +9 -5
  96. package/dist/mssql/mssqlDialect.js +23 -8
  97. package/dist/postgres/postgresDialect.d.ts +5 -2
  98. package/dist/postgres/postgresDialect.js +6 -6
  99. package/dist/querier/abstractQuerier.d.ts +20 -15
  100. package/dist/querier/abstractQuerier.js +93 -41
  101. package/dist/querier/abstractQuerierPool.d.ts +26 -24
  102. package/dist/querier/abstractQuerierPool.js +26 -64
  103. package/dist/querier/abstractSqlQuerier.d.ts +5 -6
  104. package/dist/querier/abstractSqlQuerier.js +15 -33
  105. package/dist/querier/cursor.d.ts +10 -0
  106. package/dist/querier/cursor.js +81 -0
  107. package/dist/querier/keyset.d.ts +19 -0
  108. package/dist/querier/keyset.js +198 -0
  109. package/dist/schema/canonicalType.d.ts +3 -3
  110. package/dist/schema/canonicalType.js +13 -12
  111. package/dist/schema/indexDifferences.d.ts +14 -7
  112. package/dist/schema/indexDifferences.js +7 -5
  113. package/dist/schema/schemaAST.d.ts +0 -1
  114. package/dist/schema/schemaAST.js +0 -2
  115. package/dist/schema/schemaASTBuilder.js +14 -20
  116. package/dist/schema/schemaASTDiffer.d.ts +7 -9
  117. package/dist/schema/schemaASTDiffer.js +54 -107
  118. package/dist/schema/sqlExpression.d.ts +28 -0
  119. package/dist/schema/sqlExpression.js +42 -0
  120. package/dist/schema/types.d.ts +48 -105
  121. package/dist/sqlite/sqliteDialect.d.ts +10 -13
  122. package/dist/sqlite/sqliteDialect.js +19 -30
  123. package/dist/type/dialect.d.ts +46 -11
  124. package/dist/type/dialect.js +2 -0
  125. package/dist/type/entity.d.ts +18 -3
  126. package/dist/type/migration.d.ts +7 -7
  127. package/dist/type/querier.d.ts +19 -26
  128. package/dist/type/query.d.ts +116 -25
  129. package/dist/type/query.js +21 -28
  130. package/dist/type/universalQuerier.d.ts +33 -7
  131. package/dist/type/utility.d.ts +10 -0
  132. package/dist/util/bytes.d.ts +7 -0
  133. package/dist/util/bytes.js +22 -0
  134. package/dist/util/date.d.ts +5 -0
  135. package/dist/util/date.js +5 -0
  136. package/dist/util/dialect.util.d.ts +1 -25
  137. package/dist/util/dialect.util.js +4 -50
  138. package/dist/util/field.util.d.ts +9 -0
  139. package/dist/util/field.util.js +15 -0
  140. package/dist/util/fieldOption.util.js +2 -2
  141. package/dist/util/index.d.ts +2 -1
  142. package/dist/util/index.js +2 -1
  143. package/dist/util/object.util.d.ts +0 -2
  144. package/dist/util/object.util.js +0 -7
  145. package/dist/util/query.util.d.ts +40 -0
  146. package/dist/util/query.util.js +76 -0
  147. package/dist/util/raw.d.ts +16 -1
  148. package/dist/util/raw.js +31 -0
  149. package/dist/util/relationQuery.util.js +18 -16
  150. package/dist/util/rowKey.util.js +2 -3
  151. package/dist/util/sql.util.d.ts +8 -2
  152. package/dist/util/sql.util.js +16 -17
  153. package/dist/util/sqlLiteral.js +2 -12
  154. package/dist/util/string.util.d.ts +5 -0
  155. package/dist/util/string.util.js +12 -0
  156. package/dist/util/triggerWrite.d.ts +11 -1
  157. package/dist/util/triggerWrite.js +14 -0
  158. package/package.json +1 -1
  159. package/skills/uql-orm/SKILL.md +22 -10
  160. package/dist/browser/options.d.ts +0 -4
  161. package/dist/browser/options.js +0 -13
  162. package/dist/browser/type/clientQuerierPool.d.ts +0 -4
  163. package/dist/browser/type/clientQuerierPool.js +0 -1
  164. package/dist/migrate/builder/expressions.d.ts +0 -69
  165. package/dist/migrate/builder/expressions.js +0 -145
@@ -1,4 +1,5 @@
1
- import { type ColumnFamily, type DdlRenderOptions, type EntityData, type EntityMeta, type EntityWhereMeta, type FieldKey, type FieldOptions, type IsolationLevel, type JsonColumnType, type JsonUpdateOp, type Query, type QueryAggMap, type QueryAggregate, type QueryBuildFn, type QueryComparisonOptions, type QueryConflictPaths, type QueryContext, type QueryContextOptions, type QueryExclude, type QueryGroupMap, type QueryGroupOp, type QueryHavingMap, type QueryRenderOptions, type QueryPage, type QueryPager, QueryRaw, type QueryRawFnOptions, type QuerySearch, type QuerySelectValue, type QuerySizeComparisonOps, type QueryTextSearchOptions, type QueryWhere, type QueryWhereArray, type QueryWhereFieldOp, type QueryWhereOptions, type RelationAggregateSpec, type RelationMeta, type SqlDialectName, type SqlQueryDialect, type TriggerRows, type TriggerWrite, type Type, type UpdatePayload } from '../type/index.js';
1
+ import { type ColumnFamily, type DdlRenderOptions, type EntityData, type EntityMeta, type EntityWhereMeta, type FieldKey, type FieldOptions, type IsolationLevel, type JsonColumnType, type JsonUpdateOp, type Query, type QueryAggMap, type QueryAggregate, type QueryBuildFn, type QueryComparisonOptions, type QueryConflictPaths, type QueryContext, type QueryContextOptions, type QueryExclude, type QueryGroupMap, type QueryGroupOp, type QueryHavingMap, type QueryRenderOptions, type QueryPage, type QueryPager, QueryRaw, type QueryRawFnOptions, type QuerySearch, type QuerySelectValue, type QuerySizeComparisonOps, type QueryTextSearchOptions, type QueryWhere, type QueryWhereArray, type QueryWhereFieldOp, type QueryWhereOptions, type RelationAggregateSpec, type RelationMeta, type SqlDialectName, type SqlQueryDialect, type SqlValues, type TriggerRows, type TriggerWrite, type Type, type UpdatePayload, type UpsertOptions } from '../type/index.js';
2
+ import { type SortDirection } from '../util/index.js';
2
3
  import type { HydrateKind } from './hydrateColumn.js';
3
4
  import { type JsonAccessMode, type JsonSlot } from './jsonSql.js';
4
5
  import { type QueryJoins, type QuerySortOptions } from './queryJoins.js';
@@ -16,11 +17,8 @@ type InsertShape<E> = {
16
17
  };
17
18
  /** One entry of {@link AbstractSqlDialect.hydratableFields}: a field key and how it decodes. */
18
19
  type HydratableField = readonly [string, HydrateKind];
19
- /** A direction as a statement writes it: the suffix, and where the caller asked nulls to land. */
20
- type SortOrder = {
21
- readonly direction?: string;
22
- readonly nulls?: 'first' | 'last';
23
- };
20
+ /** A sort term's direction. A vector distance has none: it always ranks nearest first. */
21
+ type SortOrder = Partial<SortDirection>;
24
22
  /** A sort term of a relation's rows as their aggregate orders by it: the column carrying it out. */
25
23
  export type SortRef = SortOrder & {
26
24
  readonly ref: string;
@@ -83,6 +81,10 @@ export type CarriedFields = {
83
81
  /** The key a term answers under in a populated relation's row, which a raw expression has only once aliased. */
84
82
  export declare function relationTermKey({ sql, key }: SelectTerm): string;
85
83
  export type { HydrateKind };
84
+ /** ` FROM <rows> WHERE <narrowing>`: what a set-based trigger's body reads, as {@link TriggerRows} states it. */
85
+ export declare function fromRows(rows: TriggerRows): string;
86
+ /** The ANSI spellings, which an engine overrides where it differs. No ANSI function makes a UUID. */
87
+ export declare const ANSI_SQL_VALUES: SqlValues;
86
88
  export declare abstract class AbstractSqlDialect extends VectorSqlDialect implements SqlQueryDialect {
87
89
  abstract readonly dialectName: SqlDialectName;
88
90
  /** Itself, unless the engine is a fork running another's SQL, which is the only case that overrides. */
@@ -94,10 +96,9 @@ export declare abstract class AbstractSqlDialect extends VectorSqlDialect implem
94
96
  * `SqlDialectFeatures.serialDeclaresPrimaryKey`.
95
97
  */
96
98
  abstract readonly autoIncrementSuffix: string;
97
- abstract readonly tableOptions: string;
98
- abstract readonly beginTransactionCommand: string;
99
- abstract readonly commitTransactionCommand: string;
100
- abstract readonly rollbackTransactionCommand: string;
99
+ readonly beginTransactionCommand: string;
100
+ readonly commitTransactionCommand: string;
101
+ readonly rollbackTransactionCommand: string;
101
102
  /**
102
103
  * How this engine declares a namespace, so a generated migration creates the schemas its tables
103
104
  * need before creating them. Only reached where {@link DialectFeatures.schemas} is on. MySQL and
@@ -105,16 +106,8 @@ export declare abstract class AbstractSqlDialect extends VectorSqlDialect implem
105
106
  */
106
107
  createSchemaSql(schema: string): string;
107
108
  readonly isolationLevelStrategy: 'inline' | 'set-before' | 'none';
108
- readonly alterColumnStrategy: 'separate-clauses' | 'single-statement';
109
- readonly alterColumnSyntax: 'ALTER COLUMN' | 'MODIFY COLUMN';
110
- readonly dropForeignKeySyntax: 'DROP CONSTRAINT' | 'DROP FOREIGN KEY';
111
- /**
112
- * `DROP CONSTRAINT <name>` where a primary key is a named constraint like any other; MySQL spells
113
- * it `DROP PRIMARY KEY` and takes no name, since a table's key is always called `PRIMARY` there.
114
- */
115
- readonly dropPrimaryKeySyntax: 'DROP CONSTRAINT' | 'DROP PRIMARY KEY';
116
- readonly dropIndexSyntax: 'on-table' | 'standalone';
117
109
  readonly booleanLiteral: 'native' | 'integer';
110
+ readonly sqlValues: SqlValues;
118
111
  /**
119
112
  * Maximum number of bind parameters the driver accepts in a single statement.
120
113
  * `insertMany` splits larger batches into multiple statements based on this limit.
@@ -140,10 +133,12 @@ export declare abstract class AbstractSqlDialect extends VectorSqlDialect implem
140
133
  */
141
134
  protected renderOperands<T>(ctx: QueryContext, operands: readonly T[], render: (ctx: QueryContext, operand: T) => void): string[];
142
135
  addValue(ctx: QueryContext, value: unknown): string;
136
+ /** When set, a `Date` binds as UTC text with this zone suffix (`''` for none). Unset, the driver gets the `Date`. */
137
+ protected readonly dateZone?: string;
143
138
  /**
144
- * A parameter value as this engine's driver takes it: a boolean as the integer an engine with no
145
- * boolean type stores, and everything else as it is - a `bigint` included, which every driver here
146
- * binds exactly, where a number would round it past 2^53. A driver that refuses one (D1) overrides.
139
+ * Converts a parameter value to what this engine's driver takes: a `Date` per {@link dateZone}, a boolean to
140
+ * 1/0 on an engine with no boolean type, and anything else unchanged. A `bigint` passes as is, since every
141
+ * driver here binds it exactly where a number would round past 2^53; a driver that refuses one (D1) overrides.
147
142
  */
148
143
  normalizeValue(value: unknown): unknown;
149
144
  /**
@@ -369,6 +364,8 @@ export declare abstract class AbstractSqlDialect extends VectorSqlDialect implem
369
364
  * value. An engine that orders JSON as text reads a number first, then the text.
370
365
  */
371
366
  protected readonly jsonSortModes: readonly JsonAccessMode[];
367
+ /** The `LIMIT` meaning all rows, for an engine that accepts an `OFFSET` only after a `LIMIT`. */
368
+ protected readonly unboundedLimit?: string;
372
369
  /**
373
370
  * `LIMIT`/`OFFSET`. `sorted` says whether an `ORDER BY` was emitted just before, which
374
371
  * {@link MergeSqlDialect} needs: SQL Server refuses to page a statement that has none.
@@ -423,13 +420,12 @@ export declare abstract class AbstractSqlDialect extends VectorSqlDialect implem
423
420
  /** The SQL referencing one of an aggregate's emitted columns, rejecting any other name. */
424
421
  private aggregateRef;
425
422
  protected having(ctx: QueryContext, having: QueryHavingMap, emittedColumns: Record<string, string>): void;
426
- private resolveSortDirection;
427
423
  /**
428
424
  * One `ORDER BY` term. A placement the engine has no `NULLS FIRST/LAST` for becomes a term of its
429
425
  * own in front of it, which is why one is only ever emitted where the caller asked for it: no index
430
426
  * serves an expression. SQL Server needs a `CASE`, having no orderable boolean.
431
427
  */
432
- protected orderByTerm(expr: string, { direction, nulls }: SortOrder): string;
428
+ protected orderByTerm(expr: string, { desc, nulls }: SortOrder): string;
433
429
  /** Every operator of one `HAVING` condition, `AND`-joined. */
434
430
  protected havingCondition(ctx: QueryContext, expr: string, condition: QueryHavingMap[string]): void;
435
431
  /**
@@ -448,6 +444,11 @@ export declare abstract class AbstractSqlDialect extends VectorSqlDialect implem
448
444
  * another table of the statement took it first.
449
445
  */
450
446
  private readOptions;
447
+ /**
448
+ * The clause that returns the written ids, shared by every insert and upsert. It is `''` on an engine whose
449
+ * statement cannot return them, and on a composite key, which has no id to ask for.
450
+ */
451
+ protected insertedIdReturning<E>(meta: EntityMeta<E>): string;
451
452
  insert<E>(ctx: QueryContext, entity: Type<E>, payload: E | E[], opts?: QueryRenderOptions): void;
452
453
  /**
453
454
  * What a text search matches and a fulltext index covers, which have to agree for the index to serve the
@@ -474,7 +475,17 @@ export declare abstract class AbstractSqlDialect extends VectorSqlDialect implem
474
475
  */
475
476
  protected appendDefaultInsertValue(ctx: QueryContext, _field: FieldOptions | undefined): void;
476
477
  update<E>(ctx: QueryContext, entity: Type<E>, q: QuerySearch<E>, payload: UpdatePayload<E>, opts?: QueryRenderOptions): void;
477
- /** `col = value`, a JSON operator or a `$inc`/`$mul` spelled as the engine's. */
478
+ /** What an update assigns: the payload's fields, `onUpdate` fills included. */
479
+ private updateEntries;
480
+ /**
481
+ * A `SET` list, each assignment reading its column as `qualifier` names it, which an upsert sets: `MERGE`'s
482
+ * source and MySQL's new row share the table's column names.
483
+ */
484
+ private appendAssignments;
485
+ /**
486
+ * `col = value`, a JSON operator or a `$inc`/`$mul` spelled as the engine's. What reads the table, the operators
487
+ * and the refs in SQL alike, reads it through `qualifier`.
488
+ */
478
489
  private appendAssignment;
479
490
  /**
480
491
  * A write in a trigger's body. Only the columns it names, none filled in JavaScript - that would bake
@@ -482,20 +493,41 @@ export declare abstract class AbstractSqlDialect extends VectorSqlDialect implem
482
493
  * trigger has none of. `rows` are what a set-based engine's body reads, narrowed to the ones it fires for.
483
494
  */
484
495
  triggerWrite(ctx: QueryContext, write: TriggerWrite, rows?: TriggerRows): void;
496
+ /** `$inc`, `$mul` and `$push` refused where the body reads a set, which applies each once for the statement. */
497
+ private refuseAccumulating;
498
+ /** A trigger's insert, unterminated: its values, or a `SELECT` of them off the set a set-based engine hands it. */
499
+ protected appendTriggerInsert<E>(ctx: QueryContext, meta: EntityMeta<E>, entries: readonly [string, unknown][], rows?: TriggerRows): void;
500
+ /** The values a trigger writes, a literal or SQL each, the rows' refs most often. */
501
+ protected appendTriggerValues<E>(ctx: QueryContext, meta: EntityMeta<E>, entries: readonly [string, unknown][]): void;
502
+ /** A trigger's upsert: its insert, then what a conflicting row takes, `assignments`, or nothing where empty. */
503
+ protected appendTriggerUpsert<E>(ctx: QueryContext, meta: EntityMeta<E>, conflictPaths: QueryConflictPaths<E>, entries: readonly [string, unknown][], assignments: string, rows?: TriggerRows): void;
504
+ /** ` ON CONFLICT (keys) DO UPDATE SET ...`, or `DO NOTHING` with nothing to assign. */
505
+ private onConflict;
506
+ /**
507
+ * The statement failing a trigger's write with `message`, a quoted literal: SQL/PSM's `SIGNAL`, which the
508
+ * MySQL family speaks. `rows` are what a set-based engine's body reads, where it fails only if there are any.
509
+ */
510
+ protected refusal(message: string, _rows?: TriggerRows): string;
485
511
  /** The values a write names, refusing one the entity has no column for. */
486
512
  private writtenEntries;
487
513
  /**
488
514
  * `INSERT ... ON CONFLICT ... DO UPDATE/NOTHING RETURNING`. The assignments are built before the insert
489
515
  * fills `onInsert` columns, which must stay out of them, and their values bound after it, where a `?` reads them.
490
516
  */
491
- upsert<E>(ctx: QueryContext, entity: Type<E>, conflictPaths: QueryConflictPaths<E>, payload: E | E[],
492
- /** One more `RETURNING` item, as a bare expression: this joins the list and adds the keyword. */
493
- extraReturning?: string): void;
517
+ upsert<E>(ctx: QueryContext, entity: Type<E>, conflictPaths: QueryConflictPaths<E>, payload: E | E[], { update }?: UpsertOptions<E>): void;
518
+ /** One more `RETURNING` item saying whether the row was created, where the engine can tell; else empty. */
519
+ protected readonly upsertCreatedReturning: string;
494
520
  /** Whether the upsert's assignments bind straight into the statement, as numbered `$n` placeholders can. */
495
521
  protected readonly upsertUpdateBindsInPlace: boolean;
496
- /** How an `ON CONFLICT` assignment reads the row that was being inserted. */
497
- protected readonly upsertExcluded: (columnName: string) => string;
498
- protected getUpsertUpdateAssignments<E>(ctx: QueryContext, meta: EntityMeta<E>, conflictPaths: QueryConflictPaths<E>, payload: E | E[], callback: (columnName: string) => string): string;
522
+ /** How an upsert's assignment reads `column` of the row that was being inserted. */
523
+ protected upsertIncoming(column: string): string;
524
+ /** `key`'s column of the row being inserted, as SQL an assignment takes. */
525
+ private incoming;
526
+ /**
527
+ * What a conflicting row takes: `update` where given, else the incoming row less the conflict paths, and what
528
+ * `onUpdate` fills. An empty `update` leaves the row as it is, its fills included: nothing to assign.
529
+ */
530
+ protected getUpsertUpdateAssignments<E>(ctx: QueryContext, meta: EntityMeta<E>, conflictPaths: QueryConflictPaths<E>, payload: E | E[], update?: UpdatePayload<E>): string;
499
531
  protected getUpsertConflictPathsStr<E>(meta: EntityMeta<E>, conflictPaths: QueryConflictPaths<E>): string;
500
532
  delete<E>(ctx: QueryContext, entity: Type<E>, q: QuerySearch<E>, opts?: QueryRenderOptions): void;
501
533
  escapeId(val: string | undefined, forbidQualified?: boolean, addDot?: boolean): string;
@@ -549,7 +581,7 @@ export declare abstract class AbstractSqlDialect extends VectorSqlDialect implem
549
581
  * `"col" = <expr>` for a JSON update, each operator wrapping the last: `$pull`, `$set`, `$push`, `$unset`.
550
582
  * `$pull` reads the column and every later one its expression once, so no value binds twice.
551
583
  */
552
- protected formatJsonUpdate(ctx: QueryContext, escapedCol: string, value: JsonUpdateOp, field?: FieldOptions): void;
584
+ protected formatJsonUpdate(ctx: QueryContext, escapedCol: string, value: JsonUpdateOp, field?: FieldOptions, current?: string): void;
553
585
  /**
554
586
  * Remove every element equal to the given value, per array key. Each key wraps the expression
555
587
  * built so far, so dialects only supply {@link jsonPullKey} - and because every key reads
@@ -566,12 +598,12 @@ export declare abstract class AbstractSqlDialect extends VectorSqlDialect implem
566
598
  protected jsonArrayOf(elem: string): string;
567
599
  /** Whether an element is not the pulled value, both read as JSON. */
568
600
  protected jsonDiffers(elem: string, operand: string): string;
569
- /** Shallow assignment of top-level keys, matching PostgreSQL's `jsonb || jsonb`. */
570
- protected abstract jsonSet(ctx: QueryContext, expr: string, set: Record<string, unknown>, field?: FieldOptions): string;
601
+ /** Shallow assignment of top-level keys, matching PostgreSQL's `jsonb || jsonb`, through `JSON_SET`. */
602
+ protected jsonSet(ctx: QueryContext, expr: string, set: Record<string, unknown>, field?: FieldOptions): string;
571
603
  /** Append one value per array key, creating the array when the key is absent. */
572
604
  protected abstract jsonPush(ctx: QueryContext, expr: string, push: Record<string, unknown>): string;
573
- /** Remove object keys. */
574
- protected abstract jsonUnset(ctx: QueryContext, expr: string, unset: readonly string[]): string;
605
+ /** Remove object keys, through `JSON_REMOVE`. */
606
+ protected jsonUnset(_ctx: QueryContext, expr: string, unset: readonly string[]): string;
575
607
  /**
576
608
  * The text of SQL a schema declares, as DDL carries it: values written as literals, and none left bound,
577
609
  * since a `CREATE` statement has no placeholder to bind one into. An entity's SQL reads its fields, a
@@ -700,7 +732,6 @@ export declare abstract class AbstractSqlDialect extends VectorSqlDialect implem
700
732
  private vectorNearCondition;
701
733
  /** ANSI-style single-quote escaping. */
702
734
  escape(value: unknown): string;
703
- protected get regexpOp(): string;
704
735
  /**
705
736
  * The `$regex` predicate. An infix operator on the MySQL family (`REGEXP`) and the Postgres one
706
737
  * (`~`), but a function on Oracle and SQL Server 2025 (`REGEXP_LIKE(col, ?)`) - which is why this