@medyll/idae-machine 0.135.2 → 0.136.2

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
@@ -1,146 +1,159 @@
1
- import { MachineDb } from "../machineDb.js";
2
- import { MachineSchemeFieldForge } from "./MachineSchemeFieldForge.js";
3
- import { MachineSchemeValues } from "./MachineSchemeValues.js";
4
- import { MachineSchemeValidate } from "./MachineSchemeValidate.js";
5
- import { MachineSchemeField } from "./MachineSchemeField.js";
1
+ import { MachineError } from './MachineError.js';
2
+ import { indexFromKeyPath } from '../../types/index.js';
3
+ import { MachineDb } from '../machineDb.js';
4
+ import { getCollectionRelations } from '../../data-ui/utils/dataRelationUtils.js';
5
+ import { getRelationResolver } from '../ext/hooks.js';
6
+ import { MachineSchemeFieldForge } from './MachineSchemeFieldForge.js';
7
+ import { MachineSchemeValues } from './MachineSchemeValues.js';
8
+ import { MachineSchemeValidate } from './MachineSchemeValidate.js';
9
+ import { MachineSchemeField } from './MachineSchemeField.js';
6
10
  /**
7
11
  * @class MachineScheme
8
- * @role Provides schema and field utilities for a collection, including metadata, formatting, and field parsing.
12
+ * @role Provides schema and field utilities for a collection: metadata, formatting, field parsing.
9
13
  */
10
14
  export class MachineScheme {
11
- /** The collection name. */
12
15
  collection;
13
- /** The collection template. */
14
- #template;
15
- /** The MachineDb instance. */
16
- #machineDb;
17
- /** The collection model. */
16
+ name;
18
17
  #collectionModel;
18
+ #machineDb;
19
19
  #model;
20
- /**
21
- * Create a new MachineScheme instance.
22
- * @role Constructor
23
- * @param {TplCollectionName} collectionName The collection name.
24
- * @param {MachineDb} idbBase The MachineDb instance.
25
- * @param {IdbqModel} model The IdbqModel instance.
26
- */
27
20
  constructor(collectionName, idbBase, model) {
28
21
  this.collection = collectionName;
22
+ this.name = collectionName;
29
23
  this.#machineDb = idbBase;
30
24
  this.#collectionModel = model[String(collectionName)];
31
- this.#template = this.#collectionModel["template"];
25
+ if (!this.#collectionModel) {
26
+ throw new MachineError(`Collection '${collectionName}' not found in model.`, 'COLLECTION_NOT_FOUND');
27
+ }
32
28
  this.#model = model;
33
29
  }
34
- /**
35
- * Get the collection model.
36
- * @role Accessor
37
- * @return {IdbqModel["Collection"]} The collection model.
38
- */
39
30
  get model() {
40
31
  return this.#collectionModel;
41
32
  }
42
- /**
43
- * Get the collection template.
44
- * @role Accessor
45
- * @return {Tpl} The collection template.
46
- */
33
+ /** Display template (presentation only). */
47
34
  get template() {
48
- return this.#template;
35
+ return this.#collectionModel.template ?? {};
36
+ }
37
+ /** Field definitions (data). */
38
+ get fields() {
39
+ return this.#collectionModel.fields ?? {};
40
+ }
41
+ /** Foreign key relations. */
42
+ get fks() {
43
+ return getCollectionRelations(this.collection) ?? {};
44
+ }
45
+ /** Primary key field name, derived from keyPath ('++id' → 'id'). */
46
+ get index() {
47
+ return indexFromKeyPath(this.#collectionModel.keyPath ?? '++id');
48
+ }
49
+ /** Default sort inferred from defaultSort or field naming/type conventions. */
50
+ get defaultSort() {
51
+ const explicitSort = this.#collectionModel.defaultSort;
52
+ if (explicitSort?.length)
53
+ return explicitSort;
54
+ const fields = this.fields;
55
+ const fieldNames = Object.keys(fields);
56
+ const ordreField = fieldNames.find(f => f === 'ordre' || f === 'order');
57
+ if (ordreField)
58
+ return [{ field: ordreField, direction: 'asc' }];
59
+ const nameField = fieldNames.find(f => ['name', 'nom', 'label', 'titre', 'title', 'code'].includes(f));
60
+ if (nameField)
61
+ return [{ field: nameField, direction: 'asc' }];
62
+ const updatedField = fieldNames.find(f => f === 'updatedAt' || f === 'dateModification');
63
+ if (updatedField)
64
+ return [{ field: updatedField, direction: 'desc' }];
65
+ const createdField = fieldNames.find(f => f === 'createdAt' || f === 'dateCreation');
66
+ if (createdField)
67
+ return [{ field: createdField, direction: 'desc' }];
68
+ const dateField = fieldNames.find(f => {
69
+ const t = fields[f]?.type ?? '';
70
+ return t === 'date' || t === 'datetime';
71
+ });
72
+ if (dateField)
73
+ return [{ field: dateField, direction: 'desc' }];
74
+ return [{ field: this.index, direction: 'asc' }];
49
75
  }
50
- /**
51
- * Get a form validator for this collection.
52
- * @role Utility
53
- * @return {MachineSchemeValidate} The form validator instance.
54
- */
55
76
  get validator() {
56
77
  return new MachineSchemeValidate(this.collection, this.#machineDb);
57
78
  }
58
- /**
59
- * Get the field rule for a given field name.
60
- * @role Field rule accessor
61
- * @param {keyof TplFields} fieldName The field name.
62
- * @return {TplFieldRules | undefined} The field rule or undefined.
63
- */
64
79
  getFieldRule(fieldName) {
65
- return this.#template.fields[String(fieldName)];
80
+ return this.fields[String(fieldName)];
66
81
  }
67
- /**
68
- * Get a new IDbCollectionValues instance for this collection.
69
- * @role Utility
70
- * @return {MachineSchemeValues} The collection values instance.
71
- */
72
82
  get collectionValues() {
73
83
  return new MachineSchemeValues(this.collection, this.#machineDb);
74
84
  }
75
85
  field(fieldName) {
76
86
  return new MachineSchemeField(this.#model, this.collection, fieldName);
77
87
  }
78
- /**
79
- * Get a field forge instance for a specific field and data.
80
- * @role Field forge factory
81
- * @template T
82
- * @param {keyof T} fieldName The field name.
83
- * @param {T} data The data object.
84
- * @return {MachineSchemeFieldForge<T>} The field forge instance.
85
- */
86
88
  fieldForge(fieldName, data) {
87
89
  return new MachineSchemeFieldForge(this.collection, fieldName, data, this.collectionValues, this.#machineDb);
88
90
  }
89
- /**
90
- * Parse all fields of a given collection.
91
- * @role Field parsing
92
- * @return {Record<string, IDbForge | undefined> | undefined} All parsed fields or undefined.
93
- */
94
91
  parse() {
95
- const fields = this.#template.fields;
92
+ const fields = this.fields;
96
93
  if (!fields)
97
94
  return;
98
95
  const out = {};
99
96
  Object.keys(fields).forEach((fieldName) => {
100
- const fieldType = fields[fieldName];
101
- if (fieldType) {
102
- out[fieldName] = this.field(fieldName).parse();
103
- }
97
+ out[fieldName] = this.field(fieldName).parse();
104
98
  });
105
- console.log("Parsed fields for collection", this.collection, out);
106
99
  return out;
107
100
  }
108
- /**
109
- * Get all foreign keys for this collection.
110
- * @role Foreign key accessor
111
- * @return {{ [collection: string]: Tpl }} Foreign key collections.
112
- */
113
101
  parseFks() {
114
- const fks = this.#template?.fks;
115
102
  const out = {};
116
- if (fks) {
117
- Object.keys(fks).forEach((collection) => {
118
- const fkScheme = new MachineScheme(collection, this.#machineDb, this.#model);
119
- out[collection] = fkScheme.parse() ?? {};
120
- });
121
- }
103
+ Object.keys(this.fks).forEach((collection) => {
104
+ const fkScheme = new MachineScheme(collection, this.#machineDb, this.#model);
105
+ out[collection] = fkScheme.parse() ?? {};
106
+ });
122
107
  return out;
123
108
  }
109
+ findFkField(targetCollection) {
110
+ return getRelationResolver()?.findRelationField?.(this.collection, targetCollection) ?? null;
111
+ }
124
112
  /**
125
- * Get all reverse foreign keys for this collection.
126
- * @role Reverse foreign key accessor
127
- * @return {Record<string, Record<string, IDbForge | undefined>>} Reverse foreign key collections.
113
+ * Whether `record` carries a value for FK relation `relationKey` — covers the
114
+ * nested `fks.{relationKey}_{id}` convention, the nested object form
115
+ * `fks.{relationKey} = { id|code }`, and the legacy flat scalar field
116
+ * (via `findFkField`). Used by `MachineSchemeValidate` to enforce
117
+ * `MachineFkDef.required`.
128
118
  */
119
+ hasFkValue(record, relationKey) {
120
+ return getRelationResolver()?.hasRelationValue?.(this.collection, record, relationKey) ?? false;
121
+ }
129
122
  parseReverseFks() {
130
123
  const result = {};
131
- Object.entries(this.model).forEach(([collectionName, collectionModel]) => {
132
- const template = collectionModel.template;
133
- if (template && template.fks) {
134
- Object.entries(template.fks).forEach(([fkName, fkConfig]) => {
135
- if (fkConfig?.code === this.collection) {
136
- if (!result[collectionName]) {
137
- result[collectionName] = {};
138
- }
139
- result[collectionName][fkName] = fkConfig;
140
- }
141
- });
124
+ // Get all collection names from the model
125
+ const collectionNames = Object.keys(this.#model);
126
+ // For each collection, get its relations and check if any point to this collection
127
+ for (const collectionName of collectionNames) {
128
+ const relations = getCollectionRelations(collectionName);
129
+ if (!relations)
130
+ continue;
131
+ Object.entries(relations).forEach(([fkName, fkConfig]) => {
132
+ if (fkConfig?.code === this.collection) {
133
+ if (!result[collectionName])
134
+ result[collectionName] = {};
135
+ result[collectionName][fkName] = fkConfig;
136
+ }
137
+ });
138
+ }
139
+ return result;
140
+ }
141
+ parseReverseFkFields() {
142
+ const reverseFks = this.parseReverseFks();
143
+ const result = {};
144
+ for (const [sourceCollection, relations] of Object.entries(reverseFks)) {
145
+ const sourceScheme = new MachineScheme(sourceCollection, this.#machineDb, this.#model);
146
+ result[sourceCollection] = {};
147
+ for (const [relationKey, relationDef] of Object.entries(relations)) {
148
+ const fkDef = relationDef;
149
+ const fieldInfo = sourceScheme.findFkField(this.collection);
150
+ result[sourceCollection][relationKey] = {
151
+ ...fkDef,
152
+ fieldName: fieldInfo?.fieldName,
153
+ targetIndex: fieldInfo?.targetIndex
154
+ };
142
155
  }
143
- });
156
+ }
144
157
  return result;
145
158
  }
146
159
  }
@@ -1,19 +1,16 @@
1
- import { MachineParserForge } from "../machineParserForge.js";
2
- import { MachineError } from "./MachineError.js";
1
+ import { MachineParserForge } from '../machineParserForge.js';
2
+ import { MachineError } from './MachineError.js';
3
+ import { getCollectionRelations } from '../../data-ui/utils/dataRelationUtils.js';
3
4
  export class MachineSchemeField {
4
5
  #collection;
5
6
  #fieldName;
6
7
  #machineForge;
7
- /** The collection model. */
8
- #model;
9
- /** The collection template. */
10
- #template;
11
- constructor(fullIDBModel, collection, fieldName) {
8
+ #collectionModel;
9
+ constructor(fullModel, collection, fieldName) {
12
10
  this.#collection = collection;
13
11
  this.#fieldName = fieldName;
14
12
  this.#machineForge = new MachineParserForge();
15
- this.#model = fullIDBModel[String(collection)];
16
- this.#template = this.#model["template"];
13
+ this.#collectionModel = fullModel[String(collection)];
17
14
  }
18
15
  /**
19
16
  * Parse a single field of a collection and return its IDbForge metadata.
@@ -24,28 +21,47 @@ export class MachineSchemeField {
24
21
  parse() {
25
22
  const field = this.getFieldRule(this.#fieldName);
26
23
  if (!field) {
27
- MachineError.throwError(`Field ${this.#fieldName} not found in collection ${this.#collection}`, "FIELD_NOT_FOUND");
24
+ MachineError.throwError(`Field ${this.#fieldName} not found in collection ${this.#collection}`, 'FIELD_NOT_FOUND');
28
25
  return undefined;
29
26
  }
30
- const array = this.#machineForge.testIs("array", field);
31
- const object = this.#machineForge.testIs("object", field);
32
- const fk = this.#machineForge.testIs("fk", field);
33
- const primitive = this.#machineForge.testIs("primitive", field);
27
+ const array = this.#machineForge.testIs('array', field);
28
+ const object = this.#machineForge.testIs('object', field);
29
+ const fk = this.#machineForge.testIs('fk', field);
30
+ const primitive = this.#machineForge.testIs('primitive', field);
34
31
  const fieldType = array ?? object ?? fk ?? primitive;
35
32
  return this.#machineForge.forge({
36
33
  collection: this.#collection,
37
34
  fieldName: String(this.#fieldName),
38
35
  ...(fieldType ?? {}),
39
- is: fieldType?.is ?? undefined,
36
+ is: fieldType?.is ?? 'primitive',
40
37
  });
41
38
  }
42
39
  /**
43
40
  * Get the field rule for a given field name.
41
+ *
42
+ * Scalar fields live in `fields`. FK relations live in the structured `fks`
43
+ * block (no scalar `fk-X` field) — synthesize a `fk-<code>.code` rule for them
44
+ * so the forge resolves them as FK, mirroring `MachineSchemeValues.descriptor`.
45
+ * Without this fallback, rendering an FK relation (e.g. a `view="fk"` field)
46
+ * throws FIELD_NOT_FOUND.
47
+ *
44
48
  * @role Field rule accessor
45
49
  * @param {keyof TplFields} fieldName The field name.
46
50
  * @return {TplFieldRules | undefined} The field rule or undefined.
47
51
  */
48
52
  getFieldRule(fieldName) {
49
- return this.#template.fields[String(fieldName)];
53
+ const name = String(fieldName);
54
+ const scalar = (this.#collectionModel.fields ?? {})[name];
55
+ if (scalar)
56
+ return scalar;
57
+ const relations = getCollectionRelations(this.#collection);
58
+ const fkDef = relations?.[name];
59
+ if (fkDef?.code) {
60
+ return {
61
+ type: `fk-${fkDef.code}.code`,
62
+ ...(fkDef.required ? { required: true } : {})
63
+ };
64
+ }
65
+ return undefined;
50
66
  }
51
67
  }
@@ -1,7 +1,6 @@
1
- import type { TplCollectionName, TplFieldArgs, TplFieldType } from "@medyll/idae-idbql";
2
- import { MachineSchemeValues } from "./MachineSchemeValues.js";
3
- import type { IDbForge } from "../machineParserForge.js";
4
- import type { MachineDb } from "../machineDb.js";
1
+ import type { TplCollectionName, TplFieldArgs, TplFieldType, IDbForge } from '../../types/index.js';
2
+ import { MachineSchemeValues } from './MachineSchemeValues.js';
3
+ import type { MachineDb } from '../machineDb.js';
5
4
  /**
6
5
  * @class IDbCollectionFieldForge
7
6
  * @role Provides advanced metadata and formatting for a single field of a collection, given a data object.
@@ -9,7 +8,7 @@ import type { MachineDb } from "../machineDb.js";
9
8
  *
10
9
  * @template T The type of the data object for the collection.
11
10
  */
12
- export declare class MachineSchemeFieldForge<T extends Record<string, any>> {
11
+ export declare class MachineSchemeFieldForge<T extends Record<string, unknown>> {
13
12
  #private;
14
13
  /**
15
14
  * Create a new IDbCollectionFieldForge instance.
@@ -19,7 +18,7 @@ export declare class MachineSchemeFieldForge<T extends Record<string, any>> {
19
18
  * @param {T} data The data object.
20
19
  * @param {MachineSchemeValues<T>=} collectionValues Optional collection values instance.
21
20
  */
22
- constructor(collection: TplCollectionName, fieldName: any, data: T, collectionValues: MachineSchemeValues<T>, machineDb: MachineDb);
21
+ constructor(collection: TplCollectionName, fieldName: keyof T | string, data: T, collectionValues: MachineSchemeValues<T>, machineDb: MachineDb);
23
22
  /**
24
23
  * Get the formatted value for the field.
25
24
  * @role Field formatting
@@ -31,7 +30,7 @@ export declare class MachineSchemeFieldForge<T extends Record<string, any>> {
31
30
  * @role Input attribute generation
32
31
  * @return {any} The input attributes for the field.
33
32
  */
34
- get inputDataSet(): Record<"data-collection" | "data-collectionId" | "data-fieldName" | "data-fieldType" | "data-fieldArgs", string>;
33
+ get inputDataSet(): Record<"data-collection" | "data-fieldType" | "data-collection-id" | "data-fieldName" | "data-fieldArgs" | "data-inputSize", string>;
35
34
  /**
36
35
  * Get the parsed field metadata (IDbForge) for the field.
37
36
  * @role Field metadata accessor
@@ -50,6 +49,7 @@ export declare class MachineSchemeFieldForge<T extends Record<string, any>> {
50
49
  * @return {TplFieldType | undefined} The field type or undefined.
51
50
  */
52
51
  get fieldType(): TplFieldType | undefined;
52
+ get inputSize(): import("../../types/index.js").InputSize | undefined;
53
53
  /**
54
54
  * will return text.inputBase for ['url', 'email', 'number', 'date', 'time', 'datetime', 'phone', 'password']
55
55
  */
@@ -58,7 +58,7 @@ export declare class MachineSchemeFieldForge<T extends Record<string, any>> {
58
58
  * @role Input type accessor
59
59
  * @return {string | 'text' | 'area'} The HTML input type.
60
60
  */
61
- get htmlInputType(): string | "text" | "area";
61
+ get htmlInputType(): string | 'text' | 'area';
62
62
  /**
63
63
  * Get the raw data object for the field.
64
64
  * @role Data accessor
@@ -72,13 +72,13 @@ export declare class MachineSchemeFieldForge<T extends Record<string, any>> {
72
72
  * @param {any[]} data The array data.
73
73
  * @return {IDbForge[]} Array of field metadata objects for each item.
74
74
  */
75
- iterateArray(fieldName: string, data: any[]): IDbForge[];
75
+ iterateArray(fieldName: string, data: unknown[]): IDbForge[];
76
76
  /**
77
77
  * Iterate over an object field and return field metadata for each property.
78
78
  * @role Object field iteration
79
79
  * @param {string} fieldName The field name.
80
- * @param {Record<string, any>} data The object data.
80
+ * @param {Record<string, unknown>} data The object data.
81
81
  * @return {IDbForge[]} Array of field metadata objects for each property.
82
82
  */
83
- iterateObject(fieldName: string, data: Record<string, any>): IDbForge[];
83
+ iterateObject(fieldName: string, data: Record<string, unknown>): IDbForge[];
84
84
  }
@@ -1,4 +1,4 @@
1
- import { MachineSchemeValues } from "./MachineSchemeValues.js";
1
+ import { MachineSchemeValues } from './MachineSchemeValues.js';
2
2
  /**
3
3
  * @class IDbCollectionFieldForge
4
4
  * @role Provides advanced metadata and formatting for a single field of a collection, given a data object.
@@ -21,8 +21,7 @@ export class MachineSchemeFieldForge {
21
21
  */
22
22
  constructor(collection, fieldName, data, collectionValues, machineDb) {
23
23
  this.#collection = collection;
24
- this.#collectionValues =
25
- collectionValues ?? new MachineSchemeValues(collection, machineDb);
24
+ this.#collectionValues = collectionValues ?? new MachineSchemeValues(collection, machineDb);
26
25
  this.#fieldName = String(fieldName);
27
26
  this.#data = data;
28
27
  }
@@ -51,7 +50,8 @@ export class MachineSchemeFieldForge {
51
50
  get forge() {
52
51
  return this.#collectionValues.machine
53
52
  .collection(this.#collection)
54
- .field(String(this.#fieldName)).parse();
53
+ .field(String(this.#fieldName))
54
+ .parse();
55
55
  }
56
56
  /**
57
57
  * Get the field arguments for the field.
@@ -69,6 +69,20 @@ export class MachineSchemeFieldForge {
69
69
  get fieldType() {
70
70
  return this.forge?.fieldType;
71
71
  }
72
+ get inputSize() {
73
+ if (this.forge?.inputSize)
74
+ return this.forge.inputSize;
75
+ const ft = this.forge?.fieldType ?? '';
76
+ if (ft === 'text-area' || ft === 'text-full')
77
+ return 'full';
78
+ if (ft === 'text-xs')
79
+ return 'xs';
80
+ if (ft === 'text-sm')
81
+ return 'sm';
82
+ if (ft === 'text-lg' || ft === 'text-long')
83
+ return 'lg';
84
+ return undefined;
85
+ }
72
86
  /**
73
87
  * will return text.inputBase for ['url', 'email', 'number', 'date', 'time', 'datetime', 'phone', 'password']
74
88
  */
@@ -78,24 +92,22 @@ export class MachineSchemeFieldForge {
78
92
  * @return {string | 'text' | 'area'} The HTML input type.
79
93
  */
80
94
  get htmlInputType() {
81
- const variant = this?.fieldType?.split("text-")?.[1] ?? this.fieldType;
82
- if (variant === "area")
95
+ const ft = this.forge?.fieldType ?? '';
96
+ if (ft === 'image')
97
+ return 'file';
98
+ if (ft === 'color')
99
+ return 'color';
100
+ if (ft === 'icon')
101
+ return 'icon';
102
+ const variant = ft.split('text-')?.[1] ?? ft;
103
+ if (variant === 'area')
83
104
  return variant;
84
- if (this.forge?.fieldType?.startsWith("text-"))
85
- return "text";
86
- if ([
87
- "url",
88
- "email",
89
- "number",
90
- "date",
91
- "time",
92
- "datetime",
93
- "phone",
94
- "password",
95
- ].includes(this.forge?.fieldType ?? "")) {
96
- return this.forge?.fieldType?.trim?.() ?? "text";
105
+ if (ft.startsWith('text-'))
106
+ return 'text';
107
+ if (['url', 'email', 'number', 'date', 'time', 'datetime', 'phone', 'password'].includes(ft)) {
108
+ return ft.trim() || 'text';
97
109
  }
98
- return "text";
110
+ return 'text';
99
111
  }
100
112
  /**
101
113
  * Get the raw data object for the field.
@@ -119,7 +131,7 @@ export class MachineSchemeFieldForge {
119
131
  * Iterate over an object field and return field metadata for each property.
120
132
  * @role Object field iteration
121
133
  * @param {string} fieldName The field name.
122
- * @param {Record<string, any>} data The object data.
134
+ * @param {Record<string, unknown>} data The object data.
123
135
  * @return {IDbForge[]} Array of field metadata objects for each property.
124
136
  */
125
137
  iterateObject(fieldName, data) {
@@ -1,6 +1,5 @@
1
- import type { TplCollectionName } from "@medyll/idae-idbql";
2
- import { MachineSchemeValues } from "./MachineSchemeValues.js";
3
- import type { IDbForge } from "../machineParserForge.js";
1
+ import type { TplCollectionName, IDbForge } from '../../types/index.js';
2
+ import { MachineSchemeValues } from './MachineSchemeValues.js';
4
3
  /**
5
4
  * @class MachineSchemeFieldValues
6
5
  * @role Utility class for introspecting and formatting field values for a given collection and data object.
@@ -19,7 +18,7 @@ import type { IDbForge } from "../machineParserForge.js";
19
18
  *
20
19
  * @template T The type of the data object for the collection.
21
20
  */
22
- export declare class MachineSchemeFieldValues<T extends Record<string, any>> {
21
+ export declare class MachineSchemeFieldValues<T extends Record<string, unknown>> {
23
22
  #private;
24
23
  /**
25
24
  * Returns the IDbForge metadata for a given field name.
@@ -42,14 +41,14 @@ export declare class MachineSchemeFieldValues<T extends Record<string, any>> {
42
41
  * @param {keyof T} fieldName The field name.
43
42
  * @return {string | string[]} The formatted value or array of formatted values.
44
43
  */
45
- format(fieldName: keyof T): string | string[];
44
+ format(fieldName: keyof T): string | string[] | unknown[];
46
45
  /**
47
46
  * Get input attributes for a field.
48
47
  * @role Input attribute generation
49
48
  * @param {keyof T} fieldName The field name.
50
49
  * @return {any} The input attributes for the field.
51
50
  */
52
- getInputDataSet(fieldName: keyof T): Record<"data-collection" | "data-collectionId" | "data-fieldName" | "data-fieldType" | "data-fieldArgs", string>;
51
+ getInputDataSet(fieldName: keyof T): Record<string, unknown> | undefined;
53
52
  /**
54
53
  * Iterate over an array field and return field metadata for each item.
55
54
  * @role Array field iteration
@@ -57,13 +56,13 @@ export declare class MachineSchemeFieldValues<T extends Record<string, any>> {
57
56
  * @param {any[]} data The array data.
58
57
  * @return {IDbForge[]} Array of field metadata objects for each item.
59
58
  */
60
- iterateArray(fieldName: string, data: any[]): IDbForge[];
59
+ iterateArray(fieldName: string, data: unknown[]): unknown[];
61
60
  /**
62
61
  * Iterate over an object field and return field metadata for each property.
63
62
  * @role Object field iteration
64
63
  * @param {string} fieldName The field name.
65
- * @param {Record<string, any>} data The object data.
64
+ * @param {Record<string, unknown>} data The object data.
66
65
  * @return {IDbForge[]} Array of field metadata objects for each property.
67
66
  */
68
- iterateObject(fieldName: string, data: Record<string, any>): IDbForge[];
67
+ iterateObject(fieldName: string, data: Record<string, unknown>): IDbForge[];
69
68
  }
@@ -1,5 +1,5 @@
1
- import { MachineSchemeValues } from "./MachineSchemeValues.js";
2
- import { machine } from "../machine.js";
1
+ import { MachineSchemeValues } from './MachineSchemeValues.js';
2
+ import { machine } from '../machine.js';
3
3
  /**
4
4
  * @class MachineSchemeFieldValues
5
5
  * @role Utility class for introspecting and formatting field values for a given collection and data object.
@@ -31,7 +31,8 @@ export class MachineSchemeFieldValues {
31
31
  getForge(fieldName) {
32
32
  return this.#collectionValues.machine
33
33
  .collection(this.#collection)
34
- .field(fieldName).parse();
34
+ .field(String(fieldName))
35
+ .parse();
35
36
  }
36
37
  /**
37
38
  * Create a new IDbCollectionFieldValues instance.
@@ -42,8 +43,7 @@ export class MachineSchemeFieldValues {
42
43
  */
43
44
  constructor(collection, data, collectionValues) {
44
45
  this.#collection = collection;
45
- this.#collectionValues =
46
- collectionValues ?? new MachineSchemeValues(collection, machine);
46
+ this.#collectionValues = collectionValues ?? new MachineSchemeValues(collection, machine.logic);
47
47
  this.#data = data;
48
48
  }
49
49
  /**
@@ -53,11 +53,14 @@ export class MachineSchemeFieldValues {
53
53
  * @return {string | string[]} The formatted value or array of formatted values.
54
54
  */
55
55
  format(fieldName) {
56
- const fieldInfo = this.#collectionValues.machine.collection(this.#collection).field(fieldName).parse();
57
- if (fieldInfo?.is === "array") {
56
+ const fieldInfo = this.#collectionValues.machine
57
+ .collection(this.#collection)
58
+ .field(String(fieldName))
59
+ .parse();
60
+ if (fieldInfo?.is === 'array') {
58
61
  return this.iterateArray(String(fieldName), this.#data);
59
62
  }
60
- if (fieldInfo?.is === "object") {
63
+ if (fieldInfo?.is === 'object') {
61
64
  return this.iterateObject(String(fieldName), this.#data);
62
65
  }
63
66
  return this.#collectionValues.format(fieldName, this.#data);
@@ -85,7 +88,7 @@ export class MachineSchemeFieldValues {
85
88
  * Iterate over an object field and return field metadata for each property.
86
89
  * @role Object field iteration
87
90
  * @param {string} fieldName The field name.
88
- * @param {Record<string, any>} data The object data.
91
+ * @param {Record<string, unknown>} data The object data.
89
92
  * @return {IDbForge[]} Array of field metadata objects for each property.
90
93
  */
91
94
  iterateObject(fieldName, data) {