@elementumai/edk 0.8.2-alpha.5 → 0.9.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 (372) hide show
  1. package/README.md +18 -14
  2. package/dist-sdk/elementum-entity-client/clients/agents/models/agent-tool.d.ts +3 -3
  3. package/dist-sdk/elementum-entity-client/clients/aspects/models/index.d.ts +1 -1
  4. package/dist-sdk/elementum-entity-client/clients/aspects/models/picklist-config.d.ts +3 -11
  5. package/dist-sdk/elementum-entity-client/clients/automation/models/automation.d.ts +2 -10
  6. package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.d.ts +1 -1
  7. package/dist-sdk/fs/entity.d.ts +2 -2
  8. package/dist-sdk/fs/entity.js +1 -1
  9. package/dist-sdk/pull/missing-report.d.ts +81 -0
  10. package/dist-sdk/pull/missing-report.js +52 -0
  11. package/dist-sdk/src/catalog/factories.d.ts +53 -19
  12. package/dist-sdk/src/catalog/factories.js +51 -12
  13. package/dist-sdk/src/catalog/from-authoring.js +13 -3
  14. package/dist-sdk/src/catalog/index.d.ts +2 -2
  15. package/dist-sdk/src/catalog/index.js +1 -1
  16. package/dist-sdk/src/catalog/org.js +1 -0
  17. package/dist-sdk/src/catalog/render.js +6 -0
  18. package/dist-sdk/src/catalog/token.js +7 -0
  19. package/dist-sdk/src/catalog/types.d.ts +34 -23
  20. package/dist-sdk/src/catalog/types.js +7 -4
  21. package/dist-sdk/src/core/app-to-ui.d.ts +6 -6
  22. package/dist-sdk/src/core/app-to-ui.js +7 -9
  23. package/dist-sdk/src/core/index.d.ts +1 -0
  24. package/dist-sdk/src/core/index.js +1 -0
  25. package/dist-sdk/src/core/platform-id.d.ts +11 -0
  26. package/dist-sdk/src/core/platform-id.js +8 -0
  27. package/dist-sdk/src/{entities/flow/activities/render-catalog.d.ts → core/render-tree.d.ts} +2 -2
  28. package/dist-sdk/src/{entities/flow/activities/render-catalog.js → core/render-tree.js} +6 -8
  29. package/dist-sdk/src/core/types/app.d.ts +13 -23
  30. package/dist-sdk/src/core/types/app.js +0 -1
  31. package/dist-sdk/src/engine/build/context.d.ts +3 -3
  32. package/dist-sdk/src/engine/pull/attrs.d.ts +4 -0
  33. package/dist-sdk/src/engine/pull/attrs.js +17 -0
  34. package/dist-sdk/src/engine/pull/context.d.ts +39 -0
  35. package/dist-sdk/src/engine/pull/org.d.ts +1 -0
  36. package/dist-sdk/src/engine/pull/org.js +2 -0
  37. package/dist-sdk/src/engine/tf/expr.d.ts +1 -1
  38. package/dist-sdk/src/engine/tf/expr.js +10 -3
  39. package/dist-sdk/src/engine/workspace/authoring-layout.js +4 -2
  40. package/dist-sdk/src/entities/access-policy/build.d.ts +4 -13
  41. package/dist-sdk/src/entities/access-policy/build.js +1 -1
  42. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +12 -38
  43. package/dist-sdk/src/entities/access-policy/from-tf.js +16 -74
  44. package/dist-sdk/src/entities/access-policy/principal.d.ts +29 -0
  45. package/dist-sdk/src/entities/access-policy/principal.js +13 -0
  46. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +20 -5
  47. package/dist-sdk/src/entities/access-policy/to-tf.js +26 -54
  48. package/dist-sdk/src/entities/agent/build.d.ts +39 -8
  49. package/dist-sdk/src/entities/agent/build.js +36 -15
  50. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +5 -0
  51. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +121 -36
  52. package/dist-sdk/src/entities/agent/from-tf.js +5 -8
  53. package/dist-sdk/src/entities/agent/index.d.ts +5 -2
  54. package/dist-sdk/src/entities/agent/index.js +4 -2
  55. package/dist-sdk/src/entities/agent/module.js +5 -2
  56. package/dist-sdk/src/entities/agent/run-as.d.ts +16 -0
  57. package/dist-sdk/src/entities/agent/run-as.js +1 -0
  58. package/dist-sdk/src/entities/agent/to-tf.d.ts +2 -1
  59. package/dist-sdk/src/entities/agent/to-tf.js +2 -1
  60. package/dist-sdk/src/entities/agent/tools.d.ts +60 -48
  61. package/dist-sdk/src/entities/agent/tools.js +44 -38
  62. package/dist-sdk/src/entities/agent-a2a-skill/from-tf.js +1 -1
  63. package/dist-sdk/src/entities/agent-a2a-skill/to-tf.js +4 -4
  64. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +17 -8
  65. package/dist-sdk/src/entities/agent-tool/from-tf.js +127 -37
  66. package/dist-sdk/src/entities/agent-tool/module.js +6 -0
  67. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +5 -5
  68. package/dist-sdk/src/entities/agent-tool/to-tf.js +93 -20
  69. package/dist-sdk/src/entities/agent-tool/types.d.ts +4 -5
  70. package/dist-sdk/src/entities/agent-tool/types.js +36 -8
  71. package/dist-sdk/src/entities/app/build.d.ts +137 -25
  72. package/dist-sdk/src/entities/app/build.js +104 -53
  73. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +173 -1
  74. package/dist-sdk/src/entities/app/deserializer/pulled-expression.d.ts +59 -0
  75. package/dist-sdk/src/entities/app/deserializer/pulled-expression.js +68 -0
  76. package/dist-sdk/src/entities/app/display-blocks.d.ts +2 -1
  77. package/dist-sdk/src/entities/app/display-blocks.js +1 -1
  78. package/dist-sdk/src/entities/app/from-tf.d.ts +11 -1
  79. package/dist-sdk/src/entities/app/from-tf.js +30 -2
  80. package/dist-sdk/src/entities/app/index.d.ts +13 -4
  81. package/dist-sdk/src/entities/app/index.js +8 -1
  82. package/dist-sdk/src/entities/app/module.js +27 -2
  83. package/dist-sdk/src/entities/app/to-tf.js +75 -1
  84. package/dist-sdk/src/entities/approval-chain/build.d.ts +31 -16
  85. package/dist-sdk/src/entities/approval-chain/build.js +49 -49
  86. package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +17 -0
  87. package/dist-sdk/src/entities/approval-chain/from-tf.js +57 -0
  88. package/dist-sdk/src/entities/approval-chain/index.d.ts +2 -3
  89. package/dist-sdk/src/entities/approval-chain/index.js +2 -3
  90. package/dist-sdk/src/entities/approval-chain/module.d.ts +3 -0
  91. package/dist-sdk/src/entities/approval-chain/module.js +51 -0
  92. package/dist-sdk/src/entities/approval-chain/printer.d.ts +2 -0
  93. package/dist-sdk/src/entities/approval-chain/printer.js +21 -0
  94. package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +9 -0
  95. package/dist-sdk/src/entities/approval-chain/to-tf.js +43 -0
  96. package/dist-sdk/src/entities/automation/build.d.ts +10 -6
  97. package/dist-sdk/src/entities/automation/build.js +5 -4
  98. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +10 -8
  99. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +51 -114
  100. package/dist-sdk/src/entities/automation/filter.d.ts +1 -115
  101. package/dist-sdk/src/entities/automation/filter.js +1 -197
  102. package/dist-sdk/src/entities/automation/from-tf.d.ts +4 -0
  103. package/dist-sdk/src/entities/automation/from-tf.js +202 -119
  104. package/dist-sdk/src/entities/automation/index.d.ts +4 -2
  105. package/dist-sdk/src/entities/automation/index.js +3 -1
  106. package/dist-sdk/src/entities/automation/module.js +10 -4
  107. package/dist-sdk/src/entities/automation/script-code.js +94 -6
  108. package/dist-sdk/src/entities/automation/tasks.d.ts +20 -19
  109. package/dist-sdk/src/entities/automation/tasks.js +2 -2
  110. package/dist-sdk/src/entities/automation/to-tf.d.ts +34 -2
  111. package/dist-sdk/src/entities/automation/to-tf.js +273 -98
  112. package/dist-sdk/src/entities/automation/triggers.d.ts +18 -17
  113. package/dist-sdk/src/entities/automation/triggers.js +1 -1
  114. package/dist-sdk/src/entities/dashboard/build.d.ts +17 -0
  115. package/dist-sdk/src/entities/dashboard/from-tf.d.ts +12 -0
  116. package/dist-sdk/src/entities/dashboard/from-tf.js +95 -0
  117. package/dist-sdk/src/entities/dashboard/module.d.ts +3 -0
  118. package/dist-sdk/src/entities/dashboard/module.js +16 -0
  119. package/dist-sdk/src/entities/dashboard/to-tf.d.ts +30 -0
  120. package/dist-sdk/src/entities/dashboard/to-tf.js +94 -0
  121. package/dist-sdk/src/entities/dashboard-widget/module.d.ts +3 -0
  122. package/dist-sdk/src/entities/dashboard-widget/module.js +10 -0
  123. package/dist-sdk/src/entities/data-lookup/module.d.ts +3 -0
  124. package/dist-sdk/src/entities/data-lookup/module.js +22 -0
  125. package/dist-sdk/src/entities/datamine/build.d.ts +22 -0
  126. package/dist-sdk/src/entities/datamine/build.js +1 -0
  127. package/dist-sdk/src/entities/datamine/from-tf.d.ts +17 -0
  128. package/dist-sdk/src/entities/datamine/from-tf.js +98 -0
  129. package/dist-sdk/src/entities/datamine/module.d.ts +3 -0
  130. package/dist-sdk/src/entities/datamine/module.js +23 -0
  131. package/dist-sdk/src/entities/datamine/to-tf.d.ts +11 -0
  132. package/dist-sdk/src/entities/datamine/to-tf.js +53 -0
  133. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +303 -0
  134. package/dist-sdk/src/entities/dynamic-layout/build.js +4 -0
  135. package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +2 -0
  136. package/dist-sdk/src/entities/dynamic-layout/dialect.js +9 -0
  137. package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +10 -0
  138. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +233 -0
  139. package/dist-sdk/src/entities/dynamic-layout/module.d.ts +3 -0
  140. package/dist-sdk/src/entities/dynamic-layout/module.js +13 -0
  141. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +26 -0
  142. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +267 -0
  143. package/dist-sdk/src/entities/element/build.d.ts +31 -14
  144. package/dist-sdk/src/entities/element/build.js +12 -4
  145. package/dist-sdk/src/entities/element/from-tf.d.ts +9 -1
  146. package/dist-sdk/src/entities/element/from-tf.js +31 -2
  147. package/dist-sdk/src/entities/element/index.d.ts +8 -3
  148. package/dist-sdk/src/entities/element/index.js +4 -1
  149. package/dist-sdk/src/entities/element/module.js +19 -2
  150. package/dist-sdk/src/entities/element/to-tf.js +57 -1
  151. package/dist-sdk/src/entities/field/build.d.ts +4 -3
  152. package/dist-sdk/src/entities/field/calculation-types.d.ts +6 -0
  153. package/dist-sdk/src/entities/field/calculation-types.js +42 -0
  154. package/dist-sdk/src/entities/field/from-tf.js +90 -11
  155. package/dist-sdk/src/entities/field/module.d.ts +1 -0
  156. package/dist-sdk/src/entities/field/module.js +5 -2
  157. package/dist-sdk/src/entities/field/record-shape.d.ts +1 -1
  158. package/dist-sdk/src/entities/field/to-tf.d.ts +1 -1
  159. package/dist-sdk/src/entities/field/to-tf.js +22 -6
  160. package/dist-sdk/src/entities/field/types.js +3 -0
  161. package/dist-sdk/src/entities/file-reader/build.d.ts +66 -19
  162. package/dist-sdk/src/entities/file-reader/build.js +49 -4
  163. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +1 -0
  164. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +11 -9
  165. package/dist-sdk/src/entities/file-reader/from-tf.d.ts +1 -1
  166. package/dist-sdk/src/entities/file-reader/from-tf.js +31 -2
  167. package/dist-sdk/src/entities/file-reader/index.d.ts +3 -3
  168. package/dist-sdk/src/entities/file-reader/index.js +3 -3
  169. package/dist-sdk/src/entities/file-reader/module.js +6 -5
  170. package/dist-sdk/src/entities/file-reader/to-tf.d.ts +1 -1
  171. package/dist-sdk/src/entities/file-reader/to-tf.js +5 -2
  172. package/dist-sdk/src/entities/file-reader/types.d.ts +3 -4
  173. package/dist-sdk/src/entities/file-reader/types.js +4 -5
  174. package/dist-sdk/src/entities/org/category.js +4 -5
  175. package/dist-sdk/src/entities/org/group.js +4 -5
  176. package/dist-sdk/src/entities/org/index.d.ts +1 -0
  177. package/dist-sdk/src/entities/org/index.js +1 -0
  178. package/dist-sdk/src/entities/org/phone-provider.d.ts +4 -0
  179. package/dist-sdk/src/entities/org/phone-provider.js +33 -0
  180. package/dist-sdk/src/entities/org/role.d.ts +3 -3
  181. package/dist-sdk/src/entities/org/role.js +9 -6
  182. package/dist-sdk/src/entities/organization/build.d.ts +29 -0
  183. package/dist-sdk/src/entities/organization/build.js +24 -0
  184. package/dist-sdk/src/entities/organization/index.d.ts +2 -0
  185. package/dist-sdk/src/entities/organization/index.js +2 -0
  186. package/dist-sdk/src/entities/organization/module.d.ts +2 -0
  187. package/dist-sdk/src/entities/organization/module.js +18 -0
  188. package/dist-sdk/src/entities/organization/to-tf.d.ts +6 -0
  189. package/dist-sdk/src/entities/organization/to-tf.js +37 -0
  190. package/dist-sdk/src/entities/phone-service/build.d.ts +17 -0
  191. package/dist-sdk/src/entities/phone-service/build.js +31 -0
  192. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.d.ts +4 -0
  193. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +54 -0
  194. package/dist-sdk/src/entities/phone-service/from-tf.d.ts +25 -0
  195. package/dist-sdk/src/entities/phone-service/from-tf.js +75 -0
  196. package/dist-sdk/src/entities/phone-service/index.d.ts +2 -0
  197. package/dist-sdk/src/entities/phone-service/index.js +2 -0
  198. package/dist-sdk/src/entities/phone-service/module.d.ts +3 -0
  199. package/dist-sdk/src/entities/phone-service/module.js +55 -0
  200. package/dist-sdk/src/entities/phone-service/to-tf.d.ts +12 -0
  201. package/dist-sdk/src/entities/phone-service/to-tf.js +54 -0
  202. package/dist-sdk/src/entities/phone-service/types.d.ts +35 -0
  203. package/dist-sdk/src/entities/phone-service/types.js +22 -0
  204. package/dist-sdk/src/entities/record-create-form/from-tf.d.ts +11 -0
  205. package/dist-sdk/src/entities/record-create-form/from-tf.js +74 -0
  206. package/dist-sdk/src/entities/record-create-form/module.d.ts +11 -0
  207. package/dist-sdk/src/entities/record-create-form/module.js +24 -0
  208. package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +33 -0
  209. package/dist-sdk/src/entities/record-create-form/to-tf.js +80 -0
  210. package/dist-sdk/src/entities/relationship/build.d.ts +16 -0
  211. package/dist-sdk/src/entities/relationship/build.js +1 -0
  212. package/dist-sdk/src/entities/relationship/from-tf.d.ts +12 -0
  213. package/dist-sdk/src/entities/relationship/from-tf.js +109 -0
  214. package/dist-sdk/src/entities/relationship/module.d.ts +3 -0
  215. package/dist-sdk/src/entities/relationship/module.js +16 -0
  216. package/dist-sdk/src/entities/relationship/to-tf.d.ts +31 -0
  217. package/dist-sdk/src/entities/relationship/to-tf.js +153 -0
  218. package/dist-sdk/src/entities/role/build.d.ts +65 -0
  219. package/dist-sdk/src/entities/role/build.js +33 -0
  220. package/dist-sdk/src/entities/role/from-tf.d.ts +13 -0
  221. package/dist-sdk/src/entities/role/from-tf.js +138 -0
  222. package/dist-sdk/src/entities/role/to-tf.d.ts +13 -0
  223. package/dist-sdk/src/entities/role/to-tf.js +69 -0
  224. package/dist-sdk/src/entities/search-table/build.d.ts +67 -28
  225. package/dist-sdk/src/entities/search-table/build.js +110 -56
  226. package/dist-sdk/src/entities/search-table/from-tf.d.ts +37 -0
  227. package/dist-sdk/src/entities/search-table/from-tf.js +113 -0
  228. package/dist-sdk/src/entities/search-table/index.d.ts +2 -2
  229. package/dist-sdk/src/entities/search-table/index.js +2 -2
  230. package/dist-sdk/src/entities/search-table/module.js +88 -10
  231. package/dist-sdk/src/entities/search-table/printer.d.ts +2 -0
  232. package/dist-sdk/src/entities/search-table/printer.js +52 -0
  233. package/dist-sdk/src/entities/search-table/to-tf.d.ts +14 -0
  234. package/dist-sdk/src/entities/search-table/to-tf.js +104 -0
  235. package/dist-sdk/src/entities/search-table/types.d.ts +8 -0
  236. package/dist-sdk/src/entities/search-table/types.js +21 -0
  237. package/dist-sdk/src/entities/service-account/build.d.ts +32 -0
  238. package/dist-sdk/src/entities/service-account/build.js +9 -0
  239. package/dist-sdk/src/entities/service-account/from-tf.d.ts +10 -0
  240. package/dist-sdk/src/entities/service-account/from-tf.js +109 -0
  241. package/dist-sdk/src/entities/service-account/module.d.ts +4 -0
  242. package/dist-sdk/src/entities/service-account/module.js +21 -0
  243. package/dist-sdk/src/entities/service-account/ref.d.ts +11 -0
  244. package/dist-sdk/src/entities/service-account/ref.js +5 -0
  245. package/dist-sdk/src/entities/service-account/to-tf.d.ts +11 -0
  246. package/dist-sdk/src/entities/service-account/to-tf.js +72 -0
  247. package/dist-sdk/src/entities/shared/connector-from-tf.d.ts +14 -0
  248. package/dist-sdk/src/entities/shared/connector-from-tf.js +14 -0
  249. package/dist-sdk/src/entities/shared/filters/ast.d.ts +21 -79
  250. package/dist-sdk/src/entities/shared/filters/ast.js +5 -2
  251. package/dist-sdk/src/entities/shared/filters/index.d.ts +94 -206
  252. package/dist-sdk/src/entities/shared/filters/index.js +189 -341
  253. package/dist-sdk/src/entities/shared/filters/print.d.ts +11 -0
  254. package/dist-sdk/src/entities/shared/filters/print.js +122 -0
  255. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +170 -0
  256. package/dist-sdk/src/entities/shared/filters/tf-codec.js +527 -0
  257. package/dist-sdk/src/entities/shared/filters/types.d.ts +66 -69
  258. package/dist-sdk/src/entities/shared/filters/types.js +2 -3
  259. package/dist-sdk/src/entities/skill/build.d.ts +2 -2
  260. package/dist-sdk/src/entities/skill/build.js +4 -3
  261. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +10 -0
  262. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +74 -32
  263. package/dist-sdk/src/entities/skill/index.d.ts +2 -1
  264. package/dist-sdk/src/entities/skill/index.js +2 -1
  265. package/dist-sdk/src/entities/skill/module.js +6 -0
  266. package/dist-sdk/src/entities/skill/to-tf.d.ts +5 -1
  267. package/dist-sdk/src/entities/skill/to-tf.js +18 -0
  268. package/dist-sdk/src/entities/skill/tools.d.ts +46 -31
  269. package/dist-sdk/src/entities/skill/tools.js +33 -20
  270. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +4 -1
  271. package/dist-sdk/src/entities/skill-tool/from-tf.js +76 -8
  272. package/dist-sdk/src/entities/skill-tool/module.js +9 -0
  273. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +6 -1
  274. package/dist-sdk/src/entities/skill-tool/to-tf.js +94 -42
  275. package/dist-sdk/src/entities/skill-tool/types.js +18 -1
  276. package/dist-sdk/src/entities/table/build.d.ts +64 -23
  277. package/dist-sdk/src/entities/table/build.js +33 -18
  278. package/dist-sdk/src/entities/table/catalog-render.js +6 -0
  279. package/dist-sdk/src/entities/table/deserializer/normalize.d.ts +99 -0
  280. package/dist-sdk/src/entities/table/deserializer/normalize.js +192 -0
  281. package/dist-sdk/src/entities/table/fields/types.d.ts +86 -0
  282. package/dist-sdk/src/entities/table/fields/types.js +12 -0
  283. package/dist-sdk/src/entities/table/fields.d.ts +107 -47
  284. package/dist-sdk/src/entities/table/fields.js +76 -55
  285. package/dist-sdk/src/entities/table/from-tf.d.ts +4 -0
  286. package/dist-sdk/src/entities/table/from-tf.js +261 -0
  287. package/dist-sdk/src/entities/table/index.d.ts +7 -5
  288. package/dist-sdk/src/entities/table/index.js +7 -7
  289. package/dist-sdk/src/entities/table/joins.d.ts +22 -9
  290. package/dist-sdk/src/entities/table/joins.js +8 -16
  291. package/dist-sdk/src/entities/table/module.d.ts +2 -1
  292. package/dist-sdk/src/entities/table/module.js +13 -6
  293. package/dist-sdk/src/entities/table/to-tf.d.ts +10 -0
  294. package/dist-sdk/src/entities/table/to-tf.js +230 -0
  295. package/dist-sdk/src/entities/task/build.d.ts +43 -0
  296. package/dist-sdk/src/entities/task/build.js +17 -0
  297. package/dist-sdk/src/entities/task/from-tf.d.ts +28 -0
  298. package/dist-sdk/src/entities/task/from-tf.js +38 -0
  299. package/dist-sdk/src/entities/task/index.d.ts +1 -0
  300. package/dist-sdk/src/entities/task/index.js +1 -0
  301. package/dist-sdk/src/entities/task/module.d.ts +3 -0
  302. package/dist-sdk/src/entities/task/module.js +12 -0
  303. package/dist-sdk/src/entities/task/to-tf.d.ts +9 -0
  304. package/dist-sdk/src/entities/task/to-tf.js +49 -0
  305. package/dist-sdk/src/entities/view/from-tf.d.ts +7 -2
  306. package/dist-sdk/src/entities/view/from-tf.js +209 -25
  307. package/dist-sdk/src/entities/view/module.js +5 -1
  308. package/dist-sdk/src/entities/view/to-tf.d.ts +49 -7
  309. package/dist-sdk/src/entities/view/to-tf.js +155 -18
  310. package/dist-sdk/src/entities/view/types.d.ts +8 -0
  311. package/dist-sdk/src/entities/view/types.js +43 -0
  312. package/dist-sdk/src/entities/visual-flow/build.d.ts +87 -0
  313. package/dist-sdk/src/entities/visual-flow/build.js +72 -0
  314. package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +49 -0
  315. package/dist-sdk/src/entities/visual-flow/from-tf.js +124 -0
  316. package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -0
  317. package/dist-sdk/src/entities/visual-flow/index.js +1 -0
  318. package/dist-sdk/src/entities/visual-flow/module.d.ts +3 -0
  319. package/dist-sdk/src/entities/visual-flow/module.js +41 -0
  320. package/dist-sdk/src/entities/visual-flow/printer.d.ts +8 -0
  321. package/dist-sdk/src/entities/visual-flow/printer.js +92 -0
  322. package/dist-sdk/src/entities/visual-flow/to-tf.d.ts +14 -0
  323. package/dist-sdk/src/entities/visual-flow/to-tf.js +101 -0
  324. package/dist-sdk/src/entities/widget/build.d.ts +55 -0
  325. package/dist-sdk/src/entities/widget/build.js +1 -0
  326. package/dist-sdk/src/entities/widget/from-tf.d.ts +11 -0
  327. package/dist-sdk/src/entities/widget/from-tf.js +209 -0
  328. package/dist-sdk/src/entities/widget/module.d.ts +3 -0
  329. package/dist-sdk/src/entities/widget/module.js +16 -0
  330. package/dist-sdk/src/entities/widget/to-tf.d.ts +44 -0
  331. package/dist-sdk/src/entities/widget/to-tf.js +204 -0
  332. package/dist-sdk/src/graph/deferred-catalog-render.d.ts +1 -1
  333. package/dist-sdk/src/graph/deferred-catalog-render.js +1 -1
  334. package/dist-sdk/src/graph/index.d.ts +7 -0
  335. package/dist-sdk/src/graph/index.js +4 -18
  336. package/dist-sdk/src/graph/modules.js +30 -1
  337. package/dist-sdk/src/graph/types.d.ts +55 -7
  338. package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
  339. package/dist-sdk/src/internal/sdk-package.js +4 -2
  340. package/package.json +30 -15
  341. package/dist-sdk/src/entities/access-policy/filter.d.ts +0 -61
  342. package/dist-sdk/src/entities/access-policy/filter.js +0 -83
  343. package/dist-sdk/src/entities/approval-chain/steps.d.ts +0 -24
  344. package/dist-sdk/src/entities/approval-chain/steps.js +0 -20
  345. package/dist-sdk/src/entities/flow/activities/agent.d.ts +0 -15
  346. package/dist-sdk/src/entities/flow/activities/agent.js +0 -29
  347. package/dist-sdk/src/entities/flow/activities/approval.d.ts +0 -9
  348. package/dist-sdk/src/entities/flow/activities/approval.js +0 -18
  349. package/dist-sdk/src/entities/flow/activities/automation.d.ts +0 -12
  350. package/dist-sdk/src/entities/flow/activities/automation.js +0 -22
  351. package/dist-sdk/src/entities/flow/activities/ctx.d.ts +0 -34
  352. package/dist-sdk/src/entities/flow/activities/ctx.js +0 -38
  353. package/dist-sdk/src/entities/flow/activities/form.d.ts +0 -22
  354. package/dist-sdk/src/entities/flow/activities/form.js +0 -36
  355. package/dist-sdk/src/entities/flow/activities/index.d.ts +0 -14
  356. package/dist-sdk/src/entities/flow/activities/index.js +0 -13
  357. package/dist-sdk/src/entities/flow/activities/input-refs.d.ts +0 -39
  358. package/dist-sdk/src/entities/flow/activities/input-refs.js +0 -19
  359. package/dist-sdk/src/entities/flow/activities/prompt-template.d.ts +0 -13
  360. package/dist-sdk/src/entities/flow/activities/prompt-template.js +0 -34
  361. package/dist-sdk/src/entities/flow/activities/types.d.ts +0 -33
  362. package/dist-sdk/src/entities/flow/build.d.ts +0 -38
  363. package/dist-sdk/src/entities/flow/build.js +0 -115
  364. package/dist-sdk/src/entities/flow/index.d.ts +0 -8
  365. package/dist-sdk/src/entities/flow/index.js +0 -7
  366. package/dist-sdk/src/entities/flow/serialize.d.ts +0 -51
  367. package/dist-sdk/src/entities/flow/serialize.js +0 -94
  368. package/dist-sdk/src/entities/flow/util.d.ts +0 -27
  369. package/dist-sdk/src/entities/flow/util.js +0 -38
  370. package/dist-sdk/src/entities/table/filter.d.ts +0 -41
  371. package/dist-sdk/src/entities/table/filter.js +0 -89
  372. /package/dist-sdk/src/entities/{flow/activities/types.js → dashboard/build.js} +0 -0
@@ -6,19 +6,23 @@
6
6
  * module never names the app's own resource type.
7
7
  */
8
8
  import { optionalString, plainObject, resourceRefLabel } from "../../engine/pull/context.js";
9
- import { isTfExpr, scopedLabelToBagKey } from "../../engine/tf/index.js";
9
+ import { reportUnknownAttrs } from "../../engine/pull/attrs.js";
10
+ import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
10
11
  import { fieldKeyFromTfRef } from "../field/from-tf.js";
11
- import { GROUP_SECTION_WIRE_TYPE, KNOWN_LAYOUT_ATTRS, KNOWN_LAYOUT_SECTION_ATTRS, KNOWN_LIST_VIEW_ATTRS, KNOWN_MANAGED_VIEW_ORDER_ATTRS, LIST_VIEW_RESOURCE_TYPE, SECTION_TYPE_FROM_WIRE, SYSTEM_FIELD_KEY_BY_ID_ATTR, UPDATE_SECTION_WIRE_TYPE, } from "./types.js";
12
- /** Report every attribute key not in `known` as dialect growth — shared by all four view/section passes below. */
13
- function reportUnknownAttrs(attrs, known, where, passName, ctx) {
14
- for (const key of Object.keys(attrs)) {
15
- if (!known.has(key)) {
16
- ctx.diagnostics.push(`${where}: unhandled attribute "${key}" — the export dialect grew; extend ${passName} deliberately`);
17
- }
18
- }
12
+ import { DASHBOARD_RESOURCE_TYPE } from "../dashboard/module.js";
13
+ import { filterFromTf, principalList } from "../access-policy/from-tf.js";
14
+ import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, GROUP_SECTION_WIRE_TYPE, KNOWN_AGENT_VIEW_ATTRS, KNOWN_CALENDAR_VIEW_ATTRS, KNOWN_DASHBOARD_VIEW_ATTRS, KNOWN_KANBAN_VIEW_ATTRS, KNOWN_LAYOUT_ATTRS, KNOWN_LAYOUT_SECTION_ATTRS, KNOWN_LIST_VIEW_ATTRS, KNOWN_MANAGED_VIEW_ORDER_ATTRS, LIST_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, SECTION_TYPE_FROM_WIRE, SYSTEM_FIELD_KEY_BY_ID_ATTR, UPDATE_SECTION_WIRE_TYPE, } from "./types.js";
15
+ function viewFilter(value, owner, where) {
16
+ return value === undefined ? undefined : filterFromTf(value, {
17
+ type: owner.type,
18
+ label: owner.label,
19
+ ownerRefName: tfLabelToTsLabel(owner.label),
20
+ ownerTfLabel: owner.ownerTfLabel,
21
+ scope: owner.scope ?? "app",
22
+ }, `${where}.filter`);
19
23
  }
20
24
  /** All three view resource kinds → the normalized shapes the app printer consumes. */
21
- export function viewsFromTf(layoutBlocks, listViewBlocks, managedViewOrderBlocks, owner, ctx) {
25
+ export function viewsFromTf(layoutBlocks, listViewBlocks, calendarViewBlocks, kanbanViewBlocks, dashboardViewBlocks, agentViewBlocks, managedViewOrderBlocks, owner, ctx) {
22
26
  const layouts = [];
23
27
  for (const block of layoutBlocks) {
24
28
  const layout = layoutFromTf(block, owner, ctx);
@@ -26,12 +30,44 @@ export function viewsFromTf(layoutBlocks, listViewBlocks, managedViewOrderBlocks
26
30
  layouts.push(layout);
27
31
  }
28
32
  const listViews = [];
29
- const keyByTfLabel = new Map();
33
+ const keyByAddress = new Map();
30
34
  for (const block of listViewBlocks) {
31
35
  const view = listViewFromTf(block, owner, ctx);
32
36
  if (view !== undefined) {
33
37
  listViews.push(view);
34
- keyByTfLabel.set(block.label ?? "", view.key);
38
+ keyByAddress.set(`${LIST_VIEW_RESOURCE_TYPE}.${block.label ?? ""}`, view.key);
39
+ }
40
+ }
41
+ const agentViews = [];
42
+ for (const block of agentViewBlocks) {
43
+ const view = agentViewFromTf(block, owner, ctx);
44
+ if (view !== undefined) {
45
+ agentViews.push(view);
46
+ keyByAddress.set(`${AGENT_VIEW_RESOURCE_TYPE}.${block.label ?? ""}`, view.key);
47
+ }
48
+ }
49
+ const calendarViews = [];
50
+ for (const block of calendarViewBlocks) {
51
+ const view = calendarViewFromTf(block, owner, ctx);
52
+ if (view !== undefined) {
53
+ calendarViews.push(view);
54
+ keyByAddress.set(`${CALENDAR_VIEW_RESOURCE_TYPE}.${block.label ?? ""}`, view.key);
55
+ }
56
+ }
57
+ const kanbanViews = [];
58
+ for (const block of kanbanViewBlocks) {
59
+ const view = kanbanViewFromTf(block, owner, ctx);
60
+ if (view !== undefined) {
61
+ kanbanViews.push(view);
62
+ keyByAddress.set(`${KANBAN_VIEW_RESOURCE_TYPE}.${block.label ?? ""}`, view.key);
63
+ }
64
+ }
65
+ const dashboardViews = [];
66
+ for (const block of dashboardViewBlocks) {
67
+ const view = dashboardViewFromTf(block, owner, ctx);
68
+ if (view !== undefined) {
69
+ dashboardViews.push(view);
70
+ keyByAddress.set(`${DASHBOARD_VIEW_RESOURCE_TYPE}.${block.label ?? ""}`, view.key);
35
71
  }
36
72
  }
37
73
  // Singleton per aspect — at most one block is expected; extras are reported.
@@ -41,9 +77,146 @@ export function viewsFromTf(layoutBlocks, listViewBlocks, managedViewOrderBlocks
41
77
  ctx.diagnostics.push(`unexpected additional elementum_managed_view_order.${block.label ?? "?"} for one aspect; ignored`);
42
78
  continue;
43
79
  }
44
- viewOrder = managedViewOrderFromTf(block, owner, keyByTfLabel, ctx);
80
+ viewOrder = managedViewOrderFromTf(block, owner, keyByAddress, ctx);
81
+ }
82
+ return { layouts, listViews, calendarViews, kanbanViews, dashboardViews, agentViews, ...(viewOrder !== undefined ? { viewOrder } : {}) };
83
+ }
84
+ function dashboardViewFromTf(block, owner, ctx) {
85
+ const label = block.label;
86
+ if (label === undefined || label === "") {
87
+ ctx.diagnostics.push(`${DASHBOARD_VIEW_RESOURCE_TYPE} block is missing its label; skipped`);
88
+ return undefined;
89
+ }
90
+ const attrs = block.attrs;
91
+ const where = `dashboard view "${label}"`;
92
+ reportUnknownAttrs(attrs, KNOWN_DASHBOARD_VIEW_ATTRS, where, "dashboardViewFromTf", ctx);
93
+ if (resourceRefLabel(attrs["aspect_id"], owner.type) !== owner.label) {
94
+ ctx.diagnostics.push(`${where}: aspect_id does not reference ${owner.type}.${owner.label}; skipped`);
95
+ return undefined;
96
+ }
97
+ const dashboardLabel = resourceRefLabel(attrs["dashboard_id"], DASHBOARD_RESOURCE_TYPE);
98
+ if (dashboardLabel === undefined) {
99
+ ctx.diagnostics.push(`${where}: dashboard_id is not a ${DASHBOARD_RESOURCE_TYPE} resource reference; skipped`);
100
+ return undefined;
101
+ }
102
+ const scope = owner.scope ?? "app";
103
+ const sort = jsonencodeValue(attrs["sort"]);
104
+ if (attrs["sort"] !== undefined && sort === undefined) {
105
+ ctx.diagnostics.push(`${where}: sort is not a jsonencode(...) expression; dropped`);
106
+ }
107
+ const userIds = principalList(attrs["user_ids"], "elementum_user", `${where}: user_ids`, ctx);
108
+ const groupIds = principalList(attrs["group_ids"], "elementum_group", `${where}: group_ids`, ctx);
109
+ const filter = viewFilter(attrs["filter"], owner, where);
110
+ return {
111
+ key: scopedLabelToBagKey(owner.ownerTfLabel, label, scope),
112
+ name: optionalString(attrs, "name", where, ctx) ?? "",
113
+ dashboardKey: scopedLabelToBagKey(owner.ownerTfLabel, dashboardLabel, scope),
114
+ ...(typeof attrs["allow_record_creation"] === "boolean" && { allowRecordCreation: attrs["allow_record_creation"] }),
115
+ ...(filter !== undefined && { filter }),
116
+ ...(sort !== undefined && { sort }),
117
+ ...(userIds !== undefined && { userIds }),
118
+ ...(groupIds !== undefined && { groupIds }),
119
+ };
120
+ }
121
+ function calendarViewFromTf(block, owner, ctx) {
122
+ return typedFieldViewFromTf(block, owner, CALENDAR_VIEW_RESOURCE_TYPE, KNOWN_CALENDAR_VIEW_ATTRS, false, ctx);
123
+ }
124
+ function kanbanViewFromTf(block, owner, ctx) {
125
+ return typedFieldViewFromTf(block, owner, KANBAN_VIEW_RESOURCE_TYPE, KNOWN_KANBAN_VIEW_ATTRS, true, ctx);
126
+ }
127
+ function typedFieldViewFromTf(block, owner, resourceType, knownAttrs, includeAllowedFilterFields, ctx) {
128
+ const label = block.label;
129
+ if (label === undefined || label === "") {
130
+ ctx.diagnostics.push(`${resourceType} block is missing its label; skipped`);
131
+ return undefined;
132
+ }
133
+ const attrs = block.attrs;
134
+ const kind = resourceType === CALENDAR_VIEW_RESOURCE_TYPE ? "calendar" : "kanban";
135
+ const where = `${kind} view "${label}"`;
136
+ reportUnknownAttrs(attrs, knownAttrs, where, `${kind}ViewFromTf`, ctx);
137
+ if (resourceRefLabel(attrs["aspect_id"], owner.type) !== owner.label) {
138
+ ctx.diagnostics.push(`${where}: aspect_id does not reference ${owner.type}.${owner.label}; skipped`);
139
+ return undefined;
140
+ }
141
+ const scope = owner.scope ?? "app";
142
+ const readFields = (attr) => {
143
+ const raw = attrs[attr];
144
+ if (raw === undefined)
145
+ return undefined;
146
+ if (!Array.isArray(raw)) {
147
+ ctx.diagnostics.push(`${where}: ${attr} is not a list; dropped`);
148
+ return undefined;
149
+ }
150
+ const fields = [];
151
+ for (const value of raw) {
152
+ const key = fieldRefFromTf(value, owner.label, owner.ownerTfLabel, scope, ctx);
153
+ if (key !== undefined)
154
+ fields.push(key);
155
+ }
156
+ return fields;
157
+ };
158
+ const columns = readFields("columns") ?? [];
159
+ const displayByField = attrs["display_by_field"] !== undefined
160
+ ? fieldRefFromTf(attrs["display_by_field"], owner.label, owner.ownerTfLabel, scope, ctx)
161
+ : undefined;
162
+ const allowedFilterFields = includeAllowedFilterFields ? readFields("allowed_filter_fields") : undefined;
163
+ const sort = jsonencodeValue(attrs["sort"]);
164
+ if (attrs["sort"] !== undefined && sort === undefined) {
165
+ ctx.diagnostics.push(`${where}: sort is not a jsonencode(...) expression; dropped`);
45
166
  }
46
- return { layouts, listViews, ...(viewOrder !== undefined ? { viewOrder } : {}) };
167
+ const userIds = principalList(attrs["user_ids"], "elementum_user", `${where}: user_ids`, ctx);
168
+ const groupIds = principalList(attrs["group_ids"], "elementum_group", `${where}: group_ids`, ctx);
169
+ const filter = viewFilter(attrs["filter"], owner, where);
170
+ return {
171
+ key: scopedLabelToBagKey(owner.ownerTfLabel, label, scope),
172
+ name: optionalString(attrs, "name", where, ctx) ?? "",
173
+ columns,
174
+ ...(displayByField !== undefined && { displayByField }),
175
+ ...(allowedFilterFields !== undefined && { allowedFilterFields }),
176
+ ...(typeof attrs["allow_record_creation"] === "boolean" && { allowRecordCreation: attrs["allow_record_creation"] }),
177
+ ...(filter !== undefined && { filter }),
178
+ ...(sort !== undefined && { sort }),
179
+ ...(userIds !== undefined && { userIds }),
180
+ ...(groupIds !== undefined && { groupIds }),
181
+ };
182
+ }
183
+ function agentViewFromTf(block, owner, ctx) {
184
+ const label = block.label;
185
+ if (label === undefined || label === "") {
186
+ ctx.diagnostics.push(`${AGENT_VIEW_RESOURCE_TYPE} block is missing its label; skipped`);
187
+ return undefined;
188
+ }
189
+ const attrs = block.attrs;
190
+ const where = `agent view "${label}"`;
191
+ reportUnknownAttrs(attrs, KNOWN_AGENT_VIEW_ATTRS, where, "agentViewFromTf", ctx);
192
+ if (resourceRefLabel(attrs["aspect_id"], owner.type) !== owner.label) {
193
+ ctx.diagnostics.push(`${where}: aspect_id does not reference ${owner.type}.${owner.label}; skipped`);
194
+ return undefined;
195
+ }
196
+ const agentLabel = resourceRefLabel(attrs["agent_id"], "elementum_agent");
197
+ if (agentLabel === undefined) {
198
+ ctx.diagnostics.push(`${where}: agent_id is not an elementum_agent resource reference; skipped`);
199
+ return undefined;
200
+ }
201
+ const scope = owner.scope ?? "app";
202
+ const sort = jsonencodeValue(attrs["sort"]);
203
+ if (attrs["sort"] !== undefined && sort === undefined) {
204
+ ctx.diagnostics.push(`${where}: sort is not a jsonencode(...) expression; dropped`);
205
+ }
206
+ const userIds = principalList(attrs["user_ids"], "elementum_user", `${where}: user_ids`, ctx);
207
+ const groupIds = principalList(attrs["group_ids"], "elementum_group", `${where}: group_ids`, ctx);
208
+ const filter = viewFilter(attrs["filter"], owner, where);
209
+ return {
210
+ key: scopedLabelToBagKey(owner.ownerTfLabel, label, scope),
211
+ name: optionalString(attrs, "name", where, ctx) ?? "",
212
+ agentKey: scopedLabelToBagKey(owner.ownerTfLabel, agentLabel, scope),
213
+ ...(typeof attrs["allow_record_creation"] === "boolean" && { allowRecordCreation: attrs["allow_record_creation"] }),
214
+ ...(filter !== undefined && { filter }),
215
+ ...(sort !== undefined && { sort }),
216
+ ...(userIds !== undefined && { userIds }),
217
+ ...(groupIds !== undefined && { groupIds }),
218
+ ...(typeof attrs["display_order"] === "number" && { displayOrder: attrs["display_order"] }),
219
+ };
47
220
  }
48
221
  function layoutFromTf(block, owner, ctx) {
49
222
  const label = block.label ?? "";
@@ -175,19 +348,16 @@ function listViewFromTf(block, owner, ctx) {
175
348
  else if (columnsAttr !== undefined) {
176
349
  ctx.diagnostics.push(`${where}: columns is not a list; dropped`);
177
350
  }
178
- // Opaque JSON pass-through: `elementum build` is stateless and never reads
179
- // current state, so if these were left unauthored, `to-tf` would author
351
+ // `elementum build` is stateless and never reads current state, so if these
352
+ // were left unauthored, `to-tf` would author
180
353
  // "absent" — forcing terraform to null out whatever's actually live on
181
354
  // every plan. Confirmed live: that trips a real provider bug ("provider
182
355
  // produced inconsistent result after apply", .sort was null but is still
183
356
  // reported non-null) on ANY list view with either attribute set. Round-
184
- // tripping the raw value, opaque and untyped, avoids ever manufacturing
185
- // that diff in the first place.
186
- const filter = jsonencodeValue(attrs["filter"]);
357
+ // round-tripping both values avoids ever manufacturing that diff. Filters
358
+ // still decode through the shared typed codec; sort remains opaque JSON.
359
+ const filter = viewFilter(attrs["filter"], owner, where);
187
360
  const sort = jsonencodeValue(attrs["sort"]);
188
- if (attrs["filter"] !== undefined && filter === undefined) {
189
- ctx.diagnostics.push(`${where}: filter is not a jsonencode(...) expression; dropped`);
190
- }
191
361
  if (attrs["sort"] !== undefined && sort === undefined) {
192
362
  ctx.diagnostics.push(`${where}: sort is not a jsonencode(...) expression; dropped`);
193
363
  }
@@ -206,7 +376,7 @@ function listViewFromTf(block, owner, ctx) {
206
376
  function jsonencodeValue(v) {
207
377
  return v !== undefined && isTfExpr(v) && v.$expr === "jsonencode" ? v.value : undefined;
208
378
  }
209
- function managedViewOrderFromTf(block, owner, keyByTfLabel, ctx) {
379
+ function managedViewOrderFromTf(block, owner, keyByAddress, ctx) {
210
380
  const label = block.label ?? "?";
211
381
  const attrs = block.attrs;
212
382
  const where = `managed view order "${label}"`;
@@ -223,8 +393,22 @@ function managedViewOrderFromTf(block, owner, keyByTfLabel, ctx) {
223
393
  }
224
394
  const order = [];
225
395
  for (const v of viewIdsAttr) {
226
- const tfLabel = resourceRefLabel(v, LIST_VIEW_RESOURCE_TYPE);
227
- const key = tfLabel !== undefined ? keyByTfLabel.get(tfLabel) : undefined;
396
+ const listLabel = resourceRefLabel(v, LIST_VIEW_RESOURCE_TYPE);
397
+ const agentLabel = resourceRefLabel(v, AGENT_VIEW_RESOURCE_TYPE);
398
+ const calendarLabel = resourceRefLabel(v, CALENDAR_VIEW_RESOURCE_TYPE);
399
+ const kanbanLabel = resourceRefLabel(v, KANBAN_VIEW_RESOURCE_TYPE);
400
+ const dashboardLabel = resourceRefLabel(v, DASHBOARD_VIEW_RESOURCE_TYPE);
401
+ const key = listLabel !== undefined
402
+ ? keyByAddress.get(`${LIST_VIEW_RESOURCE_TYPE}.${listLabel}`)
403
+ : agentLabel !== undefined
404
+ ? keyByAddress.get(`${AGENT_VIEW_RESOURCE_TYPE}.${agentLabel}`)
405
+ : calendarLabel !== undefined
406
+ ? keyByAddress.get(`${CALENDAR_VIEW_RESOURCE_TYPE}.${calendarLabel}`)
407
+ : kanbanLabel !== undefined
408
+ ? keyByAddress.get(`${KANBAN_VIEW_RESOURCE_TYPE}.${kanbanLabel}`)
409
+ : dashboardLabel !== undefined
410
+ ? keyByAddress.get(`${DASHBOARD_VIEW_RESOURCE_TYPE}.${dashboardLabel}`)
411
+ : undefined;
228
412
  if (key === undefined) {
229
413
  ctx.diagnostics.push(`${where}: a view_ids entry does not resolve to a known list view; dropped`);
230
414
  continue;
@@ -1,6 +1,6 @@
1
1
  /** The view entity's registry entries (see src/graph/). */
2
2
  import { NO_CANVAS, NO_CATALOG, NO_DATA, NO_LIFECYCLE, } from "../../graph/types.js";
3
- import { LAYOUT_RESOURCE_TYPE, LIST_VIEW_RESOURCE_TYPE, MANAGED_VIEW_ORDER_RESOURCE_TYPE, } from "./types.js";
3
+ import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, LAYOUT_RESOURCE_TYPE, LIST_VIEW_RESOURCE_TYPE, MANAGED_VIEW_ORDER_RESOURCE_TYPE, } from "./types.js";
4
4
  /**
5
5
  * Layouts + list views are stream members folded into the app authoring file
6
6
  * (inline), extracted by `appFromTf` — not own-file kinds.
@@ -18,6 +18,10 @@ export const viewModule = {
18
18
  rows: [
19
19
  { key: "layout", resourceType: LAYOUT_RESOURCE_TYPE, implemented: true },
20
20
  { key: "listView", resourceType: LIST_VIEW_RESOURCE_TYPE, implemented: true },
21
+ { key: "agentView", resourceType: AGENT_VIEW_RESOURCE_TYPE, implemented: true },
22
+ { key: "calendarView", resourceType: CALENDAR_VIEW_RESOURCE_TYPE, implemented: true },
23
+ { key: "dashboardView", resourceType: DASHBOARD_VIEW_RESOURCE_TYPE, implemented: true },
24
+ { key: "kanbanView", resourceType: KANBAN_VIEW_RESOURCE_TYPE, implemented: true },
21
25
  ],
22
26
  },
23
27
  data: NO_DATA,
@@ -5,12 +5,14 @@
5
5
  * and supplies the `objectId` back-reference — this module never names the
6
6
  * app's own resource type.
7
7
  *
8
- * Unsupported authoring shapes degrade through `diagnostics` — reported,
9
- * never silent. `children`-shaped structural breakage isn't possible here
10
- * (views have no nested sub-entities of their own), so this module never
11
- * throws `EntityTfError`.
8
+ * Unsupported structural view shapes degrade through `diagnostics` —
9
+ * reported, never silent. Invalid authored filter trees fail at build time
10
+ * with the same `EntityTfError` path used by access-policy row filters.
12
11
  */
13
12
  import { type ChildResourceScope, type TfBlock, type TfValue } from "../../engine/tf/index.js";
13
+ import type { Filter } from "../shared/filters/types.js";
14
+ import type { AccessPolicyGroupRef, AccessPolicyUserRef } from "../access-policy/principal.js";
15
+ import type { OrgRefLookup } from "../../engine/build/context.js";
14
16
  /** The authored field-ref shape post-`slimTokens`: a system key string, or a slimmed `FieldRef` token. */
15
17
  export type ViewFieldRefWire = string | {
16
18
  readonly __kind?: string;
@@ -36,12 +38,49 @@ export interface AppListViewWire {
36
38
  readonly allowRecordCreation?: boolean;
37
39
  readonly density?: string;
38
40
  readonly rows?: number;
39
- /** Opaque JSON pass-through (see `entities/app/build.ts`'s `AppListView.filter` for why). */
40
- readonly filter?: unknown;
41
+ /** Provider filter tree; authored field tokens resolve to deployed field IDs. */
42
+ readonly filter?: Filter;
41
43
  /** Opaque JSON pass-through — see `filter`. */
42
44
  readonly sort?: unknown;
43
45
  }
46
+ export interface AppAgentViewWire {
47
+ readonly name?: string;
48
+ readonly agent?: {
49
+ readonly refName?: string;
50
+ readonly parent?: string;
51
+ };
52
+ readonly allowRecordCreation?: boolean;
53
+ readonly filter?: Filter;
54
+ readonly sort?: unknown;
55
+ readonly userIds?: readonly AccessPolicyUserRef[];
56
+ readonly groupIds?: readonly AccessPolicyGroupRef[];
57
+ readonly displayOrder?: number;
58
+ }
59
+ export interface AppCalendarViewWire {
60
+ readonly name?: string;
61
+ readonly columns?: readonly ViewFieldRefWire[];
62
+ readonly displayByField?: ViewFieldRefWire;
63
+ readonly allowRecordCreation?: boolean;
64
+ readonly filter?: Filter;
65
+ readonly sort?: unknown;
66
+ readonly userIds?: readonly AccessPolicyUserRef[];
67
+ readonly groupIds?: readonly AccessPolicyGroupRef[];
68
+ }
69
+ export interface AppKanbanViewWire extends AppCalendarViewWire {
70
+ readonly allowedFilterFields?: readonly ViewFieldRefWire[];
71
+ }
72
+ export interface AppDashboardViewWire {
73
+ readonly name?: string;
74
+ readonly dashboard?: string;
75
+ readonly allowRecordCreation?: boolean;
76
+ readonly filter?: Filter;
77
+ readonly sort?: unknown;
78
+ readonly userIds?: readonly AccessPolicyUserRef[];
79
+ readonly groupIds?: readonly AccessPolicyGroupRef[];
80
+ }
44
81
  export interface ViewToTfOptions {
82
+ /** Owning authoring refName, for validating catalog-token parents. */
83
+ readonly ownerRefName: string;
45
84
  /** The owning stream root's terraform label (namespace). */
46
85
  readonly ownerTfLabel: string;
47
86
  /** App children use `apps_<ns>_`; element children use `<ns>_`. */
@@ -55,6 +94,9 @@ export interface ViewToTfOptions {
55
94
  readonly aspectName: string;
56
95
  /** The owning aspect's id reference — computed by the caller. */
57
96
  readonly objectId: TfValue;
97
+ /** Declared sibling dashboard keys, for fail-fast dashboard-view references. */
98
+ readonly dashboardKeys?: ReadonlySet<string>;
99
+ readonly orgRefs?: OrgRefLookup;
58
100
  /** Degradations land here — reported by the caller, never silent. */
59
101
  readonly diagnostics: string[];
60
102
  }
@@ -62,4 +104,4 @@ export interface ViewToTfResult {
62
104
  readonly blocks: readonly TfBlock[];
63
105
  }
64
106
  /** `layouts`/`listViews`/`viewOrder` → their resource blocks, in ei's dialect. */
65
- export declare function viewToTf(layouts: Readonly<Record<string, AppLayoutWire>> | undefined, listViews: Readonly<Record<string, AppListViewWire>> | undefined, viewOrder: readonly string[] | undefined, opts: ViewToTfOptions): ViewToTfResult;
107
+ export declare function viewToTf(layouts: Readonly<Record<string, AppLayoutWire>> | undefined, listViews: Readonly<Record<string, AppListViewWire>> | undefined, calendarViews: Readonly<Record<string, AppCalendarViewWire>> | undefined, kanbanViews: Readonly<Record<string, AppKanbanViewWire>> | undefined, dashboardViews: Readonly<Record<string, AppDashboardViewWire>> | undefined, agentViews: Readonly<Record<string, AppAgentViewWire>> | undefined, viewOrder: readonly string[] | undefined, opts: ViewToTfOptions): ViewToTfResult;
@@ -5,20 +5,21 @@
5
5
  * and supplies the `objectId` back-reference — this module never names the
6
6
  * app's own resource type.
7
7
  *
8
- * Unsupported authoring shapes degrade through `diagnostics` — reported,
9
- * never silent. `children`-shaped structural breakage isn't possible here
10
- * (views have no nested sub-entities of their own), so this module never
11
- * throws `EntityTfError`.
8
+ * Unsupported structural view shapes degrade through `diagnostics` —
9
+ * reported, never silent. Invalid authored filter trees fail at build time
10
+ * with the same `EntityTfError` path used by access-policy row filters.
12
11
  */
13
12
  import { expr, isCanonicalTsLabel, sanitizeName, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
14
13
  import { fieldRefToTfValue as customFieldRefToTfValue } from "../field/to-tf.js";
14
+ import { filterToTf, principalListToTf } from "../access-policy/to-tf.js";
15
15
  import { SUB_TYPE_BY_AUTHORING_TYPE } from "../field/types.js";
16
- import { GROUP_SECTION_WIRE_TYPE, LAYOUT_RESOURCE_TYPE, LAYOUT_RESTRICTED_SYSTEM_FIELD_KEYS, LIST_VIEW_RESOURCE_TYPE, MANAGED_VIEW_ORDER_RESOURCE_TYPE, SECTION_TYPE_TO_WIRE, SYSTEM_FIELD_ID_ATTR_BY_KEY, UPDATE_SECTION_WIRE_TYPE, } from "./types.js";
16
+ import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, GROUP_SECTION_WIRE_TYPE, LAYOUT_RESOURCE_TYPE, LAYOUT_RESTRICTED_SYSTEM_FIELD_KEYS, LIST_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, MANAGED_VIEW_ORDER_RESOURCE_TYPE, SECTION_TYPE_TO_WIRE, SYSTEM_FIELD_ID_ATTR_BY_KEY, UPDATE_SECTION_WIRE_TYPE, } from "./types.js";
17
17
  /** Elements only have `id`/`title` as real system fields (no status/stage/audit fields) — see `element/locals.ts`. */
18
18
  const ELEMENT_SYSTEM_FIELD_KEYS = new Set(["id", "title"]);
19
19
  /** `layouts`/`listViews`/`viewOrder` → their resource blocks, in ei's dialect. */
20
- export function viewToTf(layouts, listViews, viewOrder, opts) {
21
- const { ownerTfLabel, scope = "app", aspectName, objectId, diagnostics } = opts;
20
+ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboardViews, agentViews, viewOrder, opts) {
21
+ const { ownerRefName, ownerTfLabel, scope = "app", aspectName, objectId, diagnostics } = opts;
22
+ const principalCtx = { ...opts, scope, objectId };
22
23
  const blocks = [];
23
24
  for (const [stageKey, layout] of Object.entries(layouts ?? {})) {
24
25
  if (!isCanonicalTsLabel(stageKey)) {
@@ -42,34 +43,170 @@ export function viewToTf(layouts, listViews, viewOrder, opts) {
42
43
  density: view.density ?? "STANDARD",
43
44
  rows: view.rows ?? 25,
44
45
  };
45
- if (view.filter !== undefined)
46
- attrs.filter = expr.jsonencode(view.filter);
46
+ if (view.filter !== undefined) {
47
+ attrs.filter = filterToTf(view.filter, `listViews.${viewKey}.filter`, {
48
+ ownerTfLabel,
49
+ scope,
50
+ objectId,
51
+ diagnostics,
52
+ });
53
+ }
47
54
  if (view.sort !== undefined)
48
55
  attrs.sort = expr.jsonencode(view.sort);
49
56
  blocks.push({ kind: "resource", type: LIST_VIEW_RESOURCE_TYPE, label: tfLabel, attrs });
50
- viewAddressByKey.set(viewKey, tfLabel);
57
+ viewAddressByKey.set(viewKey, { type: LIST_VIEW_RESOURCE_TYPE, label: tfLabel });
58
+ }
59
+ for (const [bagName, resourceType, views] of [
60
+ ["calendarViews", CALENDAR_VIEW_RESOURCE_TYPE, calendarViews],
61
+ ["kanbanViews", KANBAN_VIEW_RESOURCE_TYPE, kanbanViews],
62
+ ]) {
63
+ for (const [viewKey, view] of Object.entries(views ?? {})) {
64
+ if (!isCanonicalTsLabel(viewKey)) {
65
+ diagnostics.push(`${bagName} key "${viewKey}" is not a canonical tsLabel (see src/engine/tf/labels.ts) — rename the key`);
66
+ continue;
67
+ }
68
+ if (viewAddressByKey.has(viewKey)) {
69
+ diagnostics.push(`${bagName}.${viewKey} collides with another view using that key; dropped`);
70
+ continue;
71
+ }
72
+ const tfLabel = scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(viewKey), scope);
73
+ const where = `${bagName}.${viewKey}`;
74
+ const attrs = {
75
+ aspect_id: objectId,
76
+ name: view.name ?? "",
77
+ allow_record_creation: view.allowRecordCreation ?? true,
78
+ columns: resolveFieldRefs(view.columns ?? [], ownerTfLabel, scope, `${where}.columns`, diagnostics),
79
+ };
80
+ if (view.displayByField !== undefined) {
81
+ const displayBy = fieldRefToTfValue(view.displayByField, ownerTfLabel, scope, `${where}.displayByField`, diagnostics);
82
+ if (displayBy !== undefined)
83
+ attrs["display_by_field"] = displayBy;
84
+ }
85
+ if (resourceType === KANBAN_VIEW_RESOURCE_TYPE) {
86
+ const allowed = view.allowedFilterFields;
87
+ if (allowed !== undefined) {
88
+ attrs["allowed_filter_fields"] = resolveFieldRefs(allowed, ownerTfLabel, scope, `${where}.allowedFilterFields`, diagnostics);
89
+ }
90
+ }
91
+ if (view.filter !== undefined)
92
+ attrs["filter"] = filterToTf(view.filter, `${where}.filter`, { ownerTfLabel, scope, objectId, diagnostics });
93
+ if (view.sort !== undefined)
94
+ attrs["sort"] = expr.jsonencode(view.sort);
95
+ const userIds = principalListToTf(view.userIds, "elementum_user", `${where}.userIds`, principalCtx);
96
+ const groupIds = principalListToTf(view.groupIds, "elementum_group", `${where}.groupIds`, principalCtx);
97
+ if (userIds !== undefined)
98
+ attrs["user_ids"] = userIds;
99
+ if (groupIds !== undefined)
100
+ attrs["group_ids"] = groupIds;
101
+ blocks.push({ kind: "resource", type: resourceType, label: tfLabel, attrs });
102
+ viewAddressByKey.set(viewKey, { type: resourceType, label: tfLabel });
103
+ }
104
+ }
105
+ for (const [viewKey, view] of Object.entries(dashboardViews ?? {})) {
106
+ if (!isCanonicalTsLabel(viewKey)) {
107
+ diagnostics.push(`dashboardViews key "${viewKey}" is not a canonical tsLabel (see src/engine/tf/labels.ts) — rename the key`);
108
+ continue;
109
+ }
110
+ if (viewAddressByKey.has(viewKey)) {
111
+ diagnostics.push(`dashboardViews.${viewKey} collides with another view using that key; dropped`);
112
+ continue;
113
+ }
114
+ const dashboardKey = view.dashboard ?? "";
115
+ if (!isCanonicalTsLabel(dashboardKey)) {
116
+ diagnostics.push(`dashboardViews.${viewKey}.dashboard is not a declared canonical dashboard key; dropped`);
117
+ continue;
118
+ }
119
+ if (opts.dashboardKeys !== undefined && !opts.dashboardKeys.has(dashboardKey)) {
120
+ diagnostics.push(`dashboardViews.${viewKey}.dashboard references missing dashboards.${dashboardKey}; dropped`);
121
+ continue;
122
+ }
123
+ const tfLabel = scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(viewKey), scope);
124
+ const attrs = {
125
+ aspect_id: objectId,
126
+ name: view.name ?? "",
127
+ dashboard_id: expr.resourceAttr("elementum_dashboard", scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(dashboardKey), scope), ["id"]),
128
+ allow_record_creation: view.allowRecordCreation ?? true,
129
+ };
130
+ if (view.filter !== undefined)
131
+ attrs["filter"] = filterToTf(view.filter, `dashboardViews.${viewKey}.filter`, { ownerTfLabel, scope, objectId, diagnostics });
132
+ if (view.sort !== undefined)
133
+ attrs["sort"] = expr.jsonencode(view.sort);
134
+ const userIds = principalListToTf(view.userIds, "elementum_user", `dashboardViews.${viewKey}.userIds`, principalCtx);
135
+ const groupIds = principalListToTf(view.groupIds, "elementum_group", `dashboardViews.${viewKey}.groupIds`, principalCtx);
136
+ if (userIds !== undefined)
137
+ attrs["user_ids"] = userIds;
138
+ if (groupIds !== undefined)
139
+ attrs["group_ids"] = groupIds;
140
+ blocks.push({ kind: "resource", type: DASHBOARD_VIEW_RESOURCE_TYPE, label: tfLabel, attrs });
141
+ viewAddressByKey.set(viewKey, { type: DASHBOARD_VIEW_RESOURCE_TYPE, label: tfLabel });
142
+ }
143
+ for (const [viewKey, view] of Object.entries(agentViews ?? {})) {
144
+ if (!isCanonicalTsLabel(viewKey)) {
145
+ diagnostics.push(`agentViews key "${viewKey}" is not a canonical tsLabel (see src/engine/tf/labels.ts) — rename the key`);
146
+ continue;
147
+ }
148
+ if (viewAddressByKey.has(viewKey)) {
149
+ diagnostics.push(`agentViews.${viewKey} collides with listViews.${viewKey}; dropped`);
150
+ continue;
151
+ }
152
+ const agentRefName = view.agent?.refName ?? "";
153
+ if (agentRefName === "") {
154
+ diagnostics.push(`agentViews.${viewKey} has no agent token; dropped`);
155
+ continue;
156
+ }
157
+ if (view.agent?.parent !== ownerRefName) {
158
+ diagnostics.push(`agentViews.${viewKey} targets an agent outside this app; dropped`);
159
+ continue;
160
+ }
161
+ const tfLabel = scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(viewKey), scope);
162
+ const attrs = {
163
+ aspect_id: objectId,
164
+ agent_id: expr.resourceAttr("elementum_agent", scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(agentRefName), scope), ["id"]),
165
+ name: view.name ?? "",
166
+ allow_record_creation: view.allowRecordCreation ?? true,
167
+ };
168
+ if (view.filter !== undefined)
169
+ attrs["filter"] = filterToTf(view.filter, `agentViews.${viewKey}.filter`, { ownerTfLabel, scope, objectId, diagnostics });
170
+ if (view.sort !== undefined)
171
+ attrs["sort"] = expr.jsonencode(view.sort);
172
+ const userIds = principalListToTf(view.userIds, "elementum_user", `agentViews.${viewKey}.userIds`, principalCtx);
173
+ const groupIds = principalListToTf(view.groupIds, "elementum_group", `agentViews.${viewKey}.groupIds`, principalCtx);
174
+ if (userIds !== undefined)
175
+ attrs["user_ids"] = userIds;
176
+ if (groupIds !== undefined)
177
+ attrs["group_ids"] = groupIds;
178
+ if (view.displayOrder !== undefined)
179
+ attrs["display_order"] = view.displayOrder;
180
+ blocks.push({ kind: "resource", type: AGENT_VIEW_RESOURCE_TYPE, label: tfLabel, attrs });
181
+ viewAddressByKey.set(viewKey, { type: AGENT_VIEW_RESOURCE_TYPE, label: tfLabel });
51
182
  }
52
183
  if (viewAddressByKey.size > 0) {
53
- const orderKeys = viewOrder ?? Object.keys(listViews ?? {});
184
+ const orderKeys = viewOrder ?? [
185
+ ...Object.keys(listViews ?? {}),
186
+ ...Object.keys(calendarViews ?? {}),
187
+ ...Object.keys(kanbanViews ?? {}),
188
+ ...Object.keys(dashboardViews ?? {}),
189
+ ...Object.keys(agentViews ?? {}),
190
+ ];
54
191
  const placed = new Set();
55
192
  const viewIds = [];
56
193
  for (const key of orderKeys) {
57
- const tfLabel = viewAddressByKey.get(key);
58
- if (tfLabel === undefined) {
59
- diagnostics.push(`viewOrder: "${key}" is not a declared listViews key; dropped`);
194
+ const address = viewAddressByKey.get(key);
195
+ if (address === undefined) {
196
+ diagnostics.push(`viewOrder: "${key}" is not a declared view key; dropped`);
60
197
  continue;
61
198
  }
62
199
  placed.add(key);
63
- viewIds.push(expr.resourceAttr(LIST_VIEW_RESOURCE_TYPE, tfLabel, ["id"]));
200
+ viewIds.push(expr.resourceAttr(address.type, address.label, ["id"]));
64
201
  }
65
202
  // Every declared list view must appear even if viewOrder omitted it —
66
203
  // otherwise the omitted view has no ordering entry and the platform
67
204
  // may reject or silently exclude it from the managed order.
68
- for (const [key, tfLabel] of viewAddressByKey) {
205
+ for (const [key, address] of viewAddressByKey) {
69
206
  if (placed.has(key))
70
207
  continue;
71
- diagnostics.push(`listViews.${key} is not listed in viewOrder; appended`);
72
- viewIds.push(expr.resourceAttr(LIST_VIEW_RESOURCE_TYPE, tfLabel, ["id"]));
208
+ diagnostics.push(`view "${key}" is not listed in viewOrder; appended`);
209
+ viewIds.push(expr.resourceAttr(address.type, address.label, ["id"]));
73
210
  }
74
211
  if (viewIds.length > 0) {
75
212
  blocks.push({
@@ -12,6 +12,10 @@
12
12
  */
13
13
  export declare const LAYOUT_RESOURCE_TYPE = "elementum_layout";
14
14
  export declare const LIST_VIEW_RESOURCE_TYPE = "elementum_list_view";
15
+ export declare const AGENT_VIEW_RESOURCE_TYPE = "elementum_agent_view";
16
+ export declare const CALENDAR_VIEW_RESOURCE_TYPE = "elementum_calendar_view";
17
+ export declare const KANBAN_VIEW_RESOURCE_TYPE = "elementum_kanban_view";
18
+ export declare const DASHBOARD_VIEW_RESOURCE_TYPE = "elementum_dashboard_view";
15
19
  export declare const MANAGED_VIEW_ORDER_RESOURCE_TYPE = "elementum_managed_view_order";
16
20
  /**
17
21
  * Layout section `type` discriminator: authoring camelCase ↔ the provider's
@@ -54,5 +58,9 @@ export declare const KNOWN_LAYOUT_ATTRS: ReadonlySet<string>;
54
58
  export declare const KNOWN_LAYOUT_SECTION_ATTRS: ReadonlySet<string>;
55
59
  /** Attributes `listViewFromTf` understands. */
56
60
  export declare const KNOWN_LIST_VIEW_ATTRS: ReadonlySet<string>;
61
+ export declare const KNOWN_AGENT_VIEW_ATTRS: ReadonlySet<string>;
62
+ export declare const KNOWN_CALENDAR_VIEW_ATTRS: ReadonlySet<string>;
63
+ export declare const KNOWN_KANBAN_VIEW_ATTRS: ReadonlySet<string>;
64
+ export declare const KNOWN_DASHBOARD_VIEW_ATTRS: ReadonlySet<string>;
57
65
  /** Attributes `managedViewOrderFromTf` understands. */
58
66
  export declare const KNOWN_MANAGED_VIEW_ORDER_ATTRS: ReadonlySet<string>;