@cohesivesystems/presentation-core 0.1.0-alpha.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 (447) hide show
  1. package/LICENSE +55 -0
  2. package/dist/api-scope-request.d.ts +43 -0
  3. package/dist/api-scope-request.d.ts.map +1 -0
  4. package/dist/api-scope-request.js +96 -0
  5. package/dist/api-scope-request.js.map +1 -0
  6. package/dist/collection-chrome-icons.d.ts +18 -0
  7. package/dist/collection-chrome-icons.d.ts.map +1 -0
  8. package/dist/collection-chrome-icons.js +57 -0
  9. package/dist/collection-chrome-icons.js.map +1 -0
  10. package/dist/collection-chrome-runtime.d.ts +25 -0
  11. package/dist/collection-chrome-runtime.d.ts.map +1 -0
  12. package/dist/collection-chrome-runtime.js +72 -0
  13. package/dist/collection-chrome-runtime.js.map +1 -0
  14. package/dist/collection-chrome-slot-renderer-registry.d.ts +110 -0
  15. package/dist/collection-chrome-slot-renderer-registry.d.ts.map +1 -0
  16. package/dist/collection-chrome-slot-renderer-registry.js +136 -0
  17. package/dist/collection-chrome-slot-renderer-registry.js.map +1 -0
  18. package/dist/collection-selection-state.d.ts +18 -0
  19. package/dist/collection-selection-state.d.ts.map +1 -0
  20. package/dist/collection-selection-state.js +2 -0
  21. package/dist/collection-selection-state.js.map +1 -0
  22. package/dist/data-source-projection.d.ts +475 -0
  23. package/dist/data-source-projection.d.ts.map +1 -0
  24. package/dist/data-source-projection.js +880 -0
  25. package/dist/data-source-projection.js.map +1 -0
  26. package/dist/data-source-query-lowering.d.ts +35 -0
  27. package/dist/data-source-query-lowering.d.ts.map +1 -0
  28. package/dist/data-source-query-lowering.js +104 -0
  29. package/dist/data-source-query-lowering.js.map +1 -0
  30. package/dist/date-time-filter-model.d.ts +20 -0
  31. package/dist/date-time-filter-model.d.ts.map +1 -0
  32. package/dist/date-time-filter-model.js +115 -0
  33. package/dist/date-time-filter-model.js.map +1 -0
  34. package/dist/document-badge-icons.d.ts +4 -0
  35. package/dist/document-badge-icons.d.ts.map +1 -0
  36. package/dist/document-badge-icons.js +4 -0
  37. package/dist/document-badge-icons.js.map +1 -0
  38. package/dist/document-module.d.ts +268 -0
  39. package/dist/document-module.d.ts.map +1 -0
  40. package/dist/document-module.js +347 -0
  41. package/dist/document-module.js.map +1 -0
  42. package/dist/document-summary-model.d.ts +2 -0
  43. package/dist/document-summary-model.d.ts.map +1 -0
  44. package/dist/document-summary-model.js +2 -0
  45. package/dist/document-summary-model.js.map +1 -0
  46. package/dist/document-workspace-chrome-projection.d.ts +18 -0
  47. package/dist/document-workspace-chrome-projection.d.ts.map +1 -0
  48. package/dist/document-workspace-chrome-projection.js +35 -0
  49. package/dist/document-workspace-chrome-projection.js.map +1 -0
  50. package/dist/document-workspace-surface-slots.d.ts +75 -0
  51. package/dist/document-workspace-surface-slots.d.ts.map +1 -0
  52. package/dist/document-workspace-surface-slots.js +268 -0
  53. package/dist/document-workspace-surface-slots.js.map +1 -0
  54. package/dist/endpoint-executor.d.ts +62 -0
  55. package/dist/endpoint-executor.d.ts.map +1 -0
  56. package/dist/endpoint-executor.js +35 -0
  57. package/dist/endpoint-executor.js.map +1 -0
  58. package/dist/field-display-resolution.d.ts +5 -0
  59. package/dist/field-display-resolution.d.ts.map +1 -0
  60. package/dist/field-display-resolution.js +50 -0
  61. package/dist/field-display-resolution.js.map +1 -0
  62. package/dist/index.d.ts +90 -0
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +89 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/module.d.ts +48 -0
  67. package/dist/module.d.ts.map +1 -0
  68. package/dist/module.js +108 -0
  69. package/dist/module.js.map +1 -0
  70. package/dist/navigation-shell-frame-renderer-registry.d.ts +12 -0
  71. package/dist/navigation-shell-frame-renderer-registry.d.ts.map +1 -0
  72. package/dist/navigation-shell-frame-renderer-registry.js +29 -0
  73. package/dist/navigation-shell-frame-renderer-registry.js.map +1 -0
  74. package/dist/navigation-shell-layout-runtime.d.ts +29 -0
  75. package/dist/navigation-shell-layout-runtime.d.ts.map +1 -0
  76. package/dist/navigation-shell-layout-runtime.js +50 -0
  77. package/dist/navigation-shell-layout-runtime.js.map +1 -0
  78. package/dist/navigation-shell-region-component-registry.d.ts +96 -0
  79. package/dist/navigation-shell-region-component-registry.d.ts.map +1 -0
  80. package/dist/navigation-shell-region-component-registry.js +108 -0
  81. package/dist/navigation-shell-region-component-registry.js.map +1 -0
  82. package/dist/navigation-shell-runtime.d.ts +48 -0
  83. package/dist/navigation-shell-runtime.d.ts.map +1 -0
  84. package/dist/navigation-shell-runtime.js +457 -0
  85. package/dist/navigation-shell-runtime.js.map +1 -0
  86. package/dist/navigation-shell-slot-renderer-registry.d.ts +15 -0
  87. package/dist/navigation-shell-slot-renderer-registry.d.ts.map +1 -0
  88. package/dist/navigation-shell-slot-renderer-registry.js +48 -0
  89. package/dist/navigation-shell-slot-renderer-registry.js.map +1 -0
  90. package/dist/navigation.d.ts +84 -0
  91. package/dist/navigation.d.ts.map +1 -0
  92. package/dist/navigation.js +167 -0
  93. package/dist/navigation.js.map +1 -0
  94. package/dist/object-path.d.ts +23 -0
  95. package/dist/object-path.d.ts.map +1 -0
  96. package/dist/object-path.js +63 -0
  97. package/dist/object-path.js.map +1 -0
  98. package/dist/page-host-renderer-registry.d.ts +119 -0
  99. package/dist/page-host-renderer-registry.d.ts.map +1 -0
  100. package/dist/page-host-renderer-registry.js +305 -0
  101. package/dist/page-host-renderer-registry.js.map +1 -0
  102. package/dist/presentation-action-endpoint-request-projection.d.ts +23 -0
  103. package/dist/presentation-action-endpoint-request-projection.d.ts.map +1 -0
  104. package/dist/presentation-action-endpoint-request-projection.js +117 -0
  105. package/dist/presentation-action-endpoint-request-projection.js.map +1 -0
  106. package/dist/presentation-action-endpoint.d.ts +24 -0
  107. package/dist/presentation-action-endpoint.d.ts.map +1 -0
  108. package/dist/presentation-action-endpoint.js +56 -0
  109. package/dist/presentation-action-endpoint.js.map +1 -0
  110. package/dist/presentation-action-icons.d.ts +4 -0
  111. package/dist/presentation-action-icons.d.ts.map +1 -0
  112. package/dist/presentation-action-icons.js +4 -0
  113. package/dist/presentation-action-icons.js.map +1 -0
  114. package/dist/presentation-action-result-state.d.ts +48 -0
  115. package/dist/presentation-action-result-state.d.ts.map +1 -0
  116. package/dist/presentation-action-result-state.js +109 -0
  117. package/dist/presentation-action-result-state.js.map +1 -0
  118. package/dist/presentation-action-runtime-binding.d.ts +48 -0
  119. package/dist/presentation-action-runtime-binding.d.ts.map +1 -0
  120. package/dist/presentation-action-runtime-binding.js +52 -0
  121. package/dist/presentation-action-runtime-binding.js.map +1 -0
  122. package/dist/presentation-action-runtime-diagnostics.d.ts +18 -0
  123. package/dist/presentation-action-runtime-diagnostics.d.ts.map +1 -0
  124. package/dist/presentation-action-runtime-diagnostics.js +69 -0
  125. package/dist/presentation-action-runtime-diagnostics.js.map +1 -0
  126. package/dist/presentation-action-runtime-labels.d.ts +15 -0
  127. package/dist/presentation-action-runtime-labels.d.ts.map +1 -0
  128. package/dist/presentation-action-runtime-labels.js +28 -0
  129. package/dist/presentation-action-runtime-labels.js.map +1 -0
  130. package/dist/presentation-action-runtime-projection.d.ts +17 -0
  131. package/dist/presentation-action-runtime-projection.d.ts.map +1 -0
  132. package/dist/presentation-action-runtime-projection.js +31 -0
  133. package/dist/presentation-action-runtime-projection.js.map +1 -0
  134. package/dist/presentation-badge-resolution.d.ts +8 -0
  135. package/dist/presentation-badge-resolution.d.ts.map +1 -0
  136. package/dist/presentation-badge-resolution.js +73 -0
  137. package/dist/presentation-badge-resolution.js.map +1 -0
  138. package/dist/presentation-collection-pagination.d.ts +32 -0
  139. package/dist/presentation-collection-pagination.d.ts.map +1 -0
  140. package/dist/presentation-collection-pagination.js +275 -0
  141. package/dist/presentation-collection-pagination.js.map +1 -0
  142. package/dist/presentation-content-diagnostics.d.ts +17 -0
  143. package/dist/presentation-content-diagnostics.d.ts.map +1 -0
  144. package/dist/presentation-content-diagnostics.js +61 -0
  145. package/dist/presentation-content-diagnostics.js.map +1 -0
  146. package/dist/presentation-content-resolution.d.ts +9 -0
  147. package/dist/presentation-content-resolution.d.ts.map +1 -0
  148. package/dist/presentation-content-resolution.js +19 -0
  149. package/dist/presentation-content-resolution.js.map +1 -0
  150. package/dist/presentation-data-source-binding-model.d.ts +81 -0
  151. package/dist/presentation-data-source-binding-model.d.ts.map +1 -0
  152. package/dist/presentation-data-source-binding-model.js +56 -0
  153. package/dist/presentation-data-source-binding-model.js.map +1 -0
  154. package/dist/presentation-data-source-runtime.d.ts +62 -0
  155. package/dist/presentation-data-source-runtime.d.ts.map +1 -0
  156. package/dist/presentation-data-source-runtime.js +80 -0
  157. package/dist/presentation-data-source-runtime.js.map +1 -0
  158. package/dist/presentation-design-intent-diagnostics.d.ts +25 -0
  159. package/dist/presentation-design-intent-diagnostics.d.ts.map +1 -0
  160. package/dist/presentation-design-intent-diagnostics.js +55 -0
  161. package/dist/presentation-design-intent-diagnostics.js.map +1 -0
  162. package/dist/presentation-icon-diagnostics.d.ts +45 -0
  163. package/dist/presentation-icon-diagnostics.d.ts.map +1 -0
  164. package/dist/presentation-icon-diagnostics.js +235 -0
  165. package/dist/presentation-icon-diagnostics.js.map +1 -0
  166. package/dist/presentation-icon-registry.d.ts +36 -0
  167. package/dist/presentation-icon-registry.d.ts.map +1 -0
  168. package/dist/presentation-icon-registry.js +81 -0
  169. package/dist/presentation-icon-registry.js.map +1 -0
  170. package/dist/presentation-navigation-action-runtime-bindings.d.ts +13 -0
  171. package/dist/presentation-navigation-action-runtime-bindings.d.ts.map +1 -0
  172. package/dist/presentation-navigation-action-runtime-bindings.js +29 -0
  173. package/dist/presentation-navigation-action-runtime-bindings.js.map +1 -0
  174. package/dist/presentation-pagination.d.ts +98 -0
  175. package/dist/presentation-pagination.d.ts.map +1 -0
  176. package/dist/presentation-pagination.js +427 -0
  177. package/dist/presentation-pagination.js.map +1 -0
  178. package/dist/presentation-projection-coverage.d.ts +38 -0
  179. package/dist/presentation-projection-coverage.d.ts.map +1 -0
  180. package/dist/presentation-projection-coverage.js +2429 -0
  181. package/dist/presentation-projection-coverage.js.map +1 -0
  182. package/dist/presentation-projection-diagnostics.d.ts +33 -0
  183. package/dist/presentation-projection-diagnostics.d.ts.map +1 -0
  184. package/dist/presentation-projection-diagnostics.js +17 -0
  185. package/dist/presentation-projection-diagnostics.js.map +1 -0
  186. package/dist/presentation-projection-trace.d.ts +97 -0
  187. package/dist/presentation-projection-trace.d.ts.map +1 -0
  188. package/dist/presentation-projection-trace.js +110 -0
  189. package/dist/presentation-projection-trace.js.map +1 -0
  190. package/dist/presentation-query-form-state.d.ts +15 -0
  191. package/dist/presentation-query-form-state.d.ts.map +1 -0
  192. package/dist/presentation-query-form-state.js +20 -0
  193. package/dist/presentation-query-form-state.js.map +1 -0
  194. package/dist/presentation-renderer-registry.d.ts +86 -0
  195. package/dist/presentation-renderer-registry.d.ts.map +1 -0
  196. package/dist/presentation-renderer-registry.js +108 -0
  197. package/dist/presentation-renderer-registry.js.map +1 -0
  198. package/dist/presentation-semantics.d.ts +288 -0
  199. package/dist/presentation-semantics.d.ts.map +1 -0
  200. package/dist/presentation-semantics.js +560 -0
  201. package/dist/presentation-semantics.js.map +1 -0
  202. package/dist/presentation-standards.d.ts +8 -0
  203. package/dist/presentation-standards.d.ts.map +1 -0
  204. package/dist/presentation-standards.js +9 -0
  205. package/dist/presentation-standards.js.map +1 -0
  206. package/dist/presentation-test-selectors.d.ts +146 -0
  207. package/dist/presentation-test-selectors.d.ts.map +1 -0
  208. package/dist/presentation-test-selectors.js +113 -0
  209. package/dist/presentation-test-selectors.js.map +1 -0
  210. package/dist/presentation-value-formatting.d.ts +12 -0
  211. package/dist/presentation-value-formatting.d.ts.map +1 -0
  212. package/dist/presentation-value-formatting.js +33 -0
  213. package/dist/presentation-value-formatting.js.map +1 -0
  214. package/dist/presentation-value-resolution.d.ts +7 -0
  215. package/dist/presentation-value-resolution.d.ts.map +1 -0
  216. package/dist/presentation-value-resolution.js +69 -0
  217. package/dist/presentation-value-resolution.js.map +1 -0
  218. package/dist/presentation-view-tree.d.ts +6 -0
  219. package/dist/presentation-view-tree.d.ts.map +1 -0
  220. package/dist/presentation-view-tree.js +15 -0
  221. package/dist/presentation-view-tree.js.map +1 -0
  222. package/dist/process-task-model.d.ts +80 -0
  223. package/dist/process-task-model.d.ts.map +1 -0
  224. package/dist/process-task-model.js +52 -0
  225. package/dist/process-task-model.js.map +1 -0
  226. package/dist/process-task-projection.d.ts +46 -0
  227. package/dist/process-task-projection.d.ts.map +1 -0
  228. package/dist/process-task-projection.js +233 -0
  229. package/dist/process-task-projection.js.map +1 -0
  230. package/dist/projected-action-status-projection.d.ts +18 -0
  231. package/dist/projected-action-status-projection.d.ts.map +1 -0
  232. package/dist/projected-action-status-projection.js +19 -0
  233. package/dist/projected-action-status-projection.js.map +1 -0
  234. package/dist/projected-activity-state-model.d.ts +22 -0
  235. package/dist/projected-activity-state-model.d.ts.map +1 -0
  236. package/dist/projected-activity-state-model.js +87 -0
  237. package/dist/projected-activity-state-model.js.map +1 -0
  238. package/dist/projected-collection-action-runtime-bindings.d.ts +12 -0
  239. package/dist/projected-collection-action-runtime-bindings.d.ts.map +1 -0
  240. package/dist/projected-collection-action-runtime-bindings.js +37 -0
  241. package/dist/projected-collection-action-runtime-bindings.js.map +1 -0
  242. package/dist/projected-collection-action-runtime-diagnostics.d.ts +23 -0
  243. package/dist/projected-collection-action-runtime-diagnostics.d.ts.map +1 -0
  244. package/dist/projected-collection-action-runtime-diagnostics.js +168 -0
  245. package/dist/projected-collection-action-runtime-diagnostics.js.map +1 -0
  246. package/dist/projected-collection-runtime.d.ts +475 -0
  247. package/dist/projected-collection-runtime.d.ts.map +1 -0
  248. package/dist/projected-collection-runtime.js +832 -0
  249. package/dist/projected-collection-runtime.js.map +1 -0
  250. package/dist/projected-document-action-diagnostics.d.ts +16 -0
  251. package/dist/projected-document-action-diagnostics.d.ts.map +1 -0
  252. package/dist/projected-document-action-diagnostics.js +113 -0
  253. package/dist/projected-document-action-diagnostics.js.map +1 -0
  254. package/dist/projected-document-action-enablements.d.ts +25 -0
  255. package/dist/projected-document-action-enablements.d.ts.map +1 -0
  256. package/dist/projected-document-action-enablements.js +38 -0
  257. package/dist/projected-document-action-enablements.js.map +1 -0
  258. package/dist/projected-document-action-projection.d.ts +45 -0
  259. package/dist/projected-document-action-projection.d.ts.map +1 -0
  260. package/dist/projected-document-action-projection.js +201 -0
  261. package/dist/projected-document-action-projection.js.map +1 -0
  262. package/dist/projected-document-action-runtime-profile-diagnostics.d.ts +16 -0
  263. package/dist/projected-document-action-runtime-profile-diagnostics.d.ts.map +1 -0
  264. package/dist/projected-document-action-runtime-profile-diagnostics.js +168 -0
  265. package/dist/projected-document-action-runtime-profile-diagnostics.js.map +1 -0
  266. package/dist/projected-document-action-runtime-profile.d.ts +64 -0
  267. package/dist/projected-document-action-runtime-profile.d.ts.map +1 -0
  268. package/dist/projected-document-action-runtime-profile.js +33 -0
  269. package/dist/projected-document-action-runtime-profile.js.map +1 -0
  270. package/dist/projected-document-action-status-notice-diagnostics.d.ts +10 -0
  271. package/dist/projected-document-action-status-notice-diagnostics.d.ts.map +1 -0
  272. package/dist/projected-document-action-status-notice-diagnostics.js +64 -0
  273. package/dist/projected-document-action-status-notice-diagnostics.js.map +1 -0
  274. package/dist/projected-document-badge-formatting.d.ts +2 -0
  275. package/dist/projected-document-badge-formatting.d.ts.map +1 -0
  276. package/dist/projected-document-badge-formatting.js +7 -0
  277. package/dist/projected-document-badge-formatting.js.map +1 -0
  278. package/dist/projected-document-editor-model.d.ts +4 -0
  279. package/dist/projected-document-editor-model.d.ts.map +1 -0
  280. package/dist/projected-document-editor-model.js +2 -0
  281. package/dist/projected-document-editor-model.js.map +1 -0
  282. package/dist/projected-document-field-navigation.d.ts +72 -0
  283. package/dist/projected-document-field-navigation.d.ts.map +1 -0
  284. package/dist/projected-document-field-navigation.js +143 -0
  285. package/dist/projected-document-field-navigation.js.map +1 -0
  286. package/dist/projected-document-field-semantics.d.ts +5 -0
  287. package/dist/projected-document-field-semantics.d.ts.map +1 -0
  288. package/dist/projected-document-field-semantics.js +16 -0
  289. package/dist/projected-document-field-semantics.js.map +1 -0
  290. package/dist/projected-document-workspace-data-source-bindings.d.ts +69 -0
  291. package/dist/projected-document-workspace-data-source-bindings.d.ts.map +1 -0
  292. package/dist/projected-document-workspace-data-source-bindings.js +81 -0
  293. package/dist/projected-document-workspace-data-source-bindings.js.map +1 -0
  294. package/dist/projected-document-workspace-notice-diagnostics.d.ts +12 -0
  295. package/dist/projected-document-workspace-notice-diagnostics.d.ts.map +1 -0
  296. package/dist/projected-document-workspace-notice-diagnostics.js +13 -0
  297. package/dist/projected-document-workspace-notice-diagnostics.js.map +1 -0
  298. package/dist/projected-input-form-runtime.d.ts +62 -0
  299. package/dist/projected-input-form-runtime.d.ts.map +1 -0
  300. package/dist/projected-input-form-runtime.js +2 -0
  301. package/dist/projected-input-form-runtime.js.map +1 -0
  302. package/dist/projected-process-task-notice-diagnostics.d.ts +13 -0
  303. package/dist/projected-process-task-notice-diagnostics.d.ts.map +1 -0
  304. package/dist/projected-process-task-notice-diagnostics.js +170 -0
  305. package/dist/projected-process-task-notice-diagnostics.js.map +1 -0
  306. package/dist/projected-query-form-runtime.d.ts +46 -0
  307. package/dist/projected-query-form-runtime.d.ts.map +1 -0
  308. package/dist/projected-query-form-runtime.js +2 -0
  309. package/dist/projected-query-form-runtime.js.map +1 -0
  310. package/dist/prompt-document-preview-projection.d.ts +46 -0
  311. package/dist/prompt-document-preview-projection.d.ts.map +1 -0
  312. package/dist/prompt-document-preview-projection.js +173 -0
  313. package/dist/prompt-document-preview-projection.js.map +1 -0
  314. package/dist/prompt-icons.d.ts +4 -0
  315. package/dist/prompt-icons.d.ts.map +1 -0
  316. package/dist/prompt-icons.js +4 -0
  317. package/dist/prompt-icons.js.map +1 -0
  318. package/dist/prompt-status-message-resolution.d.ts +18 -0
  319. package/dist/prompt-status-message-resolution.d.ts.map +1 -0
  320. package/dist/prompt-status-message-resolution.js +83 -0
  321. package/dist/prompt-status-message-resolution.js.map +1 -0
  322. package/dist/query-form-lowering.d.ts +16 -0
  323. package/dist/query-form-lowering.d.ts.map +1 -0
  324. package/dist/query-form-lowering.js +38 -0
  325. package/dist/query-form-lowering.js.map +1 -0
  326. package/dist/query-form-url-state.d.ts +44 -0
  327. package/dist/query-form-url-state.d.ts.map +1 -0
  328. package/dist/query-form-url-state.js +197 -0
  329. package/dist/query-form-url-state.js.map +1 -0
  330. package/dist/query-offset-page.d.ts +13 -0
  331. package/dist/query-offset-page.d.ts.map +1 -0
  332. package/dist/query-offset-page.js +24 -0
  333. package/dist/query-offset-page.js.map +1 -0
  334. package/dist/relation-query-input-form-target.d.ts +10 -0
  335. package/dist/relation-query-input-form-target.d.ts.map +1 -0
  336. package/dist/relation-query-input-form-target.js +30 -0
  337. package/dist/relation-query-input-form-target.js.map +1 -0
  338. package/dist/scope-selection.d.ts +94 -0
  339. package/dist/scope-selection.d.ts.map +1 -0
  340. package/dist/scope-selection.js +95 -0
  341. package/dist/scope-selection.js.map +1 -0
  342. package/dist/target-bindings.d.ts +39 -0
  343. package/dist/target-bindings.d.ts.map +1 -0
  344. package/dist/target-bindings.js +40 -0
  345. package/dist/target-bindings.js.map +1 -0
  346. package/dist/view-chrome-content-diagnostics.d.ts +8 -0
  347. package/dist/view-chrome-content-diagnostics.d.ts.map +1 -0
  348. package/dist/view-chrome-content-diagnostics.js +84 -0
  349. package/dist/view-chrome-content-diagnostics.js.map +1 -0
  350. package/dist/view-chrome-icons.d.ts +12 -0
  351. package/dist/view-chrome-icons.d.ts.map +1 -0
  352. package/dist/view-chrome-icons.js +50 -0
  353. package/dist/view-chrome-icons.js.map +1 -0
  354. package/dist/view-chrome-slot-renderer-registry.d.ts +19 -0
  355. package/dist/view-chrome-slot-renderer-registry.d.ts.map +1 -0
  356. package/dist/view-chrome-slot-renderer-registry.js +62 -0
  357. package/dist/view-chrome-slot-renderer-registry.js.map +1 -0
  358. package/package.json +53 -0
  359. package/src/api-scope-request.ts +186 -0
  360. package/src/collection-chrome-icons.ts +89 -0
  361. package/src/collection-chrome-runtime.ts +151 -0
  362. package/src/collection-chrome-slot-renderer-registry.ts +227 -0
  363. package/src/collection-selection-state.ts +32 -0
  364. package/src/data-source-projection.ts +2149 -0
  365. package/src/data-source-query-lowering.ts +217 -0
  366. package/src/date-time-filter-model.ts +156 -0
  367. package/src/document-badge-icons.ts +3 -0
  368. package/src/document-module.ts +741 -0
  369. package/src/document-summary-model.ts +1 -0
  370. package/src/document-workspace-chrome-projection.ts +62 -0
  371. package/src/document-workspace-surface-slots.ts +458 -0
  372. package/src/endpoint-executor.ts +122 -0
  373. package/src/field-display-resolution.ts +99 -0
  374. package/src/index.ts +104 -0
  375. package/src/module.ts +281 -0
  376. package/src/navigation-shell-frame-renderer-registry.ts +65 -0
  377. package/src/navigation-shell-layout-runtime.ts +124 -0
  378. package/src/navigation-shell-region-component-registry.ts +242 -0
  379. package/src/navigation-shell-runtime.ts +579 -0
  380. package/src/navigation-shell-slot-renderer-registry.ts +94 -0
  381. package/src/navigation.ts +364 -0
  382. package/src/object-path.ts +99 -0
  383. package/src/page-host-renderer-registry.ts +615 -0
  384. package/src/presentation-action-endpoint-request-projection.ts +223 -0
  385. package/src/presentation-action-endpoint.ts +130 -0
  386. package/src/presentation-action-icons.ts +3 -0
  387. package/src/presentation-action-result-state.ts +189 -0
  388. package/src/presentation-action-runtime-binding.ts +177 -0
  389. package/src/presentation-action-runtime-diagnostics.ts +120 -0
  390. package/src/presentation-action-runtime-labels.ts +57 -0
  391. package/src/presentation-action-runtime-projection.ts +67 -0
  392. package/src/presentation-badge-resolution.ts +138 -0
  393. package/src/presentation-collection-pagination.ts +436 -0
  394. package/src/presentation-content-diagnostics.ts +121 -0
  395. package/src/presentation-content-resolution.ts +46 -0
  396. package/src/presentation-data-source-binding-model.ts +140 -0
  397. package/src/presentation-data-source-runtime.ts +190 -0
  398. package/src/presentation-design-intent-diagnostics.ts +104 -0
  399. package/src/presentation-icon-diagnostics.ts +368 -0
  400. package/src/presentation-icon-registry.ts +181 -0
  401. package/src/presentation-navigation-action-runtime-bindings.ts +54 -0
  402. package/src/presentation-pagination.ts +694 -0
  403. package/src/presentation-projection-coverage.ts +3257 -0
  404. package/src/presentation-projection-diagnostics.ts +71 -0
  405. package/src/presentation-projection-trace.ts +293 -0
  406. package/src/presentation-query-form-state.ts +54 -0
  407. package/src/presentation-renderer-registry.ts +269 -0
  408. package/src/presentation-semantics.ts +1028 -0
  409. package/src/presentation-standards.ts +14 -0
  410. package/src/presentation-test-selectors.ts +312 -0
  411. package/src/presentation-value-formatting.ts +65 -0
  412. package/src/presentation-value-resolution.ts +100 -0
  413. package/src/presentation-view-tree.ts +33 -0
  414. package/src/process-task-model.ts +158 -0
  415. package/src/process-task-projection.ts +398 -0
  416. package/src/projected-action-status-projection.ts +43 -0
  417. package/src/projected-activity-state-model.ts +123 -0
  418. package/src/projected-collection-action-runtime-bindings.ts +76 -0
  419. package/src/projected-collection-action-runtime-diagnostics.ts +289 -0
  420. package/src/projected-collection-runtime.ts +1772 -0
  421. package/src/projected-document-action-diagnostics.ts +196 -0
  422. package/src/projected-document-action-enablements.ts +99 -0
  423. package/src/projected-document-action-projection.ts +464 -0
  424. package/src/projected-document-action-runtime-profile-diagnostics.ts +250 -0
  425. package/src/projected-document-action-runtime-profile.ts +133 -0
  426. package/src/projected-document-action-status-notice-diagnostics.ts +116 -0
  427. package/src/projected-document-badge-formatting.ts +7 -0
  428. package/src/projected-document-editor-model.ts +7 -0
  429. package/src/projected-document-field-navigation.ts +300 -0
  430. package/src/projected-document-field-semantics.ts +27 -0
  431. package/src/projected-document-workspace-data-source-bindings.ts +182 -0
  432. package/src/projected-document-workspace-notice-diagnostics.ts +41 -0
  433. package/src/projected-input-form-runtime.ts +86 -0
  434. package/src/projected-process-task-notice-diagnostics.ts +283 -0
  435. package/src/projected-query-form-runtime.ts +62 -0
  436. package/src/prompt-document-preview-projection.ts +345 -0
  437. package/src/prompt-icons.ts +3 -0
  438. package/src/prompt-status-message-resolution.ts +158 -0
  439. package/src/query-form-lowering.ts +77 -0
  440. package/src/query-form-url-state.ts +346 -0
  441. package/src/query-offset-page.ts +50 -0
  442. package/src/relation-query-input-form-target.ts +61 -0
  443. package/src/scope-selection.ts +201 -0
  444. package/src/target-bindings.ts +123 -0
  445. package/src/view-chrome-content-diagnostics.ts +139 -0
  446. package/src/view-chrome-icons.ts +81 -0
  447. package/src/view-chrome-slot-renderer-registry.ts +128 -0
@@ -0,0 +1,741 @@
1
+ import type {
2
+ ActionPlacementDefinition,
3
+ DataSourceDefinition,
4
+ DocumentActionStatusNoticeDefinition,
5
+ DocumentProcessTaskNoticeDefinition,
6
+ PresentationModuleDefinition,
7
+ ProcessTaskSelectorDefinition,
8
+ WorkspaceRefDefinition,
9
+ } from './module'
10
+ import type { PresentationDataSourceBinding } from './presentation-data-source-binding-model'
11
+ import {
12
+ projectPresentationDataSourceBindings,
13
+ type PresentationDataSourceBindingProjectionRegistry,
14
+ type PresentationDataSourceProjectionContext,
15
+ } from './data-source-projection'
16
+ import {
17
+ readPresentationFieldValue,
18
+ } from './presentation-value-resolution'
19
+ import type {
20
+ DataSourceRefDefinition,
21
+ DocumentActionRuntimeProfileDefinition,
22
+ DocumentDataSourceActivationPolicyDefinition,
23
+ DocumentAddressDefinition,
24
+ DocumentDataSourceRole,
25
+ DocumentIdentityDefinition,
26
+ DocumentMetricSourceDefinition,
27
+ PageHostDefinition,
28
+ } from '@cohesivesystems/presentation-contracts'
29
+ import {
30
+ dataSourceKinds,
31
+ documentKindLabels,
32
+ documentDataSourceRoles,
33
+ documentDataSourceRoleLabels,
34
+ } from '@cohesivesystems/presentation-contracts'
35
+
36
+ /**
37
+ * Frontend projection of a backend document profile.
38
+ *
39
+ * A document profile describes the semantic document being edited or viewed,
40
+ * the document-kind discriminator, and the profile-scoped data sources that
41
+ * supply resource, metadata, summary, or auxiliary state.
42
+ */
43
+ export interface DocumentProfileProjection {
44
+ readonly Actions?: readonly ActionPlacementDefinition[]
45
+ readonly DataSources?: readonly DocumentProfileDataSourceProjection[]
46
+ readonly Document?: {
47
+ readonly Address?: DocumentAddressDefinition | null
48
+ readonly DataSource?: DataSourceRefDefinition | null
49
+ readonly Id?: string
50
+ readonly Identity?: DocumentIdentityDefinition | null
51
+ readonly Kind: string | number
52
+ } | null
53
+ readonly Id: string
54
+ readonly Name?: string
55
+ readonly MetricSources?: readonly DocumentMetricSourceDefinition[]
56
+ readonly ActionStatusNotices?: readonly DocumentActionStatusNoticeDefinition[]
57
+ readonly ActionRuntimeProfiles?: readonly DocumentActionRuntimeProfileDefinition[]
58
+ readonly ProcessTaskNotices?: readonly DocumentProcessTaskNoticeDefinition[]
59
+ readonly ProcessTaskSelectors?: readonly ProcessTaskSelectorDefinition[]
60
+ }
61
+
62
+ /**
63
+ * Runtime identity for a presentation document kind.
64
+ *
65
+ * The backend owns the enum value; this projection provides stable frontend
66
+ * text and key forms without requiring document-specific handwritten unions.
67
+ */
68
+ export interface ProjectedDocumentKind {
69
+ readonly id: string
70
+ readonly label: string
71
+ readonly value: string | number
72
+ }
73
+
74
+ /**
75
+ * Opaque runtime resource loaded for a document profile.
76
+ *
77
+ * Generic document helpers read identity, document payload, display metadata,
78
+ * and version metadata through DocumentWorkspaceResourceProjection instead of
79
+ * assuming product-specific property names.
80
+ */
81
+ export type ProjectedDocumentResource = Readonly<Record<string, unknown>>
82
+
83
+ /**
84
+ * Generic runtime projection for a document workspace profile.
85
+ *
86
+ * Product-specific workspaces can extend this with extra capabilities while
87
+ * relying on the shared document module for resource, summary, metadata, and
88
+ * editor-address interpretation.
89
+ */
90
+ export interface DocumentWorkspaceProfileProjection {
91
+ /** Data source that loads and saves the primary JSON document resource. */
92
+ readonly dataSourceId: string
93
+ /** Backend-declared document kind projected into stable runtime identity metadata. */
94
+ readonly documentKind: ProjectedDocumentKind
95
+ /** Stable editor URI shown for local preview/editor integrations. */
96
+ readonly editorPath: (resourceId: string) => string
97
+ /** Human-readable label for workspace chrome and fallback messages. */
98
+ readonly label: string
99
+ /** Optional metadata data source projection attached to the profile. */
100
+ readonly metadata?: DocumentWorkspaceMetadataProjection
101
+ /** Original document profile that produced this runtime projection. */
102
+ readonly profile: DocumentProfileProjection
103
+ /** Stable profile id used for document-instance and editor-state identity. */
104
+ readonly profileId: string
105
+ /** IR-derived field paths used to interpret otherwise opaque resource shapes. */
106
+ readonly resource: DocumentWorkspaceResourceProjection
107
+ /** Optional summary data source projection for header metrics. */
108
+ readonly summary?: DocumentWorkspaceSummaryProjection
109
+ }
110
+
111
+ /** Resource field-path projection for generic document workspace state. */
112
+ export interface DocumentWorkspaceResourceProjection {
113
+ readonly createdAtPath?: string | null
114
+ readonly documentPath: string
115
+ readonly idPath: string
116
+ readonly titlePath?: string | null
117
+ readonly updatedAtPath?: string | null
118
+ readonly versionPath?: string | null
119
+ }
120
+
121
+ /** Data source projection for resource metadata associated with a document. */
122
+ export interface DocumentWorkspaceMetadataProjection {
123
+ readonly dataSourceId: string
124
+ }
125
+
126
+ /**
127
+ * Summary projection for document header metrics.
128
+ *
129
+ * Field paths come from profile metric sources that target the summary data
130
+ * source, allowing summary rendering to stay profile-driven.
131
+ */
132
+ export interface DocumentWorkspaceSummaryProjection {
133
+ readonly dataSourceId: string
134
+ readonly fieldPaths: readonly string[]
135
+ }
136
+
137
+ /** Options for projecting a document profile into a workspace runtime shape. */
138
+ export interface ProjectDocumentWorkspaceProfileOptions {
139
+ /** URI scheme used when the profile does not declare a document source address template. */
140
+ readonly fallbackAddressScheme?: string
141
+ }
142
+
143
+ /**
144
+ * Profile-scoped reference to a presentation data source.
145
+ *
146
+ * The role and activation policy let a workspace decide which data sources
147
+ * should be bound for the current document state without hard-coding concrete
148
+ * resource types in React components.
149
+ */
150
+ export interface DocumentProfileDataSourceProjection {
151
+ readonly Activation?: DocumentDataSourceActivationPolicyDefinition | null
152
+ readonly DataSource: DataSourceRefDefinition
153
+ readonly Description?: string | null
154
+ readonly Id: string
155
+ readonly IsRequired: boolean
156
+ readonly Role: DocumentDataSourceRole
157
+ }
158
+
159
+ /** Metric source projection preserved from the presentation IR document profile. */
160
+ export type DocumentMetricSourceProjection = DocumentMetricSourceDefinition
161
+
162
+ /**
163
+ * Minimal workspace shape required by document-profile resolution.
164
+ *
165
+ * The generated presentation module may contain richer workspace definitions;
166
+ * these utilities only depend on the document-profile subset.
167
+ */
168
+ interface DocumentWorkspaceProjection {
169
+ readonly DefaultDocumentProfileId?: string | null
170
+ readonly DocumentProfiles: readonly DocumentProfileProjection[]
171
+ readonly Id: string
172
+ }
173
+
174
+ type DocumentWorkspaceRefProjection = Pick<
175
+ WorkspaceRefDefinition,
176
+ 'DocumentProfileId' | 'WorkspaceId'
177
+ >
178
+
179
+ /** Options for projecting active document-profile data sources into bindings. */
180
+ export interface ProjectDocumentProfileDataSourceBindingsOptions {
181
+ /** Current view/projection/route state used to evaluate activation policies. */
182
+ readonly activation?: DocumentDataSourceActivationState
183
+ /** Optional projection context forwarded to lower-level data-source binding projection. */
184
+ readonly context?: PresentationDataSourceProjectionContext
185
+ /** Presentation module that owns canonical data-source definitions. */
186
+ readonly module: PresentationModuleDefinition | null
187
+ /** Document profile whose scoped data sources should be projected. */
188
+ readonly profile: DocumentProfileProjection | null
189
+ /** Registry used to interpret concrete data-source binding kinds. */
190
+ readonly registry: PresentationDataSourceBindingProjectionRegistry
191
+ /** Optional role filter applied before activation and binding projection. */
192
+ readonly roles?: readonly DocumentDataSourceRole[]
193
+ }
194
+
195
+ /**
196
+ * Runtime state used to determine whether profile-scoped data sources are
197
+ * active for the current document view.
198
+ */
199
+ export interface DocumentDataSourceActivationState {
200
+ readonly activeLayoutModeId?: string | null
201
+ readonly activeProjectionId?: string | null
202
+ readonly activeViewId?: string | null
203
+ readonly routeParameters?: Readonly<Record<string, string | null | undefined>>
204
+ }
205
+
206
+ /**
207
+ * Resolves the document profile referenced by a page host.
208
+ *
209
+ * Page hosts refer to workspaces; workspaces own one or more document profiles.
210
+ * This helper follows that indirection and returns the selected profile, or
211
+ * null when the page host does not identify a usable document profile.
212
+ */
213
+ export function resolvePageHostDocumentProfile<TProfile extends DocumentProfileProjection>(
214
+ module: { readonly Workspaces: readonly DocumentWorkspaceProjection[] },
215
+ pageHost: Pick<PageHostDefinition, 'Workspace'>,
216
+ ): TProfile | null {
217
+ return resolveWorkspaceDocumentProfile(module, pageHost.Workspace ?? null)
218
+ }
219
+
220
+ /**
221
+ * Resolves the active document profile for a workspace reference.
222
+ *
223
+ * Selection order is explicit workspace-ref profile id, workspace default
224
+ * profile id, then the first profile declared on the workspace.
225
+ */
226
+ export function resolveWorkspaceDocumentProfile<TProfile extends DocumentProfileProjection>(
227
+ module: { readonly Workspaces: readonly DocumentWorkspaceProjection[] },
228
+ workspaceRef: DocumentWorkspaceRefProjection | null,
229
+ ): TProfile | null {
230
+ if (!workspaceRef) {
231
+ return null
232
+ }
233
+
234
+ const workspace = findDocumentWorkspace(module, workspaceRef.WorkspaceId)
235
+ if (!workspace) {
236
+ return null
237
+ }
238
+
239
+ const documentProfileId =
240
+ workspaceRef.DocumentProfileId ??
241
+ workspace.DefaultDocumentProfileId ??
242
+ workspace.DocumentProfiles?.[0]?.Id ??
243
+ null
244
+
245
+ return documentProfileId
246
+ ? ((workspace.DocumentProfiles?.find((profile) => profile.Id === documentProfileId) ??
247
+ null) as TProfile | null)
248
+ : null
249
+ }
250
+
251
+ /** Finds a document workspace by id from the presentation module workspace set. */
252
+ export function findDocumentWorkspace<TWorkspace extends DocumentWorkspaceProjection>(
253
+ module: { readonly Workspaces: readonly DocumentWorkspaceProjection[] },
254
+ workspaceId: string,
255
+ ): TWorkspace | null {
256
+ return (
257
+ (module.Workspaces?.find((workspace) => workspace.Id === workspaceId) as
258
+ | TWorkspace
259
+ | undefined) ?? null
260
+ )
261
+ }
262
+
263
+ /**
264
+ * Finds a profile data source by semantic role and optional profile-local id.
265
+ *
266
+ * Role matching accepts generated enum values, numeric values, and generated
267
+ * labels so callers are insulated from representation differences in emitted
268
+ * presentation IR.
269
+ */
270
+ export function findDocumentProfileDataSource(
271
+ profile: DocumentProfileProjection | null,
272
+ role: DocumentDataSourceRole,
273
+ id?: string,
274
+ ): DocumentProfileDataSourceProjection | null {
275
+ return profile?.DataSources?.find(
276
+ (dataSource) =>
277
+ isDocumentDataSourceRole(dataSource.Role, role) && (!id || dataSource.Id === id),
278
+ ) ?? null
279
+ }
280
+
281
+ /**
282
+ * Returns profile data sources, optionally filtered by semantic role.
283
+ *
284
+ * This does not evaluate activation policy; use
285
+ * projectDocumentProfileDataSourceBindings when the current view state matters.
286
+ */
287
+ export function getDocumentProfileDataSources(
288
+ profile: DocumentProfileProjection | null,
289
+ roles?: readonly DocumentDataSourceRole[],
290
+ ): readonly DocumentProfileDataSourceProjection[] {
291
+ const dataSources = profile?.DataSources ?? []
292
+ if (!roles?.length) {
293
+ return dataSources
294
+ }
295
+
296
+ const roleSet = new Set(roles)
297
+ return dataSources.filter((dataSource) =>
298
+ Array.from(roleSet).some((role) => isDocumentDataSourceRole(dataSource.Role, role)),
299
+ )
300
+ }
301
+
302
+ /** Returns data-source ids for the selected profile-scoped data-source roles. */
303
+ export function getDocumentProfileDataSourceIds(
304
+ profile: DocumentProfileProjection | null,
305
+ roles?: readonly DocumentDataSourceRole[],
306
+ ): readonly string[] {
307
+ return getDocumentProfileDataSources(profile, roles).map(
308
+ (dataSource) => dataSource.DataSource.DataSourceId,
309
+ )
310
+ }
311
+
312
+ /** Returns profile data sources marked as required by the backend profile. */
313
+ export function getRequiredDocumentProfileDataSources(
314
+ profile: DocumentProfileProjection | null,
315
+ ): readonly DocumentProfileDataSourceProjection[] {
316
+ return profile?.DataSources?.filter((dataSource) => dataSource.IsRequired) ?? []
317
+ }
318
+
319
+ /**
320
+ * Resolves route parameter names that can identify the profile's primary
321
+ * document resource.
322
+ *
323
+ * Resource identity should come from the resource data-source contract when it
324
+ * exists. Falling back to document identity keeps locally declared profiles
325
+ * usable even before their resource endpoint is modeled as a parameterized
326
+ * data source.
327
+ */
328
+ export function resolveDocumentProfileResourceRouteParameterNames(
329
+ module: Pick<PresentationModuleDefinition, 'DataSources'> | null,
330
+ profile: DocumentProfileProjection | null,
331
+ ): readonly string[] {
332
+ const resourceDataSource = findDocumentProfileDataSource(
333
+ profile,
334
+ documentDataSourceRoles.resource,
335
+ )
336
+ const dataSource = module?.DataSources?.find(
337
+ (candidate) => candidate.Id === resourceDataSource?.DataSource.DataSourceId,
338
+ )
339
+ const parameterNames = dataSource?.Parameters
340
+ ?.map((parameter) => parameter.Name?.trim() ?? '')
341
+ .filter((name) => name.length > 0) ?? []
342
+
343
+ if (parameterNames.length > 0) {
344
+ return parameterNames
345
+ }
346
+
347
+ const documentIdField = profile?.Document?.Identity?.DocumentIdField?.trim()
348
+ return documentIdField ? [lowercaseFirstCharacter(documentIdField)] : []
349
+ }
350
+
351
+ /** Returns the source-address template declared for the profile document. */
352
+ export function getDocumentSourceAddressTemplate(
353
+ profile: DocumentProfileProjection | null,
354
+ ) {
355
+ return profile?.Document?.Address?.Root ?? null
356
+ }
357
+
358
+ /** Projects the backend document kind into stable runtime identity metadata. */
359
+ export function projectDocumentKind(
360
+ profile: DocumentProfileProjection | null,
361
+ ): ProjectedDocumentKind | null {
362
+ const value = profile?.Document?.Kind
363
+ if (value === null || value === undefined) {
364
+ return null
365
+ }
366
+
367
+ const label = resolveDocumentKindLabel(value)
368
+ return {
369
+ id: toKebabCase(label ?? String(value)),
370
+ label: label ? formatPascalCaseLabel(label) : String(value),
371
+ value,
372
+ }
373
+ }
374
+
375
+ /**
376
+ * Projects a backend document profile into the generic runtime shape consumed
377
+ * by document-backed workspaces.
378
+ *
379
+ * Returns null when the profile is missing, unsupported, or lacks a primary
380
+ * resource data source.
381
+ */
382
+ export function projectDocumentWorkspaceProfile(
383
+ profile: DocumentProfileProjection | null,
384
+ options: ProjectDocumentWorkspaceProfileOptions = {},
385
+ ): DocumentWorkspaceProfileProjection | null {
386
+ const documentKind = projectDocumentKind(profile)
387
+ const resourceDataSource = findDocumentProfileDataSource(
388
+ profile,
389
+ documentDataSourceRoles.resource,
390
+ )
391
+ if (!profile || !documentKind || !resourceDataSource) {
392
+ return null
393
+ }
394
+
395
+ const metadataDataSource = findDocumentProfileDataSource(
396
+ profile,
397
+ documentDataSourceRoles.metadata,
398
+ )
399
+ const summaryDataSource = findDocumentProfileDataSource(
400
+ profile,
401
+ documentDataSourceRoles.summary,
402
+ )
403
+
404
+ return {
405
+ dataSourceId: resourceDataSource.DataSource.DataSourceId,
406
+ documentKind,
407
+ editorPath: (resourceId) =>
408
+ formatDocumentSourceAddress(profile, { Id: resourceId, id: resourceId }) ??
409
+ formatFallbackDocumentSourceAddress(
410
+ options.fallbackAddressScheme ?? 'document',
411
+ documentKind,
412
+ resourceId,
413
+ ),
414
+ label: profile.Name ?? documentKind.label,
415
+ metadata: metadataDataSource
416
+ ? { dataSourceId: metadataDataSource.DataSource.DataSourceId }
417
+ : undefined,
418
+ profile,
419
+ profileId: profile.Id,
420
+ resource: projectDocumentWorkspaceResource(profile, resourceDataSource),
421
+ summary: summaryDataSource
422
+ ? {
423
+ dataSourceId: summaryDataSource.DataSource.DataSourceId,
424
+ fieldPaths: projectDocumentSummaryFieldPaths(
425
+ profile.MetricSources ?? [],
426
+ summaryDataSource.DataSource.DataSourceId,
427
+ ),
428
+ }
429
+ : undefined,
430
+ }
431
+ }
432
+
433
+ function projectDocumentWorkspaceResource(
434
+ profile: DocumentProfileProjection,
435
+ resourceDataSource: DocumentProfileDataSourceProjection,
436
+ ): DocumentWorkspaceResourceProjection {
437
+ return {
438
+ createdAtPath: firstAvailablePath('CreatedAtUtc', 'CreatedAt', 'createdAtUtc'),
439
+ documentPath:
440
+ profile.Document?.DataSource?.FieldPath ??
441
+ resourceDataSource.DataSource.FieldPath ??
442
+ 'Document',
443
+ idPath: profile.Document?.Identity?.DocumentIdField?.trim() || 'Id',
444
+ titlePath: firstAvailablePath('Name', 'Title', 'Label'),
445
+ updatedAtPath: firstAvailablePath('UpdatedAtUtc', 'UpdatedAt', 'updatedAtUtc'),
446
+ versionPath: profile.Document?.Identity?.VersionField ?? 'EntityVersion',
447
+ }
448
+ }
449
+
450
+ /**
451
+ * Creates the editor identity key used to decide whether local editor state
452
+ * still belongs to the currently loaded resource revision.
453
+ */
454
+ export function createDocumentResourceEditorKey(
455
+ projection: Pick<DocumentWorkspaceProfileProjection, 'documentKind' | 'profileId' | 'resource'>,
456
+ resource: ProjectedDocumentResource,
457
+ ) {
458
+ const resourceId = readDocumentResourceId(projection, resource)
459
+ const version = readDocumentResourceVersion(projection, resource)
460
+ const updatedAt = readDocumentResourceTextPath(resource, projection.resource.updatedAtPath)
461
+ const createdAt = readDocumentResourceTextPath(resource, projection.resource.createdAtPath)
462
+
463
+ return [
464
+ projection.profileId,
465
+ projection.documentKind.id,
466
+ resourceId ?? 'unknown',
467
+ version ?? 'unversioned',
468
+ updatedAt ?? createdAt,
469
+ ].join(':')
470
+ }
471
+
472
+ /** Reads the semantic document id from an opaque resource using profile IR. */
473
+ export function readDocumentResourceId(
474
+ projection: Pick<DocumentWorkspaceProfileProjection, 'resource'>,
475
+ resource: unknown,
476
+ ) {
477
+ return readDocumentResourceTextPath(resource, projection.resource.idPath)
478
+ }
479
+
480
+ /** Reads the JSON document payload from an opaque resource using profile IR. */
481
+ export function readDocumentResourceDocument(
482
+ projection: Pick<DocumentWorkspaceProfileProjection, 'resource'>,
483
+ resource: unknown,
484
+ ) {
485
+ return readPresentationFieldValue(resource, projection.resource.documentPath)
486
+ }
487
+
488
+ /** Reads a human-facing resource title from an opaque resource using profile IR. */
489
+ export function readDocumentResourceTitle(
490
+ projection: Pick<DocumentWorkspaceProfileProjection, 'label' | 'resource'>,
491
+ resource: unknown,
492
+ ) {
493
+ const title = readDocumentResourceTextPath(resource, projection.resource.titlePath)
494
+ return title ?? projection.label
495
+ }
496
+
497
+ /** Reads the resource version from an opaque resource using profile IR. */
498
+ export function readDocumentResourceVersion(
499
+ projection: Pick<DocumentWorkspaceProfileProjection, 'resource'>,
500
+ resource: unknown,
501
+ ) {
502
+ const version = readPresentationFieldValue(resource, projection.resource.versionPath)
503
+ return typeof version === 'number' || typeof version === 'string'
504
+ ? version
505
+ : null
506
+ }
507
+
508
+ function readDocumentResourceTextPath(
509
+ resource: unknown,
510
+ path: string | null | undefined,
511
+ ) {
512
+ const value = readPresentationFieldValue(resource, path)
513
+ return typeof value === 'string' && value.trim().length > 0
514
+ ? value.trim()
515
+ : null
516
+ }
517
+
518
+ function firstAvailablePath(...paths: readonly string[]) {
519
+ return paths.find((path) => path.trim().length > 0) ?? null
520
+ }
521
+
522
+ /**
523
+ * Tests document kind values across generated numeric and backend string enum
524
+ * representations.
525
+ */
526
+ export function isDocumentKind(
527
+ value: string | number | null | undefined,
528
+ expected: string | number,
529
+ ) {
530
+ const expectedLabel = resolveDocumentKindLabel(expected)?.toLocaleLowerCase()
531
+ const normalizedValue = String(value).toLocaleLowerCase()
532
+ return (
533
+ value === expected ||
534
+ normalizedValue === String(expected).toLocaleLowerCase() ||
535
+ normalizedValue === expectedLabel
536
+ )
537
+ }
538
+
539
+ /**
540
+ * Formats a profile document source address from a declared address template.
541
+ *
542
+ * Template placeholders are resolved from exact property names first and then
543
+ * lower-camel-case names. Returns null when the profile has no template or any
544
+ * placeholder value is missing.
545
+ */
546
+ export function formatDocumentSourceAddress(
547
+ profile: DocumentProfileProjection | null,
548
+ values: Readonly<Record<string, string | number | boolean | null | undefined>>,
549
+ ) {
550
+ const template = getDocumentSourceAddressTemplate(profile)
551
+ if (!template) {
552
+ return null
553
+ }
554
+
555
+ let hasMissingValue = false
556
+ const address = template.replace(/\{([^}]+)\}/g, (match, key: string) => {
557
+ const value = values[key] ?? values[lowercaseFirstCharacter(key)]
558
+ if (value === null || value === undefined) {
559
+ hasMissingValue = true
560
+ return match
561
+ }
562
+
563
+ return encodeURIComponent(String(value))
564
+ })
565
+
566
+ return hasMissingValue ? null : address
567
+ }
568
+
569
+ /**
570
+ * Projects active profile-scoped data sources into runtime binding
571
+ * descriptors.
572
+ *
573
+ * Profile data sources are first filtered by role and activation policy. The
574
+ * remaining ids are then interpreted through the generic presentation
575
+ * data-source projection registry, with local-state fallback definitions for
576
+ * data sources that are only scoped by the document profile.
577
+ */
578
+ export function projectDocumentProfileDataSourceBindings({
579
+ activation,
580
+ context,
581
+ module,
582
+ profile,
583
+ registry,
584
+ roles,
585
+ }: ProjectDocumentProfileDataSourceBindingsOptions): readonly PresentationDataSourceBinding[] {
586
+ const profileDataSources = getDocumentProfileDataSources(profile, roles).filter(
587
+ (dataSource) => isDocumentProfileDataSourceActive(dataSource, activation),
588
+ )
589
+
590
+ return projectPresentationDataSourceBindings({
591
+ context,
592
+ dataSourceDefinitions: profileDataSources.map(
593
+ createDocumentProfileDataSourceFallbackDefinition,
594
+ ),
595
+ dataSourceIds: profileDataSources.map(
596
+ (dataSource) => dataSource.DataSource.DataSourceId,
597
+ ),
598
+ module,
599
+ registry,
600
+ })
601
+ }
602
+
603
+ /**
604
+ * Evaluates whether a profile data source is active for the current document
605
+ * runtime state.
606
+ *
607
+ * A source is active when all required route parameters are present and, when
608
+ * projection/view/layout constraints are declared, at least one active semantic
609
+ * id matches the policy.
610
+ */
611
+ export function isDocumentProfileDataSourceActive(
612
+ dataSource: DocumentProfileDataSourceProjection,
613
+ state: DocumentDataSourceActivationState | undefined,
614
+ ) {
615
+ const policy = dataSource.Activation
616
+ if (!policy) {
617
+ return true
618
+ }
619
+
620
+ if (
621
+ !policy.RequiredRouteParameterNames.every((parameterName) =>
622
+ hasRouteParameterValue(state?.routeParameters, parameterName),
623
+ )
624
+ ) {
625
+ return false
626
+ }
627
+
628
+ const hasStateKey =
629
+ policy.ProjectionIds.length > 0 ||
630
+ policy.ViewIds.length > 0 ||
631
+ policy.LayoutModeIds.length > 0
632
+
633
+ if (!hasStateKey) {
634
+ return true
635
+ }
636
+
637
+ return (
638
+ includesSemanticId(policy.ProjectionIds, state?.activeProjectionId) ||
639
+ includesSemanticId(policy.ViewIds, state?.activeViewId) ||
640
+ includesSemanticId(policy.LayoutModeIds, state?.activeLayoutModeId)
641
+ )
642
+ }
643
+
644
+ function createDocumentProfileDataSourceFallbackDefinition(
645
+ dataSource: DocumentProfileDataSourceProjection,
646
+ ): DataSourceDefinition {
647
+ return {
648
+ Annotations: [],
649
+ Binding: null,
650
+ Cache: null,
651
+ DefaultSort: [],
652
+ Id: dataSource.DataSource.DataSourceId,
653
+ Invalidation: null,
654
+ Kind: dataSourceKinds.localState,
655
+ Name: dataSource.Description ?? dataSource.Id,
656
+ Parameters: [],
657
+ Residency: null,
658
+ ResultShape: 'unknown',
659
+ }
660
+ }
661
+
662
+ function formatFallbackDocumentSourceAddress(
663
+ scheme: string,
664
+ documentKind: ProjectedDocumentKind,
665
+ resourceId: string,
666
+ ) {
667
+ return `${scheme}://${documentKind.id}/${encodeURIComponent(resourceId)}.json`
668
+ }
669
+
670
+ function projectDocumentSummaryFieldPaths(
671
+ metricSources: DocumentProfileProjection['MetricSources'],
672
+ dataSourceId: string,
673
+ ): readonly string[] {
674
+ return Array.from(
675
+ new Set(
676
+ (metricSources ?? [])
677
+ .filter((metricSource) => metricSource.Source.DataSourceId === dataSourceId)
678
+ .map((metricSource) => metricSource.Source.FieldPath ?? '')
679
+ .filter(Boolean),
680
+ ),
681
+ )
682
+ }
683
+
684
+ function lowercaseFirstCharacter(value: string) {
685
+ return value.length > 0
686
+ ? `${value.slice(0, 1).toLocaleLowerCase()}${value.slice(1)}`
687
+ : value
688
+ }
689
+
690
+ function resolveDocumentKindLabel(value: string | number) {
691
+ if (typeof value === 'number') {
692
+ return documentKindLabels[value as keyof typeof documentKindLabels] ?? null
693
+ }
694
+
695
+ const normalizedValue = value.toLocaleLowerCase()
696
+ const match = Object.values(documentKindLabels).find(
697
+ (label) => label.toLocaleLowerCase() === normalizedValue,
698
+ )
699
+ return match ?? value
700
+ }
701
+
702
+ function formatPascalCaseLabel(value: string) {
703
+ return value.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
704
+ }
705
+
706
+ function toKebabCase(value: string) {
707
+ return formatPascalCaseLabel(value)
708
+ .trim()
709
+ .replace(/[^a-zA-Z0-9]+/g, '-')
710
+ .replace(/^-+|-+$/g, '')
711
+ .toLocaleLowerCase()
712
+ }
713
+
714
+ function hasRouteParameterValue(
715
+ routeParameters: Readonly<Record<string, string | null | undefined>> | undefined,
716
+ parameterName: string,
717
+ ) {
718
+ const value = routeParameters?.[parameterName]
719
+ return typeof value === 'string' && value.length > 0
720
+ }
721
+
722
+ function includesSemanticId(ids: readonly string[], value: string | null | undefined) {
723
+ if (!value) {
724
+ return false
725
+ }
726
+
727
+ return ids.some((id) => id.toLocaleLowerCase() === value.toLocaleLowerCase())
728
+ }
729
+
730
+ function isDocumentDataSourceRole(
731
+ value: DocumentDataSourceRole | string | null | undefined,
732
+ role: DocumentDataSourceRole,
733
+ ) {
734
+ const roleLabel = documentDataSourceRoleLabels[role]?.toLocaleLowerCase()
735
+ const normalizedValue = String(value).toLocaleLowerCase()
736
+ return (
737
+ value === role ||
738
+ normalizedValue === String(role).toLocaleLowerCase() ||
739
+ normalizedValue === roleLabel
740
+ )
741
+ }