uql-orm 0.47.1 → 0.48.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.
@@ -1,6 +1,13 @@
1
1
  import { type CascadeType, type EntityData, type EntityIndexMeta, type EntityMeta, type FieldKey, type FieldOptions, type JsonUpdateOp, type OnFieldCallback, type Query, type QueryAggMap, type QueryAggregateOp, type QueryExclude, type QueryGroupMap, type QueryOptions, QueryRaw, type QuerySearch, type QuerySelect, type QuerySelectValue, type QuerySizeComparisonOps, type QuerySortMap, type QueryVectorSearch, type QueryWhere, type QueryWhereMap, type RelationKey } from '../type/index.js';
2
2
  export type CallbackKey = keyof Pick<FieldOptions, 'onInsert' | 'onUpdate'>;
3
3
  export declare function filterFieldKeys<E>(meta: EntityMeta<E>, payload: EntityData<E>, callbackKey: CallbackKey): FieldKey<E>[];
4
+ /** Appends `record`'s not-yet-`seen` insertable keys (real, caller-written, defined value) to `keys`. */
5
+ /**
6
+ * The insertable keys `record` itself carries, as a string, for grouping rows by the statement they
7
+ * can share. Only the row's own keys: the `onInsert` columns {@link getInsertFieldKeys} appends are a
8
+ * property of the entity, identical for every row, so they cannot tell two rows apart.
9
+ */
10
+ export declare function insertShapeOf<E>(meta: EntityMeta<E>, record: EntityData<E>): string;
4
11
  /**
5
12
  * Resolves the columns of an INSERT statement: the union of the persistable fields provided by
6
13
  * any record (in first-seen order), plus every `onInsert` field. Records missing one of these
@@ -16,6 +16,20 @@ function isInsertableField(meta, record, key) {
16
16
  return !!field && !isDatabaseWritten(field) && record[key] !== undefined;
17
17
  }
18
18
  /** Appends `record`'s not-yet-`seen` insertable keys (real, caller-written, defined value) to `keys`. */
19
+ /**
20
+ * The insertable keys `record` itself carries, as a string, for grouping rows by the statement they
21
+ * can share. Only the row's own keys: the `onInsert` columns {@link getInsertFieldKeys} appends are a
22
+ * property of the entity, identical for every row, so they cannot tell two rows apart.
23
+ */
24
+ export function insertShapeOf(meta, record) {
25
+ let shape = '';
26
+ for (const key of getKeys(record)) {
27
+ if (isInsertableField(meta, record, key)) {
28
+ shape += `${key},`;
29
+ }
30
+ }
31
+ return shape;
32
+ }
19
33
  function addInsertFieldKeys(meta, record, seen, keys) {
20
34
  for (const key of getKeys(record)) {
21
35
  if (!seen.has(key) && isInsertableField(meta, record, key)) {
@@ -34,7 +34,7 @@ declare const FIELD_OPTION_FAMILY: {
34
34
  readonly comment: '*';
35
35
  };
36
36
  /**
37
- * The only options a `virtual` field reaches: it is skipped in DDL and dropped from every insert and
37
+ * The only options an inlined computed field reaches: it is skipped in DDL and dropped from every insert and
38
38
  * update, so the whole persistence half of the options above is dead on one. Stated as what survives
39
39
  * rather than on each option that dies, because it is one fact rather than nineteen - and because an
40
40
  * option added without a thought then lands on the safe side of it.
@@ -34,7 +34,7 @@ const FIELD_OPTION_FAMILY = {
34
34
  comment: '*',
35
35
  };
36
36
  /**
37
- * The only options a `virtual` field reaches: it is skipped in DDL and dropped from every insert and
37
+ * The only options an inlined computed field reaches: it is skipped in DDL and dropped from every insert and
38
38
  * update, so the whole persistence half of the options above is dead on one. Stated as what survives
39
39
  * rather than on each option that dies, because it is one fact rather than nineteen - and because an
40
40
  * option added without a thought then lands on the safe side of it.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "homepage": "https://uql-orm.dev",
4
4
  "description": "The JSON-native TypeScript ORM for Bun, Browsers, Edge, Deno, Node, Workers. Supports PostgreSQL, PGlite, MySQL, MariaDB, SQLite, CockroachDB, Turso, Neon, Cloudflare D1 and MongoDB. Queries are plain JSON, typed to the leaf.",
5
5
  "license": "MIT",
6
- "version": "0.47.1",
6
+ "version": "0.48.0",
7
7
  "type": "module",
8
8
  "engines": {
9
9
  "node": ">=24"