@things-factory/ai-assistant 10.1.98 → 10.1.99

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.98",
3
+ "version": "10.1.99",
4
4
  "main": "dist-server/index.js",
5
5
  "things-factory": true,
6
6
  "author": "heartyoh",
@@ -51,5 +51,5 @@
51
51
  "copyfiles": "^2.4.1",
52
52
  "rimraf": "^5.0.0"
53
53
  },
54
- "gitHead": "6321b11b694621c8cf7ba105650071eb88e9beb7"
54
+ "gitHead": "15e86d38824d6d2af94043eb14a928232a8924a3"
55
55
  }
@@ -309,3 +309,12 @@ describe('telling the application', () => {
309
309
  expect(result.proposed).toBe(true)
310
310
  })
311
311
  })
312
+
313
+ describe('the card speaks the person\'s words', () => {
314
+ it('an enum field hands its value key prefix to the card - PERSONAL_CARD shows as the app\'s own word for it', async () => {
315
+ const target: EntryTarget = { ...expense, fields: [...expense.fields, { name: 'paidBy', type: 'enum', values: ['PERSONAL_CARD'], valueKeyPrefix: 'text.expense-payment-' }] }
316
+ const result: any = await proposeEntries(target, { rows: [{ values: { spentOn: '2026-09-12', amount: 1, paidBy: 'PERSONAL_CARD' }, sources: [{ where: 'x' }] }] }, { state: {} }, async () => new Map())
317
+ expect(result.columns.find((one: any) => one.name === 'paidBy')).toMatchObject({ valueKeyPrefix: 'text.expense-payment-' })
318
+ })
319
+ })
320
+
@@ -28,6 +28,8 @@ export interface EntryField {
28
28
  labelKey?: string
29
29
  /** A number field the card sums - and compares with the total the material prints (§ totals). */
30
30
  total?: boolean
31
+ /** An enum's values on the card: `<prefix><value in lowercase>` - `text.expense-payment-` shows PERSONAL_CARD as 개인카드. */
32
+ valueKeyPrefix?: string
31
33
  }
32
34
 
33
35
  /** Where a row came from - which file, and where in it. Shown on the card beside the row. */
@@ -48,7 +48,13 @@ function fieldSchema(field: EntryField): any {
48
48
 
49
49
  /** What the card needs besides the rows - the columns, in the target's order. */
50
50
  function columnsOf(target: EntryTarget) {
51
- return target.fields.map(field => ({ name: field.name, type: field.type, required: !!field.required, ...(field.labelKey ? { labelKey: field.labelKey } : {}) }))
51
+ return target.fields.map(field => ({
52
+ name: field.name,
53
+ type: field.type,
54
+ required: !!field.required,
55
+ ...(field.labelKey ? { labelKey: field.labelKey } : {}),
56
+ ...(field.valueKeyPrefix ? { valueKeyPrefix: field.valueKeyPrefix } : {})
57
+ }))
52
58
  }
53
59
 
54
60
  export type SourceTextLoader = (attachmentIds: string[], context: any) => Promise<Map<string, string>>
@@ -125,7 +125,7 @@ function changedColumns(target: EntryTarget, rows: ChangeRow[]) {
125
125
  const used = new Set(rows.flatMap(row => Object.keys(row.values)))
126
126
  return changeableFields(target)
127
127
  .filter(field => used.has(field.name))
128
- .map(field => ({ name: field.name, type: field.type, ...(field.labelKey ? { labelKey: field.labelKey } : {}) }))
128
+ .map(field => ({ name: field.name, type: field.type, ...(field.labelKey ? { labelKey: field.labelKey } : {}), ...(field.valueKeyPrefix ? { valueKeyPrefix: field.valueKeyPrefix } : {}) }))
129
129
  }
130
130
 
131
131
  export async function proposeChanges(target: EntryTarget, args: any, context: any, run: GraphqlRunner) {