@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.
Files changed (375) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +555 -360
  3. package/cli.cjs +22 -0
  4. package/dist/__fixtures__/demoModel.d.ts +79 -0
  5. package/dist/__fixtures__/demoModel.js +146 -0
  6. package/dist/ai/frame/AiChatSession.svelte +152 -0
  7. package/dist/ai/frame/AiChatSession.svelte.d.ts +7 -0
  8. package/dist/ai/frame/index.d.ts +1 -0
  9. package/dist/ai/frame/index.js +2 -0
  10. package/dist/ai/index.d.ts +9 -0
  11. package/dist/ai/index.js +12 -0
  12. package/dist/ai/schema/ai-catalogs.d.ts +2 -0
  13. package/dist/ai/schema/ai-catalogs.js +86 -0
  14. package/dist/ai/schema/ai-chat-session.d.ts +2 -0
  15. package/dist/ai/schema/ai-chat-session.js +35 -0
  16. package/dist/ai/schema/ai-companion.d.ts +2 -0
  17. package/dist/ai/schema/ai-companion.js +25 -0
  18. package/dist/ai/schema/ai-message.d.ts +2 -0
  19. package/dist/ai/schema/ai-message.js +20 -0
  20. package/dist/ai/schema/ai-tool-call.d.ts +2 -0
  21. package/dist/ai/schema/ai-tool-call.js +18 -0
  22. package/dist/ai/schema/ai-user-prompt.d.ts +2 -0
  23. package/dist/ai/schema/ai-user-prompt.js +17 -0
  24. package/dist/ai/schema/tag.d.ts +2 -0
  25. package/dist/ai/schema/tag.js +14 -0
  26. package/dist/ai/streamIntoRecord.d.ts +31 -0
  27. package/dist/ai/streamIntoRecord.js +79 -0
  28. package/dist/config.d.ts +17 -0
  29. package/dist/config.js +19 -0
  30. package/dist/data-ui/controls/AlphabetFilter.svelte +114 -0
  31. package/dist/data-ui/controls/AlphabetFilter.svelte.d.ts +10 -0
  32. package/dist/data-ui/controls/ButtonAction.svelte +151 -0
  33. package/dist/data-ui/controls/ButtonAction.svelte.d.ts +18 -0
  34. package/dist/data-ui/controls/DataFind.svelte +174 -0
  35. package/dist/data-ui/controls/DataFind.svelte.d.ts +10 -0
  36. package/dist/data-ui/controls/DataGroup.svelte +150 -0
  37. package/dist/data-ui/controls/DataGroup.svelte.d.ts +7 -0
  38. package/dist/data-ui/controls/DataSort.svelte +78 -0
  39. package/dist/data-ui/controls/DataSort.svelte.d.ts +9 -0
  40. package/dist/data-ui/controls/DataToolbar.svelte +67 -0
  41. package/dist/data-ui/controls/DataToolbar.svelte.d.ts +11 -0
  42. package/dist/data-ui/controls/Find.svelte +38 -0
  43. package/dist/data-ui/controls/Find.svelte.d.ts +9 -0
  44. package/dist/data-ui/controls/FkFilter.svelte +94 -0
  45. package/dist/data-ui/controls/FkFilter.svelte.d.ts +11 -0
  46. package/dist/data-ui/controls/Group.svelte +36 -0
  47. package/dist/data-ui/controls/Group.svelte.d.ts +8 -0
  48. package/dist/data-ui/controls/ListMode.svelte +79 -0
  49. package/dist/data-ui/controls/ListMode.svelte.d.ts +10 -0
  50. package/dist/data-ui/controls/Sort.svelte +100 -0
  51. package/dist/data-ui/controls/Sort.svelte.d.ts +8 -0
  52. package/dist/data-ui/data/DataCount.svelte +67 -0
  53. package/dist/data-ui/data/DataCount.svelte.d.ts +36 -0
  54. package/dist/data-ui/data/DataFk.svelte +54 -0
  55. package/dist/data-ui/data/DataFk.svelte.d.ts +11 -0
  56. package/dist/data-ui/data/DataForm.svelte +191 -0
  57. package/dist/data-ui/data/DataForm.svelte.d.ts +15 -0
  58. package/dist/data-ui/data/DataList.svelte +645 -0
  59. package/dist/data-ui/data/DataList.svelte.d.ts +75 -0
  60. package/dist/data-ui/data/DataListFk.svelte +111 -0
  61. package/dist/data-ui/data/DataListFk.svelte.d.ts +13 -0
  62. package/dist/data-ui/data/DataListRfk.svelte +111 -0
  63. package/dist/data-ui/data/DataListRfk.svelte.d.ts +13 -0
  64. package/dist/data-ui/data/DataRecord.svelte +167 -0
  65. package/dist/data-ui/data/DataRecord.svelte.d.ts +22 -0
  66. package/dist/data-ui/data/DataRfk.svelte +73 -0
  67. package/dist/data-ui/data/DataRfk.svelte.d.ts +15 -0
  68. package/dist/data-ui/data/index.d.ts +7 -0
  69. package/dist/data-ui/data/index.js +8 -0
  70. package/dist/data-ui/field/DataField.svelte +343 -0
  71. package/dist/data-ui/field/DataField.svelte.d.ts +33 -0
  72. package/dist/{form/FieldInPlace.svelte → data-ui/field/DataFieldEdit.svelte} +103 -98
  73. package/dist/{form/FieldInPlace.svelte.d.ts → data-ui/field/DataFieldEdit.svelte.d.ts} +5 -5
  74. package/dist/data-ui/field/index.d.ts +2 -0
  75. package/dist/data-ui/field/index.js +3 -0
  76. package/dist/data-ui/field/snippets/FieldAiPrompt.svelte +145 -0
  77. package/dist/data-ui/field/snippets/FieldAiPrompt.svelte.d.ts +14 -0
  78. package/dist/data-ui/field/snippets/FieldBoolean.svelte +43 -0
  79. package/dist/data-ui/field/snippets/FieldBoolean.svelte.d.ts +12 -0
  80. package/dist/data-ui/field/snippets/FieldColor.svelte +48 -0
  81. package/dist/data-ui/field/snippets/FieldColor.svelte.d.ts +10 -0
  82. package/dist/data-ui/field/snippets/FieldCurrency.svelte +105 -0
  83. package/dist/data-ui/field/snippets/FieldCurrency.svelte.d.ts +15 -0
  84. package/dist/data-ui/field/snippets/FieldEmail.svelte +77 -0
  85. package/dist/data-ui/field/snippets/FieldEmail.svelte.d.ts +14 -0
  86. package/dist/data-ui/field/snippets/FieldIcon.svelte +73 -0
  87. package/dist/data-ui/field/snippets/FieldIcon.svelte.d.ts +11 -0
  88. package/dist/data-ui/field/snippets/FieldSelect.svelte +71 -0
  89. package/dist/data-ui/field/snippets/FieldSelect.svelte.d.ts +15 -0
  90. package/dist/data-ui/field/snippets/FieldText.svelte +52 -0
  91. package/dist/data-ui/field/snippets/FieldText.svelte.d.ts +13 -0
  92. package/dist/data-ui/field/snippets/FieldTextarea.svelte +50 -0
  93. package/dist/data-ui/field/snippets/FieldTextarea.svelte.d.ts +13 -0
  94. package/dist/data-ui/field/snippets/index.d.ts +9 -0
  95. package/dist/data-ui/field/snippets/index.js +10 -0
  96. package/dist/data-ui/fragments/ContextMenu.svelte +109 -0
  97. package/dist/data-ui/fragments/ContextMenu.svelte.d.ts +4 -0
  98. package/dist/data-ui/fragments/ContextMenuContent.svelte +275 -0
  99. package/dist/data-ui/fragments/ContextMenuContent.svelte.d.ts +8 -0
  100. package/dist/data-ui/fragments/Frame.svelte +43 -0
  101. package/dist/data-ui/fragments/Frame.svelte.d.ts +10 -0
  102. package/dist/data-ui/fragments/InfoLine.svelte +123 -0
  103. package/dist/data-ui/fragments/InfoLine.svelte.d.ts +12 -0
  104. package/dist/data-ui/fragments/Selector.svelte +56 -0
  105. package/dist/data-ui/fragments/Selector.svelte.d.ts +10 -0
  106. package/dist/{fragments → data-ui/fragments}/Skeleton.svelte +21 -21
  107. package/dist/data-ui/fragments/Tile.svelte +126 -0
  108. package/dist/data-ui/fragments/Tile.svelte.d.ts +14 -0
  109. package/dist/data-ui/fragments/contextMenu.svelte.d.ts +22 -0
  110. package/dist/data-ui/fragments/contextMenu.svelte.js +31 -0
  111. package/dist/data-ui/fragments/dialog/Dialog.svelte +185 -0
  112. package/dist/data-ui/fragments/dialog/Dialog.svelte.d.ts +29 -0
  113. package/dist/data-ui/fragments/dialog/dialog.svelte.d.ts +27 -0
  114. package/dist/data-ui/fragments/dialog/dialog.svelte.js +41 -0
  115. package/dist/data-ui/fragments/index.d.ts +11 -0
  116. package/dist/data-ui/fragments/index.js +11 -0
  117. package/dist/data-ui/utils/__tests__/HostProbe.svelte +18 -0
  118. package/dist/data-ui/utils/__tests__/HostProbe.svelte.d.ts +8 -0
  119. package/dist/data-ui/utils/data-utils.d.ts +29 -0
  120. package/dist/data-ui/utils/data-utils.js +83 -0
  121. package/dist/data-ui/utils/dataRelationUtils.d.ts +37 -0
  122. package/dist/data-ui/utils/dataRelationUtils.js +125 -0
  123. package/dist/data-ui/utils/diagramUtils.d.ts +6 -0
  124. package/dist/data-ui/utils/diagramUtils.js +131 -0
  125. package/dist/data-ui/utils/draggable.d.ts +15 -0
  126. package/dist/data-ui/utils/draggable.js +61 -0
  127. package/dist/data-ui/utils/menuPrefs.d.ts +80 -0
  128. package/dist/data-ui/utils/menuPrefs.js +119 -0
  129. package/dist/data-ui/utils/useMachinePrefs.svelte.d.ts +38 -0
  130. package/dist/data-ui/utils/useMachinePrefs.svelte.js +117 -0
  131. package/dist/data-ui/utils/useMenuTree.svelte.d.ts +26 -0
  132. package/dist/data-ui/utils/useMenuTree.svelte.js +68 -0
  133. package/dist/data-ui/utils/useRecordData.svelte.d.ts +22 -0
  134. package/dist/data-ui/utils/useRecordData.svelte.js +50 -0
  135. package/dist/data-ui/utils/useViewFields.svelte.d.ts +22 -0
  136. package/dist/data-ui/utils/useViewFields.svelte.js +59 -0
  137. package/dist/demo/.gitkeep +0 -0
  138. package/dist/demo/demo-status.json +9 -0
  139. package/dist/idae/boot.d.ts +28 -0
  140. package/dist/idae/boot.js +43 -0
  141. package/dist/idae/bridge/register.d.ts +4 -0
  142. package/dist/idae/bridge/register.js +15 -0
  143. package/dist/idae/capabilities/Capabilities.d.ts +10 -0
  144. package/dist/idae/capabilities/Capabilities.js +34 -0
  145. package/dist/idae/codefield/CodeFieldConvention.d.ts +3 -0
  146. package/dist/idae/codefield/CodeFieldConvention.js +25 -0
  147. package/dist/idae/fieldcatalog/defaultFieldTypesDef.d.ts +2 -0
  148. package/dist/idae/fieldcatalog/defaultFieldTypesDef.js +104 -0
  149. package/dist/idae/frames/FrameCatalog.d.ts +31 -0
  150. package/dist/idae/frames/FrameCatalog.js +31 -0
  151. package/dist/idae/index.d.ts +14 -0
  152. package/dist/idae/index.js +13 -0
  153. package/dist/idae/menu/IdaeMenuManager.d.ts +79 -0
  154. package/dist/idae/menu/IdaeMenuManager.js +108 -0
  155. package/dist/idae/menu/IdaeMenuStore.d.ts +77 -0
  156. package/dist/idae/menu/IdaeMenuStore.js +68 -0
  157. package/dist/idae/menu/menuSnapshot.d.ts +30 -0
  158. package/dist/idae/menu/menuSnapshot.js +30 -0
  159. package/dist/idae/meta/MetaModelProvider.d.ts +11 -0
  160. package/dist/idae/meta/MetaModelProvider.js +43 -0
  161. package/dist/idae/relations/RelationPolicy.d.ts +19 -0
  162. package/dist/idae/relations/RelationPolicy.js +125 -0
  163. package/dist/idae/rights/RightsPolicy.d.ts +16 -0
  164. package/dist/idae/rights/RightsPolicy.js +80 -0
  165. package/dist/idae/userscope/UserScopePolicy.d.ts +9 -0
  166. package/dist/idae/userscope/UserScopePolicy.js +42 -0
  167. package/dist/idae/userscope/navTracking.d.ts +11 -0
  168. package/dist/idae/userscope/navTracking.js +15 -0
  169. package/dist/index.d.ts +68 -35
  170. package/dist/index.js +82 -36
  171. package/dist/main/__tests__/_relationTestUtils.d.ts +12 -0
  172. package/dist/main/__tests__/_relationTestUtils.js +53 -0
  173. package/dist/main/__tests__/helpers/mockCollection.d.ts +21 -0
  174. package/dist/main/__tests__/helpers/mockCollection.js +27 -0
  175. package/dist/main/api/types.d.ts +29 -0
  176. package/dist/main/ext/hooks.d.ts +32 -0
  177. package/dist/main/ext/hooks.js +31 -0
  178. package/dist/main/ext/interfaces.d.ts +69 -0
  179. package/dist/main/ext/interfaces.js +3 -0
  180. package/dist/main/ext/registry.d.ts +29 -0
  181. package/dist/main/ext/registry.js +30 -0
  182. package/dist/main/frame/MachineFrameManager.d.ts +187 -0
  183. package/dist/main/frame/MachineFrameManager.js +403 -0
  184. package/dist/main/frame/contextMenuSetup.d.ts +9 -0
  185. package/dist/main/frame/contextMenuSetup.js +42 -0
  186. package/dist/main/frame/frameUrl.d.ts +1 -0
  187. package/dist/main/frame/frameUrl.js +8 -0
  188. package/dist/main/frame/frameUtils.d.ts +16 -0
  189. package/dist/main/frame/frameUtils.js +26 -0
  190. package/dist/main/frame/linkParser.d.ts +9 -0
  191. package/dist/main/frame/linkParser.js +15 -0
  192. package/dist/main/index.d.ts +15 -0
  193. package/dist/main/index.js +19 -0
  194. package/dist/main/machine/MachineAction.d.ts +62 -0
  195. package/dist/main/machine/MachineAction.js +96 -0
  196. package/dist/main/machine/MachineError.js +2 -2
  197. package/dist/main/machine/MachineFieldType.d.ts +25 -6
  198. package/dist/main/machine/MachineFieldType.js +118 -27
  199. package/dist/main/machine/MachineFkFold.d.ts +34 -0
  200. package/dist/main/machine/MachineFkFold.js +57 -0
  201. package/dist/main/machine/MachineRecordIdentity.d.ts +26 -0
  202. package/dist/main/machine/MachineRecordIdentity.js +44 -0
  203. package/dist/main/machine/MachineRights.d.ts +50 -0
  204. package/dist/main/machine/MachineRights.js +133 -0
  205. package/dist/main/machine/MachineRouter.d.ts +56 -0
  206. package/dist/main/machine/MachineRouter.js +250 -0
  207. package/dist/main/machine/MachineScheme.d.ts +40 -70
  208. package/dist/main/machine/MachineScheme.js +107 -94
  209. package/dist/main/machine/MachineSchemeField.js +32 -16
  210. package/dist/main/machine/MachineSchemeFieldForge.d.ts +11 -11
  211. package/dist/main/machine/MachineSchemeFieldForge.js +33 -21
  212. package/dist/main/machine/MachineSchemeFieldValues.d.ts +8 -9
  213. package/dist/main/machine/MachineSchemeFieldValues.js +12 -9
  214. package/dist/main/machine/MachineSchemeValidate.d.ts +69 -13
  215. package/dist/main/machine/MachineSchemeValidate.js +173 -46
  216. package/dist/main/machine/MachineSchemeValues.d.ts +32 -21
  217. package/dist/main/machine/MachineSchemeValues.js +132 -104
  218. package/dist/main/machine/SchemeFieldDefaultValues.d.ts +4 -2
  219. package/dist/main/machine/SchemeFieldDefaultValues.js +8 -2
  220. package/dist/main/machine/authState.svelte.d.ts +11 -0
  221. package/dist/main/machine/authState.svelte.js +17 -0
  222. package/dist/main/machine/fieldBuilder.d.ts +23 -0
  223. package/dist/main/machine/fieldBuilder.d.ts.map +1 -0
  224. package/dist/main/machine/fieldBuilder.js +10 -0
  225. package/dist/main/machine/fieldBuilder.js.map +1 -0
  226. package/dist/main/machine/machineLabel.d.ts +11 -0
  227. package/dist/main/machine/machineLabel.js +23 -0
  228. package/dist/main/machine/validateRules.d.ts +38 -0
  229. package/dist/main/machine/validateRules.js +109 -0
  230. package/dist/main/machine.d.ts +207 -68
  231. package/dist/main/machine.js +482 -96
  232. package/dist/main/machineDb.d.ts +21 -8
  233. package/dist/main/machineDb.js +33 -4
  234. package/dist/main/machineIdbAdapter.d.ts +83 -0
  235. package/dist/main/machineIdbAdapter.js +347 -0
  236. package/dist/main/machineModelBuilder.d.ts +31 -0
  237. package/dist/main/machineModelBuilder.js +58 -0
  238. package/dist/main/machineParserForge.d.ts +9 -18
  239. package/dist/main/machineParserForge.js +92 -35
  240. package/dist/main/machineSchemaCache.d.ts +8 -0
  241. package/dist/main/machineSchemaCache.js +58 -0
  242. package/dist/main/machineSchemaDoctor.d.ts +17 -0
  243. package/dist/main/machineSchemaDoctor.js +73 -0
  244. package/dist/main/machineSchemaLoader.d.ts +18 -0
  245. package/dist/main/machineSchemaLoader.js +43 -0
  246. package/dist/main/machineSeed.d.ts +21 -0
  247. package/dist/main/machineSeed.js +44 -0
  248. package/dist/main/router/componentRegistry.d.ts +35 -0
  249. package/dist/main/router/componentRegistry.js +35 -0
  250. package/dist/main/router/urlParser.d.ts +17 -0
  251. package/dist/main/router/urlParser.js +41 -0
  252. package/dist/main/warmupUtils.d.ts +40 -0
  253. package/dist/main/warmupUtils.js +73 -0
  254. package/dist/mcp/MachineMcpClient.d.ts +43 -0
  255. package/dist/mcp/MachineMcpClient.js +175 -0
  256. package/dist/shell/Frame.svelte +67 -0
  257. package/dist/shell/Frame.svelte.d.ts +11 -0
  258. package/dist/shell/auth/Login.svelte +244 -0
  259. package/dist/shell/auth/Login.svelte.d.ts +3 -0
  260. package/dist/shell/frame/dashboard/Dashboard.svelte +0 -0
  261. package/dist/shell/frame/dashboard/Dashboard.svelte.d.ts +26 -0
  262. package/dist/shell/frame/diagram/Diagram.svelte +244 -0
  263. package/dist/shell/frame/diagram/Diagram.svelte.d.ts +9 -0
  264. package/dist/shell/frame/explorer/Explorer.svelte +86 -0
  265. package/dist/shell/frame/explorer/Explorer.svelte.d.ts +29 -0
  266. package/dist/shell/frame/explorer/ExplorerContent.svelte +126 -0
  267. package/dist/shell/frame/explorer/ExplorerContent.svelte.d.ts +32 -0
  268. package/dist/shell/frame/index.d.ts +8 -0
  269. package/dist/shell/frame/index.js +9 -0
  270. package/dist/shell/frame/main-menu-content/MainMenuContent.svelte +100 -0
  271. package/dist/shell/frame/main-menu-content/MainMenuContent.svelte.d.ts +6 -0
  272. package/dist/shell/frame/planning/Planning.svelte +426 -0
  273. package/dist/shell/frame/planning/Planning.svelte.d.ts +12 -0
  274. package/dist/shell/frame/rbac/RbacMatrix.svelte +197 -0
  275. package/dist/shell/frame/rbac/RbacMatrix.svelte.d.ts +7 -0
  276. package/dist/shell/frame/space/Space.svelte +554 -0
  277. package/dist/shell/frame/space/Space.svelte.d.ts +8 -0
  278. package/dist/shell/frame/synthesis/Synthesis.svelte +383 -0
  279. package/dist/shell/frame/synthesis/Synthesis.svelte.d.ts +8 -0
  280. package/dist/shell/frame/today/Today.svelte +174 -0
  281. package/dist/shell/frame/today/Today.svelte.d.ts +3 -0
  282. package/dist/shell/layout/App.svelte +30 -0
  283. package/dist/shell/layout/App.svelte.d.ts +3 -0
  284. package/dist/shell/layout/Breadcrumb.svelte +67 -0
  285. package/dist/shell/layout/Breadcrumb.svelte.d.ts +12 -0
  286. package/dist/shell/layout/Columner.svelte +214 -0
  287. package/dist/shell/layout/Columner.svelte.d.ts +16 -0
  288. package/dist/shell/layout/DevResetPanel.svelte +194 -0
  289. package/dist/shell/layout/DevResetPanel.svelte.d.ts +7 -0
  290. package/dist/shell/layout/Fiche.svelte +111 -0
  291. package/dist/shell/layout/Fiche.svelte.d.ts +7 -0
  292. package/dist/shell/layout/FicheUpdate.svelte +53 -0
  293. package/dist/shell/layout/FicheUpdate.svelte.d.ts +7 -0
  294. package/dist/shell/layout/MainMenu.svelte +256 -0
  295. package/dist/shell/layout/MainMenu.svelte.d.ts +6 -0
  296. package/dist/shell/layout/MenuSettings.svelte +182 -0
  297. package/dist/shell/layout/MenuSettings.svelte.d.ts +6 -0
  298. package/dist/shell/layout/RecordTimeline.svelte +199 -0
  299. package/dist/shell/layout/RecordTimeline.svelte.d.ts +8 -0
  300. package/dist/shell/layout/RecordToolbar.svelte +39 -0
  301. package/dist/shell/layout/RecordToolbar.svelte.d.ts +7 -0
  302. package/dist/shell/layout/TaskBar.svelte +118 -0
  303. package/dist/shell/layout/TaskBar.svelte.d.ts +7 -0
  304. package/dist/shell/layout/TemplateShell.svelte +48 -0
  305. package/dist/shell/layout/TemplateShell.svelte.d.ts +15 -0
  306. package/dist/shell/layout/ThemeToggle.svelte +46 -0
  307. package/dist/shell/layout/ThemeToggle.svelte.d.ts +3 -0
  308. package/dist/shell/layout/index.d.ts +8 -0
  309. package/dist/shell/layout/index.js +9 -0
  310. package/dist/storage/ApiStorageAdapter.d.ts +41 -0
  311. package/dist/storage/ApiStorageAdapter.js +111 -0
  312. package/dist/storage/IdbStorageAdapter.d.ts +31 -0
  313. package/dist/storage/IdbStorageAdapter.js +72 -0
  314. package/dist/storage/MemoryStorageAdapter.d.ts +33 -0
  315. package/dist/storage/MemoryStorageAdapter.js +132 -0
  316. package/dist/storage/README.md +222 -0
  317. package/dist/storage/StorageAdapter.d.ts +75 -0
  318. package/dist/storage/StorageAdapter.js +7 -0
  319. package/dist/storage/demo/storage-demo.d.ts +22 -0
  320. package/dist/storage/demo/storage-demo.js +107 -0
  321. package/dist/storage/index.d.ts +9 -0
  322. package/dist/storage/index.js +9 -0
  323. package/dist/types/entity-types.d.ts +444 -0
  324. package/dist/types/entity-types.js +16 -0
  325. package/dist/types/index.d.ts +7 -0
  326. package/dist/types/index.js +6 -0
  327. package/dist/types/machine-model.d.ts +198 -0
  328. package/dist/types/machine-model.js +5 -0
  329. package/dist/types/qoolie-svelte.d.ts +11 -0
  330. package/dist/types/schema-utils.d.ts +32 -0
  331. package/dist/types/schema-utils.js +103 -0
  332. package/dist/utils/generateCode.d.ts +5 -0
  333. package/dist/utils/generateCode.js +9 -0
  334. package/dist/utils/logger.d.ts +10 -0
  335. package/dist/utils/logger.js +20 -0
  336. package/package.json +59 -33
  337. package/cli.js +0 -46
  338. package/dist/db/CrudService.d.ts +0 -9
  339. package/dist/db/CrudService.js +0 -45
  340. package/dist/demo/dbSchema.d.ts +0 -446
  341. package/dist/demo/dbSchema.js +0 -449
  342. package/dist/demo/testScheme.d.ts +0 -56
  343. package/dist/demo/testScheme.js +0 -42
  344. package/dist/form/CreateUpdate.svelte +0 -219
  345. package/dist/form/CreateUpdate.svelte.d.ts +0 -27
  346. package/dist/form/DataProvider.svelte +0 -23
  347. package/dist/form/DataProvider.svelte.d.ts +0 -7
  348. package/dist/form/FieldValue.svelte +0 -148
  349. package/dist/form/FieldValue.svelte.d.ts +0 -34
  350. package/dist/form/types.d.ts +0 -17
  351. package/dist/fragments/Confirm.svelte +0 -73
  352. package/dist/fragments/Confirm.svelte.d.ts +0 -7
  353. package/dist/fragments/Frame.svelte +0 -19
  354. package/dist/fragments/Frame.svelte.d.ts +0 -32
  355. package/dist/fragments/InfoLine.svelte +0 -21
  356. package/dist/fragments/InfoLine.svelte.d.ts +0 -35
  357. package/dist/fragments/Selector.svelte +0 -26
  358. package/dist/fragments/Selector.svelte.d.ts +0 -38
  359. package/dist/main/machine/MachineSchemeField.d.ts +0 -19
  360. package/dist/types/appschemeTypes.d.ts +0 -71
  361. package/dist/types/appschemeTypes.js +0 -83
  362. package/dist/ui/CollectionButton.svelte +0 -29
  363. package/dist/ui/CollectionButton.svelte.d.ts +0 -29
  364. package/dist/ui/CollectionFks.svelte +0 -24
  365. package/dist/ui/CollectionFks.svelte.d.ts +0 -9
  366. package/dist/ui/CollectionList.svelte +0 -100
  367. package/dist/ui/CollectionList.svelte.d.ts +0 -36
  368. package/dist/ui/CollectionListFieldValues.svelte +0 -59
  369. package/dist/ui/CollectionListFieldValues.svelte.d.ts +0 -9
  370. package/dist/ui/CollectionListMenu.svelte +0 -39
  371. package/dist/ui/CollectionListMenu.svelte.d.ts +0 -34
  372. package/dist/ui/CollectionReverseFks.svelte +0 -37
  373. package/dist/ui/CollectionReverseFks.svelte.d.ts +0 -14
  374. /package/dist/{fragments → data-ui/fragments}/Skeleton.svelte.d.ts +0 -0
  375. /package/dist/{form → main/api}/types.js +0 -0
@@ -0,0 +1,444 @@
1
+ /**
2
+ * Entity types generated from SCHEMA.md
3
+ * TypeScript representations of schema-driven metadata collections.
4
+ *
5
+ * Field-definition catalog (FieldList) and the fkRef() helper live in
6
+ * server/src/idae/field-defs.ts — server seed only. This file holds the
7
+ * entity / RBAC / audit / view interfaces (shared typings).
8
+ */
9
+ export type SchemeType = 'type' | 'group' | 'status' | 'range';
10
+ export type SchemeName = string;
11
+ export type Name = string;
12
+ export type Icon = string;
13
+ export type DateValue = string | Date;
14
+ export type Code = string;
15
+ export type ID = number | string;
16
+ export type Order = number;
17
+ export type Color = string;
18
+ export type Description = string;
19
+ export interface WithName {
20
+ name?: Name;
21
+ }
22
+ export interface WithIcon {
23
+ icon?: Icon;
24
+ }
25
+ export interface WithColor {
26
+ color?: Color;
27
+ }
28
+ export interface WithDate {
29
+ dateCreated?: DateValue;
30
+ dateUpdated?: DateValue;
31
+ }
32
+ export interface WithCode {
33
+ code?: Code;
34
+ }
35
+ export interface WithID {
36
+ id?: ID;
37
+ }
38
+ export interface WithOrder {
39
+ order?: Order;
40
+ }
41
+ /** --- GENERAL TYPES --- **/
42
+ export type AppSchemeFieldTypeCode = 'text' | 'number' | 'date' | 'datetime' | 'boolean' | 'select' | 'multiselect' | 'fk' | 'file' | 'image' | 'textarea' | 'password' | 'email' | 'url' | (string & {});
43
+ export interface Extendable {
44
+ [key: string]: unknown;
45
+ }
46
+ export interface FksItem<T = unknown> extends Extendable {
47
+ id?: unknown;
48
+ uid?: string;
49
+ name: SchemeName;
50
+ code: Code;
51
+ icon: Icon;
52
+ order: Order;
53
+ multiple: boolean;
54
+ required: boolean;
55
+ scheme?: T;
56
+ }
57
+ export interface WithEssentials<T = any> extends Extendable, WithID, WithCode, WithName, WithColor, WithIcon, WithOrder {
58
+ }
59
+ /** Base database definition */
60
+ export interface AppSchemeBase extends Extendable, WithEssentials {
61
+ }
62
+ /** Main scheme definition */
63
+ export interface AppScheme<T = Record<string, any>> extends Extendable, WithEssentials<T> {
64
+ schemeType?: SchemeType;
65
+ /**
66
+ * Dynamic views registry - populated at runtime from appscheme_view.
67
+ * Keys are appscheme_view_type.code values ('full', 'flat', 'fk', 'focus', etc.)
68
+ * @see ViewFields for standard view type definitions
69
+ */
70
+ _views?: Partial<ViewFields>;
71
+ fks?: {
72
+ [key: string]: FksItem;
73
+ };
74
+ }
75
+ /** Core scheme with explicit system relations */
76
+ export interface AppSchemeCore<T = Record<string, any>> extends AppScheme<T> {
77
+ fks?: {
78
+ appscheme_base: FksItem<AppSchemeBase>;
79
+ appscheme_type: FksItem<AppSchemeType>;
80
+ [key: string]: FksItem;
81
+ };
82
+ }
83
+ export interface AppSchemeType extends Extendable, WithEssentials {
84
+ }
85
+ export interface AppSchemeFieldGroup extends Extendable, WithEssentials {
86
+ }
87
+ export interface AppSchemeFieldType extends Extendable, WithEssentials {
88
+ }
89
+ export interface AppSchemeField extends Extendable, WithEssentials {
90
+ description?: string;
91
+ field_type?: string;
92
+ field_group?: string;
93
+ required?: boolean | 0 | 1;
94
+ readonly?: boolean | 0 | 1;
95
+ private?: boolean | 0 | 1;
96
+ fks?: {
97
+ appscheme_field_type?: FksItem<AppSchemeFieldType>;
98
+ appscheme_field_group?: FksItem<AppSchemeFieldGroup>;
99
+ };
100
+ }
101
+ export interface AppSchemeHasField extends Extendable, WithEssentials {
102
+ visible?: boolean | 0 | 1;
103
+ readonly?: boolean | 0 | 1;
104
+ required?: boolean | 0 | 1;
105
+ fks: {
106
+ appscheme: FksItem<AppScheme>;
107
+ appscheme_field: FksItem<AppSchemeField>;
108
+ };
109
+ }
110
+ export interface AppSchemeLog extends Extendable, WithID {
111
+ operation: 'create' | 'update' | 'delete';
112
+ scheme?: SchemeName;
113
+ actorId?: ID;
114
+ timestamp?: DateValue;
115
+ details?: Extendable;
116
+ changes?: Extendable;
117
+ fks?: {
118
+ appscheme: FksItem<AppScheme>;
119
+ };
120
+ }
121
+ export type AppSchemaCollection = AppSchemeBase | AppScheme | AppSchemeField | AppSchemeFieldType | AppSchemeFieldGroup | AppSchemeHasField | AppSchemeType | AppSchemeLog | AppSchemeViewType | AppSchemeView | AppUser | AppUserProfile | AppUserGroup | AppUserType | AppUserAssignment | AppUserGrant | AppUserSession | AppUserAudit;
122
+ /**
123
+ * Permission codes following CRUD + extensions pattern.
124
+ */
125
+ export type PermissionCode = 'C' | 'R' | 'U' | 'D' | 'L' | 'X';
126
+ export declare const PERMISSION_CODES: Record<PermissionCode, {
127
+ name: string;
128
+ }>;
129
+ /**
130
+ * Boolean permission value for modern APIs.
131
+ */
132
+ export type PermissionBoolean = boolean;
133
+ /**
134
+ * Legacy permission value (1 = granted, 0 = denied) for backward compatibility.
135
+ */
136
+ export type PermissionValue = 1 | 0;
137
+ /**
138
+ * App-level permissions stored as JSON blob in appuser.appPermissions.
139
+ * These override table-level permissions.
140
+ */
141
+ export interface AppPermissions extends Extendable {
142
+ ADMIN?: boolean;
143
+ DEV?: boolean;
144
+ CONF?: boolean;
145
+ BYPASS_AUDIT?: boolean;
146
+ IMPERSONATE?: boolean;
147
+ [key: string]: boolean | undefined;
148
+ }
149
+ /**
150
+ * Grant constraints - fine-grained access restrictions.
151
+ * @example { "territory": "EU", "maxAmount": 10000, "departments": ["sales", "marketing"] }
152
+ */
153
+ export interface GrantConstraints extends Extendable {
154
+ territory?: string;
155
+ maxAmount?: number;
156
+ departments?: string[];
157
+ businessUnits?: string[];
158
+ [key: string]: unknown;
159
+ }
160
+ /**
161
+ * Core user account - authentication & authorization entry point.
162
+ * Separated from profile for security (PII isolation) and performance.
163
+ */
164
+ export interface AppUser extends Extendable, WithEssentials {
165
+ login: string;
166
+ passwordHash: string;
167
+ email: string;
168
+ emailVerified: boolean;
169
+ isActive: boolean;
170
+ isLocked: boolean;
171
+ failedLoginCount?: number;
172
+ lockedUntil?: DateValue;
173
+ lastLoginAt?: DateValue;
174
+ lastLoginIp?: string;
175
+ mustChangePassword?: boolean;
176
+ /**
177
+ * App-level permissions as JSON blob.
178
+ * These override table-level permissions.
179
+ * @example { "ADMIN": true, "DEV": false, "BYPASS_AUDIT": true }
180
+ */
181
+ appPermissions?: AppPermissions;
182
+ fks: {
183
+ appuser_profile?: FksItem<AppUserProfile>;
184
+ };
185
+ }
186
+ /**
187
+ * User profile - personal data and preferences.
188
+ * Separated from AppUser for GDPR/privacy compliance.
189
+ * Can be extended without affecting auth flows.
190
+ */
191
+ export interface AppUserProfile extends Extendable, WithID {
192
+ firstName?: string;
193
+ lastName?: string;
194
+ displayName?: string;
195
+ avatarUrl?: string;
196
+ phone?: string;
197
+ mobile?: string;
198
+ locale?: string;
199
+ timezone?: string;
200
+ /**
201
+ * User preferences as JSON blob.
202
+ * @example { "theme": "dark", "notifications": { "email": true, "sms": false } }
203
+ */
204
+ preferences?: Extendable;
205
+ fks: {};
206
+ }
207
+ /**
208
+ * User groups - collections of users (teams, departments).
209
+ * Users can belong to multiple groups via AppUserAssignment.
210
+ */
211
+ export interface AppUserGroup extends Extendable, WithEssentials {
212
+ code: Code;
213
+ name: Name;
214
+ description?: Description;
215
+ /**
216
+ * System groups cannot be deleted (e.g., "Administrators", "Everyone").
217
+ */
218
+ isSystem: boolean;
219
+ }
220
+ /**
221
+ * User types — reusable classification templates (formerly AppUserRole).
222
+ * Examples: "Data Administrator", "Report Viewer", "Content Editor"
223
+ * Types can be assigned directly to users or inherited from groups.
224
+ */
225
+ export interface AppUserType extends Extendable, WithEssentials {
226
+ code: Code;
227
+ name: Name;
228
+ description?: Description;
229
+ /** System types cannot be deleted (e.g., "Admin", "User"). */
230
+ isSystem: boolean;
231
+ /** Type level for hierarchy resolution. Higher level = more privileges. */
232
+ typeLevel?: number;
233
+ }
234
+ /** Backward-compatible alias of AppUserType. */
235
+ export type AppUserRole = AppUserType;
236
+ /**
237
+ * Assignment type - distinguishes between role and group assignments.
238
+ */
239
+ export type AssignmentType = 'role' | 'group';
240
+ /**
241
+ * Assignment table - many-to-many link between users and roles/groups.
242
+ * Enables: one user, multiple roles; one role, multiple users.
243
+ * Temporal scope: assignments can be temporary (internships, projects).
244
+ */
245
+ export interface AppUserAssignment extends Extendable, WithID {
246
+ assignmentType: AssignmentType;
247
+ /**
248
+ * Primary group for UI defaults and fallback permissions.
249
+ */
250
+ isPrimary?: boolean;
251
+ /**
252
+ * When the assignment becomes active (null = immediately).
253
+ */
254
+ validFrom?: DateValue;
255
+ /**
256
+ * When the assignment expires (null = permanent).
257
+ */
258
+ validUntil?: DateValue;
259
+ /**
260
+ * Who granted this assignment.
261
+ */
262
+ assignedBy: ID;
263
+ assignedAt: DateValue;
264
+ /**
265
+ * Revocation tracking.
266
+ */
267
+ revokedBy?: ID;
268
+ revokedAt?: DateValue;
269
+ revocationReason?: string;
270
+ fks: {
271
+ appuser: FksItem<AppUser>;
272
+ appuser_type?: FksItem<AppUserType>;
273
+ appuser_group?: FksItem<AppUserGroup>;
274
+ };
275
+ }
276
+ /**
277
+ * Grant type - distinguishes which entity receives the grant.
278
+ */
279
+ export type GrantType = 'role' | 'group' | 'user';
280
+ /**
281
+ * Permission grants - fine-grained access control per scheme/resource.
282
+ * Can be assigned to roles, groups, or individual users.
283
+ * Temporal scope enables temporary access (projects, substitutions).
284
+ */
285
+ export interface AppUserGrant extends Extendable, WithID {
286
+ grantType: GrantType;
287
+ c: PermissionBoolean;
288
+ r: PermissionBoolean;
289
+ u: PermissionBoolean;
290
+ d: PermissionBoolean;
291
+ l: PermissionBoolean;
292
+ x: PermissionBoolean;
293
+ validFrom?: DateValue;
294
+ validUntil?: DateValue;
295
+ grantedBy: ID;
296
+ grantedAt: DateValue;
297
+ revokedBy?: ID;
298
+ revokedAt?: DateValue;
299
+ revocationReason?: string;
300
+ /**
301
+ * Constraints as JSON - restricts grant scope.
302
+ * @example { "territory": "EU", "maxAmount": 10000 }
303
+ */
304
+ constraints?: GrantConstraints;
305
+ fks: {
306
+ appscheme: FksItem<AppScheme>;
307
+ appuser_type?: FksItem<AppUserType>;
308
+ appuser_group?: FksItem<AppUserGroup>;
309
+ appuser?: FksItem<AppUser>;
310
+ };
311
+ }
312
+ /**
313
+ * Active user sessions for tracking and security.
314
+ * Enables "logout everywhere" and concurrent session limits.
315
+ */
316
+ export interface AppUserSession extends Extendable, WithID {
317
+ sessionToken: string;
318
+ refreshToken?: string;
319
+ ipAddress?: string;
320
+ userAgent?: string;
321
+ deviceInfo?: Extendable;
322
+ startedAt: DateValue;
323
+ expiresAt: DateValue;
324
+ lastActivityAt: DateValue;
325
+ isRevoked: boolean;
326
+ revokedAt?: DateValue;
327
+ /**
328
+ * Reason for revocation: 'logout', 'timeout', 'security', 'admin_action'
329
+ */
330
+ revocationReason?: string;
331
+ fks: {
332
+ appuser: FksItem<AppUser>;
333
+ };
334
+ }
335
+ /**
336
+ * Audit action types.
337
+ */
338
+ export type AuditAction = 'login' | 'logout' | 'create' | 'update' | 'delete' | 'view' | 'export' | 'import' | 'execute' | 'permission_denied';
339
+ /**
340
+ * Audit status types.
341
+ */
342
+ export type AuditStatus = 'success' | 'failure' | 'denied';
343
+ /**
344
+ * Audit trail for user actions.
345
+ * Immutable log of who did what, when, from where.
346
+ */
347
+ export interface AppUserAudit extends Extendable, WithID {
348
+ action: AuditAction;
349
+ resourceType: string;
350
+ resourceId?: ID;
351
+ /**
352
+ * Action details as JSON.
353
+ * @example { "fields": ["name", "email"], "before": {...}, "after": {...} }
354
+ */
355
+ details?: Extendable;
356
+ ipAddress?: string;
357
+ userAgent?: string;
358
+ sessionId?: ID;
359
+ status: AuditStatus;
360
+ failureReason?: string;
361
+ performedAt: DateValue;
362
+ fks: {
363
+ appuser: FksItem<AppUser>;
364
+ };
365
+ }
366
+ /**
367
+ * Hierarchical permission check result.
368
+ */
369
+ export interface PermissionCheckResult {
370
+ granted: boolean;
371
+ /**
372
+ * Source of the permission decision.
373
+ */
374
+ source: 'app_permissions' | 'direct_grant' | 'role_grant' | 'group_grant' | 'none';
375
+ /**
376
+ * Which grant/assignment provided the permission.
377
+ */
378
+ grantId?: ID;
379
+ /**
380
+ * Constraints that apply to this permission.
381
+ */
382
+ constraints?: GrantConstraints;
383
+ /**
384
+ * Reason for denial (if granted = false).
385
+ */
386
+ reason?: string;
387
+ }
388
+ /**
389
+ * Standard view type codes defined in appscheme_view_type.
390
+ * Extensible - new view types can be added without schema migration.
391
+ */
392
+ export type ViewTypeCode = 'full' | 'flat' | 'fk' | 'focus' | (string & {});
393
+ /**
394
+ * Field definition as resolved for a specific view.
395
+ * A view is only a list of fields — no formatting/layout metadata.
396
+ */
397
+ export interface ViewFieldDef extends Extendable {
398
+ name: string;
399
+ code: string;
400
+ order?: number;
401
+ }
402
+ /**
403
+ * Named field selections.
404
+ * Populated at runtime from appscheme_view data.
405
+ *
406
+ * Partition (disjoint, full = flat ∪ fk):
407
+ * - full : all fields, incl. fks (view_type 'full')
408
+ * - flat : non-fk fields only (view_type 'flat')
409
+ * - fk : fk fields only (view_type 'fk')
410
+ * Curated subset (orthogonal, NOT part of the partition):
411
+ * - focus : group 'identification' fields, fallback [code, name] (view_type 'focus')
412
+ */
413
+ export interface ViewFields extends Extendable {
414
+ full?: ViewFieldDef[];
415
+ flat?: ViewFieldDef[];
416
+ fk?: ViewFieldDef[];
417
+ focus?: ViewFieldDef[];
418
+ [key: string]: ViewFieldDef[] | undefined;
419
+ }
420
+ /**
421
+ * View type registry entry.
422
+ * Defines available view contexts. Extensible without schema migration.
423
+ */
424
+ export interface AppSchemeViewType extends Extendable, WithEssentials {
425
+ description?: Description;
426
+ }
427
+ /**
428
+ * View instance - binds a field to a view type for an entity.
429
+ * Pivot table: appscheme_view
430
+ */
431
+ export interface AppSchemeView extends Extendable, WithEssentials {
432
+ fks: {
433
+ appscheme: FksItem<AppScheme>;
434
+ appscheme_view_type: FksItem<AppSchemeViewType>;
435
+ appscheme_field: FksItem<AppSchemeField>;
436
+ };
437
+ }
438
+ /**
439
+ * Enhanced AppScheme with the viewFields registry.
440
+ * The _views property is populated at runtime from appscheme_view data.
441
+ */
442
+ export interface AppSchemeWithProfiles<T = Record<string, any>> extends AppScheme<T> {
443
+ _views?: Partial<ViewFields>;
444
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Entity types generated from SCHEMA.md
3
+ * TypeScript representations of schema-driven metadata collections.
4
+ *
5
+ * Field-definition catalog (FieldList) and the fkRef() helper live in
6
+ * server/src/idae/field-defs.ts — server seed only. This file holds the
7
+ * entity / RBAC / audit / view interfaces (shared typings).
8
+ */
9
+ export const PERMISSION_CODES = {
10
+ C: { name: 'create' },
11
+ R: { name: 'read' },
12
+ U: { name: 'update' },
13
+ D: { name: 'delete' },
14
+ L: { name: 'list' },
15
+ X: { name: 'execute' },
16
+ };
@@ -0,0 +1,7 @@
1
+ export * from './entity-types.js';
2
+ export type { SortBy, InputSize, ImageFieldDef, MachineFieldDef, MachineFkDef, MachineDisplayTemplate, MachineRightsPolicy, MachineCollectionModel, MachineModel, FkRelations, TplFieldType, TplFieldArgs, TplFieldRulesObject, TplFieldRules, TplFields, TplCollectionName, Tpl, IdbqModel, IDbForge, Where, Operator, OperatorType, SupportedOperator, ResultSet, ResultsetOptions, DataOpGroupByOptions, DotPath, DiagramNode, DiagramEdge, DiagramGraph, } from './machine-model.js';
3
+ export { indexFromKeyPath } from './machine-model.js';
4
+ export type { StorageAdapter, QueryOperator, QueryCondition, } from '../storage/StorageAdapter.js';
5
+ export { MemoryStorageAdapter } from '../storage/MemoryStorageAdapter.js';
6
+ export { ApiStorageAdapter, type ApiClient } from '../storage/ApiStorageAdapter.js';
7
+ export { IdbStorageAdapter } from '../storage/IdbStorageAdapter.js';
@@ -0,0 +1,6 @@
1
+ // Types barrel export
2
+ export * from './entity-types.js';
3
+ export { indexFromKeyPath } from './machine-model.js';
4
+ export { MemoryStorageAdapter } from '../storage/MemoryStorageAdapter.js';
5
+ export { ApiStorageAdapter } from '../storage/ApiStorageAdapter.js';
6
+ export { IdbStorageAdapter } from '../storage/IdbStorageAdapter.js';
@@ -0,0 +1,198 @@
1
+ /**
2
+ * Machine model types — owned by idae-machine, NOT idae-idbql.
3
+ *
4
+ * 3-sibling structure per collection:
5
+ * - fields : data definitions
6
+ * - fks : relations
7
+ * - template? : display hints (presentation only)
8
+ *
9
+ * `keyPath` stays at the root (used by IndexedDB + Mongo). Index field name is derived from keyPath
10
+ * by stripping the '++' autoincrement prefix.
11
+ */
12
+ import type { PermissionCode } from './entity-types.js';
13
+ export type { PermissionCode };
14
+ export type SortBy = {
15
+ field: string;
16
+ direction: 'asc' | 'desc';
17
+ };
18
+ export type InputSize = 'xs' | 'sm' | 'md' | 'lg' | 'full';
19
+ interface BaseFieldDef {
20
+ /** Resolved catalog-first from FieldList (server/src/idae/field-defs.ts) by field
21
+ * name — see ADR-field-type-source.md. Inline here is an explicit override, not
22
+ * the primary declaration; omit it and let the catalog resolve. */
23
+ type?: string;
24
+ required?: boolean;
25
+ readonly?: boolean;
26
+ private?: boolean;
27
+ inputSize?: InputSize;
28
+ /** Semantic field group (from appscheme_field_group.code), e.g. 'identification'. */
29
+ group?: string;
30
+ }
31
+ export interface ImageFieldDef extends BaseFieldDef {
32
+ type: 'image';
33
+ /** Whitelist of allowed preset codes */
34
+ presets?: string[];
35
+ /** Single preset code — exclusive with presets */
36
+ preset?: string;
37
+ /** Accept free-WxH notation (default: false if presets set, true otherwise) */
38
+ free?: boolean;
39
+ /** Max upload size in bytes */
40
+ maxSize?: number;
41
+ /** Allow multiple uploads (future) */
42
+ multiple?: boolean;
43
+ }
44
+ export type MachineFieldDef = BaseFieldDef | ImageFieldDef;
45
+ export interface MachineFkDef {
46
+ /** Target collection code */
47
+ code: string;
48
+ required?: boolean;
49
+ }
50
+ export type FkRelations = Record<string, MachineFkDef>;
51
+ /**
52
+ * Display template for a collection — UI/runtime hint only, no data structure.
53
+ *
54
+ * `presentation` is a space-separated list of field accessors. Accessors support
55
+ * dot notation to reach nested data and joined fk records, e.g.:
56
+ * 'name email' → top-level fields
57
+ * 'name fks.firm.name' → joined fk lookup (requires pre-joined data.fks)
58
+ * 'address.city address.country' → nested object fields
59
+ */
60
+ export interface MachineDisplayTemplate {
61
+ presentation?: string;
62
+ }
63
+ /**
64
+ * Named field selections for different display contexts.
65
+ * Populated at runtime from appscheme_view data.
66
+ *
67
+ * - full : all fields, incl. fks (default = all schema fields)
68
+ * - flat : non-fk fields only (default = schema fields minus fk keys)
69
+ * - fk : fk fields only (default = fk key fields)
70
+ * - focus : curated identity subset (group 'identification', fallback [code, name])
71
+ */
72
+ export interface ViewFields {
73
+ full?: ViewFieldDef[];
74
+ flat?: ViewFieldDef[];
75
+ fk?: ViewFieldDef[];
76
+ focus?: ViewFieldDef[];
77
+ [key: string]: ViewFieldDef[] | undefined;
78
+ }
79
+ export interface ViewFieldDef {
80
+ name: string;
81
+ code?: string;
82
+ order?: number;
83
+ }
84
+ /**
85
+ * Structural rights policy for a collection — declared in schema, not in grants.
86
+ *
87
+ * `ops` — whitelist of operations structurally permitted. Absent = all ops allowed.
88
+ * `public` — ops allowed without any auth (no user required).
89
+ * `default` — ops allowed to any authenticated user with no explicit grant.
90
+ *
91
+ * Grants (appuser_grant) apply within the bounds of `ops`.
92
+ * Resolution order in checkAccess:
93
+ * ops deny → public allow → ADMIN override → explicit grant → default → deny
94
+ */
95
+ export interface MachineRightsPolicy {
96
+ ops?: PermissionCode[];
97
+ public?: PermissionCode[];
98
+ default?: PermissionCode[];
99
+ }
100
+ export interface MachineCollectionModel<T = any> {
101
+ /** IndexedDB / Mongo primary key path: '++id' | 'id' | '[a+b]'. Index field = keyPath stripped of '++'. Optional — defaults to '++id' (engine/deploy inject it). */
102
+ keyPath?: string;
103
+ /** MongoDB database module name (without org prefix). e.g. 'machine_user' → '{org}_machine_user'. */
104
+ base?: string;
105
+ /** TypeScript type hint for record shape (never stored at runtime). */
106
+ ts?: T;
107
+ /** Data field definitions. */
108
+ fields: Record<string, MachineFieldDef>;
109
+ /** Foreign key relations — authoring declaration on the source scheme. Published to appscheme.fkRelations by publishModel. */
110
+ fkRelations?: Record<string, MachineFkDef>;
111
+ /** Resolved relations — getModel() output only, projected from appscheme.fkRelations. Never declare this on a source scheme; use `fkRelations`. */
112
+ fks?: Record<string, MachineFkDef>;
113
+ /** Display template hint (presentation only). Optional. */
114
+ template?: MachineDisplayTemplate;
115
+ /** Default sort applied by Explorer when no sortBy prop. Multiple = stable sort chain. */
116
+ defaultSort?: SortBy[];
117
+ /** Structural rights policy — declared in schema, seeded as default grants by publishModel. */
118
+ rights?: MachineRightsPolicy;
119
+ /** Display icon for the collection (Phosphor / iconify name, e.g. 'car', 'user').
120
+ * Written to the appscheme doc by publishModel; rendered in menu/explorer/synthesis.
121
+ * Optional — publishModel falls back to a generic default when absent. */
122
+ icon?: string;
123
+ /** Display accent color for the collection (any CSS color). Optional. */
124
+ color?: string;
125
+ /** Time span carried by records of this collection — the start/end field pair
126
+ * (date, datetime or time types). Declared here or auto-detected by publishModel
127
+ * from field-name pairs (start/end, debut/fin, from/until, check_in/check_out).
128
+ * Written to the appscheme doc; qualifies the collection for period-based views
129
+ * (planning/calendar). `hasTimespan` is derivable: `!!timespan`. */
130
+ timespan?: {
131
+ start: string;
132
+ end: string;
133
+ };
134
+ /** Semantic role flags — written to appscheme doc by publishModel. Drive UI/validation/routing. */
135
+ isType?: boolean;
136
+ isGroup?: boolean;
137
+ isStatus?: boolean;
138
+ /** Legacy compat slot kept for schema literals that still include `model: {}`. */
139
+ model?: unknown;
140
+ /** View field projections, injected at runtime by the server (publishModel → getModel). Never declared in a schema literal. */
141
+ _views?: Partial<ViewFields>;
142
+ }
143
+ export type MachineModel = Record<string, MachineCollectionModel>;
144
+ /** Derive the index field name from a keyPath ('++id' → 'id', 'code' → 'code'). */
145
+ export declare function indexFromKeyPath(keyPath: string): string;
146
+ /** Field type string — primitive or FK shorthand. */
147
+ export type TplFieldType = string;
148
+ /** Legacy string field rule format e.g. 'text-long (required)'. */
149
+ export type TplFieldArgs = string;
150
+ /** Object-form field rule — identical shape to MachineFieldDef. */
151
+ export type TplFieldRulesObject = MachineFieldDef;
152
+ /** Union of legacy string rule and new object rule. */
153
+ export type TplFieldRules = TplFieldArgs | MachineFieldDef;
154
+ /** Fields map for a collection template. */
155
+ export type TplFields = Record<string, MachineFieldDef | string>;
156
+ /** Collection name key — string alias for readability. */
157
+ export type TplCollectionName = string;
158
+ /** Display template alias. */
159
+ export type Tpl = MachineDisplayTemplate;
160
+ /** IdbqModel alias — use MachineModel for new code. */
161
+ export type IdbqModel = MachineModel;
162
+ /** Parsed field descriptor produced by MachineParserForge. */
163
+ export type IDbForge = {
164
+ collection?: TplCollectionName;
165
+ fieldName?: string;
166
+ fieldType?: TplFieldType;
167
+ fieldRule?: TplFieldRules;
168
+ fieldArgs?: string[] | undefined;
169
+ is: 'array' | 'object' | 'fk' | 'primitive';
170
+ /** Image field options (when fieldType === 'image') */
171
+ presets?: string[];
172
+ preset?: string;
173
+ free?: boolean;
174
+ maxSize?: number;
175
+ multiple?: boolean;
176
+ accept?: string;
177
+ /** Visual size preset for the input in DataForm grid */
178
+ inputSize?: InputSize;
179
+ };
180
+ export type { Where, Operator, OperatorType, SupportedOperator, ResultSet, ResultsetOptions, DataOpGroupByOptions, DotPath, } from '@medyll/qoolie';
181
+ export interface DiagramNode {
182
+ id: string;
183
+ collection: string;
184
+ record: Record<string, unknown>;
185
+ label: string;
186
+ }
187
+ export interface DiagramEdge {
188
+ from: string;
189
+ to: string;
190
+ relationKey: string;
191
+ direction: 'forward' | 'reverse';
192
+ fieldName: string;
193
+ }
194
+ export interface DiagramGraph {
195
+ nodes: DiagramNode[];
196
+ edges: DiagramEdge[];
197
+ root: string;
198
+ }
@@ -0,0 +1,5 @@
1
+ // ── Helpers ───────────────────────────────────────────────────────────────────
2
+ /** Derive the index field name from a keyPath ('++id' → 'id', 'code' → 'code'). */
3
+ export function indexFromKeyPath(keyPath) {
4
+ return (keyPath ?? '++id').replace(/^\+\+/, '');
5
+ }
@@ -0,0 +1,11 @@
1
+ declare module '@medyll/qoolie/svelte' {
2
+ export function useQoolieCollection<T = any>(
3
+ qoolie: import('@medyll/qoolie').QoolieInstance,
4
+ collection: string
5
+ ): { items: T[] };
6
+ export function useQoolieQuery<T = any>(
7
+ qoolie: import('@medyll/qoolie').QoolieInstance,
8
+ collection: string,
9
+ query: import('@medyll/qoolie').Where
10
+ ): { items: T[] };
11
+ }