@things-factory/ai-assistant 10.1.262 → 10.1.263

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/ai-assistant",
3
- "version": "10.1.262",
3
+ "version": "10.1.263",
4
4
  "main": "dist-server/index.js",
5
5
  "things-factory": true,
6
6
  "author": "heartyoh",
@@ -36,14 +36,14 @@
36
36
  "@operato/shell": "^10.29.69",
37
37
  "@operato/styles": "^10.0.0",
38
38
  "@operato/utils": "^10.29.39",
39
- "@things-factory/ai-client-base": "^10.1.262",
40
- "@things-factory/apptool-base": "^10.1.262",
41
- "@things-factory/attachment-base": "^10.1.262",
42
- "@things-factory/auth-base": "^10.1.262",
39
+ "@things-factory/ai-client-base": "^10.1.263",
40
+ "@things-factory/apptool-base": "^10.1.263",
41
+ "@things-factory/attachment-base": "^10.1.263",
42
+ "@things-factory/auth-base": "^10.1.263",
43
43
  "@things-factory/env": "^10.1.149",
44
- "@things-factory/help": "^10.1.262",
45
- "@things-factory/setting-base": "^10.1.262",
46
- "@things-factory/shell": "^10.1.262",
44
+ "@things-factory/help": "^10.1.263",
45
+ "@things-factory/setting-base": "^10.1.263",
46
+ "@things-factory/shell": "^10.1.263",
47
47
  "dompurify": "^3.0.0",
48
48
  "exceljs": "4.2.0",
49
49
  "graphql-scalars": "^1.22.0",
@@ -59,5 +59,5 @@
59
59
  "copyfiles": "^2.4.1",
60
60
  "rimraf": "^5.0.0"
61
61
  },
62
- "gitHead": "2d5babff1e0f83bb0dfdf2ec91e4e7c00f9ac5bd"
62
+ "gitHead": "f1ee39eb316c58c7eefa4c35651228d1d1ea4bcf"
63
63
  }
@@ -273,12 +273,18 @@ export function detailReadOf(key: string | undefined): DetailRead | undefined {
273
273
  /** A month as a `month` condition holds it. */
274
274
  const MONTH = /^\d{4}-(0[1-9]|1[0-2])$/
275
275
 
276
+ /*
277
+ * The id a key `<axis>:<id>` names - a uuid, or a row's own composite id (a training standing is `<kind>:<year>:<employee>`,
278
+ * 2026-11-08). Another axis's key is not this record's: it stays as written and finds nothing.
279
+ */
280
+ const idOfKey = (axis: string, text: string): string => recordIdOfKey(axis, text) ?? (text.startsWith(`${axis}:`) ? text.slice(axis.length + 1) : text)
281
+
276
282
  /** The conditions the model set, read by their declared types; a value that does not fit is said, never guessed at. */
277
283
  export function readCriteria(target: ReadTarget, args: any): { criteria: Record<string, unknown>; refused: { name: string; code: string }[] } {
278
284
  const criteria: Record<string, unknown> = {}
279
285
  const refused: { name: string; code: string }[] = []
280
286
  /* One record by its id - every target takes it (the id a list answer or a find tool gave, or the key `<axis>:<id>` an open record is shown by, the axis being the key's last part). */
281
- if (typeof args?.id === 'string' && args.id.trim()) criteria.id = recordIdOfKey(target.key.split('.').pop()!, args.id) ?? args.id.trim()
287
+ if (typeof args?.id === 'string' && args.id.trim()) criteria.id = idOfKey(target.key.split('.').pop()!, args.id.trim())
282
288
  if (target.search && typeof args?.text === 'string' && args.text.trim()) criteria.text = args.text.trim()
283
289
  for (const criterion of target.criteria) {
284
290
  const value = args?.[criterion.name]
@@ -311,7 +317,9 @@ export function filtersOf(target: ReadTarget, criteria: Record<string, unknown>)
311
317
  ]
312
318
  }
313
319
 
314
- export const valueAt = (row: any, path: string) => path.split('.').reduce((at, part) => (at === null || at === undefined ? undefined : at[part]), row)
320
+ /** A dotted path's value - through a list, each one's (an invention's inventors' names). */
321
+ export const valueAt = (row: any, path: string) =>
322
+ path.split('.').reduce((at, part) => (at === null || at === undefined ? undefined : Array.isArray(at) ? at.map(one => one?.[part]) : at[part]), row)
315
323
 
316
324
  /**
317
325
  * A date column's moment as people read it - `YYYY-MM-DD HH:mm` in the domain's time zone. A day (`YYYY-MM-DD`) or
@@ -366,7 +374,9 @@ export function rowOf(target: Pick<ReadTarget, 'columns'>, item: any, options: R
366
374
  /* The id names the record to the model - for one record's detail, a change, or its screen. */
367
375
  ...(item?.id ? [['id', String(item.id)] as [string, string]] : []),
368
376
  ...target.columns.map(column => {
369
- const raw = valueAt(item, column.path ?? column.name)
377
+ const found = valueAt(item, column.path ?? column.name)
378
+ /* A list of values reads as one, comma-separated. */
379
+ const raw = Array.isArray(found) ? found.filter(one => one !== undefined && one !== null && one !== '').join(', ') : found
370
380
  if (raw === undefined || raw === null || raw === '') return [column.name, null]
371
381
  if (column.type === 'number') {
372
382
  const number = Number(raw)
@@ -90,3 +90,10 @@ describe('the read tool', () => {
90
90
  expect(table.rows[0]).toMatchObject({ kind: '인사', state: '안 읽음', publishedAt: '2026-10-26 09:09' })
91
91
  })
92
92
  })
93
+
94
+ describe('a column of many', () => {
95
+ it('★ a path through a list reads each one, comma-separated - an invention\'s inventors', () => {
96
+ const columns = [{ name: 'inventors', path: 'inventors.name', type: 'string' }, { name: 'none', path: 'none.name', type: 'string' }] as any
97
+ expect(rowOf({ columns }, { id: 'a', inventors: [{ name: '김가람' }, { name: '이나래' }], none: [] })).toEqual({ id: 'a', inventors: '김가람, 이나래', none: null })
98
+ })
99
+ })
@@ -17,6 +17,12 @@ describe('a read names the record the model was shown', () => {
17
17
  expect(readCriteria(lines, { id: `contract:${ID}` }).criteria).toEqual({ id: `contract:${ID}` })
18
18
  })
19
19
 
20
+ it('★ a row whose own id is not a uuid is read by its key too - a training standing `<kind>:<year>:<employee>`', () => {
21
+ const standings = { key: 'compliance.trainings', criteria: [] } as unknown as ReadTarget
22
+ expect(readCriteria(standings, { id: `trainings:PRIVACY:2026:${ID}` }).criteria).toEqual({ id: `PRIVACY:2026:${ID}` })
23
+ expect(readCriteria(standings, { id: `PRIVACY:2026:${ID}` }).criteria).toEqual({ id: `PRIVACY:2026:${ID}` })
24
+ })
25
+
20
26
  it('★ a whole answer takes the key of the axis its id argument declares', async () => {
21
27
  const summary: DetailRead = {
22
28
  key: 'office.contract-360',