@ultimat3/entity 1.1.0 → 2.0.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.
package/src/view.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  // already describe. Values are validated by the entity's own column parsers; an unknown key is a
4
4
  // declaration-time failure, not a surprise on the first request.
5
5
 
6
- import type { StandardSchemaV1 } from '@ultimat3/schema';
6
+ import { describeValue, type StandardSchemaV1 } from '@ultimat3/schema';
7
7
  import { invariantViolated } from './errors';
8
8
  import type { AnyColumn, ColumnMap } from './types';
9
9
 
@@ -50,7 +50,13 @@ export const viewFor = <Row, K extends keyof Row & string>(
50
50
 
51
51
  const parse = (value: unknown): Pick<Row, K> => {
52
52
  if (typeof value !== 'object' || value === null) {
53
- throw invariantViolated(entityName, 'view', `expected an object, got ${String(value)}`);
53
+ // Shape, never content — the same renderer `columns.ts` uses, for the same reason: a
54
+ // view issue is folded into `X_BODY_INVALID` and reaches the caller and the log line.
55
+ throw invariantViolated(
56
+ entityName,
57
+ 'view',
58
+ `expected an object, got ${describeValue(value)}`,
59
+ );
54
60
  }
55
61
  const input = value as Readonly<Record<string, unknown>>;
56
62
  const projected = {} as Record<K, unknown>;