@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
@@ -0,0 +1,17 @@
1
+ export function reportUnknownAttrs(attrs, known, where, passName, ctx) {
2
+ for (const key of Object.keys(attrs)) {
3
+ if (!known.has(key)) {
4
+ ctx.diagnostics.push(`${where}: unhandled attribute "${key}" — the export dialect grew; extend ${passName} deliberately`);
5
+ }
6
+ }
7
+ }
8
+ export function stringList(attrs, key, where, ctx) {
9
+ const raw = attrs[key];
10
+ if (raw === undefined)
11
+ return undefined;
12
+ if (!Array.isArray(raw) || raw.some((value) => typeof value !== "string")) {
13
+ ctx.diagnostics.push(`${where}: ${key} is not a string list; dropped`);
14
+ return undefined;
15
+ }
16
+ return raw;
17
+ }
@@ -10,14 +10,53 @@ export interface DataRef {
10
10
  readonly resourceType: string;
11
11
  readonly tfLabel: string;
12
12
  }
13
+ /** A managed resource recovered from the same export stream by its import id. */
14
+ export interface ImportedResourceRef {
15
+ readonly type: string;
16
+ readonly label: string;
17
+ readonly attrs: Readonly<Record<string, TfValue>>;
18
+ }
13
19
  /** Extraction context: stream lookups + the diagnostics sink. */
14
20
  export interface FromTfContext {
15
21
  /** Lookup-attr value of a data block in the same stream: ("elementum_category", "experiments") → "Experiments". */
16
22
  dataName(type: string, label: string): string | undefined;
17
23
  /** DataFacet.providerRefAttr's resolved reference on a data block in the same stream (connector's `provider_id` → its owning `elementum_<type>_ai_provider` block). */
18
24
  dataRef(type: string, label: string): DataRef | undefined;
25
+ /** Raw attributes from a data block in the same stream. */
26
+ dataAttrs?(type: string, label: string): Readonly<Record<string, TfValue>> | undefined;
19
27
  /** Platform id recorded by the stream's import blocks, by resource address. */
20
28
  importId(address: string): string | undefined;
29
+ /**
30
+ * Display name → refName for every app/element already on disk in this
31
+ * workspace (`readAppNameMap`/`readElementNameMap`) — lets a foreign
32
+ * `data.elementum_app.<label>`/`data.elementum_element.<label>` reference
33
+ * (whose only recoverable identity is the display name off its data
34
+ * block, not a raw platform id) resolve to a typed catalog ref instead of
35
+ * staying unresolvable. Undefined when the caller didn't wire it up (the
36
+ * reference then stays unresolvable, same as before this existed).
37
+ */
38
+ readonly foreignAppRefNames?: ReadonlyMap<string, string>;
39
+ readonly foreignElementRefNames?: ReadonlyMap<string, string>;
40
+ /**
41
+ * Foreign app/element display names this stream saw referenced (currently:
42
+ * a RELATION field's `related_object_id` as a `data.elementum_app`/
43
+ * `data.elementum_element` lookup) but couldn't resolve against
44
+ * `foreignAppRefNames`/`foreignElementRefNames` — lets `--with-dependencies`
45
+ * chase them down the same way it already does for agent-tool/automation
46
+ * targets, even though the value that referenced them gets skipped this
47
+ * pull (see field/from-tf.ts's `resolveRelatedObject`). Mutated in place by
48
+ * extractors that opt in; undefined for a caller that didn't wire it up
49
+ * (most offline unit tests), in which case the reference just stays
50
+ * unresolvable, same as before this existed.
51
+ */
52
+ readonly unresolvedForeignRefs?: {
53
+ readonly apps: Set<string>;
54
+ readonly elements: Set<string>;
55
+ };
56
+ /** Managed resource whose import block carries this platform id. */
57
+ importedResource?(id: string): ImportedResourceRef | undefined;
58
+ /** Managed resource declared at this exact Terraform address. */
59
+ resourceByAddress?(address: string): ImportedResourceRef | undefined;
21
60
  /** Degradations land here — reported by the caller, never silent. */
22
61
  readonly diagnostics: string[];
23
62
  /**
@@ -45,6 +45,7 @@ export interface OrgExtract {
45
45
  readonly connectors: readonly OrgIdentity[];
46
46
  readonly aiProviders: readonly OrgIdentity[];
47
47
  readonly groups: readonly OrgIdentity[];
48
+ readonly phoneProviders: readonly OrgIdentity[];
48
49
  /** The org app directory (namespace → platform id) from locals.org_apps. */
49
50
  readonly apps: Readonly<Record<string, string>>;
50
51
  }
@@ -32,6 +32,7 @@ export function extractOrg(doc) {
32
32
  connectors: [],
33
33
  aiProviders: [],
34
34
  groups: [],
35
+ phoneProviders: [],
35
36
  };
36
37
  let apps;
37
38
  for (const block of doc.blocks) {
@@ -82,6 +83,7 @@ export function extractOrg(doc) {
82
83
  connectors: withTsLabels(raw.connectors),
83
84
  aiProviders: withTsLabels(raw.aiProviders),
84
85
  groups: withTsLabels(raw.groups),
86
+ phoneProviders: withTsLabels(raw.phoneProviders),
85
87
  apps,
86
88
  };
87
89
  }
@@ -5,7 +5,7 @@
5
5
  * reference := ("data." type "." label | type "." label) ("." ident)* index?
6
6
  * | "local." ident
7
7
  * index := "[" quoted-string "]"
8
- * jsonencode:= "jsonencode(" hcl-literal ")"
8
+ * jsonencode:= "jsonencode(" hcl-value ")"
9
9
  *
10
10
  * plus templates: strings mixing literal text with ${...} parts.
11
11
  * Anything else is a LOUD error — an unknown form in a stream means the
@@ -5,7 +5,7 @@
5
5
  * reference := ("data." type "." label | type "." label) ("." ident)* index?
6
6
  * | "local." ident
7
7
  * index := "[" quoted-string "]"
8
- * jsonencode:= "jsonencode(" hcl-literal ")"
8
+ * jsonencode:= "jsonencode(" hcl-value ")"
9
9
  *
10
10
  * plus templates: strings mixing literal text with ${...} parts.
11
11
  * Anything else is a LOUD error — an unknown form in a stream means the
@@ -222,7 +222,7 @@ class Parser {
222
222
  }
223
223
  return path;
224
224
  }
225
- /** HCL literal value inside jsonencode(...): objects, arrays, scalars. */
225
+ /** HCL value inside jsonencode(...): objects, arrays, scalars, or supported references. */
226
226
  parseLiteral() {
227
227
  this.skipWs();
228
228
  const c = this.peek();
@@ -234,6 +234,7 @@ class Parser {
234
234
  return this.parseQuotedString();
235
235
  if (c === "-" || (c !== undefined && c >= "0" && c <= "9"))
236
236
  return this.parseNumber();
237
+ const identStart = this.pos;
237
238
  const ident = this.tryIdent();
238
239
  if (ident === "true")
239
240
  return true;
@@ -241,7 +242,13 @@ class Parser {
241
242
  return false;
242
243
  if (ident === "null")
243
244
  return null;
244
- throw new TfExprError(`unsupported value in jsonencode payload at "${this.rest().slice(0, 40)}" — only literals are in the grammar`, this.src);
245
+ if (ident !== null) {
246
+ this.pos = identStart;
247
+ if (ident === "data" || ident === "local" || ident.startsWith("elementum_")) {
248
+ return this.parseReference();
249
+ }
250
+ }
251
+ throw new TfExprError(`unsupported value in jsonencode payload at "${this.rest().slice(0, 40)}" — only literals and supported references are in the grammar`, this.src);
245
252
  }
246
253
  parseObjectLiteral() {
247
254
  this.expect("{");
@@ -29,9 +29,9 @@ const ASPECT_ROOTS = new Set(ENTITY_KIND_MODULES.flatMap((m) => {
29
29
  }));
30
30
  /**
31
31
  * Child bags under apps|elements: union of own-file bags under app/element,
32
- * plus legacy authoring dirs not yet registered as graph kinds (flows, …).
32
+ * plus legacy authoring dirs not yet registered as graph kinds.
33
33
  */
34
- const LEGACY_CHILD_BAGS = ["flows", "approval-chains", "tables", "fileReaders"];
34
+ const LEGACY_CHILD_BAGS = ["approval-chains", "tables", "fileReaders"];
35
35
  const CHILD_BAGS = new Set([
36
36
  ...ownFileBagsUnder("app"),
37
37
  ...ownFileBagsUnder("element"),
@@ -83,6 +83,8 @@ export function assertRelativeAuthoringPath(relPath) {
83
83
  throw new Error(`Flat authoring path is not allowed (${bag}/${stem}.ts). ` +
84
84
  `Use ${bag}/${stem}/${stem}.ts instead.`);
85
85
  }
86
+ if (parts.length === 4 && parts[2] === "search-tables")
87
+ return;
86
88
  throw new Error(`Org-owned table authoring path must be tables/<ref>/<ref>.ts, got: ${rel}`);
87
89
  }
88
90
  if (!bag || !ASPECT_ROOTS.has(bag)) {
@@ -4,21 +4,12 @@
4
4
  * `entities/element/build.ts`). Kept here, not duplicated per parent, since
5
5
  * both parents accept the identical shape.
6
6
  */
7
- import type { GroupRef } from "../../catalog/index.js";
8
- import type { AccessPolicyPrincipalRef } from "./from-tf.js";
9
- import type { AccessPolicyFilter } from "./filter.js";
10
- /**
11
- * A principal (user/group) reference: a raw platform id — EDK has no
12
- * `org.users` catalog bag to reference a user by handle (see
13
- * `entities/org/user.ts`) — or, for groups only, a real `org.groups.<key>`
14
- * catalog token. `AccessPolicyPrincipalRef` is the pulled-source echo (see
15
- * that type's own doc comment) — round-tripped, not meant to be hand-authored.
16
- */
17
- export type AccessPolicyUserRef = string | AccessPolicyPrincipalRef;
18
- export type AccessPolicyGroupRef = string | GroupRef | AccessPolicyPrincipalRef;
7
+ import type { Filter } from "../shared/filters/types.js";
8
+ import type { AccessPolicyGroupRef, AccessPolicyUserRef } from "./principal.js";
9
+ export { groupId, userId, type AccessPolicyGroupRef, type AccessPolicyPrincipal, type AccessPolicyPrincipalRef, type AccessPolicyUserRef, type GroupId, type UserId, } from "./principal.js";
19
10
  export interface AccessPolicyOptions {
20
11
  /** Row-level-security predicate. Omit for the platform default (matches every record). */
21
- readonly filter?: AccessPolicyFilter;
12
+ readonly filter?: Filter;
22
13
  readonly userIds?: readonly AccessPolicyUserRef[];
23
14
  readonly groupIds?: readonly AccessPolicyGroupRef[];
24
15
  /** Always raw platform ids — ei's exporter carries no `elementum_service_account` resource to reference yet. */
@@ -4,4 +4,4 @@
4
4
  * `entities/element/build.ts`). Kept here, not duplicated per parent, since
5
5
  * both parents accept the identical shape.
6
6
  */
7
- export {};
7
+ export { groupId, userId, } from "./principal.js";
@@ -11,8 +11,11 @@
11
11
  * dropped with a diagnostic rather than silently misattributed.
12
12
  */
13
13
  import { type FromTfContext } from "../../engine/pull/context.js";
14
- import { type ChildResourceScope, type TfBlock } from "../../engine/tf/index.js";
15
- import type { FilterAst } from "../shared/filters/ast.js";
14
+ import { type ChildResourceScope, type TfBlock, type TfValue } from "../../engine/tf/index.js";
15
+ import type { RefExpr } from "../shared/filters/ast.js";
16
+ import type { Filter } from "../shared/filters/types.js";
17
+ import { type AccessPolicyGroupRef, type AccessPolicyUserRef } from "./principal.js";
18
+ export type { AccessPolicyPrincipalRef } from "./principal.js";
16
19
  export interface AccessPolicyOwner {
17
20
  readonly type: string;
18
21
  readonly label: string;
@@ -22,45 +25,16 @@ export interface AccessPolicyOwner {
22
25
  readonly ownerTfLabel: string;
23
26
  readonly scope: ChildResourceScope;
24
27
  }
25
- /**
26
- * A resolved `data.elementum_user`/`data.elementum_group` reference, decoded
27
- * from a pulled stream — reproduced byte-for-byte by `to-tf.ts`'s
28
- * `rawLookup`, never re-derived. Also a valid `AccessPolicyUserRef`/
29
- * `AccessPolicyGroupRef` (see `build.ts`), so the printer can round-trip it
30
- * straight into `userIds`/`groupIds` without a separate print-time shape.
31
- */
32
- export interface AccessPolicyPrincipalRef {
33
- readonly __kind: "orgPrincipalRef";
34
- readonly dataType: "elementum_user" | "elementum_group";
35
- /** The data block's own label, captured verbatim — reproduced byte-for-byte, never re-derived. */
36
- readonly label: string;
37
- /** The data block's lookup-attr value ("email" for a user, "name" for a group). */
38
- readonly value: string;
39
- }
40
- /**
41
- * FilterAst kinds {@link decodeFilter} can emit — same set as
42
- * `access-policy/filter.ts` (no consecutiveRange / contains / overlaps).
43
- * Printer + hoist walker switch on this, not the full automation FilterAst,
44
- * so an automation-only kind cannot silently grow AP coverage. A new
45
- * FilterAst kind still fails exhaustiveness here until it is excluded or
46
- * implemented in decodeFilter + filter.ts.
47
- */
48
- export type AccessPolicyFilterAst = Exclude<FilterAst, {
49
- kind: "and" | "or";
50
- } | {
51
- kind: "consecutiveRange";
52
- } | {
53
- kind: "contains" | "overlaps";
54
- }> | {
55
- kind: "and" | "or";
56
- children: readonly AccessPolicyFilterAst[];
57
- };
58
28
  export interface NormalizedAccessPolicy {
59
- readonly filter: AccessPolicyFilterAst;
60
- readonly userIds?: readonly (string | AccessPolicyPrincipalRef)[];
61
- readonly groupIds?: readonly (string | AccessPolicyPrincipalRef)[];
29
+ readonly filter: Filter<RefExpr, RefExpr>;
30
+ readonly userIds?: readonly AccessPolicyUserRef[];
31
+ readonly groupIds?: readonly AccessPolicyGroupRef[];
62
32
  /** Always raw platform ids — ei's exporter carries no `elementum_service_account` resource to reference yet. */
63
33
  readonly serviceAccountIds?: readonly string[];
64
34
  }
35
+ /** Decode one `filter` attribute through the shared exhaustive codec. */
36
+ export declare function filterFromTf(value: TfValue, owner: AccessPolicyOwner, where: string): Filter<RefExpr, RefExpr>;
37
+ export declare function principalList(value: TfValue | undefined, dataType: "elementum_user", where: string, ctx: FromTfContext): AccessPolicyUserRef[] | undefined;
38
+ export declare function principalList(value: TfValue | undefined, dataType: "elementum_group", where: string, ctx: FromTfContext): AccessPolicyGroupRef[] | undefined;
65
39
  /** One `elementum_access_policy` block → its normalized shape, or undefined when it belongs to a different owner. */
66
40
  export declare function accessPolicyFromTf(block: TfBlock, owner: AccessPolicyOwner, ctx: FromTfContext): NormalizedAccessPolicy | undefined;
@@ -13,10 +13,9 @@
13
13
  import { EntityTfError } from "../../engine/entity.js";
14
14
  import { dataRefLabel, resourceRefLabel } from "../../engine/pull/context.js";
15
15
  import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
16
+ import { filterFromTf as deserializeFilterFromTf } from "../shared/filters/tf-codec.js";
17
+ import { groupId, userId, } from "./principal.js";
16
18
  import { KNOWN_ACCESS_POLICY_ATTRS } from "./types.js";
17
- function isObject(value) {
18
- return typeof value === "object" && value !== null && !Array.isArray(value);
19
- }
20
19
  function fieldRef(value, owner, where) {
21
20
  if (isTfExpr(value) && value.$expr === "resource-attr" && value.type.endsWith("_field") && value.path[0] === "id") {
22
21
  return { kind: "field", appHandle: owner.ownerRefName, fieldKey: scopedLabelToBagKey(owner.ownerTfLabel, value.label, owner.scope) };
@@ -52,74 +51,15 @@ function picklistOptionLabel(value) {
52
51
  ? segment.index
53
52
  : undefined;
54
53
  }
55
- function filterValue(value, owner, where) {
56
- const optionLabel = picklistOptionLabel(value);
57
- if (optionLabel !== undefined)
58
- return { kind: "text", value: optionLabel };
59
- if (!isObject(value) || isTfExpr(value))
60
- throw new EntityTfError(`${where}: filter value has an unrecognized shape`);
61
- const type = typeof value.type === "string" ? value.type.toLowerCase() : undefined;
62
- if (type === undefined)
63
- throw new EntityTfError(`${where}: filter value has no type`);
64
- if (type === "null")
65
- return { kind: "null" };
66
- if (type === "current_user") {
67
- const raw = typeof value.current_user_type === "string" ? value.current_user_type.toLowerCase() : "id";
68
- const currentUserType = raw === "email" || raw === "domain" ? raw : "id";
69
- return { kind: "currentUser", currentUserType };
70
- }
71
- if (["text", "number", "boolean", "uuid", "date", "datetime"].includes(type)) {
72
- return { kind: type, value: value.value };
73
- }
74
- if (type === "field")
75
- return { kind: "reference", ref: fieldRef(value.value, owner, where) };
76
- throw new EntityTfError(`${where}: unsupported filter value type "${type}"`);
77
- }
78
- /**
79
- * Decode one `filter` attribute. Kinds are the {@link AccessPolicyFilterAst}
80
- * set — `filter.ts` builders plus what ei actually exports. consecutiveRange /
81
- * contains / overlaps throw here rather than decode into FilterAst nodes the
82
- * printer cannot author.
83
- */
84
- function decodeFilter(value, owner, where) {
85
- if (!isObject(value) || isTfExpr(value) || typeof value.type !== "string")
86
- throw new EntityTfError(`${where}: invalid filter object`);
87
- const type = value.type.toLowerCase();
88
- if (type === "true" || type === "false")
89
- return { kind: type };
90
- if (type === "and" || type === "or") {
91
- if (!Array.isArray(value.children))
92
- throw new EntityTfError(`${where}: ${type} filter has no children`);
93
- return { kind: type, children: value.children.map((child) => decodeFilter(child, owner, where)) };
94
- }
95
- if (value.field_id === undefined)
96
- throw new EntityTfError(`${where}: ${type} filter has no field_id`);
97
- const left = fieldRef(value.field_id, owner, where);
98
- const not = value.not === true ? { not: true } : {};
99
- if (type === "is_null")
100
- return { kind: "isNull", left, ...not };
101
- if (type === "in") {
102
- if (!Array.isArray(value.values))
103
- throw new EntityTfError(`${where}: in filter has no values`);
104
- return { kind: "in", left, values: value.values.map((item) => filterValue(item, owner, where)), ...not };
105
- }
106
- if (type === "between") {
107
- if (!Array.isArray(value.values) || value.values.length !== 2)
108
- throw new EntityTfError(`${where}: between filter requires two values`);
109
- return { kind: "between", left, values: [filterValue(value.values[0], owner, where), filterValue(value.values[1], owner, where)], ...not };
110
- }
111
- const kindByType = {
112
- equals: "eq", greater_than: "gt", greater_than_equals: "gte", less_than: "lt", less_than_equals: "lte", like: "like",
113
- };
114
- const kind = kindByType[type];
115
- if (kind === undefined || value.value === undefined)
116
- throw new EntityTfError(`${where}: unsupported filter type "${type}"`);
117
- const right = filterValue(value.value, owner, where);
118
- return kind === "like"
119
- ? { kind, left, right, ...not, ...(typeof value.case_insensitive === "boolean" ? { caseInsensitive: value.case_insensitive } : {}), ...(typeof value.mode === "string" ? { mode: value.mode.toLowerCase() } : {}) }
120
- : { kind, left, right, ...not };
54
+ /** Decode one `filter` attribute through the shared exhaustive codec. */
55
+ export function filterFromTf(value, owner, where) {
56
+ const decoded = deserializeFilterFromTf(value, {
57
+ field: (fieldValue) => fieldRef(fieldValue, owner, where),
58
+ reference: () => { throw new EntityTfError(`${where}: access-policy reference values are not supported`); },
59
+ literal: (literal) => picklistOptionLabel(literal) ?? literal,
60
+ });
61
+ return decoded;
121
62
  }
122
- /** Decode one `user_ids`/`group_ids` list item: a `data.elementum_user|group` lookup, or a raw platform id fallback. undefined = dropped, with a diagnostic already pushed. */
123
63
  function principalListItem(item, dataType, where, ctx) {
124
64
  const label = dataRefLabel(item, dataType);
125
65
  if (label !== undefined) {
@@ -130,11 +70,11 @@ function principalListItem(item, dataType, where, ctx) {
130
70
  return undefined;
131
71
  }
132
72
  if (typeof item === "string")
133
- return item;
73
+ return dataType === "elementum_user" ? userId(item) : groupId(item);
134
74
  ctx.diagnostics.push(`${where}: list item has an unrecognized shape; dropped`);
135
75
  return undefined;
136
76
  }
137
- function principalList(value, dataType, where, ctx) {
77
+ export function principalList(value, dataType, where, ctx) {
138
78
  if (value === undefined)
139
79
  return undefined;
140
80
  if (!Array.isArray(value)) {
@@ -143,7 +83,9 @@ function principalList(value, dataType, where, ctx) {
143
83
  }
144
84
  const items = [];
145
85
  for (const item of value) {
146
- const decoded = principalListItem(item, dataType, where, ctx);
86
+ const decoded = dataType === "elementum_user"
87
+ ? principalListItem(item, "elementum_user", where, ctx)
88
+ : principalListItem(item, "elementum_group", where, ctx);
147
89
  if (decoded !== undefined)
148
90
  items.push(decoded);
149
91
  }
@@ -165,7 +107,7 @@ export function accessPolicyFromTf(block, owner, ctx) {
165
107
  ctx.diagnostics.push(`${where}: object_id does not reference ${owner.type}.${owner.label}; skipped`);
166
108
  return undefined;
167
109
  }
168
- const filter = attrs["filter"] !== undefined ? decodeFilter(attrs["filter"], owner, where) : { kind: "true" };
110
+ const filter = attrs["filter"] !== undefined ? filterFromTf(attrs["filter"], owner, where) : { type: "TRUE" };
169
111
  const userIds = principalList(attrs["user_ids"], "elementum_user", `${where}: user_ids`, ctx);
170
112
  const groupIds = principalList(attrs["group_ids"], "elementum_group", `${where}: group_ids`, ctx);
171
113
  let serviceAccountIds;
@@ -0,0 +1,29 @@
1
+ import type { GroupRef } from "../../catalog/index.js";
2
+ declare const userIdBrand: unique symbol;
3
+ declare const groupIdBrand: unique symbol;
4
+ /** A platform user id, kept distinct from every other string id. */
5
+ export type UserId = string & {
6
+ readonly [userIdBrand]: "UserId";
7
+ };
8
+ /** A platform group id, kept distinct from every other string id. */
9
+ export type GroupId = string & {
10
+ readonly [groupIdBrand]: "GroupId";
11
+ };
12
+ /** Mark an explicit platform user id. Prefer a portable user reference when one is available. */
13
+ export declare function userId(value: string): UserId;
14
+ /** Mark an explicit platform group id. Prefer an `org.groups.*` token when one is available. */
15
+ export declare function groupId(value: string): GroupId;
16
+ export type PrincipalDataType = "elementum_user" | "elementum_group";
17
+ /** A portable principal lookup preserved verbatim from pulled Terraform. */
18
+ export interface AccessPolicyPrincipalRef<DataType extends PrincipalDataType = PrincipalDataType> {
19
+ readonly __kind: "orgPrincipalRef";
20
+ readonly dataType: DataType;
21
+ /** The data block's own label, captured verbatim. */
22
+ readonly label: string;
23
+ /** The data block's lookup value: email for a user or name for a group. */
24
+ readonly value: string;
25
+ }
26
+ export type AccessPolicyUserRef = UserId | AccessPolicyPrincipalRef<"elementum_user">;
27
+ export type AccessPolicyGroupRef = GroupId | GroupRef | AccessPolicyPrincipalRef<"elementum_group">;
28
+ export type AccessPolicyPrincipal = AccessPolicyUserRef | AccessPolicyGroupRef;
29
+ export {};
@@ -0,0 +1,13 @@
1
+ import { EdkValidationError } from "../../../elementum-entity-client/errors.js";
2
+ /** Mark an explicit platform user id. Prefer a portable user reference when one is available. */
3
+ export function userId(value) {
4
+ if (value.trim() === "")
5
+ throw new EdkValidationError("userId requires a non-empty platform id.");
6
+ return value;
7
+ }
8
+ /** Mark an explicit platform group id. Prefer an `org.groups.*` token when one is available. */
9
+ export function groupId(value) {
10
+ if (value.trim() === "")
11
+ throw new EdkValidationError("groupId requires a non-empty platform id.");
12
+ return value;
13
+ }
@@ -19,6 +19,8 @@
19
19
  */
20
20
  import type { OrgRefLookup } from "../../engine/build/context.js";
21
21
  import { type ChildResourceScope, type TfBlock, type TfValue } from "../../engine/tf/index.js";
22
+ import type { Filter } from "../shared/filters/types.js";
23
+ import type { AccessPolicyGroupRef, AccessPolicyUserRef } from "./principal.js";
22
24
  export interface AccessPolicyToTfContext {
23
25
  readonly ownerTfLabel: string;
24
26
  readonly scope: ChildResourceScope;
@@ -27,17 +29,30 @@ export interface AccessPolicyToTfContext {
27
29
  readonly orgRefs: OrgRefLookup;
28
30
  readonly diagnostics: string[];
29
31
  }
32
+ /** Filter conversion only needs owner/field context; org lookups are accepted so full policy contexts remain assignable. */
33
+ export interface FilterToTfContext extends Omit<AccessPolicyToTfContext, "orgRefs"> {
34
+ readonly orgRefs?: OrgRefLookup;
35
+ }
30
36
  export interface AccessPolicyToTfResult {
31
37
  readonly block: TfBlock;
32
38
  readonly address: string;
33
39
  }
34
- /** Authored filter shape — a plain wire-like object produced by `filter.ts`'s helpers (never hand-built by callers). */
35
- export type AccessPolicyFilterInput = Record<string, unknown>;
40
+ /**
41
+ * Encode one canonical filter through the shared exhaustive Terraform codec.
42
+ * Access-policy filters omit the trigger/task `leftValue` branch.
43
+ */
44
+ export declare function filterToTf(f: Filter, where: string, ctx: FilterToTfContext): TfValue;
36
45
  export interface AccessPolicyEntryWire {
37
- readonly filter?: AccessPolicyFilterInput;
38
- readonly userIds?: readonly unknown[];
39
- readonly groupIds?: readonly unknown[];
46
+ readonly filter?: Filter;
47
+ readonly userIds?: readonly AccessPolicyUserRef[];
48
+ readonly groupIds?: readonly AccessPolicyGroupRef[];
40
49
  readonly serviceAccountIds?: readonly string[];
41
50
  }
51
+ export declare function principalListToTf(items: readonly AccessPolicyUserRef[] | undefined, dataType: "elementum_user", where: string, ctx: Omit<AccessPolicyToTfContext, "orgRefs"> & {
52
+ readonly orgRefs?: OrgRefLookup;
53
+ }): TfValue[] | undefined;
54
+ export declare function principalListToTf(items: readonly AccessPolicyGroupRef[] | undefined, dataType: "elementum_group", where: string, ctx: Omit<AccessPolicyToTfContext, "orgRefs"> & {
55
+ readonly orgRefs?: OrgRefLookup;
56
+ }): TfValue[] | undefined;
42
57
  /** One authored access-policy entry → its resource block, positioned by `index` (0-based) for label numbering. */
43
58
  export declare function accessPolicyToTf(entry: AccessPolicyEntryWire, index: number, ctx: AccessPolicyToTfContext): AccessPolicyToTfResult;
@@ -20,6 +20,7 @@
20
20
  import { EntityTfError } from "../../engine/entity.js";
21
21
  import { expr, scopedResourceLabel } from "../../engine/tf/index.js";
22
22
  import { fieldRefToTfValue } from "../field/to-tf.js";
23
+ import { filterToTf as serializeFilterToTf } from "../shared/filters/tf-codec.js";
23
24
  import { ACCESS_POLICY_RESOURCE_TYPE } from "./types.js";
24
25
  function isFieldToken(v) {
25
26
  return typeof v === "object" && v !== null && v.__kind === "field";
@@ -47,57 +48,23 @@ function picklistLiteralToTf(literal, field, ctx) {
47
48
  return expr.local(resolvedLocalName, [{ index: literal }]);
48
49
  }
49
50
  /**
50
- * Encode one `FilterAst` (authored via `entities/access-policy/filter.ts`'s
51
- * `eq`/`and`/… helpers). Coverage matches automation's own `filterToTf` —
52
- * the only proven, working filter-grammar round-trip in this codebase —
53
- * minus the trigger/task `leftValue` branch, which cannot occur here.
51
+ * Encode one canonical filter through the shared exhaustive Terraform codec.
52
+ * Access-policy filters omit the trigger/task `leftValue` branch.
54
53
  */
55
- function filterToTf(f, where, ctx) {
56
- if (typeof f !== "object" || f === null || typeof f.type !== "string") {
57
- throw new EntityTfError(`${where}: invalid filter`);
58
- }
59
- const raw = f;
60
- const type = raw.type.toLowerCase();
61
- const result = { type };
62
- const field = isFieldToken(raw.field) ? raw.field : undefined;
63
- if (field !== undefined)
64
- result.field_id = fieldValueToTf(field, where, ctx);
65
- if (Array.isArray(raw.children)) {
66
- result.children = raw.children.map((child) => filterToTf(child, where, ctx));
67
- }
68
- if (raw.value !== undefined)
69
- result.value = literalValueToTf(raw.value, field, where, ctx);
70
- if (Array.isArray(raw.values)) {
71
- result.values = raw.values.map((item) => literalValueToTf(item, field, where, ctx));
72
- }
73
- if (typeof raw.not === "boolean")
74
- result.not = raw.not;
75
- if (typeof raw.caseInsensitive === "boolean")
76
- result.case_insensitive = raw.caseInsensitive;
77
- if (typeof raw.mode === "string")
78
- result.mode = raw.mode;
79
- if (result.type === "like" && result.mode === undefined)
80
- result.mode = "legacy";
81
- return result;
82
- }
83
- /** The wire `Value` shape (`{type, value?}`) `filter.ts`'s `eq`/`isIn`/etc. embed at `value`/`values[]`. */
84
- function literalValueToTf(raw, field, where, ctx) {
85
- if (typeof raw !== "object" || raw === null || typeof raw.type !== "string") {
86
- throw new EntityTfError(`${where}: invalid filter value`);
87
- }
88
- const rec = raw;
89
- const type = rec.type.toLowerCase();
90
- if (type === "null")
91
- return { type: "NULL" };
92
- if (type === "current_user")
93
- return { type: "CURRENT_USER", current_user_type: rec.currentUserType };
94
- if (type === "field")
95
- return fieldValueToTf(rec.value, where, ctx);
96
- if (type === "text" && typeof rec.value === "string") {
97
- const picklist = picklistLiteralToTf(rec.value, field, ctx);
98
- return picklist ?? { type: "TEXT", value: rec.value };
99
- }
100
- return { type: type.toUpperCase(), value: rec.value };
54
+ export function filterToTf(f, where, ctx) {
55
+ return serializeFilterToTf(f, {
56
+ field: (field) => {
57
+ if (!isFieldToken(field))
58
+ throw new EntityTfError(`${where}: invalid filter field`);
59
+ return fieldValueToTf(field, where, ctx);
60
+ },
61
+ reference: () => { throw new EntityTfError(`${where}: access-policy filters do not support reference values`); },
62
+ literal: (value, field) => {
63
+ if (typeof value === "string")
64
+ return picklistLiteralToTf(value, isFieldToken(field) ? field : undefined, ctx) ?? value;
65
+ return value;
66
+ },
67
+ });
101
68
  }
102
69
  function isOrgPrincipalRef(v) {
103
70
  return typeof v === "object" && v !== null && v.__kind === "orgPrincipalRef";
@@ -105,17 +72,22 @@ function isOrgPrincipalRef(v) {
105
72
  function isGroupToken(v) {
106
73
  return typeof v === "object" && v !== null && v.__kind === "group";
107
74
  }
108
- function principalListToTf(items, dataType, where, ctx) {
75
+ export function principalListToTf(items, dataType, where, ctx) {
109
76
  if (items === undefined || items.length === 0)
110
77
  return undefined;
111
78
  const values = [];
112
79
  for (const item of items) {
113
80
  if (isOrgPrincipalRef(item)) {
114
- ctx.orgRefs.rawLookup(item.dataType, item.label, item.value);
115
- values.push(expr.dataAttr(item.dataType, item.label, ["id"]));
81
+ if (ctx.orgRefs === undefined) {
82
+ ctx.diagnostics.push(`${where}: pulled principal reference requires org context; dropped`);
83
+ }
84
+ else {
85
+ ctx.orgRefs.rawLookup(item.dataType, item.label, item.value);
86
+ values.push(expr.dataAttr(item.dataType, item.label, ["id"]));
87
+ }
116
88
  }
117
89
  else if (dataType === "elementum_group" && isGroupToken(item)) {
118
- const resolved = ctx.orgRefs.byTsLabel("groups", item.refName ?? "");
90
+ const resolved = ctx.orgRefs?.byTsLabel("groups", item.refName ?? "");
119
91
  if (resolved === undefined) {
120
92
  ctx.diagnostics.push(`${where}: group token "${item.refName}" is not in the org catalog — re-run \`elementum pull org --data-only\``);
121
93
  }