@elementumai/edk 0.8.2-alpha.6 → 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
@@ -15,7 +15,7 @@ export const SKILL_TOOL_SUB_TYPES = [
15
15
  { typeKey: "createRecord", resourceType: "elementum_agentic_skill_create_record_tool", implemented: true },
16
16
  { typeKey: "searchAspect", resourceType: "elementum_agentic_skill_search_records_tool", implemented: true },
17
17
  { typeKey: "updateRecord", resourceType: "elementum_agentic_skill_update_record_tool", implemented: true },
18
- { typeKey: "searchTable", resourceType: "elementum_agentic_skill_ai_search_tool" },
18
+ { typeKey: "searchTable", resourceType: "elementum_agentic_skill_ai_search_tool", implemented: true },
19
19
  { typeKey: "runAgent", resourceType: "elementum_agentic_skill_run_agent_tool", implemented: true },
20
20
  { typeKey: "automation", resourceType: "elementum_agentic_skill_run_automation_tool", implemented: true },
21
21
  ];
@@ -60,6 +60,23 @@ export const KNOWN_SKILL_TOOL_ATTRS = {
60
60
  "filter",
61
61
  "filter_variables",
62
62
  ]),
63
+ searchTable: new Set([
64
+ "skill_id",
65
+ "app_id",
66
+ "name",
67
+ "description",
68
+ "status",
69
+ "start_message",
70
+ "run_as",
71
+ "service_account_id",
72
+ "target_id",
73
+ "search_table_id",
74
+ "query_description",
75
+ "result_limit",
76
+ "fields",
77
+ "filter",
78
+ "filter_variables",
79
+ ]),
63
80
  updateRecord: new Set([
64
81
  "skill_id",
65
82
  "app_id",
@@ -1,68 +1,108 @@
1
1
  import type { TableBigQueryMappingInput, TableCreateRequest, TableDatabricksMappingInput, TableDataViewCreateInput, TableFieldCreateInput, TableSnowflakeMappingInput, TableUpdateRequest } from "../../../elementum-entity-client/clients/tables/models/index.js";
2
- import { type AspectRef, type CloudLinkRef, type TableRef } from "../../catalog/index.js";
2
+ import { type AppOrElementRef, type CategoryRef, type CloudLinkRef, type TableColumnRef, type DatamineRef, type TableRef } from "../../catalog/index.js";
3
3
  import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
4
4
  import type { TableBindingState } from "./state.js";
5
- import { type TableColumn, type TableField } from "./fields.js";
5
+ import { type TableColumn } from "./fields.js";
6
6
  import { type TableJoin } from "./joins.js";
7
- /** Cloud mapping — the cloud link is a token; the per-warehouse mapping is literal. */
8
- export type CloudMapping = {
7
+ import type { TableDatamine } from "../datamine/build.js";
8
+ import type { Filter } from "../shared/filters/types.js";
9
+ declare const cloudMappingBrand: unique symbol;
10
+ declare const tableViewBrand: unique symbol;
11
+ /** Cloud mappings are created by provider-specific factories. */
12
+ type CloudMapping = {
13
+ readonly [cloudMappingBrand]: "CloudMapping";
9
14
  readonly cloudLink: CloudLinkRef;
10
15
  readonly snowflake: TableSnowflakeMappingInput;
11
16
  } | {
17
+ readonly [cloudMappingBrand]: "CloudMapping";
12
18
  readonly cloudLink: CloudLinkRef;
13
19
  readonly bigQuery: TableBigQueryMappingInput;
14
20
  } | {
21
+ readonly [cloudMappingBrand]: "CloudMapping";
15
22
  readonly cloudLink: CloudLinkRef;
16
23
  readonly databricks: TableDatabricksMappingInput;
17
24
  };
18
- export type TableView = TableDataViewCreateInput;
19
- export interface DefineTableV2Options extends EntityDeployOptions {
25
+ export type TableView = TableDataViewCreateInput & {
26
+ readonly [tableViewBrand]: "TableView";
27
+ };
28
+ export declare function snowflakeTableMapping(opts: {
29
+ readonly cloudLink: CloudLinkRef;
30
+ readonly database: string;
31
+ readonly schema: string;
32
+ readonly table: string;
33
+ }): CloudMapping;
34
+ export declare function bigQueryTableMapping(opts: {
35
+ readonly cloudLink: CloudLinkRef;
36
+ readonly dataset: string;
37
+ readonly table: string;
38
+ }): CloudMapping;
39
+ export declare function databricksTableMapping(opts: {
40
+ readonly cloudLink: CloudLinkRef;
41
+ readonly database: string;
42
+ readonly schema: string;
43
+ readonly table: string;
44
+ }): CloudMapping;
45
+ export declare function snowflakeTableView(opts: {
46
+ readonly database: string;
47
+ readonly schema: string;
48
+ readonly name: string;
49
+ }): TableView;
50
+ export interface DefineTableV2Options<Columns extends Readonly<Record<string, TableColumn>> = Readonly<Record<string, TableColumn>>, Datamines extends Readonly<Record<string, TableDatamine<Extract<keyof Columns, string>>>> = Readonly<Record<string, TableDatamine<Extract<keyof Columns, string>>>>> extends EntityDeployOptions {
20
51
  /** Optional display name; defaults to the file/ref name when discovered. */
21
52
  readonly name?: string;
22
53
  /** Optional platform handle; defaults to the file/ref name when discovered. */
23
54
  readonly handle?: string;
24
55
  /** The app/element/table this table derives from (token -> id at deploy). Required for creates. */
25
- readonly source?: AspectRef | TableRef;
26
- /** Raw category id. `category` is the friendlier alias used in authoring. */
27
- readonly category?: string;
28
- readonly categoryId?: string;
29
- /** Preferred authoring API: keyed columns. */
30
- readonly columns?: Readonly<Record<string, TableColumn>>;
31
- /** Back-compat with the earlier table sketch. */
32
- readonly fields?: readonly TableField[];
56
+ readonly source?: AppOrElementRef | TableRef;
57
+ /** Organization category token. Provider ids stay internal. */
58
+ readonly category: CategoryRef;
59
+ /** Stable keyed columns. Keys preserve column identity across edits. */
60
+ readonly columns?: Columns;
61
+ /** Rule-based datamines owned by this table. Primary columns are stable keys from `columns`. */
62
+ readonly datamines?: Datamines;
33
63
  readonly joins?: readonly TableJoin[];
34
- /** Preferred authoring API for table views. The platform maps max one entry to `dataView`. */
35
- readonly views?: readonly TableView[];
64
+ /** Optional Snowflake data view. The platform supports one view. */
65
+ readonly view?: TableView;
36
66
  readonly description?: string;
37
67
  readonly icon?: string;
38
68
  readonly color?: string;
39
69
  readonly cloudMapping?: CloudMapping;
40
- readonly filter?: unknown;
70
+ readonly filter?: Filter;
41
71
  readonly limit?: unknown;
42
72
  readonly orderBy?: unknown;
43
73
  }
44
74
  export interface TableAuthoringPayload {
45
75
  readonly name: string;
46
76
  readonly handle: string;
47
- readonly source?: AspectRef | TableRef | string;
48
- readonly categoryId?: string;
77
+ readonly source?: AppOrElementRef | TableRef | string;
78
+ readonly categoryId?: CategoryRef | string;
49
79
  readonly columns: Readonly<Record<string, TableFieldCreateInput>>;
80
+ readonly datamines?: Readonly<Record<string, TableDatamine<string>>>;
50
81
  readonly joins?: readonly Record<string, unknown>[];
51
82
  readonly views?: readonly TableView[];
52
83
  readonly description?: string;
53
84
  readonly icon?: string;
54
85
  readonly color?: string;
55
86
  readonly cloudMapping?: Record<string, unknown>;
56
- readonly filter?: unknown;
87
+ readonly filter?: Filter;
57
88
  readonly limit?: unknown;
58
89
  readonly orderBy?: unknown;
59
90
  }
60
- export interface TableConfigured extends DeployableEntity {
61
- ref(refName: string): TableRef;
91
+ type TableColumnRefs<Columns extends Readonly<Record<string, TableColumn>>, Parent extends string> = {
92
+ readonly [Key in keyof Columns]: TableColumnRef<Parent, Extract<Key, string>>;
93
+ };
94
+ type TableDatamineRefs<Datamines extends Readonly<Record<string, TableDatamine<string>>>, Parent extends string> = {
95
+ readonly [Key in keyof Datamines]: DatamineRef<Parent, Extract<Key, string>>;
96
+ };
97
+ export interface TableConfigured<Columns extends Readonly<Record<string, TableColumn>> = Readonly<Record<string, TableColumn>>, Datamines extends Readonly<Record<string, TableDatamine<Extract<keyof Columns, string>>>> = Readonly<Record<string, TableDatamine<Extract<keyof Columns, string>>>>> extends DeployableEntity {
98
+ ref<const RefName extends string>(refName: RefName): TableRef<RefName, TableColumnRefs<Columns, RefName>, TableDatamineRefs<Datamines, RefName>> & {
99
+ readonly columns: TableColumnRefs<Columns, RefName>;
100
+ readonly datamines: TableDatamineRefs<Datamines, RefName>;
101
+ };
62
102
  def(refName: string): DeployableEntity;
63
103
  }
64
104
  /** Build a v2 table entity. The returned object is also a configured entity for file-name ref injection. */
65
- export declare function defineTable(opts: DefineTableV2Options): TableConfigured;
105
+ export declare function defineTable<const Columns extends Readonly<Record<string, TableColumn>> = Record<never, never>, const Datamines extends Readonly<Record<string, TableDatamine<Extract<keyof Columns, string>>>> = Record<never, never>>(opts: DefineTableV2Options<Columns, Datamines>): TableConfigured<Columns, Datamines>;
66
106
  export declare function tablePayloadToReadOnlyUpdateRequest(payload: unknown): TableUpdateRequest;
67
107
  export declare function tablePayloadToCreateRequest(payload: unknown): TableCreateRequest;
68
108
  export declare function fieldNameOf(input: TableFieldCreateInput): string | undefined;
@@ -72,3 +112,4 @@ export declare function tablePayloadToUpdateRequest(opts: {
72
112
  readonly baselinePayload: unknown;
73
113
  readonly binding: TableBindingState;
74
114
  }): TableUpdateRequest;
115
+ export {};
@@ -10,7 +10,18 @@ import { EdkValidationError } from "../../../elementum-entity-client/errors.js";
10
10
  import { slimTokens, } from "../../catalog/index.js";
11
11
  import { serializeTableField } from "./fields.js";
12
12
  import { serializeJoin } from "./joins.js";
13
- import { withTableKeys } from "./keys.js";
13
+ export function snowflakeTableMapping(opts) {
14
+ return { cloudLink: opts.cloudLink, snowflake: { databaseName: opts.database, schemaName: opts.schema, tableName: opts.table } };
15
+ }
16
+ export function bigQueryTableMapping(opts) {
17
+ return { cloudLink: opts.cloudLink, bigQuery: { datasetName: opts.dataset, tableName: opts.table } };
18
+ }
19
+ export function databricksTableMapping(opts) {
20
+ return { cloudLink: opts.cloudLink, databricks: { databaseName: opts.database, schemaName: opts.schema, tableName: opts.table } };
21
+ }
22
+ export function snowflakeTableView(opts) {
23
+ return { snowflake: { databaseName: opts.database, schemaName: opts.schema, name: opts.name } };
24
+ }
14
25
  function flattenCloudMapping(m) {
15
26
  const cloudLinkId = m.cloudLink; // CloudLinkRef token -> id at deploy
16
27
  if ("snowflake" in m)
@@ -20,17 +31,7 @@ function flattenCloudMapping(m) {
20
31
  return { cloudLinkId, databricksMapping: m.databricks };
21
32
  }
22
33
  function columnsFromOptions(opts) {
23
- if (opts.columns !== undefined) {
24
- return Object.fromEntries(Object.entries(opts.columns).map(([key, column]) => [key, serializeTableField(column)]));
25
- }
26
- // Name-derived keys (matching `withTableKeys`, used everywhere else a table's
27
- // columns are keyed) instead of positional `column${i}` — an index-based key
28
- // would silently re-target an unrelated baseline column whenever an entry is
29
- // inserted, removed, or reordered in this back-compat `fields:` array.
30
- return Object.fromEntries(withTableKeys(opts.fields ?? [], (field) => field.name, "column").map(({ key, item }) => [
31
- key,
32
- serializeTableField(item),
33
- ]));
34
+ return Object.fromEntries(Object.entries(opts.columns ?? {}).map(([key, column]) => [key, serializeTableField(column)]));
34
35
  }
35
36
  function payloadFor(opts, refName) {
36
37
  const handle = opts.handle ?? refName;
@@ -38,23 +39,26 @@ function payloadFor(opts, refName) {
38
39
  if (!name || name.trim() === "") {
39
40
  throw new EdkValidationError("defineTable requires a non-empty name or file/ref name.");
40
41
  }
41
- if ((opts.views?.length ?? 0) > 1) {
42
- throw new EdkValidationError("defineTable currently supports at most one view; the platform exposes a single dataView.");
42
+ // The configured factory is created before file discovery supplies its
43
+ // refName. Validate once a real authored/discovered handle exists.
44
+ if (handle !== "" && (handle.length < 2 || handle.length > 15)) {
45
+ throw new EdkValidationError("defineTable handle must be between 2 and 15 characters.");
43
46
  }
44
- const categoryId = opts.categoryId ?? opts.category;
47
+ const categoryId = opts.category;
45
48
  const joins = opts.joins?.map(serializeJoin);
46
49
  return slimTokens({
47
50
  name,
48
51
  handle,
49
52
  ...(opts.source !== undefined ? { source: opts.source } : {}),
50
- ...(categoryId !== undefined ? { categoryId } : {}),
53
+ categoryId,
51
54
  columns: columnsFromOptions(opts),
55
+ ...(opts.datamines !== undefined ? { datamines: opts.datamines } : {}),
52
56
  ...(opts.description != null ? { description: opts.description } : {}),
53
57
  ...(opts.icon != null ? { icon: opts.icon } : {}),
54
58
  ...(opts.color != null ? { color: opts.color } : {}),
55
59
  ...(opts.cloudMapping != null ? { cloudMapping: flattenCloudMapping(opts.cloudMapping) } : {}),
56
60
  ...(joins != null && joins.length > 0 ? { joins } : {}),
57
- ...(opts.views !== undefined ? { views: opts.views } : {}),
61
+ ...(opts.view !== undefined ? { views: [opts.view] } : {}),
58
62
  ...(opts.filter !== undefined ? { filter: opts.filter } : {}),
59
63
  ...(opts.limit !== undefined ? { limit: opts.limit } : {}),
60
64
  ...(opts.orderBy !== undefined ? { orderBy: opts.orderBy } : {}),
@@ -76,7 +80,18 @@ export function defineTable(opts) {
76
80
  return {
77
81
  ...initial,
78
82
  ref(refName) {
79
- return { __kind: "table", refName, name: opts.name ?? opts.handle ?? refName };
83
+ const columns = Object.fromEntries(Object.entries(opts.columns ?? {}).map(([key, column]) => [key, {
84
+ __kind: "tableColumn",
85
+ refName: key,
86
+ parent: refName,
87
+ name: column.name,
88
+ ...(column.kind === "cloud" ? { fieldType: "snowflake" in column.cloud ? column.cloud.snowflake.type : column.cloud.bigQuery.type } : {}),
89
+ ...(column.tags !== undefined ? { tags: column.tags } : {}),
90
+ }]));
91
+ const datamines = Object.fromEntries(Object.entries(opts.datamines ?? {}).map(([key, datamine]) => [key, {
92
+ __kind: "datamine", refName: key, parent: refName, name: datamine.name,
93
+ }]));
94
+ return { __kind: "table", refName, name: opts.name ?? opts.handle ?? refName, columns, datamines };
80
95
  },
81
96
  def(refName) {
82
97
  return entityFor(opts, refName);
@@ -27,6 +27,12 @@ export function renderTableCatalogEntry(args) {
27
27
  .join(", ");
28
28
  parts.push(`columns: { ${rendered} }`);
29
29
  }
30
+ const datamines = Object.entries(ref.datamines ?? {}).sort(([a], [b]) => a.localeCompare(b));
31
+ if (datamines.length > 0) {
32
+ extraFactories.push("datamineRef");
33
+ const parentHandle = named.refName ?? args.keyName;
34
+ parts.push(`datamines: { ${datamines.map(([key, datamine]) => `${safeCatalogKey(key)}: datamineRef({ name: ${JSON.stringify(datamine.name)}, parent: ${JSON.stringify(parentHandle)} })`).join(", ")} }`);
35
+ }
30
36
  if (ref.categoryId !== undefined) {
31
37
  parts.push(`categoryId: ${JSON.stringify(ref.categoryId)}`);
32
38
  }
@@ -0,0 +1,99 @@
1
+ /**
2
+ * `TableWire` -> normalized v2 table pull projection.
3
+ */
4
+ import type { TableJoinType, TableWire } from "../../../../elementum-entity-client/clients/tables/models/index.js";
5
+ import type { MissingDataCollector } from "../../../../pull/missing-report.js";
6
+ import type { TableColumnStateV2 } from "../state.js";
7
+ import type { NormalizedTableDatamine } from "../../datamine/from-tf.js";
8
+ import type { TfValue } from "../../../engine/tf/index.js";
9
+ import type { Filter } from "../../shared/filters/types.js";
10
+ import type { TableFieldDef } from "../fields/types.js";
11
+ export interface NormalizedTable {
12
+ readonly id: string;
13
+ readonly clientHandle?: string;
14
+ readonly name: string;
15
+ readonly handle: string;
16
+ readonly type?: string;
17
+ readonly editable?: boolean;
18
+ readonly cloudManaged?: boolean;
19
+ readonly configured?: boolean;
20
+ readonly source?: NormalizedTableRef;
21
+ readonly sourceRef?: {
22
+ readonly kind: "app" | "element" | "table";
23
+ readonly refName: string;
24
+ };
25
+ readonly categoryId?: string;
26
+ /** Organization category catalog key when pull can resolve one. */
27
+ readonly categoryRef?: string;
28
+ readonly dataView?: unknown;
29
+ readonly cloudMapping?: {
30
+ readonly provider: "snowflake" | "bigQuery" | "databricks";
31
+ readonly cloudLinkRef: string;
32
+ readonly database?: string;
33
+ readonly schema?: string;
34
+ readonly dataset?: string;
35
+ readonly table: string;
36
+ };
37
+ readonly description?: string;
38
+ readonly icon?: string;
39
+ readonly color?: string;
40
+ readonly limit?: number;
41
+ readonly orderBy?: unknown;
42
+ readonly filter?: Filter<NormalizedTableFilterField, TfValue>;
43
+ readonly joins: readonly NormalizedJoin[];
44
+ readonly columns: readonly NormalizedColumn[];
45
+ readonly tableColumns: Record<string, TableColumnStateV2>;
46
+ readonly datamines?: readonly NormalizedTableDatamine[];
47
+ }
48
+ export interface NormalizedTableRef {
49
+ readonly id: string;
50
+ readonly clientHandle?: string;
51
+ readonly typename?: string;
52
+ }
53
+ export interface NormalizedJoin {
54
+ readonly source?: NormalizedTableRef;
55
+ readonly sourceRef?: {
56
+ readonly kind: "app" | "element" | "table";
57
+ readonly refName: string;
58
+ };
59
+ readonly type: TableJoinType;
60
+ readonly on: readonly {
61
+ readonly leftId: string;
62
+ readonly rightId: string;
63
+ }[];
64
+ readonly filter?: Filter<NormalizedTableFilterField, TfValue>;
65
+ }
66
+ /** A table-filter field reconstructed from provider HCL before source printing. */
67
+ export type NormalizedTableFilterField = TfValue | {
68
+ readonly kind: "catalogField";
69
+ readonly ownerKind: "app" | "element";
70
+ readonly ownerRefName: string;
71
+ readonly fieldRefName: string;
72
+ } | {
73
+ readonly kind: "tableColumn";
74
+ readonly tableRefName: string;
75
+ readonly columnRefName: string;
76
+ };
77
+ export interface NormalizedColumn {
78
+ /** Source-side variable key (camelCased, unique within the table). */
79
+ readonly key: string;
80
+ /** Field definition; no ids are printed from this object. */
81
+ readonly def: TableFieldDef;
82
+ /** Server-side identity for state. */
83
+ readonly state: TableColumnStateV2;
84
+ /** Source field id, if this field projects an existing field. */
85
+ readonly sourceFieldId?: string;
86
+ /** Typed source reconstructed from Terraform references. */
87
+ readonly sourceRef?: {
88
+ readonly kind: "field";
89
+ readonly parentKind: "app" | "element";
90
+ readonly parentRefName: string;
91
+ readonly refName: string;
92
+ } | {
93
+ readonly kind: "tableColumn";
94
+ readonly parentRefName: string;
95
+ readonly refName: string;
96
+ };
97
+ }
98
+ export type NormalizedField = NormalizedColumn;
99
+ export declare function normalizeTable(wire: TableWire, missing: MissingDataCollector): NormalizedTable;
@@ -0,0 +1,192 @@
1
+ import { filterFromTf, filterWireToTf } from "../../shared/filters/tf-codec.js";
2
+ import { withTableKeys } from "../keys.js";
3
+ import { tableColumnStateFromWire } from "../state.js";
4
+ export function normalizeTable(wire, missing) {
5
+ const columns = withTableKeys(wire.fields ?? [], (field) => field.name, "field")
6
+ .flatMap(({ key, item }) => normalizeField(item, key, missing) ?? []);
7
+ if (wire.groupBy != null) {
8
+ // `defineTable` has no `groupBy` authoring surface yet — record the gap
9
+ // instead of silently dropping it so re-applying a pulled table doesn't
10
+ // quietly clear an existing groupBy configuration.
11
+ missing.record({
12
+ category: "fieldRef",
13
+ id: wire.id,
14
+ reason: `Table "${wire.name}" has a groupBy configured on the platform, but defineTable's ` +
15
+ `authoring surface has no groupBy option yet. The generated source omits it.`,
16
+ context: "table groupBy",
17
+ });
18
+ }
19
+ return {
20
+ id: wire.id,
21
+ ...(typeof wire.clientHandle === "string" ? { clientHandle: wire.clientHandle } : {}),
22
+ name: wire.name,
23
+ handle: wire.handle,
24
+ ...(wire.type != null && { type: wire.type }),
25
+ ...(typeof wire.editable === "boolean" ? { editable: wire.editable } : {}),
26
+ ...(typeof wire.cloudManaged === "boolean" ? { cloudManaged: wire.cloudManaged } : {}),
27
+ ...(typeof wire.configured === "boolean" ? { configured: wire.configured } : {}),
28
+ ...(refOf(wire.source) !== undefined ? { source: refOf(wire.source) } : {}),
29
+ ...(categoryIdOf(wire) !== undefined ? { categoryId: categoryIdOf(wire) } : {}),
30
+ ...(wire.dataView != null ? { dataView: wire.dataView } : {}),
31
+ ...(wire.filter !== undefined ? { filter: canonicalFilterFromWire(wire.filter) } : {}),
32
+ joins: (wire.joins ?? []).map(normalizeJoin),
33
+ columns,
34
+ tableColumns: Object.fromEntries(columns.map((c) => [c.key, c.state])),
35
+ };
36
+ }
37
+ function normalizeField(wire, key, missing) {
38
+ const sourceFieldId = sourceFieldIdOf(wire);
39
+ const state = tableColumnStateFromWire(wire);
40
+ const typename = wire.__typename;
41
+ let def;
42
+ if (typename === "TableFieldCloud") {
43
+ def = normalizeCloudField(wire);
44
+ }
45
+ else if (typename === "TableFieldCalculation") {
46
+ def = normalizeCalculationField(wire);
47
+ }
48
+ else if (typename === "TableFieldReference") {
49
+ def = normalizeReferenceField(wire, sourceFieldId);
50
+ }
51
+ else if (typename === "TableFieldPicklist" || typename === "TableFieldMultiPicklist") {
52
+ // `defineTable`'s column authoring has no picklist slot — the create/update
53
+ // wire input only discriminates cloud/calculation/reference. Round-tripping
54
+ // one as a plain reference field would silently misrepresent it, so record
55
+ // the gap instead of guessing (see the `main`-branch precedent this restores).
56
+ missing.record({
57
+ category: "fieldRef",
58
+ id: wire.id,
59
+ reason: `Field "${wire.name}" is a ${typename} on the platform, but defineTable's ` +
60
+ `column authoring has no picklist slot yet. Skipping; edit picklist fields on ` +
61
+ `the platform UI and re-pull.`,
62
+ context: `table field "${wire.name}"`,
63
+ });
64
+ return undefined;
65
+ }
66
+ else {
67
+ missing.record({
68
+ category: "fieldRef",
69
+ id: wire.id,
70
+ reason: `Field "${wire.name}" has an unrecognized __typename ${JSON.stringify(typename)}. ` +
71
+ `Skipping; the SDK may need an updated TableField variant.`,
72
+ context: `table field "${wire.name}"`,
73
+ });
74
+ return undefined;
75
+ }
76
+ return { key, def, state, ...(sourceFieldId !== undefined ? { sourceFieldId } : {}) };
77
+ }
78
+ function normalizeCloudField(wire) {
79
+ const columnName = (typeof wire.columnName === "string" && wire.columnName) ||
80
+ wire.name;
81
+ return {
82
+ kind: "cloud",
83
+ name: wire.name,
84
+ cloud: {
85
+ snowflake: {
86
+ columnName,
87
+ type: wire.fieldType,
88
+ },
89
+ },
90
+ ...(wire.semanticTags != null && wire.semanticTags.length > 0 && {
91
+ tags: wire.semanticTags,
92
+ }),
93
+ };
94
+ }
95
+ function normalizeCalculationField(wire) {
96
+ const calc = wire.calculation;
97
+ const text = (typeof wire.text === "string" && wire.text) ||
98
+ calc?.text ||
99
+ "";
100
+ return {
101
+ kind: "calculation",
102
+ name: wire.name,
103
+ expression: text,
104
+ ...(wire.semanticTags != null && wire.semanticTags.length > 0 && {
105
+ tags: wire.semanticTags,
106
+ }),
107
+ };
108
+ }
109
+ function normalizeReferenceField(wire, sourceFieldId) {
110
+ const aggregation = typeof wire.aggregation === "string"
111
+ ? wire.aggregation
112
+ : undefined;
113
+ const expanded = typeof wire.expanded === "string"
114
+ ? wire.expanded
115
+ : undefined;
116
+ return {
117
+ kind: "reference",
118
+ name: wire.name,
119
+ source: sourceFieldId ?? "",
120
+ ...(aggregation != null && aggregation !== "NOT_SET" && { aggregation }),
121
+ ...(expanded != null && { expanded }),
122
+ ...(wire.semanticTags != null && wire.semanticTags.length > 0 && {
123
+ tags: wire.semanticTags,
124
+ }),
125
+ };
126
+ }
127
+ function normalizeJoin(wire) {
128
+ const joinOn = Array.isArray(wire.joinOn)
129
+ ? wire.joinOn
130
+ : Array.isArray(wire.on)
131
+ ? wire.on
132
+ : Array.isArray(wire.onFields)
133
+ ? wire.onFields
134
+ : [];
135
+ return {
136
+ ...(refOf(wire.source) !== undefined ? { source: refOf(wire.source) } : {}),
137
+ type: (typeof wire.type === "string" ? wire.type : "LEFT"),
138
+ on: joinOn.flatMap((entry) => {
139
+ if (entry === null || typeof entry !== "object")
140
+ return [];
141
+ const rec = entry;
142
+ const leftField = rec.leftField;
143
+ const rightField = rec.rightField;
144
+ const leftId = typeof rec.leftFieldId === "string"
145
+ ? rec.leftFieldId
146
+ : typeof rec.left === "string"
147
+ ? rec.left
148
+ : typeof leftField?.id === "string"
149
+ ? leftField.id
150
+ : undefined;
151
+ const rightId = typeof rec.rightFieldId === "string"
152
+ ? rec.rightFieldId
153
+ : typeof rec.right === "string"
154
+ ? rec.right
155
+ : typeof rightField?.id === "string"
156
+ ? rightField.id
157
+ : undefined;
158
+ return leftId !== undefined && rightId !== undefined ? [{ leftId, rightId }] : [];
159
+ }),
160
+ ...(wire.filter !== undefined ? { filter: canonicalFilterFromWire(wire.filter) } : {}),
161
+ };
162
+ }
163
+ function canonicalFilterFromWire(value) {
164
+ return filterFromTf(filterWireToTf(value), {
165
+ field: (field) => field,
166
+ reference: (reference) => reference,
167
+ });
168
+ }
169
+ function sourceFieldIdOf(wire) {
170
+ if (typeof wire.field === "string" && wire.field)
171
+ return wire.field;
172
+ if (typeof wire.sourceFieldId === "string" && wire.sourceFieldId)
173
+ return wire.sourceFieldId;
174
+ const field = wire.field;
175
+ return typeof field?.id === "string" ? field.id : undefined;
176
+ }
177
+ function refOf(value) {
178
+ if (value === null || typeof value !== "object")
179
+ return undefined;
180
+ const rec = value;
181
+ if (typeof rec.id !== "string" || rec.id.trim() === "")
182
+ return undefined;
183
+ return {
184
+ id: rec.id,
185
+ ...(typeof rec.clientHandle === "string" ? { clientHandle: rec.clientHandle } : {}),
186
+ ...(typeof rec.__typename === "string" ? { typename: rec.__typename } : {}),
187
+ };
188
+ }
189
+ function categoryIdOf(wire) {
190
+ const category = wire.category;
191
+ return typeof category?.id === "string" ? category.id : undefined;
192
+ }
@@ -0,0 +1,86 @@
1
+ /**
2
+ * `TableFieldDef` — the discriminated union of field shapes accepted
3
+ * by `defineTable({ fields: [...] })`. Each variant is produced by a
4
+ * dedicated factory in this directory so authors never construct one
5
+ * directly. The serializer routes on `kind` and emits the
6
+ * `TableFieldCreateInput` wire shape.
7
+ *
8
+ * The `kind` discriminator is local-only — it is stripped before the
9
+ * payload reaches the wire (`TableFieldCreateInput` discriminates on
10
+ * which slot is populated, not on a `kind` literal).
11
+ */
12
+ import type { AspectFieldSemanticTag, AspectFieldType, TableFieldAggregation, TableFieldExpanded } from "../../../../elementum-entity-client/clients/tables/models/index.js";
13
+ import type { FieldRef, TableColumnRef } from "../../../catalog/index.js";
14
+ /**
15
+ * Markers the deserializer stamps onto each pulled field so the
16
+ * update serializer can match author-edited fields against their
17
+ * server-side counterparts (`__pulledId`) and reject incompatible
18
+ * kind changes early (`__pulledKind`).
19
+ *
20
+ * Both are author-invisible — hand-authored sources don't set them;
21
+ * the update serializer falls back to a name match in that case.
22
+ * Pulled sources always carry both, so editing a pulled field (even
23
+ * renaming it) round-trips through `updates[]` rather than degrading
24
+ * to `delete + create`.
25
+ *
26
+ * `__pulledKind` is the kind discriminator at pull time. If an author
27
+ * changes `kind: "cloud"` to `kind: "calculation"` in a pulled field,
28
+ * the update serializer raises an error — V3's field-update slot is
29
+ * variant-specific (`{ cloud | calculation | reference }`), and the
30
+ * platform can't switch a field's underlying kind in place.
31
+ */
32
+ export interface PulledFieldMarkers {
33
+ readonly __pulledId?: string;
34
+ readonly __pulledKind?: "cloud" | "calculation" | "reference";
35
+ }
36
+ /**
37
+ * A column directly backed by a cloud table (Snowflake / BigQuery).
38
+ * Created via {@link cloudField}.
39
+ */
40
+ export interface TableCloudFieldDef extends PulledFieldMarkers {
41
+ readonly kind: "cloud";
42
+ readonly name: string;
43
+ readonly cloud: {
44
+ readonly snowflake: {
45
+ readonly columnName: string;
46
+ readonly type: AspectFieldType;
47
+ };
48
+ } | {
49
+ readonly bigQuery: {
50
+ readonly columnName: string;
51
+ readonly type: AspectFieldType;
52
+ };
53
+ };
54
+ readonly tags?: readonly AspectFieldSemanticTag[];
55
+ }
56
+ /**
57
+ * A computed column whose value is derived from other fields via an
58
+ * expression. Created via {@link calculationField}.
59
+ */
60
+ export interface TableCalculationFieldDef extends PulledFieldMarkers {
61
+ readonly kind: "calculation";
62
+ readonly name: string;
63
+ /** Calculation expression text (e.g. `"\"qty\" * \"price\""`). */
64
+ readonly expression: string;
65
+ readonly tags?: readonly AspectFieldSemanticTag[];
66
+ }
67
+ /**
68
+ * A column that references another field (typically on a joined
69
+ * table), optionally aggregating across rows. Created via
70
+ * {@link referenceField}.
71
+ */
72
+ export interface TableReferenceFieldDef extends PulledFieldMarkers {
73
+ readonly kind: "reference";
74
+ readonly name: string;
75
+ /**
76
+ * Id of the source field this column projects from, an app/element field
77
+ * token, or a table-column token resolved at apply.
78
+ */
79
+ readonly source: string | {
80
+ readonly id: string;
81
+ } | FieldRef | TableColumnRef;
82
+ readonly aggregation?: TableFieldAggregation;
83
+ readonly expanded?: TableFieldExpanded;
84
+ readonly tags?: readonly AspectFieldSemanticTag[];
85
+ }
86
+ export type TableFieldDef = TableCloudFieldDef | TableCalculationFieldDef | TableReferenceFieldDef;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `TableFieldDef` — the discriminated union of field shapes accepted
3
+ * by `defineTable({ fields: [...] })`. Each variant is produced by a
4
+ * dedicated factory in this directory so authors never construct one
5
+ * directly. The serializer routes on `kind` and emits the
6
+ * `TableFieldCreateInput` wire shape.
7
+ *
8
+ * The `kind` discriminator is local-only — it is stripped before the
9
+ * payload reaches the wire (`TableFieldCreateInput` discriminates on
10
+ * which slot is populated, not on a `kind` literal).
11
+ */
12
+ export {};