From 1bca240142964cef928ffe0eebcb8455f31cbb90 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 23:53:34 +0000 Subject: [PATCH 1/3] feat(platform-objects): sys_standard_unit_setting, an organization's display decimal places for a standard unit code (WIP) Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01Utp6CXM7nqtiQ3M9JqGAqL --- .../utils/organization-ownership-inventory.ts | 5 + ...connect-agent-both-halves-wire.pin.test.ts | 11 +- .../scripts/i18n-extract.config.ts | 2 + .../src/apps/setup-nav.contributions.ts | 4 + .../src/apps/translations/ar.ts | 1 + .../translations/bundle-ownership.test.ts | 2 +- .../src/apps/translations/de.ts | 1 + .../src/apps/translations/en.ts | 1 + .../src/apps/translations/es-ES.ts | 1 + .../src/apps/translations/fr.ts | 1 + .../src/apps/translations/ja-JP.ts | 1 + .../src/apps/translations/ko.ts | 1 + .../src/apps/translations/pt-BR.ts | 1 + .../src/apps/translations/ru.ts | 1 + .../src/apps/translations/zh-CN.ts | 1 + .../src/apps/translations/zh-Hant.ts | 1 + .../src/platform-objects.test.ts | 3 +- packages/platform-objects/src/plugin.test.ts | 11 +- packages/platform-objects/src/plugin.ts | 8 +- packages/platform-objects/src/system/index.ts | 6 + .../sys-standard-unit-setting.object.test.ts | 162 ++++++++++++++++++ .../sys-standard-unit-setting.object.ts | 152 ++++++++++++++++ .../src/objects/default-permission-sets.ts | 17 ++ .../system/constants/platform-object-names.ts | 1 + 24 files changed, 384 insertions(+), 11 deletions(-) create mode 100644 packages/platform-objects/src/system/sys-standard-unit-setting.object.test.ts create mode 100644 packages/platform-objects/src/system/sys-standard-unit-setting.object.ts diff --git a/packages/cli/src/utils/organization-ownership-inventory.ts b/packages/cli/src/utils/organization-ownership-inventory.ts index 351be400091..85d1dc3d5fe 100644 --- a/packages/cli/src/utils/organization-ownership-inventory.ts +++ b/packages/cli/src/utils/organization-ownership-inventory.ts @@ -860,6 +860,11 @@ export const ORGANIZATION_OWNERSHIP_INVENTORY: readonly InventoryEntry[] = [ // organization's administrators author its own units; the platform ships no // row, and no parent row anchors a unit. { object: 'sys_unit', census: PMAIN, fate: 'attribution', citation: `${CENSUS_MAIN} (in reach, added since the first census); ${D10_SINGLE}`, anchors: [] }, + // Standard unit settings (`@objectstack/platform-objects`, ADR-0158 U6 and + // Open item 10): an organization's administrators set the display decimal + // places of a standard unit; the platform ships no row, and no parent row + // anchors a setting. + { object: 'sys_standard_unit_setting', census: PMAIN, fate: 'attribution', citation: `${CENSUS_MAIN} (in reach, added since the first census); ${D10_SINGLE}`, anchors: [] }, // Tasks and notes (`@objectstack/platform-objects` `work/`): members write // them, and the organization column is stamped from the writing context; no // parent row anchors a task or a note (step 1 links neither to a record). diff --git a/packages/cli/test/connect-agent-both-halves-wire.pin.test.ts b/packages/cli/test/connect-agent-both-halves-wire.pin.test.ts index 9996c4fc2b3..623b302e3bc 100644 --- a/packages/cli/test/connect-agent-both-halves-wire.pin.test.ts +++ b/packages/cli/test/connect-agent-both-halves-wire.pin.test.ts @@ -283,13 +283,15 @@ describe('#17647 — Connect-an-Agent visibility: BOTH halves, over the wire', ( // +2, `group_apps` and `nav_packages`; 37 until #33933 moved the // Knowledge entry, `nav_settings_knowledge`, to // `@objectstack/service-knowledge`, which contributes it only where the - // knowledge service is mounted.) + // knowledge service is mounted; 36 until the Standard Unit Settings + // entry, `nav_standard_unit_settings`, joined Configuration, ADR-0158 + // Open item 10.) // `nav_settings_branding` is not among them, and not because of a // tenancy wall (this harness boots none): since #24766 it is // contributed by `@objectstack/service-settings` together with the // `branding` namespace, offered only where no organization wall stands, // and this harness composes platform-objects and the MCP bundle alone. - expect(allowedIds).toHaveLength(36); + expect(allowedIds).toHaveLength(37); expect(allowedIds).toContain('nav_packages'); expect(groupChildren(setupAllowed.body?.item, 'group_apps')).toEqual(['nav_packages']); expect(allowedIds).toContain('nav_public_forms'); @@ -300,6 +302,7 @@ describe('#17647 — Connect-an-Agent visibility: BOTH halves, over the wire', ( expect(allowedIds).not.toContain('nav_settings_knowledge'); expect(allowedIds).toContain('nav_recycle_bin'); expect(allowedIds).toContain('nav_units_of_measure'); + expect(allowedIds).toContain('nav_standard_unit_settings'); expect(allowedIds).not.toContain('nav_settings_branding'); // The two per-user stores are reached from the User record page, not // from Setup's menu (#23803). @@ -322,8 +325,8 @@ describe('#17647 — Connect-an-Agent visibility: BOTH halves, over the wire', ( expect(withAccountHalf.statusCode).toBe(200); expect(withoutAccountHalf.statusCode).toBe(200); expect(navIds(withAccountHalf.body?.item)).toEqual(navIds(withoutAccountHalf.body?.item)); - // 36: the composition the count in the test above states. - expect(navIds(withAccountHalf.body?.item)).toHaveLength(36); + // 37: the composition the count in the test above states. + expect(navIds(withAccountHalf.body?.item)).toHaveLength(37); // The mechanism behind the invariance, asserted rather than assumed: // the bundle aims exactly one contribution at `setup` and one at diff --git a/packages/platform-objects/scripts/i18n-extract.config.ts b/packages/platform-objects/scripts/i18n-extract.config.ts index 1900c13205b..989b6c8f967 100644 --- a/packages/platform-objects/scripts/i18n-extract.config.ts +++ b/packages/platform-objects/scripts/i18n-extract.config.ts @@ -204,6 +204,7 @@ import { SysMigration, SysExchangeRate, SysUnit, + SysStandardUnitSetting, SysWorkCalendar, SysWorkCalendarException, } from '../src/system/index.js'; @@ -368,6 +369,7 @@ const config: ObjectStackDefinition = defineStack({ SysMigration, SysExchangeRate, SysUnit, + SysStandardUnitSetting, SysWorkCalendar, SysWorkCalendarException, SysTask, diff --git a/packages/platform-objects/src/apps/setup-nav.contributions.ts b/packages/platform-objects/src/apps/setup-nav.contributions.ts index 8ef743efa10..1f55db98e0a 100644 --- a/packages/platform-objects/src/apps/setup-nav.contributions.ts +++ b/packages/platform-objects/src/apps/setup-nav.contributions.ts @@ -159,6 +159,10 @@ export const SETUP_NAV_CONTRIBUTIONS: NavigationContribution[] = [ // `requiredPermissions`: the object grant decides (every member reads, // organization admins write), and Setup itself already needs `setup.access`. { id: 'nav_units_of_measure', type: 'object', label: 'Units of Measure', objectName: 'sys_unit', viewName: 'all_units', icon: 'ruler' }, + // [ADR-0158 U6, Open item 10] The decimal places each standard unit + // displays with in the organization, next to the organization's own + // units. No `requiredPermissions`, for the same reason as the entry above. + { id: 'nav_standard_unit_settings', type: 'object', label: 'Standard Unit Settings', objectName: 'sys_standard_unit_setting', viewName: 'all_settings', icon: 'ruler' }, // [ADR-0157 D1, D3] Working calendars and their holidays, beside the // other organization reference data Localization governs. The exceptions // get their own entry because their list page is the import door for a diff --git a/packages/platform-objects/src/apps/translations/ar.ts b/packages/platform-objects/src/apps/translations/ar.ts index d5d88e09032..910ef092d23 100644 --- a/packages/platform-objects/src/apps/translations/ar.ts +++ b/packages/platform-objects/src/apps/translations/ar.ts @@ -95,6 +95,7 @@ export const ar: TranslationData = { nav_settings_localization: { label: 'الترجمة والإعدادات المحلية' }, nav_exchange_rates: { label: 'أسعار الصرف' }, nav_units_of_measure: { label: 'وحدات القياس' }, + nav_standard_unit_settings: { label: 'إعدادات الوحدات القياسية' }, nav_work_calendars: { label: 'تقويمات العمل' }, nav_work_calendar_exceptions: { label: 'استثناءات التقويم' }, nav_settings_company: { label: 'الشركة' }, diff --git a/packages/platform-objects/src/apps/translations/bundle-ownership.test.ts b/packages/platform-objects/src/apps/translations/bundle-ownership.test.ts index ff78fa603e2..f70dea60734 100644 --- a/packages/platform-objects/src/apps/translations/bundle-ownership.test.ts +++ b/packages/platform-objects/src/apps/translations/bundle-ownership.test.ts @@ -56,7 +56,7 @@ const OWNED_OBJECTS = new Set([ // metadata (sys_view_definition retired as inert, ADR-0131 D13) 'sys_metadata', 'sys_metadata_history', 'sys_metadata_audit', 'sys_metadata_commit', // system - 'sys_setting', 'sys_platform_setting', 'sys_secret', 'sys_setting_audit', 'sys_platform_setting_audit', 'sys_migration', 'sys_exchange_rate', 'sys_unit', + 'sys_setting', 'sys_platform_setting', 'sys_secret', 'sys_setting_audit', 'sys_platform_setting_audit', 'sys_migration', 'sys_exchange_rate', 'sys_unit', 'sys_standard_unit_setting', 'sys_work_calendar', 'sys_work_calendar_exception', // work — the built-in tasks and notes 'sys_task', 'sys_note', diff --git a/packages/platform-objects/src/apps/translations/de.ts b/packages/platform-objects/src/apps/translations/de.ts index d4e35e055c7..da7ea408f15 100644 --- a/packages/platform-objects/src/apps/translations/de.ts +++ b/packages/platform-objects/src/apps/translations/de.ts @@ -97,6 +97,7 @@ export const de: TranslationData = { nav_settings_localization: { label: 'Lokalisierung' }, nav_exchange_rates: { label: 'Wechselkurse' }, nav_units_of_measure: { label: 'Maßeinheiten' }, + nav_standard_unit_settings: { label: 'Standardeinheiten-Einstellungen' }, nav_work_calendars: { label: 'Arbeitskalender' }, nav_work_calendar_exceptions: { label: 'Kalenderausnahmen' }, nav_settings_company: { label: 'Unternehmen' }, diff --git a/packages/platform-objects/src/apps/translations/en.ts b/packages/platform-objects/src/apps/translations/en.ts index d6ff5d2d460..22a8e541aea 100644 --- a/packages/platform-objects/src/apps/translations/en.ts +++ b/packages/platform-objects/src/apps/translations/en.ts @@ -131,6 +131,7 @@ export const en: TranslationData = { nav_settings_localization: { label: 'Localization' }, nav_exchange_rates: { label: 'Exchange Rates' }, nav_units_of_measure: { label: 'Units of Measure' }, + nav_standard_unit_settings: { label: 'Standard Unit Settings' }, nav_work_calendars: { label: 'Working Calendars' }, nav_work_calendar_exceptions: { label: 'Calendar Exceptions' }, nav_settings_company: { label: 'Company' }, diff --git a/packages/platform-objects/src/apps/translations/es-ES.ts b/packages/platform-objects/src/apps/translations/es-ES.ts index 5751c3cc91b..2afc7302f88 100644 --- a/packages/platform-objects/src/apps/translations/es-ES.ts +++ b/packages/platform-objects/src/apps/translations/es-ES.ts @@ -86,6 +86,7 @@ export const esES: TranslationData = { nav_settings_localization: { label: 'Localización' }, nav_exchange_rates: { label: 'Tipos de cambio' }, nav_units_of_measure: { label: 'Unidades de medida' }, + nav_standard_unit_settings: { label: 'Ajustes de unidades estándar' }, nav_work_calendars: { label: 'Calendarios laborales' }, nav_work_calendar_exceptions: { label: 'Excepciones de calendario' }, nav_settings_company: { label: 'Empresa' }, diff --git a/packages/platform-objects/src/apps/translations/fr.ts b/packages/platform-objects/src/apps/translations/fr.ts index 9af9f5fe8f8..6fbb39c94b9 100644 --- a/packages/platform-objects/src/apps/translations/fr.ts +++ b/packages/platform-objects/src/apps/translations/fr.ts @@ -97,6 +97,7 @@ export const fr: TranslationData = { nav_settings_localization: { label: 'Localisation' }, nav_exchange_rates: { label: 'Taux de change' }, nav_units_of_measure: { label: 'Unités de mesure' }, + nav_standard_unit_settings: { label: 'Paramètres des unités standard' }, nav_work_calendars: { label: 'Calendriers de travail' }, nav_work_calendar_exceptions: { label: 'Exceptions de calendrier' }, nav_settings_company: { label: 'Entreprise' }, diff --git a/packages/platform-objects/src/apps/translations/ja-JP.ts b/packages/platform-objects/src/apps/translations/ja-JP.ts index 5f5d0125a96..73c71595823 100644 --- a/packages/platform-objects/src/apps/translations/ja-JP.ts +++ b/packages/platform-objects/src/apps/translations/ja-JP.ts @@ -86,6 +86,7 @@ export const jaJP: TranslationData = { nav_settings_localization: { label: 'ローカリゼーション' }, nav_exchange_rates: { label: '為替レート' }, nav_units_of_measure: { label: '計量単位' }, + nav_standard_unit_settings: { label: '標準単位の設定' }, nav_work_calendars: { label: '稼働カレンダー' }, nav_work_calendar_exceptions: { label: 'カレンダー例外' }, nav_settings_company: { label: '会社' }, diff --git a/packages/platform-objects/src/apps/translations/ko.ts b/packages/platform-objects/src/apps/translations/ko.ts index 77ae856db11..bfa011991f9 100644 --- a/packages/platform-objects/src/apps/translations/ko.ts +++ b/packages/platform-objects/src/apps/translations/ko.ts @@ -96,6 +96,7 @@ export const ko: TranslationData = { nav_settings_localization: { label: '현지화' }, nav_exchange_rates: { label: '환율' }, nav_units_of_measure: { label: '측정 단위' }, + nav_standard_unit_settings: { label: '표준 단위 설정' }, nav_work_calendars: { label: '근무 캘린더' }, nav_work_calendar_exceptions: { label: '캘린더 예외' }, nav_settings_company: { label: '회사' }, diff --git a/packages/platform-objects/src/apps/translations/pt-BR.ts b/packages/platform-objects/src/apps/translations/pt-BR.ts index 474927fdb49..7013ba22562 100644 --- a/packages/platform-objects/src/apps/translations/pt-BR.ts +++ b/packages/platform-objects/src/apps/translations/pt-BR.ts @@ -97,6 +97,7 @@ export const ptBR: TranslationData = { nav_settings_localization: { label: 'Localização' }, nav_exchange_rates: { label: 'Taxas de câmbio' }, nav_units_of_measure: { label: 'Unidades de medida' }, + nav_standard_unit_settings: { label: 'Configurações de unidades padrão' }, nav_work_calendars: { label: 'Calendários de trabalho' }, nav_work_calendar_exceptions: { label: 'Exceções de calendário' }, nav_settings_company: { label: 'Empresa' }, diff --git a/packages/platform-objects/src/apps/translations/ru.ts b/packages/platform-objects/src/apps/translations/ru.ts index 69f08863a32..bcf1f070c53 100644 --- a/packages/platform-objects/src/apps/translations/ru.ts +++ b/packages/platform-objects/src/apps/translations/ru.ts @@ -97,6 +97,7 @@ export const ru: TranslationData = { nav_settings_localization: { label: 'Локализация' }, nav_exchange_rates: { label: 'Курсы валют' }, nav_units_of_measure: { label: 'Единицы измерения' }, + nav_standard_unit_settings: { label: 'Настройки стандартных единиц' }, nav_work_calendars: { label: 'Рабочие календари' }, nav_work_calendar_exceptions: { label: 'Исключения календаря' }, nav_settings_company: { label: 'Компания' }, diff --git a/packages/platform-objects/src/apps/translations/zh-CN.ts b/packages/platform-objects/src/apps/translations/zh-CN.ts index c3e86d96f15..89fbf78cad5 100644 --- a/packages/platform-objects/src/apps/translations/zh-CN.ts +++ b/packages/platform-objects/src/apps/translations/zh-CN.ts @@ -90,6 +90,7 @@ export const zhCN: TranslationData = { nav_settings_localization: { label: '本地化' }, nav_exchange_rates: { label: '汇率' }, nav_units_of_measure: { label: '计量单位' }, + nav_standard_unit_settings: { label: '标准单位设置' }, nav_work_calendars: { label: '工作日历' }, nav_work_calendar_exceptions: { label: '日历例外' }, nav_settings_company: { label: '公司' }, diff --git a/packages/platform-objects/src/apps/translations/zh-Hant.ts b/packages/platform-objects/src/apps/translations/zh-Hant.ts index 4c7c143c2eb..fcc8f450c0c 100644 --- a/packages/platform-objects/src/apps/translations/zh-Hant.ts +++ b/packages/platform-objects/src/apps/translations/zh-Hant.ts @@ -95,6 +95,7 @@ export const zhHant: TranslationData = { nav_settings_localization: { label: '在地化' }, nav_exchange_rates: { label: '匯率' }, nav_units_of_measure: { label: '計量單位' }, + nav_standard_unit_settings: { label: '標準單位設定' }, nav_work_calendars: { label: '工作日曆' }, nav_work_calendar_exceptions: { label: '日曆例外' }, nav_settings_company: { label: '公司' }, diff --git a/packages/platform-objects/src/platform-objects.test.ts b/packages/platform-objects/src/platform-objects.test.ts index 9f8f2b235f8..56fcad9f5bf 100644 --- a/packages/platform-objects/src/platform-objects.test.ts +++ b/packages/platform-objects/src/platform-objects.test.ts @@ -37,7 +37,7 @@ import { SysMetadata, SysMetadataHistoryObject, } from './metadata/index.js'; -import { SysExchangeRate, SysSecret, SysSetting, SysUnit, SysWorkCalendar, SysWorkCalendarException } from './system/index.js'; +import { SysExchangeRate, SysSecret, SysSetting, SysStandardUnitSetting, SysUnit, SysWorkCalendar, SysWorkCalendarException } from './system/index.js'; import { ACCOUNT_APP, SETUP_APP, SETUP_NAV_CONTRIBUTIONS, STUDIO_APP } from './apps/index.js'; import { AppSchema } from '@objectstack/spec/ui'; import { resolveEffectiveApiMethods, isApiOperationAllowed, canServeApiOperation } from '@objectstack/spec/data'; @@ -606,6 +606,7 @@ describe('@objectstack/platform-objects', () => { sys_oauth_application: SysOauthApplication, sys_organization: SysOrganization, sys_session: SysSession, + sys_standard_unit_setting: SysStandardUnitSetting, sys_team: SysTeam, sys_unit: SysUnit, sys_user: SysUser, diff --git a/packages/platform-objects/src/plugin.test.ts b/packages/platform-objects/src/plugin.test.ts index 2169b0a770d..4305abc45dc 100644 --- a/packages/platform-objects/src/plugin.test.ts +++ b/packages/platform-objects/src/plugin.test.ts @@ -11,7 +11,7 @@ import { describe, it, expect } from 'vitest'; import { assertEngineFindOnePredicate, assertEngineUpdateDispatch } from '@objectstack/metadata-core'; import { ObjectSchema, RECYCLE_BIN_ENTRY_FIELDS, RECYCLE_BIN_OBJECT } from '@objectstack/spec/data'; import { PlatformObjectsPlugin } from './plugin.js'; -import { SysExchangeRate, SysUnit, SysLifecycleState, SysMetadataActivation, SysMigration, SysMigrationJournal, SysRecycleBin, SysSecret, SysSeedLandedKey, SysTrustedKey, SysWorkCalendar, SysWorkCalendarException } from './system/index.js'; +import { SysExchangeRate, SysUnit, SysStandardUnitSetting, SysLifecycleState, SysMetadataActivation, SysMigration, SysMigrationJournal, SysRecycleBin, SysSecret, SysSeedLandedKey, SysTrustedKey, SysWorkCalendar, SysWorkCalendarException } from './system/index.js'; /** * Hand-rolled fake PluginContext (mirrors the service-plugin tests) — this @@ -47,7 +47,7 @@ function makeCtx() { } describe('PlatformObjectsPlugin: platform-infrastructure object registration (#4243, #4270)', () => { - it('registers SysMigration, SysMigrationJournal, SysSecret, SysExchangeRate, SysUnit, SysWorkCalendar, SysWorkCalendarException, SysTrustedKey, SysLifecycleState, SysRecycleBin and SysSeedLandedKey through the manifest service', async () => { + it('registers SysMigration, SysMigrationJournal, SysSecret, SysExchangeRate, SysUnit, SysStandardUnitSetting, SysWorkCalendar, SysWorkCalendarException, SysTrustedKey, SysLifecycleState, SysRecycleBin and SysSeedLandedKey through the manifest service', async () => { const ctx = makeCtx(); const manifests: any[] = []; ctx.registerService('manifest', { register: (m: any) => manifests.push(m) }); @@ -57,7 +57,7 @@ describe('PlatformObjectsPlugin: platform-infrastructure object registration (#4 const infra = manifests.find((m) => m.id === 'com.objectstack.platform-objects'); expect(infra).toBeDefined(); expect(infra.scope).toBe('system'); - expect(infra.objects).toEqual([SysMigration, SysMigrationJournal, SysSecret, SysExchangeRate, SysUnit, SysWorkCalendar, SysWorkCalendarException, SysTrustedKey, SysLifecycleState, SysRecycleBin, SysSeedLandedKey]); + expect(infra.objects).toEqual([SysMigration, SysMigrationJournal, SysSecret, SysExchangeRate, SysUnit, SysStandardUnitSetting, SysWorkCalendar, SysWorkCalendarException, SysTrustedKey, SysLifecycleState, SysRecycleBin, SysSeedLandedKey]); expect(infra.objects.map((o: any) => o.name)).toEqual([ 'sys_migration', // ADR-0119 D2 (#4617). Registered UNCONDITIONALLY, alongside the flag @@ -74,6 +74,9 @@ describe('PlatformObjectsPlugin: platform-infrastructure object registration (#4 // read by the engine's unit membership check and by the display of a // quantity with its unit, so it registers beside the exchange rates. 'sys_unit', + // [ADR-0158 U6, Open item 10] An organization's display decimal places + // for a standard unit code, beside the organization's own units. + 'sys_standard_unit_setting', // [ADR-0157 D1] Working calendars and their exceptions, read by the // engine's calendar service; organization data on the project database. 'sys_work_calendar', @@ -93,7 +96,7 @@ describe('PlatformObjectsPlugin: platform-infrastructure object registration (#4 // and written only by the seed loader, beside the rows it describes. 'sys_seed_landed_key', ]); - // ⛔ The nine above must NOT acquire the ledger's routing triple. They + // ⛔ The twelve above must NOT acquire the ledger's routing triple. They // ride the project database today; moving them is a different question. expect(infra.defaultDatasource).toBeUndefined(); }); diff --git a/packages/platform-objects/src/plugin.ts b/packages/platform-objects/src/plugin.ts index 75d128b792e..216e45c43e6 100644 --- a/packages/platform-objects/src/plugin.ts +++ b/packages/platform-objects/src/plugin.ts @@ -8,6 +8,7 @@ import { SysMigrationJournal } from './system/sys-migration-journal.object.js'; import { SysSecret } from './system/sys-secret.object.js'; import { SysExchangeRate } from './system/sys-exchange-rate.object.js'; import { SysUnit } from './system/sys-unit.object.js'; +import { SysStandardUnitSetting } from './system/sys-standard-unit-setting.object.js'; import { SysWorkCalendar } from './system/sys-work-calendar.object.js'; import { SysWorkCalendarException } from './system/sys-work-calendar-exception.object.js'; import { SysTrustedKey } from './system/sys-trusted-key.object.js'; @@ -127,6 +128,11 @@ import { SEED_SETTLEMENT_SERVICE } from '@objectstack/spec/contracts'; * in every composition that can write or read a record, so it has no * on/off capability boundary of its own (ADR-0029 D2) and registers here, * in the first manifest beside the exchange rates. + * - **`sys_standard_unit_setting`** — the organization's display decimal + * places for a standard unit code (ADR-0158 U6, Open item 10 option A), + * the standard-code counterpart of `sys_unit`'s own `decimal_places`. Its + * reader is the display of a quantity with its unit, so it registers + * beside `sys_unit` for the same reason. * - **`sys_work_calendar`** / **`sys_work_calendar_exception`** — the * organization's working calendars and their dated holidays and make-up * workdays (ADR-0157 D1). Registered here for the reason the rate table @@ -265,7 +271,7 @@ export class PlatformObjectsPlugin { version: this.version, type: 'plugin', scope: 'system', - objects: [SysMigration, SysMigrationJournal, SysSecret, SysExchangeRate, SysUnit, SysWorkCalendar, SysWorkCalendarException, SysTrustedKey, SysLifecycleState, SysRecycleBin, SysSeedLandedKey], + objects: [SysMigration, SysMigrationJournal, SysSecret, SysExchangeRate, SysUnit, SysStandardUnitSetting, SysWorkCalendar, SysWorkCalendarException, SysTrustedKey, SysLifecycleState, SysRecycleBin, SysSeedLandedKey], }); ctx?.getService?.('manifest')?.register?.({ ...ACTIVATION_LEDGER_MANIFEST, diff --git a/packages/platform-objects/src/system/index.ts b/packages/platform-objects/src/system/index.ts index 596236bca98..3f76279c151 100644 --- a/packages/platform-objects/src/system/index.ts +++ b/packages/platform-objects/src/system/index.ts @@ -47,6 +47,12 @@ export { UNIT_RATIO_PRECISION, UNIT_DECIMAL_PLACES_MAX, } from './sys-unit.object.js'; +// [ADR-0158 U6; Open item 10, option A] An organization's display decimal +// places for a standard unit code. Zero platform rows. +export { + SysStandardUnitSetting, + STANDARD_UNIT_SETTING_CODES, +} from './sys-standard-unit-setting.object.js'; // [ADR-0157 D1] Working calendars and their dated exceptions, read by the // calendar service (`@objectstack/objectql`). export { diff --git a/packages/platform-objects/src/system/sys-standard-unit-setting.object.test.ts b/packages/platform-objects/src/system/sys-standard-unit-setting.object.test.ts new file mode 100644 index 00000000000..7603454d727 --- /dev/null +++ b/packages/platform-objects/src/system/sys-standard-unit-setting.object.test.ts @@ -0,0 +1,162 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import { describe, it, expect } from 'vitest'; +import { celEngine } from '@objectstack/formula'; +import { + IndexSchema, + ObjectSchema, + STANDARD_UNITS, + apiExposureDenialReason, + resolveCrudAffordances, + resolveInjectedSystemColumns, +} from '@objectstack/spec/data'; +import { PLATFORM_OBJECTS_BY_PACKAGE } from '@objectstack/spec/system'; +import { SysStandardUnitSetting, STANDARD_UNIT_SETTING_CODES } from './sys-standard-unit-setting.object.js'; +import { SysUnit, UNIT_DECIMAL_PLACES_MAX } from './sys-unit.object.js'; +import { SETUP_NAV_CONTRIBUTIONS } from '../apps/setup-nav.contributions.js'; +import { PlatformObjectsPlugin } from '../plugin.js'; + +/** + * ADR-0158 U6, its Open item 10 answered by option A 「组织可改,新开一处设置」: + * the declaration of the organization's display decimal places for a + * standard unit code. As in `sys-unit.object.test.ts`, the facts a mechanism + * elsewhere decides (the organization-scoped unique key, the tenant wall, the + * grants, the audit writer) are pinned here as the declaration that mechanism + * reads; the real-stack suite + * `default-permission-sets.standard-unit-setting.integration.test.ts` + * (`@objectstack/plugin-security`) drives them. The rule is EVALUATED through + * the canonical CEL engine in the scope the rule validator binds. + */ +describe('sys_standard_unit_setting — declaration (ADR-0158 U6, Open item 10)', () => { + const fields = SysStandardUnitSetting.fields as Record; + const rules = (SysStandardUnitSetting.validations ?? []) as Array>; + + it('parses as an ObjectSchema and is a platform object of this package', () => { + expect(() => ObjectSchema.parse(SysStandardUnitSetting)).not.toThrow(); + expect(PLATFORM_OBJECTS_BY_PACKAGE['platform-objects']).toContain('sys_standard_unit_setting'); + }); + + it('carries exactly a code and its decimal places, both required', () => { + expect(Object.keys(fields).sort()).toEqual(['code', 'decimal_places', 'id']); + expect(fields.code.required).toBe(true); + expect(fields.decimal_places.required).toBe(true); + }); + + describe('values', () => { + it("code is a select over exactly the standard unit table's codes, in its order (U1)", () => { + expect(fields.code.type).toBe('select'); + expect(fields.code.options.map((o: any) => o.value)).toEqual(Object.keys(STANDARD_UNITS)); + expect(STANDARD_UNIT_SETTING_CODES).toEqual(Object.keys(STANDARD_UNITS)); + // An organization's own unit carries its decimal places on its own row (U3, U6). + expect(fields.code.options.map((o: any) => o.value)).not.toContain('BOX_12'); + }); + + it("decimal_places is a whole number from 0 to 12, sys_unit's range, with no default (U6, L4)", () => { + expect(fields.decimal_places.type).toBe('number'); + expect(fields.decimal_places.scale).toBe(0); + expect(fields.decimal_places.min).toBe(0); + expect(fields.decimal_places.max).toBe(UNIT_DECIMAL_PLACES_MAX); + expect((SysUnit.fields as any).decimal_places).toMatchObject({ min: 0, max: UNIT_DECIMAL_PLACES_MAX, scale: 0 }); + expect(fields.decimal_places.defaultValue).toBeUndefined(); + }); + }); + + it("declares exactly one unique key, on code, scoped 'organization'", () => { + const unique = (SysStandardUnitSetting.indexes ?? []).filter((i: any) => i.unique); + expect(unique).toHaveLength(1); + expect((unique[0] as any).fields).toEqual(['code']); + expect(IndexSchema.parse(unique[0])).toMatchObject({ unique: 'organization' }); + }); + + it('takes no tenancy opt-out, so organization_id is injected and the tenant wall scopes it', () => { + const plan = resolveInjectedSystemColumns(SysStandardUnitSetting); + expect((SysStandardUnitSetting as any).tenancy).toBeUndefined(); + expect((SysStandardUnitSetting as any).systemFields?.tenant).not.toBe(false); + expect(plan.tenant).toBe(true); + expect(plan.names.has('organization_id')).toBe(true); + }); + + it('ships no record: no manifest this plugin registers seeds a row of it', async () => { + const manifests: any[] = []; + const services: Record = { manifest: { register: (m: any) => manifests.push(m) } }; + const ctx = { + getService: (n: string) => services[n], + registerService: (n: string, s: unknown) => { services[n] = s; }, + hook: () => {}, + logger: { info() {}, warn() {}, error() {}, debug() {} }, + }; + await new PlatformObjectsPlugin().init(ctx as any); + const owner = manifests.find((m) => (m.objects ?? []).some((o: any) => o.name === 'sys_standard_unit_setting')); + expect(owner?.id).toBe('com.objectstack.platform-objects'); + for (const m of manifests) { + for (const entry of (m.data ?? []) as Array<{ object?: string }>) expect(entry.object, m.id).not.toBe('sys_standard_unit_setting'); + } + }); + + describe('set, change and clear', () => { + it('offers New, Edit and Delete: clearing a setting is deleting its row', () => { + expect(SysStandardUnitSetting.managedBy).toBe('system-data'); + expect((SysStandardUnitSetting as any).requiredPermissions).toBeUndefined(); + expect(resolveCrudAffordances(SysStandardUnitSetting as any)).toMatchObject({ create: true, edit: true, delete: true }); + }); + + it('serves read, create, update and delete on the data API', () => { + expect(SysStandardUnitSetting.enable?.apiEnabled).toBe(true); + for (const op of ['get', 'list', 'create', 'update', 'delete']) { + expect(apiExposureDenialReason(SysStandardUnitSetting.enable, op), op).toBeNull(); + } + }); + }); + + it('surfaces the History tab, with both authored columns tracked (audited like the L1 ratio edit)', () => { + expect(SysStandardUnitSetting.enable?.trackHistory).toBe(true); + for (const name of ['code', 'decimal_places']) expect(fields[name].trackHistory, name).toBe(true); + }); + + describe('the code is immutable after create', () => { + const rule = rules.find((r) => r.name === 'standard_unit_setting_code_immutable'); + const violates = (record: Record, previous: Record): boolean | string => { + const source = typeof rule?.condition === 'string' ? rule.condition : rule?.condition?.source; + if (typeof source !== 'string') throw new Error('the rule has no CEL source'); + const out = celEngine.evaluate({ dialect: 'cel', source }, { record, previous } as any); + if (!out.ok) return `FAULT ${out.error.message.split('\n')[0].trim()}`; + return out.value as boolean; + }; + const ROW = { code: 'GRM', decimal_places: 3 }; + + it('is the one rule, update-only, attached to code', () => { + expect(rules.map((r) => r.name)).toEqual(['standard_unit_setting_code_immutable']); + expect(rule).toMatchObject({ type: 'cross_field', events: ['update'], fields: ['code'], severity: 'error' }); + }); + + it('refuses an update that changes the code, and admits one that changes the decimal places', () => { + expect(violates({ ...ROW, code: 'KGM' }, ROW)).toBe(true); + expect(violates({ ...ROW, decimal_places: 0 }, ROW)).toBe(false); + }); + }); + + describe('Setup', () => { + const configuration = SETUP_NAV_CONTRIBUTIONS.find((c) => c.group === 'group_configuration'); + const items = (configuration?.items ?? []) as any[]; + + it('lists the settings directly under the units of measure, opening the all-settings view', () => { + const at = items.findIndex((i) => i.id === 'nav_standard_unit_settings'); + expect(at).toBeGreaterThan(0); + expect(items[at - 1].id).toBe('nav_units_of_measure'); + expect(items[at]).toMatchObject({ + type: 'object', + label: 'Standard Unit Settings', + objectName: 'sys_standard_unit_setting', + viewName: 'all_settings', + }); + expect(items[at].requiredPermissions).toBeUndefined(); + }); + + it('names a view the object declares', () => { + const view = (SysStandardUnitSetting.listViews as any).all_settings; + expect(view.data).toEqual({ provider: 'object', object: 'sys_standard_unit_setting' }); + expect(view.columns).toEqual(['code', 'decimal_places']); + expect(view.emptyState?.title).toBeTruthy(); + }); + }); +}); diff --git a/packages/platform-objects/src/system/sys-standard-unit-setting.object.ts b/packages/platform-objects/src/system/sys-standard-unit-setting.object.ts new file mode 100644 index 00000000000..684ff073a58 --- /dev/null +++ b/packages/platform-objects/src/system/sys-standard-unit-setting.object.ts @@ -0,0 +1,152 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import { ObjectSchema, Field, STANDARD_UNITS } from '@objectstack/spec/data'; +import { UNIT_DECIMAL_PLACES_MAX } from './sys-unit.object.js'; + +/** + * The codes a row may name: every key of the standard unit table (ADR-0158 + * U1), in its order. Read from the table, so a code the table gains is + * selectable here with no second edit, and a code it never held is refused + * by the select's closed option set. + */ +export const STANDARD_UNIT_SETTING_CODES: readonly string[] = Object.freeze(Object.keys(STANDARD_UNITS)); + +/** + * sys_standard_unit_setting — Standard Unit Setting (ADR-0158 U6, its Open + * item 10 answered by the maintainer's option A 「组织可改,新开一处设置」) + * + * One row per standard unit an ORGANIZATION has set a display default for. + * The standard unit table (`STANDARD_UNITS` in `@objectstack/spec`, U1) is a + * closed spec constant, and `sys_unit` holds org-added units only (U3), so the + * decimal places of a standard code such as `KGM` or `H87` live here, beside + * the `decimal_places` column an org-added unit carries on its own row. The + * platform ships zero rows: a standard unit with no row has no display + * default of its own (U1 names none). + * + * - **Code** — one of the standard table's codes + * ({@link STANDARD_UNIT_SETTING_CODES}). Unique within the organization and + * immutable after create: a row is the setting OF that code, so a wrong code + * is corrected by deleting the row and adding the right one. + * - **Decimal places** — the unit's display default (U6), a whole number from + * 0 to {@link UNIT_DECIMAL_PLACES_MAX}, the same range as `sys_unit`'s + * column. Never a storage rule (L4): the field's own `scale` is the ceiling, + * a display never shows more places than it, and nothing is rounded at write + * by this value. Required: a row exists only while a value is set. + * - **Clearing** — deleting the row. The standard unit then has no display + * default of its own again. A deleted row frees nothing a stored record + * depends on (a record stores the code, and the code stays standard), so + * unlike `sys_unit` the delete is served; it is also what lets an + * organization delete itself, which refuses while any of its records + * remain, as an exchange rate does. + * - **Tenancy** — no tenancy opt-out, so `organization_id` is injected and the + * Layer 0 tenant wall (ADR-0095 D1) scopes every read and write: another + * organization's value is never read. + * - **Who reads, who writes** — every member READS it (`member_default` names + * this object, read only), as `sys_unit` is read, so a quantity displays + * with the same default for everyone who reads it. Organization + * administrators create, edit and delete rows through + * `organization_admin`'s line; a member holds no write bit on it. + * - **Audit** — not on the audit writer's skip list, so every create, edit + * and delete lands in `sys_audit_log`, and `enable.trackHistory` plus the + * per-field flags keep the old and new values, as a unit's ratio edit is + * kept (L1). + * + * @namespace sys + */ +export const SysStandardUnitSetting = ObjectSchema.create({ + name: 'sys_standard_unit_setting', + label: 'Standard Unit Setting', + pluralLabel: 'Standard Unit Settings', + icon: 'ruler', + color: 'green', + isSystem: true, + // Platform-defined schema, organization-administered data. + managedBy: 'system-data', + description: + 'How many decimal places a quantity in a standard unit of measure (KGM, H87, …) displays with in this organization — ' + + 'one row per standard unit the organization has set.', + displayNameField: 'code', + nameField: 'code', // [ADR-0079] canonical primary-title pointer (mirrors deprecated displayNameField) + highlightFields: ['code', 'decimal_places'], + + fields: { + id: Field.text({ label: 'ID', required: true, readonly: true, group: 'System' }), + + code: Field.select( + STANDARD_UNIT_SETTING_CODES.map((value) => ({ value, label: value })), + { + label: 'Standard Unit', + required: true, + searchable: true, + trackHistory: true, + description: + 'The standard unit code (UN/ECE Recommendation 20), for example KGM for kilogram or H87 for piece. ' + + "The organization's own units carry their decimal places on the unit itself, under Units of Measure. " + + 'The code cannot be changed after the setting is created.', + group: 'Unit', + }, + ), + + decimal_places: Field.number({ + label: 'Decimal Places', + required: true, + min: 0, + max: UNIT_DECIMAL_PLACES_MAX, + scale: 0, + trackHistory: true, + description: + "How many decimal places a quantity in this unit displays with by default. It never rounds a stored value, and a field's own decimal places still limit what is stored and shown. " + + 'Delete the setting to clear it.', + group: 'Display', + }), + }, + + indexes: [ + { fields: ['code'], unique: 'organization' }, + ], + + // `validations` is the server-enforced channel: objectql's rule validator runs + // it on insert, by-id update and bulk update (ADR-0049 declared = enforced). + validations: [ + { + // A row is the setting of its code: the code is immutable after create. + // `cross_field` so the refusal is attached to the field it is about. + type: 'cross_field', + name: 'standard_unit_setting_code_immutable', + events: ['update'], + condition: 'previous != null && record.code != previous.code', + fields: ['code'], + severity: 'error', + message: "A setting's unit cannot be changed after it is created. Delete it and add a setting for the other unit instead.", + }, + ], + + listViews: { + all_settings: { + type: 'grid', + name: 'all_settings', + label: 'All', + description: + 'Decimal places a quantity in a standard unit displays with in this organization. ' + + "A field's own decimal places still limit what is stored and shown.", + data: { provider: 'object', object: 'sys_standard_unit_setting' }, + columns: ['code', 'decimal_places'], + sort: [{ field: 'code', order: 'asc' }], + pagination: { pageSize: 50 }, + emptyState: { + title: 'No standard unit settings yet', + message: + 'Standard units display with the decimal places of the field that holds the quantity. ' + + 'Add a setting to give a standard unit, such as grams or kilograms, its own number of decimal places.', + }, + }, + }, + + enable: { + trackHistory: true, + searchable: false, + apiEnabled: true, + // A setting is reference data, not a discussion surface. + feeds: false, + }, +}); diff --git a/packages/plugins/plugin-security/src/objects/default-permission-sets.ts b/packages/plugins/plugin-security/src/objects/default-permission-sets.ts index 37589f271e8..d4a112e3870 100644 --- a/packages/plugins/plugin-security/src/objects/default-permission-sets.ts +++ b/packages/plugins/plugin-security/src/objects/default-permission-sets.ts @@ -469,6 +469,14 @@ const baseDefaultPermissionSets: PermissionSet[] = [ // so an administrator edits every unit of their organization without // them. sys_unit: { allowRead: true, allowCreate: true, allowEdit: true, allowDelete: false }, + // [ADR-0158 U6, Open item 10 option A] The organization's display decimal + // places for a standard unit code: set, changed and cleared here. + // Clearing is deleting the row, so this line keeps the delete the + // wildcard gives (unlike `sys_unit`, whose rows hold codes records use). + // WITHOUT the superuser bits, like the line above: settings carry no + // owner scope for an administrator, so an administrator edits every + // setting of their organization without them. + sys_standard_unit_setting: { allowRead: true, allowCreate: true, allowEdit: true, allowDelete: true }, }, // `manage_mailboxes` (ruling 6116489638, Q4 → A): an organization // administrator reads its organization's mailboxes and their unassociated @@ -936,6 +944,15 @@ const baseDefaultPermissionSets: PermissionSet[] = [ // (ADR-0090 D5). An external member resolves `external_default` and gets // no such line. sys_unit: { allowRead: true, allowCreate: false, allowEdit: false, allowDelete: false }, + // [ADR-0158 U6, Open item 10 option A] The organization's display decimal + // places for a standard unit code, READ only, on the `sys_unit` line's + // reasoning: a quantity displays with the same default for every member + // who reads it. ⛔ No row policy (every row is the member's own + // organization's reference data, behind Layer 0, ADR-0095 D1) and ⛔ no + // write bit: organization administrators set and clear these through + // `organization_admin`'s line. An external member resolves + // `external_default` and gets no such line, as with `sys_unit`. + sys_standard_unit_setting: { allowRead: true, allowCreate: false, allowEdit: false, allowDelete: false }, // [#36942 — maintainer ruling 7131539862, verbatim 「1. #36942 任务/备忘默认权限: A。」] // The platform's built-in tasks and notes (`@objectstack/platform-objects` // `work/`), for every member, whichever application is installed: read, diff --git a/packages/spec/src/system/constants/platform-object-names.ts b/packages/spec/src/system/constants/platform-object-names.ts index 8a6742a4edc..b38d3336215 100644 --- a/packages/spec/src/system/constants/platform-object-names.ts +++ b/packages/spec/src/system/constants/platform-object-names.ts @@ -96,6 +96,7 @@ export const PLATFORM_OBJECTS_BY_PACKAGE: Readonly Date: Thu, 26 Nov 2026 00:09:32 +0000 Subject: [PATCH 2/3] =?UTF-8?q?feat(platform-objects):=20standard=20unit?= =?UTF-8?q?=20settings=20=E2=80=94=20exact-uppercase=20code=20rule,=20real?= =?UTF-8?q?-stack=20grants=20suite,=20regenerated=20bundles=20and=20census?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01Utp6CXM7nqtiQ3M9JqGAqL --- .changeset/35498-standard-unit-setting.md | 19 ++ .../apps/translations/ar.objects.generated.ts | 36 +++ .../ar.source-hashes.generated.ts | 14 + .../apps/translations/de.objects.generated.ts | 36 +++ .../de.source-hashes.generated.ts | 14 + .../apps/translations/en.objects.generated.ts | 36 +++ .../translations/es-ES.objects.generated.ts | 36 +++ .../es-ES.source-hashes.generated.ts | 14 + .../apps/translations/fr.objects.generated.ts | 36 +++ .../fr.source-hashes.generated.ts | 14 + .../translations/ja-JP.objects.generated.ts | 36 +++ .../ja-JP.source-hashes.generated.ts | 14 + .../apps/translations/ko.objects.generated.ts | 36 +++ .../ko.source-hashes.generated.ts | 14 + .../translations/pt-BR.objects.generated.ts | 36 +++ .../pt-BR.source-hashes.generated.ts | 14 + .../apps/translations/ru.objects.generated.ts | 36 +++ .../ru.source-hashes.generated.ts | 14 + .../translations/zh-CN.objects.generated.ts | 36 +++ .../zh-CN.source-hashes.generated.ts | 1 + .../translations/zh-Hant.objects.generated.ts | 36 +++ .../zh-Hant.source-hashes.generated.ts | 14 + packages/platform-objects/src/system/index.ts | 1 + .../sys-standard-unit-setting.object.test.ts | 25 +- .../sys-standard-unit-setting.object.ts | 58 ++-- ....standard-unit-setting.integration.test.ts | 292 ++++++++++++++++++ scripts/platform-object-tenancy-census.json | 11 +- 27 files changed, 899 insertions(+), 30 deletions(-) create mode 100644 .changeset/35498-standard-unit-setting.md create mode 100644 packages/plugins/plugin-security/src/default-permission-sets.standard-unit-setting.integration.test.ts diff --git a/.changeset/35498-standard-unit-setting.md b/.changeset/35498-standard-unit-setting.md new file mode 100644 index 00000000000..fe6e44aa88f --- /dev/null +++ b/.changeset/35498-standard-unit-setting.md @@ -0,0 +1,19 @@ +--- +'@objectstack/spec': patch +'@objectstack/platform-objects': patch +'@objectstack/plugin-security': patch +'@objectstack/cli': patch +--- + +feat(platform-objects): an organization sets how many decimal places each standard unit of measure displays with (`sys_standard_unit_setting`, ADR-0158 U6) + +Clause-②: yes (widening) +Metadata-protocol: none + +An organization administrator can now give any standard unit of measure (UN/ECE Recommendation 20 codes such as `KGM` or `H87`) its own display decimal places, for example 3 for grams at a jeweller or 0 for kilograms at a gravel yard. The value lives in the new organization-owned object `sys_standard_unit_setting` (Setup → Configuration → Standard Unit Settings): one row per standard code, `decimal_places` a whole number from 0 to 12. Deleting the row clears the setting. The organization's own units keep their decimal places on their own `sys_unit` row. + +- Every member reads the settings (`member_default`, read only); organization administrators and owners create, edit and delete them (`organization_admin`). External members get no read, as with `sys_unit`. +- `organization_id` is injected, so the tenant wall scopes every read and write; another organization's setting is never read. +- Every set, change and clear is written to `sys_audit_log`, with field history on both columns. +- The value is a display default only (ADR-0158 L4): a field's own `scale` stays the storage ceiling, and nothing is rounded at write by it. No reader ships in this change; the quantity display reads it. +- Like an exchange rate, a setting is a record the organization owns, so an organization delete is refused (`DELETE_RESTRICTED`) until its settings are deleted. diff --git a/packages/platform-objects/src/apps/translations/ar.objects.generated.ts b/packages/platform-objects/src/apps/translations/ar.objects.generated.ts index 0457bcddfdc..05a44a4918a 100644 --- a/packages/platform-objects/src/apps/translations/ar.objects.generated.ts +++ b/packages/platform-objects/src/apps/translations/ar.objects.generated.ts @@ -4505,6 +4505,42 @@ export const arObjects: NonNullable = { } } }, + sys_standard_unit_setting: { + label: "Standard Unit Setting", + pluralLabel: "Standard Unit Settings", + description: "How many decimal places a quantity in a standard unit of measure (KGM, H87, …) displays with in this organization — one row per standard unit the organization has set.", + fields: { + id: { + label: "ID" + }, + code: { + label: "Standard Unit", + help: "The standard unit code (UN/ECE Recommendation 20) in exact uppercase, for example KGM for kilogram, GRM for gram or H87 for piece. The organization's own units carry their decimal places on the unit itself, under Units of Measure. The code cannot be changed after the setting is created." + }, + decimal_places: { + label: "Decimal Places", + help: "How many decimal places a quantity in this unit displays with by default. It never rounds a stored value, and a field's own decimal places still limit what is stored and shown. Delete the setting to clear it." + } + }, + _views: { + all_settings: { + label: "All", + description: "Decimal places a quantity in a standard unit displays with in this organization. A field's own decimal places still limit what is stored and shown.", + emptyState: { + title: "No standard unit settings yet", + message: "Standard units display with the decimal places of the field that holds the quantity. Add a setting to give a standard unit, such as grams or kilograms, its own number of decimal places." + } + } + }, + _validations: { + standard_unit_setting_code_standard: { + message: "Enter a standard unit code in exact uppercase, for example KGM or H87. An organization's own unit carries its decimal places on the unit itself, under Units of Measure." + }, + standard_unit_setting_code_immutable: { + message: "A setting's unit cannot be changed after it is created. Delete it and add a setting for the other unit instead." + } + } + }, sys_work_calendar: { label: "تقويم العمل", pluralLabel: "تقويمات العمل", diff --git a/packages/platform-objects/src/apps/translations/ar.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/ar.source-hashes.generated.ts index 07b4512dc20..994dfe6f133 100644 --- a/packages/platform-objects/src/apps/translations/ar.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/ar.source-hashes.generated.ts @@ -123,6 +123,20 @@ export const arGeneratedSourceHashes: Readonly> = { "objects.sys_sso_provider._actions.register_sso_provider.params.tokenEndpoint.label": "7cba958c95cef146", "objects.sys_sso_provider.fields.sign_out_of_idp.help": "ab8ff5fce3001c81", "objects.sys_sso_provider.fields.sign_out_of_idp.label": "212587b8191bb91b", + "objects.sys_standard_unit_setting._validations.standard_unit_setting_code_immutable.message": "30dca7b5af0102a7", + "objects.sys_standard_unit_setting._validations.standard_unit_setting_code_standard.message": "b8d744ecf7e2fd14", + "objects.sys_standard_unit_setting._views.all_settings.description": "b2c6e313dfbaab6f", + "objects.sys_standard_unit_setting._views.all_settings.emptyState.message": "4973c431bef4fb16", + "objects.sys_standard_unit_setting._views.all_settings.emptyState.title": "c744be790895b52b", + "objects.sys_standard_unit_setting._views.all_settings.label": "6d6f653f8264ab17", + "objects.sys_standard_unit_setting.description": "8be70d71b4824c8a", + "objects.sys_standard_unit_setting.fields.code.help": "171e0116c9d1a103", + "objects.sys_standard_unit_setting.fields.code.label": "8101f71ea11455f1", + "objects.sys_standard_unit_setting.fields.decimal_places.help": "8f87ae85775e6bb4", + "objects.sys_standard_unit_setting.fields.decimal_places.label": "c376c70ccdda79b3", + "objects.sys_standard_unit_setting.fields.id.label": "00b0385c9c152888", + "objects.sys_standard_unit_setting.label": "97ace8a464552c96", + "objects.sys_standard_unit_setting.pluralLabel": "507e2db8f56dcaf0", "objects.sys_unit._validations.unit_code_immutable.message": "c8ce340a53339ba2", "objects.sys_unit._validations.unit_code_organization_namespace.message": "a1feea8fefab1228", "objects.sys_unit._validations.unit_dimension_immutable.message": "b12c97027d369d60", diff --git a/packages/platform-objects/src/apps/translations/de.objects.generated.ts b/packages/platform-objects/src/apps/translations/de.objects.generated.ts index 44f0e08dc90..3f6618da5f4 100644 --- a/packages/platform-objects/src/apps/translations/de.objects.generated.ts +++ b/packages/platform-objects/src/apps/translations/de.objects.generated.ts @@ -4505,6 +4505,42 @@ export const deObjects: NonNullable = { } } }, + sys_standard_unit_setting: { + label: "Standard Unit Setting", + pluralLabel: "Standard Unit Settings", + description: "How many decimal places a quantity in a standard unit of measure (KGM, H87, …) displays with in this organization — one row per standard unit the organization has set.", + fields: { + id: { + label: "ID" + }, + code: { + label: "Standard Unit", + help: "The standard unit code (UN/ECE Recommendation 20) in exact uppercase, for example KGM for kilogram, GRM for gram or H87 for piece. The organization's own units carry their decimal places on the unit itself, under Units of Measure. The code cannot be changed after the setting is created." + }, + decimal_places: { + label: "Decimal Places", + help: "How many decimal places a quantity in this unit displays with by default. It never rounds a stored value, and a field's own decimal places still limit what is stored and shown. Delete the setting to clear it." + } + }, + _views: { + all_settings: { + label: "All", + description: "Decimal places a quantity in a standard unit displays with in this organization. A field's own decimal places still limit what is stored and shown.", + emptyState: { + title: "No standard unit settings yet", + message: "Standard units display with the decimal places of the field that holds the quantity. Add a setting to give a standard unit, such as grams or kilograms, its own number of decimal places." + } + } + }, + _validations: { + standard_unit_setting_code_standard: { + message: "Enter a standard unit code in exact uppercase, for example KGM or H87. An organization's own unit carries its decimal places on the unit itself, under Units of Measure." + }, + standard_unit_setting_code_immutable: { + message: "A setting's unit cannot be changed after it is created. Delete it and add a setting for the other unit instead." + } + } + }, sys_work_calendar: { label: "Arbeitskalender", pluralLabel: "Arbeitskalender", diff --git a/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts index 284a4e2c27e..f83bb1bd045 100644 --- a/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts @@ -269,6 +269,20 @@ export const deGeneratedSourceHashes: Readonly> = { "objects.sys_sso_provider.fields.id.label": "00b0385c9c152888", "objects.sys_sso_provider.fields.sign_out_of_idp.help": "ab8ff5fce3001c81", "objects.sys_sso_provider.fields.sign_out_of_idp.label": "212587b8191bb91b", + "objects.sys_standard_unit_setting._validations.standard_unit_setting_code_immutable.message": "30dca7b5af0102a7", + "objects.sys_standard_unit_setting._validations.standard_unit_setting_code_standard.message": "b8d744ecf7e2fd14", + "objects.sys_standard_unit_setting._views.all_settings.description": "b2c6e313dfbaab6f", + "objects.sys_standard_unit_setting._views.all_settings.emptyState.message": "4973c431bef4fb16", + "objects.sys_standard_unit_setting._views.all_settings.emptyState.title": "c744be790895b52b", + "objects.sys_standard_unit_setting._views.all_settings.label": "6d6f653f8264ab17", + "objects.sys_standard_unit_setting.description": "8be70d71b4824c8a", + "objects.sys_standard_unit_setting.fields.code.help": "171e0116c9d1a103", + "objects.sys_standard_unit_setting.fields.code.label": "8101f71ea11455f1", + "objects.sys_standard_unit_setting.fields.decimal_places.help": "8f87ae85775e6bb4", + "objects.sys_standard_unit_setting.fields.decimal_places.label": "c376c70ccdda79b3", + "objects.sys_standard_unit_setting.fields.id.label": "00b0385c9c152888", + "objects.sys_standard_unit_setting.label": "97ace8a464552c96", + "objects.sys_standard_unit_setting.pluralLabel": "507e2db8f56dcaf0", "objects.sys_task.fields.status.label": "64a420165247654b", "objects.sys_team.fields.name.label": "5274417ff1ccaf01", "objects.sys_team.label": "42b87165ac826b2b", diff --git a/packages/platform-objects/src/apps/translations/en.objects.generated.ts b/packages/platform-objects/src/apps/translations/en.objects.generated.ts index 6bd9c22e800..9518be3c18c 100644 --- a/packages/platform-objects/src/apps/translations/en.objects.generated.ts +++ b/packages/platform-objects/src/apps/translations/en.objects.generated.ts @@ -4505,6 +4505,42 @@ export const enObjects: NonNullable = { } } }, + sys_standard_unit_setting: { + label: "Standard Unit Setting", + pluralLabel: "Standard Unit Settings", + description: "How many decimal places a quantity in a standard unit of measure (KGM, H87, …) displays with in this organization — one row per standard unit the organization has set.", + fields: { + id: { + label: "ID" + }, + code: { + label: "Standard Unit", + help: "The standard unit code (UN/ECE Recommendation 20) in exact uppercase, for example KGM for kilogram, GRM for gram or H87 for piece. The organization's own units carry their decimal places on the unit itself, under Units of Measure. The code cannot be changed after the setting is created." + }, + decimal_places: { + label: "Decimal Places", + help: "How many decimal places a quantity in this unit displays with by default. It never rounds a stored value, and a field's own decimal places still limit what is stored and shown. Delete the setting to clear it." + } + }, + _views: { + all_settings: { + label: "All", + description: "Decimal places a quantity in a standard unit displays with in this organization. A field's own decimal places still limit what is stored and shown.", + emptyState: { + title: "No standard unit settings yet", + message: "Standard units display with the decimal places of the field that holds the quantity. Add a setting to give a standard unit, such as grams or kilograms, its own number of decimal places." + } + } + }, + _validations: { + standard_unit_setting_code_standard: { + message: "Enter a standard unit code in exact uppercase, for example KGM or H87. An organization's own unit carries its decimal places on the unit itself, under Units of Measure." + }, + standard_unit_setting_code_immutable: { + message: "A setting's unit cannot be changed after it is created. Delete it and add a setting for the other unit instead." + } + } + }, sys_work_calendar: { label: "Working Calendar", pluralLabel: "Working Calendars", diff --git a/packages/platform-objects/src/apps/translations/es-ES.objects.generated.ts b/packages/platform-objects/src/apps/translations/es-ES.objects.generated.ts index 17acdc29926..9cfb6b71e7d 100644 --- a/packages/platform-objects/src/apps/translations/es-ES.objects.generated.ts +++ b/packages/platform-objects/src/apps/translations/es-ES.objects.generated.ts @@ -4505,6 +4505,42 @@ export const esESObjects: NonNullable = { } } }, + sys_standard_unit_setting: { + label: "Standard Unit Setting", + pluralLabel: "Standard Unit Settings", + description: "How many decimal places a quantity in a standard unit of measure (KGM, H87, …) displays with in this organization — one row per standard unit the organization has set.", + fields: { + id: { + label: "ID" + }, + code: { + label: "Standard Unit", + help: "The standard unit code (UN/ECE Recommendation 20) in exact uppercase, for example KGM for kilogram, GRM for gram or H87 for piece. The organization's own units carry their decimal places on the unit itself, under Units of Measure. The code cannot be changed after the setting is created." + }, + decimal_places: { + label: "Decimal Places", + help: "How many decimal places a quantity in this unit displays with by default. It never rounds a stored value, and a field's own decimal places still limit what is stored and shown. Delete the setting to clear it." + } + }, + _views: { + all_settings: { + label: "All", + description: "Decimal places a quantity in a standard unit displays with in this organization. A field's own decimal places still limit what is stored and shown.", + emptyState: { + title: "No standard unit settings yet", + message: "Standard units display with the decimal places of the field that holds the quantity. Add a setting to give a standard unit, such as grams or kilograms, its own number of decimal places." + } + } + }, + _validations: { + standard_unit_setting_code_standard: { + message: "Enter a standard unit code in exact uppercase, for example KGM or H87. An organization's own unit carries its decimal places on the unit itself, under Units of Measure." + }, + standard_unit_setting_code_immutable: { + message: "A setting's unit cannot be changed after it is created. Delete it and add a setting for the other unit instead." + } + } + }, sys_work_calendar: { label: "Calendario laboral", pluralLabel: "Calendarios laborales", diff --git a/packages/platform-objects/src/apps/translations/es-ES.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/es-ES.source-hashes.generated.ts index 16a789fc601..7824b427eaa 100644 --- a/packages/platform-objects/src/apps/translations/es-ES.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/es-ES.source-hashes.generated.ts @@ -159,6 +159,20 @@ export const esESGeneratedSourceHashes: Readonly> = { "objects.sys_sso_provider.fields.id.label": "00b0385c9c152888", "objects.sys_sso_provider.fields.sign_out_of_idp.help": "ab8ff5fce3001c81", "objects.sys_sso_provider.fields.sign_out_of_idp.label": "212587b8191bb91b", + "objects.sys_standard_unit_setting._validations.standard_unit_setting_code_immutable.message": "30dca7b5af0102a7", + "objects.sys_standard_unit_setting._validations.standard_unit_setting_code_standard.message": "b8d744ecf7e2fd14", + "objects.sys_standard_unit_setting._views.all_settings.description": "b2c6e313dfbaab6f", + "objects.sys_standard_unit_setting._views.all_settings.emptyState.message": "4973c431bef4fb16", + "objects.sys_standard_unit_setting._views.all_settings.emptyState.title": "c744be790895b52b", + "objects.sys_standard_unit_setting._views.all_settings.label": "6d6f653f8264ab17", + "objects.sys_standard_unit_setting.description": "8be70d71b4824c8a", + "objects.sys_standard_unit_setting.fields.code.help": "171e0116c9d1a103", + "objects.sys_standard_unit_setting.fields.code.label": "8101f71ea11455f1", + "objects.sys_standard_unit_setting.fields.decimal_places.help": "8f87ae85775e6bb4", + "objects.sys_standard_unit_setting.fields.decimal_places.label": "c376c70ccdda79b3", + "objects.sys_standard_unit_setting.fields.id.label": "00b0385c9c152888", + "objects.sys_standard_unit_setting.label": "97ace8a464552c96", + "objects.sys_standard_unit_setting.pluralLabel": "507e2db8f56dcaf0", "objects.sys_unit._validations.unit_code_immutable.message": "c8ce340a53339ba2", "objects.sys_unit._validations.unit_code_organization_namespace.message": "a1feea8fefab1228", "objects.sys_unit._validations.unit_dimension_immutable.message": "b12c97027d369d60", diff --git a/packages/platform-objects/src/apps/translations/fr.objects.generated.ts b/packages/platform-objects/src/apps/translations/fr.objects.generated.ts index 994aea2b413..5c0ebf7be78 100644 --- a/packages/platform-objects/src/apps/translations/fr.objects.generated.ts +++ b/packages/platform-objects/src/apps/translations/fr.objects.generated.ts @@ -4505,6 +4505,42 @@ export const frObjects: NonNullable = { } } }, + sys_standard_unit_setting: { + label: "Standard Unit Setting", + pluralLabel: "Standard Unit Settings", + description: "How many decimal places a quantity in a standard unit of measure (KGM, H87, …) displays with in this organization — one row per standard unit the organization has set.", + fields: { + id: { + label: "ID" + }, + code: { + label: "Standard Unit", + help: "The standard unit code (UN/ECE Recommendation 20) in exact uppercase, for example KGM for kilogram, GRM for gram or H87 for piece. The organization's own units carry their decimal places on the unit itself, under Units of Measure. The code cannot be changed after the setting is created." + }, + decimal_places: { + label: "Decimal Places", + help: "How many decimal places a quantity in this unit displays with by default. It never rounds a stored value, and a field's own decimal places still limit what is stored and shown. Delete the setting to clear it." + } + }, + _views: { + all_settings: { + label: "All", + description: "Decimal places a quantity in a standard unit displays with in this organization. A field's own decimal places still limit what is stored and shown.", + emptyState: { + title: "No standard unit settings yet", + message: "Standard units display with the decimal places of the field that holds the quantity. Add a setting to give a standard unit, such as grams or kilograms, its own number of decimal places." + } + } + }, + _validations: { + standard_unit_setting_code_standard: { + message: "Enter a standard unit code in exact uppercase, for example KGM or H87. An organization's own unit carries its decimal places on the unit itself, under Units of Measure." + }, + standard_unit_setting_code_immutable: { + message: "A setting's unit cannot be changed after it is created. Delete it and add a setting for the other unit instead." + } + } + }, sys_work_calendar: { label: "Calendrier de travail", pluralLabel: "Calendriers de travail", diff --git a/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts index 50c90b529e7..9042e6b4b19 100644 --- a/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts @@ -306,6 +306,20 @@ export const frGeneratedSourceHashes: Readonly> = { "objects.sys_sso_provider.fields.id.label": "00b0385c9c152888", "objects.sys_sso_provider.fields.sign_out_of_idp.help": "ab8ff5fce3001c81", "objects.sys_sso_provider.fields.sign_out_of_idp.label": "212587b8191bb91b", + "objects.sys_standard_unit_setting._validations.standard_unit_setting_code_immutable.message": "30dca7b5af0102a7", + "objects.sys_standard_unit_setting._validations.standard_unit_setting_code_standard.message": "b8d744ecf7e2fd14", + "objects.sys_standard_unit_setting._views.all_settings.description": "b2c6e313dfbaab6f", + "objects.sys_standard_unit_setting._views.all_settings.emptyState.message": "4973c431bef4fb16", + "objects.sys_standard_unit_setting._views.all_settings.emptyState.title": "c744be790895b52b", + "objects.sys_standard_unit_setting._views.all_settings.label": "6d6f653f8264ab17", + "objects.sys_standard_unit_setting.description": "8be70d71b4824c8a", + "objects.sys_standard_unit_setting.fields.code.help": "171e0116c9d1a103", + "objects.sys_standard_unit_setting.fields.code.label": "8101f71ea11455f1", + "objects.sys_standard_unit_setting.fields.decimal_places.help": "8f87ae85775e6bb4", + "objects.sys_standard_unit_setting.fields.decimal_places.label": "c376c70ccdda79b3", + "objects.sys_standard_unit_setting.fields.id.label": "00b0385c9c152888", + "objects.sys_standard_unit_setting.label": "97ace8a464552c96", + "objects.sys_standard_unit_setting.pluralLabel": "507e2db8f56dcaf0", "objects.sys_task.fields.description.label": "779a4342c8eb6707", "objects.sys_two_factor.fields.secret.label": "03cb32e33fa5cc45", "objects.sys_unit._validations.unit_code_immutable.message": "c8ce340a53339ba2", diff --git a/packages/platform-objects/src/apps/translations/ja-JP.objects.generated.ts b/packages/platform-objects/src/apps/translations/ja-JP.objects.generated.ts index b917253f294..e046d846bfa 100644 --- a/packages/platform-objects/src/apps/translations/ja-JP.objects.generated.ts +++ b/packages/platform-objects/src/apps/translations/ja-JP.objects.generated.ts @@ -4505,6 +4505,42 @@ export const jaJPObjects: NonNullable = { } } }, + sys_standard_unit_setting: { + label: "Standard Unit Setting", + pluralLabel: "Standard Unit Settings", + description: "How many decimal places a quantity in a standard unit of measure (KGM, H87, …) displays with in this organization — one row per standard unit the organization has set.", + fields: { + id: { + label: "ID" + }, + code: { + label: "Standard Unit", + help: "The standard unit code (UN/ECE Recommendation 20) in exact uppercase, for example KGM for kilogram, GRM for gram or H87 for piece. The organization's own units carry their decimal places on the unit itself, under Units of Measure. The code cannot be changed after the setting is created." + }, + decimal_places: { + label: "Decimal Places", + help: "How many decimal places a quantity in this unit displays with by default. It never rounds a stored value, and a field's own decimal places still limit what is stored and shown. Delete the setting to clear it." + } + }, + _views: { + all_settings: { + label: "All", + description: "Decimal places a quantity in a standard unit displays with in this organization. A field's own decimal places still limit what is stored and shown.", + emptyState: { + title: "No standard unit settings yet", + message: "Standard units display with the decimal places of the field that holds the quantity. Add a setting to give a standard unit, such as grams or kilograms, its own number of decimal places." + } + } + }, + _validations: { + standard_unit_setting_code_standard: { + message: "Enter a standard unit code in exact uppercase, for example KGM or H87. An organization's own unit carries its decimal places on the unit itself, under Units of Measure." + }, + standard_unit_setting_code_immutable: { + message: "A setting's unit cannot be changed after it is created. Delete it and add a setting for the other unit instead." + } + } + }, sys_work_calendar: { label: "稼働カレンダー", pluralLabel: "稼働カレンダー", diff --git a/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.generated.ts index 45d2394e914..601a8fc4340 100644 --- a/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.generated.ts @@ -149,6 +149,20 @@ export const jaJPGeneratedSourceHashes: Readonly> = { "objects.sys_sso_provider.fields.id.label": "00b0385c9c152888", "objects.sys_sso_provider.fields.sign_out_of_idp.help": "ab8ff5fce3001c81", "objects.sys_sso_provider.fields.sign_out_of_idp.label": "212587b8191bb91b", + "objects.sys_standard_unit_setting._validations.standard_unit_setting_code_immutable.message": "30dca7b5af0102a7", + "objects.sys_standard_unit_setting._validations.standard_unit_setting_code_standard.message": "b8d744ecf7e2fd14", + "objects.sys_standard_unit_setting._views.all_settings.description": "b2c6e313dfbaab6f", + "objects.sys_standard_unit_setting._views.all_settings.emptyState.message": "4973c431bef4fb16", + "objects.sys_standard_unit_setting._views.all_settings.emptyState.title": "c744be790895b52b", + "objects.sys_standard_unit_setting._views.all_settings.label": "6d6f653f8264ab17", + "objects.sys_standard_unit_setting.description": "8be70d71b4824c8a", + "objects.sys_standard_unit_setting.fields.code.help": "171e0116c9d1a103", + "objects.sys_standard_unit_setting.fields.code.label": "8101f71ea11455f1", + "objects.sys_standard_unit_setting.fields.decimal_places.help": "8f87ae85775e6bb4", + "objects.sys_standard_unit_setting.fields.decimal_places.label": "c376c70ccdda79b3", + "objects.sys_standard_unit_setting.fields.id.label": "00b0385c9c152888", + "objects.sys_standard_unit_setting.label": "97ace8a464552c96", + "objects.sys_standard_unit_setting.pluralLabel": "507e2db8f56dcaf0", "objects.sys_unit._validations.unit_code_immutable.message": "c8ce340a53339ba2", "objects.sys_unit._validations.unit_code_organization_namespace.message": "a1feea8fefab1228", "objects.sys_unit._validations.unit_dimension_immutable.message": "b12c97027d369d60", diff --git a/packages/platform-objects/src/apps/translations/ko.objects.generated.ts b/packages/platform-objects/src/apps/translations/ko.objects.generated.ts index 15bca878780..8483607bf1f 100644 --- a/packages/platform-objects/src/apps/translations/ko.objects.generated.ts +++ b/packages/platform-objects/src/apps/translations/ko.objects.generated.ts @@ -4505,6 +4505,42 @@ export const koObjects: NonNullable = { } } }, + sys_standard_unit_setting: { + label: "Standard Unit Setting", + pluralLabel: "Standard Unit Settings", + description: "How many decimal places a quantity in a standard unit of measure (KGM, H87, …) displays with in this organization — one row per standard unit the organization has set.", + fields: { + id: { + label: "ID" + }, + code: { + label: "Standard Unit", + help: "The standard unit code (UN/ECE Recommendation 20) in exact uppercase, for example KGM for kilogram, GRM for gram or H87 for piece. The organization's own units carry their decimal places on the unit itself, under Units of Measure. The code cannot be changed after the setting is created." + }, + decimal_places: { + label: "Decimal Places", + help: "How many decimal places a quantity in this unit displays with by default. It never rounds a stored value, and a field's own decimal places still limit what is stored and shown. Delete the setting to clear it." + } + }, + _views: { + all_settings: { + label: "All", + description: "Decimal places a quantity in a standard unit displays with in this organization. A field's own decimal places still limit what is stored and shown.", + emptyState: { + title: "No standard unit settings yet", + message: "Standard units display with the decimal places of the field that holds the quantity. Add a setting to give a standard unit, such as grams or kilograms, its own number of decimal places." + } + } + }, + _validations: { + standard_unit_setting_code_standard: { + message: "Enter a standard unit code in exact uppercase, for example KGM or H87. An organization's own unit carries its decimal places on the unit itself, under Units of Measure." + }, + standard_unit_setting_code_immutable: { + message: "A setting's unit cannot be changed after it is created. Delete it and add a setting for the other unit instead." + } + } + }, sys_work_calendar: { label: "근무 캘린더", pluralLabel: "근무 캘린더", diff --git a/packages/platform-objects/src/apps/translations/ko.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/ko.source-hashes.generated.ts index 8275f417b7a..c9103bde07a 100644 --- a/packages/platform-objects/src/apps/translations/ko.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/ko.source-hashes.generated.ts @@ -153,6 +153,20 @@ export const koGeneratedSourceHashes: Readonly> = { "objects.sys_sso_provider.fields.id.label": "00b0385c9c152888", "objects.sys_sso_provider.fields.sign_out_of_idp.help": "ab8ff5fce3001c81", "objects.sys_sso_provider.fields.sign_out_of_idp.label": "212587b8191bb91b", + "objects.sys_standard_unit_setting._validations.standard_unit_setting_code_immutable.message": "30dca7b5af0102a7", + "objects.sys_standard_unit_setting._validations.standard_unit_setting_code_standard.message": "b8d744ecf7e2fd14", + "objects.sys_standard_unit_setting._views.all_settings.description": "b2c6e313dfbaab6f", + "objects.sys_standard_unit_setting._views.all_settings.emptyState.message": "4973c431bef4fb16", + "objects.sys_standard_unit_setting._views.all_settings.emptyState.title": "c744be790895b52b", + "objects.sys_standard_unit_setting._views.all_settings.label": "6d6f653f8264ab17", + "objects.sys_standard_unit_setting.description": "8be70d71b4824c8a", + "objects.sys_standard_unit_setting.fields.code.help": "171e0116c9d1a103", + "objects.sys_standard_unit_setting.fields.code.label": "8101f71ea11455f1", + "objects.sys_standard_unit_setting.fields.decimal_places.help": "8f87ae85775e6bb4", + "objects.sys_standard_unit_setting.fields.decimal_places.label": "c376c70ccdda79b3", + "objects.sys_standard_unit_setting.fields.id.label": "00b0385c9c152888", + "objects.sys_standard_unit_setting.label": "97ace8a464552c96", + "objects.sys_standard_unit_setting.pluralLabel": "507e2db8f56dcaf0", "objects.sys_unit._validations.unit_code_immutable.message": "c8ce340a53339ba2", "objects.sys_unit._validations.unit_code_organization_namespace.message": "a1feea8fefab1228", "objects.sys_unit._validations.unit_dimension_immutable.message": "b12c97027d369d60", diff --git a/packages/platform-objects/src/apps/translations/pt-BR.objects.generated.ts b/packages/platform-objects/src/apps/translations/pt-BR.objects.generated.ts index fd78d06ff62..43f14a42b59 100644 --- a/packages/platform-objects/src/apps/translations/pt-BR.objects.generated.ts +++ b/packages/platform-objects/src/apps/translations/pt-BR.objects.generated.ts @@ -4505,6 +4505,42 @@ export const ptBRObjects: NonNullable = { } } }, + sys_standard_unit_setting: { + label: "Standard Unit Setting", + pluralLabel: "Standard Unit Settings", + description: "How many decimal places a quantity in a standard unit of measure (KGM, H87, …) displays with in this organization — one row per standard unit the organization has set.", + fields: { + id: { + label: "ID" + }, + code: { + label: "Standard Unit", + help: "The standard unit code (UN/ECE Recommendation 20) in exact uppercase, for example KGM for kilogram, GRM for gram or H87 for piece. The organization's own units carry their decimal places on the unit itself, under Units of Measure. The code cannot be changed after the setting is created." + }, + decimal_places: { + label: "Decimal Places", + help: "How many decimal places a quantity in this unit displays with by default. It never rounds a stored value, and a field's own decimal places still limit what is stored and shown. Delete the setting to clear it." + } + }, + _views: { + all_settings: { + label: "All", + description: "Decimal places a quantity in a standard unit displays with in this organization. A field's own decimal places still limit what is stored and shown.", + emptyState: { + title: "No standard unit settings yet", + message: "Standard units display with the decimal places of the field that holds the quantity. Add a setting to give a standard unit, such as grams or kilograms, its own number of decimal places." + } + } + }, + _validations: { + standard_unit_setting_code_standard: { + message: "Enter a standard unit code in exact uppercase, for example KGM or H87. An organization's own unit carries its decimal places on the unit itself, under Units of Measure." + }, + standard_unit_setting_code_immutable: { + message: "A setting's unit cannot be changed after it is created. Delete it and add a setting for the other unit instead." + } + } + }, sys_work_calendar: { label: "Calendário de trabalho", pluralLabel: "Calendários de trabalho", diff --git a/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.generated.ts index bc05572759b..d1924652a22 100644 --- a/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.generated.ts @@ -197,6 +197,20 @@ export const ptBRGeneratedSourceHashes: Readonly> = { "objects.sys_sso_provider.fields.id.label": "00b0385c9c152888", "objects.sys_sso_provider.fields.sign_out_of_idp.help": "ab8ff5fce3001c81", "objects.sys_sso_provider.fields.sign_out_of_idp.label": "212587b8191bb91b", + "objects.sys_standard_unit_setting._validations.standard_unit_setting_code_immutable.message": "30dca7b5af0102a7", + "objects.sys_standard_unit_setting._validations.standard_unit_setting_code_standard.message": "b8d744ecf7e2fd14", + "objects.sys_standard_unit_setting._views.all_settings.description": "b2c6e313dfbaab6f", + "objects.sys_standard_unit_setting._views.all_settings.emptyState.message": "4973c431bef4fb16", + "objects.sys_standard_unit_setting._views.all_settings.emptyState.title": "c744be790895b52b", + "objects.sys_standard_unit_setting._views.all_settings.label": "6d6f653f8264ab17", + "objects.sys_standard_unit_setting.description": "8be70d71b4824c8a", + "objects.sys_standard_unit_setting.fields.code.help": "171e0116c9d1a103", + "objects.sys_standard_unit_setting.fields.code.label": "8101f71ea11455f1", + "objects.sys_standard_unit_setting.fields.decimal_places.help": "8f87ae85775e6bb4", + "objects.sys_standard_unit_setting.fields.decimal_places.label": "c376c70ccdda79b3", + "objects.sys_standard_unit_setting.fields.id.label": "00b0385c9c152888", + "objects.sys_standard_unit_setting.label": "97ace8a464552c96", + "objects.sys_standard_unit_setting.pluralLabel": "507e2db8f56dcaf0", "objects.sys_task.fields.status.label": "64a420165247654b", "objects.sys_unit._validations.unit_code_immutable.message": "c8ce340a53339ba2", "objects.sys_unit._validations.unit_code_organization_namespace.message": "a1feea8fefab1228", diff --git a/packages/platform-objects/src/apps/translations/ru.objects.generated.ts b/packages/platform-objects/src/apps/translations/ru.objects.generated.ts index 1c699ea4f3f..6cae07ff061 100644 --- a/packages/platform-objects/src/apps/translations/ru.objects.generated.ts +++ b/packages/platform-objects/src/apps/translations/ru.objects.generated.ts @@ -4505,6 +4505,42 @@ export const ruObjects: NonNullable = { } } }, + sys_standard_unit_setting: { + label: "Standard Unit Setting", + pluralLabel: "Standard Unit Settings", + description: "How many decimal places a quantity in a standard unit of measure (KGM, H87, …) displays with in this organization — one row per standard unit the organization has set.", + fields: { + id: { + label: "ID" + }, + code: { + label: "Standard Unit", + help: "The standard unit code (UN/ECE Recommendation 20) in exact uppercase, for example KGM for kilogram, GRM for gram or H87 for piece. The organization's own units carry their decimal places on the unit itself, under Units of Measure. The code cannot be changed after the setting is created." + }, + decimal_places: { + label: "Decimal Places", + help: "How many decimal places a quantity in this unit displays with by default. It never rounds a stored value, and a field's own decimal places still limit what is stored and shown. Delete the setting to clear it." + } + }, + _views: { + all_settings: { + label: "All", + description: "Decimal places a quantity in a standard unit displays with in this organization. A field's own decimal places still limit what is stored and shown.", + emptyState: { + title: "No standard unit settings yet", + message: "Standard units display with the decimal places of the field that holds the quantity. Add a setting to give a standard unit, such as grams or kilograms, its own number of decimal places." + } + } + }, + _validations: { + standard_unit_setting_code_standard: { + message: "Enter a standard unit code in exact uppercase, for example KGM or H87. An organization's own unit carries its decimal places on the unit itself, under Units of Measure." + }, + standard_unit_setting_code_immutable: { + message: "A setting's unit cannot be changed after it is created. Delete it and add a setting for the other unit instead." + } + } + }, sys_work_calendar: { label: "Рабочий календарь", pluralLabel: "Рабочие календари", diff --git a/packages/platform-objects/src/apps/translations/ru.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/ru.source-hashes.generated.ts index 1c0e0ea0ef2..3d6a5f02c22 100644 --- a/packages/platform-objects/src/apps/translations/ru.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/ru.source-hashes.generated.ts @@ -152,6 +152,20 @@ export const ruGeneratedSourceHashes: Readonly> = { "objects.sys_sso_provider.fields.id.label": "00b0385c9c152888", "objects.sys_sso_provider.fields.sign_out_of_idp.help": "ab8ff5fce3001c81", "objects.sys_sso_provider.fields.sign_out_of_idp.label": "212587b8191bb91b", + "objects.sys_standard_unit_setting._validations.standard_unit_setting_code_immutable.message": "30dca7b5af0102a7", + "objects.sys_standard_unit_setting._validations.standard_unit_setting_code_standard.message": "b8d744ecf7e2fd14", + "objects.sys_standard_unit_setting._views.all_settings.description": "b2c6e313dfbaab6f", + "objects.sys_standard_unit_setting._views.all_settings.emptyState.message": "4973c431bef4fb16", + "objects.sys_standard_unit_setting._views.all_settings.emptyState.title": "c744be790895b52b", + "objects.sys_standard_unit_setting._views.all_settings.label": "6d6f653f8264ab17", + "objects.sys_standard_unit_setting.description": "8be70d71b4824c8a", + "objects.sys_standard_unit_setting.fields.code.help": "171e0116c9d1a103", + "objects.sys_standard_unit_setting.fields.code.label": "8101f71ea11455f1", + "objects.sys_standard_unit_setting.fields.decimal_places.help": "8f87ae85775e6bb4", + "objects.sys_standard_unit_setting.fields.decimal_places.label": "c376c70ccdda79b3", + "objects.sys_standard_unit_setting.fields.id.label": "00b0385c9c152888", + "objects.sys_standard_unit_setting.label": "97ace8a464552c96", + "objects.sys_standard_unit_setting.pluralLabel": "507e2db8f56dcaf0", "objects.sys_unit._validations.unit_code_immutable.message": "c8ce340a53339ba2", "objects.sys_unit._validations.unit_code_organization_namespace.message": "a1feea8fefab1228", "objects.sys_unit._validations.unit_dimension_immutable.message": "b12c97027d369d60", diff --git a/packages/platform-objects/src/apps/translations/zh-CN.objects.generated.ts b/packages/platform-objects/src/apps/translations/zh-CN.objects.generated.ts index 0df6dc105f2..c13c705661e 100644 --- a/packages/platform-objects/src/apps/translations/zh-CN.objects.generated.ts +++ b/packages/platform-objects/src/apps/translations/zh-CN.objects.generated.ts @@ -4505,6 +4505,42 @@ export const zhCNObjects: NonNullable = { } } }, + sys_standard_unit_setting: { + label: "标准单位设置", + pluralLabel: "标准单位设置", + description: "本组织中以标准计量单位(KGM、H87 等)表示的数量显示几位小数,组织设置过的每个标准单位一行。", + fields: { + id: { + label: "ID" + }, + code: { + label: "标准单位", + help: "标准单位编码(UN/ECE 第 20 号建议),须为大写,例如千克 KGM、克 GRM、件 H87。本组织自己的单位在「计量单位」中各自设置小数位。设置创建后不能更改编码。" + }, + decimal_places: { + label: "小数位", + help: "以此单位表示的数量默认显示几位小数。它不会对已存储的值做舍入,字段自身的小数位仍限制存储和显示的位数。删除这条设置即可清除。" + } + }, + _views: { + all_settings: { + label: "全部", + description: "本组织中以标准单位表示的数量显示的小数位。字段自身的小数位仍限制存储和显示的位数。", + emptyState: { + title: "暂无标准单位设置", + message: "标准单位按存放数量的字段的小数位显示。添加一条设置,可以为克、千克等标准单位指定自己的小数位。" + } + } + }, + _validations: { + standard_unit_setting_code_standard: { + message: "请输入大写的标准单位编码,例如 KGM 或 H87。本组织自己的单位在「计量单位」中各自设置小数位。" + }, + standard_unit_setting_code_immutable: { + message: "设置创建后不能更改单位。请删除它,再为另一个单位添加设置。" + } + } + }, sys_work_calendar: { label: "工作日历", pluralLabel: "工作日历", diff --git a/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.generated.ts index eee746ae3fc..e2e667bb54c 100644 --- a/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.generated.ts @@ -89,6 +89,7 @@ export const zhCNGeneratedSourceHashes: Readonly> = { "objects.sys_sso_provider.fields.id.label": "00b0385c9c152888", "objects.sys_sso_provider.fields.sign_out_of_idp.help": "ab8ff5fce3001c81", "objects.sys_sso_provider.fields.sign_out_of_idp.label": "212587b8191bb91b", + "objects.sys_standard_unit_setting.fields.id.label": "00b0385c9c152888", "objects.sys_unit.fields.id.label": "00b0385c9c152888", "objects.sys_user._actions.import_sso_users.params.csv.label": "bfb77802b66a9222", "objects.sys_user.fields.source.options.idp_pending": "3751093c5b65b072", diff --git a/packages/platform-objects/src/apps/translations/zh-Hant.objects.generated.ts b/packages/platform-objects/src/apps/translations/zh-Hant.objects.generated.ts index d7f6f26ee18..651d2b71e12 100644 --- a/packages/platform-objects/src/apps/translations/zh-Hant.objects.generated.ts +++ b/packages/platform-objects/src/apps/translations/zh-Hant.objects.generated.ts @@ -4505,6 +4505,42 @@ export const zhHantObjects: NonNullable = { } } }, + sys_standard_unit_setting: { + label: "Standard Unit Setting", + pluralLabel: "Standard Unit Settings", + description: "How many decimal places a quantity in a standard unit of measure (KGM, H87, …) displays with in this organization — one row per standard unit the organization has set.", + fields: { + id: { + label: "ID" + }, + code: { + label: "Standard Unit", + help: "The standard unit code (UN/ECE Recommendation 20) in exact uppercase, for example KGM for kilogram, GRM for gram or H87 for piece. The organization's own units carry their decimal places on the unit itself, under Units of Measure. The code cannot be changed after the setting is created." + }, + decimal_places: { + label: "Decimal Places", + help: "How many decimal places a quantity in this unit displays with by default. It never rounds a stored value, and a field's own decimal places still limit what is stored and shown. Delete the setting to clear it." + } + }, + _views: { + all_settings: { + label: "All", + description: "Decimal places a quantity in a standard unit displays with in this organization. A field's own decimal places still limit what is stored and shown.", + emptyState: { + title: "No standard unit settings yet", + message: "Standard units display with the decimal places of the field that holds the quantity. Add a setting to give a standard unit, such as grams or kilograms, its own number of decimal places." + } + } + }, + _validations: { + standard_unit_setting_code_standard: { + message: "Enter a standard unit code in exact uppercase, for example KGM or H87. An organization's own unit carries its decimal places on the unit itself, under Units of Measure." + }, + standard_unit_setting_code_immutable: { + message: "A setting's unit cannot be changed after it is created. Delete it and add a setting for the other unit instead." + } + } + }, sys_work_calendar: { label: "工作日曆", pluralLabel: "工作日曆", diff --git a/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.generated.ts index 2631dfc2a38..7f3c633dfe6 100644 --- a/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.generated.ts @@ -146,6 +146,20 @@ export const zhHantGeneratedSourceHashes: Readonly> = { "objects.sys_sso_provider.fields.id.label": "00b0385c9c152888", "objects.sys_sso_provider.fields.sign_out_of_idp.help": "ab8ff5fce3001c81", "objects.sys_sso_provider.fields.sign_out_of_idp.label": "212587b8191bb91b", + "objects.sys_standard_unit_setting._validations.standard_unit_setting_code_immutable.message": "30dca7b5af0102a7", + "objects.sys_standard_unit_setting._validations.standard_unit_setting_code_standard.message": "b8d744ecf7e2fd14", + "objects.sys_standard_unit_setting._views.all_settings.description": "b2c6e313dfbaab6f", + "objects.sys_standard_unit_setting._views.all_settings.emptyState.message": "4973c431bef4fb16", + "objects.sys_standard_unit_setting._views.all_settings.emptyState.title": "c744be790895b52b", + "objects.sys_standard_unit_setting._views.all_settings.label": "6d6f653f8264ab17", + "objects.sys_standard_unit_setting.description": "8be70d71b4824c8a", + "objects.sys_standard_unit_setting.fields.code.help": "171e0116c9d1a103", + "objects.sys_standard_unit_setting.fields.code.label": "8101f71ea11455f1", + "objects.sys_standard_unit_setting.fields.decimal_places.help": "8f87ae85775e6bb4", + "objects.sys_standard_unit_setting.fields.decimal_places.label": "c376c70ccdda79b3", + "objects.sys_standard_unit_setting.fields.id.label": "00b0385c9c152888", + "objects.sys_standard_unit_setting.label": "97ace8a464552c96", + "objects.sys_standard_unit_setting.pluralLabel": "507e2db8f56dcaf0", "objects.sys_unit._validations.unit_code_immutable.message": "c8ce340a53339ba2", "objects.sys_unit._validations.unit_code_organization_namespace.message": "a1feea8fefab1228", "objects.sys_unit._validations.unit_dimension_immutable.message": "b12c97027d369d60", diff --git a/packages/platform-objects/src/system/index.ts b/packages/platform-objects/src/system/index.ts index 3f76279c151..b87d6dbaebd 100644 --- a/packages/platform-objects/src/system/index.ts +++ b/packages/platform-objects/src/system/index.ts @@ -52,6 +52,7 @@ export { export { SysStandardUnitSetting, STANDARD_UNIT_SETTING_CODES, + STANDARD_UNIT_SETTING_CODE_PATTERN, } from './sys-standard-unit-setting.object.js'; // [ADR-0157 D1] Working calendars and their dated exceptions, read by the // calendar service (`@objectstack/objectql`). diff --git a/packages/platform-objects/src/system/sys-standard-unit-setting.object.test.ts b/packages/platform-objects/src/system/sys-standard-unit-setting.object.test.ts index 7603454d727..c5452509811 100644 --- a/packages/platform-objects/src/system/sys-standard-unit-setting.object.test.ts +++ b/packages/platform-objects/src/system/sys-standard-unit-setting.object.test.ts @@ -11,7 +11,11 @@ import { resolveInjectedSystemColumns, } from '@objectstack/spec/data'; import { PLATFORM_OBJECTS_BY_PACKAGE } from '@objectstack/spec/system'; -import { SysStandardUnitSetting, STANDARD_UNIT_SETTING_CODES } from './sys-standard-unit-setting.object.js'; +import { + SysStandardUnitSetting, + STANDARD_UNIT_SETTING_CODES, + STANDARD_UNIT_SETTING_CODE_PATTERN, +} from './sys-standard-unit-setting.object.js'; import { SysUnit, UNIT_DECIMAL_PLACES_MAX } from './sys-unit.object.js'; import { SETUP_NAV_CONTRIBUTIONS } from '../apps/setup-nav.contributions.js'; import { PlatformObjectsPlugin } from '../plugin.js'; @@ -43,12 +47,17 @@ describe('sys_standard_unit_setting — declaration (ADR-0158 U6, Open item 10)' }); describe('values', () => { - it("code is a select over exactly the standard unit table's codes, in its order (U1)", () => { - expect(fields.code.type).toBe('select'); - expect(fields.code.options.map((o: any) => o.value)).toEqual(Object.keys(STANDARD_UNITS)); + it("code is text admitted only by a format rule over exactly the standard unit table's codes (U1)", () => { + expect(fields.code.type).toBe('text'); + expect(fields.code.maxLength).toBe(3); expect(STANDARD_UNIT_SETTING_CODES).toEqual(Object.keys(STANDARD_UNITS)); - // An organization's own unit carries its decimal places on its own row (U3, U6). - expect(fields.code.options.map((o: any) => o.value)).not.toContain('BOX_12'); + const format = rules.find((r) => r.name === 'standard_unit_setting_code_standard'); + expect(format).toMatchObject({ type: 'format', field: 'code', severity: 'error', regex: STANDARD_UNIT_SETTING_CODE_PATTERN }); + const re = new RegExp(format!.regex); + for (const code of Object.keys(STANDARD_UNITS)) expect(re.test(code), code).toBe(true); + // Exact uppercase (U4), no near-synonym of piece (U2), and no + // organization code: an org unit carries its decimal places on its own row. + for (const code of ['kgm', 'Kgm', 'C62', 'EA', 'BOX_12', 'JIN1', 'KGMX', ' KGM', '']) expect(re.test(code), code).toBe(false); }); it("decimal_places is a whole number from 0 to 12, sys_unit's range, with no default (U6, L4)", () => { @@ -124,8 +133,8 @@ describe('sys_standard_unit_setting — declaration (ADR-0158 U6, Open item 10)' }; const ROW = { code: 'GRM', decimal_places: 3 }; - it('is the one rule, update-only, attached to code', () => { - expect(rules.map((r) => r.name)).toEqual(['standard_unit_setting_code_immutable']); + it('is an update-only rule attached to code, beside the format rule', () => { + expect(rules.map((r) => r.name)).toEqual(['standard_unit_setting_code_standard', 'standard_unit_setting_code_immutable']); expect(rule).toMatchObject({ type: 'cross_field', events: ['update'], fields: ['code'], severity: 'error' }); }); diff --git a/packages/platform-objects/src/system/sys-standard-unit-setting.object.ts b/packages/platform-objects/src/system/sys-standard-unit-setting.object.ts index 684ff073a58..2ac56135ea3 100644 --- a/packages/platform-objects/src/system/sys-standard-unit-setting.object.ts +++ b/packages/platform-objects/src/system/sys-standard-unit-setting.object.ts @@ -6,11 +6,18 @@ import { UNIT_DECIMAL_PLACES_MAX } from './sys-unit.object.js'; /** * The codes a row may name: every key of the standard unit table (ADR-0158 * U1), in its order. Read from the table, so a code the table gains is - * selectable here with no second edit, and a code it never held is refused - * by the select's closed option set. + * admitted here with no second edit. */ export const STANDARD_UNIT_SETTING_CODES: readonly string[] = Object.freeze(Object.keys(STANDARD_UNITS)); +/** + * The format rule's pattern: exactly one standard code, in exact uppercase, as + * a quantity stores it (U4). A `text` column with this rule, not a `select`: + * a select's option values are stored lowercase, and a unit code is stored in + * exact uppercase everywhere it appears. + */ +export const STANDARD_UNIT_SETTING_CODE_PATTERN = `^(?:${STANDARD_UNIT_SETTING_CODES.join('|')})$`; + /** * sys_standard_unit_setting — Standard Unit Setting (ADR-0158 U6, its Open * item 10 answered by the maintainer's option A 「组织可改,新开一处设置」) @@ -23,10 +30,11 @@ export const STANDARD_UNIT_SETTING_CODES: readonly string[] = Object.freeze(Obje * platform ships zero rows: a standard unit with no row has no display * default of its own (U1 names none). * - * - **Code** — one of the standard table's codes - * ({@link STANDARD_UNIT_SETTING_CODES}). Unique within the organization and - * immutable after create: a row is the setting OF that code, so a wrong code - * is corrected by deleting the row and adding the right one. + * - **Code** — one of the standard table's codes in exact uppercase + * ({@link STANDARD_UNIT_SETTING_CODE_PATTERN}), as a quantity stores it. + * Unique within the organization and immutable after create: a row is the + * setting OF that code, so a wrong code is corrected by deleting the row + * and adding the right one. * - **Decimal places** — the unit's display default (U6), a whole number from * 0 to {@link UNIT_DECIMAL_PLACES_MAX}, the same range as `sys_unit`'s * column. Never a storage rule (L4): the field's own `scale` is the ceiling, @@ -72,20 +80,18 @@ export const SysStandardUnitSetting = ObjectSchema.create({ fields: { id: Field.text({ label: 'ID', required: true, readonly: true, group: 'System' }), - code: Field.select( - STANDARD_UNIT_SETTING_CODES.map((value) => ({ value, label: value })), - { - label: 'Standard Unit', - required: true, - searchable: true, - trackHistory: true, - description: - 'The standard unit code (UN/ECE Recommendation 20), for example KGM for kilogram or H87 for piece. ' + - "The organization's own units carry their decimal places on the unit itself, under Units of Measure. " + - 'The code cannot be changed after the setting is created.', - group: 'Unit', - }, - ), + code: Field.text({ + label: 'Standard Unit', + required: true, + searchable: true, + maxLength: 3, + trackHistory: true, + description: + 'The standard unit code (UN/ECE Recommendation 20) in exact uppercase, for example KGM for kilogram, GRM for gram or H87 for piece. ' + + "The organization's own units carry their decimal places on the unit itself, under Units of Measure. " + + 'The code cannot be changed after the setting is created.', + group: 'Unit', + }), decimal_places: Field.number({ label: 'Decimal Places', @@ -108,6 +114,18 @@ export const SysStandardUnitSetting = ObjectSchema.create({ // `validations` is the server-enforced channel: objectql's rule validator runs // it on insert, by-id update and bulk update (ADR-0049 declared = enforced). validations: [ + { + // U1: one of the standard table's codes, in exact uppercase. An absent + // value is left to `required`. + type: 'format', + name: 'standard_unit_setting_code_standard', + field: 'code', + regex: STANDARD_UNIT_SETTING_CODE_PATTERN, + severity: 'error', + message: + 'Enter a standard unit code in exact uppercase, for example KGM or H87. ' + + "An organization's own unit carries its decimal places on the unit itself, under Units of Measure.", + }, { // A row is the setting of its code: the code is immutable after create. // `cross_field` so the refusal is attached to the field it is about. diff --git a/packages/plugins/plugin-security/src/default-permission-sets.standard-unit-setting.integration.test.ts b/packages/plugins/plugin-security/src/default-permission-sets.standard-unit-setting.integration.test.ts new file mode 100644 index 00000000000..c9f762737c7 --- /dev/null +++ b/packages/plugins/plugin-security/src/default-permission-sets.standard-unit-setting.integration.test.ts @@ -0,0 +1,292 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * [ADR-0158 U6; Open item 10, option A 「组织可改,新开一处设置」] Who sets, + * reads and clears an organization's display decimal places for a standard + * unit code, on a real stack: + * + * - the REAL `SecurityPlugin` with the shipped permission sets, so a member's + * read comes from `member_default`'s `sys_standard_unit_setting` line and + * an administrator's writes from `organization_admin`'s; + * - the REAL `sys_standard_unit_setting` object + * (`@objectstack/platform-objects`), so its organization-scoped unique key, + * its closed code set, its range and its rule are what the engine enforces; + * - the REAL `AuditPlugin`, so every set, change and clear lands in + * `sys_audit_log`; + * - the REAL caller resolution (`resolveAuthzContext`, then + * `assembleExecutionContext`) over the identity rows seeded below; + * - the `isolated` tenancy posture, so the tenant wall stands. + * + * What it holds: an organization administrator or owner sets, changes and + * clears (deletes) a setting, each act audited; a member reads the settings + * and writes none; another organization's setting is never read, changed or + * cleared; and an organization holding a setting refuses its own delete until + * the setting is cleared, as it does for an exchange rate. + * + * Refusals assert the wire `code` AND `status` the data door maps the engine's + * error to (ADR-0112), and that nothing was stored or changed. + */ + +import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest'; +import { ObjectKernel, resolveAuthzContext, assembleExecutionContext, type Plugin, type PluginContext } from '@objectstack/core'; +import { ObjectQL, ObjectQLPlugin } from '@objectstack/objectql'; +import { SqlDriver } from '@objectstack/driver-sql'; +import { AuditPlugin } from '@objectstack/plugin-audit'; +import { SysMember, SysOrganization, SysUser } from '@objectstack/platform-objects/identity'; +import { SysStandardUnitSetting } from '@objectstack/platform-objects/system'; +import { mapDataError } from '@objectstack/types'; +import { SecurityPlugin } from './security-plugin.js'; +import { defaultPermissionSets } from './objects/default-permission-sets.js'; + +const OBJ = 'sys_standard_unit_setting'; +const ORG = 'org_unit_settings'; +const OTHER = 'org_unit_settings_other'; +const ALICE = 'usr_unit_settings_alice'; +const CAROL = 'usr_unit_settings_carol'; +const OWEN = 'usr_unit_settings_owen'; + +const inOrg = (organizationId: string) => ({ isSystem: true, tenantId: organizationId }) as const; +const SYS = inOrg(ORG); + +type Row = Record; +type Ctx = Record; + +function sqliteDriverPlugin(): Plugin { + return { + name: 'test.driver.sqlite', + type: 'standard', + version: '1.0.0', + async init(ctx: PluginContext) { + ctx.registerService( + 'driver.default', + new SqlDriver({ client: 'better-sqlite3', connection: { filename: ':memory:' }, useNullAsDefault: true }), + ); + }, + }; +} + +function objectsPlugin(): Plugin { + return { + name: 'test.objects', + type: 'standard', + version: '1.0.0', + dependencies: ['com.objectstack.engine.objectql'], + async init(ctx: PluginContext) { + ctx.getService<{ register(m: unknown): unknown }>('manifest').register({ + id: 'test.standard-unit-setting-grants', + namespace: 'unitsettings', + version: '1.0.0', + type: 'plugin', + name: 'Standard unit setting grants fixture', + objects: [SysUser, SysMember, SysOrganization, SysStandardUnitSetting], + }); + }, + }; +} + +/** The thrown error, and the wire answer the data door maps it to. */ +async function refusal(run: () => Promise): Promise<{ status: number; code: string; fields: string[]; thrown: any }> { + let thrown: unknown; + try { + await run(); + } catch (e) { + thrown = e; + } + expect(thrown, 'the call was refused').toBeDefined(); + const wire = mapDataError(thrown, OBJ); + const fields = ((wire.body as { fields?: Array<{ field: string; code: string }> }).fields ?? []).map((f) => f.field); + return { status: wire.status, code: String(wire.body.code), fields, thrown }; +} + +describe('sys_standard_unit_setting on a real stack: administrator sets and clears, member reads, organizations stay apart', () => { + let kernel: ObjectKernel; + let ql: ObjectQL; + const as: Record = {}; + let grams = ''; + let otherGrams = ''; + + const contextOf = async (userId: string): Promise => { + const authz = await resolveAuthzContext({ + ql, + headers: {}, + getSession: async () => ({ + user: { id: userId }, + session: { id: `ses_${userId}`, userId, activeOrganizationId: ORG }, + }), + } as never); + return assembleExecutionContext({ + authz, + oauth: undefined, + localization: undefined, + requestLocale: undefined, + accessToken: undefined, + } as never) as unknown as Ctx; + }; + + const insert = (ctx: Ctx, data: Row) => ql.insert(OBJ, data, { context: ctx } as never) as Promise; + const update = (ctx: Ctx, id: string, data: Row) => ql.update(OBJ, data, { where: { id }, context: ctx } as never); + const remove = (ctx: Ctx, id: string) => ql.delete(OBJ, { where: { id }, context: ctx } as never); + const list = async (ctx: Ctx) => (await ql.find(OBJ, { context: ctx } as never)) as Row[]; + const stored = async (where: Row, organizationId = ORG) => + (await ql.find(OBJ, { where, context: inOrg(organizationId) } as never)) as Row[]; + const storedById = async (id: string, organizationId = ORG) => (await stored({ id }, organizationId))[0]; + const ledger = async (recordId: string) => + ((await ql.find('sys_audit_log', { where: { object_name: OBJ, record_id: recordId }, context: { isSystem: true } } as never)) as Row[]); + + beforeAll(async () => { + kernel = new ObjectKernel({ logger: { level: 'silent' } }); + // The multi-organization posture a deployment with organizations runs in: + // with it the security plugin raises Layer 0, the tenant wall (ADR-0095 + // D1, ADR-0105 D1), which is what keeps another organization's setting + // out of reach. Without it the posture is `single` and no wall stands. + kernel.registerService('tenancy', { posture: 'isolated' }); + await kernel.use(sqliteDriverPlugin()); + await kernel.use(new ObjectQLPlugin()); + await kernel.use(objectsPlugin()); + await kernel.use(new AuditPlugin()); + await kernel.use(new SecurityPlugin({ defaultPermissionSets })); + await kernel.bootstrap(); + ql = kernel.getService('objectql'); + + for (const [id, slug] of [[ORG, 'unit-settings'], [OTHER, 'unit-settings-other']]) { + await ql.insert('sys_organization', { id, name: slug, slug }, { context: { isSystem: true } } as never); + } + const role: Record = { [ALICE]: 'member', [CAROL]: 'admin', [OWEN]: 'owner' }; + for (const userId of Object.keys(role)) { + await ql.insert( + 'sys_user', + { id: userId, name: userId, email: `${userId}@unit-settings.test`, email_verified: true }, + { context: SYS } as never, + ); + await ql.insert('sys_member', { user_id: userId, organization_id: ORG, role: role[userId] }, { context: SYS } as never); + } + for (const [key, userId] of [['alice', ALICE], ['carol', CAROL], ['owen', OWEN]] as const) as[key] = await contextOf(userId); + grams = String((await insert(as.carol, { code: 'GRM', decimal_places: 3 })).id); + // The other organization sets the same code its own way. + otherGrams = String((await ql.insert(OBJ, { code: 'GRM', decimal_places: 1 }, { context: inOrg(OTHER) } as never) as Row).id); + }, 120_000); + + afterAll(async () => { + if (kernel) await Promise.race([kernel.shutdown(), new Promise((r) => setTimeout(r, 10_000))]); + }, 30_000); + + it('the fixture is armed: each persona holds the position this suite is about', () => { + expect(as.alice.positions).toEqual(expect.arrayContaining(['org_member', 'everyone'])); + expect(as.carol.positions).toEqual(expect.arrayContaining(['org_admin', 'everyone'])); + expect(as.owen.positions).toEqual(expect.arrayContaining(['org_owner', 'everyone'])); + expect(as.carol.positions).not.toContain('org_member'); + }); + + for (const key of ['carol', 'owen'] as const) { + describe(`an organization ${key === 'carol' ? 'administrator' : 'owner'}`, () => { + it('sets a setting, changes it and clears it, and each act is audited', async () => { + const code = key === 'carol' ? 'KGM' : 'H87'; + const id = String((await insert(as[key], { code, decimal_places: 2 })).id); + // Stamped with the writer's organization: the setting is the organization's. + expect(await storedById(id)).toMatchObject({ code, decimal_places: 2, organization_id: ORG }); + + await update(as[key], id, { decimal_places: 0 }); + expect(await storedById(id)).toMatchObject({ code, decimal_places: 0 }); + + await remove(as[key], id); + expect(await stored({ code })).toEqual([]); + + await vi.waitFor(async () => + expect((await ledger(id)).map((r) => r.action).sort()).toEqual(['create', 'delete', 'update']), + ); + const change = (await ledger(id)).find((r) => r.action === 'update')!; + expect(JSON.parse(String(change.old_value))).toMatchObject({ decimal_places: 2 }); + expect(JSON.parse(String(change.new_value))).toMatchObject({ decimal_places: 0 }); + expect(change.tenant_id).toBe(ORG); + }); + }); + } + + describe('a member', () => { + it("reads the organization's settings, so a quantity displays with the same default for them", async () => { + expect((await list(as.alice)).map((r) => [r.code, r.decimal_places])).toEqual([['GRM', 3]]); + }); + + it('sets, changes and clears none: 403 PERMISSION_DENIED, nothing stored or changed', async () => { + expect(await refusal(() => insert(as.alice, { code: 'MTR', decimal_places: 2 }))).toMatchObject({ status: 403, code: 'PERMISSION_DENIED' }); + expect(await stored({ code: 'MTR' })).toEqual([]); + expect(await refusal(() => update(as.alice, grams, { decimal_places: 5 }))).toMatchObject({ status: 403, code: 'PERMISSION_DENIED' }); + expect(await refusal(() => remove(as.alice, grams))).toMatchObject({ status: 403, code: 'PERMISSION_DENIED' }); + expect(await storedById(grams)).toMatchObject({ code: 'GRM', decimal_places: 3 }); + }); + }); + + describe("another organization's setting", () => { + it('is never read, by list or by id, by a member or an administrator', async () => { + for (const key of ['alice', 'carol'] as const) { + expect((await list(as[key])).map((r) => r.id), key).not.toContain(otherGrams); + expect(await ql.find(OBJ, { where: { id: otherGrams }, context: as[key] } as never), key).toEqual([]); + } + }); + + it('is never changed or cleared by an administrator of this organization', async () => { + await update(as.carol, otherGrams, { decimal_places: 6 }).catch(() => undefined); + await remove(as.carol, otherGrams).catch(() => undefined); + expect(await storedById(otherGrams, OTHER)).toMatchObject({ code: 'GRM', decimal_places: 1, organization_id: OTHER }); + expect(await storedById(grams)).toMatchObject({ code: 'GRM', decimal_places: 3, organization_id: ORG }); + }); + }); + + describe('the rules a write meets', () => { + it('refuses a code that is not a standard unit, an organization code included: 400 VALIDATION_FAILED on code', async () => { + for (const code of ['BOX_12', 'kgm', 'EA']) { + expect(await refusal(() => insert(as.carol, { code, decimal_places: 1 })), code).toMatchObject({ + status: 400, + code: 'VALIDATION_FAILED', + fields: ['code'], + }); + expect(await stored({ code }), code).toEqual([]); + } + }); + + it('refuses decimal places outside 0 to 12, or with a fraction: 400 VALIDATION_FAILED on decimal_places', async () => { + for (const decimal_places of [-1, 13, 1.5]) { + expect(await refusal(() => insert(as.carol, { code: 'LTR', decimal_places })), String(decimal_places)).toMatchObject({ + status: 400, + code: 'VALIDATION_FAILED', + fields: ['decimal_places'], + }); + } + expect(await stored({ code: 'LTR' })).toEqual([]); + }); + + it('refuses a second setting of the same code: 409 UNIQUE_VIOLATION, the first kept', async () => { + expect(await refusal(() => insert(as.carol, { code: 'GRM', decimal_places: 4 }))).toMatchObject({ status: 409, code: 'UNIQUE_VIOLATION' }); + expect(await stored({ code: 'GRM' })).toHaveLength(1); + }); + + it('refuses changing the code of a setting: 400 VALIDATION_FAILED on code, the row unchanged', async () => { + expect(await refusal(() => update(as.carol, grams, { code: 'MGM' }))).toMatchObject({ + status: 400, + code: 'VALIDATION_FAILED', + fields: ['code'], + }); + expect(await storedById(grams)).toMatchObject({ code: 'GRM', decimal_places: 3 }); + }); + }); + + describe("an organization's delete", () => { + const GONE = 'org_unit_settings_gone'; + const organizations = async (ids: string[]) => + ((await ql.find('sys_organization', { where: { id: { $in: ids } }, context: { isSystem: true } } as never)) as Row[]).map((r) => r.id); + + it('is refused 409 DELETE_RESTRICTED naming this object while a setting remains, and goes through once it is cleared', async () => { + await ql.insert('sys_organization', { id: GONE, name: 'gone', slug: 'unit-settings-gone' }, { context: { isSystem: true } } as never); + const setting = (await ql.insert(OBJ, { code: 'TNE', decimal_places: 0 }, { context: inOrg(GONE) } as never)) as Row; + + const refused = await refusal(() => ql.delete('sys_organization', { where: { id: GONE }, context: SYS } as never)); + expect(refused).toMatchObject({ status: 409, code: 'DELETE_RESTRICTED' }); + expect(refused.thrown.dependentObject).toBe(OBJ); + expect(await organizations([GONE])).toEqual([GONE]); + + await ql.delete(OBJ, { where: { id: setting.id }, context: inOrg(GONE) } as never); + await expect(ql.delete('sys_organization', { where: { id: GONE }, context: SYS } as never)).resolves.toBe(true); + expect(await organizations([GONE])).toEqual([]); + }); + }); +}); diff --git a/scripts/platform-object-tenancy-census.json b/scripts/platform-object-tenancy-census.json index 5ec4ad5144e..b3ce6dda67a 100644 --- a/scripts/platform-object-tenancy-census.json +++ b/scripts/platform-object-tenancy-census.json @@ -26,8 +26,8 @@ "predicate": "resolveTenantFieldName(registered schema) !== null, where the registered schema is the authored schema plus the columns resolveInjectedSystemColumns says the registration injects (the applySystemFields pass). Both functions are loaded from source and executed; neither is re-spelled here.", "population": "every object registered by a tracked packages/**/*.object.ts module whose name carries a platform prefix (sys_ / cloud_ / ai_). The cloud repository's own cloud_ objects are not in this tree and so not in this census.", "totals": { - "registered": 110, - "inReach": 59, + "registered": 111, + "inReach": 60, "outOfReach": 51 }, "reasonTotals": { @@ -784,6 +784,13 @@ "tenancy.enabled: false" ] }, + { + "name": "sys_standard_unit_setting", + "file": "packages/platform-objects/src/system/sys-standard-unit-setting.object.ts", + "reach": "in", + "tenantField": "organization_id", + "reasons": [] + }, { "name": "sys_sync_run", "file": "packages/services/service-automation/src/sys-sync-run.object.ts", From 98cbc476025ff17adedde53e62f0cb8bcdbba110 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 01:49:45 +0000 Subject: [PATCH 3/3] fix(platform-objects): state the tenancy posture the isolation sentence holds under; pin an administrator editing and clearing another's setting Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01Utp6CXM7nqtiQ3M9JqGAqL --- .changeset/35498-standard-unit-setting.md | 4 +-- .../sys-standard-unit-setting.object.ts | 9 ++++-- ....standard-unit-setting.integration.test.ts | 30 +++++++++++++++++++ 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/.changeset/35498-standard-unit-setting.md b/.changeset/35498-standard-unit-setting.md index fe6e44aa88f..7c824d988b5 100644 --- a/.changeset/35498-standard-unit-setting.md +++ b/.changeset/35498-standard-unit-setting.md @@ -13,7 +13,7 @@ Metadata-protocol: none An organization administrator can now give any standard unit of measure (UN/ECE Recommendation 20 codes such as `KGM` or `H87`) its own display decimal places, for example 3 for grams at a jeweller or 0 for kilograms at a gravel yard. The value lives in the new organization-owned object `sys_standard_unit_setting` (Setup → Configuration → Standard Unit Settings): one row per standard code, `decimal_places` a whole number from 0 to 12. Deleting the row clears the setting. The organization's own units keep their decimal places on their own `sys_unit` row. - Every member reads the settings (`member_default`, read only); organization administrators and owners create, edit and delete them (`organization_admin`). External members get no read, as with `sys_unit`. -- `organization_id` is injected, so the tenant wall scopes every read and write; another organization's setting is never read. +- `organization_id` is injected and stamped on every row. Under the `isolated` tenancy posture the tenant wall (ADR-0095 D1) confines every read and write to the caller's organization, so another organization's setting is never read. As with every organization-owned object (ADR-0105 D1), the `single` posture raises no wall, and the `group` posture walls by membership, so a member of several organizations can read each one's settings. - Every set, change and clear is written to `sys_audit_log`, with field history on both columns. -- The value is a display default only (ADR-0158 L4): a field's own `scale` stays the storage ceiling, and nothing is rounded at write by it. No reader ships in this change; the quantity display reads it. +- The value is a display default only (ADR-0158 L4): a field's own `scale` stays the storage ceiling, and nothing is rounded at write by it. No reader ships in this change; the quantity display card (#35490) will read it. - Like an exchange rate, a setting is a record the organization owns, so an organization delete is refused (`DELETE_RESTRICTED`) until its settings are deleted. diff --git a/packages/platform-objects/src/system/sys-standard-unit-setting.object.ts b/packages/platform-objects/src/system/sys-standard-unit-setting.object.ts index 2ac56135ea3..a04bbc7b25d 100644 --- a/packages/platform-objects/src/system/sys-standard-unit-setting.object.ts +++ b/packages/platform-objects/src/system/sys-standard-unit-setting.object.ts @@ -46,9 +46,12 @@ export const STANDARD_UNIT_SETTING_CODE_PATTERN = `^(?:${STANDARD_UNIT_SETTING_C * unlike `sys_unit` the delete is served; it is also what lets an * organization delete itself, which refuses while any of its records * remain, as an exchange rate does. - * - **Tenancy** — no tenancy opt-out, so `organization_id` is injected and the - * Layer 0 tenant wall (ADR-0095 D1) scopes every read and write: another - * organization's value is never read. + * - **Tenancy** — no tenancy opt-out, so `organization_id` is injected and + * stamped on every row. Under the `isolated` posture the Layer 0 tenant + * wall (ADR-0095 D1) confines every read and write to the caller's + * organization, so another organization's value is never read; as for + * every organization-owned object (ADR-0105 D1), `single` raises no wall + * and `group` walls by membership. * - **Who reads, who writes** — every member READS it (`member_default` names * this object, read only), as `sys_unit` is read, so a quantity displays * with the same default for everyone who reads it. Organization diff --git a/packages/plugins/plugin-security/src/default-permission-sets.standard-unit-setting.integration.test.ts b/packages/plugins/plugin-security/src/default-permission-sets.standard-unit-setting.integration.test.ts index c9f762737c7..5e86041f66e 100644 --- a/packages/plugins/plugin-security/src/default-permission-sets.standard-unit-setting.integration.test.ts +++ b/packages/plugins/plugin-security/src/default-permission-sets.standard-unit-setting.integration.test.ts @@ -202,6 +202,36 @@ describe('sys_standard_unit_setting on a real stack: administrator sets and clea }); } + // The `organization_admin` line's claim: an administrator edits and clears + // EVERY setting of the organization, not only the ones they created, with + // no superuser bit (settings carry no owner scope for an administrator). + describe('an administrator edits and clears every setting of the organization, not only their own', () => { + for (const [creator, editor] of [['owen', 'carol'], ['carol', 'owen']] as const) { + it(`the ${editor === 'carol' ? 'administrator' : 'owner'} changes and then deletes a setting the ${creator === 'owen' ? 'owner' : 'administrator'} created`, async () => { + const code = creator === 'owen' ? 'MTR' : 'CMT'; + const id = String((await insert(as[creator], { code, decimal_places: 2 })).id); + expect(await storedById(id)).toMatchObject({ code, decimal_places: 2, organization_id: ORG }); + + await update(as[editor], id, { decimal_places: 1 }); + expect(await storedById(id)).toMatchObject({ code, decimal_places: 1 }); + + await remove(as[editor], id); + expect(await stored({ code })).toEqual([]); + }); + } + + it("the effective permissions of both keep read, create, edit and delete, without the superuser bits", async () => { + const security = kernel.getService<{ + getEffectiveObjectPermissions(ctx: Ctx): Promise>>; + }>('security'); + for (const key of ['carol', 'owen'] as const) { + const map = await security.getEffectiveObjectPermissions(as[key]); + expect(map[OBJ], key).toMatchObject({ allowRead: true, allowCreate: true, allowEdit: true, allowDelete: true }); + expect(map[OBJ]?.modifyAllRecords, key).not.toBe(true); + } + }); + }); + describe('a member', () => { it("reads the organization's settings, so a quantity displays with the same default for them", async () => { expect((await list(as.alice)).map((r) => [r.code, r.decimal_places])).toEqual([['GRM', 3]]);