udp-react-enterprise-component-library 27.0.0-next.12 → 27.0.0-next.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/UI/fluent-web-components/UdpIconPicker.d.ts +4 -1
- package/dist/UI/fluent-web-components/UdpIconPicker.d.ts.map +1 -1
- package/dist/UI/fluent-web-components/UdpIconPicker.js +2 -2
- package/dist/UI/fluent-web-components/UdpIconPicker.js.map +1 -1
- package/dist/UI/fluent-web-components/UdpIconPicker.mjs +32 -28
- package/dist/UI/fluent-web-components/UdpIconPicker.mjs.map +1 -1
- package/dist/UI/fluent-web-components/UdpLink.d.ts +6 -0
- package/dist/UI/fluent-web-components/UdpLink.d.ts.map +1 -1
- package/dist/UI/fluent-web-components/UdpLink.js.map +1 -1
- package/dist/UI/fluent-web-components/UdpLink.mjs.map +1 -1
- package/dist/UI/fluent-web-components/types.d.ts +2 -0
- package/dist/UI/fluent-web-components/types.d.ts.map +1 -1
- package/dist/UI/widgets/library/InquiryFindRecordsWidget/InquiryFindRecordsWidget.d.ts +16 -3
- package/dist/UI/widgets/library/InquiryFindRecordsWidget/InquiryFindRecordsWidget.d.ts.map +1 -1
- package/dist/UI/widgets/library/InquiryFindRecordsWidget/InquiryFindRecordsWidget.js +36 -13
- package/dist/UI/widgets/library/InquiryFindRecordsWidget/InquiryFindRecordsWidget.js.map +1 -1
- package/dist/UI/widgets/library/InquiryFindRecordsWidget/InquiryFindRecordsWidget.mjs +119 -62
- package/dist/UI/widgets/library/InquiryFindRecordsWidget/InquiryFindRecordsWidget.mjs.map +1 -1
- package/dist/UI/widgets/library/InquiryFindRecordsWidget/index.mjs +3 -2
- package/dist/UI/widgets/library/InquiryRecentRecordsWidget/InquiryRecentRecordsWidget.d.ts +9 -2
- package/dist/UI/widgets/library/InquiryRecentRecordsWidget/InquiryRecentRecordsWidget.d.ts.map +1 -1
- package/dist/UI/widgets/library/InquiryRecentRecordsWidget/InquiryRecentRecordsWidget.js +18 -18
- package/dist/UI/widgets/library/InquiryRecentRecordsWidget/InquiryRecentRecordsWidget.js.map +1 -1
- package/dist/UI/widgets/library/InquiryRecentRecordsWidget/InquiryRecentRecordsWidget.mjs +79 -67
- package/dist/UI/widgets/library/InquiryRecentRecordsWidget/InquiryRecentRecordsWidget.mjs.map +1 -1
- package/dist/UI/widgets/library/InquiryRemindersWidget/InquiryRemindersWidget.d.ts +8 -2
- package/dist/UI/widgets/library/InquiryRemindersWidget/InquiryRemindersWidget.d.ts.map +1 -1
- package/dist/UI/widgets/library/InquiryRemindersWidget/InquiryRemindersWidget.js +32 -16
- package/dist/UI/widgets/library/InquiryRemindersWidget/InquiryRemindersWidget.js.map +1 -1
- package/dist/UI/widgets/library/InquiryRemindersWidget/InquiryRemindersWidget.mjs +129 -102
- package/dist/UI/widgets/library/InquiryRemindersWidget/InquiryRemindersWidget.mjs.map +1 -1
- package/dist/UI/widgets/library/InquiryRemindersWidget/reminderRowModel.d.ts +3 -2
- package/dist/UI/widgets/library/InquiryRemindersWidget/reminderRowModel.d.ts.map +1 -1
- package/dist/UI/widgets/library/InquiryRemindersWidget/reminderRowModel.js +11 -12
- package/dist/UI/widgets/library/InquiryRemindersWidget/reminderRowModel.js.map +1 -1
- package/dist/UI/widgets/library/InquiryRemindersWidget/reminderRowModel.mjs +6 -4
- package/dist/UI/widgets/library/InquiryRemindersWidget/reminderRowModel.mjs.map +1 -1
- package/dist/UI/widgets/library/InquiryRemindersWidget/useInquiryReminders.d.ts +2 -19
- package/dist/UI/widgets/library/InquiryRemindersWidget/useInquiryReminders.d.ts.map +1 -1
- package/dist/UI/widgets/library/InquiryRemindersWidget/useInquiryReminders.js +4 -5
- package/dist/UI/widgets/library/InquiryRemindersWidget/useInquiryReminders.js.map +1 -1
- package/dist/UI/widgets/library/InquiryRemindersWidget/useInquiryReminders.mjs +5 -4
- package/dist/UI/widgets/library/InquiryRemindersWidget/useInquiryReminders.mjs.map +1 -1
- package/dist/actionPanels/index.d.ts +0 -2
- package/dist/actionPanels/index.d.ts.map +1 -1
- package/dist/actionPanels/index.js +0 -2
- package/dist/actionPanels/index.js.map +1 -1
- package/dist/actionPanels/panelActionFields.d.ts +9 -26
- package/dist/actionPanels/panelActionFields.d.ts.map +1 -1
- package/dist/actionPanels/panelActionFields.js +32 -55
- package/dist/actionPanels/panelActionFields.js.map +1 -1
- package/dist/actionPanels/panelActionFields.mjs +159 -375
- package/dist/actionPanels/panelActionFields.mjs.map +1 -1
- package/dist/actionPanels/panelOperations.d.ts +15 -41
- package/dist/actionPanels/panelOperations.d.ts.map +1 -1
- package/dist/actionPanels/panelOperations.js +51 -89
- package/dist/actionPanels/panelOperations.js.map +1 -1
- package/dist/actionPanels/panelOperations.mjs +37 -92
- package/dist/actionPanels/panelOperations.mjs.map +1 -1
- package/dist/domain/actionPanel/actionTypeMeta.d.ts +15 -2
- package/dist/domain/actionPanel/actionTypeMeta.d.ts.map +1 -1
- package/dist/domain/actionPanel/actionTypeMeta.js +21 -2
- package/dist/domain/actionPanel/actionTypeMeta.js.map +1 -1
- package/dist/domain/actionPanel/actionTypeMeta.mjs +18 -3
- package/dist/domain/actionPanel/actionTypeMeta.mjs.map +1 -1
- package/dist/domain/actionPanel/buttonOrder.d.ts +67 -0
- package/dist/domain/actionPanel/buttonOrder.d.ts.map +1 -0
- package/dist/domain/actionPanel/buttonOrder.js +105 -0
- package/dist/domain/actionPanel/buttonOrder.js.map +1 -0
- package/dist/domain/actionPanel/buttonOrder.mjs +90 -0
- package/dist/domain/actionPanel/buttonOrder.mjs.map +1 -0
- package/dist/domain/actionPanel/index.d.ts +1 -0
- package/dist/domain/actionPanel/index.d.ts.map +1 -1
- package/dist/domain/actionPanel/index.js +1 -0
- package/dist/domain/actionPanel/index.js.map +1 -1
- package/dist/domain/actionPanel/index.mjs +4 -3
- package/dist/domain/actionPanel/serialize.d.ts +6 -2
- package/dist/domain/actionPanel/serialize.d.ts.map +1 -1
- package/dist/domain/actionPanel/serialize.js +10 -3
- package/dist/domain/actionPanel/serialize.js.map +1 -1
- package/dist/domain/actionPanel/serialize.mjs +7 -3
- package/dist/domain/actionPanel/serialize.mjs.map +1 -1
- package/dist/domain/actionPanel/types.d.ts +24 -8
- package/dist/domain/actionPanel/types.d.ts.map +1 -1
- package/dist/domain/actionPanel/types.js.map +1 -1
- package/dist/domain/actionPanel/types.mjs.map +1 -1
- package/dist/domain/inquiryTree/describe.d.ts +15 -3
- package/dist/domain/inquiryTree/describe.d.ts.map +1 -1
- package/dist/domain/inquiryTree/describe.js +32 -28
- package/dist/domain/inquiryTree/describe.js.map +1 -1
- package/dist/domain/inquiryTree/describe.mjs +34 -16
- package/dist/domain/inquiryTree/describe.mjs.map +1 -1
- package/dist/domain/inquiryTree/displayTree.d.ts +75 -97
- package/dist/domain/inquiryTree/displayTree.d.ts.map +1 -1
- package/dist/domain/inquiryTree/displayTree.js +418 -551
- package/dist/domain/inquiryTree/displayTree.js.map +1 -1
- package/dist/domain/inquiryTree/displayTree.mjs +345 -414
- package/dist/domain/inquiryTree/displayTree.mjs.map +1 -1
- package/dist/domain/inquiryTree/groups.d.ts +2 -0
- package/dist/domain/inquiryTree/groups.d.ts.map +1 -1
- package/dist/domain/inquiryTree/groups.js.map +1 -1
- package/dist/domain/inquiryTree/groups.mjs.map +1 -1
- package/dist/domain/inquiryTree/index.d.ts +1 -1
- package/dist/domain/inquiryTree/index.d.ts.map +1 -1
- package/dist/domain/inquiryTree/index.js +1 -1
- package/dist/domain/inquiryTree/index.js.map +1 -1
- package/dist/domain/inquiryTree/index.mjs +12 -12
- package/dist/domain/inquiryTree/lazyLoad.d.ts +20 -129
- package/dist/domain/inquiryTree/lazyLoad.d.ts.map +1 -1
- package/dist/domain/inquiryTree/lazyLoad.js +48 -233
- package/dist/domain/inquiryTree/lazyLoad.js.map +1 -1
- package/dist/domain/inquiryTree/lazyLoad.mjs +32 -187
- package/dist/domain/inquiryTree/lazyLoad.mjs.map +1 -1
- package/dist/domain/inquiryTree/legalChildren.d.ts +13 -14
- package/dist/domain/inquiryTree/legalChildren.d.ts.map +1 -1
- package/dist/domain/inquiryTree/legalChildren.js +21 -42
- package/dist/domain/inquiryTree/legalChildren.js.map +1 -1
- package/dist/domain/inquiryTree/legalChildren.mjs +19 -37
- package/dist/domain/inquiryTree/legalChildren.mjs.map +1 -1
- package/dist/domain/inquiryTree/names.d.ts +38 -0
- package/dist/domain/inquiryTree/names.d.ts.map +1 -0
- package/dist/domain/inquiryTree/names.js +64 -0
- package/dist/domain/inquiryTree/names.js.map +1 -0
- package/dist/domain/inquiryTree/names.mjs +56 -0
- package/dist/domain/inquiryTree/names.mjs.map +1 -0
- package/dist/domain/inquiryTree/operations.d.ts +6 -2
- package/dist/domain/inquiryTree/operations.d.ts.map +1 -1
- package/dist/domain/inquiryTree/operations.js +17 -16
- package/dist/domain/inquiryTree/operations.js.map +1 -1
- package/dist/domain/inquiryTree/operations.mjs +14 -11
- package/dist/domain/inquiryTree/operations.mjs.map +1 -1
- package/dist/domain/inquiryTree/rules.d.ts +3 -4
- package/dist/domain/inquiryTree/rules.d.ts.map +1 -1
- package/dist/domain/inquiryTree/rules.js +3 -13
- package/dist/domain/inquiryTree/rules.js.map +1 -1
- package/dist/domain/inquiryTree/rules.mjs +3 -9
- package/dist/domain/inquiryTree/rules.mjs.map +1 -1
- package/dist/domain/inquiryTree/runtime.d.ts +23 -16
- package/dist/domain/inquiryTree/runtime.d.ts.map +1 -1
- package/dist/domain/inquiryTree/runtime.js +46 -54
- package/dist/domain/inquiryTree/runtime.js.map +1 -1
- package/dist/domain/inquiryTree/runtime.mjs +31 -26
- package/dist/domain/inquiryTree/runtime.mjs.map +1 -1
- package/dist/domain/inquiryTree/serialize.d.ts +20 -29
- package/dist/domain/inquiryTree/serialize.d.ts.map +1 -1
- package/dist/domain/inquiryTree/serialize.js +93 -205
- package/dist/domain/inquiryTree/serialize.js.map +1 -1
- package/dist/domain/inquiryTree/serialize.mjs +89 -180
- package/dist/domain/inquiryTree/serialize.mjs.map +1 -1
- package/dist/domain/inquiryTree/types.d.ts +146 -65
- package/dist/domain/inquiryTree/types.d.ts.map +1 -1
- package/dist/domain/inquiryTree/types.js +5 -0
- package/dist/domain/inquiryTree/types.js.map +1 -1
- package/dist/domain/inquiryTree/types.mjs +3 -1
- package/dist/domain/inquiryTree/types.mjs.map +1 -1
- package/dist/domain/inquiryTree/validate.d.ts +9 -2
- package/dist/domain/inquiryTree/validate.d.ts.map +1 -1
- package/dist/domain/inquiryTree/validate.js +30 -58
- package/dist/domain/inquiryTree/validate.js.map +1 -1
- package/dist/domain/inquiryTree/validate.mjs +29 -44
- package/dist/domain/inquiryTree/validate.mjs.map +1 -1
- package/dist/domain/inquiryTree/view.d.ts +8 -12
- package/dist/domain/inquiryTree/view.d.ts.map +1 -1
- package/dist/domain/inquiryTree/view.js +40 -66
- package/dist/domain/inquiryTree/view.js.map +1 -1
- package/dist/domain/inquiryTree/view.mjs +30 -60
- package/dist/domain/inquiryTree/view.mjs.map +1 -1
- package/dist/domain/inquiryTree/waveLoad.d.ts +32 -48
- package/dist/domain/inquiryTree/waveLoad.d.ts.map +1 -1
- package/dist/domain/inquiryTree/waveLoad.js +75 -90
- package/dist/domain/inquiryTree/waveLoad.js.map +1 -1
- package/dist/domain/inquiryTree/waveLoad.mjs +54 -60
- package/dist/domain/inquiryTree/waveLoad.mjs.map +1 -1
- package/dist/domain/inquiryTree/wireString.d.ts +5 -0
- package/dist/domain/inquiryTree/wireString.d.ts.map +1 -1
- package/dist/domain/inquiryTree/wireString.js +11 -0
- package/dist/domain/inquiryTree/wireString.js.map +1 -1
- package/dist/domain/inquiryTree/wireString.mjs +10 -1
- package/dist/domain/inquiryTree/wireString.mjs.map +1 -1
- package/dist/domain/nodeView/index.mjs +2 -2
- package/dist/domain/nodeView/model.d.ts +35 -30
- package/dist/domain/nodeView/model.d.ts.map +1 -1
- package/dist/domain/nodeView/model.js +108 -69
- package/dist/domain/nodeView/model.js.map +1 -1
- package/dist/domain/nodeView/model.mjs +86 -36
- package/dist/domain/nodeView/model.mjs.map +1 -1
- package/dist/icons/legacyIconNames.d.ts.map +1 -1
- package/dist/icons/legacyIconNames.js +46 -1
- package/dist/icons/legacyIconNames.js.map +1 -1
- package/dist/icons/legacyIconNames.mjs +46 -1
- package/dist/icons/legacyIconNames.mjs.map +1 -1
- package/dist/index.mjs +10 -12
- package/dist/inquiry/Inquiry.d.ts +3 -0
- package/dist/inquiry/Inquiry.d.ts.map +1 -1
- package/dist/inquiry/Inquiry.js +3 -0
- package/dist/inquiry/Inquiry.js.map +1 -1
- package/dist/inquiry/Inquiry.mjs +3 -0
- package/dist/inquiry/Inquiry.mjs.map +1 -1
- package/dist/inquiry/v2/InquiryV2.d.ts +8 -6
- package/dist/inquiry/v2/InquiryV2.d.ts.map +1 -1
- package/dist/inquiry/v2/InquiryV2.js +45 -24
- package/dist/inquiry/v2/InquiryV2.js.map +1 -1
- package/dist/inquiry/v2/InquiryV2.mjs +108 -61
- package/dist/inquiry/v2/InquiryV2.mjs.map +1 -1
- package/dist/inquiry/v2/InquiryV2.module.css +60 -15
- package/dist/inquiry/v2/InquiryWorkspace.d.ts +9 -9
- package/dist/inquiry/v2/InquiryWorkspace.d.ts.map +1 -1
- package/dist/inquiry/v2/InquiryWorkspace.js +531 -408
- package/dist/inquiry/v2/InquiryWorkspace.js.map +1 -1
- package/dist/inquiry/v2/InquiryWorkspace.mjs +524 -408
- package/dist/inquiry/v2/InquiryWorkspace.mjs.map +1 -1
- package/dist/inquiry/v2/ai/InquiryV2Copilot.d.ts +3 -2
- package/dist/inquiry/v2/ai/InquiryV2Copilot.d.ts.map +1 -1
- package/dist/inquiry/v2/ai/InquiryV2Copilot.js +20 -37
- package/dist/inquiry/v2/ai/InquiryV2Copilot.js.map +1 -1
- package/dist/inquiry/v2/ai/InquiryV2Copilot.mjs +19 -31
- package/dist/inquiry/v2/ai/InquiryV2Copilot.mjs.map +1 -1
- package/dist/inquiry/v2/ai/copilotModel.d.ts +6 -14
- package/dist/inquiry/v2/ai/copilotModel.d.ts.map +1 -1
- package/dist/inquiry/v2/ai/copilotModel.js +35 -87
- package/dist/inquiry/v2/ai/copilotModel.js.map +1 -1
- package/dist/inquiry/v2/ai/copilotModel.mjs +23 -47
- package/dist/inquiry/v2/ai/copilotModel.mjs.map +1 -1
- package/dist/inquiry/v2/api/queries.d.ts +46 -73
- package/dist/inquiry/v2/api/queries.d.ts.map +1 -1
- package/dist/inquiry/v2/api/queries.js +151 -210
- package/dist/inquiry/v2/api/queries.js.map +1 -1
- package/dist/inquiry/v2/api/queries.mjs +227 -183
- package/dist/inquiry/v2/api/queries.mjs.map +1 -1
- package/dist/inquiry/v2/capabilities/actions/ActionsCapability.d.ts.map +1 -1
- package/dist/inquiry/v2/capabilities/actions/ActionsCapability.js +103 -32
- package/dist/inquiry/v2/capabilities/actions/ActionsCapability.js.map +1 -1
- package/dist/inquiry/v2/capabilities/actions/ActionsCapability.mjs +92 -32
- package/dist/inquiry/v2/capabilities/actions/ActionsCapability.mjs.map +1 -1
- package/dist/inquiry/v2/capabilities/actions/ActionsCapability.module.css +8 -1
- package/dist/inquiry/v2/capabilities/actions/EntityFormSurface.d.ts +20 -16
- package/dist/inquiry/v2/capabilities/actions/EntityFormSurface.d.ts.map +1 -1
- package/dist/inquiry/v2/capabilities/actions/EntityFormSurface.js +111 -68
- package/dist/inquiry/v2/capabilities/actions/EntityFormSurface.js.map +1 -1
- package/dist/inquiry/v2/capabilities/actions/EntityFormSurface.mjs +108 -142
- package/dist/inquiry/v2/capabilities/actions/EntityFormSurface.mjs.map +1 -1
- package/dist/inquiry/v2/capabilities/actions/RetrieveSurface.mjs +1 -1
- package/dist/inquiry/v2/capabilities/actions/actionModel.d.ts +66 -50
- package/dist/inquiry/v2/capabilities/actions/actionModel.d.ts.map +1 -1
- package/dist/inquiry/v2/capabilities/actions/actionModel.js +141 -66
- package/dist/inquiry/v2/capabilities/actions/actionModel.js.map +1 -1
- package/dist/inquiry/v2/capabilities/actions/actionModel.mjs +115 -53
- package/dist/inquiry/v2/capabilities/actions/actionModel.mjs.map +1 -1
- package/dist/inquiry/v2/capabilities/actions/parentKeyDefaults.d.ts +26 -0
- package/dist/inquiry/v2/capabilities/actions/parentKeyDefaults.d.ts.map +1 -0
- package/dist/inquiry/v2/capabilities/actions/parentKeyDefaults.js +36 -0
- package/dist/inquiry/v2/capabilities/actions/parentKeyDefaults.js.map +1 -0
- package/dist/inquiry/v2/capabilities/actions/parentKeyDefaults.mjs +41 -0
- package/dist/inquiry/v2/capabilities/actions/parentKeyDefaults.mjs.map +1 -0
- package/dist/inquiry/v2/capabilities/actions/runAction.d.ts +3 -2
- package/dist/inquiry/v2/capabilities/actions/runAction.d.ts.map +1 -1
- package/dist/inquiry/v2/capabilities/actions/runAction.js +27 -23
- package/dist/inquiry/v2/capabilities/actions/runAction.js.map +1 -1
- package/dist/inquiry/v2/capabilities/actions/runAction.mjs +26 -20
- package/dist/inquiry/v2/capabilities/actions/runAction.mjs.map +1 -1
- package/dist/inquiry/v2/capabilities/actions/useHeaderFold.d.ts +20 -0
- package/dist/inquiry/v2/capabilities/actions/useHeaderFold.d.ts.map +1 -0
- package/dist/inquiry/v2/capabilities/actions/useHeaderFold.js +112 -0
- package/dist/inquiry/v2/capabilities/actions/useHeaderFold.js.map +1 -0
- package/dist/inquiry/v2/capabilities/actions/useHeaderFold.mjs +118 -0
- package/dist/inquiry/v2/capabilities/actions/useHeaderFold.mjs.map +1 -0
- package/dist/inquiry/v2/capabilities/actions/useSheetPanel.d.ts +25 -1
- package/dist/inquiry/v2/capabilities/actions/useSheetPanel.d.ts.map +1 -1
- package/dist/inquiry/v2/capabilities/actions/useSheetPanel.js +7 -4
- package/dist/inquiry/v2/capabilities/actions/useSheetPanel.js.map +1 -1
- package/dist/inquiry/v2/capabilities/actions/useSheetPanel.mjs +9 -4
- package/dist/inquiry/v2/capabilities/actions/useSheetPanel.mjs.map +1 -1
- package/dist/inquiry/v2/capabilities/alerts/AlertsCapability.d.ts +5 -3
- package/dist/inquiry/v2/capabilities/alerts/AlertsCapability.d.ts.map +1 -1
- package/dist/inquiry/v2/capabilities/alerts/AlertsCapability.js +11 -8
- package/dist/inquiry/v2/capabilities/alerts/AlertsCapability.js.map +1 -1
- package/dist/inquiry/v2/capabilities/alerts/AlertsCapability.mjs +13 -7
- package/dist/inquiry/v2/capabilities/alerts/AlertsCapability.mjs.map +1 -1
- package/dist/inquiry/v2/capabilities/alerts/AlertsCapability.module.css +4 -4
- package/dist/inquiry/v2/capabilities/header/HeaderCapability.d.ts +1 -1
- package/dist/inquiry/v2/capabilities/header/HeaderCapability.d.ts.map +1 -1
- package/dist/inquiry/v2/capabilities/header/HeaderCapability.js +20 -17
- package/dist/inquiry/v2/capabilities/header/HeaderCapability.js.map +1 -1
- package/dist/inquiry/v2/capabilities/header/HeaderCapability.mjs +101 -111
- package/dist/inquiry/v2/capabilities/header/HeaderCapability.mjs.map +1 -1
- package/dist/inquiry/v2/capabilities/header/HeaderCapability.module.css +9 -6
- package/dist/inquiry/v2/capabilities/tabs/TabsCapability.d.ts +2 -1
- package/dist/inquiry/v2/capabilities/tabs/TabsCapability.d.ts.map +1 -1
- package/dist/inquiry/v2/capabilities/tabs/TabsCapability.js +9 -2
- package/dist/inquiry/v2/capabilities/tabs/TabsCapability.js.map +1 -1
- package/dist/inquiry/v2/capabilities/tabs/TabsCapability.mjs +18 -15
- package/dist/inquiry/v2/capabilities/tabs/TabsCapability.mjs.map +1 -1
- package/dist/inquiry/v2/index.d.ts +0 -1
- package/dist/inquiry/v2/index.d.ts.map +1 -1
- package/dist/inquiry/v2/index.js.map +1 -1
- package/dist/inquiry/v2/kernel/ActionRunnerContext.d.ts +3 -3
- package/dist/inquiry/v2/kernel/ActionRunnerContext.d.ts.map +1 -1
- package/dist/inquiry/v2/kernel/ActionRunnerContext.js +11 -5
- package/dist/inquiry/v2/kernel/ActionRunnerContext.js.map +1 -1
- package/dist/inquiry/v2/kernel/ActionRunnerContext.mjs +15 -12
- package/dist/inquiry/v2/kernel/ActionRunnerContext.mjs.map +1 -1
- package/dist/inquiry/v2/kernel/ReadOnlyContext.d.ts +3 -0
- package/dist/inquiry/v2/kernel/ReadOnlyContext.d.ts.map +1 -0
- package/dist/inquiry/v2/kernel/ReadOnlyContext.js +14 -0
- package/dist/inquiry/v2/kernel/ReadOnlyContext.js.map +1 -0
- package/dist/inquiry/v2/kernel/ReadOnlyContext.mjs +20 -0
- package/dist/inquiry/v2/kernel/ReadOnlyContext.mjs.map +1 -0
- package/dist/inquiry/v2/kernel/RecordContext.d.ts +2 -0
- package/dist/inquiry/v2/kernel/RecordContext.d.ts.map +1 -1
- package/dist/inquiry/v2/kernel/RecordContext.js.map +1 -1
- package/dist/inquiry/v2/kernel/RecordContext.mjs.map +1 -1
- package/dist/inquiry/v2/kernel/UdpNodeView.d.ts.map +1 -1
- package/dist/inquiry/v2/kernel/UdpNodeView.js +18 -13
- package/dist/inquiry/v2/kernel/UdpNodeView.js.map +1 -1
- package/dist/inquiry/v2/kernel/UdpNodeView.mjs +177 -140
- package/dist/inquiry/v2/kernel/UdpNodeView.mjs.map +1 -1
- package/dist/inquiry/v2/kernel/UdpNodeView.module.css +56 -5
- package/dist/inquiry/v2/kernel/capabilities.d.ts +0 -2
- package/dist/inquiry/v2/kernel/capabilities.d.ts.map +1 -1
- package/dist/inquiry/v2/kernel/capabilities.js.map +1 -1
- package/dist/inquiry/v2/kernel/capabilities.mjs.map +1 -1
- package/dist/inquiry/v2/landing/InquiryExplorePage.d.ts +26 -37
- package/dist/inquiry/v2/landing/InquiryExplorePage.d.ts.map +1 -1
- package/dist/inquiry/v2/landing/InquiryExplorePage.js +48 -57
- package/dist/inquiry/v2/landing/InquiryExplorePage.js.map +1 -1
- package/dist/inquiry/v2/landing/InquiryExplorePage.mjs +102 -106
- package/dist/inquiry/v2/landing/InquiryExplorePage.mjs.map +1 -1
- package/dist/inquiry/v2/landing/InquiryExplorePage.module.css +58 -6
- package/dist/inquiry/v2/landing/InquiryLanding.d.ts +3 -3
- package/dist/inquiry/v2/landing/InquiryLanding.d.ts.map +1 -1
- package/dist/inquiry/v2/landing/InquiryLanding.js +8 -3
- package/dist/inquiry/v2/landing/InquiryLanding.js.map +1 -1
- package/dist/inquiry/v2/landing/InquiryLanding.mjs +51 -35
- package/dist/inquiry/v2/landing/InquiryLanding.mjs.map +1 -1
- package/dist/inquiry/v2/landing/InquiryLanding.module.css +8 -0
- package/dist/inquiry/v2/page/UdpPageRenderer.d.ts +5 -1
- package/dist/inquiry/v2/page/UdpPageRenderer.d.ts.map +1 -1
- package/dist/inquiry/v2/page/UdpPageRenderer.js +13 -1
- package/dist/inquiry/v2/page/UdpPageRenderer.js.map +1 -1
- package/dist/inquiry/v2/page/UdpPageRenderer.mjs +36 -7
- package/dist/inquiry/v2/page/UdpPageRenderer.mjs.map +1 -1
- package/dist/inquiry/v2/search/InquirySearchPanel.d.ts +1 -7
- package/dist/inquiry/v2/search/InquirySearchPanel.d.ts.map +1 -1
- package/dist/inquiry/v2/search/InquirySearchPanel.js +6 -13
- package/dist/inquiry/v2/search/InquirySearchPanel.js.map +1 -1
- package/dist/inquiry/v2/search/InquirySearchPanel.mjs +4 -8
- package/dist/inquiry/v2/search/InquirySearchPanel.mjs.map +1 -1
- package/dist/inquiry/v2/search/RecordFinder.d.ts +30 -1
- package/dist/inquiry/v2/search/RecordFinder.d.ts.map +1 -1
- package/dist/inquiry/v2/search/RecordFinder.js +43 -20
- package/dist/inquiry/v2/search/RecordFinder.js.map +1 -1
- package/dist/inquiry/v2/search/RecordFinder.mjs +68 -42
- package/dist/inquiry/v2/search/RecordFinder.mjs.map +1 -1
- package/dist/inquiry/v2/search/index.d.ts +3 -3
- package/dist/inquiry/v2/search/index.d.ts.map +1 -1
- package/dist/inquiry/v2/search/index.js +1 -1
- package/dist/inquiry/v2/search/index.js.map +1 -1
- package/dist/inquiry/v2/search/searchModel.d.ts +130 -23
- package/dist/inquiry/v2/search/searchModel.d.ts.map +1 -1
- package/dist/inquiry/v2/search/searchModel.js +237 -36
- package/dist/inquiry/v2/search/searchModel.js.map +1 -1
- package/dist/inquiry/v2/search/searchModel.mjs +207 -34
- package/dist/inquiry/v2/search/searchModel.mjs.map +1 -1
- package/dist/inquiry/v2/search/useInquirySearch.d.ts.map +1 -1
- package/dist/inquiry/v2/search/useInquirySearch.js +46 -19
- package/dist/inquiry/v2/search/useInquirySearch.js.map +1 -1
- package/dist/inquiry/v2/search/useInquirySearch.mjs +83 -84
- package/dist/inquiry/v2/search/useInquirySearch.mjs.map +1 -1
- package/dist/inquiry/v2/tree/InquiryFluentTreeMenu.d.ts +4 -1
- package/dist/inquiry/v2/tree/InquiryFluentTreeMenu.d.ts.map +1 -1
- package/dist/inquiry/v2/tree/InquiryFluentTreeMenu.js +174 -166
- package/dist/inquiry/v2/tree/InquiryFluentTreeMenu.js.map +1 -1
- package/dist/inquiry/v2/tree/InquiryFluentTreeMenu.mjs +343 -325
- package/dist/inquiry/v2/tree/InquiryFluentTreeMenu.mjs.map +1 -1
- package/dist/inquiry/v2/tree/InquiryMenuToolbar.d.ts +3 -1
- package/dist/inquiry/v2/tree/InquiryMenuToolbar.d.ts.map +1 -1
- package/dist/inquiry/v2/tree/InquiryMenuToolbar.js +8 -7
- package/dist/inquiry/v2/tree/InquiryMenuToolbar.js.map +1 -1
- package/dist/inquiry/v2/tree/InquiryMenuToolbar.mjs +68 -72
- package/dist/inquiry/v2/tree/InquiryMenuToolbar.mjs.map +1 -1
- package/dist/inquiry/v2/tree/LoadRecordDialog.d.ts +3 -3
- package/dist/inquiry/v2/tree/LoadRecordDialog.d.ts.map +1 -1
- package/dist/inquiry/v2/tree/LoadRecordDialog.js +12 -7
- package/dist/inquiry/v2/tree/LoadRecordDialog.js.map +1 -1
- package/dist/inquiry/v2/tree/LoadRecordDialog.mjs +48 -33
- package/dist/inquiry/v2/tree/LoadRecordDialog.mjs.map +1 -1
- package/dist/inquiry/v2/tree/NodeList.d.ts.map +1 -1
- package/dist/inquiry/v2/tree/NodeList.js +17 -6
- package/dist/inquiry/v2/tree/NodeList.js.map +1 -1
- package/dist/inquiry/v2/tree/NodeList.mjs +49 -36
- package/dist/inquiry/v2/tree/NodeList.mjs.map +1 -1
- package/dist/inquiry/v2/tree/arrivalModel.d.ts +15 -0
- package/dist/inquiry/v2/tree/arrivalModel.d.ts.map +1 -1
- package/dist/inquiry/v2/tree/arrivalModel.js +14 -1
- package/dist/inquiry/v2/tree/arrivalModel.js.map +1 -1
- package/dist/inquiry/v2/tree/arrivalModel.mjs +12 -1
- package/dist/inquiry/v2/tree/arrivalModel.mjs.map +1 -1
- package/dist/inquiry/v2/tree/branchRefreshModel.d.ts +32 -0
- package/dist/inquiry/v2/tree/branchRefreshModel.d.ts.map +1 -0
- package/dist/inquiry/v2/tree/branchRefreshModel.js +62 -0
- package/dist/inquiry/v2/tree/branchRefreshModel.js.map +1 -0
- package/dist/inquiry/v2/tree/branchRefreshModel.mjs +60 -0
- package/dist/inquiry/v2/tree/branchRefreshModel.mjs.map +1 -0
- package/dist/inquiry/v2/tree/droppedPageModel.d.ts +23 -1
- package/dist/inquiry/v2/tree/droppedPageModel.d.ts.map +1 -1
- package/dist/inquiry/v2/tree/droppedPageModel.js +53 -26
- package/dist/inquiry/v2/tree/droppedPageModel.js.map +1 -1
- package/dist/inquiry/v2/tree/droppedPageModel.mjs +48 -20
- package/dist/inquiry/v2/tree/droppedPageModel.mjs.map +1 -1
- package/dist/inquiry/v2/tree/fluentTreeMenu/treeMenuVisuals.d.ts +7 -12
- package/dist/inquiry/v2/tree/fluentTreeMenu/treeMenuVisuals.d.ts.map +1 -1
- package/dist/inquiry/v2/tree/fluentTreeMenu/treeMenuVisuals.js +44 -15
- package/dist/inquiry/v2/tree/fluentTreeMenu/treeMenuVisuals.js.map +1 -1
- package/dist/inquiry/v2/tree/fluentTreeMenu/treeMenuVisuals.mjs +34 -15
- package/dist/inquiry/v2/tree/fluentTreeMenu/treeMenuVisuals.mjs.map +1 -1
- package/dist/inquiry/v2/tree/fluentTreeMenu/useAggregateBadges.d.ts.map +1 -1
- package/dist/inquiry/v2/tree/fluentTreeMenu/useAggregateBadges.js +7 -18
- package/dist/inquiry/v2/tree/fluentTreeMenu/useAggregateBadges.js.map +1 -1
- package/dist/inquiry/v2/tree/fluentTreeMenu/useAggregateBadges.mjs +6 -14
- package/dist/inquiry/v2/tree/fluentTreeMenu/useAggregateBadges.mjs.map +1 -1
- package/dist/inquiry/v2/tree/fluentTreeMenu/useChildCountBadges.d.ts +20 -16
- package/dist/inquiry/v2/tree/fluentTreeMenu/useChildCountBadges.d.ts.map +1 -1
- package/dist/inquiry/v2/tree/fluentTreeMenu/useChildCountBadges.js +77 -55
- package/dist/inquiry/v2/tree/fluentTreeMenu/useChildCountBadges.js.map +1 -1
- package/dist/inquiry/v2/tree/fluentTreeMenu/useChildCountBadges.mjs +85 -106
- package/dist/inquiry/v2/tree/fluentTreeMenu/useChildCountBadges.mjs.map +1 -1
- package/dist/inquiry/v2/tree/lineageModel.d.ts +18 -1
- package/dist/inquiry/v2/tree/lineageModel.d.ts.map +1 -1
- package/dist/inquiry/v2/tree/lineageModel.js +71 -2
- package/dist/inquiry/v2/tree/lineageModel.js.map +1 -1
- package/dist/inquiry/v2/tree/lineageModel.mjs +53 -3
- package/dist/inquiry/v2/tree/lineageModel.mjs.map +1 -1
- package/dist/inquiry/v2/tree/menuRebuildModel.d.ts +10 -27
- package/dist/inquiry/v2/tree/menuRebuildModel.d.ts.map +1 -1
- package/dist/inquiry/v2/tree/menuRebuildModel.js +8 -58
- package/dist/inquiry/v2/tree/menuRebuildModel.js.map +1 -1
- package/dist/inquiry/v2/tree/menuRebuildModel.mjs +8 -51
- package/dist/inquiry/v2/tree/menuRebuildModel.mjs.map +1 -1
- package/dist/inquiry/v2/tree/pagedChildrenModel.d.ts +26 -0
- package/dist/inquiry/v2/tree/pagedChildrenModel.d.ts.map +1 -0
- package/dist/inquiry/v2/tree/pagedChildrenModel.js +56 -0
- package/dist/inquiry/v2/tree/pagedChildrenModel.js.map +1 -0
- package/dist/inquiry/v2/tree/pagedChildrenModel.mjs +43 -0
- package/dist/inquiry/v2/tree/pagedChildrenModel.mjs.map +1 -0
- package/dist/inquiry/v2/tree/rootRemovalModel.d.ts +7 -0
- package/dist/inquiry/v2/tree/rootRemovalModel.d.ts.map +1 -1
- package/dist/inquiry/v2/tree/rootRemovalModel.js +31 -5
- package/dist/inquiry/v2/tree/rootRemovalModel.js.map +1 -1
- package/dist/inquiry/v2/tree/rootRemovalModel.mjs +21 -4
- package/dist/inquiry/v2/tree/rootRemovalModel.mjs.map +1 -1
- package/dist/inquiry/v2/tree/treeFilterModel.d.ts +0 -2
- package/dist/inquiry/v2/tree/treeFilterModel.d.ts.map +1 -1
- package/dist/inquiry/v2/tree/treeFilterModel.js +0 -7
- package/dist/inquiry/v2/tree/treeFilterModel.js.map +1 -1
- package/dist/inquiry/v2/tree/treeFilterModel.mjs.map +1 -1
- package/dist/inquiry/v2/tree/useInquiryMenu.d.ts +16 -7
- package/dist/inquiry/v2/tree/useInquiryMenu.d.ts.map +1 -1
- package/dist/inquiry/v2/tree/useInquiryMenu.js +401 -163
- package/dist/inquiry/v2/tree/useInquiryMenu.js.map +1 -1
- package/dist/inquiry/v2/tree/useInquiryMenu.mjs +511 -310
- package/dist/inquiry/v2/tree/useInquiryMenu.mjs.map +1 -1
- package/dist/inquiry/v2/tree/waveLoader.d.ts +10 -11
- package/dist/inquiry/v2/tree/waveLoader.d.ts.map +1 -1
- package/dist/inquiry/v2/tree/waveLoader.js +78 -72
- package/dist/inquiry/v2/tree/waveLoader.js.map +1 -1
- package/dist/inquiry/v2/tree/waveLoader.mjs +79 -68
- package/dist/inquiry/v2/tree/waveLoader.mjs.map +1 -1
- package/dist/inquiry/v2/widgets/listRow.module.css +27 -0
- package/dist/inquiry/v2/widgets/widgetRowModel.d.ts +6 -2
- package/dist/inquiry/v2/widgets/widgetRowModel.d.ts.map +1 -1
- package/dist/inquiry/v2/widgets/widgetRowModel.js +49 -14
- package/dist/inquiry/v2/widgets/widgetRowModel.js.map +1 -1
- package/dist/inquiry/v2/widgets/widgetRowModel.mjs +36 -12
- package/dist/inquiry/v2/widgets/widgetRowModel.mjs.map +1 -1
- package/dist/maintenance/UdpTaggedRecordsPage.mjs +1 -1
- package/dist/maintenance/api/lookupApi.mjs +1 -1
- package/dist/maintenance/api/tagsApi.mjs +1 -1
- package/dist/maintenance/config/nodeDefaults.d.ts.map +1 -1
- package/dist/maintenance/config/nodeDefaults.js +16 -5
- package/dist/maintenance/config/nodeDefaults.js.map +1 -1
- package/dist/maintenance/config/nodeDefaults.mjs +14 -5
- package/dist/maintenance/config/nodeDefaults.mjs.map +1 -1
- package/dist/maintenance/config/useEntityConfig.mjs +1 -1
- package/dist/maintenance/config/useLinkedLabels.mjs +1 -1
- package/dist/maintenance/grid/MaintenanceGrid.mjs +1 -1
- package/dist/maintenance/metadata/useEntityMetadata.mjs +1 -1
- package/dist/maintenance/record/ChildTab.mjs +1 -1
- package/dist/maintenance/record/DeleteRecordDialog.mjs +1 -1
- package/dist/maintenance/record/LinkRecordsSheet.mjs +1 -1
- package/dist/maintenance/record/RecordFacts.mjs +1 -1
- package/dist/maintenance/record/RecordSheet.mjs +2 -2
- package/dist/maintenance/record/displayValue.mjs +1 -1
- package/dist/maintenance/record/stampDisplayText.mjs +1 -1
- package/dist/maintenance/settings/useEntityCatalog.mjs +1 -1
- package/dist/maintenanceEngine/tableBrowser/TableColumnDefs.d.ts +4 -5
- package/dist/maintenanceEngine/tableBrowser/TableColumnDefs.d.ts.map +1 -1
- package/dist/stores/inquiryStore.d.ts +2 -1
- package/dist/stores/inquiryStore.d.ts.map +1 -1
- package/dist/stores/inquiryStore.js +4 -3
- package/dist/stores/inquiryStore.js.map +1 -1
- package/dist/stores/inquiryStore.mjs +18 -11
- package/dist/stores/inquiryStore.mjs.map +1 -1
- package/dist/udp/pages/UdpMaintenanceEnginePage/UdpMaintenanceEnginePage.d.ts.map +1 -1
- package/dist/udp/pages/UdpMaintenanceEnginePage/UdpMaintenanceEnginePage.js +1 -1
- package/dist/udp/pages/UdpMaintenanceEnginePage/UdpMaintenanceEnginePage.js.map +1 -1
- package/dist/udp/pages/UdpMaintenanceEnginePage/UdpMaintenanceEnginePage.mjs +2 -1
- package/dist/udp/pages/UdpMaintenanceEnginePage/UdpMaintenanceEnginePage.mjs.map +1 -1
- package/dist/udp/pages/UdpMaintenanceEnginePage/components/EntitiyTimeLine.mjs +1 -1
- package/dist/udp/utilities/useDateStringColumnDef.d.ts +1 -1
- package/dist/utilities/i18n/locales/es-US.json +23 -5
- package/dist/utilities/i18n/locales/es-US.mjs +24 -4
- package/dist/utilities/i18n/locales/fr-CA.json +23 -5
- package/dist/utilities/i18n/locales/fr-CA.mjs +24 -4
- package/package.json +30 -18
- package/dist/actionPanels/PanelActionForm.d.ts +0 -56
- package/dist/actionPanels/PanelActionForm.d.ts.map +0 -1
- package/dist/actionPanels/PanelActionForm.js +0 -30
- package/dist/actionPanels/PanelActionForm.js.map +0 -1
- package/dist/actionPanels/PanelActionForm.mjs +0 -168
- package/dist/actionPanels/PanelActionForm.mjs.map +0 -1
- package/dist/actionPanels/PanelEditor.d.ts +0 -44
- package/dist/actionPanels/PanelEditor.d.ts.map +0 -1
- package/dist/actionPanels/PanelEditor.js +0 -78
- package/dist/actionPanels/PanelEditor.js.map +0 -1
- package/dist/actionPanels/PanelEditor.mjs +0 -345
- package/dist/actionPanels/PanelEditor.mjs.map +0 -1
- package/dist/actionPanels/panelActionFields.module.css +0 -18
- package/dist/domain/inquiryTree/ruleBindings.d.ts +0 -10
- package/dist/domain/inquiryTree/ruleBindings.d.ts.map +0 -1
- package/dist/domain/inquiryTree/ruleBindings.js +0 -20
- package/dist/domain/inquiryTree/ruleBindings.js.map +0 -1
- package/dist/domain/inquiryTree/ruleBindings.mjs +0 -21
- package/dist/domain/inquiryTree/ruleBindings.mjs.map +0 -1
- package/dist/inquiry/v2/kernel/readOnlyModel.d.ts +0 -17
- package/dist/inquiry/v2/kernel/readOnlyModel.d.ts.map +0 -1
- package/dist/inquiry/v2/kernel/readOnlyModel.js +0 -19
- package/dist/inquiry/v2/kernel/readOnlyModel.js.map +0 -1
- package/dist/inquiry/v2/kernel/readOnlyModel.mjs +0 -21
- package/dist/inquiry/v2/kernel/readOnlyModel.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilotModel.mjs","names":["humanizeFieldName","simpleEntityName","upperFirst","SearchFilterElement","SearchableEntity","nodeEntityName","resolveRowLabel","DisplayNode","resolveNodeViewModel","NodeViewTab","CopilotToolDefinition","type","function","name","description","parameters","Record","MAX_NODE_MATCHES","MAX_FIND_ROWS","MAX_CONTEXT_ROOTS","LoadedNodeRef","label","entity","businessObjectKey","menuIndex","nodeId","parentLabel","childCount","isGroup","entityOf","node","raw","undefined","keyOf","nodeObj","flattenMenuNodes","menuList","Array","ref","out","walk","push","String","id","children","length","isGroupNode","forEach","child","menu","root","resolveMenuNode","match","error","all","wanted","trim","byId","find","item","byKey","lower","toLowerCase","exact","filter","partial","includes","MAX_RECORD_FIELDS","RECORD_IDENTIFIER_FIELDS","Set","LOOKUP_SUFFIX","RecordFieldProjection","field","value","RecordProjection","header","display","fields","truncated","tabs","clip","text","MAX_CELL_CHARS","slice","projectRecord","model","kind","map","key","Object","entries","endsWith","has","lookup","tab","resolveTab","Pick","names","join","childrenPendingLoad","properties","lazyLoadChildrenArr","FoundRecordRef","alreadyLoaded","LoadedRowProjection","Omit","projectLoadedRows","refs","rest","LoadedRowSummary","recordCount","groupCount","rowCount","byEntity","count","UNTYPED_ENTITY","summarizeLoadedRows","counts","Map","set","get","plural","one","many","describeLoadedComposition","summary","split","groups","foundRecordToken","index","noArgs","additionalProperties","findRecordsTool","entityName","required","loadRecordTool","record","listLoadedRecordsTool","query","selectNodeTool","filterTreeTool","clearFilterTool","expandAllTool","collapseAllTool","readRecordTool","expandNodeTool","switchTabTool","MAX_QUERY_ROWS","MAX_ROW_FIELDS","DEFAULT_QUERY_ROWS","QueryConditionInput","operator","values","QueryField","QueryEntitySchema","displayName","QuerySchemaContext","filterFields","path","columns","buildQueryEntitySchema","normalizeType","seen","add","fieldKey","entry","searchConfiguration","searchable","template","quickSearchTemplates","searchField","column","resultColumns","toSearchSchemaContext","schema","replace","resolveFieldPath","resolveConditionFields","conditions","condition","MAX_SCHEMA_FIELDS","MAX_FIELD_SUGGESTIONS","explainUnknownField","fieldPath","words","word","near","some","shown","QueryEntitySchemaResult","filterableFields","operators","describeEntitySchema","operatorsByType","default","mapConditionsToFilterElements","operatorToBackend","searchOperator","equals","searchValue","describeConditions","operatorLabels","queryRowFields","requested","Boolean","ProjectedQueryRows","rows","clippedCells","projectQueryRows","projected","row","JSON","stringify","clampQueryPageSize","pageSize","Math","min","max","Number","getEntitySchemaTool","conditionsSchema","items","enum","buildQueryRecordsTool","buildProposeAdvancedSearchTool","explanation","COPILOT_TOOL_DEFINITIONS","CopilotContextInput","treeName","treeOutline","searchableEntities","loadedNodes","rootLabels","selected","selectedRootLabel","filterText","filterMatchCount","isLoadingRecords","today","activeTabId","buildCopilotContext","input","lines","named","open"],"sources":["../../../../src/inquiry/v2/ai/copilotModel.ts"],"sourcesContent":["/**\n * The inquiry copilot's PURE half: tool schemas, loaded-node resolution, result\n * projection, and the per-turn context string. No React, no HTTP, no .js\n * helpers — so every decision here runs under the node:test domain harness\n * (`pnpm test:domain`) while the wiring file stays a wiring file.\n *\n * Split follows the Tree Builder copilot precedent (describeTree.ts / tools.ts /\n * TreeCopilot.tsx): schemas and describers are data, the capability is glue.\n */\nimport {\n humanizeFieldName,\n simpleEntityName,\n upperFirst\n} from '../search/searchModel';\nimport type {\n SearchFilterElement,\n SearchableEntity\n} from '../search/searchModel';\nimport {\n nodeEntityName,\n resolveRowLabel,\n type DisplayNode\n} from '../../../domain/inquiryTree/displayTree';\nimport { resolveNodeViewModel } from '../../../domain/nodeView/model';\nimport type { NodeViewTab } from '../../../domain/nodeView/model';\n\n/**\n * The OpenAI function-tool shape, restated structurally so this module stays\n * free of `aiAssistant/openai` (which pulls in axios and therefore cannot\n * compile under the domain harness). A type alias, not an interface, so it\n * stays assignable to `OpenAiToolDefinition`, whose open index signature\n * an interface would not satisfy.\n */\nexport type CopilotToolDefinition = {\n type: 'function';\n function: {\n name: string;\n description: string;\n parameters: Record<string, unknown>;\n };\n};\n\n/** Longest list of loaded rows / found records handed back in one result. */\nexport const MAX_NODE_MATCHES = 30;\nexport const MAX_FIND_ROWS = 10;\n/** Loaded root labels named in the context line before it says \"+N more\". */\nconst MAX_CONTEXT_ROOTS = 8;\n\n/* ------------------------------------------------------------ loaded nodes */\n\n/** One row of the loaded tree, as the model sees it. */\nexport interface LoadedNodeRef {\n /** The exact string the tree row shows (resolveRowLabel — never a raw column). */\n label: string;\n entity?: string;\n businessObjectKey?: string;\n /** Which menu the row lives in — the menu list is a list of menus. */\n menuIndex: number;\n /** The display-tree node id: what selectNodeById takes. */\n nodeId: string;\n parentLabel?: string;\n childCount: number;\n isGroup: boolean;\n}\n\nconst entityOf = (node: DisplayNode): string | undefined => {\n const raw = nodeEntityName(node);\n return raw ? simpleEntityName(raw) : undefined;\n};\n\nconst keyOf = (node: DisplayNode): string | undefined => {\n const raw = node.nodeObj?.businessObjectKey;\n return typeof raw === 'string' && raw ? raw : undefined;\n};\n\n/** Every row currently rendered in the tree pane, depth-first, menu by menu. */\nexport const flattenMenuNodes = (\n menuList: DisplayNode[][]\n): Array<{ node: DisplayNode; ref: LoadedNodeRef }> => {\n const out: Array<{ node: DisplayNode; ref: LoadedNodeRef }> = [];\n const walk = (\n node: DisplayNode | null | undefined,\n menuIndex: number,\n parentLabel?: string\n ): void => {\n if (!node) return;\n const label = resolveRowLabel(node);\n out.push({\n node,\n ref: {\n label,\n entity: entityOf(node),\n businessObjectKey: keyOf(node),\n menuIndex,\n nodeId: String(node.id),\n parentLabel,\n childCount: node.children?.length ?? 0,\n isGroup: !!node.isGroupNode\n }\n });\n (node.children ?? []).forEach((child) => walk(child, menuIndex, label));\n };\n menuList.forEach((menu, menuIndex) =>\n menu.forEach((root) => walk(root, menuIndex))\n );\n return out;\n};\n\n/**\n * Resolve a model-supplied loaded-row reference: node id, then businessObjectKey,\n * then exact label, then unique label substring. Ambiguity comes back as an\n * error the model can repair from rather than the wrong row quietly opening —\n * the same semantics as the domain `resolveNodeRef`.\n */\nexport const resolveMenuNode = (\n menuList: DisplayNode[][],\n ref: string\n): { match?: { node: DisplayNode; ref: LoadedNodeRef }; error?: string } => {\n const all = flattenMenuNodes(menuList);\n const wanted = String(ref ?? '').trim();\n if (!wanted) return { error: 'node is required.' };\n const byId = all.find((item) => item.ref.nodeId === wanted);\n if (byId) return { match: byId };\n const byKey = all.find((item) => item.ref.businessObjectKey === wanted);\n if (byKey) return { match: byKey };\n const lower = wanted.toLowerCase();\n const exact = all.filter((item) => item.ref.label.toLowerCase() === lower);\n if (exact.length === 1) return { match: exact[0] };\n if (exact.length > 1)\n return {\n error: `\"${wanted}\" matches ${exact.length} loaded rows — use the nodeId from list_loaded_records.`\n };\n const partial = all.filter((item) =>\n item.ref.label.toLowerCase().includes(lower)\n );\n if (partial.length === 1) return { match: partial[0] };\n if (partial.length > 1)\n return {\n error: `\"${wanted}\" is ambiguous (${partial.length} loaded rows match) — use a longer label or the nodeId.`\n };\n return {\n error: `No loaded row matches \"${wanted}\". Call list_loaded_records, or find_records + load_record to bring it in.`\n };\n};\n\n/* ------------------------------------------------------- record reading */\n\n/** Scalars one read_record result carries beyond the header fields. */\nexport const MAX_RECORD_FIELDS = 40;\n\n/** Identifiers the model already has in tool arguments — never worth a line. */\nconst RECORD_IDENTIFIER_FIELDS = new Set(['businessobjectkey']);\nconst LOOKUP_SUFFIX = 'LookupValue';\n\nexport interface RecordFieldProjection {\n /** The name a person reads. */\n name: string;\n /** The wire name — the same string get_entity_schema reports. */\n field: string;\n value: string;\n}\n\n/** One loaded record as read_record reports it. */\nexport interface RecordProjection {\n label: string;\n entity?: string;\n /** What the record header shows, in its configured order. */\n header: Array<{ label: string; value: string; display: string }>;\n /** Every other scalar the row carries, lookups already resolved to text. */\n fields: RecordFieldProjection[];\n truncated: boolean;\n /** The record pane's tabs for this row, in order. */\n tabs: Array<{ id: string; label: string }>;\n /** Child rows currently loaded under it. */\n children: number;\n}\n\nconst clip = (text: string): string =>\n text.length > MAX_CELL_CHARS ? `${text.slice(0, MAX_CELL_CHARS)}…` : text;\n\n/**\n * The record the row IS, read straight off the row: no fetch, because the tree\n * already holds every value its header and pages read. Header fields come\n * first exactly as the view resolves them (same domain model, so a stat or a\n * badge reads the same text the user sees); the rest are the row's scalars,\n * with a lookup's display text standing in for its id, as the header does.\n */\nexport const projectRecord = (node: DisplayNode): RecordProjection => {\n const model = resolveNodeViewModel(node);\n const header =\n model.header.kind === 'fields'\n ? model.header.fields.map((field) => ({\n label: field.label,\n value: field.value,\n display: field.display\n }))\n : [];\n const nodeObj = node.nodeObj ?? {};\n const fields: RecordFieldProjection[] = [];\n for (const [key, raw] of Object.entries(nodeObj)) {\n if (raw === undefined || raw === null || raw === '') continue;\n if (typeof raw === 'object') continue;\n if (key.endsWith(LOOKUP_SUFFIX)) continue;\n if (RECORD_IDENTIFIER_FIELDS.has(key.toLowerCase())) continue;\n const lookup = nodeObj[`${key}${LOOKUP_SUFFIX}`];\n const value =\n lookup !== undefined && lookup !== null && lookup !== '' ? lookup : raw;\n fields.push({\n name: humanizeFieldName(key),\n field: key,\n value: clip(String(value as string | number | boolean))\n });\n }\n return {\n label: resolveRowLabel(node),\n entity: entityOf(node),\n header,\n fields: fields.slice(0, MAX_RECORD_FIELDS),\n truncated: fields.length > MAX_RECORD_FIELDS,\n tabs: model.tabs.map((tab) => ({ id: tab.id, label: tab.label })),\n children: node.children?.length ?? 0\n };\n};\n\n/**\n * Resolve a model-supplied tab reference against the selected record's tabs:\n * id, then exact label, then unique label substring — the resolveMenuNode\n * grammar, so the model addresses tabs the way it addresses rows.\n */\nexport const resolveTab = (\n tabs: Array<Pick<NodeViewTab, 'id' | 'label'>>,\n ref: string\n): { match?: Pick<NodeViewTab, 'id' | 'label'>; error?: string } => {\n const wanted = String(ref ?? '').trim();\n if (!wanted) return { error: 'tab is required.' };\n if (!tabs.length) return { error: 'The selected record has no tabs.' };\n const names = tabs.map((tab) => `\"${tab.label}\"`).join(', ');\n const byId = tabs.find((tab) => tab.id === wanted);\n if (byId) return { match: byId };\n const lower = wanted.toLowerCase();\n const exact = tabs.find((tab) => tab.label.toLowerCase() === lower);\n if (exact) return { match: exact };\n const partial = tabs.filter((tab) => tab.label.toLowerCase().includes(lower));\n if (partial.length === 1) return { match: partial[0] };\n if (partial.length > 1)\n return { error: `\"${wanted}\" matches ${partial.length} tabs: ${names}.` };\n return { error: `No tab matches \"${wanted}\". Tabs: ${names}.` };\n};\n\n/**\n * Whether flagging this row expanded will FETCH: it has an unloaded lazy level\n * with something to load. The same predicate the menu's pre-expanded-row\n * effect fires on (waveLoad `collectPreExpandedLazyRows`), minus the flag\n * itself — so expand_node knows whether to wait for children to arrive.\n */\nexport const childrenPendingLoad = (node: DisplayNode): boolean =>\n !node.isGroupNode &&\n node.properties?.['lazyLoad'] === true &&\n !node['completedLoadingChildren'] &&\n !!node.lazyLoadChildrenArr?.length;\n\n/* ---------------------------------------------------------- find → load ref */\n\n/**\n * A record the copilot found but has not loaded. `ref` is the chaining token:\n * find_records mints it, load_record takes it, and the row itself never has to\n * travel through the model — so a load always uses the exact record that was\n * found, not a re-derived guess at it.\n */\nexport interface FoundRecordRef {\n ref: string;\n label: string;\n entity: string;\n businessObjectKey?: string;\n alreadyLoaded: boolean;\n}\n\n/**\n * The model-facing row shape: `isGroup` is replaced by an explicit `kind` so a\n * grouping heading can never be read as a record. The bug this closes is the\n * copilot answering \"3 records loaded\" for 2 records under 1 group heading.\n */\nexport type LoadedRowProjection = Omit<LoadedNodeRef, 'isGroup'> & {\n kind: 'group' | 'record';\n};\n\nexport const projectLoadedRows = (\n refs: LoadedNodeRef[]\n): LoadedRowProjection[] =>\n refs.map(({ isGroup, ...rest }) => ({\n ...rest,\n kind: isGroup ? 'group' : 'record'\n }));\n\n/** Records vs group headings, and the per-entity split of the records. */\nexport interface LoadedRowSummary {\n recordCount: number;\n groupCount: number;\n rowCount: number;\n /** Entity name → record count, in the order the rows first appear. */\n byEntity: Array<{ entity: string; count: number }>;\n}\n\n/** Records without a resolvable entity name are counted under this bucket. */\nconst UNTYPED_ENTITY = 'untyped';\n\nexport const summarizeLoadedRows = (\n refs: LoadedNodeRef[]\n): LoadedRowSummary => {\n const counts = new Map<string, number>();\n let recordCount = 0;\n let groupCount = 0;\n for (const ref of refs) {\n if (ref.isGroup) {\n groupCount += 1;\n continue;\n }\n recordCount += 1;\n const entity = ref.entity || UNTYPED_ENTITY;\n counts.set(entity, (counts.get(entity) ?? 0) + 1);\n }\n return {\n recordCount,\n groupCount,\n rowCount: refs.length,\n byEntity: [...counts].map(([entity, count]) => ({ entity, count }))\n };\n};\n\nconst plural = (count: number, one: string, many: string): string =>\n `${count} ${count === 1 ? one : many}`;\n\n/**\n * One compact line stating the composition of the tree pane, so \"how many\n * records?\" is answered from the context instead of by counting rows.\n * e.g. `Loaded: 3 records (2 Resource, 1 Assignment) plus 1 group heading — 4 rows total.`\n */\nexport const describeLoadedComposition = (\n summary: LoadedRowSummary\n): string => {\n const split = summary.byEntity.length\n ? ` (${summary.byEntity\n .map((item) => `${item.count} ${item.entity}`)\n .join(', ')})`\n : '';\n const groups = summary.groupCount\n ? ` plus ${plural(summary.groupCount, 'group heading', 'group headings')}`\n : '';\n return (\n `Loaded: ${plural(summary.recordCount, 'record', 'records')}${split}${groups}` +\n ` — ${plural(summary.rowCount, 'row', 'rows')} total.`\n );\n};\n\n/** `f1`, `f2`, … — short enough that the model quotes them back verbatim. */\nexport const foundRecordToken = (index: number): string => `f${index + 1}`;\n\n/* ------------------------------------------------------------- tool schemas */\n\nconst noArgs = { type: 'object', additionalProperties: false, properties: {} };\n\nexport const findRecordsTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'find_records',\n description:\n \"Search the tree's searchable entities for records the user names, whether or not they are loaded. Returns a ref token per hit — pass that to load_record to bring one into the tree. This is a SEARCH, not a data answer: report how many matched and name them, never dump their fields.\",\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n text: {\n type: 'string',\n description:\n \"What to search for, as the user would type it into the tree's own search box.\"\n },\n entityName: {\n type: 'string',\n description:\n 'Limit the search to one searchable entity (simple name, from your context). Omit to search them all.'\n }\n },\n required: ['text']\n }\n }\n};\n\nexport const loadRecordTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'load_record',\n description:\n 'Bring a record found by find_records into the tree, exactly as the + Load dialog does — it is added as a root, selected, and its record view opens. A record already in the tree is selected rather than duplicated.',\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n record: {\n type: 'string',\n description:\n 'A ref token from the last find_records result (e.g. \"f2\"), or that result\\'s exact label.'\n }\n },\n required: ['record']\n }\n }\n};\n\nexport const listLoadedRecordsTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'list_loaded_records',\n description:\n 'List the rows currently loaded in the tree (optionally filtered by a label or entity substring). Returns the nodeIds select_node takes. Every row carries kind: \"record\" or \"group\" — a group row is a heading that organizes records and is never itself a record, so count only kind \"record\" rows when the user asks how many records are loaded.',\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n query: {\n type: 'string',\n description:\n 'Case-insensitive substring of the row label or entity name. Omit to list everything.'\n }\n }\n }\n }\n};\n\nexport const selectNodeTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'select_node',\n description:\n \"Select a row that is already loaded in the tree so its record view opens. Accepts the nodeId (preferred), the record's businessObjectKey, or a unique row label.\",\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n node: {\n type: 'string',\n description: 'nodeId, businessObjectKey, or unique label.'\n }\n },\n required: ['node']\n }\n }\n};\n\nexport const filterTreeTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'filter_tree',\n description:\n 'Filter the loaded tree rows by text: matches are highlighted and everything else is dimmed. Nothing is fetched, hidden or removed — use find_records when the record may not be loaded yet.',\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n text: { type: 'string', description: 'Text to highlight rows by.' }\n },\n required: ['text']\n }\n }\n};\n\nexport const clearFilterTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'clear_filter',\n description:\n 'Clear the tree filter and put the tree back the way the user had it expanded.',\n parameters: noArgs\n }\n};\n\nexport const expandAllTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'expand_all',\n description:\n 'Expand every loaded level of the tree. Levels whose records have not been fetched stay closed — this never triggers a load.',\n parameters: noArgs\n }\n};\n\nexport const collapseAllTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'collapse_all',\n description: 'Collapse every row in the tree.',\n parameters: noArgs\n }\n};\n\nexport const readRecordTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'read_record',\n description:\n \"Read a loaded record's data: the fields its header shows, every other value the row carries (lookups already as text), the tabs its record pane offers, and how many child rows are loaded under it. Defaults to the selected record; pass node for another loaded row. This is how you answer \\\"what is this record's …?\\\" — from the row, with no query. Quote the values the user asked about; never recite the whole list unasked.\",\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n node: {\n type: 'string',\n description:\n 'nodeId, businessObjectKey, or unique label of a loaded row. Omit for the selected record.'\n }\n }\n }\n }\n};\n\nexport const expandNodeTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'expand_node',\n description:\n \"Expand one loaded row so its child rows show — the same as clicking its chevron. A child level that has not been fetched yet loads now (this is the ONE tool that fetches children), and the result waits for it. Call this before counting or listing a row's children when it is collapsed or its children are not loaded; then list_loaded_records shows them.\",\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n node: {\n type: 'string',\n description: 'nodeId, businessObjectKey, or unique label.'\n }\n },\n required: ['node']\n }\n }\n};\n\nexport const switchTabTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'switch_tab',\n description:\n \"Open one of the selected record's tabs in the record pane — the tab's page is what the user then sees. Your context lists the tabs and which is open; read_record lists them too.\",\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n tab: { type: 'string', description: 'Tab label (or id).' }\n },\n required: ['tab']\n }\n }\n};\n\n/* ------------------------------------------- conditions: query + advanced */\n\n/**\n * Rows one query_records call may return, fields per row, and characters per\n * cell. The copilot answers questions from data — it does not page through it,\n * so the caps are what keeps a \"how many overdue?\" from arriving as a table.\n */\nexport const MAX_QUERY_ROWS = 50;\nexport const MAX_ROW_FIELDS = 12;\nexport const MAX_CELL_CHARS = 200;\n/** Rows a query returns when the model names no page size. */\nexport const DEFAULT_QUERY_ROWS = 10;\n\n/** One filter condition as the model emits it (shared searchIntent vocabulary). */\nexport interface QueryConditionInput {\n field?: string;\n operator?: string;\n value?: string;\n values?: string[];\n}\n\n/** One filterable field, in BOTH vocabularies people and wires use. */\nexport interface QueryField {\n /** The wire name the search API filters on (\"ResourceTypeId\"). */\n field: string;\n /** The name a person reads, as the tree's own search UI shows it. */\n name: string;\n /** Normalized type — what decides the field's allowed operators. */\n type: string;\n}\n\n/**\n * ONE searchable entity's filterable vocabulary. This is the single source of\n * truth for the copilot's filtering: `get_entity_schema` reports it, the\n * validator checks against it, and field references are resolved through it —\n * so what the model is TOLD it may filter on and what it is ALLOWED to filter on\n * can never disagree.\n */\nexport interface QueryEntitySchema {\n /** Simple catalog name (\"Resource\"). */\n entityName: string;\n /** The tree's own label for the set (\"Resources\"). */\n displayName: string;\n fields: QueryField[];\n}\n\n/**\n * The shape the shared `validateIntent` checks against (structurally\n * `AiSearchSchemaContext`, restated here so this module stays free of\n * `searchIntent` — which imports the stencil package and therefore\n * cannot run under the domain harness).\n */\nexport interface QuerySchemaContext {\n entityName: string;\n filterFields: Array<{ path: string; type: string }>;\n /** Always empty: neither tool sorts, groups or projects columns. */\n columns: never[];\n}\n\n/**\n * What the model may filter a searchable entity on: the UNION of every field\n * this tree is known to filter that entity by — its configured search set, the\n * fields quick search stamps text into, and the columns its query projects.\n * Wire-cased exactly as `buildAdvancedSearchSchema` cases the drawer's (so a\n * copilot-built filter element is indistinguishable from a drawer-built one) and\n * labelled exactly as the tree humanizes them (so a name read off the screen is\n * a name that works). Deduped by name, first source winning — see the numbered\n * comments for why that order.\n *\n * The union is the point. A tree routinely configures ONE search field while its\n * query projects a dozen and its record header displays all of them; a schema\n * built from the search config alone can only answer \"you may filter by Name\",\n * which is false and sends the user away. Every field here is one the backend\n * accepts a filter on.\n */\nexport const buildQueryEntitySchema = (\n entity: Pick<\n SearchableEntity,\n | 'entityName'\n | 'displayName'\n | 'searchConfiguration'\n | 'quickSearchTemplates'\n | 'resultColumns'\n >,\n /** Catalog/.NET type → the operator vocabulary's type (normalizeSearchFieldType). */\n normalizeType: (type: string | null | undefined) => string\n): QueryEntitySchema => {\n const fields: QueryField[] = [];\n const seen = new Set<string>();\n const add = (field: string, name: string, type: string): void => {\n const key = fieldKey(field);\n if (!key || seen.has(key)) return;\n seen.add(key);\n fields.push({ field, name, type });\n };\n\n // 1. The configured search set — the only source that carries a TYPE, so it\n // goes first and wins the type of any field the later sources repeat.\n for (const entry of entity.searchConfiguration ?? []) {\n if (entry.searchable === false || !entry.name) continue;\n add(\n upperFirst(entry.name),\n humanizeFieldName(entry.name),\n normalizeType(entry.type)\n );\n }\n // 2. The fields QUICK SEARCH itself filters on. The tree already sends these\n // to the backend on every keystroke, so they are known-good filter fields\n // — and they are the list the user sees searched, which makes them the\n // first thing anyone names. Field names are authored, so they pass through\n // verbatim. No declared type, so only = and ≠ are offered.\n for (const template of entity.quickSearchTemplates ?? []) {\n if (!template?.searchField) continue;\n add(\n template.searchField,\n humanizeFieldName(template.searchField),\n 'default'\n );\n }\n // 3. The query's own projected columns — ALWAYS, not a fallback. A selected\n // column is filterable: `executeQueryAdHoc` accepts a filter on any of\n // them, which is exactly what the record grids' column filters do every day\n // (SearchServiceDatasource sends `upperFirst(columnField)` as searchField —\n // the same string built here). It matters because a tree commonly\n // configures ONE search field while its query projects a dozen, and the\n // record header shows every one of them: a user reading \"Resource type: 1\"\n // off the screen is naming a column, not a search-config entry.\n for (const column of entity.resultColumns) {\n add(\n upperFirst(column.field),\n column.header || humanizeFieldName(column.field),\n 'default'\n );\n }\n\n return {\n entityName: simpleEntityName(entity.entityName),\n displayName: entity.displayName,\n fields\n };\n};\n\n/** The same schema, in the shape the shared validator reads. */\nexport const toSearchSchemaContext = (\n schema: QueryEntitySchema\n): QuerySchemaContext => ({\n entityName: schema.entityName,\n filterFields: schema.fields.map((field) => ({\n path: field.field,\n type: field.type\n })),\n columns: []\n});\n\n/** Letters and digits only: \"Resource Type Id\" / \"resource_type_id\" → \"resourcetypeid\". */\nconst fieldKey = (name: string): string =>\n String(name ?? '')\n .toLowerCase()\n .replace(/[^a-z0-9]/g, '');\n\n/**\n * A model-supplied field reference → the wire name, or undefined. Both\n * vocabularies are accepted — the wire name and the display name the search UI\n * shows — because a model reading the screen (and a user reading it over its\n * shoulder) speaks the display name, and nobody outside this file should have\n * to know the wire casing. Punctuation and case are ignored on both sides.\n */\nexport const resolveFieldPath = (\n schema: QueryEntitySchema,\n name: string | undefined\n): string | undefined => {\n const wanted = fieldKey(String(name ?? ''));\n if (!wanted) return undefined;\n return schema.fields.find(\n (field) =>\n fieldKey(field.field) === wanted || fieldKey(field.name) === wanted\n )?.field;\n};\n\n/**\n * Rewrite every condition's field into the wire vocabulary the validator and\n * the search API use. Unresolvable references are left ALONE so the shared\n * validator reports them — with `explainUnknownField` naming the alternatives —\n * rather than this function inventing a match.\n */\nexport const resolveConditionFields = (\n schema: QueryEntitySchema,\n conditions: QueryConditionInput[] | null | undefined\n): QueryConditionInput[] =>\n (conditions ?? []).map((condition) => {\n const path = resolveFieldPath(schema, condition?.field);\n return path ? { ...condition, field: path } : condition;\n });\n\n/** Fields shown before a schema result says \"call again for the rest\". */\nexport const MAX_SCHEMA_FIELDS = 60;\n/** Alternatives named when a field reference doesn't match anything. */\nconst MAX_FIELD_SUGGESTIONS = 5;\n\n/**\n * The repair message an unmatched field gets: the closest real fields, in BOTH\n * names, so one round trip fixes it. Fed to the shared validator's\n * `explainUnknownField` hook — the model never sees a bare \"not a filterable\n * field\" it can only answer by asking the user for a wire name.\n */\nexport const explainUnknownField = (\n schema: QueryEntitySchema,\n fieldPath: string\n): string => {\n // Word overlap, not substring: \"Resource Kind\" should surface every Resource\n // field, which a whole-string comparison misses. Short words (\"id\", \"no\")\n // match too much to be evidence of anything.\n const words = String(fieldPath ?? '')\n .split(/[^A-Za-z0-9]+|(?=[A-Z])/)\n .map((word) => word.toLowerCase())\n .filter((word) => word.length > 2);\n const wanted = fieldKey(fieldPath);\n const near = schema.fields.filter((field) => {\n const key = fieldKey(field.field);\n if (key.includes(wanted) || wanted.includes(key)) return true;\n return words.some((word) => key.includes(word));\n });\n const shown = (near.length ? near : schema.fields).slice(\n 0,\n MAX_FIELD_SUGGESTIONS\n );\n if (!shown.length)\n return `\"${fieldPath}\" is not filterable — ${schema.entityName} has no configured search fields.`;\n return (\n `\"${fieldPath}\" is not a filterable field on ${schema.entityName}. ` +\n `${near.length ? 'Closest' : 'Filterable'}: ${shown\n .map((field) => `${field.name} (${field.field})`)\n .join(', ')}` +\n `${schema.fields.length > shown.length ? ', …' : ''}. ` +\n 'Call get_entity_schema for the full list.'\n );\n};\n\n/** One entity's schema as the get_entity_schema tool reports it. */\nexport interface QueryEntitySchemaResult {\n entity: string;\n displayName: string;\n filterableFields: Array<{\n name: string;\n field: string;\n type: string;\n operators: string[];\n }>;\n truncated: boolean;\n}\n\n/**\n * The schema tool's answer, built from the SAME QueryEntitySchema the validator\n * checks against — so every field it reports is a field a query will accept,\n * and every operator it names is one that field allows.\n */\nexport const describeEntitySchema = (\n schema: QueryEntitySchema,\n /** Normalized type → allowed operators (searchIntent's OPERATORS_BY_TYPE). */\n operatorsByType: Record<string, string[]>\n): QueryEntitySchemaResult => ({\n entity: schema.entityName,\n displayName: schema.displayName,\n filterableFields: schema.fields\n .slice(0, MAX_SCHEMA_FIELDS)\n .map((field) => ({\n name: field.name,\n field: field.field,\n type: field.type,\n operators: operatorsByType[field.type] ?? operatorsByType.default ?? []\n })),\n truncated: schema.fields.length > MAX_SCHEMA_FIELDS\n});\n\n/**\n * Conditions → search filter elements, mapped through the shared operator table\n * (injected: its values are stencil constants). Multi-value operators are\n * comma-joined, matching the shared compiler and the manual builder's storage.\n * Field names pass through verbatim — `resolveConditionFields` already put them\n * in the wire vocabulary.\n */\nexport const mapConditionsToFilterElements = (\n conditions: QueryConditionInput[] | null | undefined,\n operatorToBackend: Record<string, string>\n): SearchFilterElement[] =>\n (conditions ?? [])\n .filter((condition) => !!condition?.field)\n .map((condition) => ({\n searchField: String(condition.field),\n searchOperator:\n operatorToBackend[String(condition.operator)] ??\n operatorToBackend.equals ??\n '=',\n searchValue: condition.values?.length\n ? condition.values.join(',')\n : (condition.value ?? '')\n }));\n\n/**\n * One human line per condition for the proposal card — a sentence about the\n * records, not a config dump: `Resource.Status = Active`.\n */\nexport const describeConditions = (\n entityName: string,\n conditions: QueryConditionInput[] | null | undefined,\n operatorLabels: Record<string, string>\n): string[] =>\n (conditions ?? []).map((condition) => {\n const operator = String(condition?.operator ?? '');\n const value = condition?.values?.length\n ? condition.values.join(' … ')\n : (condition?.value ?? '');\n return `${entityName}.${String(condition?.field ?? '')} ${\n operatorLabels[operator] ?? operator\n } ${value}`.trim();\n });\n\n/**\n * The fields a query result row carries: what the model asked for, else a\n * compact automatic set off the entity's own result columns (the same columns\n * the search panel shows), capped so a wide entity can't fill the turn.\n */\nexport const queryRowFields = (\n entity: Pick<SearchableEntity, 'resultColumns'>,\n requested?: string[] | null\n): string[] =>\n (requested?.length\n ? requested\n : entity.resultColumns.map((column) => column.field)\n )\n .filter(Boolean)\n .slice(0, MAX_ROW_FIELDS);\n\n/** A projected result row plus whether anything in the page had to be clipped. */\nexport interface ProjectedQueryRows {\n rows: Array<Record<string, unknown>>;\n /** True when at least one cell was cut at MAX_CELL_CHARS. */\n clippedCells: boolean;\n}\n\n/**\n * Rows as the model sees them: only the named fields, empty values dropped\n * (absent reads the same as null and costs nothing), long cells cut. Never\n * more than MAX_QUERY_ROWS rows regardless of what came back.\n */\nexport const projectQueryRows = (\n rows: Array<Record<string, unknown>>,\n fields: string[]\n): ProjectedQueryRows => {\n let clippedCells = false;\n const projected = rows.slice(0, MAX_QUERY_ROWS).map((row) => {\n const out: Record<string, unknown> = {};\n for (const field of fields) {\n const value = row?.[field];\n if (value === undefined || value === null) continue;\n if (typeof value === 'object') {\n const text = JSON.stringify(value);\n out[field] =\n text.length > MAX_CELL_CHARS\n ? `${text.slice(0, MAX_CELL_CHARS)}…`\n : text;\n if (text.length > MAX_CELL_CHARS) clippedCells = true;\n continue;\n }\n const text = String(value as string | number | boolean);\n if (text.length > MAX_CELL_CHARS) {\n out[field] = `${text.slice(0, MAX_CELL_CHARS)}…`;\n clippedCells = true;\n continue;\n }\n out[field] = value;\n }\n return out;\n });\n return { rows: projected, clippedCells };\n};\n\n/** Clamp a model-supplied page size into the range the tool honors. */\nexport const clampQueryPageSize = (pageSize: unknown): number =>\n Math.min(Math.max(Number(pageSize) || DEFAULT_QUERY_ROWS, 1), MAX_QUERY_ROWS);\n\nexport const getEntitySchemaTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'get_entity_schema',\n description:\n \"List what a searchable entity can be filtered on: every field's display name, its wire name and the operators it allows. Call this BEFORE query_records or propose_advanced_search whenever you are not certain a field exists — it is how you turn what the user said (\\\"resource type\\\") into a field, and it is always cheaper than asking them.\",\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n entityName: {\n type: 'string',\n description:\n 'Simple entity name from your context. Omit to describe every searchable entity.'\n }\n }\n }\n }\n};\n\n/** The conditions array both condition-bearing tools take. */\nconst conditionsSchema = (operators: string[], description: string) => ({\n type: 'array',\n description,\n items: {\n type: 'object',\n additionalProperties: false,\n properties: {\n field: {\n type: 'string',\n description:\n 'A filterable field — its display name or its wire name, from get_entity_schema. Never invent one.'\n },\n operator: { type: 'string', enum: operators },\n value: { type: 'string', description: 'Single-value operators.' },\n values: {\n type: 'array',\n items: { type: 'string' },\n description: 'between: exactly 2; in/not_in: one or more.'\n }\n },\n required: ['field', 'operator']\n }\n});\n\n/**\n * Built per host rather than declared as a constant: the operator vocabulary is\n * the shared searchIntent table's, whose values are stencil constants this\n * module must not import.\n */\nexport const buildQueryRecordsTool = (\n operators: string[]\n): CopilotToolDefinition => ({\n type: 'function',\n function: {\n name: 'query_records',\n description:\n \"Run a read-only query against one of the tree's searchable entities and return { total, rows }. This is how you ANSWER A DATA QUESTION — counts (\\\"how many …\\\") and facts about records the tree may not have loaded. `total` is the full match count even when few rows come back. Prefer the records already loaded when your context already answers the question; use find_records when the user wants a record brought INTO the tree rather than an answer.\",\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n entityName: {\n type: 'string',\n description:\n 'Searchable entity to query (simple name, from your context).'\n },\n conditions: conditionsSchema(\n operators,\n 'AND-combined filter conditions. Omit to query every record.'\n ),\n pageSize: {\n type: 'number',\n description: `Rows to return (1-${MAX_QUERY_ROWS}). Default ${DEFAULT_QUERY_ROWS}; use 1 for a pure count.`\n },\n fields: {\n type: 'array',\n items: { type: 'string' },\n description:\n \"Fields to include per row (default: the entity's own result columns).\"\n }\n },\n required: ['entityName']\n }\n }\n});\n\nexport const buildProposeAdvancedSearchTool = (\n operators: string[]\n): CopilotToolDefinition => ({\n type: 'function',\n function: {\n name: 'propose_advanced_search',\n description:\n \"Propose an advanced search for the user to review and apply — applying opens the viewer's own Advanced Search results, exactly as if they had built the filter in the drawer. Use when the user wants to FIND OR NARROW a set of records on screen; use query_records instead when they want a direct answer.\",\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n explanation: {\n type: 'string',\n description: 'One sentence describing what the search finds.'\n },\n entityName: {\n type: 'string',\n description: 'Searchable entity to search (simple name).'\n },\n conditions: conditionsSchema(\n operators,\n 'AND-combined filter conditions — at least one.'\n )\n },\n required: ['explanation', 'entityName', 'conditions']\n }\n }\n});\n\n/**\n * The fixed-schema tools, in the order the model reads them. `query_records`\n * and `propose_advanced_search` are built alongside these by the capability\n * (they need the shared operator table — see the factories above).\n */\nexport const COPILOT_TOOL_DEFINITIONS: CopilotToolDefinition[] = [\n findRecordsTool,\n getEntitySchemaTool,\n loadRecordTool,\n readRecordTool,\n listLoadedRecordsTool,\n selectNodeTool,\n expandNodeTool,\n switchTabTool,\n filterTreeTool,\n clearFilterTool,\n expandAllTool,\n collapseAllTool\n];\n\n/* ------------------------------------------------------------- context */\n\nexport interface CopilotContextInput {\n /** Tree name from the detailed tree, or '' before it lands. */\n treeName: string;\n /**\n * The tree's CONFIGURED structure in words (domain `describeTree`), or null\n * while the tree is still loading / unreadable.\n */\n treeOutline: string | null;\n /** Simple names of the entities find_records can search. */\n searchableEntities: string[];\n /** The rows on screen (flattenMenuNodes output refs). */\n loadedNodes: LoadedNodeRef[];\n /** Labels of the tree's root rows, in the order they render. */\n rootLabels: string[];\n /** The selected row, or null when nothing is selected. */\n selected: LoadedNodeRef | null;\n /** The root record the selection lives under, when it is not the root itself. */\n selectedRootLabel: string | null;\n /** Live filter text ('' when no filter is active) and what it matched. */\n filterText: string;\n filterMatchCount: number;\n /** True while the root record page is still being fetched. */\n isLoadingRecords: boolean;\n /**\n * The current date, spelled out. Without it \"this month\" / \"overdue\" are\n * guesses — the model has no clock of its own.\n */\n today: string;\n /** The selected record's tabs, in order, and which one is open. */\n tabs: Array<{ id: string; label: string }>;\n activeTabId: string | null;\n}\n\n/**\n * The per-turn prompt section: what the tree IS, what is on screen, and what the\n * user is looking at. Everything \"here\" / \"this record\" / \"these\" can refer to\n * is stated, so the copilot never has to ask the one question a copilot sitting\n * beside the tree should never ask.\n */\nexport const buildCopilotContext = (input: CopilotContextInput): string => {\n const {\n treeName,\n treeOutline,\n searchableEntities,\n loadedNodes,\n rootLabels,\n selected,\n selectedRootLabel,\n filterText,\n filterMatchCount,\n isLoadingRecords,\n today,\n tabs,\n activeTabId\n } = input;\n\n if (!treeOutline) return 'The inquiry tree is still loading.';\n\n const lines: string[] = [\n `Today is ${today}.`,\n `The user is viewing the inquiry tree \"${treeName || 'Inquiry'}\".` +\n (searchableEntities.length\n ? ` Searchable entities — what find_records, query_records and propose_advanced_search work on: ${searchableEntities.join(', ')}.`\n : ' No entity in this tree is searchable, so find_records, query_records and propose_advanced_search will not work.')\n ];\n\n if (!rootLabels.length) {\n lines.push(\n isLoadingRecords\n ? 'The tree is still filling in — no rows are on screen yet.'\n : 'No records are in the tree yet — find_records then load_record brings one in.'\n );\n } else {\n const named = rootLabels.slice(0, MAX_CONTEXT_ROOTS).join(', ');\n lines.push(describeLoadedComposition(summarizeLoadedRows(loadedNodes)));\n lines.push(\n `Top-level rows (${rootLabels.length}): ${named}` +\n (rootLabels.length > MAX_CONTEXT_ROOTS\n ? ` (+${rootLabels.length - MAX_CONTEXT_ROOTS} more — call list_loaded_records).`\n : '.')\n );\n }\n\n lines.push(\n selected\n ? `On screen: \"${selected.label}\"${\n selected.entity ? ` (${selected.entity})` : ''\n } is selected and its record view is open` +\n (selectedRootLabel && selectedRootLabel !== selected.label\n ? `, under \"${selectedRootLabel}\".`\n : '.') +\n ' \"this record\", \"this one\" and \"here\" mean it.'\n : 'On screen: no record is selected, so the record pane is empty.'\n );\n\n if (selected && tabs.length) {\n const open = tabs.find((tab) => tab.id === activeTabId) ?? tabs[0];\n lines.push(\n `Its record pane has ${tabs.length === 1 ? 'one tab' : 'tabs'}: ${tabs\n .map((tab) => `\"${tab.label}\"`)\n .join(', ')}` +\n (tabs.length > 1 ? ` — \"${open.label}\" is open.` : '.') +\n ' read_record reads the record itself.'\n );\n }\n\n if (filterText.trim()) {\n lines.push(\n `A tree filter is active on \"${filterText.trim()}\" — ${filterMatchCount} ` +\n `${filterMatchCount === 1 ? 'row matches' : 'rows match'}. clear_filter removes it.`\n );\n }\n\n return `${lines.join('\\n')}\\n\\nThe tree's configured structure:\\n${treeOutline}`;\n};\n"],"mappings":";;;;;;;;;;;;;;AA8CA,MAAMmB,oBAAoB;AAmB1B,MAAMU,YAAYC,SAA0C;CAC1D,MAAMC,MAAM1B,eAAeyB,KAAK;AAChC,QAAOC,MAAM9B,iBAAiB8B,IAAI,GAAGC,KAAAA;;AAGvC,MAAMC,SAASH,SAA0C;CACvD,MAAMC,MAAMD,KAAKI,SAASX;AAC1B,QAAO,OAAOQ,QAAQ,YAAYA,MAAMA,MAAMC,KAAAA;;;AAIhD,MAAaG,oBACXC,aACqD;CACrD,MAAMG,MAAwD,EAAE;CAChE,MAAMC,QACJV,MACAN,WACAE,gBACS;AACT,MAAI,CAACI,KAAM;EACX,MAAMT,QAAQf,gBAAgBwB,KAAK;AACnCS,MAAIE,KAAK;GACPX;GACAQ,KAAK;IACHjB;IACAC,QAAQO,SAASC,KAAK;IACtBP,mBAAmBU,MAAMH,KAAK;IAC9BN;IACAC,QAAQiB,OAAOZ,KAAKa,GAAG;IACvBjB;IACAC,YAAYG,KAAKc,UAAUC,UAAU;IACrCjB,SAAS,CAAC,CAACE,KAAKgB;IAClB;GACD,CAAC;AACF,GAAChB,KAAKc,YAAY,EAAE,EAAEG,SAASC,UAAUR,KAAKQ,OAAOxB,WAAWH,MAAM,CAAC;;AAEzEe,UAASW,SAASE,MAAMzB,cACtByB,KAAKF,SAASG,SAASV,KAAKU,MAAM1B,UAAU,CAC9C,CAAC;AACD,QAAOe;;;;;;;;AAST,MAAaY,mBACXf,UACAE,QAC0E;CAC1E,MAAMgB,MAAMnB,iBAAiBC,SAAS;CACtC,MAAMmB,SAASb,OAAOJ,OAAO,GAAG,CAACkB,MAAM;AACvC,KAAI,CAACD,OAAQ,QAAO,EAAEF,OAAO,qBAAqB;CAClD,MAAMI,OAAOH,IAAII,MAAMC,SAASA,KAAKrB,IAAIb,WAA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MAAM;GACNwH,sBAAsB;GACtB/B,YAAY,EACVsC,OAAO;IACL/H,MAAM;IACNG,aACE;IACJ,EACF;GACF;EACF;CACD;AAED,MAAa6H,iBAAwC;CACnDhI,MAAM;CACNC,UAAU;EACRC,MAAM;EACNC,aACE;EACFC,YAAY;GACVJ,MAAM;GACNwH,sBAAsB;GACtB/B,YAAY,EACVtE,MAAM;IACJnB,MAAM;IACNG,aAAa;IACf,EACD;GACDwH,UAAU,CAAC,OAAM;GACnB;EACF;CACD;AAED,MAAaM,iBAAwC;CACnDjI,MAAM;CACNC,UAAU;EACRC,MAAM;EACNC,aACE;EACFC,YAAY;GACVJ,MAAM;GACNwH,sBAAsB;GACtB/B,YAAY,EACVnB,MAAM;IAAEtE,MAAM;IAAUG,aAAa;IAA6B,EACnE;GACDwH,UAAU,CAAC,OAAM;GACnB;EACF;CACD;AAED,MAAaO,kBAAyC;CACpDlI,MAAM;CACNC,UAAU;EACRC,MAAM;EACNC,aACE;EACFC,YAAYmH;EACd;CACD;AAED,MAAaY,gBAAuC;CAClDnI,MAAM;CACNC,UAAU;EACRC,MAAM;EACNC,aACE;EACFC,YAAYmH;EACd;CACD;AAED,MAAaa,kBAAyC;CACpDpI,MAAM;CACNC,UAAU;EACRC,MAAM;EACNC,aAAa;EACbC,YAAYmH;EACd;CACD;AAED,MAAac,iBAAwC;CACnDrI,MAAM;CACNC,UAAU;EACRC,MAAM;EACNC,aACE;EACFC,YAAY;GACVJ,MAAM;GACNwH,sBAAsB;GACtB/B,YAAY,EACVtE,MAAM;IACJnB,MAAM;IACNG,aACE;IACJ,EACF;GACF;EACF;CACD;AAED,MAAamI,iBAAwC;CACnDtI,MAAM;CACNC,UAAU;EACRC,MAAM;EACNC,aACE;EACFC,YAAY;GACVJ,MAAM;GACNwH,sBAAsB;GACtB/B,YAAY,EACVtE,MAAM;IACJnB,MAAM;IACNG,aAAa;IACf,EACD;GACDwH,UAAU,CAAC,OAAM;GACnB;EACF;CACD;AAED,MAAaY,gB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L,MAAM,CACnB0L,OAAMzM,KACJ,+BAA+BkM,WAAWnL,MAAM,CAAA,MAAOoL,iBAAgB,GAClEA,qBAAqB,IAAI,gBAAgB,aAAY,4BAC3D;AAGH,QAAO,GAAGM,MAAMhJ,KAAK,KAAK,CAAA,wCAAyCmI"}
|
|
1
|
+
{"version":3,"file":"copilotModel.mjs","names":["humanizeFieldName","upperFirst","getSanitizedName","resolveRef","toJsonString","SearchFilterElement","SearchableEntity","hasUnloadedChildren","nodeEntityName","resolveRowLabel","DisplayNode","resolveNodeViewModel","NodeViewTab","CopilotToolDefinition","type","function","name","description","parameters","Record","MAX_NODE_MATCHES","MAX_FIND_ROWS","MAX_CONTEXT_ROOTS","LoadedNodeRef","label","entity","businessObjectKey","menuIndex","nodeId","parentLabel","childCount","isGroup","entityOf","node","raw","undefined","keyOf","nodeObj","flattenMenuNodes","menuList","Array","ref","out","walk","push","String","id","children","length","isGroupNode","forEach","child","menu","root","resolveMenuNode","match","error","wanted","trim","matches","exact","item","MAX_RECORD_FIELDS","RECORD_IDENTIFIER_FIELDS","Set","LOOKUP_SUFFIX","RecordFieldProjection","field","value","RecordProjection","header","display","fields","truncated","tabs","clip","text","MAX_CELL_CHARS","slice","projectRecord","model","kind","map","key","Object","entries","endsWith","has","toLowerCase","lookup","tab","resolveTab","Pick","names","join","childrenPendingLoad","lazyLoadChildrenArr","FoundRecordRef","alreadyLoaded","LoadedRowProjection","Omit","projectLoadedRows","refs","rest","LoadedRowSummary","recordCount","groupCount","rowCount","byEntity","count","UNTYPED_ENTITY","summarizeLoadedRows","counts","Map","set","get","plural","one","many","describeLoadedComposition","summary","split","groups","foundRecordToken","index","noArgs","additionalProperties","properties","findRecordsTool","entityName","required","loadRecordTool","record","listLoadedRecordsTool","query","selectNodeTool","filterTreeTool","clearFilterTool","expandAllTool","collapseAllTool","readRecordTool","expandNodeTool","switchTabTool","MAX_QUERY_ROWS","MAX_ROW_FIELDS","DEFAULT_QUERY_ROWS","QueryConditionInput","operator","values","QueryField","QueryEntitySchema","displayName","QuerySchemaContext","filterFields","path","columns","buildQueryEntitySchema","normalizeType","seen","add","fieldKey","entry","searchConfiguration","searchable","template","quickSearchTemplates","searchField","column","resultColumns","toSearchSchemaContext","schema","replace","resolveFieldPath","find","resolveConditionFields","conditions","condition","MAX_SCHEMA_FIELDS","MAX_FIELD_SUGGESTIONS","explainUnknownField","fieldPath","words","word","filter","near","includes","some","shown","QueryEntitySchemaResult","filterableFields","operators","describeEntitySchema","operatorsByType","default","mapConditionsToFilterElements","operatorToBackend","searchOperator","equals","searchValue","describeConditions","operatorLabels","queryRowFields","requested","Boolean","ProjectedQueryRows","rows","clippedCells","projectQueryRows","projected","row","clipped","clampQueryPageSize","pageSize","Math","min","max","Number","getEntitySchemaTool","conditionsSchema","items","enum","buildQueryRecordsTool","buildProposeAdvancedSearchTool","explanation","CopilotContextInput","treeName","treeOutline","searchableEntities","loadedNodes","rootLabels","selected","selectedRootLabel","filterText","filterMatchCount","isLoadingRecords","today","activeTabId","buildCopilotContext","input","lines","named","open"],"sources":["../../../../src/inquiry/v2/ai/copilotModel.ts"],"sourcesContent":["/**\n * The inquiry copilot's PURE half: tool schemas, loaded-node resolution, result\n * projection, and the per-turn context string. No React, no HTTP, no .js\n * helpers — so every decision here runs under the node:test domain harness\n * (`pnpm test:domain`) while the wiring file stays a wiring file.\n *\n * Split follows the Tree Builder copilot precedent (describeTree.ts / tools.ts /\n * TreeCopilot.tsx): schemas and describers are data, the capability is glue.\n */\nimport { humanizeFieldName, upperFirst } from '../search/searchModel';\nimport { getSanitizedName } from '../../../domain/inquiryTree/legalChildren';\nimport { resolveRef } from '../../../domain/inquiryTree/describe';\nimport { toJsonString } from '../../../domain/inquiryTree/wireString';\nimport type {\n SearchFilterElement,\n SearchableEntity\n} from '../search/searchModel';\nimport {\n hasUnloadedChildren,\n nodeEntityName,\n resolveRowLabel,\n type DisplayNode\n} from '../../../domain/inquiryTree/displayTree';\nimport { resolveNodeViewModel } from '../../../domain/nodeView/model';\nimport type { NodeViewTab } from '../../../domain/nodeView/model';\n\n/**\n * The OpenAI function-tool shape, restated structurally so this module stays\n * free of `aiAssistant/openai` (which pulls in axios and therefore cannot\n * compile under the domain harness). A type alias, not an interface, so it\n * stays assignable to `OpenAiToolDefinition`, whose open index signature\n * an interface would not satisfy.\n */\nexport type CopilotToolDefinition = {\n type: 'function';\n function: {\n name: string;\n description: string;\n parameters: Record<string, unknown>;\n };\n};\n\n/** Longest list of loaded rows / found records handed back in one result. */\nexport const MAX_NODE_MATCHES = 30;\nexport const MAX_FIND_ROWS = 10;\n/** Loaded root labels named in the context line before it says \"+N more\". */\nconst MAX_CONTEXT_ROOTS = 8;\n\n/* ------------------------------------------------------------ loaded nodes */\n\n/** One row of the loaded tree, as the model sees it. */\nexport interface LoadedNodeRef {\n /** The exact string the tree row shows (resolveRowLabel — never a raw column). */\n label: string;\n entity?: string;\n businessObjectKey?: string;\n /** Which menu the row lives in — the menu list is a list of menus. */\n menuIndex: number;\n /** The display-tree node id: what selectNodeById takes. */\n nodeId: string;\n parentLabel?: string;\n childCount: number;\n isGroup: boolean;\n}\n\nconst entityOf = (node: DisplayNode): string | undefined => {\n const raw = nodeEntityName(node);\n return raw ? getSanitizedName(raw) : undefined;\n};\n\nconst keyOf = (node: DisplayNode): string | undefined => {\n const raw = node.nodeObj?.businessObjectKey;\n return typeof raw === 'string' && raw ? raw : undefined;\n};\n\n/** Every row currently rendered in the tree pane, depth-first, menu by menu. */\nexport const flattenMenuNodes = (\n menuList: DisplayNode[][]\n): Array<{ node: DisplayNode; ref: LoadedNodeRef }> => {\n const out: Array<{ node: DisplayNode; ref: LoadedNodeRef }> = [];\n const walk = (\n node: DisplayNode | null | undefined,\n menuIndex: number,\n parentLabel?: string\n ): void => {\n if (!node) return;\n const label = resolveRowLabel(node);\n out.push({\n node,\n ref: {\n label,\n entity: entityOf(node),\n businessObjectKey: keyOf(node),\n menuIndex,\n nodeId: String(node.id),\n parentLabel,\n childCount: node.children?.length ?? 0,\n isGroup: !!node.isGroupNode\n }\n });\n (node.children ?? []).forEach((child) => walk(child, menuIndex, label));\n };\n menuList.forEach((menu, menuIndex) =>\n menu.forEach((root) => walk(root, menuIndex))\n );\n return out;\n};\n\n/**\n * Resolve a model-supplied loaded-row reference (resolveRef over node id /\n * businessObjectKey / label): ambiguity comes back as an error the model can\n * repair from rather than the wrong row quietly opening.\n */\nexport const resolveMenuNode = (\n menuList: DisplayNode[][],\n ref: string\n): { match?: { node: DisplayNode; ref: LoadedNodeRef }; error?: string } => {\n const wanted = String(ref ?? '').trim();\n if (!wanted) return { error: 'node is required.' };\n const { match, matches, exact } = resolveRef(\n flattenMenuNodes(menuList),\n wanted,\n (item) => [item.ref.nodeId, item.ref.businessObjectKey],\n (item) => item.ref.label\n );\n if (match) return { match };\n return {\n error: exact\n ? `\"${wanted}\" matches ${matches} loaded rows — use the nodeId from list_loaded_records.`\n : matches\n ? `\"${wanted}\" is ambiguous (${matches} loaded rows match) — use a longer label or the nodeId.`\n : `No loaded row matches \"${wanted}\". Call list_loaded_records, or find_records + load_record to bring it in.`\n };\n};\n\n/* ------------------------------------------------------- record reading */\n\n/** Scalars one read_record result carries beyond the header fields. */\nexport const MAX_RECORD_FIELDS = 40;\n\n/** Identifiers the model already has in tool arguments — never worth a line. */\nconst RECORD_IDENTIFIER_FIELDS = new Set(['businessobjectkey']);\nconst LOOKUP_SUFFIX = 'LookupValue';\n\nexport interface RecordFieldProjection {\n /** The name a person reads. */\n name: string;\n /** The wire name — the same string get_entity_schema reports. */\n field: string;\n value: string;\n}\n\n/** One loaded record as read_record reports it. */\nexport interface RecordProjection {\n label: string;\n entity?: string;\n /** What the record header shows, in its configured order. */\n header: Array<{ label: string; value: string; display: string }>;\n /** Every other scalar the row carries, lookups already resolved to text. */\n fields: RecordFieldProjection[];\n truncated: boolean;\n /** The record pane's tabs for this row, in order. */\n tabs: Array<{ id: string; label: string }>;\n /** Child rows currently loaded under it. */\n children: number;\n}\n\nconst clip = (text: string): string =>\n text.length > MAX_CELL_CHARS ? `${text.slice(0, MAX_CELL_CHARS)}…` : text;\n\n/**\n * The record the row IS, read straight off the row: no fetch, because the tree\n * already holds every value its header and pages read. Header fields come\n * first exactly as the view resolves them (same domain model, so a stat or a\n * badge reads the same text the user sees); the rest are the row's scalars,\n * with a lookup's display text standing in for its id, as the header does.\n */\nexport const projectRecord = (node: DisplayNode): RecordProjection => {\n const model = resolveNodeViewModel(node);\n const header =\n model.header.kind === 'fields'\n ? model.header.fields.map((field) => ({\n label: field.label,\n value: field.value,\n display: field.display\n }))\n : [];\n const nodeObj = node.nodeObj ?? {};\n const fields: RecordFieldProjection[] = [];\n for (const [key, raw] of Object.entries(nodeObj)) {\n if (raw === undefined || raw === null || raw === '') continue;\n if (typeof raw === 'object') continue;\n if (key.endsWith(LOOKUP_SUFFIX)) continue;\n if (RECORD_IDENTIFIER_FIELDS.has(key.toLowerCase())) continue;\n const lookup = nodeObj[`${key}${LOOKUP_SUFFIX}`];\n const value =\n lookup !== undefined && lookup !== null && lookup !== '' ? lookup : raw;\n fields.push({\n name: humanizeFieldName(key),\n field: key,\n value: clip(String(value as string | number | boolean))\n });\n }\n return {\n label: resolveRowLabel(node),\n entity: entityOf(node),\n header,\n fields: fields.slice(0, MAX_RECORD_FIELDS),\n truncated: fields.length > MAX_RECORD_FIELDS,\n tabs: model.tabs.map((tab) => ({ id: tab.id, label: tab.label })),\n children: node.children?.length ?? 0\n };\n};\n\n/**\n * Resolve a model-supplied tab reference against the selected record's tabs —\n * the resolveRef grammar, so the model addresses tabs the way it addresses rows.\n */\nexport const resolveTab = (\n tabs: Array<Pick<NodeViewTab, 'id' | 'label'>>,\n ref: string\n): { match?: Pick<NodeViewTab, 'id' | 'label'>; error?: string } => {\n const wanted = String(ref ?? '').trim();\n if (!wanted) return { error: 'tab is required.' };\n if (!tabs.length) return { error: 'The selected record has no tabs.' };\n const names = tabs.map((tab) => `\"${tab.label}\"`).join(', ');\n const { match, matches } = resolveRef(\n tabs,\n wanted,\n (tab) => [tab.id],\n (tab) => tab.label\n );\n if (match) return { match };\n return {\n error: matches\n ? `\"${wanted}\" matches ${matches} tabs: ${names}.`\n : `No tab matches \"${wanted}\". Tabs: ${names}.`\n };\n};\n\n/**\n * Whether flagging this row expanded will FETCH: it has an unloaded lazy level\n * with something to load. The same predicate the menu's pre-expanded-row\n * effect fires on (waveLoad `collectPreExpandedLazyRows`), minus the flag\n * itself — so expand_node knows whether to wait for children to arrive.\n */\nexport const childrenPendingLoad = (node: DisplayNode): boolean =>\n hasUnloadedChildren(node) && !!node.lazyLoadChildrenArr?.length;\n\n/* ---------------------------------------------------------- find → load ref */\n\n/**\n * A record the copilot found but has not loaded. `ref` is the chaining token:\n * find_records mints it, load_record takes it, and the row itself never has to\n * travel through the model — so a load always uses the exact record that was\n * found, not a re-derived guess at it.\n */\nexport interface FoundRecordRef {\n ref: string;\n label: string;\n entity: string;\n businessObjectKey?: string;\n alreadyLoaded: boolean;\n}\n\n/**\n * The model-facing row shape: `isGroup` is replaced by an explicit `kind` so a\n * grouping heading can never be read as a record. The bug this closes is the\n * copilot answering \"3 records loaded\" for 2 records under 1 group heading.\n */\nexport type LoadedRowProjection = Omit<LoadedNodeRef, 'isGroup'> & {\n kind: 'group' | 'record';\n};\n\nexport const projectLoadedRows = (\n refs: LoadedNodeRef[]\n): LoadedRowProjection[] =>\n refs.map(({ isGroup, ...rest }) => ({\n ...rest,\n kind: isGroup ? 'group' : 'record'\n }));\n\n/** Records vs group headings, and the per-entity split of the records. */\nexport interface LoadedRowSummary {\n recordCount: number;\n groupCount: number;\n rowCount: number;\n /** Entity name → record count, in the order the rows first appear. */\n byEntity: Array<{ entity: string; count: number }>;\n}\n\n/** Records without a resolvable entity name are counted under this bucket. */\nconst UNTYPED_ENTITY = 'untyped';\n\nexport const summarizeLoadedRows = (\n refs: LoadedNodeRef[]\n): LoadedRowSummary => {\n const counts = new Map<string, number>();\n let recordCount = 0;\n let groupCount = 0;\n for (const ref of refs) {\n if (ref.isGroup) {\n groupCount += 1;\n continue;\n }\n recordCount += 1;\n const entity = ref.entity || UNTYPED_ENTITY;\n counts.set(entity, (counts.get(entity) ?? 0) + 1);\n }\n return {\n recordCount,\n groupCount,\n rowCount: refs.length,\n byEntity: [...counts].map(([entity, count]) => ({ entity, count }))\n };\n};\n\nconst plural = (count: number, one: string, many: string): string =>\n `${count} ${count === 1 ? one : many}`;\n\n/**\n * One compact line stating the composition of the tree pane, so \"how many\n * records?\" is answered from the context instead of by counting rows.\n * e.g. `Loaded: 3 records (2 Resource, 1 Assignment) plus 1 group heading — 4 rows total.`\n */\nexport const describeLoadedComposition = (\n summary: LoadedRowSummary\n): string => {\n const split = summary.byEntity.length\n ? ` (${summary.byEntity\n .map((item) => `${item.count} ${item.entity}`)\n .join(', ')})`\n : '';\n const groups = summary.groupCount\n ? ` plus ${plural(summary.groupCount, 'group heading', 'group headings')}`\n : '';\n return (\n `Loaded: ${plural(summary.recordCount, 'record', 'records')}${split}${groups}` +\n ` — ${plural(summary.rowCount, 'row', 'rows')} total.`\n );\n};\n\n/** `f1`, `f2`, … — short enough that the model quotes them back verbatim. */\nexport const foundRecordToken = (index: number): string => `f${index + 1}`;\n\n/* ------------------------------------------------------------- tool schemas */\n\nconst noArgs = { type: 'object', additionalProperties: false, properties: {} };\n\nexport const findRecordsTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'find_records',\n description:\n \"Search the tree's searchable entities for records the user names, whether or not they are loaded. Returns a ref token per hit — pass that to load_record to bring one into the tree. This is a SEARCH, not a data answer: report how many matched and name them, never dump their fields.\",\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n text: {\n type: 'string',\n description:\n \"What to search for, as the user would type it into the tree's own search box.\"\n },\n entityName: {\n type: 'string',\n description:\n 'Limit the search to one searchable entity (simple name, from your context). Omit to search them all.'\n }\n },\n required: ['text']\n }\n }\n};\n\nexport const loadRecordTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'load_record',\n description:\n 'Bring a record found by find_records into the tree, exactly as the + Load dialog does — it is added as a root, selected, and its record view opens. A record already in the tree is selected rather than duplicated.',\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n record: {\n type: 'string',\n description:\n 'A ref token from the last find_records result (e.g. \"f2\"), or that result\\'s exact label.'\n }\n },\n required: ['record']\n }\n }\n};\n\nexport const listLoadedRecordsTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'list_loaded_records',\n description:\n 'List the rows currently loaded in the tree (optionally filtered by a label or entity substring). Returns the nodeIds select_node takes. Every row carries kind: \"record\" or \"group\" — a group row is a heading that organizes records and is never itself a record, so count only kind \"record\" rows when the user asks how many records are loaded.',\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n query: {\n type: 'string',\n description:\n 'Case-insensitive substring of the row label or entity name. Omit to list everything.'\n }\n }\n }\n }\n};\n\nexport const selectNodeTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'select_node',\n description:\n \"Select a row that is already loaded in the tree so its record view opens. Accepts the nodeId (preferred), the record's businessObjectKey, or a unique row label.\",\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n node: {\n type: 'string',\n description: 'nodeId, businessObjectKey, or unique label.'\n }\n },\n required: ['node']\n }\n }\n};\n\nexport const filterTreeTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'filter_tree',\n description:\n 'Filter the loaded tree rows by text: matches are highlighted and everything else is dimmed. Nothing is fetched, hidden or removed — use find_records when the record may not be loaded yet.',\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n text: { type: 'string', description: 'Text to highlight rows by.' }\n },\n required: ['text']\n }\n }\n};\n\nexport const clearFilterTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'clear_filter',\n description:\n 'Clear the tree filter and put the tree back the way the user had it expanded.',\n parameters: noArgs\n }\n};\n\nexport const expandAllTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'expand_all',\n description:\n 'Expand every loaded level of the tree. Levels whose records have not been fetched stay closed — this never triggers a load.',\n parameters: noArgs\n }\n};\n\nexport const collapseAllTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'collapse_all',\n description: 'Collapse every row in the tree.',\n parameters: noArgs\n }\n};\n\nexport const readRecordTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'read_record',\n description:\n \"Read a loaded record's data: the fields its header shows, every other value the row carries (lookups already as text), the tabs its record pane offers, and how many child rows are loaded under it. Defaults to the selected record; pass node for another loaded row. This is how you answer \\\"what is this record's …?\\\" — from the row, with no query. Quote the values the user asked about; never recite the whole list unasked.\",\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n node: {\n type: 'string',\n description:\n 'nodeId, businessObjectKey, or unique label of a loaded row. Omit for the selected record.'\n }\n }\n }\n }\n};\n\nexport const expandNodeTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'expand_node',\n description:\n \"Expand one loaded row so its child rows show — the same as clicking its chevron. A child level that has not been fetched yet loads now (this is the ONE tool that fetches children), and the result waits for it. Call this before counting or listing a row's children when it is collapsed or its children are not loaded; then list_loaded_records shows them.\",\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n node: {\n type: 'string',\n description: 'nodeId, businessObjectKey, or unique label.'\n }\n },\n required: ['node']\n }\n }\n};\n\nexport const switchTabTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'switch_tab',\n description:\n \"Open one of the selected record's tabs in the record pane — the tab's page is what the user then sees. Your context lists the tabs and which is open; read_record lists them too.\",\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n tab: { type: 'string', description: 'Tab label (or id).' }\n },\n required: ['tab']\n }\n }\n};\n\n/* ------------------------------------------- conditions: query + advanced */\n\n/**\n * Rows one query_records call may return, fields per row, and characters per\n * cell. The copilot answers questions from data — it does not page through it,\n * so the caps are what keeps a \"how many overdue?\" from arriving as a table.\n */\nexport const MAX_QUERY_ROWS = 50;\nexport const MAX_ROW_FIELDS = 12;\nexport const MAX_CELL_CHARS = 200;\n/** Rows a query returns when the model names no page size. */\nexport const DEFAULT_QUERY_ROWS = 10;\n\n/** One filter condition as the model emits it (shared searchIntent vocabulary). */\nexport interface QueryConditionInput {\n field?: string;\n operator?: string;\n value?: string;\n values?: string[];\n}\n\n/** One filterable field, in BOTH vocabularies people and wires use. */\nexport interface QueryField {\n /** The wire name the search API filters on (\"ResourceTypeId\"). */\n field: string;\n /** The name a person reads, as the tree's own search UI shows it. */\n name: string;\n /** Normalized type — what decides the field's allowed operators. */\n type: string;\n}\n\n/**\n * ONE searchable entity's filterable vocabulary. This is the single source of\n * truth for the copilot's filtering: `get_entity_schema` reports it, the\n * validator checks against it, and field references are resolved through it —\n * so what the model is TOLD it may filter on and what it is ALLOWED to filter on\n * can never disagree.\n */\nexport interface QueryEntitySchema {\n /** Simple catalog name (\"Resource\"). */\n entityName: string;\n /** The tree's own label for the set (\"Resources\"). */\n displayName: string;\n fields: QueryField[];\n}\n\n/**\n * The shape the shared `validateIntent` checks against (structurally\n * `AiSearchSchemaContext`, restated here so this module stays free of\n * `searchIntent` — which imports the stencil package and therefore\n * cannot run under the domain harness).\n */\nexport interface QuerySchemaContext {\n entityName: string;\n filterFields: Array<{ path: string; type: string }>;\n /** Always empty: neither tool sorts, groups or projects columns. */\n columns: never[];\n}\n\n/**\n * What the model may filter a searchable entity on: the UNION of every field\n * this tree is known to filter that entity by — its configured search set, the\n * fields quick search stamps text into, and the columns its query projects.\n * Wire-cased exactly as `buildAdvancedSearchSchema` cases the drawer's (so a\n * copilot-built filter element is indistinguishable from a drawer-built one) and\n * labelled exactly as the tree humanizes them (so a name read off the screen is\n * a name that works). Deduped by name, first source winning — see the numbered\n * comments for why that order.\n *\n * The union is the point. A tree routinely configures ONE search field while its\n * query projects a dozen and its record header displays all of them; a schema\n * built from the search config alone can only answer \"you may filter by Name\",\n * which is false and sends the user away. Every field here is one the backend\n * accepts a filter on.\n */\nexport const buildQueryEntitySchema = (\n entity: Pick<\n SearchableEntity,\n | 'entityName'\n | 'displayName'\n | 'searchConfiguration'\n | 'quickSearchTemplates'\n | 'resultColumns'\n >,\n /** Catalog/.NET type → the operator vocabulary's type (normalizeSearchFieldType). */\n normalizeType: (type: string | null | undefined) => string\n): QueryEntitySchema => {\n const fields: QueryField[] = [];\n const seen = new Set<string>();\n const add = (field: string, name: string, type: string): void => {\n const key = fieldKey(field);\n if (!key || seen.has(key)) return;\n seen.add(key);\n fields.push({ field, name, type });\n };\n\n // 1. The configured search set — the only source that carries a TYPE, so it\n // goes first and wins the type of any field the later sources repeat.\n for (const entry of entity.searchConfiguration ?? []) {\n if (entry.searchable === false || !entry.name) continue;\n add(\n upperFirst(entry.name),\n humanizeFieldName(entry.name),\n normalizeType(entry.type)\n );\n }\n // 2. The fields QUICK SEARCH itself filters on. The tree already sends these\n // to the backend on every keystroke, so they are known-good filter fields\n // — and they are the list the user sees searched, which makes them the\n // first thing anyone names. Field names are authored, so they pass through\n // verbatim. No declared type, so only = and ≠ are offered.\n for (const template of entity.quickSearchTemplates ?? []) {\n if (!template?.searchField) continue;\n add(\n template.searchField,\n humanizeFieldName(template.searchField),\n 'default'\n );\n }\n // 3. The query's own projected columns — ALWAYS, not a fallback. A selected\n // column is filterable: `executeQueryAdHoc` accepts a filter on any of\n // them, which is exactly what the record grids' column filters do every day\n // (SearchServiceDatasource sends `upperFirst(columnField)` as searchField —\n // the same string built here). It matters because a tree commonly\n // configures ONE search field while its query projects a dozen, and the\n // record header shows every one of them: a user reading \"Resource type: 1\"\n // off the screen is naming a column, not a search-config entry.\n for (const column of entity.resultColumns) {\n add(\n upperFirst(column.field),\n column.header || humanizeFieldName(column.field),\n 'default'\n );\n }\n\n return {\n entityName: getSanitizedName(entity.entityName),\n displayName: entity.displayName,\n fields\n };\n};\n\n/** The same schema, in the shape the shared validator reads. */\nexport const toSearchSchemaContext = (\n schema: QueryEntitySchema\n): QuerySchemaContext => ({\n entityName: schema.entityName,\n filterFields: schema.fields.map((field) => ({\n path: field.field,\n type: field.type\n })),\n columns: []\n});\n\n/** Letters and digits only: \"Resource Type Id\" / \"resource_type_id\" → \"resourcetypeid\". */\nconst fieldKey = (name: string): string =>\n String(name ?? '')\n .toLowerCase()\n .replace(/[^a-z0-9]/g, '');\n\n/**\n * A model-supplied field reference → the wire name, or undefined. Both\n * vocabularies are accepted — the wire name and the display name the search UI\n * shows — because a model reading the screen (and a user reading it over its\n * shoulder) speaks the display name, and nobody outside this file should have\n * to know the wire casing. Punctuation and case are ignored on both sides.\n */\nexport const resolveFieldPath = (\n schema: QueryEntitySchema,\n name: string | undefined\n): string | undefined => {\n const wanted = fieldKey(String(name ?? ''));\n if (!wanted) return undefined;\n return schema.fields.find(\n (field) =>\n fieldKey(field.field) === wanted || fieldKey(field.name) === wanted\n )?.field;\n};\n\n/**\n * Rewrite every condition's field into the wire vocabulary the validator and\n * the search API use. Unresolvable references are left ALONE so the shared\n * validator reports them — with `explainUnknownField` naming the alternatives —\n * rather than this function inventing a match.\n */\nexport const resolveConditionFields = (\n schema: QueryEntitySchema,\n conditions: QueryConditionInput[] | null | undefined\n): QueryConditionInput[] =>\n (conditions ?? []).map((condition) => {\n const path = resolveFieldPath(schema, condition?.field);\n return path ? { ...condition, field: path } : condition;\n });\n\n/** Fields shown before a schema result says \"call again for the rest\". */\nexport const MAX_SCHEMA_FIELDS = 60;\n/** Alternatives named when a field reference doesn't match anything. */\nconst MAX_FIELD_SUGGESTIONS = 5;\n\n/**\n * The repair message an unmatched field gets: the closest real fields, in BOTH\n * names, so one round trip fixes it. Fed to the shared validator's\n * `explainUnknownField` hook — the model never sees a bare \"not a filterable\n * field\" it can only answer by asking the user for a wire name.\n */\nexport const explainUnknownField = (\n schema: QueryEntitySchema,\n fieldPath: string\n): string => {\n // Word overlap, not substring: \"Resource Kind\" should surface every Resource\n // field, which a whole-string comparison misses. Short words (\"id\", \"no\")\n // match too much to be evidence of anything.\n const words = String(fieldPath ?? '')\n .split(/[^A-Za-z0-9]+|(?=[A-Z])/)\n .map((word) => word.toLowerCase())\n .filter((word) => word.length > 2);\n const wanted = fieldKey(fieldPath);\n const near = schema.fields.filter((field) => {\n const key = fieldKey(field.field);\n if (key.includes(wanted) || wanted.includes(key)) return true;\n return words.some((word) => key.includes(word));\n });\n const shown = (near.length ? near : schema.fields).slice(\n 0,\n MAX_FIELD_SUGGESTIONS\n );\n if (!shown.length)\n return `\"${fieldPath}\" is not filterable — ${schema.entityName} has no configured search fields.`;\n return (\n `\"${fieldPath}\" is not a filterable field on ${schema.entityName}. ` +\n `${near.length ? 'Closest' : 'Filterable'}: ${shown\n .map((field) => `${field.name} (${field.field})`)\n .join(', ')}` +\n `${schema.fields.length > shown.length ? ', …' : ''}. ` +\n 'Call get_entity_schema for the full list.'\n );\n};\n\n/** One entity's schema as the get_entity_schema tool reports it. */\nexport interface QueryEntitySchemaResult {\n entity: string;\n displayName: string;\n filterableFields: Array<{\n name: string;\n field: string;\n type: string;\n operators: string[];\n }>;\n truncated: boolean;\n}\n\n/**\n * The schema tool's answer, built from the SAME QueryEntitySchema the validator\n * checks against — so every field it reports is a field a query will accept,\n * and every operator it names is one that field allows.\n */\nexport const describeEntitySchema = (\n schema: QueryEntitySchema,\n /** Normalized type → allowed operators (searchIntent's OPERATORS_BY_TYPE). */\n operatorsByType: Record<string, string[]>\n): QueryEntitySchemaResult => ({\n entity: schema.entityName,\n displayName: schema.displayName,\n filterableFields: schema.fields\n .slice(0, MAX_SCHEMA_FIELDS)\n .map((field) => ({\n name: field.name,\n field: field.field,\n type: field.type,\n operators: operatorsByType[field.type] ?? operatorsByType.default ?? []\n })),\n truncated: schema.fields.length > MAX_SCHEMA_FIELDS\n});\n\n/**\n * Conditions → search filter elements, mapped through the shared operator table\n * (injected: its values are stencil constants). Multi-value operators are\n * comma-joined, matching the shared compiler and the manual builder's storage.\n * Field names pass through verbatim — `resolveConditionFields` already put them\n * in the wire vocabulary.\n */\nexport const mapConditionsToFilterElements = (\n conditions: QueryConditionInput[] | null | undefined,\n operatorToBackend: Record<string, string>\n): SearchFilterElement[] =>\n (conditions ?? [])\n .filter((condition) => !!condition?.field)\n .map((condition) => ({\n searchField: String(condition.field),\n searchOperator:\n operatorToBackend[String(condition.operator)] ??\n operatorToBackend.equals ??\n '=',\n searchValue: condition.values?.length\n ? condition.values.join(',')\n : (condition.value ?? '')\n }));\n\n/**\n * One human line per condition for the proposal card — a sentence about the\n * records, not a config dump: `Resource.Status = Active`.\n */\nexport const describeConditions = (\n entityName: string,\n conditions: QueryConditionInput[] | null | undefined,\n operatorLabels: Record<string, string>\n): string[] =>\n (conditions ?? []).map((condition) => {\n const operator = String(condition?.operator ?? '');\n const value = condition?.values?.length\n ? condition.values.join(' … ')\n : (condition?.value ?? '');\n return `${entityName}.${String(condition?.field ?? '')} ${\n operatorLabels[operator] ?? operator\n } ${value}`.trim();\n });\n\n/**\n * The fields a query result row carries: what the model asked for, else a\n * compact automatic set off the entity's own result columns (the same columns\n * the search panel shows), capped so a wide entity can't fill the turn.\n */\nexport const queryRowFields = (\n entity: Pick<SearchableEntity, 'resultColumns'>,\n requested?: string[] | null\n): string[] =>\n (requested?.length\n ? requested\n : entity.resultColumns.map((column) => column.field)\n )\n .filter(Boolean)\n .slice(0, MAX_ROW_FIELDS);\n\n/** A projected result row plus whether anything in the page had to be clipped. */\nexport interface ProjectedQueryRows {\n rows: Array<Record<string, unknown>>;\n /** True when at least one cell was cut at MAX_CELL_CHARS. */\n clippedCells: boolean;\n}\n\n/**\n * Rows as the model sees them: only the named fields, empty values dropped\n * (absent reads the same as null and costs nothing), long cells cut. Never\n * more than MAX_QUERY_ROWS rows regardless of what came back.\n */\nexport const projectQueryRows = (\n rows: Array<Record<string, unknown>>,\n fields: string[]\n): ProjectedQueryRows => {\n let clippedCells = false;\n const projected = rows.slice(0, MAX_QUERY_ROWS).map((row) => {\n const out: Record<string, unknown> = {};\n for (const field of fields) {\n const value = row?.[field];\n if (value === undefined || value === null) continue;\n const text = toJsonString(value);\n const clipped = text.length > MAX_CELL_CHARS;\n if (clipped) clippedCells = true;\n // Objects go as JSON text; a short scalar keeps its own type.\n out[field] = clipped || typeof value === 'object' ? clip(text) : value;\n }\n return out;\n });\n return { rows: projected, clippedCells };\n};\n\n/** Clamp a model-supplied page size into the range the tool honors. */\nexport const clampQueryPageSize = (pageSize: unknown): number =>\n Math.min(Math.max(Number(pageSize) || DEFAULT_QUERY_ROWS, 1), MAX_QUERY_ROWS);\n\nexport const getEntitySchemaTool: CopilotToolDefinition = {\n type: 'function',\n function: {\n name: 'get_entity_schema',\n description:\n \"List what a searchable entity can be filtered on: every field's display name, its wire name and the operators it allows. Call this BEFORE query_records or propose_advanced_search whenever you are not certain a field exists — it is how you turn what the user said (\\\"resource type\\\") into a field, and it is always cheaper than asking them.\",\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n entityName: {\n type: 'string',\n description:\n 'Simple entity name from your context. Omit to describe every searchable entity.'\n }\n }\n }\n }\n};\n\n/** The conditions array both condition-bearing tools take. */\nconst conditionsSchema = (operators: string[], description: string) => ({\n type: 'array',\n description,\n items: {\n type: 'object',\n additionalProperties: false,\n properties: {\n field: {\n type: 'string',\n description:\n 'A filterable field — its display name or its wire name, from get_entity_schema. Never invent one.'\n },\n operator: { type: 'string', enum: operators },\n value: { type: 'string', description: 'Single-value operators.' },\n values: {\n type: 'array',\n items: { type: 'string' },\n description: 'between: exactly 2; in/not_in: one or more.'\n }\n },\n required: ['field', 'operator']\n }\n});\n\n/**\n * Built per host rather than declared as a constant: the operator vocabulary is\n * the shared searchIntent table's, whose values are stencil constants this\n * module must not import.\n */\nexport const buildQueryRecordsTool = (\n operators: string[]\n): CopilotToolDefinition => ({\n type: 'function',\n function: {\n name: 'query_records',\n description:\n \"Run a read-only query against one of the tree's searchable entities and return { total, rows }. This is how you ANSWER A DATA QUESTION — counts (\\\"how many …\\\") and facts about records the tree may not have loaded. `total` is the full match count even when few rows come back. Prefer the records already loaded when your context already answers the question; use find_records when the user wants a record brought INTO the tree rather than an answer.\",\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n entityName: {\n type: 'string',\n description:\n 'Searchable entity to query (simple name, from your context).'\n },\n conditions: conditionsSchema(\n operators,\n 'AND-combined filter conditions. Omit to query every record.'\n ),\n pageSize: {\n type: 'number',\n description: `Rows to return (1-${MAX_QUERY_ROWS}). Default ${DEFAULT_QUERY_ROWS}; use 1 for a pure count.`\n },\n fields: {\n type: 'array',\n items: { type: 'string' },\n description:\n \"Fields to include per row (default: the entity's own result columns).\"\n }\n },\n required: ['entityName']\n }\n }\n});\n\nexport const buildProposeAdvancedSearchTool = (\n operators: string[]\n): CopilotToolDefinition => ({\n type: 'function',\n function: {\n name: 'propose_advanced_search',\n description:\n \"Propose an advanced search for the user to review and apply — applying opens the viewer's own Advanced Search results, exactly as if they had built the filter in the drawer. Use when the user wants to FIND OR NARROW a set of records on screen; use query_records instead when they want a direct answer.\",\n parameters: {\n type: 'object',\n additionalProperties: false,\n properties: {\n explanation: {\n type: 'string',\n description: 'One sentence describing what the search finds.'\n },\n entityName: {\n type: 'string',\n description: 'Searchable entity to search (simple name).'\n },\n conditions: conditionsSchema(\n operators,\n 'AND-combined filter conditions — at least one.'\n )\n },\n required: ['explanation', 'entityName', 'conditions']\n }\n }\n});\n/* ------------------------------------------------------------- context */\n\nexport interface CopilotContextInput {\n /** Tree name from the tree, or '' before it lands. */\n treeName: string;\n /**\n * The tree's CONFIGURED structure in words (domain `describeTree`), or null\n * while the tree is still loading / unreadable.\n */\n treeOutline: string | null;\n /** Simple names of the entities find_records can search. */\n searchableEntities: string[];\n /** The rows on screen (flattenMenuNodes output refs). */\n loadedNodes: LoadedNodeRef[];\n /** Labels of the tree's root rows, in the order they render. */\n rootLabels: string[];\n /** The selected row, or null when nothing is selected. */\n selected: LoadedNodeRef | null;\n /** The root record the selection lives under, when it is not the root itself. */\n selectedRootLabel: string | null;\n /** Live filter text ('' when no filter is active) and what it matched. */\n filterText: string;\n filterMatchCount: number;\n /** True while the root record page is still being fetched. */\n isLoadingRecords: boolean;\n /**\n * The current date, spelled out. Without it \"this month\" / \"overdue\" are\n * guesses — the model has no clock of its own.\n */\n today: string;\n /** The selected record's tabs, in order, and which one is open. */\n tabs: Array<{ id: string; label: string }>;\n activeTabId: string | null;\n}\n\n/**\n * The per-turn prompt section: what the tree IS, what is on screen, and what the\n * user is looking at. Everything \"here\" / \"this record\" / \"these\" can refer to\n * is stated, so the copilot never has to ask the one question a copilot sitting\n * beside the tree should never ask.\n */\nexport const buildCopilotContext = (input: CopilotContextInput): string => {\n const {\n treeName,\n treeOutline,\n searchableEntities,\n loadedNodes,\n rootLabels,\n selected,\n selectedRootLabel,\n filterText,\n filterMatchCount,\n isLoadingRecords,\n today,\n tabs,\n activeTabId\n } = input;\n\n if (!treeOutline) return 'The inquiry tree is still loading.';\n\n const lines: string[] = [\n `Today is ${today}.`,\n `The user is viewing the inquiry tree \"${treeName || 'Inquiry'}\".` +\n (searchableEntities.length\n ? ` Searchable entities — what find_records, query_records and propose_advanced_search work on: ${searchableEntities.join(', ')}.`\n : ' No entity in this tree is searchable, so find_records, query_records and propose_advanced_search will not work.')\n ];\n\n if (!rootLabels.length) {\n lines.push(\n isLoadingRecords\n ? 'The tree is still filling in — no rows are on screen yet.'\n : 'No records are in the tree yet — find_records then load_record brings one in.'\n );\n } else {\n const named = rootLabels.slice(0, MAX_CONTEXT_ROOTS).join(', ');\n lines.push(describeLoadedComposition(summarizeLoadedRows(loadedNodes)));\n lines.push(\n `Top-level rows (${rootLabels.length}): ${named}` +\n (rootLabels.length > MAX_CONTEXT_ROOTS\n ? ` (+${rootLabels.length - MAX_CONTEXT_ROOTS} more — call list_loaded_records).`\n : '.')\n );\n }\n\n lines.push(\n selected\n ? `On screen: \"${selected.label}\"${\n selected.entity ? ` (${selected.entity})` : ''\n } is selected and its record view is open` +\n (selectedRootLabel && selectedRootLabel !== selected.label\n ? `, under \"${selectedRootLabel}\".`\n : '.') +\n ' \"this record\", \"this one\" and \"here\" mean it.'\n : 'On screen: no record is selected, so the record pane is empty.'\n );\n\n if (selected && tabs.length) {\n const open = tabs.find((tab) => tab.id === activeTabId) ?? tabs[0];\n lines.push(\n `Its record pane has ${tabs.length === 1 ? 'one tab' : 'tabs'}: ${tabs\n .map((tab) => `\"${tab.label}\"`)\n .join(', ')}` +\n (tabs.length > 1 ? ` — \"${open.label}\" is open.` : '.') +\n ' read_record reads the record itself.'\n );\n }\n\n if (filterText.trim()) {\n lines.push(\n `A tree filter is active on \"${filterText.trim()}\" — ${filterMatchCount} ` +\n `${filterMatchCount === 1 ? 'row matches' : 'rows match'}. clear_filter removes it.`\n );\n }\n\n return `${lines.join('\\n')}\\n\\nThe tree's configured structure:\\n${treeOutline}`;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AA8CA,MAAMsB,oBAAoB;AAmB1B,MAAMU,YAAYC,SAA0C;CAC1D,MAAMC,MAAM1B,eAAeyB,KAAK;AAChC,QAAOC,MAAMhC,iBAAiBgC,IAAI,GAAGC,KAAAA;;AAGvC,MAAMC,SAASH,SAA0C;CACvD,MAAMC,MAAMD,KAAKI,SAASX;AAC1B,QAAO,OAAOQ,QAAQ,YAAYA,MAAMA,MAAMC,KAAAA;;;AAIhD,MAAaG,oBACXC,aACqD;CACrD,MAAMG,MAAwD,EAAE;CAChE,MAAMC,QACJV,MACAN,WACAE,gBACS;AACT,MAAI,CAACI,KAAM;EACX,MAAMT,QAAQf,gBAAgBwB,KAAK;AACnCS,MAAIE,KAAK;GACPX;GACAQ,KAAK;IACHjB;IACAC,QAAQO,SAASC,KAAK;IACtBP,mBAAmBU,MAAMH,KAAK;IAC9BN;IACAC,QAAQiB,OAAOZ,KAAKa,GAAG;IACvBjB;IACAC,YAAYG,KAAKc,UAAUC,UAAU;IACrCjB,SAAS,CAAC,CAACE,KAAKgB;IAClB;GACD,CAAC;AACF,GAAChB,KAAKc,YAAY,EAAE,EAAEG,SAASC,UAAUR,KAAKQ,OAAOxB,WAAW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CAE/C8M,qBAAqBA,sBAAsBD,SAAS9M,QACjD,YAAY+M,kBAAiB,MAC7B,OACJ,yDACA,iEACL;AAED,KAAID,YAAY5J,KAAK1B,QAAQ;EAC3B,MAAMiM,OAAOvK,KAAKmG,MAAMnF,QAAQA,IAAI5C,OAAO8L,YAAY,IAAIlK,KAAK;AAChEqK,QAAMnM,KACJ,uBAAuB8B,KAAK1B,WAAW,IAAI,YAAY,OAAM,IAAK0B,KAC/DQ,KAAKQ,QAAQ,IAAIA,IAAIlE,MAAK,GAAI,CAC9BsE,KAAK,KAAK,MACVpB,KAAK1B,SAAS,IAAI,OAAOiM,KAAKzN,MAAK,cAAe,OACnD,wCACH;;AAGH,KAAIgN,WAAW9K,MAAM,CACnBqL,OAAMnM,KACJ,+BAA+B4L,WAAW9K,MAAM,CAAA,MAAO+K,iBAAgB,GAClEA,qBAAqB,IAAI,gBAAgB,aAAY,4BAC3D;AAGH,QAAO,GAAGM,MAAMjJ,KAAK,KAAK,CAAA,wCAAyCoI"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type QueryClient, UseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import { PageDocument } from '../../../domain/page';
|
|
3
|
-
import type { CatalogObject, PromotedEntity } from '../../../domain/inquiryTree';
|
|
3
|
+
import type { CatalogObject, InquiryTree, PromotedEntity } from '../../../domain/inquiryTree';
|
|
4
4
|
import { InstanceBodyFilters } from './instanceBodyModel';
|
|
5
5
|
export interface PromotedMethodRef {
|
|
6
6
|
apiMethodId?: string;
|
|
@@ -88,13 +88,6 @@ export declare const inquiryKeys: {
|
|
|
88
88
|
*/
|
|
89
89
|
childBatch: (apiMethodId: string, bodyHash: string) => readonly ["inquiry", "childBatch", string, string];
|
|
90
90
|
entityMeta: (entityName: string) => readonly ["entityMeta", string];
|
|
91
|
-
/**
|
|
92
|
-
* The default entity form's assembled inputs — the entity's UdpObjectFieldInfo
|
|
93
|
-
* rows, the attributes ordered by them, and the option lists behind its
|
|
94
|
-
* foreign-key fields. Config-shaped, so one assembly serves every open of the
|
|
95
|
-
* sheet for that entity.
|
|
96
|
-
*/
|
|
97
|
-
entityForm: (entityName: string) => readonly ["inquiry", "entityForm", string];
|
|
98
91
|
lookupMethod: (catalogId: string) => readonly ["lookupMethod", string];
|
|
99
92
|
lookup: (lookupId: string) => readonly ["lookup", string];
|
|
100
93
|
apiMethod: (apiMethodId: string) => readonly ["apiMethod", string];
|
|
@@ -120,8 +113,9 @@ export declare const inquiryKeys: {
|
|
|
120
113
|
* carry. The tree CONFIG (`['inquiry','tree', …]`) is deliberately NOT here —
|
|
121
114
|
* it changes on a Tree Builder save, never on a record mutation, and
|
|
122
115
|
* invalidating it would refetch the whole tree document on every create.
|
|
116
|
+
* Resolves once the active queries have refetched.
|
|
123
117
|
*/
|
|
124
|
-
export declare const invalidateInquiryRowData: (queryClient: QueryClient) => void
|
|
118
|
+
export declare const invalidateInquiryRowData: (queryClient: QueryClient) => Promise<void>;
|
|
125
119
|
/** An alert config (aggregate-threshold bearing) behind a node-level alert. */
|
|
126
120
|
export interface AlertConfig {
|
|
127
121
|
aggregateThresholdId?: string;
|
|
@@ -158,31 +152,27 @@ export declare const fetchAggregateThresholdValue: (queryClient: QueryClient, ag
|
|
|
158
152
|
* empty-params call the alert path made through AggregateChip. Aggregate
|
|
159
153
|
* values are live, so cached briefly.
|
|
160
154
|
*/
|
|
161
|
-
export declare const useAggregateThresholdValue: (aggregateThresholdId: string) => UseQueryResult<AggregateThresholdValue>;
|
|
162
|
-
/**
|
|
163
|
-
export
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
returnObject?: string;
|
|
171
|
-
};
|
|
172
|
-
/** The product the tree belongs to — its promotions are read under it. */
|
|
173
|
-
product?: {
|
|
174
|
-
productId?: string | number;
|
|
175
|
-
} | null;
|
|
176
|
-
explorePageId?: string | null;
|
|
177
|
-
}
|
|
178
|
-
/** Fetch a detailed inquiry tree (config — cached hard). */
|
|
179
|
-
export declare const useInquiryTree: (treeId: string) => UseQueryResult<InquiryTreeWire>;
|
|
155
|
+
export declare const useAggregateThresholdValue: (aggregateThresholdId: string, params?: Record<string, unknown>) => UseQueryResult<AggregateThresholdValue>;
|
|
156
|
+
/** Fetch an inquiry tree (config — cached hard). */
|
|
157
|
+
export declare const useInquiryTree: (treeId: string) => UseQueryResult<InquiryTree>;
|
|
158
|
+
/**
|
|
159
|
+
* A tree, imperatively — the load-to-tree door needs a tree the viewer is NOT
|
|
160
|
+
* mounted on. Same query as useInquiryTree, so a tree the user later opens is a
|
|
161
|
+
* cache hit.
|
|
162
|
+
*/
|
|
163
|
+
export declare const fetchInquiryTree: (queryClient: QueryClient, treeId: string) => Promise<InquiryTree>;
|
|
180
164
|
/**
|
|
181
|
-
* The
|
|
182
|
-
*
|
|
183
|
-
*
|
|
165
|
+
* The trees this tree's levels link to (`associatedTreeId`), by that id. It
|
|
166
|
+
* follows the ids on the tree it is handed, so a builder's unsaved link is read
|
|
167
|
+
* too. Fetched with the tree because the searchable set is derived from them
|
|
168
|
+
* up front. `trees` holds every one that has answered (a tree that failed is
|
|
169
|
+
* left out); `settled` once none is still pending — a link added later loads
|
|
170
|
+
* beside the trees already in hand rather than hiding them.
|
|
184
171
|
*/
|
|
185
|
-
export declare const
|
|
172
|
+
export declare const useLinkedTrees: (tree: InquiryTree) => {
|
|
173
|
+
trees: Readonly<Record<string, InquiryTree>>;
|
|
174
|
+
settled: boolean;
|
|
175
|
+
};
|
|
186
176
|
/* ------------------------------------------------ recently loaded records */
|
|
187
177
|
/**
|
|
188
178
|
* One entry of the tree's recently-loaded history, exactly as v1 wrote it
|
|
@@ -211,25 +201,6 @@ export interface RecentlyLoadedNode {
|
|
|
211
201
|
* list — a record loaded in either viewer shows up in both.
|
|
212
202
|
*/
|
|
213
203
|
export declare const useRecentlyLoadedNodes: (treeId: string, userId: string) => UseQueryResult<RecentlyLoadedNode[]>;
|
|
214
|
-
/**
|
|
215
|
-
* Record that the user brought a record into the tree by hand — v1 wrote this
|
|
216
|
-
* from its search-load and move-to-top paths, which are exactly what v2's
|
|
217
|
-
* single load path replaced.
|
|
218
|
-
*
|
|
219
|
-
* `queryPayload` is stored as the identifier search that fetched the record, so
|
|
220
|
-
* a click on the history replays the same request v1's entries replay. Failure
|
|
221
|
-
* is silent on purpose: history is a convenience, and a load that worked must
|
|
222
|
-
* not report an error because the bookkeeping behind it didn't.
|
|
223
|
-
*/
|
|
224
|
-
export declare const recordRecentlyLoadedNode: (queryClient: QueryClient, { treeId, userId, apiMethodId, entityName, treeStructureId, label, filterElements }: {
|
|
225
|
-
treeId: string;
|
|
226
|
-
userId: string;
|
|
227
|
-
apiMethodId: string;
|
|
228
|
-
entityName: string;
|
|
229
|
-
treeStructureId: string;
|
|
230
|
-
label: string;
|
|
231
|
-
filterElements: Record<string, unknown>[];
|
|
232
|
-
}) => Promise<void>;
|
|
233
204
|
/** One history entry of a (possibly bulk) load. */
|
|
234
205
|
export interface RecentlyLoadedWriteEntry {
|
|
235
206
|
apiMethodId: string;
|
|
@@ -285,23 +256,26 @@ export type LookupsMap = Record<string, LookupsMapEntry>;
|
|
|
285
256
|
* requested a wave earlier so lookup stamping never pays for this hop.
|
|
286
257
|
*/
|
|
287
258
|
export declare const usePrefetchLookupMethod: (catalogId: string) => void;
|
|
288
|
-
/** Association key → entity name, e.g. `{ resourceAssignment: 'Assignment' }`. */
|
|
289
|
-
export type NestedEntityMap = Record<string, string>;
|
|
290
259
|
/** What a producer needs to stamp lookup display text onto a page of rows. */
|
|
291
260
|
export interface LookupStampContext {
|
|
292
261
|
queryClient: QueryClient;
|
|
293
262
|
catalogId: string | null | undefined;
|
|
294
263
|
/** The tree's catalog objects — the source of each entity's lookup config. */
|
|
295
264
|
catalogObjects?: CatalogObject[] | null;
|
|
296
|
-
/**
|
|
297
|
-
|
|
265
|
+
/**
|
|
266
|
+
* Display text from the product's entity config (maintenance's
|
|
267
|
+
* stampDisplayText): a foreign key the catalog has no lookup for shows its
|
|
268
|
+
* linked record's label, as maintenance does.
|
|
269
|
+
*/
|
|
270
|
+
stampDisplayText?: (entityName: string, rows: Array<Record<string, unknown>>) => Promise<Array<Record<string, unknown>>>;
|
|
298
271
|
}
|
|
299
272
|
/**
|
|
300
273
|
* Stamp a page of rows whose entity is KNOWN: the entity's catalog lookup
|
|
301
|
-
* config
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
274
|
+
* config, overridden by a response's own `lookupsMap` where present. Every v2
|
|
275
|
+
* producer — root page, lazy child page, search-loaded record — funnels
|
|
276
|
+
* through here so a label/header chip on an FK field reads the same wherever
|
|
277
|
+
* the row came from. v2 fetches every level lean (`eagerLoad: false`), so a
|
|
278
|
+
* row carries no nested association rows to stamp.
|
|
305
279
|
*/
|
|
306
280
|
export declare const stampRecordRows: (context: LookupStampContext, entityName: string, rows: Record<string, unknown>[], responseLookupsMap?: LookupsMap) => Promise<Record<string, unknown>[]>;
|
|
307
281
|
export interface RecordRows {
|
|
@@ -319,7 +293,8 @@ export interface RecordRows {
|
|
|
319
293
|
* Two shapes, one query:
|
|
320
294
|
* - the ROOT PAGE: `pageSize` records, the root level's initial record count;
|
|
321
295
|
* - ENTRY FROM RECORD (`?node=`/`?nodeSearch=`): `identifierFilters` names one
|
|
322
|
-
* record and the page is just that record
|
|
296
|
+
* record and the page is just that record — two rows are asked for and the
|
|
297
|
+
* page is empty unless exactly one matches (rowForIdentifierSet).
|
|
323
298
|
*
|
|
324
299
|
* The request carries the Data Builder query's OWN saved filters/order
|
|
325
300
|
* (`instanceFilters`): ad-hoc execution ignores the instance body, so a query's
|
|
@@ -346,25 +321,23 @@ export declare const useRootRecords: ({ treeId, apiMethodId, entityName, instanc
|
|
|
346
321
|
enabled?: boolean;
|
|
347
322
|
}) => UseQueryResult<RecordRows>;
|
|
348
323
|
/**
|
|
349
|
-
* Fetch
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
*/
|
|
354
|
-
export declare const fetchRecordByIdentifiers: (queryClient: QueryClient, apiMethodId: string, filterElements: Record<string, unknown>[], lookupContext?: LookupStampContext & {
|
|
355
|
-
entityName?: string;
|
|
356
|
-
}) => Promise<Record<string, unknown>>;
|
|
357
|
-
/**
|
|
358
|
-
* Fetch MANY records in one request — the bulk-load path ("Load selected").
|
|
359
|
-
* Each identifier set becomes an AND group and the groups combine with OR, so
|
|
324
|
+
* Fetch records by identifier sets in one request — every load by identifiers
|
|
325
|
+
* (Load dialog picks, "Load selected", deep links, a record's refresh). LEAN:
|
|
326
|
+
* the record's levels are filled by the wave loader afterwards. Each
|
|
327
|
+
* identifier set becomes an AND group and the groups combine with OR, so
|
|
360
328
|
* twenty picks cost one search instead of twenty (the per-record pipeline made
|
|
361
329
|
* 50+ requests for a 20-record bulk load, observed 2026-08-27). Returns the
|
|
362
|
-
* rows the server matched, lookup-stamped when given a context
|
|
363
|
-
*
|
|
330
|
+
* rows the server matched, lookup-stamped when given a context. One row more
|
|
331
|
+
* than the sets is asked for, so a set matching several records shows as
|
|
332
|
+
* ambiguous rather than as its first match (resolveIdentifierSets).
|
|
364
333
|
*/
|
|
365
334
|
export declare const fetchRecordsByIdentifierSets: (queryClient: QueryClient, apiMethodId: string, identifierSets: Record<string, unknown>[][], lookupContext?: LookupStampContext & {
|
|
366
335
|
entityName?: string;
|
|
367
336
|
}) => Promise<Record<string, unknown>[]>;
|
|
337
|
+
/** Each identifier set's row, null when none or several match (resolveIdentifierSets). */
|
|
338
|
+
export declare const fetchRowsForIdentifierSets: (queryClient: QueryClient, apiMethodId: string, identifierSets: Record<string, unknown>[][], lookupContext?: LookupStampContext & {
|
|
339
|
+
entityName?: string;
|
|
340
|
+
}) => Promise<Record<string, unknown>[]>;
|
|
368
341
|
/**
|
|
369
342
|
* ONE child-level request — a wave's batched `parentFK IN (…)` fetch or a lazy
|
|
370
343
|
* expand's single-parent one. Cached on (method × exact body), so the same
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../../src/inquiry/v2/api/queries.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../../src/inquiry/v2/api/queries.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,KAAK,WAAW,EAIhB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAEL,YAAY,EAEb,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EAEX,cAAc,EACf,MAAM,6BAA6B,CAAC;AAgBrC,OAAO,EAGL,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAoC7B,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,iBAAiB,CAAC;IAC1C,qBAAqB,CAAC,EAAE,iBAAiB,CAAC;IAC1C,qBAAqB,CAAC,EAAE,iBAAiB,CAAC;IAC1C,kBAAkB,CAAC,EAAE,iBAAiB,CAAC;IACvC,qBAAqB,CAAC,EAAE,iBAAiB,CAAC;CAC3C;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,qEAAmE;IACnE,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3C,+DAA6D;IAC7D,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACvC;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,0FAsCxB,CAAC;AAEL;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,yFAY9B,CAAC;AAEF,8DAA8D;AAC9D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