@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
@@ -0,0 +1,113 @@
1
+ import { EntityTfError } from "../../engine/entity.js";
2
+ import { resourceRefLabel } from "../../engine/pull/context.js";
3
+ import { isTfExpr, sanitizeName, scopedLabelToBagKey, tfLabelToTsLabel, } from "../../engine/tf/index.js";
4
+ import { fieldKeyFromTfRef } from "../field/from-tf.js";
5
+ import { KNOWN_SEARCH_TABLE_ATTRS, SEARCH_TABLE_VARIANT_BY_RESOURCE } from "./types.js";
6
+ import { connectorIdentityFromTf } from "../shared/connector-from-tf.js";
7
+ function requiredString(attrs, key, where) {
8
+ const value = attrs[key];
9
+ if (typeof value !== "string" || value === "")
10
+ throw new EntityTfError(`${where}: "${key}" is required`);
11
+ return value;
12
+ }
13
+ function assertKnown(block, variant) {
14
+ for (const key of Object.keys(block.attrs)) {
15
+ if (!KNOWN_SEARCH_TABLE_ATTRS[variant].has(key)) {
16
+ throw new EntityTfError(`${block.type}.${block.label}: unrecognized attribute "${key}" — this EDK version cannot round-trip it`);
17
+ }
18
+ }
19
+ }
20
+ function fieldKey(value, ownerTfLabel, scope, where) {
21
+ if (value === undefined)
22
+ throw new EntityTfError(`${where}: field reference is required`);
23
+ const key = fieldKeyFromTfRef(value, ownerTfLabel, scope);
24
+ if (key === undefined)
25
+ throw new EntityTfError(`${where}: field value is not a field resource reference`);
26
+ return key;
27
+ }
28
+ function connectorKey(value, ctx, where) {
29
+ if (value === undefined || !isTfExpr(value) || value.$expr !== "data-attr" || value.type !== "elementum_ai_provider_connector") {
30
+ throw new EntityTfError(`${where}: ai_provider_connector_id is not an AI service data reference`);
31
+ }
32
+ const identity = connectorIdentityFromTf(value.type, value.label, ctx);
33
+ if (identity.catalogKey === undefined) {
34
+ throw new EntityTfError(`${where}: AI service data source has no model/provider identity`);
35
+ }
36
+ return identity.catalogKey;
37
+ }
38
+ export function searchTableFromTf(block, ownerTfLabel, scope, ctx) {
39
+ const label = block.label;
40
+ if (label === undefined || label === "")
41
+ throw new EntityTfError(`${block.type} block is missing its label`);
42
+ const variant = SEARCH_TABLE_VARIANT_BY_RESOURCE.get(block.type ?? "");
43
+ if (variant !== "snowflake" && variant !== "linked" && variant !== "table")
44
+ throw new EntityTfError(`unsupported search table resource "${block.type}"`);
45
+ assertKnown(block, variant);
46
+ if (variant === "table") {
47
+ const tableId = block.attrs["table_id"];
48
+ if (tableId === undefined || !isTfExpr(tableId) || tableId.$expr !== "resource-attr" || tableId.type !== "elementum_table" || tableId.label !== ownerTfLabel)
49
+ throw new EntityTfError(`${block.type}.${label}: table_id does not reference elementum_table.${ownerTfLabel}`);
50
+ const tableFieldKey = (value) => {
51
+ if (value === undefined || !isTfExpr(value) || value.$expr !== "resource-attr" || value.type !== "elementum_table" || value.label !== ownerTfLabel || value.path[0] !== "field_ids")
52
+ throw new EntityTfError(`${block.type}.${label}: field is not a table column reference`);
53
+ const index = value.path[1];
54
+ if (typeof index !== "object")
55
+ throw new EntityTfError(`${block.type}.${label}: table column reference has no key`);
56
+ return tfLabelToTsLabel(sanitizeName(index.index));
57
+ };
58
+ const attrs = block.attrs["attribute_field_ids"];
59
+ if (!Array.isArray(attrs))
60
+ throw new EntityTfError(`${block.type}.${label}: attribute_field_ids must be a list`);
61
+ const duration = requiredString(block.attrs, "duration", `${block.type}.${label}`);
62
+ const targetLag = block.attrs["target_lag"];
63
+ if (typeof targetLag !== "number")
64
+ throw new EntityTfError(`${block.type}.${label}: target_lag is required`);
65
+ const prefix = `tables_${ownerTfLabel}_`;
66
+ const refName = tfLabelToTsLabel(label.startsWith(prefix) ? label.slice(prefix.length) : label);
67
+ return { kind: "table", refName, ...(typeof block.attrs.name === "string" && { name: block.attrs.name }), fieldKey: tableFieldKey(block.attrs.field_id), attributeFieldKeys: attrs.map(tableFieldKey), connectorKey: connectorKey(block.attrs.ai_provider_connector_id, ctx, `${block.type}.${label}`), duration: duration, targetLag, ...(typeof block.attrs.warehouse === "string" && { warehouse: block.attrs.warehouse }), ...(typeof block.attrs.creation_timeout === "string" && { creationTimeout: block.attrs.creation_timeout }) };
68
+ }
69
+ const aspectScope = scope;
70
+ const expectedOwnerType = scope === "element" ? "elementum_element" : "elementum_app";
71
+ if (resourceRefLabel(block.attrs["object_id"], expectedOwnerType) !== ownerTfLabel) {
72
+ throw new EntityTfError(`${block.type}.${label}: object_id does not reference ${expectedOwnerType}.${ownerTfLabel}`);
73
+ }
74
+ const refName = scopedLabelToBagKey(ownerTfLabel, label, aspectScope);
75
+ const where = `${block.type}.${label}`;
76
+ if (variant === "linked") {
77
+ const cloud = block.attrs["cloud_link_id"];
78
+ if (!isTfExpr(cloud) || cloud.$expr !== "data-attr" || cloud.type !== "elementum_cloudlink") {
79
+ throw new EntityTfError(`${where}: cloud_link_id is not an elementum_cloudlink data reference`);
80
+ }
81
+ return {
82
+ kind: "linked",
83
+ refName,
84
+ cloudLinkKey: tfLabelToTsLabel(cloud.label),
85
+ database: requiredString(block.attrs, "database", where),
86
+ schema: requiredString(block.attrs, "schema_name", where),
87
+ serviceName: requiredString(block.attrs, "service_name", where),
88
+ ...(typeof block.attrs["warehouse"] === "string" && { warehouse: block.attrs["warehouse"] }),
89
+ };
90
+ }
91
+ const rawAttributes = block.attrs["attribute_field_ids"];
92
+ if (!Array.isArray(rawAttributes))
93
+ throw new EntityTfError(`${where}: "attribute_field_ids" must be a list`);
94
+ const duration = requiredString(block.attrs, "duration", where);
95
+ if (!["DAYS", "HOURS", "MINUTES", "SECONDS"].includes(duration)) {
96
+ throw new EntityTfError(`${where}: unsupported duration ${JSON.stringify(duration)}`);
97
+ }
98
+ const targetLag = block.attrs["target_lag"];
99
+ if (typeof targetLag !== "number")
100
+ throw new EntityTfError(`${where}: "target_lag" is required`);
101
+ return {
102
+ kind: "snowflake",
103
+ refName,
104
+ ...(typeof block.attrs["name"] === "string" && { name: block.attrs["name"] }),
105
+ fieldKey: fieldKey(block.attrs["field_id"], ownerTfLabel, aspectScope, where),
106
+ attributeFieldKeys: rawAttributes.map((value) => fieldKey(value, ownerTfLabel, aspectScope, where)),
107
+ connectorKey: connectorKey(block.attrs["ai_provider_connector_id"], ctx, where),
108
+ duration: duration,
109
+ targetLag,
110
+ ...(typeof block.attrs["warehouse"] === "string" && { warehouse: block.attrs["warehouse"] }),
111
+ ...(typeof block.attrs["creation_timeout"] === "string" && { creationTimeout: block.attrs["creation_timeout"] }),
112
+ };
113
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * v2 search-table authoring — `defineSearchTable`. App-owned; create-only.
2
+ * v2 search-table authoring — `defineSearchTable`. Element-owned; create-only.
3
3
  * Standalone from v1's `src/searchTables`.
4
4
  */
5
- export { defineSearchTable, type DefineSearchTableV2Options, type SearchTableLinkedV2Options, type SearchTableSnowflakeV2Options, type SearchTableTimeUnit, type VectorIndex, } from "./build.js";
5
+ export { defineLinkedSearchTable, defineSearchTable, defineTableSearchTable, searchTableDuration, type DefineLinkedSearchTableOptions, type DefineSearchTableOptions, type DefineTableSearchTableOptions, type SearchTableDuration, type SearchTableConfigured, type SearchTableTimeUnit, type VectorIndex, } from "./build.js";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * v2 search-table authoring — `defineSearchTable`. App-owned; create-only.
2
+ * v2 search-table authoring — `defineSearchTable`. Element-owned; create-only.
3
3
  * Standalone from v1's `src/searchTables`.
4
4
  */
5
- export { defineSearchTable, } from "./build.js";
5
+ export { defineLinkedSearchTable, defineSearchTable, defineTableSearchTable, searchTableDuration, } from "./build.js";
@@ -3,7 +3,11 @@
3
3
  * catalog discovery; TF bridge not on the graph lifecycle yet.
4
4
  */
5
5
  import { rootParentFactoryEntry } from "../../catalog/render-helpers.js";
6
- import { NO_DATA, NO_LIFECYCLE, } from "../../graph/types.js";
6
+ import { EntityTfError } from "../../engine/entity.js";
7
+ import { searchTableFromTf } from "./from-tf.js";
8
+ import { printSearchTable } from "./printer.js";
9
+ import { searchTableToTf } from "./to-tf.js";
10
+ import { SEARCH_TABLE_RESOURCE_TYPES } from "./types.js";
7
11
  function isConfigured(value) {
8
12
  return (typeof value === "object" &&
9
13
  value !== null &&
@@ -11,7 +15,7 @@ function isConfigured(value) {
11
15
  typeof value.def === "function");
12
16
  }
13
17
  function searchTableStubRef(refName, parent) {
14
- return { __kind: "searchTable", refName, name: refName, parent };
18
+ return { __kind: "searchTable", refName, name: refName, parent, __variant: "snowflake" };
15
19
  }
16
20
  function searchTableRefFromAuthoring(args) {
17
21
  const { refName, parent, defaultExport } = args;
@@ -31,25 +35,88 @@ function searchTableRefFromAuthoring(args) {
31
35
  const entityRefName = entity.refName === "" ? refName : entity.refName;
32
36
  const entityParent = entity.parent === "" ? parent : entity.parent;
33
37
  const maybeRefName = entity.ref?.name;
34
- const payloadName = entity.payload?.name;
38
+ const payload = entity.payload;
39
+ const payloadName = payload?.name;
35
40
  const name = typeof maybeRefName === "string"
36
41
  ? maybeRefName
37
42
  : typeof payloadName === "string"
38
43
  ? payloadName
39
44
  : entityRefName;
40
- return { __kind: "searchTable", refName: entityRefName, name, parent: entityParent };
45
+ const variant = payload?.__variant === "snowflake" || payload?.__variant === "linked" || payload?.__variant === "table"
46
+ ? payload.__variant
47
+ : undefined;
48
+ return {
49
+ __kind: "searchTable",
50
+ refName: entityRefName,
51
+ name,
52
+ parent: entityParent,
53
+ ...(variant !== undefined && { __variant: variant }),
54
+ };
55
+ }
56
+ function extractSearchTables(ownBlocks, _stream, ctx) {
57
+ const items = [];
58
+ const skipped = [];
59
+ const diagnostics = [];
60
+ for (const block of ownBlocks) {
61
+ try {
62
+ items.push(searchTableFromTf(block, ctx.appTfLabel, block.type === SEARCH_TABLE_RESOURCE_TYPES.table ? "table" : ctx.parentScope, ctx));
63
+ }
64
+ catch (err) {
65
+ const address = `${block.type}.${block.label ?? ""}`;
66
+ skipped.push(address);
67
+ diagnostics.push(err instanceof Error ? err.message : String(err));
68
+ }
69
+ }
70
+ return { items, skipped, diagnostics };
41
71
  }
42
72
  export const searchTableModule = {
43
73
  kind: "search-table",
44
- stream: { role: "streamReported" },
74
+ stream: { role: "streamMember" },
45
75
  authoring: { unit: "ownFile", bag: "search-tables" },
76
+ // No `app` parent: a managed/linked search table is element-owned, and
77
+ // table-owned search has its own builder. See build.ts's SearchTableOwner.
46
78
  parents: [
47
- { parent: "app", child: "search-table" },
48
79
  { parent: "element", child: "search-table" },
80
+ { parent: "table", child: "search-table" },
49
81
  ],
50
- resource: { shape: "none" },
51
- data: NO_DATA,
52
- lifecycle: NO_LIFECYCLE,
82
+ resource: {
83
+ shape: "subTypes",
84
+ rows: [
85
+ { key: "snowflake", resourceType: SEARCH_TABLE_RESOURCE_TYPES.snowflake, implemented: true },
86
+ { key: "linked", resourceType: SEARCH_TABLE_RESOURCE_TYPES.linked, implemented: true },
87
+ { key: "table", resourceType: SEARCH_TABLE_RESOURCE_TYPES.table, implemented: true },
88
+ ],
89
+ },
90
+ data: {
91
+ participates: true,
92
+ resourceType: "elementum_search_table",
93
+ lookupAttr: "name",
94
+ referencedByBuild: true,
95
+ },
96
+ lifecycle: {
97
+ participates: true,
98
+ extractOwnFile: extractSearchTables,
99
+ printOwnFile: (item, opts) => {
100
+ const table = item;
101
+ // A managed/linked search table is element-owned, so "app" here is an
102
+ // invalid state rather than a scope to print. Name it instead of coercing
103
+ // it into source that could not have been authored.
104
+ if (table.kind !== "table" && opts.parentScope !== "element") {
105
+ throw new EntityTfError(`search table "${table.refName}": a ${table.kind} search table is owned by an element, got parent scope "${opts.parentScope}"`);
106
+ }
107
+ return {
108
+ refName: table.refName,
109
+ source: printSearchTable(table, opts.appRefName, table.kind === "table" ? "table" : "element", opts.orgImportPath),
110
+ };
111
+ },
112
+ toTf: (entity, ctx) => searchTableToTf(entity, {
113
+ appRefName: ctx.appRefName,
114
+ appTfLabel: ctx.appTfLabel,
115
+ parentScope: ctx.parentScope ?? "app",
116
+ orgRefs: ctx.orgRefs,
117
+ diagnostics: ctx.diagnostics,
118
+ }),
119
+ },
53
120
  canvas: { participates: true, label: "Search tables", glyph: "⌕", component: "generic" },
54
121
  catalog: {
55
122
  participates: true,
@@ -57,7 +124,18 @@ export const searchTableModule = {
57
124
  catalogBag: "searchTables",
58
125
  renderOrder: 60,
59
126
  catalogRoot: "app",
60
- renderEntry: rootParentFactoryEntry("searchTableRef"),
127
+ renderEntry: (args) => {
128
+ const variant = args.ref.__variant;
129
+ const factoryName = variant === "linked"
130
+ ? "linkedSearchTableRef"
131
+ : variant === "table"
132
+ ? "tableSearchTableRef"
133
+ : "searchTableRef";
134
+ const rendered = rootParentFactoryEntry(factoryName)(args);
135
+ return factoryName === "searchTableRef"
136
+ ? rendered
137
+ : { ...rendered, extraFactories: [factoryName], omitsDefaultFactory: true };
138
+ },
61
139
  stubRef: searchTableStubRef,
62
140
  refFromAuthoring: searchTableRefFromAuthoring,
63
141
  },
@@ -0,0 +1,2 @@
1
+ import type { NormalizedSearchTable } from "./from-tf.js";
2
+ export declare function printSearchTable(table: NormalizedSearchTable, ownerRefName: string, parentScope: "element" | "table", orgImportPath: string): string;
@@ -0,0 +1,52 @@
1
+ import { quote } from "../../../pull/util.js";
2
+ import { sdkPackageSpecifier } from "../../internal/sdk-package.js";
3
+ function member(value) {
4
+ return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value) ? `.${value}` : `[${quote(value)}]`;
5
+ }
6
+ function connectorExpr(key) {
7
+ const dot = key.indexOf(".");
8
+ const provider = dot === -1 ? key : key.slice(0, dot);
9
+ const model = dot === -1 ? "" : key.slice(dot + 1);
10
+ return `org.aiProviders${member(provider)}.models${member(model)}`;
11
+ }
12
+ export function printSearchTable(table, ownerRefName,
13
+ // "element" for managed/linked, "table" for table-owned. Never "app".
14
+ parentScope, orgImportPath) {
15
+ const builder = table.kind === "linked"
16
+ ? "defineLinkedSearchTable"
17
+ : table.kind === "table"
18
+ ? "defineTableSearchTable"
19
+ : "defineSearchTable";
20
+ const lines = [
21
+ "/** Auto-generated by EDK pull. Hand-edit freely. */",
22
+ `import { ${builder}, searchTableDuration } from ${quote(sdkPackageSpecifier("searchTables"))};`,
23
+ ...(parentScope === "table" ? [] : [`import catalog from "@catalog";`]),
24
+ `import { org } from ${quote(orgImportPath)};`,
25
+ ...(parentScope === "table" ? [`import tableDefinition from ${quote(`../${ownerRefName}.js`)};`] : []),
26
+ "",
27
+ ...(parentScope === "table" ? [`const table = tableDefinition.ref(${quote(ownerRefName)});`, ""] : []),
28
+ `const searchTable = ${builder}({`,
29
+ ];
30
+ if (table.kind === "table") {
31
+ const tableExpr = "table";
32
+ lines.push(` table: ${tableExpr},`, ...(table.name !== undefined ? [` name: ${quote(table.name)},`] : []), ` field: ${tableExpr}.columns${member(table.fieldKey)},`, ` service: ${connectorExpr(table.connectorKey)},`, ` attributeFields: [${table.attributeFieldKeys.map((key) => `${tableExpr}.columns${member(key)}`).join(", ")}],`, ` duration: searchTableDuration.${table.duration.toLowerCase()},`, ` targetLag: ${table.targetLag},`);
33
+ if (table.warehouse !== undefined)
34
+ lines.push(` warehouse: ${quote(table.warehouse)},`);
35
+ if (table.creationTimeout !== undefined)
36
+ lines.push(` creationTimeout: ${quote(table.creationTimeout)},`);
37
+ }
38
+ else if (table.kind === "snowflake") {
39
+ lines.push(` ${parentScope}: catalog${member(ownerRefName)},`, ` name: ${quote(table.name ?? table.refName)},`, ` attributeFields: [${table.attributeFieldKeys.map((key) => `catalog${member(ownerRefName)}.fields${member(key)}`).join(", ")}],`, ` vectorIndex: { field: catalog${member(ownerRefName)}.fields${member(table.fieldKey)}, service: ${connectorExpr(table.connectorKey)} },`, ` duration: searchTableDuration.${table.duration.toLowerCase()},`, ` targetLag: ${table.targetLag},`);
40
+ if (table.warehouse !== undefined)
41
+ lines.push(` warehouse: ${quote(table.warehouse)},`);
42
+ if (table.creationTimeout !== undefined)
43
+ lines.push(` creationTimeout: ${quote(table.creationTimeout)},`);
44
+ }
45
+ else {
46
+ lines.push(` ${parentScope}: catalog${member(ownerRefName)},`, ` name: ${quote(table.refName)},`, ` cloudLink: org.cloudLinks${member(table.cloudLinkKey)},`, ` database: ${quote(table.database)},`, ` schema: ${quote(table.schema)},`, ` serviceName: ${quote(table.serviceName)},`);
47
+ if (table.warehouse !== undefined)
48
+ lines.push(` warehouse: ${quote(table.warehouse)},`);
49
+ }
50
+ lines.push("});", "", "export default searchTable;", "");
51
+ return lines.join("\n");
52
+ }
@@ -0,0 +1,14 @@
1
+ import type { OrgRefLookup } from "../../engine/build/context.js";
2
+ import { type DeployableEntity } from "../../engine/entity.js";
3
+ import { type ChildResourceScope, type TfBlock } from "../../engine/tf/index.js";
4
+ export interface SearchTableToTfContext {
5
+ readonly appRefName: string;
6
+ readonly appTfLabel: string;
7
+ readonly parentScope: ChildResourceScope | "table";
8
+ readonly orgRefs: OrgRefLookup;
9
+ readonly diagnostics: string[];
10
+ }
11
+ export declare function searchTableToTf(entity: DeployableEntity, ctx: SearchTableToTfContext): {
12
+ readonly blocks: readonly TfBlock[];
13
+ readonly address: string;
14
+ };
@@ -0,0 +1,104 @@
1
+ import { EntityTfError } from "../../engine/entity.js";
2
+ import { expr, scopedResourceLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
3
+ import { fieldRefToTfValue } from "../field/to-tf.js";
4
+ import { CLOUD_LINK_ORG_BAG } from "../org/cloud-link.js";
5
+ import { CONNECTOR_ORG_BAG } from "../org/connector.js";
6
+ import { SEARCH_TABLE_RESOURCE_TYPES } from "./types.js";
7
+ function fieldValue(token, ctx, where) {
8
+ if (token?.refName === undefined || token.refName === "")
9
+ throw new EntityTfError(`${where}: missing field token`);
10
+ if (token.parent !== undefined && token.parent !== ctx.appRefName) {
11
+ throw new EntityTfError(`${where}: cross-aspect field token ${token.parent}.${token.refName} is not supported`);
12
+ }
13
+ const value = fieldRefToTfValue(token.fieldType ?? "", token.refName, ctx.appTfLabel, ctx.parentScope);
14
+ if (value === undefined)
15
+ throw new EntityTfError(`${where}: field ${token.refName} has no Terraform resource mapping`);
16
+ return value;
17
+ }
18
+ function connectorValue(token, ctx, where) {
19
+ const key = token?.parent !== undefined ? `${token.parent}.${token.refName ?? ""}` : token?.refName ?? "";
20
+ const resolved = ctx.orgRefs.byTsLabel(CONNECTOR_ORG_BAG, key);
21
+ if (resolved === undefined) {
22
+ throw new EntityTfError(`${where}: AI service token "${key}" is not in the org catalog — re-run \`elementum pull org --data-only\``);
23
+ }
24
+ return expr.dataAttr("elementum_ai_provider_connector", resolved.tfLabel, ["id"]);
25
+ }
26
+ export function searchTableToTf(entity, ctx) {
27
+ if (entity.kind !== "searchTable")
28
+ throw new EntityTfError(`searchTableToTf expects kind "searchTable"; got ${entity.kind}`);
29
+ const payload = entity.payload;
30
+ if (payload === null || payload.__variant === undefined)
31
+ throw new EntityTfError(`search table ${entity.refName} has no variant payload`);
32
+ const label = ctx.parentScope === "table" ? `tables_${ctx.appTfLabel}_${tsLabelToTfLabel(entity.refName)}` : scopedResourceLabel(ctx.appTfLabel, tsLabelToTfLabel(entity.refName), ctx.parentScope);
33
+ if (payload.__variant === "table") {
34
+ const columnValue = (token, where) => {
35
+ if (!token?.refName || (token.parent !== undefined && token.parent !== ctx.appRefName))
36
+ throw new EntityTfError(`${where}: table column must belong to ${ctx.appRefName}`);
37
+ return expr.resourceAttr("elementum_table", ctx.appTfLabel, ["field_ids", { index: token.name ?? token.refName }]);
38
+ };
39
+ const attrs = {
40
+ table_id: expr.resourceAttr("elementum_table", ctx.appTfLabel, ["id"]),
41
+ field_id: columnValue(payload.fieldId, `search table ${entity.refName}`),
42
+ ai_provider_connector_id: connectorValue(payload.aiProviderConnectorId, ctx, `search table ${entity.refName}`),
43
+ attribute_field_ids: (payload.attributeFieldIds ?? []).map((field) => columnValue(field, `search table ${entity.refName}`)),
44
+ duration: payload.duration ?? "DAYS", target_lag: payload.targetLag ?? 1,
45
+ };
46
+ if (payload.name !== undefined)
47
+ attrs.name = payload.name;
48
+ if (payload.warehouse !== undefined)
49
+ attrs.warehouse = payload.warehouse;
50
+ if (payload.creationTimeout !== undefined)
51
+ attrs.creation_timeout = payload.creationTimeout;
52
+ const block = { kind: "resource", type: SEARCH_TABLE_RESOURCE_TYPES.table, label, attrs };
53
+ return { blocks: [block], address: `${block.type}.${label}` };
54
+ }
55
+ if (ctx.parentScope === "table") {
56
+ throw new EntityTfError(`search table ${entity.refName}: ${payload.__variant} search tables cannot belong to a table`);
57
+ }
58
+ const aspectCtx = ctx;
59
+ const objectId = expr.resourceAttr(ctx.parentScope === "element" ? "elementum_element" : "elementum_app", ctx.appTfLabel, ["id"]);
60
+ if (payload.__variant === "linked") {
61
+ const cloudLinkKey = payload.cloudLinkId?.refName ?? "";
62
+ const cloudLink = ctx.orgRefs.byTsLabel(CLOUD_LINK_ORG_BAG, cloudLinkKey);
63
+ if (cloudLink === undefined)
64
+ throw new EntityTfError(`search table ${entity.refName}: cloud link ${cloudLinkKey} is not in the org catalog`);
65
+ const attrs = {
66
+ object_id: objectId,
67
+ cloud_link_id: expr.dataAttr("elementum_cloudlink", cloudLink.tfLabel, ["id"]),
68
+ database: payload.database ?? "",
69
+ schema_name: payload.schema ?? "",
70
+ service_name: payload.serviceName ?? "",
71
+ };
72
+ if (payload.warehouse !== undefined)
73
+ attrs["warehouse"] = payload.warehouse;
74
+ const block = { kind: "resource", type: SEARCH_TABLE_RESOURCE_TYPES.linked, label, attrs };
75
+ return { blocks: [block], address: `${block.type}.${label}` };
76
+ }
77
+ const index = payload.vectorIndexes?.[0] ??
78
+ (payload.fieldId !== undefined || payload.aiProviderConnectorId !== undefined
79
+ ? { fieldId: payload.fieldId, aiProviderConnectorId: payload.aiProviderConnectorId }
80
+ : undefined);
81
+ if (index === undefined)
82
+ throw new EntityTfError(`search table ${entity.refName}: no vector index`);
83
+ if ((payload.vectorIndexes?.length ?? 0) > 1)
84
+ throw new EntityTfError(`search table ${entity.refName}: Terraform supports exactly one vector index`);
85
+ if ((payload.textIndexFieldIds?.length ?? 0) > 0) {
86
+ ctx.diagnostics.push(`search table ${entity.refName}: textIndexFields have no elementum_ai_search_table attribute; dropped`);
87
+ }
88
+ const attrs = {
89
+ object_id: objectId,
90
+ field_id: fieldValue(index.fieldId, aspectCtx, `search table ${entity.refName}`),
91
+ ai_provider_connector_id: connectorValue(index.aiProviderConnectorId, ctx, `search table ${entity.refName}`),
92
+ attribute_field_ids: (payload.attributeFieldIds ?? []).map((field) => fieldValue(field, aspectCtx, `search table ${entity.refName}`)),
93
+ duration: payload.duration ?? "DAYS",
94
+ target_lag: payload.targetLag ?? 1,
95
+ };
96
+ if (payload.name !== undefined)
97
+ attrs["name"] = payload.name;
98
+ if (payload.warehouse !== undefined)
99
+ attrs["warehouse"] = payload.warehouse;
100
+ if (payload.creationTimeout !== undefined)
101
+ attrs["creation_timeout"] = payload.creationTimeout;
102
+ const block = { kind: "resource", type: SEARCH_TABLE_RESOURCE_TYPES.snowflake, label, attrs };
103
+ return { blocks: [block], address: `${block.type}.${label}` };
104
+ }
@@ -0,0 +1,8 @@
1
+ export declare const SEARCH_TABLE_RESOURCE_TYPES: {
2
+ readonly snowflake: "elementum_ai_search_table";
3
+ readonly linked: "elementum_linked_ai_search_table";
4
+ readonly table: "elementum_table_search_table";
5
+ };
6
+ export type SearchTableResourceVariant = keyof typeof SEARCH_TABLE_RESOURCE_TYPES;
7
+ export declare const SEARCH_TABLE_VARIANT_BY_RESOURCE: Map<string, "snowflake" | "table" | "linked">;
8
+ export declare const KNOWN_SEARCH_TABLE_ATTRS: Readonly<Record<"snowflake" | "linked" | "table", ReadonlySet<string>>>;
@@ -0,0 +1,21 @@
1
+ export const SEARCH_TABLE_RESOURCE_TYPES = {
2
+ snowflake: "elementum_ai_search_table",
3
+ linked: "elementum_linked_ai_search_table",
4
+ table: "elementum_table_search_table",
5
+ };
6
+ export const SEARCH_TABLE_VARIANT_BY_RESOURCE = new Map(Object.entries(SEARCH_TABLE_RESOURCE_TYPES).map(([variant, resource]) => [resource, variant]));
7
+ export const KNOWN_SEARCH_TABLE_ATTRS = {
8
+ snowflake: new Set([
9
+ "name",
10
+ "object_id",
11
+ "field_id",
12
+ "ai_provider_connector_id",
13
+ "attribute_field_ids",
14
+ "duration",
15
+ "target_lag",
16
+ "warehouse",
17
+ "creation_timeout",
18
+ ]),
19
+ linked: new Set(["object_id", "cloud_link_id", "database", "schema_name", "service_name", "warehouse"]),
20
+ table: new Set(["name", "table_id", "field_id", "ai_provider_connector_id", "attribute_field_ids", "duration", "target_lag", "warehouse", "creation_timeout", "status", "error_message", "field_name"]),
21
+ };
@@ -0,0 +1,32 @@
1
+ import type { GroupRef } from "../../catalog/index.js";
2
+ import type { RoleUserRef } from "../role/build.js";
3
+ declare const serviceAccountStatusBrand: unique symbol;
4
+ export type ServiceAccountStatus = string & {
5
+ readonly [serviceAccountStatusBrand]: "ServiceAccountStatus";
6
+ };
7
+ export declare const serviceAccountStatus: {
8
+ readonly active: ServiceAccountStatus;
9
+ readonly inactive: ServiceAccountStatus;
10
+ };
11
+ /** A role by display name within the service account's owning app. */
12
+ export interface ServiceAccountRoleRef {
13
+ readonly __kind: "serviceAccountRole";
14
+ readonly name: string;
15
+ }
16
+ export declare function serviceAccountRoleRef(name: string): ServiceAccountRoleRef;
17
+ export interface ServiceAccountAccessPolicy {
18
+ readonly users?: readonly RoleUserRef[];
19
+ readonly groups?: readonly GroupRef[];
20
+ }
21
+ /** An app-owned non-human identity. Service accounts do not have email. */
22
+ export interface AppServiceAccount {
23
+ readonly firstName: string;
24
+ readonly lastName: string;
25
+ readonly purpose: string;
26
+ readonly status?: ServiceAccountStatus;
27
+ /** Custom or managed roles, both resolved by name within this app. */
28
+ readonly roles?: readonly ServiceAccountRoleRef[];
29
+ /** Users/groups allowed to select and run as this identity. */
30
+ readonly accessPolicies?: readonly ServiceAccountAccessPolicy[];
31
+ }
32
+ export {};
@@ -0,0 +1,9 @@
1
+ export const serviceAccountStatus = {
2
+ active: "ACTIVE",
3
+ inactive: "INACTIVE",
4
+ };
5
+ export function serviceAccountRoleRef(name) {
6
+ if (name.trim() === "")
7
+ throw new Error("service account role name must not be empty");
8
+ return { __kind: "serviceAccountRole", name };
9
+ }
@@ -0,0 +1,10 @@
1
+ import { type FromTfContext } from "../../engine/pull/context.js";
2
+ import { type TfBlock } from "../../engine/tf/index.js";
3
+ import { type AppServiceAccount } from "./build.js";
4
+ export interface NormalizedServiceAccount extends AppServiceAccount {
5
+ readonly key: string;
6
+ }
7
+ export declare function serviceAccountsFromTf(blocks: readonly TfBlock[], owner: {
8
+ readonly label: string;
9
+ readonly ownerTfLabel: string;
10
+ }, ctx: FromTfContext): NormalizedServiceAccount[];
@@ -0,0 +1,109 @@
1
+ import { dataRefLabel, resourceRefLabel } from "../../engine/pull/context.js";
2
+ import { scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
3
+ import { serviceAccountRoleRef, serviceAccountStatus, } from "./build.js";
4
+ import { SERVICE_ACCOUNT_ACCESS_POLICY_RESOURCE_TYPE, SERVICE_ACCOUNT_RESOURCE_TYPE } from "./module.js";
5
+ const ACCOUNT_ATTRS = new Set(["id", "app_id", "first_name", "last_name", "purpose", "name", "status", "role_ids"]);
6
+ const POLICY_ATTRS = new Set(["id", "app_id", "service_account_id", "user_ids", "group_ids"]);
7
+ function principal(value, type, where, ctx) {
8
+ const label = dataRefLabel(value, type);
9
+ if (label !== undefined) {
10
+ const name = ctx.dataName(type, label);
11
+ if (name !== undefined)
12
+ return type === "elementum_user"
13
+ ? { __kind: "user", email: name }
14
+ : { __kind: "group", refName: tfLabelToTsLabel(label), name };
15
+ ctx.diagnostics.push(`${where}: data.${type}.${label} has no lookup value; dropped`);
16
+ return undefined;
17
+ }
18
+ if (typeof value === "string")
19
+ ctx.diagnostics.push(`${where}: raw platform ids are not part of the public EDK API; dropped`);
20
+ else
21
+ ctx.diagnostics.push(`${where}: unrecognized principal; dropped`);
22
+ return undefined;
23
+ }
24
+ function principalList(value, type, where, ctx) {
25
+ if (value === undefined)
26
+ return undefined;
27
+ if (!Array.isArray(value)) {
28
+ ctx.diagnostics.push(`${where}: expected a list; dropped`);
29
+ return undefined;
30
+ }
31
+ const out = value.flatMap((item) => (type === "elementum_user"
32
+ ? principal(item, "elementum_user", where, ctx)
33
+ : principal(item, "elementum_group", where, ctx)) ?? []);
34
+ return out.length > 0 ? out : undefined;
35
+ }
36
+ function roleRefs(value, blocks, where, ctx) {
37
+ if (value === undefined)
38
+ return undefined;
39
+ if (!Array.isArray(value)) {
40
+ ctx.diagnostics.push(`${where}: expected a list; dropped`);
41
+ return undefined;
42
+ }
43
+ const out = [];
44
+ for (const item of value) {
45
+ const resourceLabel = resourceRefLabel(item, "elementum_role");
46
+ if (resourceLabel !== undefined) {
47
+ const role = blocks.find((candidate) => candidate.type === "elementum_role" && candidate.label === resourceLabel);
48
+ if (typeof role?.attrs["name"] === "string")
49
+ out.push(serviceAccountRoleRef(role.attrs["name"]));
50
+ else
51
+ ctx.diagnostics.push(`${where}: ${resourceLabel} has no recoverable role name; dropped`);
52
+ continue;
53
+ }
54
+ const dataLabel = dataRefLabel(item, "elementum_role");
55
+ const name = dataLabel === undefined ? undefined : ctx.dataName("elementum_role", dataLabel);
56
+ if (name !== undefined)
57
+ out.push(serviceAccountRoleRef(name));
58
+ else
59
+ ctx.diagnostics.push(`${where}: role reference has no recoverable name; dropped`);
60
+ }
61
+ return out.length > 0 ? out : undefined;
62
+ }
63
+ export function serviceAccountsFromTf(blocks, owner, ctx) {
64
+ const accounts = blocks.filter((block) => block.type === SERVICE_ACCOUNT_RESOURCE_TYPE);
65
+ const policies = blocks.filter((block) => block.type === SERVICE_ACCOUNT_ACCESS_POLICY_RESOURCE_TYPE);
66
+ return accounts.flatMap((block) => {
67
+ const label = block.label ?? "";
68
+ const where = `${SERVICE_ACCOUNT_RESOURCE_TYPE}.${label || "?"}`;
69
+ if (label === "" || resourceRefLabel(block.attrs["app_id"], "elementum_app") !== owner.label)
70
+ return [];
71
+ for (const attr of Object.keys(block.attrs))
72
+ if (!ACCOUNT_ATTRS.has(attr))
73
+ ctx.diagnostics.push(`${where}: unhandled attribute ${JSON.stringify(attr)}`);
74
+ const firstName = block.attrs["first_name"];
75
+ const lastName = block.attrs["last_name"];
76
+ const purpose = block.attrs["purpose"];
77
+ if (typeof firstName !== "string" || typeof lastName !== "string" || typeof purpose !== "string") {
78
+ ctx.diagnostics.push(`${where}: first_name, last_name, and purpose are required; skipped`);
79
+ return [];
80
+ }
81
+ const accessPolicies = [];
82
+ for (const policy of policies) {
83
+ if (resourceRefLabel(policy.attrs["service_account_id"], SERVICE_ACCOUNT_RESOURCE_TYPE) !== label)
84
+ continue;
85
+ const policyWhere = `${SERVICE_ACCOUNT_ACCESS_POLICY_RESOURCE_TYPE}.${policy.label ?? "?"}`;
86
+ for (const attr of Object.keys(policy.attrs))
87
+ if (!POLICY_ATTRS.has(attr))
88
+ ctx.diagnostics.push(`${policyWhere}: unhandled attribute ${JSON.stringify(attr)}`);
89
+ if (resourceRefLabel(policy.attrs["app_id"], "elementum_app") !== owner.label) {
90
+ ctx.diagnostics.push(`${policyWhere}: app_id has the wrong owner; skipped`);
91
+ continue;
92
+ }
93
+ const users = principalList(policy.attrs["user_ids"], "elementum_user", `${policyWhere}.user_ids`, ctx);
94
+ const groups = principalList(policy.attrs["group_ids"], "elementum_group", `${policyWhere}.group_ids`, ctx);
95
+ accessPolicies.push({ ...(users !== undefined && { users }), ...(groups !== undefined && { groups }) });
96
+ }
97
+ const roles = roleRefs(block.attrs["role_ids"], blocks, `${where}.role_ids`, ctx);
98
+ const status = block.attrs["status"];
99
+ return [{
100
+ key: scopedLabelToBagKey(owner.ownerTfLabel, label, "app"),
101
+ firstName,
102
+ lastName,
103
+ purpose,
104
+ ...(status === "ACTIVE" ? { status: serviceAccountStatus.active } : status === "INACTIVE" ? { status: serviceAccountStatus.inactive } : {}),
105
+ ...(roles !== undefined && { roles }),
106
+ ...(accessPolicies.length > 0 && { accessPolicies }),
107
+ }];
108
+ });
109
+ }