@workbasehq/core 0.2.5 → 0.2.6

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": "@workbasehq/core",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.ts",
package/src/config.ts CHANGED
@@ -18,7 +18,7 @@ export { Q, Cond }
18
18
  /** SQLite date formatting with column operands; values use the library wire encoding. */
19
19
  export const Fn = { ...LibraryFn, strftime: (format: string, date: string) => Q.expr(`FN(${JSON.stringify(['STRFTIME', Q.value(format).serialize(), Q.expr(date).serialize()])})`) }
20
20
 
21
- export const CORE_VERSION = '0.2.5'
21
+ export const CORE_VERSION = '0.2.6'
22
22
  const navigationIconSchema = z.enum(['LayoutDashboard', 'Users', 'MapPin', 'Coins', 'Wallet', 'ArrowLeftRight', 'Settings', 'Building2', 'Activity', 'Workflow', 'Database', 'Folder'])
23
23
  const identifier = z.string().regex(/^[a-z][a-z0-9_]*$/)
24
24
  export const serializedExpressionSchema = z.union([z.string().min(1).max(32000), z.record(z.string(), z.unknown()).transform(value => JSON.stringify(value))])
@@ -93,15 +93,15 @@ export function consoleModel(kernel: KernelRegistry, scope: Scope): ConsoleModel
93
93
  const values = field.type === 'enum' ? (field.values ?? []).map(value => `value_${value}`) : field.type === 'bool' ? ['yes', 'no'] : []
94
94
  return values.flatMap(key => [key, `${key}_${name}`])
95
95
  })))
96
- for (const [name, entity] of Object.entries(config.entities)) {
96
+ for (const name of Object.keys(config.entities)) {
97
97
  if (authority.canRead(name)) for (const prefix of ['entity', 'entitySingular', 'entityObject']) keys.add(`${prefix}_${name}`)
98
- for (const field of Object.keys(entity.fields)) if (authority.literals(name, field)) keys.add(`field_${field}_${name}`)
98
+ for (const field of fieldsFor(config, name)) if (authority.literals(name, field)) keys.add(`field_${field}_${name}`)
99
99
  }
100
100
  const dictionary = Object.fromEntries(Object.entries(labels).filter(([key]) => keys.has(key)))
101
101
  for (const [name, entity] of Object.entries(config.entities)) if (entity.displayExpression && entity.displayField && authority.read(name, entity.displayField)) {
102
102
  const title = labels[`entitySingular_${name}`] ?? labels[`entity_${name}`] ?? name.replaceAll('_', ' ').replace(/^./, first => first.toUpperCase())
103
- dictionary[`field_${entity.displayField}_${name}`] = title
104
- dictionary[`listField_${entity.displayField}_${name}`] = title
103
+ dictionary[`field_${entity.displayField}_${name}`] ??= title
104
+ dictionary[`listField_${entity.displayField}_${name}`] = dictionary[`field_${entity.displayField}_${name}`]
105
105
  }
106
106
  return Object.keys(dictionary).length ? [[language, dictionary]] : []
107
107
  })) } : {}),