uql-orm 0.101.0 → 0.101.2

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 (104) hide show
  1. package/README.md +1 -1
  2. package/dist/browser/uql-browser.min.js +2 -2
  3. package/dist/browser/uql-browser.min.js.map +6 -6
  4. package/dist/d1/d1SqliteDialect.d.ts +1 -1
  5. package/dist/d1/d1SqliteDialect.js +1 -1
  6. package/dist/dialect/abstractDialect.js +2 -2
  7. package/dist/dialect/abstractSqlDialect.d.ts +10 -10
  8. package/dist/dialect/abstractSqlDialect.js +24 -24
  9. package/dist/dialect/operators.js +2 -2
  10. package/dist/dialect/pgLikeSqlDialect.d.ts +1 -1
  11. package/dist/dialect/pgLikeSqlDialect.js +5 -5
  12. package/dist/dialect/queryContext.d.ts +1 -1
  13. package/dist/dialect/queryContext.js +1 -1
  14. package/dist/dialect/vectorSqlDialect.js +1 -1
  15. package/dist/entity/decorator/entity.d.ts +2 -2
  16. package/dist/entity/decorator/entity.js +2 -2
  17. package/dist/http/index.d.ts +2 -2
  18. package/dist/http/index.js +1 -2
  19. package/dist/http/query.d.ts +1 -1
  20. package/dist/http/query.js +4 -4
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/libsql/index.d.ts +1 -1
  24. package/dist/libsql/index.js +1 -1
  25. package/dist/migrate/builder/tableBuilder.js +1 -1
  26. package/dist/migrate/builder/types.d.ts +2 -2
  27. package/dist/migrate/codegen/entityCodeGenerator.js +1 -1
  28. package/dist/migrate/codegen/fieldOptionsSource.js +5 -5
  29. package/dist/migrate/codegen/indexDecoratorSource.d.ts +2 -2
  30. package/dist/migrate/codegen/indexDecoratorSource.js +5 -5
  31. package/dist/migrate/codegen/sourceLiteral.d.ts +2 -2
  32. package/dist/migrate/codegen/sourceLiteral.js +3 -3
  33. package/dist/migrate/ddl/defaultSql.js +1 -1
  34. package/dist/migrate/generator/definitionToNode.d.ts +3 -3
  35. package/dist/migrate/index.d.ts +8 -11
  36. package/dist/migrate/index.js +7 -17
  37. package/dist/migrate/indexPredicate.d.ts +1 -1
  38. package/dist/migrate/indexPredicate.js +5 -5
  39. package/dist/migrate/introspection/abstractSqlSchemaIntrospector.d.ts +8 -8
  40. package/dist/migrate/introspection/abstractSqlSchemaIntrospector.js +3 -3
  41. package/dist/migrate/introspection/mssqlIntrospector.d.ts +5 -5
  42. package/dist/migrate/introspection/mssqlIntrospector.js +10 -10
  43. package/dist/migrate/introspection/mysqlIntrospector.d.ts +5 -5
  44. package/dist/migrate/introspection/mysqlIntrospector.js +13 -13
  45. package/dist/migrate/introspection/postgresIntrospector.d.ts +13 -13
  46. package/dist/migrate/introspection/postgresIntrospector.js +21 -21
  47. package/dist/migrate/introspection/sqliteIntrospector.d.ts +4 -4
  48. package/dist/migrate/introspection/sqliteIntrospector.js +6 -6
  49. package/dist/migrate/migrationLock.d.ts +3 -3
  50. package/dist/migrate/migrationLock.js +7 -7
  51. package/dist/migrate/migrationTarget.js +2 -2
  52. package/dist/migrate/migrator.js +2 -2
  53. package/dist/migrate/schemaGenerator.d.ts +1 -1
  54. package/dist/migrate/schemaGenerator.js +1 -1
  55. package/dist/migrate/storage/databaseStorage.d.ts +3 -3
  56. package/dist/migrate/storage/databaseStorage.js +4 -4
  57. package/dist/migrate/triggerSql.js +7 -7
  58. package/dist/mongodb/index.d.ts +1 -1
  59. package/dist/mongodb/index.js +1 -1
  60. package/dist/mongodb/mongoDialect.js +4 -4
  61. package/dist/mongodb/mongoSchemaGenerator.js +3 -3
  62. package/dist/mongodb/mongodbQuerier.d.ts +3 -2
  63. package/dist/mssql/mssqlDialect.js +3 -3
  64. package/dist/postgres/index.d.ts +1 -1
  65. package/dist/postgres/index.js +1 -1
  66. package/dist/querier/abstractQuerier.d.ts +10 -3
  67. package/dist/querier/abstractQuerier.js +12 -12
  68. package/dist/querier/abstractSqlQuerier.d.ts +3 -3
  69. package/dist/querier/abstractSqlQuerier.js +3 -3
  70. package/dist/schema/canonicalType.d.ts +1 -1
  71. package/dist/schema/canonicalType.js +6 -6
  72. package/dist/schema/sqlExpression.d.ts +4 -4
  73. package/dist/schema/sqlExpression.js +5 -5
  74. package/dist/sqlite/index.d.ts +1 -1
  75. package/dist/sqlite/index.js +1 -1
  76. package/dist/sqlite/sqliteDialect.js +2 -2
  77. package/dist/type/dialect.d.ts +3 -3
  78. package/dist/type/entity.d.ts +39 -39
  79. package/dist/type/index.d.ts +1 -1
  80. package/dist/type/index.js +1 -1
  81. package/dist/type/migration.d.ts +1 -1
  82. package/dist/type/querier.d.ts +5 -5
  83. package/dist/type/query.d.ts +32 -32
  84. package/dist/type/queryAggregate.d.ts +2 -2
  85. package/dist/type/{queryRaw.d.ts → querySql.d.ts} +33 -33
  86. package/dist/type/{queryRaw.js → querySql.js} +17 -17
  87. package/dist/type/queryWhere.d.ts +22 -22
  88. package/dist/type/universalQuerier.d.ts +12 -12
  89. package/dist/type/wire.d.ts +4 -4
  90. package/dist/util/ddlExpression.util.d.ts +4 -4
  91. package/dist/util/ddlExpression.util.js +7 -7
  92. package/dist/util/dialect.util.d.ts +7 -7
  93. package/dist/util/dialect.util.js +4 -4
  94. package/dist/util/fieldOption.util.d.ts +3 -3
  95. package/dist/util/fieldOption.util.js +5 -5
  96. package/dist/util/index.d.ts +1 -1
  97. package/dist/util/index.js +1 -1
  98. package/dist/util/query.util.js +1 -1
  99. package/dist/util/{raw.d.ts → sql.d.ts} +22 -20
  100. package/dist/util/{raw.js → sql.js} +28 -26
  101. package/dist/util/triggerWrite.d.ts +7 -7
  102. package/dist/util/triggerWrite.js +2 -2
  103. package/package.json +1 -1
  104. package/skills/uql-orm/SKILL.md +7 -7
@@ -1,7 +1,7 @@
1
1
  import type { QueryContext, RelationAggregateSpec, SqlQueryDialect, TriggerRows } from './dialect.js';
2
2
  import type { Scalar, Type } from './utility.js';
3
- /** What a `raw` callback receives. See {@link QueryRawFn}. */
4
- export type QueryRawRenderOptions = {
3
+ /** What a `sql` callback receives. See {@link QuerySqlFn}. */
4
+ export type QuerySqlRenderOptions = {
5
5
  /** The dialect rendering the SQL. */
6
6
  dialect: SqlQueryDialect;
7
7
  /** The alias of the table in scope, unescaped; empty where there is none. */
@@ -21,61 +21,61 @@ export type QueryRawRenderOptions = {
21
21
  */
22
22
  rows?: TriggerRows;
23
23
  };
24
- /** {@link QueryRawRenderOptions} as the callers along the way fill them in, every one still optional. */
25
- export type QueryRawFnOptions = Partial<QueryRawRenderOptions>;
24
+ /** {@link QuerySqlRenderOptions} as the callers along the way fill them in, every one still optional. */
25
+ export type QuerySqlFnOptions = Partial<QuerySqlRenderOptions>;
26
26
  /**
27
- * A `raw` callback: write into `ctx`, or return a string or number to have it appended. Anything else
27
+ * A `sql` callback: write into `ctx`, or return a string or number to have it appended. Anything else
28
28
  * it returns is ignored, which is why the return type is `unknown` rather than `void | Scalar` - the
29
29
  * latter rejected `({ ctx }) => ctx.append(...)`, the form every computed field is written in, because
30
30
  * TypeScript's "returning a value where void is expected" allowance does not apply to a union.
31
31
  */
32
- export type QueryRawFn = (opts: QueryRawRenderOptions) => unknown;
33
- export declare const RAW_VALUE: unique symbol;
32
+ export type QuerySqlFn = (opts: QuerySqlRenderOptions) => unknown;
33
+ export declare const SQL_FN: unique symbol;
34
34
  export declare const RAW_ALIAS: unique symbol;
35
- export declare const RAW_TEXT: unique symbol;
35
+ export declare const SQL_TEXT: unique symbol;
36
36
  /** Keys the phantom a ref or an aggregate carries its value type in, which no value ever fills. */
37
- export declare const RAW_VALUE_TYPE: unique symbol;
37
+ export declare const SQL_VALUE_TYPE: unique symbol;
38
38
  /**
39
- * What a `raw` template interpolates: a value it binds, a list of them (`= ANY(${ids})`), or SQL it renders in
39
+ * What a `sql` template interpolates: a value it binds, a list of them (`= ANY(${ids})`), or SQL it renders in
40
40
  * place. Never `undefined`, which would bind nothing: leave it out, or interpolate `null`.
41
41
  */
42
- export type RawValue = Scalar | null | readonly (Scalar | null)[] | QueryRaw;
43
- /** A statement as `all` and `run` take one: a tagged template's strings and values, or a `raw` built apart. */
44
- export type SqlStatement = readonly [strings: TemplateStringsArray, ...values: RawValue[]] | readonly [sql: QueryRaw];
45
- export declare class QueryRaw {
46
- readonly [RAW_VALUE]: QueryRawFn;
42
+ export type SqlArg = Scalar | null | readonly (Scalar | null)[] | QuerySql;
43
+ /** A statement as `all` and `run` take one: a tagged template's strings and values, or a `sql` built apart. */
44
+ export type SqlStatement = readonly [strings: TemplateStringsArray, ...values: SqlArg[]] | readonly [sql: QuerySql];
45
+ export declare class QuerySql {
46
+ readonly [SQL_FN]: QuerySqlFn;
47
47
  readonly [RAW_ALIAS]?: string;
48
48
  /**
49
49
  * The SQL verbatim, set only where it is a constant: a template that interpolates nothing binds no
50
50
  * value and reads no column, so it needs no dialect to render. What a DDL clause with nowhere to
51
51
  * bind reads - see {@link constantSql}.
52
52
  */
53
- readonly [RAW_TEXT]?: string;
54
- constructor(value: QueryRawFn, { alias, text }?: {
53
+ readonly [SQL_TEXT]?: string;
54
+ constructor(value: QuerySqlFn, { alias, text }?: {
55
55
  readonly alias?: string;
56
56
  readonly text?: string;
57
57
  });
58
58
  /** The same expression under an alias, for a `$select` projection. */
59
- as(alias: string): QueryRaw;
59
+ as(alias: string): QuerySql;
60
60
  /** Writes the expression into `opts.ctx`. The alias is the projection's to write, after the term. */
61
- render(opts: QueryRawRenderOptions): void;
61
+ render(opts: QuerySqlRenderOptions): void;
62
62
  }
63
63
  /**
64
- * A field of an entity as SQL, read off `refs(Entity)` or a definition's refs: interpolated into `raw`, it
64
+ * A field of an entity as SQL, read off `refs(Entity)` or a definition's refs: interpolated into `sql`, it
65
65
  * renders as the field's column. Its `key` is how an index tells a column from an expression, and `V`,
66
- * the field's type, is what a value slot checks it against: see {@link RawFor}.
66
+ * the field's type, is what a value slot checks it against: see {@link SqlFor}.
67
67
  */
68
- export declare class ColumnRef<K extends string = string, V = unknown> extends QueryRaw {
68
+ export declare class ColumnRef<K extends string = string, V = unknown> extends QuerySql {
69
69
  readonly key: K;
70
- readonly [RAW_VALUE_TYPE]?: V;
71
- constructor(key: K, value: QueryRawFn);
70
+ readonly [SQL_VALUE_TYPE]?: V;
71
+ constructor(key: K, value: QuerySqlFn);
72
72
  }
73
73
  /**
74
74
  * SQL where a value of type `V` goes: bare SQL, whose type is its author's to know, or a ref to a column
75
- * holding one, nullability aside. `Raw` is what the transport carries, so the wire's `never` stays one.
75
+ * holding one, nullability aside. `Sql` is what the transport carries, so the wire's `never` stays one.
76
76
  */
77
- export type RawFor<Raw, V> = Raw & {
78
- readonly [RAW_VALUE_TYPE]?: V | null;
77
+ export type SqlFor<Sql, V> = Sql & {
78
+ readonly [SQL_VALUE_TYPE]?: V | null;
79
79
  };
80
80
  /**
81
81
  * A relation aggregate as SQL, read off a `computed` field's refs: `(user) => user.resources.count()`.
@@ -85,18 +85,18 @@ export type RawFor<Raw, V> = Raw & {
85
85
  * `V` is the value it reads, carried in a phantom field so the aggregate a field declares decides the
86
86
  * property's type.
87
87
  */
88
- export declare class RelationAggregate<V = unknown> extends QueryRaw {
88
+ export declare class RelationAggregate<V = unknown> extends QuerySql {
89
89
  /** What it reads, kept beside the SQL so a read decodes the value the way the target's field does. */
90
90
  readonly spec: RelationAggregateSpec;
91
- readonly [RAW_VALUE_TYPE]?: V;
91
+ readonly [SQL_VALUE_TYPE]?: V;
92
92
  constructor(
93
93
  /** What it reads, kept beside the SQL so a read decodes the value the way the target's field does. */
94
- spec: RelationAggregateSpec, value: QueryRawFn);
94
+ spec: RelationAggregateSpec, value: QuerySqlFn);
95
95
  }
96
96
  /**
97
- * A write `insertInto`, `updateTable` or `deleteFrom` renders, or several joined in one `raw`. It reads a
98
- * set-based trigger's rows through {@link QueryRawRenderOptions.rows}, which is how `of` and `where` narrow
97
+ * A write `insertInto`, `updateTable` or `deleteFrom` renders, or several joined in one `sql`. It reads a
98
+ * set-based trigger's rows through {@link QuerySqlRenderOptions.rows}, which is how `of` and `where` narrow
99
99
  * them there; SQL of its own reads `inserted` and `deleted` whole.
100
100
  */
101
- export declare class TriggerWriteRaw extends QueryRaw {
101
+ export declare class TriggerWriteSql extends QuerySql {
102
102
  }
@@ -1,40 +1,40 @@
1
- export const RAW_VALUE = Symbol('rawValue');
1
+ export const SQL_FN = Symbol('sqlFn');
2
2
  export const RAW_ALIAS = Symbol('rawAlias');
3
- export const RAW_TEXT = Symbol('rawText');
3
+ export const SQL_TEXT = Symbol('sqlText');
4
4
  /** Keys the phantom a ref or an aggregate carries its value type in, which no value ever fills. */
5
- export const RAW_VALUE_TYPE = Symbol('rawValueType');
6
- export class QueryRaw {
7
- [RAW_VALUE];
5
+ export const SQL_VALUE_TYPE = Symbol('sqlValueType');
6
+ export class QuerySql {
7
+ [SQL_FN];
8
8
  [RAW_ALIAS];
9
9
  /**
10
10
  * The SQL verbatim, set only where it is a constant: a template that interpolates nothing binds no
11
11
  * value and reads no column, so it needs no dialect to render. What a DDL clause with nowhere to
12
12
  * bind reads - see {@link constantSql}.
13
13
  */
14
- [RAW_TEXT];
14
+ [SQL_TEXT];
15
15
  constructor(value, { alias, text } = {}) {
16
- this[RAW_VALUE] = value;
16
+ this[SQL_FN] = value;
17
17
  this[RAW_ALIAS] = alias;
18
- this[RAW_TEXT] = text;
18
+ this[SQL_TEXT] = text;
19
19
  }
20
20
  /** The same expression under an alias, for a `$select` projection. */
21
21
  as(alias) {
22
- return new QueryRaw(this[RAW_VALUE], { alias, text: this[RAW_TEXT] });
22
+ return new QuerySql(this[SQL_FN], { alias, text: this[SQL_TEXT] });
23
23
  }
24
24
  /** Writes the expression into `opts.ctx`. The alias is the projection's to write, after the term. */
25
25
  render(opts) {
26
- const emitted = this[RAW_VALUE](opts);
26
+ const emitted = this[SQL_FN](opts);
27
27
  if (typeof emitted === 'string' || (typeof emitted === 'number' && !Number.isNaN(emitted))) {
28
28
  opts.ctx.append(String(emitted));
29
29
  }
30
30
  }
31
31
  }
32
32
  /**
33
- * A field of an entity as SQL, read off `refs(Entity)` or a definition's refs: interpolated into `raw`, it
33
+ * A field of an entity as SQL, read off `refs(Entity)` or a definition's refs: interpolated into `sql`, it
34
34
  * renders as the field's column. Its `key` is how an index tells a column from an expression, and `V`,
35
- * the field's type, is what a value slot checks it against: see {@link RawFor}.
35
+ * the field's type, is what a value slot checks it against: see {@link SqlFor}.
36
36
  */
37
- export class ColumnRef extends QueryRaw {
37
+ export class ColumnRef extends QuerySql {
38
38
  key;
39
39
  constructor(key, value) {
40
40
  super(value);
@@ -49,7 +49,7 @@ export class ColumnRef extends QueryRaw {
49
49
  * `V` is the value it reads, carried in a phantom field so the aggregate a field declares decides the
50
50
  * property's type.
51
51
  */
52
- export class RelationAggregate extends QueryRaw {
52
+ export class RelationAggregate extends QuerySql {
53
53
  spec;
54
54
  constructor(
55
55
  /** What it reads, kept beside the SQL so a read decodes the value the way the target's field does. */
@@ -59,9 +59,9 @@ export class RelationAggregate extends QueryRaw {
59
59
  }
60
60
  }
61
61
  /**
62
- * A write `insertInto`, `updateTable` or `deleteFrom` renders, or several joined in one `raw`. It reads a
63
- * set-based trigger's rows through {@link QueryRawRenderOptions.rows}, which is how `of` and `where` narrow
62
+ * A write `insertInto`, `updateTable` or `deleteFrom` renders, or several joined in one `sql`. It reads a
63
+ * set-based trigger's rows through {@link QuerySqlRenderOptions.rows}, which is how `of` and `where` narrow
64
64
  * them there; SQL of its own reads `inserted` and `deleted` whole.
65
65
  */
66
- export class TriggerWriteRaw extends QueryRaw {
66
+ export class TriggerWriteSql extends QuerySql {
67
67
  }
@@ -1,6 +1,6 @@
1
1
  import type { FieldKey, FieldKeyOf, JsonFieldPaths, JsonFieldPathValue, RelationKey, RelationTarget } from './entity.js';
2
2
  import type { QuerySelect } from './query.js';
3
- import type { QueryRaw, RawFor } from './queryRaw.js';
3
+ import type { QuerySql, SqlFor } from './querySql.js';
4
4
  import type { AtLeastOne, ExpandScalar, IsMany, QueryComparableScalar, Scalar } from './utility.js';
5
5
  import type { QueryVectorQuery } from './vector.js';
6
6
  /**
@@ -27,10 +27,10 @@ export type QueryTextSearchOptions<E> = {
27
27
  * entity's keys so each stays linked for rename. An object and nothing else, so a wrong value is
28
28
  * reported on its key: ids go through `{ id: 1 }` or the by-id methods.
29
29
  */
30
- export type QueryWhere<E, Raw = QueryRaw, K extends keyof E = FieldKey<E> | RelationKey<E>> = QueryWhereRootOperator<E, Raw> & {
31
- [P in K]?: P extends FieldKey<E> ? QueryWhereFieldValue<E[P], Raw> : QueryWhereRelation<RelationTarget<E[P]>, Raw>;
30
+ export type QueryWhere<E, Sql = QuerySql, K extends keyof E = FieldKey<E> | RelationKey<E>> = QueryWhereRootOperator<E, Sql> & {
31
+ [P in K]?: P extends FieldKey<E> ? QueryWhereFieldValue<E[P], Sql> : QueryWhereRelation<RelationTarget<E[P]>, Sql>;
32
32
  } & ([JsonFieldPaths<E>] extends [never] ? unknown : {
33
- [P in JsonFieldPaths<E>]?: QueryWhereFieldValue<JsonFieldPathValue<E, P>, Raw>;
33
+ [P in JsonFieldPaths<E>]?: QueryWhereFieldValue<JsonFieldPathValue<E, P>, Sql>;
34
34
  });
35
35
  /**
36
36
  * Filter a to-many relation by its row count, and by nothing beside it: the target's keys and the root
@@ -47,27 +47,27 @@ export type QueryRelationSizeFilter<T = object> = {
47
47
  * A relation key's filter: a where over the target's rows, or its row count, never both. A target keyed
48
48
  * by an index signature declares no keys to refuse, so there the run-time check alone answers a mix.
49
49
  */
50
- export type QueryWhereRelation<T, Raw = QueryRaw> = string extends keyof T ? QueryWhere<T, Raw> | QueryRelationSizeFilter : (QueryWhere<T, Raw> & {
50
+ export type QueryWhereRelation<T, Sql = QuerySql> = string extends keyof T ? QueryWhere<T, Sql> | QueryRelationSizeFilter : (QueryWhere<T, Sql> & {
51
51
  readonly $size?: never;
52
52
  }) | QueryRelationSizeFilter<T>;
53
- export type QueryWhereRootOperator<E, Raw = QueryRaw> = {
53
+ export type QueryWhereRootOperator<E, Sql = QuerySql> = {
54
54
  /**
55
55
  * joins query clauses with a logical `AND`, returns records that match all the clauses.
56
56
  */
57
- $and?: QueryWhereArray<E, Raw>;
57
+ $and?: QueryWhereArray<E, Sql>;
58
58
  /**
59
59
  * joins query clauses with a logical `OR`, returns records that match any of the clauses.
60
60
  */
61
- $or?: QueryWhereArray<E, Raw>;
61
+ $or?: QueryWhereArray<E, Sql>;
62
62
  /**
63
63
  * joins query clauses with a logical `AND`, returns records that do not match all the clauses.
64
64
  * @see {@link QueryWhereFieldOperatorMap.$not} for per-field negation.
65
65
  */
66
- $not?: QueryWhereArray<E, Raw>;
66
+ $not?: QueryWhereArray<E, Sql>;
67
67
  /**
68
68
  * joins query clauses with a logical `OR`, returns records that do not match any of the clauses.
69
69
  */
70
- $nor?: QueryWhereArray<E, Raw>;
70
+ $nor?: QueryWhereArray<E, Sql>;
71
71
  /**
72
72
  * whether the specified fields match against a full-text search of the given string.
73
73
  */
@@ -75,11 +75,11 @@ export type QueryWhereRootOperator<E, Raw = QueryRaw> = {
75
75
  /**
76
76
  * whether the record exists in the given sub-query.
77
77
  */
78
- $exists?: Raw;
78
+ $exists?: Sql;
79
79
  /**
80
80
  * whether the record does not exists in the given sub-query.
81
81
  */
82
- $nexists?: Raw;
82
+ $nexists?: Sql;
83
83
  };
84
84
  /**
85
85
  * Per-field negation operators. `Pick`'s constraint ties this back to
@@ -112,7 +112,7 @@ export type QuerySizeComparisonOps = {
112
112
  export type QueryVectorNear = QueryVectorQuery & AtLeastOne<{
113
113
  [K in QueryOrderedOp]: NonNullable<QueryWhereFieldOperatorMap<number>[K]>;
114
114
  }>;
115
- export type QueryWhereFieldOperatorMap<T, Raw = QueryRaw> = {
115
+ export type QueryWhereFieldOperatorMap<T, Sql = QuerySql> = {
116
116
  /**
117
117
  * whether a value is equal to the given value.
118
118
  */
@@ -125,7 +125,7 @@ export type QueryWhereFieldOperatorMap<T, Raw = QueryRaw> = {
125
125
  * negates the given comparison for a single field.
126
126
  * @see {@link QueryWhereRootOperator.$not} for root-level clause negation.
127
127
  */
128
- $not?: QueryWhereFieldValue<T, Raw>;
128
+ $not?: QueryWhereFieldValue<T, Sql>;
129
129
  /**
130
130
  * whether a value is less than the given value.
131
131
  */
@@ -216,7 +216,7 @@ export type QueryWhereFieldOperatorMap<T, Raw = QueryRaw> = {
216
216
  * @example { addresses: { $elemMatch: { city: 'NYC', zip: '10001' } } }
217
217
  * @example { addresses: { $elemMatch: { city: { $like: 'New%' } } } }
218
218
  */
219
- $elemMatch?: unknown extends T ? QueryWhereElemMatch<unknown, Raw> : NonNullable<T> extends readonly (infer U)[] ? QueryWhereElemMatch<U, Raw> : never;
219
+ $elemMatch?: unknown extends T ? QueryWhereElemMatch<unknown, Sql> : NonNullable<T> extends readonly (infer U)[] ? QueryWhereElemMatch<U, Sql> : never;
220
220
  /**
221
221
  * whether a vector is within a given distance of the query vector. `$sort` ranks by distance;
222
222
  * this filters by it, so "the closest ten" and "everything closer than 0.35" are separate asks.
@@ -230,10 +230,10 @@ export type QueryWhereFieldOperatorMap<T, Raw = QueryRaw> = {
230
230
  * field comparison. An untyped element (`unknown`) accepts any keys but still requires the
231
231
  * object-of-conditions shape (a bare scalar is rejected).
232
232
  */
233
- export type QueryWhereElemMatch<U, Raw = QueryRaw> = unknown extends U ? {
234
- [key: string]: QueryWhereFieldValue<unknown, Raw> | undefined;
235
- } : NonNullable<U> extends Scalar ? QueryWhereFieldOperators<NonNullable<U>, Raw> : {
236
- [K in keyof NonNullable<U>]?: QueryWhereFieldValue<NonNullable<U>[K], Raw>;
233
+ export type QueryWhereElemMatch<U, Sql = QuerySql> = unknown extends U ? {
234
+ [key: string]: QueryWhereFieldValue<unknown, Sql> | undefined;
235
+ } : NonNullable<U> extends Scalar ? QueryWhereFieldOperators<NonNullable<U>, Sql> : {
236
+ [K in keyof NonNullable<U>]?: QueryWhereFieldValue<NonNullable<U>[K], Sql>;
237
237
  };
238
238
  /** Every operator a field condition takes, which is what a key of one is once checked. */
239
239
  export type QueryWhereFieldOp = keyof QueryWhereFieldOperatorMap<unknown>;
@@ -285,7 +285,7 @@ type QueryAllowedOp<T> = QueryCommonOp | ([NonNullable<T>] extends [QueryCompara
285
285
  * The operators a field of type `T` takes. `unknown`, and a column typed as every scalar at once (a
286
286
  * runtime-defined entity), take all of them, since nothing narrows what they hold.
287
287
  */
288
- export type QueryWhereFieldOperators<T, Raw = QueryRaw> = unknown extends T ? QueryWhereFieldOperatorMap<T, Raw> : IsUntypedColumn<T> extends true ? QueryWhereFieldOperatorMap<T, Raw> : Pick<QueryWhereFieldOperatorMap<T, Raw>, QueryAllowedOp<T>>;
288
+ export type QueryWhereFieldOperators<T, Sql = QuerySql> = unknown extends T ? QueryWhereFieldOperatorMap<T, Sql> : IsUntypedColumn<T> extends true ? QueryWhereFieldOperatorMap<T, Sql> : Pick<QueryWhereFieldOperatorMap<T, Sql>, QueryAllowedOp<T>>;
289
289
  /**
290
290
  * Whether a column admits every scalar at once, which is what an entity keyed by an index signature
291
291
  * says about all of its columns. `Scalar` is the yardstick rather than a parameter: the question is
@@ -296,9 +296,9 @@ type IsUntypedColumn<T> = [Scalar] extends [NonNullable<T>] ? true : false;
296
296
  * A field's filter value: the value, `null` where it is optional, a list as an implicit `$in` (not on
297
297
  * an array field, where it would be ambiguous), or an operator map.
298
298
  */
299
- export type QueryWhereFieldValue<T, Raw = QueryRaw> = T | (undefined extends T ? null : never) | (IsMany<T> extends true ? never : readonly T[]) | QueryWhereFieldOperators<T, Raw> | RawFor<Raw, T>;
299
+ export type QueryWhereFieldValue<T, Sql = QuerySql> = T | (undefined extends T ? null : never) | (IsMany<T> extends true ? never : readonly T[]) | QueryWhereFieldOperators<T, Sql> | SqlFor<Sql, T>;
300
300
  /**
301
301
  * query filter array - the value every {@link QueryGroupOp} takes.
302
302
  */
303
- export type QueryWhereArray<E, Raw = QueryRaw> = readonly (QueryWhere<E, Raw> | Raw)[];
303
+ export type QueryWhereArray<E, Sql = QuerySql> = readonly (QueryWhere<E, Sql> | Sql)[];
304
304
  export {};
@@ -2,12 +2,12 @@ import type { EntityId, EntityWrite, FieldKey, RelationKey, UpdateWrite, Written
2
2
  import type { CursorPage, QueryConflictPaths, QueryFilter, QueryFindResult, QueryKeysetProjected, QueryOneProjected, QueryOptions, QueryPage, QueryProjected, QuerySearch, ReturningResult, WriteOptions } from './query.js';
3
3
  import type { QueryAggMap, QueryAggregate, QueryAggregateResult, QueryGroupMap } from './queryAggregate.js';
4
4
  import type { BooleanLike, Type } from './utility.js';
5
- import type { QuerierCountedResult, QuerierRaw, QuerierResult, QuerierTransport } from './wire.js';
5
+ import type { QuerierCountedResult, QuerierSql, QuerierResult, QuerierTransport } from './wire.js';
6
6
  /** The query type each projected read takes, keyed by the kind of read. */
7
- export type ProjectedQuery<E, S extends FieldKey<E>, V, X extends FieldKey<E>, P extends RelationKey<E>, C extends RelationKey<E>, Raw> = {
8
- readonly one: QueryOneProjected<E, S, V, X, P, C, Raw>;
9
- readonly many: QueryProjected<E, S, V, X, P, C, Raw>;
10
- readonly page: QueryKeysetProjected<E, S, V, X, P, C, Raw>;
7
+ export type ProjectedQuery<E, S extends FieldKey<E>, V, X extends FieldKey<E>, P extends RelationKey<E>, C extends RelationKey<E>, Sql> = {
8
+ readonly one: QueryOneProjected<E, S, V, X, P, C, Sql>;
9
+ readonly many: QueryProjected<E, S, V, X, P, C, Sql>;
10
+ readonly page: QueryKeysetProjected<E, S, V, X, P, C, Sql>;
11
11
  };
12
12
  /** The result type of each projected read on transport `W`, keyed by the kind of read. */
13
13
  export type ProjectedResult<W extends QuerierTransport, T> = {
@@ -22,14 +22,14 @@ export type ProjectedResult<W extends QuerierTransport, T> = {
22
22
  * the query type, `R` the result type on transport `W`, and `O` the options. Declaring it once saves every
23
23
  * such read from repeating the six type parameters.
24
24
  */
25
- export type ProjectedRead<Q extends keyof ProjectedQuery<object, never, never, never, never, never, never>, R extends keyof ProjectedResult<QuerierTransport, unknown>, W extends QuerierTransport, O> = <E extends object, const S extends FieldKey<E> = never, const V = true, const X extends FieldKey<E> = never, const P extends RelationKey<E> = never, const C extends RelationKey<E> = never>(entity: Type<E>, q: ProjectedQuery<E, S, V, X, P, C, QuerierRaw<W>>[Q], opts?: O) => ProjectedResult<W, QueryFindResult<E, S, V, X, P, C>>[R];
25
+ export type ProjectedRead<Q extends keyof ProjectedQuery<object, never, never, never, never, never, never>, R extends keyof ProjectedResult<QuerierTransport, unknown>, W extends QuerierTransport, O> = <E extends object, const S extends FieldKey<E> = never, const V = true, const X extends FieldKey<E> = never, const P extends RelationKey<E> = never, const C extends RelationKey<E> = never>(entity: Type<E>, q: ProjectedQuery<E, S, V, X, P, C, QuerierSql<W>>[Q], opts?: O) => ProjectedResult<W, QueryFindResult<E, S, V, X, P, C>>[R];
26
26
  /**
27
27
  * The operations the server and the browser client declare alike, per transport `W`, options `O`,
28
28
  * and delete options `DO`, which on the client also carry the {@link QueryOptions} it cannot pass otherwise.
29
29
  */
30
30
  export interface SharedQuerier<W extends QuerierTransport, O, DO = O> {
31
31
  /** Find the record with the given primary key. */
32
- findOneById<E extends object, const S extends FieldKey<E> = never, const V = true, const X extends FieldKey<E> = never, const P extends RelationKey<E> = never, const C extends RelationKey<E> = never>(entity: Type<E>, id: EntityId<E>, q?: QueryOneProjected<E, S, V, X, P, C, QuerierRaw<W>>, opts?: O): QuerierResult<W, QueryFindResult<E, S, V, X, P, C> | undefined>;
32
+ findOneById<E extends object, const S extends FieldKey<E> = never, const V = true, const X extends FieldKey<E> = never, const P extends RelationKey<E> = never, const C extends RelationKey<E> = never>(entity: Type<E>, id: EntityId<E>, q?: QueryOneProjected<E, S, V, X, P, C, QuerierSql<W>>, opts?: O): QuerierResult<W, QueryFindResult<E, S, V, X, P, C> | undefined>;
33
33
  /**
34
34
  * obtains the first record matching the given search parameters.
35
35
  * @param entity the target entity
@@ -53,13 +53,13 @@ export interface SharedQuerier<W extends QuerierTransport, O, DO = O> {
53
53
  */
54
54
  findManyPage: ProjectedRead<'page', 'page', W, O>;
55
55
  /** Count the records matching the filter, or those a page of them takes. */
56
- count<E extends object>(entity: Type<E>, q?: QueryPage<E, QuerierRaw<W>>, opts?: O): QuerierResult<W, number>;
56
+ count<E extends object>(entity: Type<E>, q?: QueryPage<E, QuerierSql<W>>, opts?: O): QuerierResult<W, number>;
57
57
  /** Whether any record matches: a count capped at one row, so the engine stops at the first match. */
58
- exists<E extends object>(entity: Type<E>, q?: QueryFilter<E, QuerierRaw<W>>, opts?: O): QuerierResult<W, boolean>;
58
+ exists<E extends object>(entity: Type<E>, q?: QueryFilter<E, QuerierSql<W>>, opts?: O): QuerierResult<W, boolean>;
59
59
  /** Update the record with the given primary key; resolves to the number of affected rows. */
60
- updateOneById<E extends object>(entity: Type<E>, id: EntityId<E>, payload: UpdateWrite<E, QuerierRaw<W>>, opts?: O): QuerierResult<W, number>;
60
+ updateOneById<E extends object>(entity: Type<E>, id: EntityId<E>, payload: UpdateWrite<E, QuerierSql<W>>, opts?: O): QuerierResult<W, number>;
61
61
  /** Update the records matching the query; resolves to the number of affected rows. */
62
- updateMany<E extends object>(entity: Type<E>, q: QuerySearch<E, QuerierRaw<W>>, payload: UpdateWrite<E, QuerierRaw<W>>, opts?: O): QuerierResult<W, number>;
62
+ updateMany<E extends object>(entity: Type<E>, q: QuerySearch<E, QuerierSql<W>>, payload: UpdateWrite<E, QuerierSql<W>>, opts?: O): QuerierResult<W, number>;
63
63
  /**
64
64
  * delete or SoftDelete a record.
65
65
  * @param entity the entity to persist on
@@ -73,7 +73,7 @@ export interface SharedQuerier<W extends QuerierTransport, O, DO = O> {
73
73
  * @param q the criteria to look for the records
74
74
  * @return the number of affected records
75
75
  */
76
- deleteMany<E extends object>(entity: Type<E>, q: QuerySearch<E, QuerierRaw<W>>, opts?: DO): QuerierResult<W, number>;
76
+ deleteMany<E extends object>(entity: Type<E>, q: QuerySearch<E, QuerierSql<W>>, opts?: DO): QuerierResult<W, number>;
77
77
  }
78
78
  /**
79
79
  * A `querier` allows to interact with the datasource to perform persistence operations on any entity.
@@ -1,4 +1,4 @@
1
- import type { QueryRaw } from './queryRaw.js';
1
+ import type { QuerySql } from './querySql.js';
2
2
  /**
3
3
  * The envelope a wire response wraps its result in.
4
4
  */
@@ -18,11 +18,11 @@ export type RequestCountedSuccessResponse<E> = RequestSuccessResponse<E> & {
18
18
  */
19
19
  export type QuerierTransport = 'server' | 'client';
20
20
  /**
21
- * The `raw` SQL a transport carries. A client's query and payload travel as JSON, which a `raw` fragment
21
+ * The `sql` SQL a transport carries. A client's query and payload travel as JSON, which a `sql` fragment
22
22
  * is not: it would arrive as `{}`, so the client's types refuse one rather than let it leave.
23
23
  */
24
- export type QuerierRaw<W extends QuerierTransport> = {
25
- server: QueryRaw;
24
+ export type QuerierSql<W extends QuerierTransport> = {
25
+ server: QuerySql;
26
26
  client: never;
27
27
  }[W];
28
28
  /**
@@ -1,8 +1,8 @@
1
1
  import type { CheckSchema, EnumValues } from '../schema/types.js';
2
- import { type EntityIndexColumn, type EntityIndexMeta, type EntityMeta, type IndexColumnInput, type IndexColumnSchema, QueryRaw } from '../type/index.js';
2
+ import { type EntityIndexColumn, type EntityIndexMeta, type EntityMeta, type IndexColumnInput, type IndexColumnSchema, QuerySql } from '../type/index.js';
3
3
  /**
4
4
  * Reduces an authored index entry to the form metadata keeps, so a column, an expression and an options
5
- * object reach the schema as one: a column read off the refs as its key, any other `raw` as it is.
5
+ * object reach the schema as one: a column read off the refs as its key, any other `sql` as it is.
6
6
  */
7
7
  export declare function normalizeIndexColumn(entry: IndexColumnInput): EntityIndexColumn;
8
8
  /**
@@ -12,7 +12,7 @@ export declare function normalizeIndexColumn(entry: IndexColumnInput): EntityInd
12
12
  */
13
13
  export declare function declaredIndexes<E>(meta: EntityMeta<E>): EntityIndexMeta<E>[];
14
14
  /** An index entry as the schema holds it, its expression rendered to text by `render`. */
15
- export declare function renderIndexColumn(entry: EntityIndexColumn, render: (sql: QueryRaw) => string): IndexColumnSchema;
15
+ export declare function renderIndexColumn(entry: EntityIndexColumn, render: (statement: QuerySql) => string): IndexColumnSchema;
16
16
  /** What an unnamed index's name is built from: each entry's column, or `expr<n>` for an expression, which has none. */
17
17
  export declare function indexNameParts(entries: readonly EntityIndexColumn[]): string[];
18
18
  /** The name an index is created and read by: its own, else one derived from its table, entries' columns and uniqueness. */
@@ -26,4 +26,4 @@ export declare function ownedCheck(table: string, label: string | undefined, exp
26
26
  export declare function enumCheck(table: string, { name, enum: values }: {
27
27
  readonly name: string;
28
28
  readonly enum?: EnumValues;
29
- }, render: (sql: QueryRaw) => string): CheckSchema[];
29
+ }, render: (statement: QuerySql) => string): CheckSchema[];
@@ -1,13 +1,13 @@
1
- import { ColumnRef, QueryRaw, } from '../type/index.js';
1
+ import { ColumnRef, QuerySql, } from '../type/index.js';
2
2
  import { definedEntries } from './object.util.js';
3
- import { raw } from './raw.js';
3
+ import { sql } from './sql.js';
4
4
  import { derivedIndexName, ownedName } from './sql.util.js';
5
5
  /**
6
6
  * Reduces an authored index entry to the form metadata keeps, so a column, an expression and an options
7
- * object reach the schema as one: a column read off the refs as its key, any other `raw` as it is.
7
+ * object reach the schema as one: a column read off the refs as its key, any other `sql` as it is.
8
8
  */
9
9
  export function normalizeIndexColumn(entry) {
10
- const { column, ...modifiers } = typeof entry === 'string' || entry instanceof QueryRaw ? { column: entry } : entry;
10
+ const { column, ...modifiers } = typeof entry === 'string' || entry instanceof QuerySql ? { column: entry } : entry;
11
11
  return { ...modifiers, column: column instanceof ColumnRef ? column.key : column };
12
12
  }
13
13
  /**
@@ -30,7 +30,7 @@ export function declaredIndexes(meta) {
30
30
  /** An index entry as the schema holds it, its expression rendered to text by `render`. */
31
31
  export function renderIndexColumn(entry, render) {
32
32
  const { column } = entry;
33
- return column instanceof QueryRaw ? { ...entry, column: render(column), expression: true } : { ...entry, column };
33
+ return column instanceof QuerySql ? { ...entry, column: render(column), expression: true } : { ...entry, column };
34
34
  }
35
35
  /** What an unnamed index's name is built from: each entry's column, or `expr<n>` for an expression, which has none. */
36
36
  export function indexNameParts(entries) {
@@ -52,7 +52,7 @@ export function enumCheck(table, { name, enum: values }, render) {
52
52
  if (!values) {
53
53
  return [];
54
54
  }
55
- const sql = raw(({ ctx, dialect }) => {
55
+ const statement = sql(({ ctx, dialect }) => {
56
56
  ctx.append(`${dialect.escapeId(name)} IN (`);
57
57
  values.forEach((value, i) => {
58
58
  ctx.append(i ? ', ' : '');
@@ -60,5 +60,5 @@ export function enumCheck(table, { name, enum: values }, render) {
60
60
  });
61
61
  ctx.append(')');
62
62
  });
63
- return [ownedCheck(table, name, render(sql))];
63
+ return [ownedCheck(table, name, render(statement))];
64
64
  }
@@ -1,5 +1,5 @@
1
1
  import type { IndexType } from '../schema/types.js';
2
- import { type AggregateCall, type CascadeType, type EntityData, type EntityIndexMeta, type EntityMeta, type FieldKey, type FieldOptions, type FieldUpdateOp, type JsonUpdateOp, type OnFieldCallback, type QueryAggMap, type QueryExclude, type QueryGroupMap, type QueryOptions, QueryRaw, type QuerySearch, type QuerySelect, type QuerySelectValue, type QuerySortDirection, type QuerySizeComparisonOps, type QuerySortMap, type QueryTextSearchOptions, type QueryVectorQuery, type QueryVectorSearch, type QueryWhere, type RelationKey, type UpdatePayload, type VectorDistance } from '../type/index.js';
2
+ import { type AggregateCall, type CascadeType, type EntityData, type EntityIndexMeta, type EntityMeta, type FieldKey, type FieldOptions, type FieldUpdateOp, type JsonUpdateOp, type OnFieldCallback, type QueryAggMap, type QueryExclude, type QueryGroupMap, type QueryOptions, QuerySql, type QuerySearch, type QuerySelect, type QuerySelectValue, type QuerySortDirection, type QuerySizeComparisonOps, type QuerySortMap, type QueryTextSearchOptions, type QueryVectorQuery, type QueryVectorSearch, type QueryWhere, type RelationKey, type UpdatePayload, type VectorDistance } from '../type/index.js';
3
3
  export type CallbackKey = keyof Pick<FieldOptions, 'onInsert' | 'onUpdate'>;
4
4
  /** The keys of `payload` a write persists as columns. */
5
5
  export declare function filterFieldKeys<E>(meta: EntityMeta<E>, payload: EntityData<E> | UpdatePayload<E>, callbackKey: CallbackKey): FieldKey<E>[];
@@ -14,12 +14,12 @@ export declare function insertShapeOf<E>(meta: EntityMeta<E>, record: EntityData
14
14
  * whether or not it was filled yet. A record missing one writes its default.
15
15
  */
16
16
  export declare function getInsertFieldKeys<E>(meta: EntityMeta<E>, payloads: EntityData<E>[]): FieldKey<E>[];
17
- export declare function getFieldCallbackValue(val: OnFieldCallback): string | number | bigint | boolean | Date | import("../type/utility.js").JsonBrand | QueryRaw | readonly number[] | readonly import("../type/utility.js").JsonBrand[] | Uint8Array<ArrayBufferLike>;
17
+ export declare function getFieldCallbackValue(val: OnFieldCallback): string | number | bigint | boolean | Date | import("../type/utility.js").JsonBrand | QuerySql | readonly number[] | readonly import("../type/utility.js").JsonBrand[] | Uint8Array<ArrayBufferLike>;
18
18
  /**
19
19
  * Resolves the value stamped on the soft-delete field when deleting a row.
20
20
  * `true` stamps the current timestamp (`new Date()`); any other marker is an {@link OnFieldCallback}.
21
21
  */
22
- export declare function getSoftDeleteValue(field: FieldOptions): string | number | bigint | boolean | Date | import("../type/utility.js").JsonBrand | QueryRaw | readonly number[] | readonly import("../type/utility.js").JsonBrand[] | Uint8Array<ArrayBufferLike>;
22
+ export declare function getSoftDeleteValue(field: FieldOptions): string | number | bigint | boolean | Date | import("../type/utility.js").JsonBrand | QuerySql | readonly number[] | readonly import("../type/utility.js").JsonBrand[] | Uint8Array<ArrayBufferLike>;
23
23
  /** Fills each field `callbackKey` generates on `payload` in place, where the caller left it unset. */
24
24
  export declare function fillOnFields<E, R extends EntityData<E> | UpdatePayload<E>>(meta: EntityMeta<E>, payload: R | R[], callbackKey: CallbackKey): R[];
25
25
  /** The relations a write cascades `action` to, in declaration order. */
@@ -32,8 +32,8 @@ export declare function isCascadable(action: CascadeType, configuration?: boolea
32
32
  * neither clause on a write at all.
33
33
  */
34
34
  export declare function isPagedQuery<E>(q: QuerySearch<E>): boolean;
35
- /** Whether `select` is the list form `raw()` fills, narrowing both ways, which `Array.isArray` does not for a `readonly` array. */
36
- export declare function isSelectList<E>(select: QuerySelectValue<E> | undefined): select is readonly QueryRaw[];
35
+ /** Whether `select` is the list form `sql()` fills, narrowing both ways, which `Array.isArray` does not for a `readonly` array. */
36
+ export declare function isSelectList<E>(select: QuerySelectValue<E> | undefined): select is readonly QuerySql[];
37
37
  export declare function normalizeScalarFieldSelection<E>(meta: EntityMeta<E>, select?: QuerySelect<E>, exclude?: QueryExclude<E>): FieldKey<E>[];
38
38
  /** Type guard: checks whether a sort value is a vector similarity search. */
39
39
  export declare function isVectorSearch(value: unknown): value is QueryVectorSearch;
@@ -73,7 +73,7 @@ export declare function isFieldUpdateOp(value: unknown): value is FieldUpdateOp;
73
73
  * The one operator a scalar field's update carries, and its operand. Naming both throws rather than
74
74
  * reading one: their order would change the result, and an untyped payload is how both arrive.
75
75
  */
76
- export declare function fieldUpdateOf(key: string, value: FieldUpdateOp): [keyof FieldUpdateOp, number | bigint | QueryRaw];
76
+ export declare function fieldUpdateOf(key: string, value: FieldUpdateOp): [keyof FieldUpdateOp, number | bigint | QuerySql];
77
77
  /** Returns a `QueryOptions.filters` value with the built-in soft-delete filter disabled (used by hard delete). */
78
78
  export declare function withoutSoftDeleteFilter(filters: QueryOptions['filters']): QueryOptions['filters'];
79
79
  /**
@@ -125,7 +125,7 @@ export declare function parseSortByCount(val: unknown): unknown;
125
125
  export declare function parseGroupMap<E>(group?: QueryGroupMap<E>, select?: QueryAggMap<E>): ParsedGroupEntry<E>[];
126
126
  /**
127
127
  * Whether `value` is a map of comparison operators rather than a value to compare against. Only a
128
- * plain object qualifies: `Date`, `QueryRaw`, `Uint8Array` and arrays are all `typeof 'object'`, and
128
+ * plain object qualifies: `Date`, `QuerySql`, `Uint8Array` and arrays are all `typeof 'object'`, and
129
129
  * reading their keys as operators drops the condition (a `Date` has none) or throws on an array's
130
130
  * indices. Shared by the SQL and MongoDB builders, whose `$where` and `$having` all face this.
131
131
  */
@@ -1,5 +1,5 @@
1
1
  import { getContext } from '../context/context.js';
2
- import { QueryRaw, resolveAggregateOp, SOFT_DELETE_FILTER, } from '../type/index.js';
2
+ import { QuerySql, resolveAggregateOp, SOFT_DELETE_FILTER, } from '../type/index.js';
3
3
  import { DEFAULT_VECTOR_DISTANCE, VECTOR_INDEX_TYPES } from '../type/vector.js';
4
4
  import { defaultReadKeys, fieldKeys, isDatabaseWritten } from './field.util.js';
5
5
  import { entityName, getKeys, hasKeys, isOperatorObject, isRecord, someKey } from './object.util.js';
@@ -101,7 +101,7 @@ export function isCascadable(action, configuration) {
101
101
  export function isPagedQuery(q) {
102
102
  return q.$sort !== undefined || q.$limit !== undefined || q.$skip !== undefined;
103
103
  }
104
- /** Whether `select` is the list form `raw()` fills, narrowing both ways, which `Array.isArray` does not for a `readonly` array. */
104
+ /** Whether `select` is the list form `sql()` fills, narrowing both ways, which `Array.isArray` does not for a `readonly` array. */
105
105
  export function isSelectList(select) {
106
106
  return Array.isArray(select);
107
107
  }
@@ -399,7 +399,7 @@ function namedKeys(map) {
399
399
  }
400
400
  /**
401
401
  * Whether `value` is a map of comparison operators rather than a value to compare against. Only a
402
- * plain object qualifies: `Date`, `QueryRaw`, `Uint8Array` and arrays are all `typeof 'object'`, and
402
+ * plain object qualifies: `Date`, `QuerySql`, `Uint8Array` and arrays are all `typeof 'object'`, and
403
403
  * reading their keys as operators drops the condition (a `Date` has none) or throws on an array's
404
404
  * indices. Shared by the SQL and MongoDB builders, whose `$where` and `$having` all face this.
405
405
  */
@@ -409,7 +409,7 @@ export function isOperatorMap(value) {
409
409
  !Array.isArray(value) &&
410
410
  !(value instanceof Date) &&
411
411
  !(value instanceof Uint8Array) &&
412
- !(value instanceof QueryRaw));
412
+ !(value instanceof QuerySql));
413
413
  }
414
414
  /** A JSON object, matched by what it holds: a plain object with no operator key. */
415
415
  export function isJsonObject(value) {
@@ -1,4 +1,4 @@
1
- import { type ColumnFamily, type FamilyOf, type FieldOptions, QueryRaw, type StampEvent } from '../type/index.js';
1
+ import { type ColumnFamily, type FamilyOf, type FieldOptions, QuerySql, type StampEvent } from '../type/index.js';
2
2
  /**
3
3
  * The column families each field option means anything on, or `'*'` where it applies to every column.
4
4
  * Exhaustive over {@link FieldOptions}, so a new option cannot be added without placing it - the
@@ -76,14 +76,14 @@ type OptionsFamily<O> = O extends {
76
76
  type DeadOptions<O> = (O extends {
77
77
  readonly stored: true | readonly StampEvent[];
78
78
  } ? GeneratedWrite : O extends {
79
- readonly computed: QueryRaw;
79
+ readonly computed: QuerySql;
80
80
  } ? Exclude<keyof FieldOptions, InlineRead> : never) | (O extends {
81
81
  readonly isId: true;
82
82
  readonly nullable: true;
83
83
  } ? 'nullable' : never) | (O extends {
84
84
  readonly updatable: false;
85
85
  } ? 'onUpdate' : never) | (O extends {
86
- readonly columnType: QueryRaw;
86
+ readonly columnType: QuerySql;
87
87
  } ? TypeBound : never) | (O extends {
88
88
  readonly version: true;
89
89
  } ? VersionWrite : never) | (O extends {