@medyll/idae-machine 0.129.0 → 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/README.md +462 -300
- 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/data-ui/field/DataFieldEdit.svelte +103 -0
- package/dist/data-ui/field/DataFieldEdit.svelte.d.ts +14 -0
- 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 +3 -3
- 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 -43
- package/dist/index.js +82 -44
- 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.d.ts +33 -0
- package/dist/main/machine/MachineError.js +49 -0
- package/dist/main/machine/MachineErrorValidation.d.ts +19 -0
- package/dist/main/machine/MachineErrorValidation.js +24 -0
- package/dist/main/machine/MachineFieldType.d.ts +140 -0
- package/dist/main/machine/MachineFieldType.js +341 -0
- 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 +54 -0
- package/dist/main/machine/MachineScheme.js +159 -0
- package/dist/main/machine/MachineSchemeField.js +67 -0
- package/dist/main/machine/MachineSchemeFieldForge.d.ts +84 -0
- package/dist/main/machine/MachineSchemeFieldForge.js +140 -0
- package/dist/main/machine/MachineSchemeFieldValues.d.ts +68 -0
- package/dist/main/machine/MachineSchemeFieldValues.js +97 -0
- package/dist/main/machine/MachineSchemeValidate.d.ts +107 -0
- package/dist/main/machine/MachineSchemeValidate.js +247 -0
- package/dist/main/machine/MachineSchemeValues.d.ts +120 -0
- package/dist/main/machine/MachineSchemeValues.js +306 -0
- package/dist/main/machine/SchemeFieldDefaultValues.d.ts +76 -0
- package/dist/main/machine/SchemeFieldDefaultValues.js +104 -0
- 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 +227 -61
- package/dist/main/machine.js +503 -86
- package/dist/main/machineDb.d.ts +25 -54
- package/dist/main/machineDb.js +40 -94
- 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 +38 -0
- package/dist/main/machineParserForge.js +168 -0
- 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 +70 -31
- package/dist/db/CrudService.d.ts +0 -9
- package/dist/db/CrudService.js +0 -45
- package/dist/db/dbSchema.d.ts +0 -201
- package/dist/db/dbSchema.js +0 -205
- package/dist/db/fieldTypes.d.ts +0 -13
- package/dist/db/fieldTypes.js +0 -67
- package/dist/db/types.d.ts +0 -124
- package/dist/demo/form/CreateUpdate.svelte +0 -198
- package/dist/demo/form/CreateUpdate.svelte.d.ts +0 -29
- package/dist/demo/form/CrudZone.svelte +0 -22
- package/dist/demo/form/CrudZone.svelte.d.ts +0 -29
- package/dist/demo/form/DataProvider.svelte +0 -20
- package/dist/demo/form/DataProvider.svelte.d.ts +0 -9
- package/dist/demo/form/FieldInPlace.svelte +0 -49
- package/dist/demo/form/FieldInPlace.svelte.d.ts +0 -11
- package/dist/demo/form/FieldValue.svelte +0 -212
- package/dist/demo/form/FieldValue.svelte.d.ts +0 -35
- package/dist/demo/form/types.d.ts +0 -17
- package/dist/demo/form/types.js +0 -1
- package/dist/demo/testDbSchema.d.ts +0 -6
- package/dist/demo/testDbSchema.js +0 -58
- package/dist/demo/types.d.ts +0 -140
- package/dist/demo/types.js +0 -1
- package/dist/fragments/Confirm.svelte +0 -58
- package/dist/fragments/Confirm.svelte.d.ts +0 -11
- 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/List.svelte +0 -21
- package/dist/fragments/List.svelte.d.ts +0 -38
- package/dist/fragments/Selector.svelte +0 -26
- package/dist/fragments/Selector.svelte.d.ts +0 -38
- package/dist/main/machine/IDbCollection.d.ts +0 -69
- package/dist/main/machine/IDbCollection.js +0 -98
- package/dist/main/machine/IDbCollectionFieldForge.d.ts +0 -42
- package/dist/main/machine/IDbCollectionFieldForge.js +0 -74
- package/dist/main/machine/IDbCollectionFieldValues.d.ts +0 -46
- package/dist/main/machine/IDbCollectionFieldValues.js +0 -62
- package/dist/main/machine/IDbCollectionValues.d.ts +0 -78
- package/dist/main/machine/IDbCollectionValues.js +0 -203
- package/dist/main/machine/IDbError.d.ts +0 -6
- package/dist/main/machine/IDbError.js +0 -61
- package/dist/main/machine/IDbFormValidate.d.ts +0 -55
- package/dist/main/machine/IDbFormValidate.js +0 -183
- package/dist/main/machine/IDbValidationError.d.ts +0 -19
- package/dist/main/machine/IDbValidationError.js +0 -24
- package/dist/main/machine/types.d.ts +0 -1
- package/dist/main/machine/types.js +0 -1
- package/dist/main/machineForge.d.ts +0 -57
- package/dist/main/machineForge.js +0 -105
- package/dist/types/appschemeTypes.d.ts +0 -71
- package/dist/types/appschemeTypes.js +0 -83
- package/dist/ui/CollectionButton.svelte +0 -26
- package/dist/ui/CollectionButton.svelte.d.ts +0 -29
- package/dist/ui/CollectionFieldGuess.svelte +0 -29
- package/dist/ui/CollectionFieldGuess.svelte.d.ts +0 -11
- package/dist/ui/CollectionFks.svelte +0 -24
- package/dist/ui/CollectionFks.svelte.d.ts +0 -9
- package/dist/ui/CollectionList.svelte +0 -95
- package/dist/ui/CollectionList.svelte.d.ts +0 -37
- package/dist/ui/CollectionListMenu.svelte +0 -47
- package/dist/ui/CollectionListMenu.svelte.d.ts +0 -34
- package/dist/ui/CollectionReverseFks.svelte +0 -56
- package/dist/ui/CollectionReverseFks.svelte.d.ts +0 -18
- /package/dist/{fragments → data-ui/fragments}/Skeleton.svelte.d.ts +0 -0
- /package/dist/{db → main/api}/types.js +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { machine } from '../../main/machine.js';
|
|
2
|
+
import { untrack } from 'svelte';
|
|
3
|
+
/** Canonical prefs scope key for a list — controls must use the same key to sync. */
|
|
4
|
+
export function dataListPrefsScope(collection, prefsScope) {
|
|
5
|
+
return prefsScope ?? `datalist.${collection}`;
|
|
6
|
+
}
|
|
7
|
+
export function dataListPrefsDefaults() {
|
|
8
|
+
return { mode: null, sortBy: [], groupBy: undefined, find: undefined };
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Shared per-scope reactive stores. A DataList and any external control
|
|
12
|
+
* (Sort/Group/Find) bound to the same scope read/write the *same* `$state`
|
|
13
|
+
* object — so toolbars externalised as sibling components stay in sync with
|
|
14
|
+
* the list instead of each holding an isolated copy.
|
|
15
|
+
*/
|
|
16
|
+
const stores = new Map();
|
|
17
|
+
function ensureStore(scopeStr, defaults) {
|
|
18
|
+
const existing = stores.get(scopeStr);
|
|
19
|
+
if (existing)
|
|
20
|
+
return existing;
|
|
21
|
+
const store = $state({ slots: { ...defaults }, hydrated: false, loaded: false });
|
|
22
|
+
stores.set(scopeStr, store);
|
|
23
|
+
return store;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Drop all cached prefs stores. The cache deliberately survives component
|
|
27
|
+
* remounts (so externalised controls share live state); in production a
|
|
28
|
+
* user switch reloads the page. Tests reboot the machine in-process, so they
|
|
29
|
+
* must clear the cache between cases to stay isolated.
|
|
30
|
+
*/
|
|
31
|
+
export function clearMachinePrefsCache() {
|
|
32
|
+
stores.clear();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Svelte 5 rune: hydrate + persist a set of named preference slots
|
|
36
|
+
* from/to appuser_prefs (code = `{userId}:{scope}.{slot}`).
|
|
37
|
+
*
|
|
38
|
+
* Usage:
|
|
39
|
+
* const prefs = useMachinePrefs(() => 'datalist.vehicle', { sortBy: [], groupBy: undefined }, () => true);
|
|
40
|
+
* prefs.get('sortBy') → reactive read
|
|
41
|
+
* prefs.set('sortBy', v) → reactive write + persist
|
|
42
|
+
* prefs.hydrated → true once initial load done
|
|
43
|
+
*/
|
|
44
|
+
export function useMachinePrefs(scope, defaults, enabled) {
|
|
45
|
+
function normalize(value) {
|
|
46
|
+
if (value == null || typeof value !== 'object')
|
|
47
|
+
return value;
|
|
48
|
+
return JSON.parse(JSON.stringify(value));
|
|
49
|
+
}
|
|
50
|
+
function persist(scopeStr, slot, value) {
|
|
51
|
+
if (!enabled())
|
|
52
|
+
return;
|
|
53
|
+
const scopeKey = `${scopeStr}.${slot}`;
|
|
54
|
+
void machine.action('appuser_prefs', { scopeKey, name: scopeKey, value: normalize(value) }, { code: '{userId}:{scopeKey}', upsertOn: ['code'] });
|
|
55
|
+
}
|
|
56
|
+
// Hydrate when scope/enabled changes. Guarded so a scope only fetches from
|
|
57
|
+
// IDB once — later-mounting controls bound to the same scope reuse the
|
|
58
|
+
// already-hydrated shared store instead of re-reading (or worse, resetting
|
|
59
|
+
// a value the user just changed).
|
|
60
|
+
$effect(() => {
|
|
61
|
+
const s = scope();
|
|
62
|
+
const on = enabled();
|
|
63
|
+
const st = ensureStore(s, defaults);
|
|
64
|
+
// usePrefs=false: never read persisted prefs. Don't touch shared slots
|
|
65
|
+
// (a prefs-enabled consumer may own them); just report hydrated.
|
|
66
|
+
if (!on) {
|
|
67
|
+
st.hydrated = true;
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (st.loaded) {
|
|
71
|
+
st.hydrated = true;
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const user = machine.rights.currentUser;
|
|
75
|
+
if (!user) {
|
|
76
|
+
st.hydrated = true;
|
|
77
|
+
return;
|
|
78
|
+
} // retry once a user is set
|
|
79
|
+
st.loaded = true;
|
|
80
|
+
// Reset to defaults before applying persisted values so a stale slot
|
|
81
|
+
// can't survive a (re)hydration.
|
|
82
|
+
Object.assign(st.slots, defaults);
|
|
83
|
+
const prefix = `${String(user.id)}:${s}.`;
|
|
84
|
+
untrack(() => {
|
|
85
|
+
Promise.resolve(machine.collection('appuser_prefs').getAll())
|
|
86
|
+
.then((rows) => {
|
|
87
|
+
for (const r of rows) {
|
|
88
|
+
if (typeof r.code === 'string' && r.code.startsWith(prefix)) {
|
|
89
|
+
const key = r.code.slice(prefix.length);
|
|
90
|
+
if (key in st.slots)
|
|
91
|
+
st.slots[key] = r.value ?? st.slots[key];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
.catch((error) => {
|
|
96
|
+
console.warn('[useMachinePrefs] Failed to hydrate preferences:', error);
|
|
97
|
+
})
|
|
98
|
+
.finally(() => { st.hydrated = true; });
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
get hydrated() { return ensureStore(scope(), defaults).hydrated; },
|
|
103
|
+
get(slot) {
|
|
104
|
+
return ensureStore(scope(), defaults).slots[slot];
|
|
105
|
+
},
|
|
106
|
+
set(slot, value) {
|
|
107
|
+
const st = ensureStore(scope(), defaults);
|
|
108
|
+
st.slots[slot] = value;
|
|
109
|
+
if (enabled() && st.hydrated)
|
|
110
|
+
untrack(() => persist(scope(), slot, value));
|
|
111
|
+
},
|
|
112
|
+
/** Raw reactive state — for binding in templates */
|
|
113
|
+
get slots() {
|
|
114
|
+
return ensureStore(scope(), defaults).slots;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type MenuTree } from '../../idae/menu/IdaeMenuStore.js';
|
|
2
|
+
import { type MenuZone } from './menuPrefs.js';
|
|
3
|
+
/**
|
|
4
|
+
* Svelte 5 rune: reactive list of allowed collection codes for a zone — the access
|
|
5
|
+
* half of {@link useMenuTree} (rights('L') ∩ prefs ∩ baseline ∩ dev), without the
|
|
6
|
+
* appscheme/appscheme_base metadata join or grouping.
|
|
7
|
+
*
|
|
8
|
+
* Use when a consumer renders the metadata itself (e.g. `DataList collection="appscheme"
|
|
9
|
+
* where={{ code: { $in: codes } }}`) — the labels/icons/grouping then come from the
|
|
10
|
+
* appscheme collection instead of being re-derived here. Only subscribes to
|
|
11
|
+
* appuser_prefs, not appscheme/appscheme_base.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useMenuCodes(zone: () => MenuZone): {
|
|
14
|
+
readonly codes: string[];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Svelte 5 rune: reactive menu tree for a zone — rights(L) ∩ prefs ∩ appscheme/type.
|
|
18
|
+
* Re-derives whenever appuser_prefs/appscheme/appscheme_base/current user changes.
|
|
19
|
+
*
|
|
20
|
+
* Usage:
|
|
21
|
+
* const menu = useMenuTree(() => 'side');
|
|
22
|
+
* menu.tree.groups → [{ key, label, items: [{ collection, label, icon, ... }] }]
|
|
23
|
+
*/
|
|
24
|
+
export declare function useMenuTree(zone: () => MenuZone): {
|
|
25
|
+
readonly tree: MenuTree;
|
|
26
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { machine } from '../../main/machine.js';
|
|
2
|
+
import { buildMenuTree } from '../../idae/menu/IdaeMenuStore.js';
|
|
3
|
+
import { filterMenuCollections, readMenuPrefsFromRecords } from './menuPrefs.js';
|
|
4
|
+
/**
|
|
5
|
+
* Svelte 5 rune: reactive list of allowed collection codes for a zone — the access
|
|
6
|
+
* half of {@link useMenuTree} (rights('L') ∩ prefs ∩ baseline ∩ dev), without the
|
|
7
|
+
* appscheme/appscheme_base metadata join or grouping.
|
|
8
|
+
*
|
|
9
|
+
* Use when a consumer renders the metadata itself (e.g. `DataList collection="appscheme"
|
|
10
|
+
* where={{ code: { $in: codes } }}`) — the labels/icons/grouping then come from the
|
|
11
|
+
* appscheme collection instead of being re-derived here. Only subscribes to
|
|
12
|
+
* appuser_prefs, not appscheme/appscheme_base.
|
|
13
|
+
*/
|
|
14
|
+
export function useMenuCodes(zone) {
|
|
15
|
+
const prefsSrc = machine.store('appuser_prefs');
|
|
16
|
+
const codes = $derived.by(() => {
|
|
17
|
+
const userId = machine.rights.currentUser?.id;
|
|
18
|
+
const prefsRecords = prefsSrc.records;
|
|
19
|
+
const prefs = userId != null ? readMenuPrefsFromRecords(prefsRecords, userId) : {};
|
|
20
|
+
return filterMenuCollections(zone(), machine.rights.allowedCollections('L'), {
|
|
21
|
+
prefs,
|
|
22
|
+
baseline: machine.rights.menuBaseline,
|
|
23
|
+
isDev: import.meta.env.DEV
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
get codes() {
|
|
28
|
+
return codes;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Svelte 5 rune: reactive menu tree for a zone — rights(L) ∩ prefs ∩ appscheme/type.
|
|
34
|
+
* Re-derives whenever appuser_prefs/appscheme/appscheme_base/current user changes.
|
|
35
|
+
*
|
|
36
|
+
* Usage:
|
|
37
|
+
* const menu = useMenuTree(() => 'side');
|
|
38
|
+
* menu.tree.groups → [{ key, label, items: [{ collection, label, icon, ... }] }]
|
|
39
|
+
*/
|
|
40
|
+
export function useMenuTree(zone) {
|
|
41
|
+
// machine.store() registers a reactive subscription (Svelte 5 $effect under the
|
|
42
|
+
// hood) — it must be called ONCE per hook instance, at top level, never re-invoked
|
|
43
|
+
// inside $derived.by. Calling it fresh on every recompute (the original S50-01
|
|
44
|
+
// shape) re-registers a brand-new subscription each pass and the tree never
|
|
45
|
+
// converges (always reads the just-reset empty snapshot).
|
|
46
|
+
const prefsSrc = machine.store('appuser_prefs');
|
|
47
|
+
const appschemeSrc = machine.store('appscheme');
|
|
48
|
+
const appschemeBaseSrc = machine.store('appscheme_base');
|
|
49
|
+
const tree = $derived.by(() => {
|
|
50
|
+
const z = zone();
|
|
51
|
+
const userId = machine.rights.currentUser?.id;
|
|
52
|
+
const prefsRecords = prefsSrc.records;
|
|
53
|
+
const prefs = userId != null ? readMenuPrefsFromRecords(prefsRecords, userId) : {};
|
|
54
|
+
return buildMenuTree({
|
|
55
|
+
allowedCollections: machine.rights.allowedCollections('L'),
|
|
56
|
+
prefs,
|
|
57
|
+
baseline: machine.rights.menuBaseline,
|
|
58
|
+
appscheme: appschemeSrc.records,
|
|
59
|
+
appscheme_base: appschemeBaseSrc.records,
|
|
60
|
+
isDev: import.meta.env.DEV
|
|
61
|
+
}, z);
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
get tree() {
|
|
65
|
+
return tree;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive dual-source record resolution — BL-24.
|
|
3
|
+
*
|
|
4
|
+
* A component receives either `(collection, collectionId)` or `(collection, data)`.
|
|
5
|
+
* `data` wins when provided (controlled — e.g. DataList passes a store item); otherwise
|
|
6
|
+
* the record is read reactively via `machine.store` (never `machine.collection` —
|
|
7
|
+
* invariant CLAUDE.md 8) using the scheme's index field (default `id`).
|
|
8
|
+
*
|
|
9
|
+
* Extracted from the inline pattern in DataRecord.svelte (the documented contract,
|
|
10
|
+
* CLAUDE.md §4 "DataRecord data source contract") so other collection+collectionId
|
|
11
|
+
* consumers (ContextMenuContent, DataField, Fiche, ...) share one resolution path
|
|
12
|
+
* instead of re-implementing it divergently (ContextMenuContent.svelte:40 used a loose
|
|
13
|
+
* `== ` match against the raw store, ignoring `scheme.index` and never re-deriving).
|
|
14
|
+
*/
|
|
15
|
+
export declare function useRecordData(collection: () => string | undefined, source: () => {
|
|
16
|
+
collectionId?: string | number;
|
|
17
|
+
data?: Record<string, unknown>;
|
|
18
|
+
}): {
|
|
19
|
+
readonly record: Record<string, unknown> | undefined;
|
|
20
|
+
readonly collectionId: string | number | undefined;
|
|
21
|
+
readonly scheme: import("../../main/machine/MachineScheme.js").MachineScheme | null;
|
|
22
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { machine } from '../../main/machine.js';
|
|
2
|
+
import { MachineRecordIdentity } from '../../main/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Reactive dual-source record resolution — BL-24.
|
|
5
|
+
*
|
|
6
|
+
* A component receives either `(collection, collectionId)` or `(collection, data)`.
|
|
7
|
+
* `data` wins when provided (controlled — e.g. DataList passes a store item); otherwise
|
|
8
|
+
* the record is read reactively via `machine.store` (never `machine.collection` —
|
|
9
|
+
* invariant CLAUDE.md 8) using the scheme's index field (default `id`).
|
|
10
|
+
*
|
|
11
|
+
* Extracted from the inline pattern in DataRecord.svelte (the documented contract,
|
|
12
|
+
* CLAUDE.md §4 "DataRecord data source contract") so other collection+collectionId
|
|
13
|
+
* consumers (ContextMenuContent, DataField, Fiche, ...) share one resolution path
|
|
14
|
+
* instead of re-implementing it divergently (ContextMenuContent.svelte:40 used a loose
|
|
15
|
+
* `== ` match against the raw store, ignoring `scheme.index` and never re-deriving).
|
|
16
|
+
*/
|
|
17
|
+
export function useRecordData(collection, source) {
|
|
18
|
+
const scheme = $derived.by(() => {
|
|
19
|
+
const c = collection();
|
|
20
|
+
return c ? machine.logic.collection(c) : null;
|
|
21
|
+
});
|
|
22
|
+
const queryId = $derived(MachineRecordIdentity.normalizeKey(source().collectionId));
|
|
23
|
+
const recordStore = $derived.by(() => {
|
|
24
|
+
const { data, collectionId } = source();
|
|
25
|
+
const c = collection();
|
|
26
|
+
if (data !== undefined || !c || collectionId === undefined)
|
|
27
|
+
return null;
|
|
28
|
+
return machine.store(c, MachineRecordIdentity.buildWhere(scheme?.index ?? 'id', queryId));
|
|
29
|
+
});
|
|
30
|
+
const fetchedData = $derived(recordStore?.records?.[0]);
|
|
31
|
+
const record = $derived(source().data ?? fetchedData);
|
|
32
|
+
const resolvedCollectionId = $derived.by(() => {
|
|
33
|
+
const { collectionId, data } = source();
|
|
34
|
+
if (collectionId !== undefined)
|
|
35
|
+
return collectionId;
|
|
36
|
+
const idx = scheme?.index ?? 'id';
|
|
37
|
+
return data?.[idx];
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
get record() {
|
|
41
|
+
return record;
|
|
42
|
+
},
|
|
43
|
+
get collectionId() {
|
|
44
|
+
return resolvedCollectionId;
|
|
45
|
+
},
|
|
46
|
+
get scheme() {
|
|
47
|
+
return scheme;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive field-list resolution for a (collection, view) pair.
|
|
3
|
+
*
|
|
4
|
+
* Both structural views (full/flat/fk/focus) and custom named views are resolved
|
|
5
|
+
* through `appscheme_view` — the single source of truth published by publishModel.
|
|
6
|
+
*
|
|
7
|
+
* `view` and `groupFieldBy` are ORTHOGONAL axes:
|
|
8
|
+
* view → WHICH fields (field codes from appscheme_view rows)
|
|
9
|
+
* groupFieldBy → HOW to group them (looked up in appscheme_field, grouped on its FK)
|
|
10
|
+
*/
|
|
11
|
+
export declare function useViewFields(collection: () => string | undefined, view: () => string | undefined, groupFieldBy?: () => string | undefined): {
|
|
12
|
+
readonly fieldNames: unknown[];
|
|
13
|
+
readonly fieldKinds: Record<string, {
|
|
14
|
+
kind: "scalar" | "fk";
|
|
15
|
+
fieldName: string;
|
|
16
|
+
fieldType: string;
|
|
17
|
+
title: string;
|
|
18
|
+
fkCollection?: string;
|
|
19
|
+
fkIndexField?: string;
|
|
20
|
+
} | null>;
|
|
21
|
+
readonly groups: Record<string, any[]> | undefined;
|
|
22
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { machine } from '../../main/machine.js';
|
|
2
|
+
/**
|
|
3
|
+
* Reactive field-list resolution for a (collection, view) pair.
|
|
4
|
+
*
|
|
5
|
+
* Both structural views (full/flat/fk/focus) and custom named views are resolved
|
|
6
|
+
* through `appscheme_view` — the single source of truth published by publishModel.
|
|
7
|
+
*
|
|
8
|
+
* `view` and `groupFieldBy` are ORTHOGONAL axes:
|
|
9
|
+
* view → WHICH fields (field codes from appscheme_view rows)
|
|
10
|
+
* groupFieldBy → HOW to group them (looked up in appscheme_field, grouped on its FK)
|
|
11
|
+
*/
|
|
12
|
+
export function useViewFields(collection, view, groupFieldBy) {
|
|
13
|
+
const viewName = $derived(view() ?? 'full');
|
|
14
|
+
// qoolie's where engine uses BARE operators (eq/in/gte…), NOT Mongo's $-prefixed
|
|
15
|
+
// form. A `$eq` key matches no operator case → the condition is a silent no-op →
|
|
16
|
+
// the store returns every appscheme_view row (all collections, all view types),
|
|
17
|
+
// yielding duplicate field codes (e.g. `id` in full+flat). Use `eq`/`in`.
|
|
18
|
+
const viewRows = $derived(collection()
|
|
19
|
+
? machine.store('appscheme_view', {
|
|
20
|
+
'fks.appscheme.code': { eq: collection() },
|
|
21
|
+
'fks.appscheme_view_type.code': { eq: viewName },
|
|
22
|
+
})
|
|
23
|
+
: null);
|
|
24
|
+
const fieldNames = $derived([
|
|
25
|
+
...new Set((viewRows?.records ?? [])
|
|
26
|
+
.slice()
|
|
27
|
+
.sort((a, b) => (a.order ?? 0) - (b.order ?? 0))
|
|
28
|
+
.map((r) => r?.fks?.appscheme_field?.code)
|
|
29
|
+
.filter((c) => !!c))
|
|
30
|
+
]);
|
|
31
|
+
// kind: scalar|fk per field, projected from the scheme's `fks{}` block onto the
|
|
32
|
+
// view's field list — lets a consumer iterating fieldNames know FK-ness without
|
|
33
|
+
// re-deriving descriptor() itself. Read-only projection; MachineSchemeValues.descriptor()
|
|
34
|
+
// stays the single source of truth.
|
|
35
|
+
const fieldKinds = $derived.by(() => {
|
|
36
|
+
const name = collection();
|
|
37
|
+
const collLogic = name ? machine.logic.collection(name) : null;
|
|
38
|
+
const out = {};
|
|
39
|
+
if (!collLogic)
|
|
40
|
+
return out;
|
|
41
|
+
for (const fieldName of fieldNames) {
|
|
42
|
+
out[fieldName] = collLogic.collectionValues.descriptor(fieldName);
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
});
|
|
46
|
+
// ── groupFieldBy axis → query appscheme_field ONLY when grouping is asked ───
|
|
47
|
+
const groupKey = $derived(groupFieldBy?.());
|
|
48
|
+
const fieldStore = $derived(groupKey && fieldNames.length
|
|
49
|
+
? machine.store('appscheme_field', { code: { in: fieldNames } })
|
|
50
|
+
: null);
|
|
51
|
+
const groups = $derived(groupKey && fieldStore?.records?.length
|
|
52
|
+
? fieldStore.records.groupBy(`fks.${groupKey}.code`, true)
|
|
53
|
+
: undefined);
|
|
54
|
+
return {
|
|
55
|
+
get fieldNames() { return fieldNames; },
|
|
56
|
+
get fieldKinds() { return fieldKinds; },
|
|
57
|
+
get groups() { return groups; },
|
|
58
|
+
};
|
|
59
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { RelationPolicy, MetaModelProvider, UserScopePolicy, RightsPolicy, Capabilities, FrameCatalog } from '../main/ext/interfaces.js';
|
|
2
|
+
import type { MachineModel } from '../types/index.js';
|
|
3
|
+
import { IdaeRelationPolicy } from './relations/RelationPolicy.js';
|
|
4
|
+
import { IdaeUserScopePolicy } from './userscope/UserScopePolicy.js';
|
|
5
|
+
import { IdaeMetaModelProvider } from './meta/MetaModelProvider.js';
|
|
6
|
+
import { IdaeRightsPolicy } from './rights/RightsPolicy.js';
|
|
7
|
+
import { IdaeCapabilities } from './capabilities/Capabilities.js';
|
|
8
|
+
import { IdaeFrameCatalog } from './frames/FrameCatalog.js';
|
|
9
|
+
declare const relationPolicy: IdaeRelationPolicy;
|
|
10
|
+
declare const userScopePolicy: IdaeUserScopePolicy;
|
|
11
|
+
declare const metaModelProvider: IdaeMetaModelProvider;
|
|
12
|
+
declare const rightsPolicy: IdaeRightsPolicy;
|
|
13
|
+
declare const capabilities: IdaeCapabilities;
|
|
14
|
+
declare const frameCatalog: IdaeFrameCatalog;
|
|
15
|
+
export interface PolicyRegistry {
|
|
16
|
+
relation?: RelationPolicy;
|
|
17
|
+
meta?: MetaModelProvider;
|
|
18
|
+
userScope?: UserScopePolicy;
|
|
19
|
+
rights?: RightsPolicy;
|
|
20
|
+
capabilities?: Capabilities;
|
|
21
|
+
frameCatalog?: FrameCatalog;
|
|
22
|
+
}
|
|
23
|
+
export declare function registerPolicy<T extends keyof PolicyRegistry>(policyName: T, implementation: PolicyRegistry[T]): void;
|
|
24
|
+
export declare function getPolicyRegistry(): PolicyRegistry;
|
|
25
|
+
export declare function initializeDomainPoliciesWithMachine(machine: any): void;
|
|
26
|
+
export declare function initializeDomainPoliciesWithModel(model: MachineModel): void;
|
|
27
|
+
export declare function initializeDomainPolicies(): void;
|
|
28
|
+
export { relationPolicy, userScopePolicy, metaModelProvider, rightsPolicy, capabilities, frameCatalog };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// idae/boot.ts — domain policy registration
|
|
2
|
+
// Registers all idae domain implementations with the machine engine.
|
|
3
|
+
import { IdaeRelationPolicy } from './relations/RelationPolicy.js';
|
|
4
|
+
import { IdaeUserScopePolicy } from './userscope/UserScopePolicy.js';
|
|
5
|
+
import { IdaeMetaModelProvider } from './meta/MetaModelProvider.js';
|
|
6
|
+
import { IdaeRightsPolicy } from './rights/RightsPolicy.js';
|
|
7
|
+
import { IdaeCapabilities } from './capabilities/Capabilities.js';
|
|
8
|
+
import { IdaeFrameCatalog } from './frames/FrameCatalog.js';
|
|
9
|
+
import { registerDomainBridges } from './bridge/register.js';
|
|
10
|
+
const relationPolicy = new IdaeRelationPolicy();
|
|
11
|
+
const userScopePolicy = new IdaeUserScopePolicy();
|
|
12
|
+
const metaModelProvider = new IdaeMetaModelProvider();
|
|
13
|
+
const rightsPolicy = new IdaeRightsPolicy();
|
|
14
|
+
const capabilities = new IdaeCapabilities();
|
|
15
|
+
const frameCatalog = new IdaeFrameCatalog();
|
|
16
|
+
let policyRegistry = {};
|
|
17
|
+
export function registerPolicy(policyName, implementation) {
|
|
18
|
+
policyRegistry[policyName] = implementation;
|
|
19
|
+
}
|
|
20
|
+
export function getPolicyRegistry() {
|
|
21
|
+
return policyRegistry;
|
|
22
|
+
}
|
|
23
|
+
export function initializeDomainPoliciesWithMachine(machine) {
|
|
24
|
+
relationPolicy.initialize(machine);
|
|
25
|
+
userScopePolicy.initialize(machine);
|
|
26
|
+
registerPolicy('relation', relationPolicy);
|
|
27
|
+
registerPolicy('userScope', userScopePolicy);
|
|
28
|
+
registerDomainBridges(relationPolicy, metaModelProvider, rightsPolicy);
|
|
29
|
+
}
|
|
30
|
+
export function initializeDomainPoliciesWithModel(model) {
|
|
31
|
+
metaModelProvider.initialize(model);
|
|
32
|
+
rightsPolicy.initialize(model);
|
|
33
|
+
capabilities.initialize(model);
|
|
34
|
+
registerPolicy('meta', metaModelProvider);
|
|
35
|
+
registerPolicy('rights', rightsPolicy);
|
|
36
|
+
registerPolicy('capabilities', capabilities);
|
|
37
|
+
registerPolicy('frameCatalog', frameCatalog);
|
|
38
|
+
registerDomainBridges(relationPolicy, metaModelProvider, rightsPolicy);
|
|
39
|
+
}
|
|
40
|
+
export function initializeDomainPolicies() {
|
|
41
|
+
// stub — call initializeDomainPoliciesWithMachine + initializeDomainPoliciesWithModel for full init
|
|
42
|
+
}
|
|
43
|
+
export { relationPolicy, userScopePolicy, metaModelProvider, rightsPolicy, capabilities, frameCatalog };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IdaeRelationPolicy } from '../relations/RelationPolicy.js';
|
|
2
|
+
import type { IdaeMetaModelProvider } from '../meta/MetaModelProvider.js';
|
|
3
|
+
import type { IdaeRightsPolicy } from '../rights/RightsPolicy.js';
|
|
4
|
+
export declare function registerDomainBridges(relationPolicy: IdaeRelationPolicy, metaModelProvider: IdaeMetaModelProvider, rightsPolicy: IdaeRightsPolicy): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// idae/bridge/register.ts
|
|
2
|
+
// Registers all domain implementations with the engine bridge hooks.
|
|
3
|
+
// Called once during boot — after this, engine files can delegate to domain
|
|
4
|
+
// via the abstract hooks without importing from idae/.
|
|
5
|
+
import { registerRelationResolver, registerMetaCollectionResolver, registerCodeFieldConvention, registerGrantDecoder } from '../../main/ext/hooks.js';
|
|
6
|
+
import { ensureCodeField, CODE_FIELD_NAME } from '../codefield/CodeFieldConvention.js';
|
|
7
|
+
export function registerDomainBridges(relationPolicy, metaModelProvider, rightsPolicy) {
|
|
8
|
+
registerRelationResolver(relationPolicy);
|
|
9
|
+
registerMetaCollectionResolver(metaModelProvider);
|
|
10
|
+
registerCodeFieldConvention({
|
|
11
|
+
codeFieldName: CODE_FIELD_NAME,
|
|
12
|
+
ensureCodeField
|
|
13
|
+
});
|
|
14
|
+
registerGrantDecoder(rightsPolicy);
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Capabilities as CapabilitiesInterface } from '../../main/ext/interfaces.js';
|
|
2
|
+
import type { MachineModel } from '../../types/index.js';
|
|
3
|
+
export declare class IdaeCapabilities implements CapabilitiesInterface {
|
|
4
|
+
private model;
|
|
5
|
+
initialize(model: MachineModel): void;
|
|
6
|
+
statusField(collection: string): string | null;
|
|
7
|
+
typeField(collection: string): string | null;
|
|
8
|
+
groupField(collection: string): string | null;
|
|
9
|
+
workflowOrder(_collection: string): string[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// idae/capabilities/Capabilities.ts
|
|
2
|
+
// Domain implementation of Capabilities — workflow semantics.
|
|
3
|
+
// Knows about status/type/group field conventions and workflow ordering.
|
|
4
|
+
const STATUS_FIELD_CANDIDATES = ['status', 'state', 'etat', 'statut'];
|
|
5
|
+
const TYPE_FIELD_CANDIDATES = ['type', 'kind', 'category', 'genre'];
|
|
6
|
+
const GROUP_FIELD_CANDIDATES = ['group', 'groupCode', 'groupe'];
|
|
7
|
+
const DEFAULT_WORKFLOW_ORDER = ['START', 'PENDING', 'RUN', 'ACTIVE', 'END', 'DONE', 'CLOSED', 'CANCELLED'];
|
|
8
|
+
export class IdaeCapabilities {
|
|
9
|
+
model = null;
|
|
10
|
+
initialize(model) {
|
|
11
|
+
this.model = model;
|
|
12
|
+
}
|
|
13
|
+
statusField(collection) {
|
|
14
|
+
const fields = this.model?.[collection]?.fields;
|
|
15
|
+
if (!fields)
|
|
16
|
+
return null;
|
|
17
|
+
return STATUS_FIELD_CANDIDATES.find(f => f in fields) ?? null;
|
|
18
|
+
}
|
|
19
|
+
typeField(collection) {
|
|
20
|
+
const fields = this.model?.[collection]?.fields;
|
|
21
|
+
if (!fields)
|
|
22
|
+
return null;
|
|
23
|
+
return TYPE_FIELD_CANDIDATES.find(f => f in fields) ?? null;
|
|
24
|
+
}
|
|
25
|
+
groupField(collection) {
|
|
26
|
+
const fields = this.model?.[collection]?.fields;
|
|
27
|
+
if (!fields)
|
|
28
|
+
return null;
|
|
29
|
+
return GROUP_FIELD_CANDIDATES.find(f => f in fields) ?? null;
|
|
30
|
+
}
|
|
31
|
+
workflowOrder(_collection) {
|
|
32
|
+
return DEFAULT_WORKFLOW_ORDER;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// idae/codefield/CodeFieldConvention.ts
|
|
2
|
+
// Domain convention: every collection must have a `code` field (semantic key).
|
|
3
|
+
// Implements the CodeFieldConvention hook registered in the engine bridge.
|
|
4
|
+
import { field } from '../../main/machine/fieldBuilder.js';
|
|
5
|
+
export const CODE_FIELD_NAME = 'code';
|
|
6
|
+
export function ensureCodeField(model) {
|
|
7
|
+
const out = {};
|
|
8
|
+
for (const [name, col] of Object.entries(model)) {
|
|
9
|
+
const fields = col.fields ?? {};
|
|
10
|
+
if ('code' in fields) {
|
|
11
|
+
out[name] = col;
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
const rebuilt = {};
|
|
15
|
+
for (const [fn, fd] of Object.entries(fields)) {
|
|
16
|
+
rebuilt[fn] = fd;
|
|
17
|
+
if (fn === 'id')
|
|
18
|
+
rebuilt.code = field('text');
|
|
19
|
+
}
|
|
20
|
+
if (!('code' in rebuilt))
|
|
21
|
+
rebuilt.code = field('text');
|
|
22
|
+
out[name] = { ...col, fields: rebuilt };
|
|
23
|
+
}
|
|
24
|
+
return out;
|
|
25
|
+
}
|