@elementumai/edk 0.8.2-alpha.6 → 0.9.5

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 (481) hide show
  1. package/README.md +49 -37
  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 +3 -11
  6. package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.d.ts +1 -1
  7. package/dist-sdk/elementum-entity-client/clients/skills/models/skill.d.ts +1 -1
  8. package/dist-sdk/elementum-entity-client/clients/skills/models/skill.js +1 -1
  9. package/dist-sdk/fs/entity.d.ts +2 -2
  10. package/dist-sdk/fs/entity.js +1 -1
  11. package/dist-sdk/pull/missing-report.d.ts +81 -0
  12. package/dist-sdk/pull/missing-report.js +52 -0
  13. package/dist-sdk/pull/util.d.ts +1 -1
  14. package/dist-sdk/pull/util.js +3 -3
  15. package/dist-sdk/src/catalog/factories.d.ts +96 -23
  16. package/dist-sdk/src/catalog/factories.js +141 -21
  17. package/dist-sdk/src/catalog/from-authoring.d.ts +5 -5
  18. package/dist-sdk/src/catalog/from-authoring.js +20 -10
  19. package/dist-sdk/src/catalog/index.d.ts +2 -2
  20. package/dist-sdk/src/catalog/index.js +1 -1
  21. package/dist-sdk/src/catalog/org.js +63 -4
  22. package/dist-sdk/src/catalog/render-helpers.d.ts +1 -1
  23. package/dist-sdk/src/catalog/render-helpers.js +1 -1
  24. package/dist-sdk/src/catalog/render.d.ts +1 -0
  25. package/dist-sdk/src/catalog/render.js +8 -2
  26. package/dist-sdk/src/catalog/token.js +18 -4
  27. package/dist-sdk/src/catalog/types.d.ts +64 -24
  28. package/dist-sdk/src/catalog/types.js +12 -4
  29. package/dist-sdk/src/core/app-to-ui.d.ts +6 -6
  30. package/dist-sdk/src/core/app-to-ui.js +7 -9
  31. package/dist-sdk/src/core/index.d.ts +11 -10
  32. package/dist-sdk/src/core/index.js +10 -9
  33. package/dist-sdk/src/core/platform-id.d.ts +11 -0
  34. package/dist-sdk/src/core/platform-id.js +8 -0
  35. package/dist-sdk/src/{entities/flow/activities/render-catalog.d.ts → core/render-tree.d.ts} +3 -3
  36. package/dist-sdk/src/{entities/flow/activities/render-catalog.js → core/render-tree.js} +7 -10
  37. package/dist-sdk/src/core/types/ai-provider.d.ts +1 -1
  38. package/dist-sdk/src/core/types/ai-provider.js +1 -1
  39. package/dist-sdk/src/core/types/app.d.ts +78 -52
  40. package/dist-sdk/src/core/types/app.js +2 -3
  41. package/dist-sdk/src/core/types/aspect-category.d.ts +4 -4
  42. package/dist-sdk/src/core/types/aspect-category.js +4 -4
  43. package/dist-sdk/src/core/types/cloud-link.d.ts +3 -3
  44. package/dist-sdk/src/core/types/cloud-link.js +3 -3
  45. package/dist-sdk/src/core/types/display-block.d.ts +2 -2
  46. package/dist-sdk/src/core/types/display-block.js +2 -2
  47. package/dist-sdk/src/core/types/group.d.ts +1 -1
  48. package/dist-sdk/src/core/types/group.js +1 -1
  49. package/dist-sdk/src/core/types/user.d.ts +1 -1
  50. package/dist-sdk/src/core/types/user.js +1 -1
  51. package/dist-sdk/src/core/wire/ref-serializer.js +3 -3
  52. package/dist-sdk/src/engine/build/context.d.ts +23 -16
  53. package/dist-sdk/src/engine/entity.d.ts +1 -1
  54. package/dist-sdk/src/engine/pull/attrs.d.ts +4 -0
  55. package/dist-sdk/src/engine/pull/attrs.js +17 -0
  56. package/dist-sdk/src/engine/pull/context.d.ts +73 -0
  57. package/dist-sdk/src/engine/pull/context.js +14 -0
  58. package/dist-sdk/src/engine/pull/org.d.ts +10 -0
  59. package/dist-sdk/src/engine/pull/org.js +35 -0
  60. package/dist-sdk/src/engine/pull/ref-only.d.ts +37 -0
  61. package/dist-sdk/src/engine/pull/ref-only.js +204 -0
  62. package/dist-sdk/src/engine/tf/expr.d.ts +7 -3
  63. package/dist-sdk/src/engine/tf/expr.js +27 -15
  64. package/dist-sdk/src/engine/tf/index.d.ts +1 -1
  65. package/dist-sdk/src/engine/tf/index.js +1 -1
  66. package/dist-sdk/src/engine/tf/model.d.ts +8 -1
  67. package/dist-sdk/src/engine/tf/model.js +4 -0
  68. package/dist-sdk/src/engine/tf/parse.js +13 -2
  69. package/dist-sdk/src/engine/tf/render.js +4 -0
  70. package/dist-sdk/src/engine/workspace/authoring-layout.js +4 -2
  71. package/dist-sdk/src/entities/access-policy/build.d.ts +6 -16
  72. package/dist-sdk/src/entities/access-policy/build.js +2 -2
  73. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +14 -40
  74. package/dist-sdk/src/entities/access-policy/from-tf.js +26 -85
  75. package/dist-sdk/src/entities/access-policy/principal.d.ts +39 -0
  76. package/dist-sdk/src/entities/access-policy/principal.js +13 -0
  77. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +33 -6
  78. package/dist-sdk/src/entities/access-policy/to-tf.js +62 -60
  79. package/dist-sdk/src/entities/agent/build.d.ts +42 -11
  80. package/dist-sdk/src/entities/agent/build.js +40 -19
  81. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +11 -1
  82. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +180 -45
  83. package/dist-sdk/src/entities/agent/from-tf.d.ts +3 -1
  84. package/dist-sdk/src/entities/agent/from-tf.js +17 -12
  85. package/dist-sdk/src/entities/agent/index.d.ts +5 -2
  86. package/dist-sdk/src/entities/agent/index.js +4 -2
  87. package/dist-sdk/src/entities/agent/module.js +7 -2
  88. package/dist-sdk/src/entities/agent/run-as.d.ts +16 -0
  89. package/dist-sdk/src/entities/agent/run-as.js +1 -0
  90. package/dist-sdk/src/entities/agent/to-tf.d.ts +6 -2
  91. package/dist-sdk/src/entities/agent/to-tf.js +58 -9
  92. package/dist-sdk/src/entities/agent/tools.d.ts +97 -70
  93. package/dist-sdk/src/entities/agent/tools.js +63 -43
  94. package/dist-sdk/src/entities/agent-a2a-skill/from-tf.js +1 -1
  95. package/dist-sdk/src/entities/agent-a2a-skill/to-tf.js +4 -4
  96. package/dist-sdk/src/entities/agent-evaluation/build.d.ts +19 -0
  97. package/dist-sdk/src/entities/agent-evaluation/build.js +41 -0
  98. package/dist-sdk/src/entities/agent-evaluation/deserializer/print-agent-evaluation.d.ts +4 -0
  99. package/dist-sdk/src/entities/agent-evaluation/deserializer/print-agent-evaluation.js +30 -0
  100. package/dist-sdk/src/entities/agent-evaluation/from-tf.d.ts +12 -0
  101. package/dist-sdk/src/entities/agent-evaluation/from-tf.js +46 -0
  102. package/dist-sdk/src/entities/agent-evaluation/index.d.ts +1 -0
  103. package/dist-sdk/src/entities/agent-evaluation/index.js +1 -0
  104. package/dist-sdk/src/entities/agent-evaluation/module.d.ts +3 -0
  105. package/dist-sdk/src/entities/agent-evaluation/module.js +58 -0
  106. package/dist-sdk/src/entities/agent-evaluation/to-tf.d.ts +12 -0
  107. package/dist-sdk/src/entities/agent-evaluation/to-tf.js +35 -0
  108. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +25 -15
  109. package/dist-sdk/src/entities/agent-tool/from-tf.js +175 -43
  110. package/dist-sdk/src/entities/agent-tool/module.js +6 -0
  111. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +15 -7
  112. package/dist-sdk/src/entities/agent-tool/to-tf.js +169 -48
  113. package/dist-sdk/src/entities/agent-tool/types.d.ts +4 -6
  114. package/dist-sdk/src/entities/agent-tool/types.js +30 -29
  115. package/dist-sdk/src/entities/app/build.d.ts +214 -47
  116. package/dist-sdk/src/entities/app/build.js +128 -66
  117. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +188 -8
  118. package/dist-sdk/src/entities/app/deserializer/pulled-expression.d.ts +59 -0
  119. package/dist-sdk/src/entities/app/deserializer/pulled-expression.js +70 -0
  120. package/dist-sdk/src/entities/app/display-blocks.d.ts +2 -1
  121. package/dist-sdk/src/entities/app/display-blocks.js +1 -1
  122. package/dist-sdk/src/entities/app/from-tf.d.ts +11 -1
  123. package/dist-sdk/src/entities/app/from-tf.js +30 -2
  124. package/dist-sdk/src/entities/app/index.d.ts +20 -8
  125. package/dist-sdk/src/entities/app/index.js +16 -6
  126. package/dist-sdk/src/entities/app/module.js +29 -4
  127. package/dist-sdk/src/entities/app/to-tf.d.ts +1 -1
  128. package/dist-sdk/src/entities/app/to-tf.js +97 -7
  129. package/dist-sdk/src/entities/approval-chain/build.d.ts +31 -16
  130. package/dist-sdk/src/entities/approval-chain/build.js +49 -49
  131. package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +17 -0
  132. package/dist-sdk/src/entities/approval-chain/from-tf.js +57 -0
  133. package/dist-sdk/src/entities/approval-chain/index.d.ts +2 -3
  134. package/dist-sdk/src/entities/approval-chain/index.js +2 -3
  135. package/dist-sdk/src/entities/approval-chain/module.d.ts +3 -0
  136. package/dist-sdk/src/entities/approval-chain/module.js +51 -0
  137. package/dist-sdk/src/entities/approval-chain/printer.d.ts +2 -0
  138. package/dist-sdk/src/entities/approval-chain/printer.js +21 -0
  139. package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +9 -0
  140. package/dist-sdk/src/entities/approval-chain/to-tf.js +43 -0
  141. package/dist-sdk/src/entities/automation/build.d.ts +177 -95
  142. package/dist-sdk/src/entities/automation/build.js +164 -72
  143. package/dist-sdk/src/entities/automation/calculation-expression.d.ts +191 -0
  144. package/dist-sdk/src/entities/automation/calculation-expression.js +57 -0
  145. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +18 -9
  146. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +18 -14
  147. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +214 -311
  148. package/dist-sdk/src/entities/automation/filter.d.ts +1 -115
  149. package/dist-sdk/src/entities/automation/filter.js +1 -197
  150. package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -0
  151. package/dist-sdk/src/entities/automation/from-tf.js +695 -182
  152. package/dist-sdk/src/entities/automation/index.d.ts +9 -10
  153. package/dist-sdk/src/entities/automation/index.js +11 -11
  154. package/dist-sdk/src/entities/automation/module.js +82 -8
  155. package/dist-sdk/src/entities/automation/operators.d.ts +32 -48
  156. package/dist-sdk/src/entities/automation/operators.js +10 -37
  157. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +1 -1
  158. package/dist-sdk/src/entities/automation/output-key-wire-name.js +1 -1
  159. package/dist-sdk/src/entities/automation/script-code.js +107 -28
  160. package/dist-sdk/src/entities/automation/serialize.js +1 -1
  161. package/dist-sdk/src/entities/automation/tasks.d.ts +167 -102
  162. package/dist-sdk/src/entities/automation/tasks.js +66 -13
  163. package/dist-sdk/src/entities/automation/to-tf.d.ts +44 -3
  164. package/dist-sdk/src/entities/automation/to-tf.js +607 -161
  165. package/dist-sdk/src/entities/automation/triggers.d.ts +33 -25
  166. package/dist-sdk/src/entities/automation/triggers.js +8 -2
  167. package/dist-sdk/src/entities/automation/types.d.ts +3 -2
  168. package/dist-sdk/src/entities/automation/types.js +3 -2
  169. package/dist-sdk/src/entities/chart/build.d.ts +95 -0
  170. package/dist-sdk/src/entities/chart/build.js +42 -0
  171. package/dist-sdk/src/entities/chart/from-tf.d.ts +55 -0
  172. package/dist-sdk/src/entities/chart/from-tf.js +269 -0
  173. package/dist-sdk/src/entities/chart/index.d.ts +4 -0
  174. package/dist-sdk/src/entities/chart/index.js +3 -0
  175. package/dist-sdk/src/entities/chart/module.d.ts +3 -0
  176. package/dist-sdk/src/entities/chart/module.js +61 -0
  177. package/dist-sdk/src/entities/chart/printer.d.ts +5 -0
  178. package/dist-sdk/src/entities/chart/printer.js +104 -0
  179. package/dist-sdk/src/entities/chart/to-tf.d.ts +15 -0
  180. package/dist-sdk/src/entities/chart/to-tf.js +150 -0
  181. package/dist-sdk/src/entities/chart/types.d.ts +53 -0
  182. package/dist-sdk/src/entities/chart/types.js +22 -0
  183. package/dist-sdk/src/entities/dashboard/build.d.ts +44 -0
  184. package/dist-sdk/src/entities/dashboard/build.js +16 -0
  185. package/dist-sdk/src/entities/dashboard/from-tf.d.ts +12 -0
  186. package/dist-sdk/src/entities/dashboard/from-tf.js +113 -0
  187. package/dist-sdk/src/entities/dashboard/module.d.ts +3 -0
  188. package/dist-sdk/src/entities/dashboard/module.js +16 -0
  189. package/dist-sdk/src/entities/dashboard/to-tf.d.ts +43 -0
  190. package/dist-sdk/src/entities/dashboard/to-tf.js +121 -0
  191. package/dist-sdk/src/entities/dashboard-widget/module.d.ts +3 -0
  192. package/dist-sdk/src/entities/dashboard-widget/module.js +10 -0
  193. package/dist-sdk/src/entities/data-lookup/module.d.ts +3 -0
  194. package/dist-sdk/src/entities/data-lookup/module.js +22 -0
  195. package/dist-sdk/src/entities/datamine/build.d.ts +22 -0
  196. package/dist-sdk/src/entities/datamine/from-tf.d.ts +17 -0
  197. package/dist-sdk/src/entities/datamine/from-tf.js +98 -0
  198. package/dist-sdk/src/entities/datamine/module.d.ts +3 -0
  199. package/dist-sdk/src/entities/datamine/module.js +23 -0
  200. package/dist-sdk/src/entities/datamine/to-tf.d.ts +11 -0
  201. package/dist-sdk/src/entities/datamine/to-tf.js +53 -0
  202. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +304 -0
  203. package/dist-sdk/src/entities/dynamic-layout/build.js +4 -0
  204. package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +4 -0
  205. package/dist-sdk/src/entities/dynamic-layout/dialect.js +47 -0
  206. package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +10 -0
  207. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +239 -0
  208. package/dist-sdk/src/entities/dynamic-layout/module.d.ts +3 -0
  209. package/dist-sdk/src/entities/dynamic-layout/module.js +13 -0
  210. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +26 -0
  211. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +267 -0
  212. package/dist-sdk/src/entities/element/build.d.ts +48 -38
  213. package/dist-sdk/src/entities/element/build.js +24 -33
  214. package/dist-sdk/src/entities/element/from-tf.d.ts +9 -1
  215. package/dist-sdk/src/entities/element/from-tf.js +31 -2
  216. package/dist-sdk/src/entities/element/index.d.ts +14 -7
  217. package/dist-sdk/src/entities/element/index.js +11 -5
  218. package/dist-sdk/src/entities/element/module.js +26 -5
  219. package/dist-sdk/src/entities/element/to-tf.d.ts +2 -1
  220. package/dist-sdk/src/entities/element/to-tf.js +64 -4
  221. package/dist-sdk/src/entities/field/build.d.ts +55 -27
  222. package/dist-sdk/src/entities/field/build.js +31 -6
  223. package/dist-sdk/src/entities/field/calc/aggregate.d.ts +52 -21
  224. package/dist-sdk/src/entities/field/calc/aggregate.js +59 -29
  225. package/dist-sdk/src/entities/field/calc/date.d.ts +78 -29
  226. package/dist-sdk/src/entities/field/calc/date.js +120 -29
  227. package/dist-sdk/src/entities/field/calc/index.d.ts +80 -85
  228. package/dist-sdk/src/entities/field/calc/index.js +82 -139
  229. package/dist-sdk/src/entities/field/calc/numeric.d.ts +8 -12
  230. package/dist-sdk/src/entities/field/calc/numeric.js +10 -27
  231. package/dist-sdk/src/entities/field/calc/runtime.d.ts +19 -2
  232. package/dist-sdk/src/entities/field/calc/runtime.js +79 -8
  233. package/dist-sdk/src/entities/field/calc/text.d.ts +32 -23
  234. package/dist-sdk/src/entities/field/calc/text.js +43 -31
  235. package/dist-sdk/src/entities/field/calc/types.d.ts +36 -81
  236. package/dist-sdk/src/entities/field/calc/types.js +1 -22
  237. package/dist-sdk/src/entities/field/calc.d.ts +71 -48
  238. package/dist-sdk/src/entities/field/calc.js +5 -15
  239. package/dist-sdk/src/entities/field/calculation-types.d.ts +6 -0
  240. package/dist-sdk/src/entities/field/calculation-types.js +49 -0
  241. package/dist-sdk/src/entities/field/from-tf.js +238 -13
  242. package/dist-sdk/src/entities/field/locals.d.ts +11 -3
  243. package/dist-sdk/src/entities/field/locals.js +15 -2
  244. package/dist-sdk/src/entities/field/module.d.ts +1 -0
  245. package/dist-sdk/src/entities/field/module.js +27 -7
  246. package/dist-sdk/src/entities/field/record-shape.d.ts +25 -11
  247. package/dist-sdk/src/entities/field/to-tf.d.ts +41 -2
  248. package/dist-sdk/src/entities/field/to-tf.js +314 -40
  249. package/dist-sdk/src/entities/field/types.d.ts +1 -1
  250. package/dist-sdk/src/entities/field/types.js +10 -1
  251. package/dist-sdk/src/entities/file-reader/build.d.ts +71 -19
  252. package/dist-sdk/src/entities/file-reader/build.js +49 -4
  253. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +1 -0
  254. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +12 -10
  255. package/dist-sdk/src/entities/file-reader/from-tf.d.ts +1 -1
  256. package/dist-sdk/src/entities/file-reader/from-tf.js +31 -2
  257. package/dist-sdk/src/entities/file-reader/index.d.ts +3 -3
  258. package/dist-sdk/src/entities/file-reader/index.js +3 -3
  259. package/dist-sdk/src/entities/file-reader/module.js +6 -5
  260. package/dist-sdk/src/entities/file-reader/to-tf.d.ts +1 -1
  261. package/dist-sdk/src/entities/file-reader/to-tf.js +5 -2
  262. package/dist-sdk/src/entities/file-reader/types.d.ts +3 -4
  263. package/dist-sdk/src/entities/file-reader/types.js +4 -5
  264. package/dist-sdk/src/entities/org/category.js +4 -5
  265. package/dist-sdk/src/entities/org/cloud-link.js +4 -5
  266. package/dist-sdk/src/entities/org/email-alias.d.ts +2 -0
  267. package/dist-sdk/src/entities/org/email-alias.js +12 -0
  268. package/dist-sdk/src/entities/org/group.js +4 -5
  269. package/dist-sdk/src/entities/org/index.d.ts +2 -0
  270. package/dist-sdk/src/entities/org/index.js +2 -0
  271. package/dist-sdk/src/entities/org/phone-provider.d.ts +4 -0
  272. package/dist-sdk/src/entities/org/phone-provider.js +30 -0
  273. package/dist-sdk/src/entities/org/role.d.ts +3 -3
  274. package/dist-sdk/src/entities/org/role.js +9 -6
  275. package/dist-sdk/src/entities/organization/build.d.ts +241 -0
  276. package/dist-sdk/src/entities/organization/build.js +165 -0
  277. package/dist-sdk/src/entities/organization/index.d.ts +2 -0
  278. package/dist-sdk/src/entities/organization/index.js +2 -0
  279. package/dist-sdk/src/entities/organization/module.d.ts +2 -0
  280. package/dist-sdk/src/entities/organization/module.js +21 -0
  281. package/dist-sdk/src/entities/organization/to-tf.d.ts +7 -0
  282. package/dist-sdk/src/entities/organization/to-tf.js +154 -0
  283. package/dist-sdk/src/entities/phone-service/build.d.ts +17 -0
  284. package/dist-sdk/src/entities/phone-service/build.js +31 -0
  285. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.d.ts +4 -0
  286. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +56 -0
  287. package/dist-sdk/src/entities/phone-service/from-tf.d.ts +25 -0
  288. package/dist-sdk/src/entities/phone-service/from-tf.js +75 -0
  289. package/dist-sdk/src/entities/phone-service/index.d.ts +2 -0
  290. package/dist-sdk/src/entities/phone-service/index.js +2 -0
  291. package/dist-sdk/src/entities/phone-service/module.d.ts +3 -0
  292. package/dist-sdk/src/entities/phone-service/module.js +55 -0
  293. package/dist-sdk/src/entities/phone-service/to-tf.d.ts +12 -0
  294. package/dist-sdk/src/entities/phone-service/to-tf.js +54 -0
  295. package/dist-sdk/src/entities/phone-service/types.d.ts +35 -0
  296. package/dist-sdk/src/entities/phone-service/types.js +22 -0
  297. package/dist-sdk/src/entities/record-create-form/from-tf.d.ts +11 -0
  298. package/dist-sdk/src/entities/record-create-form/from-tf.js +74 -0
  299. package/dist-sdk/src/entities/record-create-form/module.d.ts +11 -0
  300. package/dist-sdk/src/entities/record-create-form/module.js +24 -0
  301. package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +33 -0
  302. package/dist-sdk/src/entities/record-create-form/to-tf.js +88 -0
  303. package/dist-sdk/src/entities/relationship/build.d.ts +16 -0
  304. package/dist-sdk/src/entities/relationship/build.js +1 -0
  305. package/dist-sdk/src/entities/relationship/from-tf.d.ts +12 -0
  306. package/dist-sdk/src/entities/relationship/from-tf.js +109 -0
  307. package/dist-sdk/src/entities/relationship/module.d.ts +3 -0
  308. package/dist-sdk/src/entities/relationship/module.js +16 -0
  309. package/dist-sdk/src/entities/relationship/to-tf.d.ts +32 -0
  310. package/dist-sdk/src/entities/relationship/to-tf.js +145 -0
  311. package/dist-sdk/src/entities/role/build.d.ts +65 -0
  312. package/dist-sdk/src/entities/role/build.js +33 -0
  313. package/dist-sdk/src/entities/role/from-tf.d.ts +13 -0
  314. package/dist-sdk/src/entities/role/from-tf.js +138 -0
  315. package/dist-sdk/src/entities/role/to-tf.d.ts +13 -0
  316. package/dist-sdk/src/entities/role/to-tf.js +69 -0
  317. package/dist-sdk/src/entities/search-table/build.d.ts +67 -28
  318. package/dist-sdk/src/entities/search-table/build.js +110 -56
  319. package/dist-sdk/src/entities/search-table/from-tf.d.ts +37 -0
  320. package/dist-sdk/src/entities/search-table/from-tf.js +113 -0
  321. package/dist-sdk/src/entities/search-table/index.d.ts +2 -2
  322. package/dist-sdk/src/entities/search-table/index.js +2 -2
  323. package/dist-sdk/src/entities/search-table/module.js +88 -10
  324. package/dist-sdk/src/entities/search-table/printer.d.ts +2 -0
  325. package/dist-sdk/src/entities/search-table/printer.js +52 -0
  326. package/dist-sdk/src/entities/search-table/to-tf.d.ts +14 -0
  327. package/dist-sdk/src/entities/search-table/to-tf.js +104 -0
  328. package/dist-sdk/src/entities/search-table/types.d.ts +8 -0
  329. package/dist-sdk/src/entities/search-table/types.js +21 -0
  330. package/dist-sdk/src/entities/service-account/build.d.ts +32 -0
  331. package/dist-sdk/src/entities/service-account/build.js +9 -0
  332. package/dist-sdk/src/entities/service-account/from-tf.d.ts +10 -0
  333. package/dist-sdk/src/entities/service-account/from-tf.js +109 -0
  334. package/dist-sdk/src/entities/service-account/module.d.ts +4 -0
  335. package/dist-sdk/src/entities/service-account/module.js +21 -0
  336. package/dist-sdk/src/entities/service-account/ref.d.ts +11 -0
  337. package/dist-sdk/src/entities/service-account/ref.js +5 -0
  338. package/dist-sdk/src/entities/service-account/to-tf.d.ts +32 -0
  339. package/dist-sdk/src/entities/service-account/to-tf.js +103 -0
  340. package/dist-sdk/src/entities/shared/connector-from-tf.d.ts +14 -0
  341. package/dist-sdk/src/entities/shared/connector-from-tf.js +14 -0
  342. package/dist-sdk/src/entities/shared/context.d.ts +25 -24
  343. package/dist-sdk/src/entities/shared/context.js +36 -35
  344. package/dist-sdk/src/entities/shared/filters/ast.d.ts +30 -81
  345. package/dist-sdk/src/entities/shared/filters/ast.js +6 -2
  346. package/dist-sdk/src/entities/shared/filters/index.d.ts +95 -206
  347. package/dist-sdk/src/entities/shared/filters/index.js +196 -341
  348. package/dist-sdk/src/entities/shared/filters/print.d.ts +11 -0
  349. package/dist-sdk/src/entities/shared/filters/print.js +122 -0
  350. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +170 -0
  351. package/dist-sdk/src/entities/shared/filters/tf-codec.js +527 -0
  352. package/dist-sdk/src/entities/shared/filters/types.d.ts +66 -69
  353. package/dist-sdk/src/entities/shared/filters/types.js +2 -3
  354. package/dist-sdk/src/entities/shared/foreign-ref.d.ts +14 -0
  355. package/dist-sdk/src/entities/shared/foreign-ref.js +12 -0
  356. package/dist-sdk/src/entities/shared/ref.d.ts +26 -11
  357. package/dist-sdk/src/entities/shared/ref.js +8 -3
  358. package/dist-sdk/src/entities/shared/types/common.d.ts +2 -2
  359. package/dist-sdk/src/entities/shared/types/field-types.d.ts +1 -1
  360. package/dist-sdk/src/entities/shared/types/field-types.js +1 -1
  361. package/dist-sdk/src/entities/skill/build.d.ts +4 -4
  362. package/dist-sdk/src/entities/skill/build.js +6 -5
  363. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +11 -1
  364. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +100 -39
  365. package/dist-sdk/src/entities/skill/index.d.ts +3 -2
  366. package/dist-sdk/src/entities/skill/index.js +3 -2
  367. package/dist-sdk/src/entities/skill/module.js +8 -2
  368. package/dist-sdk/src/entities/skill/to-tf.d.ts +6 -2
  369. package/dist-sdk/src/entities/skill/to-tf.js +20 -2
  370. package/dist-sdk/src/entities/skill/tools.d.ts +47 -31
  371. package/dist-sdk/src/entities/skill/tools.js +37 -23
  372. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +17 -1
  373. package/dist-sdk/src/entities/skill-tool/from-tf.js +118 -8
  374. package/dist-sdk/src/entities/skill-tool/module.js +9 -0
  375. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +6 -1
  376. package/dist-sdk/src/entities/skill-tool/to-tf.js +100 -48
  377. package/dist-sdk/src/entities/skill-tool/types.js +18 -1
  378. package/dist-sdk/src/entities/table/build.d.ts +64 -23
  379. package/dist-sdk/src/entities/table/build.js +41 -26
  380. package/dist-sdk/src/entities/table/catalog-render.js +15 -1
  381. package/dist-sdk/src/entities/table/deserializer/normalize.d.ts +99 -0
  382. package/dist-sdk/src/entities/table/deserializer/normalize.js +192 -0
  383. package/dist-sdk/src/entities/table/fields/types.d.ts +86 -0
  384. package/dist-sdk/src/entities/table/fields/types.js +12 -0
  385. package/dist-sdk/src/entities/table/fields.d.ts +107 -47
  386. package/dist-sdk/src/entities/table/fields.js +76 -55
  387. package/dist-sdk/src/entities/table/from-tf.d.ts +4 -0
  388. package/dist-sdk/src/entities/table/from-tf.js +261 -0
  389. package/dist-sdk/src/entities/table/index.d.ts +7 -5
  390. package/dist-sdk/src/entities/table/index.js +7 -7
  391. package/dist-sdk/src/entities/table/joins.d.ts +22 -9
  392. package/dist-sdk/src/entities/table/joins.js +8 -16
  393. package/dist-sdk/src/entities/table/module.d.ts +2 -1
  394. package/dist-sdk/src/entities/table/module.js +13 -6
  395. package/dist-sdk/src/entities/table/to-tf.d.ts +10 -0
  396. package/dist-sdk/src/entities/table/to-tf.js +222 -0
  397. package/dist-sdk/src/entities/task/build.d.ts +43 -0
  398. package/dist-sdk/src/entities/task/build.js +17 -0
  399. package/dist-sdk/src/entities/task/from-tf.d.ts +28 -0
  400. package/dist-sdk/src/entities/task/from-tf.js +38 -0
  401. package/dist-sdk/src/entities/task/index.d.ts +1 -0
  402. package/dist-sdk/src/entities/task/index.js +1 -0
  403. package/dist-sdk/src/entities/task/module.d.ts +3 -0
  404. package/dist-sdk/src/entities/task/module.js +12 -0
  405. package/dist-sdk/src/entities/task/to-tf.d.ts +9 -0
  406. package/dist-sdk/src/entities/task/to-tf.js +49 -0
  407. package/dist-sdk/src/entities/view/build.d.ts +46 -0
  408. package/dist-sdk/src/entities/view/build.js +19 -0
  409. package/dist-sdk/src/entities/view/from-tf.d.ts +7 -2
  410. package/dist-sdk/src/entities/view/from-tf.js +264 -30
  411. package/dist-sdk/src/entities/view/module.d.ts +6 -13
  412. package/dist-sdk/src/entities/view/module.js +12 -15
  413. package/dist-sdk/src/entities/view/sharing.d.ts +10 -0
  414. package/dist-sdk/src/entities/view/sharing.js +6 -0
  415. package/dist-sdk/src/entities/view/to-tf.d.ts +56 -12
  416. package/dist-sdk/src/entities/view/to-tf.js +192 -20
  417. package/dist-sdk/src/entities/view/types.d.ts +8 -0
  418. package/dist-sdk/src/entities/view/types.js +46 -0
  419. package/dist-sdk/src/entities/visual-flow/build.d.ts +87 -0
  420. package/dist-sdk/src/entities/visual-flow/build.js +72 -0
  421. package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +49 -0
  422. package/dist-sdk/src/entities/visual-flow/from-tf.js +124 -0
  423. package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -0
  424. package/dist-sdk/src/entities/visual-flow/index.js +1 -0
  425. package/dist-sdk/src/entities/visual-flow/module.d.ts +3 -0
  426. package/dist-sdk/src/entities/visual-flow/module.js +41 -0
  427. package/dist-sdk/src/entities/visual-flow/printer.d.ts +8 -0
  428. package/dist-sdk/src/entities/visual-flow/printer.js +92 -0
  429. package/dist-sdk/src/entities/visual-flow/to-tf.d.ts +15 -0
  430. package/dist-sdk/src/entities/visual-flow/to-tf.js +97 -0
  431. package/dist-sdk/src/entities/widget/build.d.ts +55 -0
  432. package/dist-sdk/src/entities/widget/build.js +1 -0
  433. package/dist-sdk/src/entities/widget/from-tf.d.ts +11 -0
  434. package/dist-sdk/src/entities/widget/from-tf.js +209 -0
  435. package/dist-sdk/src/entities/widget/module.d.ts +3 -0
  436. package/dist-sdk/src/entities/widget/module.js +16 -0
  437. package/dist-sdk/src/entities/widget/to-tf.d.ts +45 -0
  438. package/dist-sdk/src/entities/widget/to-tf.js +206 -0
  439. package/dist-sdk/src/graph/deferred-catalog-render.d.ts +1 -1
  440. package/dist-sdk/src/graph/deferred-catalog-render.js +1 -1
  441. package/dist-sdk/src/graph/index.d.ts +12 -1
  442. package/dist-sdk/src/graph/index.js +8 -19
  443. package/dist-sdk/src/graph/modules.js +35 -1
  444. package/dist-sdk/src/graph/types.d.ts +106 -7
  445. package/dist-sdk/src/internal/safe-identifier.d.ts +4 -0
  446. package/dist-sdk/src/internal/safe-identifier.js +13 -0
  447. package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
  448. package/dist-sdk/src/internal/sdk-package.js +5 -2
  449. package/package.json +39 -15
  450. package/dist-sdk/src/entities/access-policy/filter.d.ts +0 -61
  451. package/dist-sdk/src/entities/access-policy/filter.js +0 -83
  452. package/dist-sdk/src/entities/approval-chain/steps.d.ts +0 -24
  453. package/dist-sdk/src/entities/approval-chain/steps.js +0 -20
  454. package/dist-sdk/src/entities/flow/activities/agent.d.ts +0 -15
  455. package/dist-sdk/src/entities/flow/activities/agent.js +0 -29
  456. package/dist-sdk/src/entities/flow/activities/approval.d.ts +0 -9
  457. package/dist-sdk/src/entities/flow/activities/approval.js +0 -18
  458. package/dist-sdk/src/entities/flow/activities/automation.d.ts +0 -12
  459. package/dist-sdk/src/entities/flow/activities/automation.js +0 -22
  460. package/dist-sdk/src/entities/flow/activities/ctx.d.ts +0 -34
  461. package/dist-sdk/src/entities/flow/activities/ctx.js +0 -38
  462. package/dist-sdk/src/entities/flow/activities/form.d.ts +0 -22
  463. package/dist-sdk/src/entities/flow/activities/form.js +0 -36
  464. package/dist-sdk/src/entities/flow/activities/index.d.ts +0 -14
  465. package/dist-sdk/src/entities/flow/activities/index.js +0 -13
  466. package/dist-sdk/src/entities/flow/activities/input-refs.d.ts +0 -39
  467. package/dist-sdk/src/entities/flow/activities/input-refs.js +0 -19
  468. package/dist-sdk/src/entities/flow/activities/prompt-template.d.ts +0 -13
  469. package/dist-sdk/src/entities/flow/activities/prompt-template.js +0 -34
  470. package/dist-sdk/src/entities/flow/activities/types.d.ts +0 -33
  471. package/dist-sdk/src/entities/flow/build.d.ts +0 -38
  472. package/dist-sdk/src/entities/flow/build.js +0 -115
  473. package/dist-sdk/src/entities/flow/index.d.ts +0 -8
  474. package/dist-sdk/src/entities/flow/index.js +0 -7
  475. package/dist-sdk/src/entities/flow/serialize.d.ts +0 -51
  476. package/dist-sdk/src/entities/flow/serialize.js +0 -94
  477. package/dist-sdk/src/entities/flow/util.d.ts +0 -27
  478. package/dist-sdk/src/entities/flow/util.js +0 -38
  479. package/dist-sdk/src/entities/table/filter.d.ts +0 -41
  480. package/dist-sdk/src/entities/table/filter.js +0 -89
  481. /package/dist-sdk/src/entities/{flow/activities/types.js → datamine/build.js} +0 -0
@@ -4,6 +4,17 @@
4
4
  * (The extraction-side twin is src/engine/pull/context.ts.)
5
5
  */
6
6
  import type { ChildResourceScope, TfValue } from "../tf/index.js";
7
+ import type { KindId } from "../../graph/types.js";
8
+ export interface ForeignRootIdentity {
9
+ readonly name: string;
10
+ readonly namespace?: string;
11
+ readonly tfLabel?: string;
12
+ }
13
+ export interface ResolvedForeignRoot {
14
+ readonly resourceType: string;
15
+ readonly tfLabel: string;
16
+ readonly usedCompatibilityFallback: boolean;
17
+ }
7
18
  /**
8
19
  * Org-catalog lookups: recorded tfLabels for the data references entities emit.
9
20
  *
@@ -12,6 +23,10 @@ import type { ChildResourceScope, TfValue } from "../tf/index.js";
12
23
  * Entity to-tf passes the bag it authors against.
13
24
  */
14
25
  export interface OrgRefLookup {
26
+ /** Resolve a root reference according to its graph-declared referenceLookups strategy. */
27
+ resolveForeignRoot(kind: KindId, identity: ForeignRootIdentity, options?: {
28
+ readonly record?: boolean;
29
+ }): ResolvedForeignRoot;
15
30
  /**
16
31
  * Resolve by org.ts bag key (tsLabel). Records a data block when found.
17
32
  * Used by token-bearing refs (cloud links, connectors, …).
@@ -26,12 +41,8 @@ export interface OrgRefLookup {
26
41
  byName(bag: string, name: string): {
27
42
  readonly tfLabel: string;
28
43
  } | undefined;
29
- /**
30
- * Record a name-keyed `data.elementum_app` lookup for a FOREIGN app (e.g.
31
- * a cross-app agent-tool target). The label derives from the app NAME
32
- * (ei's sanitize rule), computed by the caller.
33
- */
34
- foreignApp(tfLabel: string, name: string): void;
44
+ /** Legacy typed convenience routed through app's graph-declared root strategy. */
45
+ foreignApp(tfLabel: string, name: string, namespace?: string): void;
35
46
  /**
36
47
  * Record a name-keyed `data.elementum_agentic_skill` lookup for a FOREIGN
37
48
  * skill (an agent's `skillAccess` pointing at a skill owned by a
@@ -39,7 +50,7 @@ export interface OrgRefLookup {
39
50
  * platform identifier, already slug-shaped) — same discipline as
40
51
  * `foreignApp`.
41
52
  */
42
- foreignSkill(tfLabel: string, name: string): void;
53
+ foreignSkill(tfLabel: string, name: string, appId: TfValue): void;
43
54
  /**
44
55
  * Record an arbitrary data lookup by its EXACT captured label and
45
56
  * lookup-attr value, bypassing org.ts bag validation — used when the
@@ -49,13 +60,9 @@ export interface OrgRefLookup {
49
60
  * unlike `byName`'s category precedent which re-derives the label from a
50
61
  * hand-authored display name).
51
62
  */
52
- rawLookup(type: string, tfLabel: string, value: string): void;
53
- /**
54
- * Record a name-keyed `data.elementum_element` lookup for a FOREIGN
55
- * element (e.g. a cross-aspect agent-tool target — board issue #42).
56
- * Same discipline as `foreignApp`, distinct resource type.
57
- */
58
- foreignElement(tfLabel: string, name: string): void;
63
+ rawLookup(type: string, tfLabel: string, value: string, extraAttrs?: Readonly<Record<string, TfValue>>): void;
64
+ /** Legacy typed convenience routed through element's graph-declared root strategy. */
65
+ foreignElement(tfLabel: string, name: string, namespace?: string): void;
59
66
  /**
60
67
  * Record a field-lookup data block for a field owned by a FOREIGN (or
61
68
  * otherwise not-self-resource) aspect — e.g. a relation field's
@@ -71,7 +78,7 @@ export interface OrgRefLookup {
71
78
  }
72
79
  /** A stream root discovered elsewhere in THIS workspace build — kind + tfLabel, keyed by {@link workspaceAspectKey}. */
73
80
  export interface WorkspaceAspect {
74
- readonly kind: ChildResourceScope;
81
+ readonly kind: ChildResourceScope | "table";
75
82
  readonly tfLabel: string;
76
83
  }
77
84
  /**
@@ -82,7 +89,7 @@ export interface WorkspaceAspect {
82
89
  * so `refName` alone is not a unique map key). Keying by kind+refName keeps
83
90
  * an app "tickets" and an element "tickets" from colliding.
84
91
  */
85
- export declare function workspaceAspectKey(kind: ChildResourceScope, refName: string): string;
92
+ export declare function workspaceAspectKey(kind: ChildResourceScope | "table", refName: string): string;
86
93
  export interface ToTfContext {
87
94
  /** The owning app's refName — its authoring directory / catalog key. */
88
95
  readonly appRefName: string;
@@ -21,7 +21,7 @@ export interface DeployableEntity extends EntityDeployOptions {
21
21
  }
22
22
  /**
23
23
  * Owning-app refName context for an automation's record-bearing trigger/task
24
- * refs — `defineAutomation.def()` attaches it as a structural extension on
24
+ * refs — `automation.def()` attaches it as a structural extension on
25
25
  * the object it returns (deliberately not a declared property: every other
26
26
  * kind would carry a slot that never applies to it). The terraform-path
27
27
  * automation emitter (M4) is its consumer.
@@ -0,0 +1,4 @@
1
+ import type { TfValue } from "../tf/index.js";
2
+ import type { FromTfContext } from "./context.js";
3
+ export declare function reportUnknownAttrs(attrs: Readonly<Record<string, unknown>>, known: ReadonlySet<string>, where: string, passName: string, ctx: FromTfContext): void;
4
+ export declare function stringList(attrs: Readonly<Record<string, TfValue>>, key: string, where: string, ctx: FromTfContext): string[] | undefined;
@@ -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,85 @@ 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
+ /** Imported platform field id -> typed owner/key, assembled by the recursive pull workspace context. */
41
+ readonly foreignFieldRefsById?: ReadonlyMap<string, {
42
+ readonly ownerRefName: string;
43
+ readonly fieldKey: string;
44
+ readonly fieldName?: string;
45
+ }>;
46
+ /** Platform table id -> typed org catalog identity, loaded by recursive pull when table refs are present. */
47
+ readonly foreignTableRefsById?: ReadonlyMap<string, {
48
+ readonly tableRefName: string;
49
+ readonly name: string;
50
+ readonly columnRefNamesByName?: ReadonlyMap<string, string>;
51
+ readonly columnRefNamesById?: ReadonlyMap<string, string>;
52
+ }>;
53
+ /** Namespace → refName for portable ref-only app/element catalogs. */
54
+ readonly foreignAppRefNamespaces?: ReadonlyMap<string, string>;
55
+ readonly foreignElementRefNamespaces?: ReadonlyMap<string, string>;
56
+ /** `data.<field-type>.<label>` → generated ref-only catalog member. */
57
+ readonly foreignFieldRefsByDataAddress?: ReadonlyMap<string, {
58
+ readonly ownerRefName: string;
59
+ readonly fieldKey: string;
60
+ }>;
61
+ /**
62
+ * Foreign app/element display names this stream saw referenced (currently:
63
+ * a RELATION field's `related_object_id` as a `data.elementum_app`/
64
+ * `data.elementum_element` lookup) but couldn't resolve against
65
+ * `foreignAppRefNames`/`foreignElementRefNames` — lets `--with-dependencies`
66
+ * chase them down the same way it already does for agent-tool/automation
67
+ * targets, even though the value that referenced them gets skipped this
68
+ * pull (see field/from-tf.ts's `resolveRelatedObject`). Mutated in place by
69
+ * extractors that opt in; undefined for a caller that didn't wire it up
70
+ * (most offline unit tests), in which case the reference just stays
71
+ * unresolvable, same as before this existed.
72
+ */
73
+ readonly unresolvedForeignRefs?: {
74
+ readonly apps: Set<string>;
75
+ readonly elements: Set<string>;
76
+ };
77
+ /** Managed resource whose import block carries this platform id. */
78
+ importedResource?(id: string): ImportedResourceRef | undefined;
79
+ /** Managed resource declared at this exact Terraform address. */
80
+ resourceByAddress?(address: string): ImportedResourceRef | undefined;
81
+ /**
82
+ * Every managed resource of the given type in the stream — for a caller
83
+ * that needs to find one by following a REFERENCE (e.g. a trigger block's
84
+ * own `automation` attribute pointing back at its owning automation)
85
+ * rather than by guessing its Terraform label. Label equality between two
86
+ * related resources (e.g. a trigger sharing its owning automation's label)
87
+ * is an observed export convention, not a contract — prefer this + a
88
+ * reference check over constructing a guessed address with
89
+ * `resourceByAddress`.
90
+ */
91
+ resourcesOfType?(type: string): readonly ImportedResourceRef[];
21
92
  /** Degradations land here — reported by the caller, never silent. */
22
93
  readonly diagnostics: string[];
23
94
  /**
@@ -35,4 +106,6 @@ export declare function dataRefLabel(v: TfValue | undefined, type: string): stri
35
106
  export declare function resourceRefLabel(v: TfValue | undefined, type: string): string | undefined;
36
107
  export declare function optionalString(attrs: Record<string, TfValue>, key: string, where: string, ctx: FromTfContext): string | undefined;
37
108
  export declare function optionalBoolean(attrs: Record<string, TfValue>, key: string, where: string, ctx: FromTfContext): boolean | undefined;
109
+ export declare function requiredString(attrs: Record<string, TfValue>, key: string, where: string, ctx: FromTfContext): string | undefined;
110
+ export declare function requiredBoolean(attrs: Record<string, TfValue>, key: string, where: string, ctx: FromTfContext): boolean | undefined;
38
111
  export declare function plainObject(v: TfValue): Record<string, TfValue> | undefined;
@@ -37,6 +37,20 @@ export function optionalBoolean(attrs, key, where, ctx) {
37
37
  }
38
38
  return v;
39
39
  }
40
+ export function requiredString(attrs, key, where, ctx) {
41
+ const value = optionalString(attrs, key, where, ctx);
42
+ if (value === undefined && attrs[key] === undefined) {
43
+ ctx.diagnostics.push(`${where}: required string "${key}" is missing; dropped`);
44
+ }
45
+ return value;
46
+ }
47
+ export function requiredBoolean(attrs, key, where, ctx) {
48
+ const value = optionalBoolean(attrs, key, where, ctx);
49
+ if (value === undefined && attrs[key] === undefined) {
50
+ ctx.diagnostics.push(`${where}: required boolean "${key}" is missing; dropped`);
51
+ }
52
+ return value;
53
+ }
40
54
  export function plainObject(v) {
41
55
  if (typeof v !== "object" || v === null || Array.isArray(v) || isTfExpr(v))
42
56
  return undefined;
@@ -39,12 +39,22 @@ export interface OrgIdentity {
39
39
  /** DataFacet.providerRefAttr's resolved reference (connector's `provider_id` → its owning `elementum_<type>_ai_provider` block), when the kind has one. */
40
40
  readonly providerRef?: OrgIdentityRef;
41
41
  }
42
+ export interface OrgStoredFunction {
43
+ readonly cloudLinkName: string;
44
+ readonly name: string;
45
+ readonly functionType: string;
46
+ readonly configured: boolean;
47
+ readonly parameterTypes: readonly string[];
48
+ readonly returnType: string;
49
+ }
42
50
  export interface OrgExtract {
43
51
  readonly cloudLinks: readonly OrgIdentity[];
44
52
  readonly categories: readonly OrgIdentity[];
45
53
  readonly connectors: readonly OrgIdentity[];
46
54
  readonly aiProviders: readonly OrgIdentity[];
47
55
  readonly groups: readonly OrgIdentity[];
56
+ readonly phoneProviders: readonly OrgIdentity[];
57
+ readonly storedFunctions?: readonly OrgStoredFunction[];
48
58
  /** The org app directory (namespace → platform id) from locals.org_apps. */
49
59
  readonly apps: Readonly<Record<string, string>>;
50
60
  }
@@ -32,8 +32,10 @@ export function extractOrg(doc) {
32
32
  connectors: [],
33
33
  aiProviders: [],
34
34
  groups: [],
35
+ phoneProviders: [],
35
36
  };
36
37
  let apps;
38
+ let storedFunctions = [];
37
39
  for (const block of doc.blocks) {
38
40
  if (block.kind === "data") {
39
41
  const type = block.type ?? "";
@@ -69,6 +71,9 @@ export function extractOrg(doc) {
69
71
  throw new OrgExtractError(`unexpected locals block (keys: ${Object.keys(block.attrs).join(", ")}) in org export stream`);
70
72
  }
71
73
  apps = requireStringMap(orgApps);
74
+ if (block.attrs["org_stored_functions"] !== undefined) {
75
+ storedFunctions = requireStoredFunctions(block.attrs["org_stored_functions"]);
76
+ }
72
77
  continue;
73
78
  }
74
79
  throw new OrgExtractError(`unexpected ${block.kind} block in org export stream — org export is identity-level only`);
@@ -82,9 +87,39 @@ export function extractOrg(doc) {
82
87
  connectors: withTsLabels(raw.connectors),
83
88
  aiProviders: withTsLabels(raw.aiProviders),
84
89
  groups: withTsLabels(raw.groups),
90
+ phoneProviders: withTsLabels(raw.phoneProviders),
91
+ storedFunctions,
85
92
  apps,
86
93
  };
87
94
  }
95
+ function requireStoredFunctions(value) {
96
+ if (!Array.isArray(value))
97
+ throw new OrgExtractError("locals.org_stored_functions is not an array");
98
+ return value.map((entry, index) => {
99
+ if (typeof entry !== "object" || entry === null || Array.isArray(entry)) {
100
+ throw new OrgExtractError(`locals.org_stored_functions[${index}] is not an object`);
101
+ }
102
+ const row = entry;
103
+ const stringValue = (key) => {
104
+ if (typeof row[key] !== "string")
105
+ throw new OrgExtractError(`locals.org_stored_functions[${index}].${key} is not a string`);
106
+ return row[key];
107
+ };
108
+ if (typeof row.configured !== "boolean")
109
+ throw new OrgExtractError(`locals.org_stored_functions[${index}].configured is not a boolean`);
110
+ if (!Array.isArray(row.parameter_types) || !row.parameter_types.every((item) => typeof item === "string")) {
111
+ throw new OrgExtractError(`locals.org_stored_functions[${index}].parameter_types is not a string array`);
112
+ }
113
+ return {
114
+ cloudLinkName: stringValue("cloud_link_name"),
115
+ name: stringValue("name"),
116
+ functionType: stringValue("function_type"),
117
+ configured: row.configured,
118
+ parameterTypes: row.parameter_types,
119
+ returnType: stringValue("return_type"),
120
+ };
121
+ });
122
+ }
88
123
  /** Derive each identity's authoring key from its recorded tfLabel — pure,
89
124
  * lossless, and unique because ei's tfLabels are unique per type. */
90
125
  function withTsLabels(entities) {
@@ -0,0 +1,37 @@
1
+ import type { FieldRef } from "../../catalog/index.js";
2
+ import type { UnresolvedReferenceDiagnostic } from "../../graph/types.js";
3
+ import { type TfDocument } from "../tf/index.js";
4
+ export interface DirectReferenceRoot {
5
+ readonly kind: "app" | "element" | "table";
6
+ readonly refName: string;
7
+ readonly name: string;
8
+ readonly namespace?: string;
9
+ readonly fields: readonly FieldRef[];
10
+ readonly columns: readonly {
11
+ readonly refName: string;
12
+ readonly name: string;
13
+ readonly fieldType?: string;
14
+ }[];
15
+ readonly datamines: readonly {
16
+ readonly refName: string;
17
+ readonly name: string;
18
+ }[];
19
+ readonly automations: readonly {
20
+ readonly refName: string;
21
+ readonly name: string;
22
+ }[];
23
+ }
24
+ export type UnresolvedReference = UnresolvedReferenceDiagnostic;
25
+ /** Format the diagnostic suffix printed beside an existing `unsafePlatformId(...)` call. */
26
+ export declare function unresolvedReferenceComment(uuid: string, unresolvedReferences: readonly UnresolvedReferenceDiagnostic[]): string;
27
+ export interface RefOnlyMetadata {
28
+ readonly roots: readonly DirectReferenceRoot[];
29
+ readonly unresolved: readonly UnresolvedReference[];
30
+ readonly diagnostics: readonly string[];
31
+ }
32
+ /** Reads bridge-owned, ID-free reference metadata without knowing provider resource names. */
33
+ export declare function readRefOnlyMetadata(doc: TfDocument): RefOnlyMetadata;
34
+ export declare function fieldDataReferenceMap(doc: TfDocument, roots: readonly DirectReferenceRoot[]): ReadonlyMap<string, {
35
+ readonly ownerRefName: string;
36
+ readonly fieldKey: string;
37
+ }>;
@@ -0,0 +1,204 @@
1
+ import { isTfExpr, tfLabelToTsLabel } from "../tf/index.js";
2
+ function singleLineComment(value) {
3
+ return value.replace(/\*\//g, "* /").replace(/\s+/g, " ").trim();
4
+ }
5
+ /** Format the diagnostic suffix printed beside an existing `unsafePlatformId(...)` call. */
6
+ export function unresolvedReferenceComment(uuid, unresolvedReferences) {
7
+ const details = [...new Set(unresolvedReferences
8
+ .filter((reference) => reference.uuid === uuid)
9
+ .map((reference) => {
10
+ const kind = singleLineComment(reference.kind || "unknown");
11
+ const usage = singleLineComment(reference.usage || "unknown");
12
+ const reason = singleLineComment(reference.reason || "metadata lookup failed");
13
+ return `unresolved ${kind} reference at ${usage}: ${reason}`;
14
+ }))];
15
+ return details.length === 0 ? "" : ` /* ${details.join(" | ")}; source-org-only */`;
16
+ }
17
+ function record(v) {
18
+ return typeof v === "object" && v !== null && !Array.isArray(v) ? v : undefined;
19
+ }
20
+ function stringAt(obj, ...keys) {
21
+ for (const key of keys)
22
+ if (typeof obj[key] === "string")
23
+ return obj[key];
24
+ return undefined;
25
+ }
26
+ function parseRoot(payload) {
27
+ let raw;
28
+ try {
29
+ raw = JSON.parse(payload);
30
+ }
31
+ catch {
32
+ return undefined;
33
+ }
34
+ const obj = record(raw);
35
+ if (obj === undefined)
36
+ return undefined;
37
+ const kind = stringAt(obj, "kind");
38
+ const name = stringAt(obj, "name");
39
+ const wireRefName = stringAt(obj, "refName");
40
+ if ((kind !== "app" && kind !== "element" && kind !== "table") || name === undefined || wireRefName === undefined)
41
+ return undefined;
42
+ const fields = [];
43
+ for (const rawField of Array.isArray(obj.fields) ? obj.fields : []) {
44
+ const field = record(rawField);
45
+ if (field === undefined)
46
+ continue;
47
+ const fieldName = stringAt(field, "name");
48
+ const fieldRefName = stringAt(field, "refName");
49
+ const fieldType = stringAt(field, "fieldType");
50
+ if (fieldName === undefined || fieldRefName === undefined || fieldType === undefined)
51
+ continue;
52
+ const tags = Array.isArray(field.tags) && field.tags.every((v) => typeof v === "string") ? field.tags : undefined;
53
+ const options = Array.isArray(field.options) && field.options.every((v) => typeof v === "string") ? field.options : undefined;
54
+ fields.push({
55
+ __kind: "field",
56
+ refName: tfLabelToTsLabel(fieldRefName),
57
+ name: fieldName,
58
+ parent: tfLabelToTsLabel(wireRefName),
59
+ fieldType,
60
+ ...(tags !== undefined && tags.length > 0 ? { tags } : {}),
61
+ ...(options !== undefined && options.length > 0 ? { options } : {}),
62
+ });
63
+ }
64
+ const columns = (Array.isArray(obj.columns) ? obj.columns : []).flatMap((rawColumn) => {
65
+ const column = record(rawColumn);
66
+ if (column === undefined)
67
+ return [];
68
+ const columnName = stringAt(column, "name");
69
+ const columnRefName = stringAt(column, "refName");
70
+ if (columnName === undefined || columnRefName === undefined)
71
+ return [];
72
+ const fieldType = stringAt(column, "fieldType");
73
+ return [{ refName: tfLabelToTsLabel(columnRefName), name: columnName, ...(fieldType !== undefined ? { fieldType } : {}) }];
74
+ });
75
+ const datamines = (Array.isArray(obj.datamines) ? obj.datamines : []).flatMap((rawDatamine) => {
76
+ const datamine = record(rawDatamine);
77
+ if (datamine === undefined)
78
+ return [];
79
+ const datamineName = stringAt(datamine, "name");
80
+ const datamineRefName = stringAt(datamine, "refName");
81
+ return datamineName === undefined || datamineRefName === undefined ? [] : [{ refName: tfLabelToTsLabel(datamineRefName), name: datamineName }];
82
+ });
83
+ const automations = (Array.isArray(obj.automations) ? obj.automations : []).flatMap((rawAutomation) => {
84
+ const automation = record(rawAutomation);
85
+ if (automation === undefined)
86
+ return [];
87
+ const automationName = stringAt(automation, "name");
88
+ const automationRefName = stringAt(automation, "refName");
89
+ return automationName === undefined || automationRefName === undefined ? [] : [{ refName: tfLabelToTsLabel(automationRefName), name: automationName }];
90
+ });
91
+ return {
92
+ kind,
93
+ refName: tfLabelToTsLabel(wireRefName),
94
+ name,
95
+ ...(stringAt(obj, "namespace") !== undefined ? { namespace: stringAt(obj, "namespace") } : {}),
96
+ fields,
97
+ columns,
98
+ datamines,
99
+ automations,
100
+ };
101
+ }
102
+ function parseUnresolved(payload) {
103
+ let raw;
104
+ try {
105
+ raw = JSON.parse(payload);
106
+ }
107
+ catch {
108
+ return undefined;
109
+ }
110
+ const obj = record(raw);
111
+ if (obj === undefined)
112
+ return undefined;
113
+ const usage = stringAt(obj, "usage", "Usage") ?? "unknown";
114
+ const kind = stringAt(obj, "kind", "Kind") ?? "unknown";
115
+ const uuid = stringAt(obj, "uuid", "UUID");
116
+ const reason = stringAt(obj, "reason", "Reason") ?? "metadata lookup failed";
117
+ return uuid === undefined ? undefined : { usage, kind, uuid, reason, portability: "source-org-only" };
118
+ }
119
+ /** Reads bridge-owned, ID-free reference metadata without knowing provider resource names. */
120
+ export function readRefOnlyMetadata(doc) {
121
+ const roots = [];
122
+ const unresolved = [];
123
+ const diagnostics = [];
124
+ for (const block of doc.blocks) {
125
+ if (block.kind !== "locals")
126
+ continue;
127
+ for (const [key, value] of Object.entries(block.attrs)) {
128
+ if (typeof value !== "string")
129
+ continue;
130
+ if (key.startsWith("edk_ref_only_")) {
131
+ const root = parseRoot(value);
132
+ if (root !== undefined) {
133
+ if ((root.kind === "app" || root.kind === "element") && (root.namespace === undefined || root.namespace === "")) {
134
+ diagnostics.push(`ref-only ${root.kind} "${root.name}" is missing its required namespace; catalog materialization was skipped`);
135
+ }
136
+ else {
137
+ roots.push(root);
138
+ }
139
+ }
140
+ }
141
+ else if (key.startsWith("edk_unresolved_reference_")) {
142
+ const ref = parseUnresolved(value);
143
+ if (ref !== undefined)
144
+ unresolved.push(ref);
145
+ }
146
+ }
147
+ }
148
+ const knownFallbacks = new Set(unresolved.map((ref) => ref.uuid));
149
+ const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
150
+ const visit = (value, usage, kind) => {
151
+ if (typeof value === "string") {
152
+ if (uuid.test(value) && !knownFallbacks.has(value)) {
153
+ knownFallbacks.add(value);
154
+ unresolved.push({ usage, kind, uuid: value, reason: "export retained a raw UUID because no portable lookup was available", portability: "source-org-only" });
155
+ }
156
+ return;
157
+ }
158
+ if (Array.isArray(value))
159
+ value.forEach((item, index) => visit(item, `${usage}[${index}]`, kind));
160
+ else if (typeof value === "object" && value !== null && !isTfExpr(value)) {
161
+ for (const [key, child] of Object.entries(value))
162
+ visit(child, `${usage}.${key}`, kind);
163
+ }
164
+ };
165
+ for (const block of doc.blocks) {
166
+ if (block.kind !== "resource" || block.label === undefined || block.type === undefined)
167
+ continue;
168
+ for (const [attr, value] of Object.entries(block.attrs)) {
169
+ if (attr === "object_id" || attr === "app_id" || attr === "stage_id" || (!attr.endsWith("_id") && !attr.endsWith("_ids") && attr !== "filter" && attr !== "sort" && attr !== "dynamic_config"))
170
+ continue;
171
+ visit(value, `${block.type}.${block.label}.${attr}`, attr.replace(/_ids?$/, ""));
172
+ }
173
+ }
174
+ const deduped = new Map(roots.map((root) => [
175
+ root.kind === "table" ? `table:${root.name}` : `${root.kind}:${root.namespace}`,
176
+ root,
177
+ ]));
178
+ return { roots: [...deduped.values()], unresolved, diagnostics };
179
+ }
180
+ export function fieldDataReferenceMap(doc, roots) {
181
+ const ownerByDataAddress = new Map();
182
+ for (const block of doc.blocks) {
183
+ if (block.kind !== "data" || block.label === undefined)
184
+ continue;
185
+ const namespace = typeof block.attrs.namespace === "string" ? block.attrs.namespace : undefined;
186
+ const name = typeof block.attrs.name === "string" ? block.attrs.name : undefined;
187
+ const root = roots.find((candidate) => (namespace !== undefined && candidate.namespace === namespace) || (name !== undefined && candidate.name === name));
188
+ if (root !== undefined)
189
+ ownerByDataAddress.set(`${block.type}.${block.label}`, root);
190
+ }
191
+ const out = new Map();
192
+ for (const block of doc.blocks) {
193
+ if (block.kind !== "data" || block.label === undefined || typeof block.attrs.name !== "string")
194
+ continue;
195
+ const ownerExpr = block.attrs.object_id;
196
+ if (!isTfExpr(ownerExpr) || ownerExpr.$expr !== "data-attr" || ownerExpr.path.join(".") !== "id")
197
+ continue;
198
+ const owner = ownerByDataAddress.get(`${ownerExpr.type}.${ownerExpr.label}`);
199
+ const field = owner?.fields.find((candidate) => candidate.name === block.attrs.name);
200
+ if (owner !== undefined && field !== undefined)
201
+ out.set(`${block.type}.${block.label}`, { ownerRefName: owner.refName, fieldKey: field.refName });
202
+ }
203
+ return out;
204
+ }
@@ -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
@@ -20,6 +20,10 @@ export declare class TfExprError extends Error {
20
20
  * hcl2json encodes every expression attribute as "${...}"; plain strings
21
21
  * stay plain (with template escapes still doubled).
22
22
  */
23
- export declare function parseStringValue(raw: string): string | TfExpr;
23
+ export interface ExpressionParseOptions {
24
+ /** Terraform variables are accepted only in explicitly modeled credential positions. */
25
+ readonly allowVariables?: boolean;
26
+ }
27
+ export declare function parseStringValue(raw: string, options?: ExpressionParseOptions): string | TfExpr;
24
28
  /** Parse the inside of a ${...} interpolation. */
25
- export declare function parseExpression(src: string): TfExpr;
29
+ export declare function parseExpression(src: string, options?: ExpressionParseOptions): TfExpr;