@medyll/idae-machine 0.135.2 → 0.136.1
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/LICENSE +21 -21
- package/README.md +555 -360
- package/cli.cjs +22 -0
- package/dist/__fixtures__/demoModel.d.ts +79 -0
- package/dist/__fixtures__/demoModel.js +146 -0
- package/dist/ai/frame/AiChatSession.svelte +152 -0
- package/dist/ai/frame/AiChatSession.svelte.d.ts +7 -0
- package/dist/ai/frame/index.d.ts +1 -0
- package/dist/ai/frame/index.js +2 -0
- package/dist/ai/index.d.ts +9 -0
- package/dist/ai/index.js +12 -0
- package/dist/ai/schema/ai-catalogs.d.ts +2 -0
- package/dist/ai/schema/ai-catalogs.js +86 -0
- package/dist/ai/schema/ai-chat-session.d.ts +2 -0
- package/dist/ai/schema/ai-chat-session.js +35 -0
- package/dist/ai/schema/ai-companion.d.ts +2 -0
- package/dist/ai/schema/ai-companion.js +25 -0
- package/dist/ai/schema/ai-message.d.ts +2 -0
- package/dist/ai/schema/ai-message.js +20 -0
- package/dist/ai/schema/ai-tool-call.d.ts +2 -0
- package/dist/ai/schema/ai-tool-call.js +18 -0
- package/dist/ai/schema/ai-user-prompt.d.ts +2 -0
- package/dist/ai/schema/ai-user-prompt.js +17 -0
- package/dist/ai/schema/tag.d.ts +2 -0
- package/dist/ai/schema/tag.js +14 -0
- package/dist/ai/streamIntoRecord.d.ts +31 -0
- package/dist/ai/streamIntoRecord.js +79 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.js +19 -0
- package/dist/data-ui/controls/AlphabetFilter.svelte +114 -0
- package/dist/data-ui/controls/AlphabetFilter.svelte.d.ts +10 -0
- package/dist/data-ui/controls/ButtonAction.svelte +151 -0
- package/dist/data-ui/controls/ButtonAction.svelte.d.ts +18 -0
- package/dist/data-ui/controls/DataFind.svelte +174 -0
- package/dist/data-ui/controls/DataFind.svelte.d.ts +10 -0
- package/dist/data-ui/controls/DataGroup.svelte +150 -0
- package/dist/data-ui/controls/DataGroup.svelte.d.ts +7 -0
- package/dist/data-ui/controls/DataSort.svelte +78 -0
- package/dist/data-ui/controls/DataSort.svelte.d.ts +9 -0
- package/dist/data-ui/controls/DataToolbar.svelte +67 -0
- package/dist/data-ui/controls/DataToolbar.svelte.d.ts +11 -0
- package/dist/data-ui/controls/Find.svelte +38 -0
- package/dist/data-ui/controls/Find.svelte.d.ts +9 -0
- package/dist/data-ui/controls/FkFilter.svelte +94 -0
- package/dist/data-ui/controls/FkFilter.svelte.d.ts +11 -0
- package/dist/data-ui/controls/Group.svelte +36 -0
- package/dist/data-ui/controls/Group.svelte.d.ts +8 -0
- package/dist/data-ui/controls/ListMode.svelte +79 -0
- package/dist/data-ui/controls/ListMode.svelte.d.ts +10 -0
- package/dist/data-ui/controls/Sort.svelte +100 -0
- package/dist/data-ui/controls/Sort.svelte.d.ts +8 -0
- package/dist/data-ui/data/DataCount.svelte +67 -0
- package/dist/data-ui/data/DataCount.svelte.d.ts +36 -0
- package/dist/data-ui/data/DataFk.svelte +54 -0
- package/dist/data-ui/data/DataFk.svelte.d.ts +11 -0
- package/dist/data-ui/data/DataForm.svelte +191 -0
- package/dist/data-ui/data/DataForm.svelte.d.ts +15 -0
- package/dist/data-ui/data/DataList.svelte +645 -0
- package/dist/data-ui/data/DataList.svelte.d.ts +75 -0
- package/dist/data-ui/data/DataListFk.svelte +111 -0
- package/dist/data-ui/data/DataListFk.svelte.d.ts +13 -0
- package/dist/data-ui/data/DataListRfk.svelte +111 -0
- package/dist/data-ui/data/DataListRfk.svelte.d.ts +13 -0
- package/dist/data-ui/data/DataRecord.svelte +167 -0
- package/dist/data-ui/data/DataRecord.svelte.d.ts +22 -0
- package/dist/data-ui/data/DataRfk.svelte +73 -0
- package/dist/data-ui/data/DataRfk.svelte.d.ts +15 -0
- package/dist/data-ui/data/index.d.ts +7 -0
- package/dist/data-ui/data/index.js +8 -0
- package/dist/data-ui/field/DataField.svelte +343 -0
- package/dist/data-ui/field/DataField.svelte.d.ts +33 -0
- package/dist/{form/FieldInPlace.svelte → data-ui/field/DataFieldEdit.svelte} +103 -98
- package/dist/{form/FieldInPlace.svelte.d.ts → data-ui/field/DataFieldEdit.svelte.d.ts} +5 -5
- package/dist/data-ui/field/index.d.ts +2 -0
- package/dist/data-ui/field/index.js +3 -0
- package/dist/data-ui/field/snippets/FieldAiPrompt.svelte +145 -0
- package/dist/data-ui/field/snippets/FieldAiPrompt.svelte.d.ts +14 -0
- package/dist/data-ui/field/snippets/FieldBoolean.svelte +43 -0
- package/dist/data-ui/field/snippets/FieldBoolean.svelte.d.ts +12 -0
- package/dist/data-ui/field/snippets/FieldColor.svelte +48 -0
- package/dist/data-ui/field/snippets/FieldColor.svelte.d.ts +10 -0
- package/dist/data-ui/field/snippets/FieldCurrency.svelte +105 -0
- package/dist/data-ui/field/snippets/FieldCurrency.svelte.d.ts +15 -0
- package/dist/data-ui/field/snippets/FieldEmail.svelte +77 -0
- package/dist/data-ui/field/snippets/FieldEmail.svelte.d.ts +14 -0
- package/dist/data-ui/field/snippets/FieldIcon.svelte +73 -0
- package/dist/data-ui/field/snippets/FieldIcon.svelte.d.ts +11 -0
- package/dist/data-ui/field/snippets/FieldSelect.svelte +71 -0
- package/dist/data-ui/field/snippets/FieldSelect.svelte.d.ts +15 -0
- package/dist/data-ui/field/snippets/FieldText.svelte +52 -0
- package/dist/data-ui/field/snippets/FieldText.svelte.d.ts +13 -0
- package/dist/data-ui/field/snippets/FieldTextarea.svelte +50 -0
- package/dist/data-ui/field/snippets/FieldTextarea.svelte.d.ts +13 -0
- package/dist/data-ui/field/snippets/index.d.ts +9 -0
- package/dist/data-ui/field/snippets/index.js +10 -0
- package/dist/data-ui/fragments/ContextMenu.svelte +109 -0
- package/dist/data-ui/fragments/ContextMenu.svelte.d.ts +4 -0
- package/dist/data-ui/fragments/ContextMenuContent.svelte +275 -0
- package/dist/data-ui/fragments/ContextMenuContent.svelte.d.ts +8 -0
- package/dist/data-ui/fragments/Frame.svelte +43 -0
- package/dist/data-ui/fragments/Frame.svelte.d.ts +10 -0
- package/dist/data-ui/fragments/InfoLine.svelte +123 -0
- package/dist/data-ui/fragments/InfoLine.svelte.d.ts +12 -0
- package/dist/data-ui/fragments/Selector.svelte +56 -0
- package/dist/data-ui/fragments/Selector.svelte.d.ts +10 -0
- package/dist/{fragments → data-ui/fragments}/Skeleton.svelte +21 -21
- package/dist/data-ui/fragments/Tile.svelte +126 -0
- package/dist/data-ui/fragments/Tile.svelte.d.ts +14 -0
- package/dist/data-ui/fragments/contextMenu.svelte.d.ts +22 -0
- package/dist/data-ui/fragments/contextMenu.svelte.js +31 -0
- package/dist/data-ui/fragments/dialog/Dialog.svelte +185 -0
- package/dist/data-ui/fragments/dialog/Dialog.svelte.d.ts +29 -0
- package/dist/data-ui/fragments/dialog/dialog.svelte.d.ts +27 -0
- package/dist/data-ui/fragments/dialog/dialog.svelte.js +41 -0
- package/dist/data-ui/fragments/index.d.ts +11 -0
- package/dist/data-ui/fragments/index.js +11 -0
- package/dist/data-ui/utils/__tests__/HostProbe.svelte +18 -0
- package/dist/data-ui/utils/__tests__/HostProbe.svelte.d.ts +8 -0
- package/dist/data-ui/utils/data-utils.d.ts +29 -0
- package/dist/data-ui/utils/data-utils.js +83 -0
- package/dist/data-ui/utils/dataRelationUtils.d.ts +37 -0
- package/dist/data-ui/utils/dataRelationUtils.js +125 -0
- package/dist/data-ui/utils/diagramUtils.d.ts +6 -0
- package/dist/data-ui/utils/diagramUtils.js +131 -0
- package/dist/data-ui/utils/draggable.d.ts +15 -0
- package/dist/data-ui/utils/draggable.js +61 -0
- package/dist/data-ui/utils/menuPrefs.d.ts +80 -0
- package/dist/data-ui/utils/menuPrefs.js +119 -0
- package/dist/data-ui/utils/useMachinePrefs.svelte.d.ts +38 -0
- package/dist/data-ui/utils/useMachinePrefs.svelte.js +117 -0
- package/dist/data-ui/utils/useMenuTree.svelte.d.ts +26 -0
- package/dist/data-ui/utils/useMenuTree.svelte.js +68 -0
- package/dist/data-ui/utils/useRecordData.svelte.d.ts +22 -0
- package/dist/data-ui/utils/useRecordData.svelte.js +50 -0
- package/dist/data-ui/utils/useViewFields.svelte.d.ts +22 -0
- package/dist/data-ui/utils/useViewFields.svelte.js +59 -0
- package/dist/demo/.gitkeep +0 -0
- package/dist/demo/demo-status.json +9 -0
- package/dist/idae/boot.d.ts +28 -0
- package/dist/idae/boot.js +43 -0
- package/dist/idae/bridge/register.d.ts +4 -0
- package/dist/idae/bridge/register.js +15 -0
- package/dist/idae/capabilities/Capabilities.d.ts +10 -0
- package/dist/idae/capabilities/Capabilities.js +34 -0
- package/dist/idae/codefield/CodeFieldConvention.d.ts +3 -0
- package/dist/idae/codefield/CodeFieldConvention.js +25 -0
- package/dist/idae/fieldcatalog/defaultFieldTypesDef.d.ts +2 -0
- package/dist/idae/fieldcatalog/defaultFieldTypesDef.js +104 -0
- package/dist/idae/frames/FrameCatalog.d.ts +31 -0
- package/dist/idae/frames/FrameCatalog.js +31 -0
- package/dist/idae/index.d.ts +14 -0
- package/dist/idae/index.js +13 -0
- package/dist/idae/menu/IdaeMenuManager.d.ts +79 -0
- package/dist/idae/menu/IdaeMenuManager.js +108 -0
- package/dist/idae/menu/IdaeMenuStore.d.ts +77 -0
- package/dist/idae/menu/IdaeMenuStore.js +68 -0
- package/dist/idae/menu/menuSnapshot.d.ts +30 -0
- package/dist/idae/menu/menuSnapshot.js +30 -0
- package/dist/idae/meta/MetaModelProvider.d.ts +11 -0
- package/dist/idae/meta/MetaModelProvider.js +43 -0
- package/dist/idae/relations/RelationPolicy.d.ts +19 -0
- package/dist/idae/relations/RelationPolicy.js +125 -0
- package/dist/idae/rights/RightsPolicy.d.ts +16 -0
- package/dist/idae/rights/RightsPolicy.js +80 -0
- package/dist/idae/userscope/UserScopePolicy.d.ts +9 -0
- package/dist/idae/userscope/UserScopePolicy.js +42 -0
- package/dist/idae/userscope/navTracking.d.ts +11 -0
- package/dist/idae/userscope/navTracking.js +15 -0
- package/dist/index.d.ts +68 -35
- package/dist/index.js +82 -36
- package/dist/main/__tests__/_relationTestUtils.d.ts +12 -0
- package/dist/main/__tests__/_relationTestUtils.js +53 -0
- package/dist/main/__tests__/helpers/mockCollection.d.ts +21 -0
- package/dist/main/__tests__/helpers/mockCollection.js +27 -0
- package/dist/main/api/types.d.ts +29 -0
- package/dist/main/ext/hooks.d.ts +32 -0
- package/dist/main/ext/hooks.js +31 -0
- package/dist/main/ext/interfaces.d.ts +69 -0
- package/dist/main/ext/interfaces.js +3 -0
- package/dist/main/ext/registry.d.ts +29 -0
- package/dist/main/ext/registry.js +30 -0
- package/dist/main/frame/MachineFrameManager.d.ts +187 -0
- package/dist/main/frame/MachineFrameManager.js +403 -0
- package/dist/main/frame/contextMenuSetup.d.ts +9 -0
- package/dist/main/frame/contextMenuSetup.js +42 -0
- package/dist/main/frame/frameUrl.d.ts +1 -0
- package/dist/main/frame/frameUrl.js +8 -0
- package/dist/main/frame/frameUtils.d.ts +16 -0
- package/dist/main/frame/frameUtils.js +26 -0
- package/dist/main/frame/linkParser.d.ts +9 -0
- package/dist/main/frame/linkParser.js +15 -0
- package/dist/main/index.d.ts +15 -0
- package/dist/main/index.js +19 -0
- package/dist/main/machine/MachineAction.d.ts +62 -0
- package/dist/main/machine/MachineAction.js +96 -0
- package/dist/main/machine/MachineError.js +2 -2
- package/dist/main/machine/MachineFieldType.d.ts +25 -6
- package/dist/main/machine/MachineFieldType.js +118 -27
- package/dist/main/machine/MachineFkFold.d.ts +34 -0
- package/dist/main/machine/MachineFkFold.js +57 -0
- package/dist/main/machine/MachineRecordIdentity.d.ts +26 -0
- package/dist/main/machine/MachineRecordIdentity.js +44 -0
- package/dist/main/machine/MachineRights.d.ts +50 -0
- package/dist/main/machine/MachineRights.js +133 -0
- package/dist/main/machine/MachineRouter.d.ts +56 -0
- package/dist/main/machine/MachineRouter.js +250 -0
- package/dist/main/machine/MachineScheme.d.ts +40 -70
- package/dist/main/machine/MachineScheme.js +107 -94
- package/dist/main/machine/MachineSchemeField.js +32 -16
- package/dist/main/machine/MachineSchemeFieldForge.d.ts +11 -11
- package/dist/main/machine/MachineSchemeFieldForge.js +33 -21
- package/dist/main/machine/MachineSchemeFieldValues.d.ts +8 -9
- package/dist/main/machine/MachineSchemeFieldValues.js +12 -9
- package/dist/main/machine/MachineSchemeValidate.d.ts +69 -13
- package/dist/main/machine/MachineSchemeValidate.js +173 -46
- package/dist/main/machine/MachineSchemeValues.d.ts +32 -21
- package/dist/main/machine/MachineSchemeValues.js +132 -104
- package/dist/main/machine/SchemeFieldDefaultValues.d.ts +4 -2
- package/dist/main/machine/SchemeFieldDefaultValues.js +8 -2
- package/dist/main/machine/authState.svelte.d.ts +11 -0
- package/dist/main/machine/authState.svelte.js +17 -0
- package/dist/main/machine/fieldBuilder.d.ts +23 -0
- package/dist/main/machine/fieldBuilder.d.ts.map +1 -0
- package/dist/main/machine/fieldBuilder.js +10 -0
- package/dist/main/machine/fieldBuilder.js.map +1 -0
- package/dist/main/machine/machineLabel.d.ts +11 -0
- package/dist/main/machine/machineLabel.js +23 -0
- package/dist/main/machine/validateRules.d.ts +38 -0
- package/dist/main/machine/validateRules.js +109 -0
- package/dist/main/machine.d.ts +207 -68
- package/dist/main/machine.js +482 -96
- package/dist/main/machineDb.d.ts +21 -8
- package/dist/main/machineDb.js +33 -4
- package/dist/main/machineIdbAdapter.d.ts +83 -0
- package/dist/main/machineIdbAdapter.js +347 -0
- package/dist/main/machineModelBuilder.d.ts +31 -0
- package/dist/main/machineModelBuilder.js +58 -0
- package/dist/main/machineParserForge.d.ts +9 -18
- package/dist/main/machineParserForge.js +92 -35
- package/dist/main/machineSchemaCache.d.ts +8 -0
- package/dist/main/machineSchemaCache.js +58 -0
- package/dist/main/machineSchemaDoctor.d.ts +17 -0
- package/dist/main/machineSchemaDoctor.js +73 -0
- package/dist/main/machineSchemaLoader.d.ts +18 -0
- package/dist/main/machineSchemaLoader.js +43 -0
- package/dist/main/machineSeed.d.ts +21 -0
- package/dist/main/machineSeed.js +44 -0
- package/dist/main/router/componentRegistry.d.ts +35 -0
- package/dist/main/router/componentRegistry.js +35 -0
- package/dist/main/router/urlParser.d.ts +17 -0
- package/dist/main/router/urlParser.js +41 -0
- package/dist/main/warmupUtils.d.ts +40 -0
- package/dist/main/warmupUtils.js +73 -0
- package/dist/mcp/MachineMcpClient.d.ts +43 -0
- package/dist/mcp/MachineMcpClient.js +175 -0
- package/dist/shell/Frame.svelte +67 -0
- package/dist/shell/Frame.svelte.d.ts +11 -0
- package/dist/shell/auth/Login.svelte +244 -0
- package/dist/shell/auth/Login.svelte.d.ts +3 -0
- package/dist/shell/frame/dashboard/Dashboard.svelte +0 -0
- package/dist/shell/frame/dashboard/Dashboard.svelte.d.ts +26 -0
- package/dist/shell/frame/diagram/Diagram.svelte +244 -0
- package/dist/shell/frame/diagram/Diagram.svelte.d.ts +9 -0
- package/dist/shell/frame/explorer/Explorer.svelte +86 -0
- package/dist/shell/frame/explorer/Explorer.svelte.d.ts +29 -0
- package/dist/shell/frame/explorer/ExplorerContent.svelte +126 -0
- package/dist/shell/frame/explorer/ExplorerContent.svelte.d.ts +32 -0
- package/dist/shell/frame/index.d.ts +8 -0
- package/dist/shell/frame/index.js +9 -0
- package/dist/shell/frame/main-menu-content/MainMenuContent.svelte +100 -0
- package/dist/shell/frame/main-menu-content/MainMenuContent.svelte.d.ts +6 -0
- package/dist/shell/frame/planning/Planning.svelte +426 -0
- package/dist/shell/frame/planning/Planning.svelte.d.ts +12 -0
- package/dist/shell/frame/rbac/RbacMatrix.svelte +197 -0
- package/dist/shell/frame/rbac/RbacMatrix.svelte.d.ts +7 -0
- package/dist/shell/frame/space/Space.svelte +554 -0
- package/dist/shell/frame/space/Space.svelte.d.ts +8 -0
- package/dist/shell/frame/synthesis/Synthesis.svelte +383 -0
- package/dist/shell/frame/synthesis/Synthesis.svelte.d.ts +8 -0
- package/dist/shell/frame/today/Today.svelte +174 -0
- package/dist/shell/frame/today/Today.svelte.d.ts +3 -0
- package/dist/shell/layout/App.svelte +30 -0
- package/dist/shell/layout/App.svelte.d.ts +3 -0
- package/dist/shell/layout/Breadcrumb.svelte +67 -0
- package/dist/shell/layout/Breadcrumb.svelte.d.ts +12 -0
- package/dist/shell/layout/Columner.svelte +214 -0
- package/dist/shell/layout/Columner.svelte.d.ts +16 -0
- package/dist/shell/layout/DevResetPanel.svelte +194 -0
- package/dist/shell/layout/DevResetPanel.svelte.d.ts +7 -0
- package/dist/shell/layout/Fiche.svelte +111 -0
- package/dist/shell/layout/Fiche.svelte.d.ts +7 -0
- package/dist/shell/layout/FicheUpdate.svelte +53 -0
- package/dist/shell/layout/FicheUpdate.svelte.d.ts +7 -0
- package/dist/shell/layout/MainMenu.svelte +256 -0
- package/dist/shell/layout/MainMenu.svelte.d.ts +6 -0
- package/dist/shell/layout/MenuSettings.svelte +182 -0
- package/dist/shell/layout/MenuSettings.svelte.d.ts +6 -0
- package/dist/shell/layout/RecordTimeline.svelte +199 -0
- package/dist/shell/layout/RecordTimeline.svelte.d.ts +8 -0
- package/dist/shell/layout/RecordToolbar.svelte +39 -0
- package/dist/shell/layout/RecordToolbar.svelte.d.ts +7 -0
- package/dist/shell/layout/TaskBar.svelte +118 -0
- package/dist/shell/layout/TaskBar.svelte.d.ts +7 -0
- package/dist/shell/layout/TemplateShell.svelte +48 -0
- package/dist/shell/layout/TemplateShell.svelte.d.ts +15 -0
- package/dist/shell/layout/ThemeToggle.svelte +46 -0
- package/dist/shell/layout/ThemeToggle.svelte.d.ts +3 -0
- package/dist/shell/layout/index.d.ts +8 -0
- package/dist/shell/layout/index.js +9 -0
- package/dist/storage/ApiStorageAdapter.d.ts +41 -0
- package/dist/storage/ApiStorageAdapter.js +111 -0
- package/dist/storage/IdbStorageAdapter.d.ts +31 -0
- package/dist/storage/IdbStorageAdapter.js +72 -0
- package/dist/storage/MemoryStorageAdapter.d.ts +33 -0
- package/dist/storage/MemoryStorageAdapter.js +132 -0
- package/dist/storage/README.md +222 -0
- package/dist/storage/StorageAdapter.d.ts +75 -0
- package/dist/storage/StorageAdapter.js +7 -0
- package/dist/storage/demo/storage-demo.d.ts +22 -0
- package/dist/storage/demo/storage-demo.js +107 -0
- package/dist/storage/index.d.ts +9 -0
- package/dist/storage/index.js +9 -0
- package/dist/types/entity-types.d.ts +444 -0
- package/dist/types/entity-types.js +16 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.js +6 -0
- package/dist/types/machine-model.d.ts +198 -0
- package/dist/types/machine-model.js +5 -0
- package/dist/types/qoolie-svelte.d.ts +11 -0
- package/dist/types/schema-utils.d.ts +32 -0
- package/dist/types/schema-utils.js +103 -0
- package/dist/utils/generateCode.d.ts +5 -0
- package/dist/utils/generateCode.js +9 -0
- package/dist/utils/logger.d.ts +10 -0
- package/dist/utils/logger.js +20 -0
- package/package.json +59 -33
- package/cli.js +0 -46
- package/dist/db/CrudService.d.ts +0 -9
- package/dist/db/CrudService.js +0 -45
- package/dist/demo/dbSchema.d.ts +0 -446
- package/dist/demo/dbSchema.js +0 -449
- package/dist/demo/testScheme.d.ts +0 -56
- package/dist/demo/testScheme.js +0 -42
- package/dist/form/CreateUpdate.svelte +0 -219
- package/dist/form/CreateUpdate.svelte.d.ts +0 -27
- package/dist/form/DataProvider.svelte +0 -23
- package/dist/form/DataProvider.svelte.d.ts +0 -7
- package/dist/form/FieldValue.svelte +0 -148
- package/dist/form/FieldValue.svelte.d.ts +0 -34
- package/dist/form/types.d.ts +0 -17
- package/dist/fragments/Confirm.svelte +0 -73
- package/dist/fragments/Confirm.svelte.d.ts +0 -7
- package/dist/fragments/Frame.svelte +0 -19
- package/dist/fragments/Frame.svelte.d.ts +0 -32
- package/dist/fragments/InfoLine.svelte +0 -21
- package/dist/fragments/InfoLine.svelte.d.ts +0 -35
- package/dist/fragments/Selector.svelte +0 -26
- package/dist/fragments/Selector.svelte.d.ts +0 -38
- package/dist/main/machine/MachineSchemeField.d.ts +0 -19
- package/dist/types/appschemeTypes.d.ts +0 -71
- package/dist/types/appschemeTypes.js +0 -83
- package/dist/ui/CollectionButton.svelte +0 -29
- package/dist/ui/CollectionButton.svelte.d.ts +0 -29
- package/dist/ui/CollectionFks.svelte +0 -24
- package/dist/ui/CollectionFks.svelte.d.ts +0 -9
- package/dist/ui/CollectionList.svelte +0 -100
- package/dist/ui/CollectionList.svelte.d.ts +0 -36
- package/dist/ui/CollectionListFieldValues.svelte +0 -59
- package/dist/ui/CollectionListFieldValues.svelte.d.ts +0 -9
- package/dist/ui/CollectionListMenu.svelte +0 -39
- package/dist/ui/CollectionListMenu.svelte.d.ts +0 -34
- package/dist/ui/CollectionReverseFks.svelte +0 -37
- package/dist/ui/CollectionReverseFks.svelte.d.ts +0 -14
- /package/dist/{fragments → data-ui/fragments}/Skeleton.svelte.d.ts +0 -0
- /package/dist/{form → main/api}/types.js +0 -0
|
@@ -1,21 +1,29 @@
|
|
|
1
|
-
import type { TplCollectionName, TplFields } from
|
|
2
|
-
import { MachineDb } from
|
|
1
|
+
import type { TplCollectionName, TplFields } from '../../types/index.js';
|
|
2
|
+
import { MachineDb } from '../machineDb.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
4
|
* @class MachineSchemeValidate
|
|
9
5
|
* @role Provides validation utilities for form fields in a collection.
|
|
6
|
+
* Supports field validation, custom validators, cross-field validation, and async validators.
|
|
10
7
|
*
|
|
11
8
|
* Usage:
|
|
12
|
-
* const validator = new
|
|
9
|
+
* const validator = new MachineSchemeValidate('agents', machineDb);
|
|
10
|
+
* validator.registerCustom('email', (val) => /^.+@.+/.test(val));
|
|
13
11
|
* const result = validator.validateField('email', value);
|
|
14
12
|
*/
|
|
13
|
+
/** Validation error result structure */
|
|
14
|
+
export interface ValidationError {
|
|
15
|
+
fieldName: string;
|
|
16
|
+
message: string;
|
|
17
|
+
severity: 'error' | 'warning';
|
|
18
|
+
type: 'required' | 'type' | 'format' | 'custom' | 'cross-field';
|
|
19
|
+
}
|
|
15
20
|
export declare class MachineSchemeValidate {
|
|
16
21
|
#private;
|
|
17
22
|
private collection;
|
|
18
23
|
private machineDb;
|
|
24
|
+
private customValidators;
|
|
25
|
+
private asyncValidators;
|
|
26
|
+
private crossFieldValidators;
|
|
19
27
|
/**
|
|
20
28
|
* Create a new MachineSchemeValidate instance.
|
|
21
29
|
* @role Constructor
|
|
@@ -30,22 +38,70 @@ export declare class MachineSchemeValidate {
|
|
|
30
38
|
* @param {any} value The value to validate.
|
|
31
39
|
* @return {{ isValid: boolean; error?: string; }} An object with isValid and optional error.
|
|
32
40
|
*/
|
|
33
|
-
validateField(fieldName: keyof TplFields, value: unknown): {
|
|
41
|
+
validateField(fieldName: keyof TplFields, value: unknown, formData?: Record<string, unknown>): Promise<{
|
|
34
42
|
isValid: boolean;
|
|
35
43
|
error?: string;
|
|
36
|
-
}
|
|
44
|
+
}>;
|
|
37
45
|
/**
|
|
38
46
|
* Validate a single field value for a collection.
|
|
39
47
|
* @param fieldName The field name.
|
|
40
48
|
* @param value The value to validate.
|
|
41
49
|
* @returns True if valid, false otherwise.
|
|
42
50
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Quick validation check for a field value (boolean result).
|
|
53
|
+
* @role Field validation
|
|
54
|
+
* @param {keyof TplFields} fieldName The field name to validate.
|
|
55
|
+
* @param {unknown} value The value to validate.
|
|
56
|
+
* @returns {Promise<boolean>} True if valid, false otherwise.
|
|
57
|
+
*/
|
|
58
|
+
validateFieldValue(fieldName: keyof TplFields, value: unknown): Promise<boolean>;
|
|
59
|
+
/**
|
|
60
|
+
* Register a custom validator function for a specific field.
|
|
61
|
+
* @role Custom validation
|
|
62
|
+
* @param {keyof TplFields} fieldName The field name to validate.
|
|
63
|
+
* @param {(value: unknown) => boolean} validator The validator function (returns true if valid).
|
|
64
|
+
*/
|
|
65
|
+
registerCustom(fieldName: keyof TplFields, validator: (value: unknown) => boolean): void;
|
|
66
|
+
/**
|
|
67
|
+
* Register an async validator function for a specific field.
|
|
68
|
+
* @role Async validation
|
|
69
|
+
* @param {keyof TplFields} fieldName The field name to validate.
|
|
70
|
+
* @param {(value: unknown) => Promise<boolean>} validator The async validator function.
|
|
71
|
+
*/
|
|
72
|
+
registerAsync(fieldName: keyof TplFields, validator: (value: unknown) => Promise<boolean>): void;
|
|
73
|
+
/**
|
|
74
|
+
* Register a cross-field validator that validates multiple fields together.
|
|
75
|
+
* @role Cross-field validation
|
|
76
|
+
* @param {Object} rule The cross-field validation rule.
|
|
77
|
+
* @param {string[]} rule.fields The field names involved in the validation.
|
|
78
|
+
* @param {(data: Record<string, unknown>) => boolean | Promise<boolean>} rule.validator The validator function.
|
|
79
|
+
*/
|
|
80
|
+
registerCrossField(rule: {
|
|
81
|
+
fields: string[];
|
|
82
|
+
validator: (data: Record<string, unknown>) => boolean | Promise<boolean>;
|
|
83
|
+
}): void;
|
|
84
|
+
/**
|
|
85
|
+
* Validate entire form data against all collection fields.
|
|
86
|
+
* @role Form validation
|
|
87
|
+
* @param {Record<string, unknown>} formData The complete form data to validate.
|
|
88
|
+
* @param {Object} [options] Validation options.
|
|
89
|
+
* @param {string[]} [options.ignoreFields] Fields to skip during validation.
|
|
90
|
+
* @param {Array} [options.crossFieldValidators] Array of cross-field validator functions.
|
|
91
|
+
* @returns {Promise<Object>} Validation result with isValid flag, error messages, and invalid field names.
|
|
92
|
+
*/
|
|
93
|
+
validateForm(formData: Record<string, unknown>, options?: {
|
|
45
94
|
ignoreFields?: string[] | undefined;
|
|
46
|
-
|
|
95
|
+
crossFieldValidators?: Array<(data: Record<string, unknown>) => boolean | {
|
|
96
|
+
isValid: boolean;
|
|
97
|
+
errors?: Record<string, string>;
|
|
98
|
+
} | Promise<boolean | {
|
|
99
|
+
isValid: boolean;
|
|
100
|
+
errors?: Record<string, string>;
|
|
101
|
+
}>>;
|
|
102
|
+
}): Promise<{
|
|
47
103
|
isValid: boolean;
|
|
48
104
|
errors: Record<string, string>;
|
|
49
105
|
invalidFields: string[];
|
|
50
|
-
}
|
|
106
|
+
}>;
|
|
51
107
|
}
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
import { MachineDb } from
|
|
2
|
-
import { MachineErrorValidation } from
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @class MachineSchemeValidate
|
|
10
|
-
* @role Provides validation utilities for form fields in a collection.
|
|
11
|
-
*
|
|
12
|
-
* Usage:
|
|
13
|
-
* const validator = new IDbFormValidate('agent');
|
|
14
|
-
* const result = validator.validateField('email', value);
|
|
15
|
-
*/
|
|
1
|
+
import { MachineDb } from '../machineDb.js';
|
|
2
|
+
import { MachineErrorValidation } from './MachineErrorValidation.js';
|
|
3
|
+
import { MachineError } from './MachineError.js';
|
|
4
|
+
import MachineSchemeFieldType, { defaultTypes } from './MachineFieldType.js';
|
|
5
|
+
import { validateField as validateFieldPure } from './validateRules.js';
|
|
16
6
|
export class MachineSchemeValidate {
|
|
17
7
|
collection;
|
|
18
8
|
machineDb;
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
customValidators = new Map();
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
+
asyncValidators = new Map();
|
|
13
|
+
crossFieldValidators = [];
|
|
19
14
|
/**
|
|
20
15
|
* Create a new MachineSchemeValidate instance.
|
|
21
16
|
* @role Constructor
|
|
@@ -33,33 +28,44 @@ export class MachineSchemeValidate {
|
|
|
33
28
|
* @param {any} value The value to validate.
|
|
34
29
|
* @return {{ isValid: boolean; error?: string; }} An object with isValid and optional error.
|
|
35
30
|
*/
|
|
36
|
-
validateField(fieldName, value) {
|
|
31
|
+
async validateField(fieldName, value, formData) {
|
|
37
32
|
try {
|
|
38
|
-
const fieldInfo = this.machineDb
|
|
39
|
-
.collection(this.collection)
|
|
40
|
-
.field(fieldName)
|
|
41
|
-
.parse();
|
|
33
|
+
const fieldInfo = this.machineDb.collection(this.collection).field(fieldName).parse();
|
|
42
34
|
if (!fieldInfo) {
|
|
43
35
|
return {
|
|
44
36
|
isValid: false,
|
|
45
|
-
error: `Field ${String(fieldName)} not found in collection
|
|
37
|
+
error: `Field ${String(fieldName)} not found in collection`
|
|
46
38
|
};
|
|
47
39
|
}
|
|
48
|
-
|
|
40
|
+
// If the value is empty (undefined/null/empty string) and the field is not required, skip further checks.
|
|
41
|
+
const args = (fieldInfo.fieldArgs ?? []);
|
|
42
|
+
const isRequired = args.includes('required');
|
|
43
|
+
if (value === undefined || value === null || value === '') {
|
|
44
|
+
if (isRequired) {
|
|
45
|
+
return this.#returnError(fieldName, 'required');
|
|
46
|
+
}
|
|
47
|
+
return { isValid: true };
|
|
48
|
+
}
|
|
49
|
+
const typeOK = await this.#validateType(value, fieldInfo.fieldType, {
|
|
50
|
+
formData,
|
|
51
|
+
fieldName: String(fieldName)
|
|
52
|
+
});
|
|
53
|
+
if (!typeOK) {
|
|
49
54
|
return this.#returnError(fieldName, fieldInfo.fieldType);
|
|
50
55
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
56
|
+
// Check custom validators for this field
|
|
57
|
+
const customValidators = this.customValidators.get(String(fieldName)) || [];
|
|
58
|
+
for (const validator of customValidators) {
|
|
59
|
+
if (!validator(value)) {
|
|
60
|
+
return { isValid: false, error: `Invalid value for ${String(fieldName)}` };
|
|
57
61
|
}
|
|
58
62
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
// Check async validators for this field
|
|
64
|
+
const asyncValidators = this.asyncValidators.get(String(fieldName)) || [];
|
|
65
|
+
for (const validator of asyncValidators) {
|
|
66
|
+
const isValid = await validator(value);
|
|
67
|
+
if (!isValid) {
|
|
68
|
+
return { isValid: false, error: `Validation failed for ${String(fieldName)}` };
|
|
63
69
|
}
|
|
64
70
|
}
|
|
65
71
|
return { isValid: true };
|
|
@@ -68,6 +74,9 @@ export class MachineSchemeValidate {
|
|
|
68
74
|
if (error instanceof MachineErrorValidation) {
|
|
69
75
|
return { isValid: false, error: error.message };
|
|
70
76
|
}
|
|
77
|
+
else if (error instanceof MachineError) {
|
|
78
|
+
return { isValid: false, error: error.message };
|
|
79
|
+
}
|
|
71
80
|
throw error;
|
|
72
81
|
}
|
|
73
82
|
}
|
|
@@ -77,44 +86,162 @@ export class MachineSchemeValidate {
|
|
|
77
86
|
* @param value The value to validate.
|
|
78
87
|
* @returns True if valid, false otherwise.
|
|
79
88
|
*/
|
|
80
|
-
|
|
81
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Quick validation check for a field value (boolean result).
|
|
91
|
+
* @role Field validation
|
|
92
|
+
* @param {keyof TplFields} fieldName The field name to validate.
|
|
93
|
+
* @param {unknown} value The value to validate.
|
|
94
|
+
* @returns {Promise<boolean>} True if valid, false otherwise.
|
|
95
|
+
*/
|
|
96
|
+
async validateFieldValue(fieldName, value) {
|
|
97
|
+
const result = await this.validateField(fieldName, value);
|
|
82
98
|
return !!result.isValid;
|
|
83
99
|
}
|
|
84
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Register a custom validator function for a specific field.
|
|
102
|
+
* @role Custom validation
|
|
103
|
+
* @param {keyof TplFields} fieldName The field name to validate.
|
|
104
|
+
* @param {(value: unknown) => boolean} validator The validator function (returns true if valid).
|
|
105
|
+
*/
|
|
106
|
+
registerCustom(fieldName, validator) {
|
|
107
|
+
if (!this.customValidators.has(String(fieldName))) {
|
|
108
|
+
this.customValidators.set(String(fieldName), []);
|
|
109
|
+
}
|
|
110
|
+
this.customValidators.get(String(fieldName))?.push(validator);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Register an async validator function for a specific field.
|
|
114
|
+
* @role Async validation
|
|
115
|
+
* @param {keyof TplFields} fieldName The field name to validate.
|
|
116
|
+
* @param {(value: unknown) => Promise<boolean>} validator The async validator function.
|
|
117
|
+
*/
|
|
118
|
+
registerAsync(fieldName, validator) {
|
|
119
|
+
if (!this.asyncValidators.has(String(fieldName))) {
|
|
120
|
+
this.asyncValidators.set(String(fieldName), []);
|
|
121
|
+
}
|
|
122
|
+
this.asyncValidators.get(String(fieldName))?.push(validator);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Register a cross-field validator that validates multiple fields together.
|
|
126
|
+
* @role Cross-field validation
|
|
127
|
+
* @param {Object} rule The cross-field validation rule.
|
|
128
|
+
* @param {string[]} rule.fields The field names involved in the validation.
|
|
129
|
+
* @param {(data: Record<string, unknown>) => boolean | Promise<boolean>} rule.validator The validator function.
|
|
130
|
+
*/
|
|
131
|
+
registerCrossField(rule) {
|
|
132
|
+
this.crossFieldValidators.push(rule);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Validate entire form data against all collection fields.
|
|
136
|
+
* @role Form validation
|
|
137
|
+
* @param {Record<string, unknown>} formData The complete form data to validate.
|
|
138
|
+
* @param {Object} [options] Validation options.
|
|
139
|
+
* @param {string[]} [options.ignoreFields] Fields to skip during validation.
|
|
140
|
+
* @param {Array} [options.crossFieldValidators] Array of cross-field validator functions.
|
|
141
|
+
* @returns {Promise<Object>} Validation result with isValid flag, error messages, and invalid field names.
|
|
142
|
+
*/
|
|
143
|
+
async validateForm(formData, options = {}) {
|
|
85
144
|
const errors = {};
|
|
86
145
|
const invalidFields = [];
|
|
87
146
|
let isValid = true;
|
|
88
|
-
const fields = this.machineDb.collection(this.collection).
|
|
147
|
+
const fields = this.machineDb.collection(this.collection).fields;
|
|
89
148
|
if (!fields) {
|
|
90
149
|
return {
|
|
91
150
|
isValid: false,
|
|
92
|
-
errors: { general:
|
|
93
|
-
invalidFields: [
|
|
151
|
+
errors: { general: 'Collection fields not found' },
|
|
152
|
+
invalidFields: ['general']
|
|
94
153
|
};
|
|
95
154
|
}
|
|
96
|
-
for (const [fieldName
|
|
97
|
-
// Ignorer les champs spécifiés dans options.ignoreFields
|
|
155
|
+
for (const [fieldName] of Object.entries(fields)) {
|
|
98
156
|
if (options.ignoreFields && options.ignoreFields.includes(fieldName)) {
|
|
99
157
|
continue;
|
|
100
158
|
}
|
|
101
|
-
const result = this.validateField(fieldName, formData[fieldName]);
|
|
159
|
+
const result = await this.validateField(fieldName, formData[fieldName], formData);
|
|
102
160
|
if (!result.isValid) {
|
|
103
|
-
errors[fieldName] = result.error ||
|
|
161
|
+
errors[fieldName] = result.error || 'Invalid field';
|
|
104
162
|
invalidFields.push(fieldName);
|
|
105
163
|
isValid = false;
|
|
106
164
|
}
|
|
107
165
|
}
|
|
166
|
+
// FK relations declared `required: true` in the `fks` block — checked
|
|
167
|
+
// separately from `fields` since FK refs aren't scalar form fields.
|
|
168
|
+
const scheme = this.machineDb.collection(this.collection);
|
|
169
|
+
for (const [relationKey, fkDef] of Object.entries(scheme.fks)) {
|
|
170
|
+
if (!fkDef.required)
|
|
171
|
+
continue;
|
|
172
|
+
if (options.ignoreFields && options.ignoreFields.includes(relationKey))
|
|
173
|
+
continue;
|
|
174
|
+
if (!scheme.hasFkValue(formData, relationKey)) {
|
|
175
|
+
errors[relationKey] = 'Ce champ est obligatoire';
|
|
176
|
+
invalidFields.push(relationKey);
|
|
177
|
+
isValid = false;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
// Cross-field validators (from options parameter)
|
|
181
|
+
if (options.crossFieldValidators) {
|
|
182
|
+
for (const vf of options.crossFieldValidators) {
|
|
183
|
+
const out = await vf(formData);
|
|
184
|
+
if (typeof out === 'boolean') {
|
|
185
|
+
if (!out) {
|
|
186
|
+
errors['__form'] = 'Cross-field validation failed';
|
|
187
|
+
invalidFields.push('__form');
|
|
188
|
+
isValid = false;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
else if (typeof out === 'object') {
|
|
192
|
+
if (!out.isValid) {
|
|
193
|
+
if (out.errors) {
|
|
194
|
+
Object.entries(out.errors).forEach(([k, v]) => {
|
|
195
|
+
errors[k] = v;
|
|
196
|
+
invalidFields.push(k);
|
|
197
|
+
isValid = false;
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
errors['__form'] = 'Cross-field validation failed';
|
|
202
|
+
invalidFields.push('__form');
|
|
203
|
+
isValid = false;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// Cross-field validators (registered instance validators)
|
|
210
|
+
for (const rule of this.crossFieldValidators) {
|
|
211
|
+
try {
|
|
212
|
+
const result = await rule.validator(formData);
|
|
213
|
+
if (!result) {
|
|
214
|
+
errors['__form'] = `Cross-field validation failed for fields: ${rule.fields.join(', ')}`;
|
|
215
|
+
invalidFields.push('__form');
|
|
216
|
+
isValid = false;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
errors['__form'] = 'Cross-field validation error';
|
|
221
|
+
invalidFields.push('__form');
|
|
222
|
+
isValid = false;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
108
225
|
return { isValid, errors, invalidFields };
|
|
109
226
|
}
|
|
110
|
-
#validateType(value, type) {
|
|
111
|
-
|
|
227
|
+
async #validateType(value, type, ctx) {
|
|
228
|
+
// First try the shared pure validateRules for standard types
|
|
229
|
+
const pureError = validateFieldPure(value, { type: type ?? 'any' });
|
|
230
|
+
if (pureError !== null) {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
// Then check MachineSchemeFieldType registry for custom types
|
|
234
|
+
const typeDef = MachineSchemeFieldType.getFieldType(type ?? 'any');
|
|
112
235
|
if (typeDef && typeDef.validator) {
|
|
113
|
-
|
|
236
|
+
const res = typeDef.validator(value, ctx);
|
|
237
|
+
if (res && typeof res?.then === 'function') {
|
|
238
|
+
return (await res);
|
|
239
|
+
}
|
|
240
|
+
return Boolean(res);
|
|
114
241
|
}
|
|
115
242
|
return true;
|
|
116
243
|
}
|
|
117
244
|
#returnError(fieldName, enumCode) {
|
|
118
|
-
throw new MachineErrorValidation(String(fieldName), enumCode ??
|
|
245
|
+
throw new MachineErrorValidation(String(fieldName), enumCode ?? 'unknown', `Invalid format for field ${String(fieldName)}. Cause "${enumCode}" `);
|
|
119
246
|
}
|
|
120
247
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TplCollectionName, TplFields } from '
|
|
1
|
+
import type { TplCollectionName, TplFields } from '../../types/index.js';
|
|
2
2
|
import { MachineDb } from '../machineDb.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class MachineSchemeValues
|
|
@@ -8,7 +8,7 @@ import { MachineDb } from '../machineDb.js';
|
|
|
8
8
|
*
|
|
9
9
|
* @template T The type of the data object for the collection.
|
|
10
10
|
*/
|
|
11
|
-
export declare class MachineSchemeValues<T extends Record<string,
|
|
11
|
+
export declare class MachineSchemeValues<T extends Record<string, unknown>> {
|
|
12
12
|
#private;
|
|
13
13
|
/**
|
|
14
14
|
* The IDbBase instance used for schema introspection.
|
|
@@ -28,10 +28,10 @@ export declare class MachineSchemeValues<T extends Record<string, any>> {
|
|
|
28
28
|
/**
|
|
29
29
|
* Get the presentation string for a data object, using the collection's presentation template.
|
|
30
30
|
* @role Presentation logic
|
|
31
|
-
* @param {Record<string,
|
|
31
|
+
* @param {Record<string, unknown>} data The data object.
|
|
32
32
|
* @return {string} The formatted presentation string.
|
|
33
33
|
*/
|
|
34
|
-
presentation(data: Record<string,
|
|
34
|
+
presentation(data: Record<string, unknown>): string;
|
|
35
35
|
/**
|
|
36
36
|
* Get the value of the index field for a data object.
|
|
37
37
|
* @param data The data object.
|
|
@@ -40,10 +40,10 @@ export declare class MachineSchemeValues<T extends Record<string, any>> {
|
|
|
40
40
|
/**
|
|
41
41
|
* Get the value of the index field for a data object.
|
|
42
42
|
* @role Index accessor
|
|
43
|
-
* @param {Record<string,
|
|
44
|
-
* @return {
|
|
43
|
+
* @param {Record<string, unknown>} data The data object.
|
|
44
|
+
* @return {unknown | null} The value of the index field, or null if not found.
|
|
45
45
|
*/
|
|
46
|
-
indexValue(data: Record<string,
|
|
46
|
+
indexValue(data: Record<string, unknown>): unknown | null;
|
|
47
47
|
/**
|
|
48
48
|
* Format a field value for display, using the field type and schema.
|
|
49
49
|
* @param fieldName The field name.
|
|
@@ -71,7 +71,7 @@ export declare class MachineSchemeValues<T extends Record<string, any>> {
|
|
|
71
71
|
* @param {T} data The data object.
|
|
72
72
|
* @return {Record<`data-${'collection' | 'collectionId' | 'fieldName' | 'fieldType' | 'fieldArgs'}`, string>} The data-* attributes for the field.
|
|
73
73
|
*/
|
|
74
|
-
getInputDataSet(fieldName: string, data: T): Record<`data-${'collection' | '
|
|
74
|
+
getInputDataSet(fieldName: string, data: T): Record<`data-${'collection' | 'collection-id' | 'fieldName' | 'fieldType' | 'fieldArgs' | 'inputSize'}`, string>;
|
|
75
75
|
/**
|
|
76
76
|
* Iterate over an array field and return an array of IDbForge objects for each element.
|
|
77
77
|
* @param fieldName The field name.
|
|
@@ -82,28 +82,39 @@ export declare class MachineSchemeValues<T extends Record<string, any>> {
|
|
|
82
82
|
* Iterate over an array field and return an array of IDbForge objects for each element.
|
|
83
83
|
* @role Array field iteration
|
|
84
84
|
* @param {keyof TplFields} fieldName The field name.
|
|
85
|
-
* @param {
|
|
86
|
-
* @return {
|
|
85
|
+
* @param {unknown[]} data The array data.
|
|
86
|
+
* @return {Array<Record<string, unknown>>} An array of IDbForge objects.
|
|
87
87
|
*/
|
|
88
|
-
iterateArrayField(fieldName: keyof TplFields, data:
|
|
88
|
+
iterateArrayField(fieldName: keyof TplFields, data: unknown[]): Array<Record<string, unknown>>;
|
|
89
89
|
/**
|
|
90
|
-
* Iterate over an object field and return
|
|
90
|
+
* Iterate over an object field and return data rows keyed by property name.
|
|
91
91
|
* @param fieldName The field name.
|
|
92
92
|
* @param data The object data.
|
|
93
|
-
* @returns
|
|
93
|
+
* @returns Data rows derived from the object's properties.
|
|
94
94
|
*/
|
|
95
|
+
iterateObjectField(fieldName: keyof TplFields, data: Record<string, unknown>): Array<Record<string, unknown>>;
|
|
95
96
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
* Resolved descriptor for a single field — the machine-native equivalent of the legacy
|
|
98
|
+
* `columnModel[]` entry. Scalar-vs-FK divergence is decided HERE, never in a component.
|
|
99
|
+
*/
|
|
100
|
+
descriptor(fieldName: string): {
|
|
101
|
+
kind: 'scalar' | 'fk';
|
|
102
|
+
fieldName: string;
|
|
103
|
+
fieldType: string;
|
|
104
|
+
title: string;
|
|
105
|
+
fkCollection?: string;
|
|
106
|
+
fkIndexField?: string;
|
|
107
|
+
} | null;
|
|
108
|
+
/**
|
|
109
|
+
* Human-readable display value for a field.
|
|
110
|
+
* Scalar → MachineSchemeFieldType.format(). FK → presentation(targetRecord).
|
|
111
|
+
* `resolveTarget` is injected by the caller (keeps this class pure/testable).
|
|
101
112
|
*/
|
|
102
|
-
|
|
113
|
+
displayValue(fieldName: keyof T, data: T, resolveTarget?: (fkCollection: string, fkIndexField: string, value: unknown) => Record<string, unknown> | undefined): string;
|
|
103
114
|
/**
|
|
104
115
|
* Get default values for the collection, using global and collection-specific factories.
|
|
105
116
|
* @role Default values
|
|
106
|
-
* @returns {Record<string,
|
|
117
|
+
* @returns {Record<string, unknown>} An object with default values for each field in the collection.
|
|
107
118
|
*/
|
|
108
|
-
getDefaults(): Record<string,
|
|
119
|
+
getDefaults(): Record<string, unknown>;
|
|
109
120
|
}
|