nucleus-core-ts 0.9.795 → 0.9.797

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,4 +1,6 @@
1
1
  import type { RunIssueValue } from '../types';
2
+ /** `name: ÜRETİM PLANLAMA, slug: TAT-110` — the mapped values, in column order. */
3
+ export declare function describeRow(row: Record<string, unknown>): string;
2
4
  export type RunPlanIssuesProps = {
3
5
  issues: RunIssueValue[];
4
6
  };
@@ -9,6 +9,14 @@ import { integrationsPageTheme } from '../theme';
9
9
  * open because the source index is the only way back to the offending record.
10
10
  * Messages wrap rather than truncate — a clipped reason is a reason nobody acts on.
11
11
  */ const theme = integrationsPageTheme;
12
+ /** Long enough to compare two rows at a glance, short enough to stay one line. */ const MAX_VALUE_LENGTH = 60;
13
+ /** `name: ÜRETİM PLANLAMA, slug: TAT-110` — the mapped values, in column order. */ export function describeRow(row) {
14
+ return Object.entries(row).map(([column, value])=>{
15
+ const text = value == null ? '—' : String(value);
16
+ const shown = text.length > MAX_VALUE_LENGTH ? `${text.slice(0, MAX_VALUE_LENGTH - 1)}…` : text;
17
+ return `${column}: ${shown}`;
18
+ }).join(', ');
19
+ }
12
20
  export function RunPlanIssues({ issues }) {
13
21
  if (issues.length === 0) return null;
14
22
  return /*#__PURE__*/ _jsxs("details", {
@@ -34,6 +42,14 @@ export function RunPlanIssues({ issues }) {
34
42
  issue.dedupKey ? /*#__PURE__*/ _jsx("span", {
35
43
  className: theme.field.hint,
36
44
  children: `Dedup key: ${issue.dedupKey}`
45
+ }) : null,
46
+ issue.keptRow ? /*#__PURE__*/ _jsx("span", {
47
+ className: theme.field.hint,
48
+ children: `Kept — ${describeRow(issue.keptRow)}`
49
+ }) : null,
50
+ issue.row ? /*#__PURE__*/ _jsx("span", {
51
+ className: theme.field.hint,
52
+ children: issue.keptRow ? `Skipped — ${describeRow(issue.row)}` : describeRow(issue.row)
37
53
  }) : null
38
54
  ]
39
55
  }, `${issue.sourceIndex}-${issue.kind}-${index}`))
@@ -0,0 +1,44 @@
1
+ import { describe, expect, test } from 'bun:test';
2
+ import { describeRow } from './RunPlanIssues';
3
+ /**
4
+ * A preview that names the key which collided but not the values behind it
5
+ * cannot answer the only question worth asking: is this the same record listed
6
+ * twice, or two records the key cannot tell apart? The first is a skip; the
7
+ * second means the key is too narrow and rows are being lost.
8
+ */ describe('describeRow', ()=>{
9
+ test('lists the mapped columns and their values, in order', ()=>{
10
+ expect(describeRow({
11
+ name: 'ÜRETİM PLANLAMA MÜDÜRLÜĞÜ',
12
+ slug: 'TAT-110'
13
+ })).toBe('name: ÜRETİM PLANLAMA MÜDÜRLÜĞÜ, slug: TAT-110');
14
+ });
15
+ test('an empty column reads as a dash, not as nothing at all', ()=>{
16
+ expect(describeRow({
17
+ name: null,
18
+ slug: 'TAT-110'
19
+ })).toBe('name: —, slug: TAT-110');
20
+ expect(describeRow({
21
+ name: undefined,
22
+ slug: 'X'
23
+ })).toBe('name: —, slug: X');
24
+ });
25
+ test('a long value is cut rather than allowed to bury the rest', ()=>{
26
+ const long = 'A'.repeat(200);
27
+ const described = describeRow({
28
+ description: long,
29
+ slug: 'X'
30
+ });
31
+ expect(described.length).toBeLessThan(120);
32
+ expect(described).toContain('…');
33
+ expect(described).toContain('slug: X');
34
+ });
35
+ test('non-string values are shown rather than dropped', ()=>{
36
+ expect(describeRow({
37
+ displayOrder: 0,
38
+ enabled: false
39
+ })).toBe('displayOrder: 0, enabled: false');
40
+ });
41
+ test('an empty row yields an empty description rather than punctuation', ()=>{
42
+ expect(describeRow({})).toBe('');
43
+ });
44
+ });
@@ -8,6 +8,16 @@ export type RunIssueValue = {
8
8
  kind: string;
9
9
  message: string;
10
10
  dedupKey?: string | null;
11
+ /**
12
+ * What the skipped record mapped to, when the planner could attach it.
13
+ *
14
+ * Two records sharing a key are either the same thing listed twice — skip it
15
+ * — or two things the key cannot tell apart, which means the key is too
16
+ * narrow and rows are being lost. The values are the difference.
17
+ */
18
+ row?: Record<string, unknown>;
19
+ /** The record that claimed this key first — what the skipped one lost to. */
20
+ keptRow?: Record<string, unknown>;
11
21
  };
12
22
  /** What a run would do, computed without writing. */
13
23
  export type RunPlanValue = {