@elementumai/edk 0.0.0-oidc-bootstrap → 0.8.1

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 (390) hide show
  1. package/README.md +462 -3
  2. package/dist-sdk/elementum-entity-client/clients/agents/models/agent-tool.d.ts +188 -0
  3. package/dist-sdk/elementum-entity-client/clients/agents/models/agent-tool.js +20 -0
  4. package/dist-sdk/elementum-entity-client/clients/agents/models/agent.d.ts +245 -0
  5. package/dist-sdk/elementum-entity-client/clients/agents/models/agent.js +30 -0
  6. package/dist-sdk/elementum-entity-client/clients/ai-provider-connectors/models/ai-provider-connector.d.ts +18 -0
  7. package/dist-sdk/elementum-entity-client/clients/ai-provider-connectors/models/ai-provider-connector.js +8 -0
  8. package/dist-sdk/elementum-entity-client/clients/aspects/models/aspect.d.ts +718 -0
  9. package/dist-sdk/elementum-entity-client/clients/aspects/models/aspect.js +52 -0
  10. package/dist-sdk/elementum-entity-client/clients/aspects/models/field-base.d.ts +23 -0
  11. package/dist-sdk/elementum-entity-client/clients/aspects/models/field-base.js +1 -0
  12. package/dist-sdk/elementum-entity-client/clients/aspects/models/field-types.d.ts +148 -0
  13. package/dist-sdk/elementum-entity-client/clients/aspects/models/field-types.js +12 -0
  14. package/dist-sdk/elementum-entity-client/clients/aspects/models/format.d.ts +63 -0
  15. package/dist-sdk/elementum-entity-client/clients/aspects/models/format.js +17 -0
  16. package/dist-sdk/elementum-entity-client/clients/aspects/models/index.d.ts +39 -0
  17. package/dist-sdk/elementum-entity-client/clients/aspects/models/index.js +35 -0
  18. package/dist-sdk/elementum-entity-client/clients/aspects/models/picklist-config.d.ts +116 -0
  19. package/dist-sdk/elementum-entity-client/clients/aspects/models/picklist-config.js +11 -0
  20. package/dist-sdk/elementum-entity-client/clients/automation/models/automation.d.ts +178 -0
  21. package/dist-sdk/elementum-entity-client/clients/automation/models/automation.js +18 -0
  22. package/dist-sdk/elementum-entity-client/clients/document-models/models/document-model.d.ts +200 -0
  23. package/dist-sdk/elementum-entity-client/clients/document-models/models/document-model.js +1 -0
  24. package/dist-sdk/elementum-entity-client/clients/search-tables/models/index.d.ts +1 -0
  25. package/dist-sdk/elementum-entity-client/clients/search-tables/models/index.js +1 -0
  26. package/dist-sdk/elementum-entity-client/clients/search-tables/models/search-table-wire.d.ts +141 -0
  27. package/dist-sdk/elementum-entity-client/clients/search-tables/models/search-table-wire.js +22 -0
  28. package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.d.ts +123 -0
  29. package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.js +14 -0
  30. package/dist-sdk/elementum-entity-client/clients/skills/models/skill.d.ts +78 -0
  31. package/dist-sdk/elementum-entity-client/clients/skills/models/skill.js +23 -0
  32. package/dist-sdk/elementum-entity-client/clients/tables/models/index.d.ts +1 -0
  33. package/dist-sdk/elementum-entity-client/clients/tables/models/index.js +1 -0
  34. package/dist-sdk/elementum-entity-client/clients/tables/models/table-wire.d.ts +265 -0
  35. package/dist-sdk/elementum-entity-client/clients/tables/models/table-wire.js +15 -0
  36. package/dist-sdk/elementum-entity-client/errors.d.ts +90 -0
  37. package/dist-sdk/elementum-entity-client/errors.js +111 -0
  38. package/dist-sdk/elementum-entity-client/models/connection.d.ts +30 -0
  39. package/dist-sdk/elementum-entity-client/models/connection.js +16 -0
  40. package/dist-sdk/elementum-entity-client/types.d.ts +71 -0
  41. package/dist-sdk/elementum-entity-client/types.js +1 -0
  42. package/dist-sdk/fs/entity.d.ts +104 -0
  43. package/dist-sdk/fs/entity.js +52 -0
  44. package/dist-sdk/pull/util.d.ts +130 -0
  45. package/dist-sdk/pull/util.js +204 -0
  46. package/dist-sdk/src/catalog/ai-provider-models.d.ts +30 -0
  47. package/dist-sdk/src/catalog/ai-provider-models.js +63 -0
  48. package/dist-sdk/src/catalog/factories.d.ts +242 -0
  49. package/dist-sdk/src/catalog/factories.js +265 -0
  50. package/dist-sdk/src/catalog/from-authoring.d.ts +103 -0
  51. package/dist-sdk/src/catalog/from-authoring.js +467 -0
  52. package/dist-sdk/src/catalog/index.d.ts +12 -0
  53. package/dist-sdk/src/catalog/index.js +12 -0
  54. package/dist-sdk/src/catalog/org.d.ts +11 -0
  55. package/dist-sdk/src/catalog/org.js +288 -0
  56. package/dist-sdk/src/catalog/render-helpers.d.ts +35 -0
  57. package/dist-sdk/src/catalog/render-helpers.js +82 -0
  58. package/dist-sdk/src/catalog/render.d.ts +48 -0
  59. package/dist-sdk/src/catalog/render.js +193 -0
  60. package/dist-sdk/src/catalog/token.d.ts +10 -0
  61. package/dist-sdk/src/catalog/token.js +76 -0
  62. package/dist-sdk/src/catalog/types.d.ts +215 -0
  63. package/dist-sdk/src/catalog/types.js +86 -0
  64. package/dist-sdk/src/catalog/write.d.ts +43 -0
  65. package/dist-sdk/src/catalog/write.js +109 -0
  66. package/dist-sdk/src/core/app-to-ui.d.ts +22 -0
  67. package/dist-sdk/src/core/app-to-ui.js +75 -0
  68. package/dist-sdk/src/core/index.d.ts +10 -0
  69. package/dist-sdk/src/core/index.js +9 -0
  70. package/dist-sdk/src/core/system-fields.d.ts +95 -0
  71. package/dist-sdk/src/core/system-fields.js +153 -0
  72. package/dist-sdk/src/core/triggers/on-demand.d.ts +144 -0
  73. package/dist-sdk/src/core/triggers/on-demand.js +112 -0
  74. package/dist-sdk/src/core/types/ai-provider.d.ts +23 -0
  75. package/dist-sdk/src/core/types/ai-provider.js +8 -0
  76. package/dist-sdk/src/core/types/app.d.ts +857 -0
  77. package/dist-sdk/src/core/types/app.js +210 -0
  78. package/dist-sdk/src/core/types/aspect-category.d.ts +35 -0
  79. package/dist-sdk/src/core/types/aspect-category.js +33 -0
  80. package/dist-sdk/src/core/types/cloud-link.d.ts +34 -0
  81. package/dist-sdk/src/core/types/cloud-link.js +32 -0
  82. package/dist-sdk/src/core/types/display-block.d.ts +149 -0
  83. package/dist-sdk/src/core/types/display-block.js +61 -0
  84. package/dist-sdk/src/core/types/group.d.ts +13 -0
  85. package/dist-sdk/src/core/types/group.js +6 -0
  86. package/dist-sdk/src/core/types/platform.d.ts +2 -0
  87. package/dist-sdk/src/core/types/platform.js +1 -0
  88. package/dist-sdk/src/core/types/user.d.ts +20 -0
  89. package/dist-sdk/src/core/types/user.js +8 -0
  90. package/dist-sdk/src/core/wire/ref-serializer.d.ts +45 -0
  91. package/dist-sdk/src/core/wire/ref-serializer.js +89 -0
  92. package/dist-sdk/src/engine/build/context.d.ts +67 -0
  93. package/dist-sdk/src/engine/build/context.js +6 -0
  94. package/dist-sdk/src/engine/build/source-context.d.ts +45 -0
  95. package/dist-sdk/src/engine/build/source-context.js +23 -0
  96. package/dist-sdk/src/engine/entity.d.ts +44 -0
  97. package/dist-sdk/src/engine/entity.js +15 -0
  98. package/dist-sdk/src/engine/pull/context.d.ts +38 -0
  99. package/dist-sdk/src/engine/pull/context.js +44 -0
  100. package/dist-sdk/src/engine/pull/org.d.ts +54 -0
  101. package/dist-sdk/src/engine/pull/org.js +134 -0
  102. package/dist-sdk/src/engine/tf/escape.d.ts +22 -0
  103. package/dist-sdk/src/engine/tf/escape.js +28 -0
  104. package/dist-sdk/src/engine/tf/expr.d.ts +25 -0
  105. package/dist-sdk/src/engine/tf/expr.js +405 -0
  106. package/dist-sdk/src/engine/tf/index.d.ts +12 -0
  107. package/dist-sdk/src/engine/tf/index.js +11 -0
  108. package/dist-sdk/src/engine/tf/labels.d.ts +76 -0
  109. package/dist-sdk/src/engine/tf/labels.js +196 -0
  110. package/dist-sdk/src/engine/tf/model.d.ts +84 -0
  111. package/dist-sdk/src/engine/tf/model.js +49 -0
  112. package/dist-sdk/src/engine/tf/parse.d.ts +41 -0
  113. package/dist-sdk/src/engine/tf/parse.js +189 -0
  114. package/dist-sdk/src/engine/tf/render.d.ts +13 -0
  115. package/dist-sdk/src/engine/tf/render.js +102 -0
  116. package/dist-sdk/src/engine/workspace/authoring-layout.d.ts +43 -0
  117. package/dist-sdk/src/engine/workspace/authoring-layout.js +201 -0
  118. package/dist-sdk/src/entities/access-policy/build.d.ts +26 -0
  119. package/dist-sdk/src/entities/access-policy/build.js +7 -0
  120. package/dist-sdk/src/entities/access-policy/filter.d.ts +61 -0
  121. package/dist-sdk/src/entities/access-policy/filter.js +83 -0
  122. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +48 -0
  123. package/dist-sdk/src/entities/access-policy/from-tf.js +189 -0
  124. package/dist-sdk/src/entities/access-policy/module.d.ts +3 -0
  125. package/dist-sdk/src/entities/access-policy/module.js +17 -0
  126. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +36 -0
  127. package/dist-sdk/src/entities/access-policy/to-tf.js +149 -0
  128. package/dist-sdk/src/entities/access-policy/types.d.ts +4 -0
  129. package/dist-sdk/src/entities/access-policy/types.js +10 -0
  130. package/dist-sdk/src/entities/agent/build.d.ts +108 -0
  131. package/dist-sdk/src/entities/agent/build.js +148 -0
  132. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +53 -0
  133. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +344 -0
  134. package/dist-sdk/src/entities/agent/from-tf.d.ts +65 -0
  135. package/dist-sdk/src/entities/agent/from-tf.js +289 -0
  136. package/dist-sdk/src/entities/agent/index.d.ts +7 -0
  137. package/dist-sdk/src/entities/agent/index.js +7 -0
  138. package/dist-sdk/src/entities/agent/module.d.ts +4 -0
  139. package/dist-sdk/src/entities/agent/module.js +122 -0
  140. package/dist-sdk/src/entities/agent/to-tf.d.ts +33 -0
  141. package/dist-sdk/src/entities/agent/to-tf.js +188 -0
  142. package/dist-sdk/src/entities/agent/tools.d.ts +284 -0
  143. package/dist-sdk/src/entities/agent/tools.js +238 -0
  144. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +110 -0
  145. package/dist-sdk/src/entities/agent-tool/from-tf.js +265 -0
  146. package/dist-sdk/src/entities/agent-tool/module.d.ts +3 -0
  147. package/dist-sdk/src/entities/agent-tool/module.js +32 -0
  148. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +40 -0
  149. package/dist-sdk/src/entities/agent-tool/to-tf.js +250 -0
  150. package/dist-sdk/src/entities/agent-tool/types.d.ts +43 -0
  151. package/dist-sdk/src/entities/agent-tool/types.js +102 -0
  152. package/dist-sdk/src/entities/app/build.d.ts +368 -0
  153. package/dist-sdk/src/entities/app/build.js +372 -0
  154. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +168 -0
  155. package/dist-sdk/src/entities/app/deserializer/normalize.js +12 -0
  156. package/dist-sdk/src/entities/app/display-blocks.d.ts +26 -0
  157. package/dist-sdk/src/entities/app/display-blocks.js +34 -0
  158. package/dist-sdk/src/entities/app/from-tf.d.ts +23 -0
  159. package/dist-sdk/src/entities/app/from-tf.js +197 -0
  160. package/dist-sdk/src/entities/app/index.d.ts +14 -0
  161. package/dist-sdk/src/entities/app/index.js +11 -0
  162. package/dist-sdk/src/entities/app/locals.d.ts +11 -0
  163. package/dist-sdk/src/entities/app/locals.js +31 -0
  164. package/dist-sdk/src/entities/app/module.d.ts +4 -0
  165. package/dist-sdk/src/entities/app/module.js +66 -0
  166. package/dist-sdk/src/entities/app/to-tf.d.ts +33 -0
  167. package/dist-sdk/src/entities/app/to-tf.js +212 -0
  168. package/dist-sdk/src/entities/approval-chain/build.d.ts +24 -0
  169. package/dist-sdk/src/entities/approval-chain/build.js +56 -0
  170. package/dist-sdk/src/entities/approval-chain/index.d.ts +6 -0
  171. package/dist-sdk/src/entities/approval-chain/index.js +6 -0
  172. package/dist-sdk/src/entities/approval-chain/steps.d.ts +24 -0
  173. package/dist-sdk/src/entities/approval-chain/steps.js +20 -0
  174. package/dist-sdk/src/entities/automation/build.d.ts +259 -0
  175. package/dist-sdk/src/entities/automation/build.js +436 -0
  176. package/dist-sdk/src/entities/automation/catalog-render.d.ts +5 -0
  177. package/dist-sdk/src/entities/automation/catalog-render.js +35 -0
  178. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +152 -0
  179. package/dist-sdk/src/entities/automation/deserializer/ast.js +13 -0
  180. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +55 -0
  181. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +1176 -0
  182. package/dist-sdk/src/entities/automation/filter.d.ts +93 -0
  183. package/dist-sdk/src/entities/automation/filter.js +156 -0
  184. package/dist-sdk/src/entities/automation/from-tf.d.ts +35 -0
  185. package/dist-sdk/src/entities/automation/from-tf.js +1258 -0
  186. package/dist-sdk/src/entities/automation/index.d.ts +22 -0
  187. package/dist-sdk/src/entities/automation/index.js +25 -0
  188. package/dist-sdk/src/entities/automation/module.d.ts +3 -0
  189. package/dist-sdk/src/entities/automation/module.js +150 -0
  190. package/dist-sdk/src/entities/automation/operators.d.ts +93 -0
  191. package/dist-sdk/src/entities/automation/operators.js +69 -0
  192. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +19 -0
  193. package/dist-sdk/src/entities/automation/output-key-wire-name.js +24 -0
  194. package/dist-sdk/src/entities/automation/script-code.d.ts +51 -0
  195. package/dist-sdk/src/entities/automation/script-code.js +633 -0
  196. package/dist-sdk/src/entities/automation/serialize.d.ts +6 -0
  197. package/dist-sdk/src/entities/automation/serialize.js +41 -0
  198. package/dist-sdk/src/entities/automation/tasks.d.ts +641 -0
  199. package/dist-sdk/src/entities/automation/tasks.js +765 -0
  200. package/dist-sdk/src/entities/automation/to-tf.d.ts +19 -0
  201. package/dist-sdk/src/entities/automation/to-tf.js +1169 -0
  202. package/dist-sdk/src/entities/automation/triggers.d.ts +205 -0
  203. package/dist-sdk/src/entities/automation/triggers.js +202 -0
  204. package/dist-sdk/src/entities/automation/types.d.ts +78 -0
  205. package/dist-sdk/src/entities/automation/types.js +131 -0
  206. package/dist-sdk/src/entities/element/build.d.ts +121 -0
  207. package/dist-sdk/src/entities/element/build.js +110 -0
  208. package/dist-sdk/src/entities/element/from-tf.d.ts +19 -0
  209. package/dist-sdk/src/entities/element/from-tf.js +170 -0
  210. package/dist-sdk/src/entities/element/index.d.ts +12 -0
  211. package/dist-sdk/src/entities/element/index.js +10 -0
  212. package/dist-sdk/src/entities/element/locals.d.ts +7 -0
  213. package/dist-sdk/src/entities/element/locals.js +12 -0
  214. package/dist-sdk/src/entities/element/module.d.ts +8 -0
  215. package/dist-sdk/src/entities/element/module.js +65 -0
  216. package/dist-sdk/src/entities/element/to-tf.d.ts +14 -0
  217. package/dist-sdk/src/entities/element/to-tf.js +169 -0
  218. package/dist-sdk/src/entities/field/build.d.ts +112 -0
  219. package/dist-sdk/src/entities/field/build.js +84 -0
  220. package/dist-sdk/src/entities/field/calc/aggregate.d.ts +60 -0
  221. package/dist-sdk/src/entities/field/calc/aggregate.js +71 -0
  222. package/dist-sdk/src/entities/field/calc/date.d.ts +73 -0
  223. package/dist-sdk/src/entities/field/calc/date.js +109 -0
  224. package/dist-sdk/src/entities/field/calc/index.d.ts +229 -0
  225. package/dist-sdk/src/entities/field/calc/index.js +433 -0
  226. package/dist-sdk/src/entities/field/calc/numeric.d.ts +22 -0
  227. package/dist-sdk/src/entities/field/calc/numeric.js +67 -0
  228. package/dist-sdk/src/entities/field/calc/runtime.d.ts +61 -0
  229. package/dist-sdk/src/entities/field/calc/runtime.js +174 -0
  230. package/dist-sdk/src/entities/field/calc/text.d.ts +100 -0
  231. package/dist-sdk/src/entities/field/calc/text.js +208 -0
  232. package/dist-sdk/src/entities/field/calc/types.d.ts +86 -0
  233. package/dist-sdk/src/entities/field/calc/types.js +23 -0
  234. package/dist-sdk/src/entities/field/calc.d.ts +108 -0
  235. package/dist-sdk/src/entities/field/calc.js +54 -0
  236. package/dist-sdk/src/entities/field/from-tf.d.ts +31 -0
  237. package/dist-sdk/src/entities/field/from-tf.js +184 -0
  238. package/dist-sdk/src/entities/field/locals.d.ts +8 -0
  239. package/dist-sdk/src/entities/field/locals.js +24 -0
  240. package/dist-sdk/src/entities/field/module.d.ts +3 -0
  241. package/dist-sdk/src/entities/field/module.js +50 -0
  242. package/dist-sdk/src/entities/field/options.d.ts +27 -0
  243. package/dist-sdk/src/entities/field/options.js +76 -0
  244. package/dist-sdk/src/entities/field/record-shape.d.ts +57 -0
  245. package/dist-sdk/src/entities/field/record-shape.js +1 -0
  246. package/dist-sdk/src/entities/field/to-tf.d.ts +73 -0
  247. package/dist-sdk/src/entities/field/to-tf.js +142 -0
  248. package/dist-sdk/src/entities/field/types.d.ts +53 -0
  249. package/dist-sdk/src/entities/field/types.js +68 -0
  250. package/dist-sdk/src/entities/file-reader/build.d.ts +182 -0
  251. package/dist-sdk/src/entities/file-reader/build.js +105 -0
  252. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +6 -0
  253. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +109 -0
  254. package/dist-sdk/src/entities/file-reader/from-tf.d.ts +13 -0
  255. package/dist-sdk/src/entities/file-reader/from-tf.js +172 -0
  256. package/dist-sdk/src/entities/file-reader/index.d.ts +10 -0
  257. package/dist-sdk/src/entities/file-reader/index.js +10 -0
  258. package/dist-sdk/src/entities/file-reader/module.d.ts +3 -0
  259. package/dist-sdk/src/entities/file-reader/module.js +115 -0
  260. package/dist-sdk/src/entities/file-reader/to-tf.d.ts +14 -0
  261. package/dist-sdk/src/entities/file-reader/to-tf.js +84 -0
  262. package/dist-sdk/src/entities/file-reader/types.d.ts +32 -0
  263. package/dist-sdk/src/entities/file-reader/types.js +30 -0
  264. package/dist-sdk/src/entities/flow/activities/agent.d.ts +15 -0
  265. package/dist-sdk/src/entities/flow/activities/agent.js +29 -0
  266. package/dist-sdk/src/entities/flow/activities/approval.d.ts +9 -0
  267. package/dist-sdk/src/entities/flow/activities/approval.js +18 -0
  268. package/dist-sdk/src/entities/flow/activities/automation.d.ts +12 -0
  269. package/dist-sdk/src/entities/flow/activities/automation.js +22 -0
  270. package/dist-sdk/src/entities/flow/activities/ctx.d.ts +34 -0
  271. package/dist-sdk/src/entities/flow/activities/ctx.js +38 -0
  272. package/dist-sdk/src/entities/flow/activities/form.d.ts +22 -0
  273. package/dist-sdk/src/entities/flow/activities/form.js +36 -0
  274. package/dist-sdk/src/entities/flow/activities/index.d.ts +14 -0
  275. package/dist-sdk/src/entities/flow/activities/index.js +13 -0
  276. package/dist-sdk/src/entities/flow/activities/input-refs.d.ts +39 -0
  277. package/dist-sdk/src/entities/flow/activities/input-refs.js +19 -0
  278. package/dist-sdk/src/entities/flow/activities/prompt-template.d.ts +13 -0
  279. package/dist-sdk/src/entities/flow/activities/prompt-template.js +34 -0
  280. package/dist-sdk/src/entities/flow/activities/render-catalog.d.ts +140 -0
  281. package/dist-sdk/src/entities/flow/activities/render-catalog.js +174 -0
  282. package/dist-sdk/src/entities/flow/activities/types.d.ts +33 -0
  283. package/dist-sdk/src/entities/flow/activities/types.js +1 -0
  284. package/dist-sdk/src/entities/flow/build.d.ts +38 -0
  285. package/dist-sdk/src/entities/flow/build.js +115 -0
  286. package/dist-sdk/src/entities/flow/index.d.ts +8 -0
  287. package/dist-sdk/src/entities/flow/index.js +7 -0
  288. package/dist-sdk/src/entities/flow/serialize.d.ts +51 -0
  289. package/dist-sdk/src/entities/flow/serialize.js +94 -0
  290. package/dist-sdk/src/entities/flow/util.d.ts +27 -0
  291. package/dist-sdk/src/entities/flow/util.js +38 -0
  292. package/dist-sdk/src/entities/org/ai-provider.d.ts +13 -0
  293. package/dist-sdk/src/entities/org/ai-provider.js +46 -0
  294. package/dist-sdk/src/entities/org/category.d.ts +5 -0
  295. package/dist-sdk/src/entities/org/category.js +33 -0
  296. package/dist-sdk/src/entities/org/cloud-link.d.ts +5 -0
  297. package/dist-sdk/src/entities/org/cloud-link.js +33 -0
  298. package/dist-sdk/src/entities/org/connector.d.ts +12 -0
  299. package/dist-sdk/src/entities/org/connector.js +35 -0
  300. package/dist-sdk/src/entities/org/group.d.ts +5 -0
  301. package/dist-sdk/src/entities/org/group.js +40 -0
  302. package/dist-sdk/src/entities/org/index.d.ts +11 -0
  303. package/dist-sdk/src/entities/org/index.js +11 -0
  304. package/dist-sdk/src/entities/org/role.d.ts +7 -0
  305. package/dist-sdk/src/entities/org/role.js +21 -0
  306. package/dist-sdk/src/entities/org/user.d.ts +7 -0
  307. package/dist-sdk/src/entities/org/user.js +30 -0
  308. package/dist-sdk/src/entities/search-table/build.d.ts +41 -0
  309. package/dist-sdk/src/entities/search-table/build.js +79 -0
  310. package/dist-sdk/src/entities/search-table/index.d.ts +5 -0
  311. package/dist-sdk/src/entities/search-table/index.js +5 -0
  312. package/dist-sdk/src/entities/search-table/module.d.ts +6 -0
  313. package/dist-sdk/src/entities/search-table/module.js +64 -0
  314. package/dist-sdk/src/entities/shared/context.d.ts +93 -0
  315. package/dist-sdk/src/entities/shared/context.js +156 -0
  316. package/dist-sdk/src/entities/shared/filters/ast.d.ts +277 -0
  317. package/dist-sdk/src/entities/shared/filters/ast.js +65 -0
  318. package/dist-sdk/src/entities/shared/filters/index.d.ts +211 -0
  319. package/dist-sdk/src/entities/shared/filters/index.js +372 -0
  320. package/dist-sdk/src/entities/shared/filters/types.d.ts +170 -0
  321. package/dist-sdk/src/entities/shared/filters/types.js +7 -0
  322. package/dist-sdk/src/entities/shared/ref.d.ts +160 -0
  323. package/dist-sdk/src/entities/shared/ref.js +119 -0
  324. package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +17 -0
  325. package/dist-sdk/src/entities/shared/tool-field-ref.js +31 -0
  326. package/dist-sdk/src/entities/shared/types/common.d.ts +106 -0
  327. package/dist-sdk/src/entities/shared/types/common.js +64 -0
  328. package/dist-sdk/src/entities/shared/types/field-types.d.ts +58 -0
  329. package/dist-sdk/src/entities/shared/types/field-types.js +57 -0
  330. package/dist-sdk/src/entities/shared/types/platform.d.ts +46 -0
  331. package/dist-sdk/src/entities/shared/types/platform.js +10 -0
  332. package/dist-sdk/src/entities/skill/build.d.ts +25 -0
  333. package/dist-sdk/src/entities/skill/build.js +50 -0
  334. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +39 -0
  335. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +124 -0
  336. package/dist-sdk/src/entities/skill/from-tf.d.ts +33 -0
  337. package/dist-sdk/src/entities/skill/from-tf.js +96 -0
  338. package/dist-sdk/src/entities/skill/index.d.ts +7 -0
  339. package/dist-sdk/src/entities/skill/index.js +7 -0
  340. package/dist-sdk/src/entities/skill/module.d.ts +4 -0
  341. package/dist-sdk/src/entities/skill/module.js +111 -0
  342. package/dist-sdk/src/entities/skill/to-tf.d.ts +33 -0
  343. package/dist-sdk/src/entities/skill/to-tf.js +59 -0
  344. package/dist-sdk/src/entities/skill/tools.d.ts +93 -0
  345. package/dist-sdk/src/entities/skill/tools.js +105 -0
  346. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +60 -0
  347. package/dist-sdk/src/entities/skill-tool/from-tf.js +142 -0
  348. package/dist-sdk/src/entities/skill-tool/module.d.ts +3 -0
  349. package/dist-sdk/src/entities/skill-tool/module.js +21 -0
  350. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +34 -0
  351. package/dist-sdk/src/entities/skill-tool/to-tf.js +130 -0
  352. package/dist-sdk/src/entities/skill-tool/types.d.ts +40 -0
  353. package/dist-sdk/src/entities/skill-tool/types.js +67 -0
  354. package/dist-sdk/src/entities/table/build.d.ts +74 -0
  355. package/dist-sdk/src/entities/table/build.js +339 -0
  356. package/dist-sdk/src/entities/table/catalog-render.d.ts +5 -0
  357. package/dist-sdk/src/entities/table/catalog-render.js +39 -0
  358. package/dist-sdk/src/entities/table/fields.d.ts +81 -0
  359. package/dist-sdk/src/entities/table/fields.js +70 -0
  360. package/dist-sdk/src/entities/table/filter.d.ts +41 -0
  361. package/dist-sdk/src/entities/table/filter.js +89 -0
  362. package/dist-sdk/src/entities/table/index.d.ts +8 -0
  363. package/dist-sdk/src/entities/table/index.js +12 -0
  364. package/dist-sdk/src/entities/table/joins.d.ts +26 -0
  365. package/dist-sdk/src/entities/table/joins.js +31 -0
  366. package/dist-sdk/src/entities/table/keys.d.ts +11 -0
  367. package/dist-sdk/src/entities/table/keys.js +25 -0
  368. package/dist-sdk/src/entities/table/module.d.ts +5 -0
  369. package/dist-sdk/src/entities/table/module.js +25 -0
  370. package/dist-sdk/src/entities/table/state.d.ts +39 -0
  371. package/dist-sdk/src/entities/table/state.js +43 -0
  372. package/dist-sdk/src/entities/view/from-tf.d.ts +29 -0
  373. package/dist-sdk/src/entities/view/from-tf.js +235 -0
  374. package/dist-sdk/src/entities/view/module.d.ts +24 -0
  375. package/dist-sdk/src/entities/view/module.js +61 -0
  376. package/dist-sdk/src/entities/view/to-tf.d.ts +65 -0
  377. package/dist-sdk/src/entities/view/to-tf.js +171 -0
  378. package/dist-sdk/src/entities/view/types.d.ts +58 -0
  379. package/dist-sdk/src/entities/view/types.js +89 -0
  380. package/dist-sdk/src/graph/deferred-catalog-render.d.ts +9 -0
  381. package/dist-sdk/src/graph/deferred-catalog-render.js +18 -0
  382. package/dist-sdk/src/graph/index.d.ts +91 -0
  383. package/dist-sdk/src/graph/index.js +211 -0
  384. package/dist-sdk/src/graph/modules.d.ts +7 -0
  385. package/dist-sdk/src/graph/modules.js +42 -0
  386. package/dist-sdk/src/graph/types.d.ts +375 -0
  387. package/dist-sdk/src/graph/types.js +102 -0
  388. package/dist-sdk/src/internal/sdk-package.d.ts +7 -0
  389. package/dist-sdk/src/internal/sdk-package.js +23 -0
  390. package/package.json +201 -8
@@ -0,0 +1,43 @@
1
+ export interface AuthoringTenantContext {
2
+ /** Organization slug from `ei auth` (folder basename). */
3
+ readonly organization: string;
4
+ /** Instance slug from `ei auth` (e.g. `eu`, `us`, `dev`). */
5
+ readonly instance: string;
6
+ }
7
+ /** Walk up from `startDir` to the nearest directory that contains `tsconfig.json`. */
8
+ export declare function findOrgWorkspaceByTsconfig(startDir: string): string | undefined;
9
+ /**
10
+ * Validate a path relative to the org workspace root (posix-style segments).
11
+ * Example: `elements/tag/tag.ts`, `apps/incident/automations/triage.ts`.
12
+ */
13
+ export declare function assertRelativeAuthoringPath(relPath: string): void;
14
+ /**
15
+ * Org root directory must be `<org>` or `<instance>/<org>` for this tenant.
16
+ */
17
+ export declare function assertOrgRootMatchesTenant(orgRoot: string, tenant: AuthoringTenantContext): void;
18
+ /**
19
+ * Absolute paths of org workspaces allowed for this auth tenant under `cwd`:
20
+ * `<org>` and `<instance>/<org>`.
21
+ */
22
+ export declare function approvedOrgWorkspaceRoots(tenant: AuthoringTenantContext, cwd?: string): string[];
23
+ /**
24
+ * Full plan/apply path gate.
25
+ *
26
+ * 1. Resolve org workspace via nearest `tsconfig.json`
27
+ * 2. Relative path from that root must be a complete valid authoring path
28
+ * 3. Org workspace folder must match authenticated org/instance
29
+ */
30
+ export declare function assertAuthoringPathForTenant(file: string, tenant: AuthoringTenantContext): void;
31
+ /**
32
+ * Layout-only check for discovery without a tenant context (tests).
33
+ * Prefers validating relative to the nearest `tsconfig.json` org root; falls
34
+ * back to requiring a valid `apps|elements/…` suffix in the absolute path.
35
+ */
36
+ export declare function assertValidAuthoringLayout(file: string): void;
37
+ /** @deprecated Use {@link assertAuthoringPathForTenant}. */
38
+ export declare function assertUnderAuthenticatedOrgWorkspace(file: string, tenant: AuthoringTenantContext): void;
39
+ /** Build tenant path context from active `ei auth`. */
40
+ export declare function authoringTenantFromEiAuth(auth: {
41
+ readonly organization: string;
42
+ readonly instance: string;
43
+ }): AuthoringTenantContext;
@@ -0,0 +1,201 @@
1
+ /**
2
+ * Authoring-path validation for plan/apply.
3
+ *
4
+ * Workspace root = nearest ancestor directory that contains `tsconfig.json`
5
+ * (the org root written by `elementum import org`).
6
+ *
7
+ * From that root, the relative path must be fully valid for the authenticated
8
+ * tenant:
9
+ *
10
+ * elements/<ref>/<ref>.ts
11
+ * apps/<ref>/<ref>.ts
12
+ * tables/<ref>/<ref>.ts
13
+ * {apps|elements}/<ref>/{automations,agents,…}/<name>.ts
14
+ *
15
+ * The org root itself must match auth:
16
+ * <org>/ or
17
+ * <instance>/<org>/ (e.g. eu/sanofi)
18
+ */
19
+ import { existsSync } from "node:fs";
20
+ import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
21
+ import { ENTITY_KIND_MODULES, ownFileBagsUnder } from "../../graph/index.js";
22
+ /** Org-root aspect bags from graph nodes parented by org with streamRoot + ownFile. */
23
+ const ASPECT_ROOTS = new Set(ENTITY_KIND_MODULES.flatMap((m) => {
24
+ if (m.stream.role !== "streamRoot" || m.authoring.unit !== "ownFile")
25
+ return [];
26
+ if (!m.parents.some((e) => e.parent === "org"))
27
+ return [];
28
+ return [m.authoring.bag];
29
+ }));
30
+ /**
31
+ * Child bags under apps|elements: union of own-file bags under app/element,
32
+ * plus legacy authoring dirs not yet registered as graph kinds (flows, …).
33
+ */
34
+ const LEGACY_CHILD_BAGS = ["flows", "approval-chains", "tables", "fileReaders"];
35
+ const CHILD_BAGS = new Set([
36
+ ...ownFileBagsUnder("app"),
37
+ ...ownFileBagsUnder("element"),
38
+ ...LEGACY_CHILD_BAGS,
39
+ ]);
40
+ /** Instance folder names used in multi-instance parent workspaces. */
41
+ const INSTANCE_FOLDER_NAMES = new Set(["us", "eu", "stage", "dev", "local"]);
42
+ /** Walk up from `startDir` to the nearest directory that contains `tsconfig.json`. */
43
+ export function findOrgWorkspaceByTsconfig(startDir) {
44
+ let cur = resolve(startDir);
45
+ while (true) {
46
+ if (existsSync(join(cur, "tsconfig.json")))
47
+ return cur;
48
+ const parent = dirname(cur);
49
+ if (parent === cur)
50
+ return undefined;
51
+ cur = parent;
52
+ }
53
+ }
54
+ /**
55
+ * Validate a path relative to the org workspace root (posix-style segments).
56
+ * Example: `elements/tag/tag.ts`, `apps/incident/automations/triage.ts`.
57
+ */
58
+ export function assertRelativeAuthoringPath(relPath) {
59
+ const rel = relPath.split(/[/\\]/).filter((p) => p && p !== ".").join("/");
60
+ if (rel === "" || rel.includes("..")) {
61
+ throw new Error(`Authoring path must be inside the org workspace: ${relPath}`);
62
+ }
63
+ const parts = rel.split("/");
64
+ const file = parts[parts.length - 1];
65
+ if (!/\.(ts|js|mjs)$/.test(file) || file.endsWith(".d.ts") || file.endsWith(".test.ts")) {
66
+ throw new Error(`Not an entity source file: ${relPath}`);
67
+ }
68
+ if (file.startsWith("_")) {
69
+ throw new Error(`Not an entity source file: ${relPath}`);
70
+ }
71
+ const stem = file.replace(/\.(ts|js|mjs)$/, "");
72
+ const bag = parts[0];
73
+ // Org-owned table root (graph: table.authoring.bag) — special-cased path shape.
74
+ if (bag === "tables") {
75
+ if (parts.length === 3) {
76
+ const refFolder = parts[1];
77
+ if (refFolder !== stem) {
78
+ throw new Error(`Table file must be tables/${refFolder}/${refFolder}.ts, got ${rel}`);
79
+ }
80
+ return;
81
+ }
82
+ if (parts.length === 2) {
83
+ throw new Error(`Flat authoring path is not allowed (${bag}/${stem}.ts). ` +
84
+ `Use ${bag}/${stem}/${stem}.ts instead.`);
85
+ }
86
+ throw new Error(`Org-owned table authoring path must be tables/<ref>/<ref>.ts, got: ${rel}`);
87
+ }
88
+ if (!bag || !ASPECT_ROOTS.has(bag)) {
89
+ throw new Error(`Authoring file must live under apps/<ref>/, elements/<ref>/, or tables/<ref>/ (from org workspace root), got: ${rel}`);
90
+ }
91
+ // apps|elements / <ref> / <ref>.ts
92
+ if (parts.length === 3) {
93
+ const refFolder = parts[1];
94
+ if (refFolder !== stem) {
95
+ throw new Error(`Aspect file must be ${bag}/${refFolder}/${refFolder}.ts, got ${rel}`);
96
+ }
97
+ return;
98
+ }
99
+ // apps|elements / <ref> / <bag> / <name>.ts
100
+ if (parts.length === 4) {
101
+ const childBag = parts[2];
102
+ if (!CHILD_BAGS.has(childBag)) {
103
+ throw new Error(`Unknown bag "${childBag}" under ${bag}/${parts[1]}/ — expected one of ${[...CHILD_BAGS].join(", ")}`);
104
+ }
105
+ return;
106
+ }
107
+ if (parts.length === 2) {
108
+ throw new Error(`Flat authoring path is not allowed (${bag}/${stem}.ts). ` +
109
+ `Use ${bag}/${stem}/${stem}.ts instead.`);
110
+ }
111
+ throw new Error(`Authoring path is too deep or malformed: ${rel}`);
112
+ }
113
+ /**
114
+ * Org root directory must be `<org>` or `<instance>/<org>` for this tenant.
115
+ */
116
+ export function assertOrgRootMatchesTenant(orgRoot, tenant) {
117
+ const orgSlug = tenant.organization.trim().toLowerCase();
118
+ const instanceSlug = tenant.instance.trim().toLowerCase();
119
+ if (orgSlug === "" || instanceSlug === "") {
120
+ throw new Error("ei auth instance and organization are required to validate authoring paths.");
121
+ }
122
+ const root = resolve(orgRoot);
123
+ const base = basename(root).toLowerCase();
124
+ const parent = basename(dirname(root)).toLowerCase();
125
+ if (base !== orgSlug) {
126
+ throw new Error(`Org workspace folder must be "${orgSlug}" (ei auth organization), got "${base}" (${root})`);
127
+ }
128
+ if (INSTANCE_FOLDER_NAMES.has(parent) && parent !== instanceSlug) {
129
+ throw new Error(`Org workspace is under instance folder "${parent}" but ei auth instance is "${instanceSlug}" (${root})`);
130
+ }
131
+ }
132
+ /**
133
+ * Absolute paths of org workspaces allowed for this auth tenant under `cwd`:
134
+ * `<org>` and `<instance>/<org>`.
135
+ */
136
+ export function approvedOrgWorkspaceRoots(tenant, cwd = process.cwd()) {
137
+ const org = tenant.organization.trim();
138
+ const instance = tenant.instance.trim();
139
+ if (org === "" || instance === "")
140
+ return [];
141
+ return [resolve(cwd, instance, org)];
142
+ }
143
+ /**
144
+ * Full plan/apply path gate.
145
+ *
146
+ * 1. Resolve org workspace via nearest `tsconfig.json`
147
+ * 2. Relative path from that root must be a complete valid authoring path
148
+ * 3. Org workspace folder must match authenticated org/instance
149
+ */
150
+ export function assertAuthoringPathForTenant(file, tenant) {
151
+ const abs = resolve(file);
152
+ const orgRoot = findOrgWorkspaceByTsconfig(dirname(abs));
153
+ if (orgRoot === undefined) {
154
+ throw new Error(`No org workspace (tsconfig.json) found above ${abs}`);
155
+ }
156
+ const rel = relative(orgRoot, abs);
157
+ if (rel.startsWith("..") || isAbsolute(rel)) {
158
+ throw new Error(`Authoring file is outside org workspace ${orgRoot}: ${abs}`);
159
+ }
160
+ assertRelativeAuthoringPath(rel);
161
+ assertOrgRootMatchesTenant(orgRoot, tenant);
162
+ }
163
+ /**
164
+ * Layout-only check for discovery without a tenant context (tests).
165
+ * Prefers validating relative to the nearest `tsconfig.json` org root; falls
166
+ * back to requiring a valid `apps|elements/…` suffix in the absolute path.
167
+ */
168
+ export function assertValidAuthoringLayout(file) {
169
+ const abs = resolve(file);
170
+ const orgRoot = findOrgWorkspaceByTsconfig(dirname(abs));
171
+ if (orgRoot !== undefined) {
172
+ const rel = relative(orgRoot, abs);
173
+ if (!rel.startsWith("..") && !isAbsolute(rel)) {
174
+ assertRelativeAuthoringPath(rel);
175
+ return;
176
+ }
177
+ }
178
+ // No tsconfig above the file — still reject obviously flat/misplaced paths
179
+ // by inspecting the absolute path's apps|elements|tables suffix.
180
+ const parts = abs.replace(/\.(ts|js|mjs)$/, "").split(sep);
181
+ const idx = Math.max(parts.lastIndexOf("apps"), parts.lastIndexOf("elements"), parts.lastIndexOf("tables"));
182
+ if (idx === -1) {
183
+ throw new Error(`Authoring file must live under an org workspace with tsconfig.json ` +
184
+ `(apps/<ref>/, elements/<ref>/, or tables/<ref>/): ${abs}`);
185
+ }
186
+ const suffix = parts.slice(idx).join("/");
187
+ assertRelativeAuthoringPath(`${suffix}.ts`);
188
+ }
189
+ /** @deprecated Use {@link assertAuthoringPathForTenant}. */
190
+ export function assertUnderAuthenticatedOrgWorkspace(file, tenant) {
191
+ assertAuthoringPathForTenant(file, tenant);
192
+ }
193
+ /** Build tenant path context from active `ei auth`. */
194
+ export function authoringTenantFromEiAuth(auth) {
195
+ const organization = auth.organization.trim();
196
+ const instance = auth.instance.trim();
197
+ if (organization === "" || instance === "") {
198
+ throw new Error("ei auth instance and organization are required.");
199
+ }
200
+ return { organization, instance };
201
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Access-policy authoring options — the `accessPolicies: [...]` array shared
3
+ * by `defineApp`/`defineElement` (`entities/app/build.ts` /
4
+ * `entities/element/build.ts`). Kept here, not duplicated per parent, since
5
+ * both parents accept the identical shape.
6
+ */
7
+ import type { GroupRef } from "../../catalog/index.js";
8
+ import type { AccessPolicyPrincipalRef } from "./from-tf.js";
9
+ import type { AccessPolicyFilter } from "./filter.js";
10
+ /**
11
+ * A principal (user/group) reference: a raw platform id — EDK has no
12
+ * `org.users` catalog bag to reference a user by handle (see
13
+ * `entities/org/user.ts`) — or, for groups only, a real `org.groups.<key>`
14
+ * catalog token. `AccessPolicyPrincipalRef` is the pulled-source echo (see
15
+ * that type's own doc comment) — round-tripped, not meant to be hand-authored.
16
+ */
17
+ export type AccessPolicyUserRef = string | AccessPolicyPrincipalRef;
18
+ export type AccessPolicyGroupRef = string | GroupRef | AccessPolicyPrincipalRef;
19
+ export interface AccessPolicyOptions {
20
+ /** Row-level-security predicate. Omit for the platform default (matches every record). */
21
+ readonly filter?: AccessPolicyFilter;
22
+ readonly userIds?: readonly AccessPolicyUserRef[];
23
+ readonly groupIds?: readonly AccessPolicyGroupRef[];
24
+ /** Always raw platform ids — ei's exporter carries no `elementum_service_account` resource to reference yet. */
25
+ readonly serviceAccountIds?: readonly string[];
26
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Access-policy authoring options — the `accessPolicies: [...]` array shared
3
+ * by `defineApp`/`defineElement` (`entities/app/build.ts` /
4
+ * `entities/element/build.ts`). Kept here, not duplicated per parent, since
5
+ * both parents accept the identical shape.
6
+ */
7
+ export {};
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Access-policy filter helpers — build the platform's wire `Filter` shape.
3
+ *
4
+ * Unlike automation's filter DSL (`entities/automation/filter.ts`), an access
5
+ * policy's filter has no trigger/task context to reference — it is always a
6
+ * plain row-level-security predicate over the OWNING app/element's own
7
+ * fields (confirmed by the frozen provider schema: `elementum_access_policy`
8
+ * carries `object_id` + `filter` + principal lists, nothing else). So the
9
+ * left-hand side of every operator is always a `FieldRef` catalog token —
10
+ * there is no `Ref`/`leftValue` row-less mode to support, and no user-directory
11
+ * field scope either (that's a distinct concept used elsewhere, e.g. approval
12
+ * chains — access policies filter the aspect's own records, never a fixed
13
+ * user-directory attribute).
14
+ *
15
+ * Operator/value-type coverage matches what `entities/automation/from-tf.ts`'s
16
+ * `decodeFilter` can round-trip (true/false/and/or/is_null/in/between/eq/gt/
17
+ * gte/lt/lte/like; text/number/boolean/null/current_user/field values) — this
18
+ * repo has no wider working filter-grammar implementation to match.
19
+ */
20
+ import type { FieldRef } from "../../catalog/index.js";
21
+ import type { LikeMode } from "../shared/filters/index.js";
22
+ /** A wire filter (embeds `FieldRef` tokens at `field` positions). */
23
+ export type AccessPolicyFilter = Record<string, unknown>;
24
+ type Primitive = string | number | boolean | null;
25
+ /**
26
+ * Marker produced by {@link currentUser} — compares against the acting
27
+ * user's id/email/domain rather than a literal value.
28
+ */
29
+ export interface CurrentUserFilterValue {
30
+ readonly __kind: "currentUser";
31
+ readonly currentUserType: "id" | "email" | "domain";
32
+ }
33
+ export type AccessPolicyFilterValue = Primitive | FieldRef | CurrentUserFilterValue;
34
+ /** Compare against the current (acting) user — id by default. */
35
+ export declare function currentUser(type?: "id" | "email" | "domain"): CurrentUserFilterValue;
36
+ /** Match every record (the minimal valid filter — the default when a policy has none configured). */
37
+ export declare function whereTrue(): AccessPolicyFilter;
38
+ /** Match no record. */
39
+ export declare function whereFalse(): AccessPolicyFilter;
40
+ export declare function eq(field: FieldRef, v: AccessPolicyFilterValue): AccessPolicyFilter;
41
+ export declare function neq(field: FieldRef, v: AccessPolicyFilterValue): AccessPolicyFilter;
42
+ export declare function gt(field: FieldRef, v: AccessPolicyFilterValue): AccessPolicyFilter;
43
+ export declare function gte(field: FieldRef, v: AccessPolicyFilterValue): AccessPolicyFilter;
44
+ export declare function lt(field: FieldRef, v: AccessPolicyFilterValue): AccessPolicyFilter;
45
+ export declare function lte(field: FieldRef, v: AccessPolicyFilterValue): AccessPolicyFilter;
46
+ export declare function like(field: FieldRef, v: string, options?: {
47
+ readonly not?: boolean;
48
+ readonly caseInsensitive?: boolean;
49
+ readonly mode?: LikeMode;
50
+ }): AccessPolicyFilter;
51
+ export declare function isNull(field: FieldRef, options?: {
52
+ readonly not?: boolean;
53
+ }): AccessPolicyFilter;
54
+ export declare function isNotNull(field: FieldRef): AccessPolicyFilter;
55
+ export declare function isIn(field: FieldRef, values: readonly AccessPolicyFilterValue[]): AccessPolicyFilter;
56
+ export declare function between(field: FieldRef, low: AccessPolicyFilterValue, high: AccessPolicyFilterValue, options?: {
57
+ readonly not?: boolean;
58
+ }): AccessPolicyFilter;
59
+ export declare function and(...children: AccessPolicyFilter[]): AccessPolicyFilter;
60
+ export declare function or(...children: AccessPolicyFilter[]): AccessPolicyFilter;
61
+ export {};
@@ -0,0 +1,83 @@
1
+ /** Compare against the current (acting) user — id by default. */
2
+ export function currentUser(type = "id") {
3
+ return { __kind: "currentUser", currentUserType: type };
4
+ }
5
+ function isCurrentUserValue(value) {
6
+ return typeof value === "object" && value !== null && value.__kind === "currentUser";
7
+ }
8
+ function isFieldValue(value) {
9
+ return typeof value === "object" && value !== null && value.__kind === "field";
10
+ }
11
+ /** Map a filter value to the platform's `Value` wire shape. */
12
+ function value(v) {
13
+ if (isCurrentUserValue(v))
14
+ return { type: "CURRENT_USER", currentUserType: v.currentUserType };
15
+ if (isFieldValue(v))
16
+ return { type: "FIELD", value: v };
17
+ if (v === null)
18
+ return { type: "NULL" };
19
+ if (typeof v === "number")
20
+ return { type: "NUMBER", value: v };
21
+ if (typeof v === "boolean")
22
+ return { type: "BOOLEAN", value: v };
23
+ return { type: "TEXT", value: v };
24
+ }
25
+ /** Match every record (the minimal valid filter — the default when a policy has none configured). */
26
+ export function whereTrue() {
27
+ return { type: "TRUE" };
28
+ }
29
+ /** Match no record. */
30
+ export function whereFalse() {
31
+ return { type: "FALSE" };
32
+ }
33
+ export function eq(field, v) {
34
+ return { type: "EQUALS", field, value: value(v) };
35
+ }
36
+ export function neq(field, v) {
37
+ return { type: "EQUALS", field, value: value(v), not: true };
38
+ }
39
+ export function gt(field, v) {
40
+ return { type: "GREATER_THAN", field, value: value(v) };
41
+ }
42
+ export function gte(field, v) {
43
+ return { type: "GREATER_THAN_EQUALS", field, value: value(v) };
44
+ }
45
+ export function lt(field, v) {
46
+ return { type: "LESS_THAN", field, value: value(v) };
47
+ }
48
+ export function lte(field, v) {
49
+ return { type: "LESS_THAN_EQUALS", field, value: value(v) };
50
+ }
51
+ export function like(field, v, options) {
52
+ return {
53
+ type: "LIKE",
54
+ field,
55
+ value: value(v),
56
+ ...(options?.not ? { not: true } : {}),
57
+ ...(options?.caseInsensitive !== undefined ? { caseInsensitive: options.caseInsensitive } : {}),
58
+ ...(options?.mode ? { mode: options.mode } : {}),
59
+ };
60
+ }
61
+ export function isNull(field, options) {
62
+ return { type: "IS_NULL", field, ...(options?.not ? { not: true } : {}) };
63
+ }
64
+ export function isNotNull(field) {
65
+ return isNull(field, { not: true });
66
+ }
67
+ export function isIn(field, values) {
68
+ return { type: "IN", field, values: values.map((v) => value(v)) };
69
+ }
70
+ export function between(field, low, high, options) {
71
+ return {
72
+ type: "BETWEEN",
73
+ field,
74
+ values: [value(low), value(high)],
75
+ ...(options?.not ? { not: true } : {}),
76
+ };
77
+ }
78
+ export function and(...children) {
79
+ return { type: "AND", children };
80
+ }
81
+ export function or(...children) {
82
+ return { type: "OR", children };
83
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Access-policy extraction (#69): one `elementum_access_policy` block → the
3
+ * normalized shape the app/element printer consumes. The owning app/element's
4
+ * from-tf drives the pass and says who the owner is — this module never
5
+ * names the app/element resource type.
6
+ *
7
+ * `object_id` is always self (ei's exporter never emits a foreign owner —
8
+ * confirmed by `cmd/elementum/export/hcl_access_policy.go`'s `collectOwners`,
9
+ * which only ever sets `object_id` to the SAME app/element/task being
10
+ * exported) — so a block whose `object_id` doesn't match the owner is
11
+ * dropped with a diagnostic rather than silently misattributed.
12
+ */
13
+ import { type FromTfContext } from "../../engine/pull/context.js";
14
+ import { type ChildResourceScope, type TfBlock } from "../../engine/tf/index.js";
15
+ import type { FilterAst } from "../shared/filters/ast.js";
16
+ export interface AccessPolicyOwner {
17
+ readonly type: string;
18
+ readonly label: string;
19
+ /** `appRefName`/`elementRefName` — the owner's EDK refName (catalog root), used to build field refs. */
20
+ readonly ownerRefName: string;
21
+ /** The owner's terraform label (namespace) — used to strip the child-resource label prefix off `*_field` refs. */
22
+ readonly ownerTfLabel: string;
23
+ readonly scope: ChildResourceScope;
24
+ }
25
+ /**
26
+ * A resolved `data.elementum_user`/`data.elementum_group` reference, decoded
27
+ * from a pulled stream — reproduced byte-for-byte by `to-tf.ts`'s
28
+ * `rawLookup`, never re-derived. Also a valid `AccessPolicyUserRef`/
29
+ * `AccessPolicyGroupRef` (see `build.ts`), so the printer can round-trip it
30
+ * straight into `userIds`/`groupIds` without a separate print-time shape.
31
+ */
32
+ export interface AccessPolicyPrincipalRef {
33
+ readonly __kind: "orgPrincipalRef";
34
+ readonly dataType: "elementum_user" | "elementum_group";
35
+ /** The data block's own label, captured verbatim — reproduced byte-for-byte, never re-derived. */
36
+ readonly label: string;
37
+ /** The data block's lookup-attr value ("email" for a user, "name" for a group). */
38
+ readonly value: string;
39
+ }
40
+ export interface NormalizedAccessPolicy {
41
+ readonly filter: FilterAst;
42
+ readonly userIds?: readonly (string | AccessPolicyPrincipalRef)[];
43
+ readonly groupIds?: readonly (string | AccessPolicyPrincipalRef)[];
44
+ /** Always raw platform ids — ei's exporter carries no `elementum_service_account` resource to reference yet. */
45
+ readonly serviceAccountIds?: readonly string[];
46
+ }
47
+ /** One `elementum_access_policy` block → its normalized shape, or undefined when it belongs to a different owner. */
48
+ export declare function accessPolicyFromTf(block: TfBlock, owner: AccessPolicyOwner, ctx: FromTfContext): NormalizedAccessPolicy | undefined;
@@ -0,0 +1,189 @@
1
+ /**
2
+ * Access-policy extraction (#69): one `elementum_access_policy` block → the
3
+ * normalized shape the app/element printer consumes. The owning app/element's
4
+ * from-tf drives the pass and says who the owner is — this module never
5
+ * names the app/element resource type.
6
+ *
7
+ * `object_id` is always self (ei's exporter never emits a foreign owner —
8
+ * confirmed by `cmd/elementum/export/hcl_access_policy.go`'s `collectOwners`,
9
+ * which only ever sets `object_id` to the SAME app/element/task being
10
+ * exported) — so a block whose `object_id` doesn't match the owner is
11
+ * dropped with a diagnostic rather than silently misattributed.
12
+ */
13
+ import { EntityTfError } from "../../engine/entity.js";
14
+ import { dataRefLabel, resourceRefLabel } from "../../engine/pull/context.js";
15
+ import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
16
+ import { KNOWN_ACCESS_POLICY_ATTRS } from "./types.js";
17
+ function isObject(value) {
18
+ return typeof value === "object" && value !== null && !Array.isArray(value);
19
+ }
20
+ function fieldRef(value, owner, where) {
21
+ if (isTfExpr(value) && value.$expr === "resource-attr" && value.type.endsWith("_field") && value.path[0] === "id") {
22
+ return { kind: "field", appHandle: owner.ownerRefName, fieldKey: scopedLabelToBagKey(owner.ownerTfLabel, value.label, owner.scope) };
23
+ }
24
+ // A system field (status/title/id/stage/…) has no own resource block — ei
25
+ // addresses its id via a `<ownerTfLabel>_<field>_field_id` local instead
26
+ // (same shape automation's decodeValue resolves for trigger/task field
27
+ // refs). Extremely common on real access-policy filters (row-level
28
+ // security keyed off Status is the whole point of the feature).
29
+ if (isTfExpr(value) && value.$expr === "local") {
30
+ const prefix = `${owner.ownerTfLabel}_`;
31
+ if (value.name.startsWith(prefix) && value.name.endsWith("_field_id")) {
32
+ return { kind: "field", appHandle: owner.ownerRefName, fieldKey: tfLabelToTsLabel(value.name.slice(prefix.length, -9)) };
33
+ }
34
+ }
35
+ if (typeof value === "string")
36
+ return { kind: "unresolved", uuid: value, hint: "field" };
37
+ throw new EntityTfError(`${where}: field reference cannot be reconstructed`);
38
+ }
39
+ /**
40
+ * A picklist-typed literal filter value ("Open") emits as a
41
+ * `local.<...>_options_by_label[label]` lookup on build, not a plain
42
+ * `{type:"text", value}` object (see `to-tf.ts`'s `picklistLiteralToTf`) —
43
+ * collapse it back to its readable label, mirroring automation's own
44
+ * `picklistOptionLabel`.
45
+ */
46
+ function picklistOptionLabel(value) {
47
+ if (value === undefined || !isTfExpr(value) || value.$expr !== "local" || value.path.length !== 1)
48
+ return undefined;
49
+ const segment = value.path[0];
50
+ const isOptionsLookup = value.name.endsWith("_options_by_label") || value.name.endsWith("_option_ids_by_label");
51
+ return isOptionsLookup && typeof segment === "object" && segment !== null && "index" in segment && typeof segment.index === "string"
52
+ ? segment.index
53
+ : undefined;
54
+ }
55
+ function filterValue(value, owner, where) {
56
+ const optionLabel = picklistOptionLabel(value);
57
+ if (optionLabel !== undefined)
58
+ return { kind: "text", value: optionLabel };
59
+ if (!isObject(value) || isTfExpr(value))
60
+ throw new EntityTfError(`${where}: filter value has an unrecognized shape`);
61
+ const type = typeof value.type === "string" ? value.type.toLowerCase() : undefined;
62
+ if (type === undefined)
63
+ throw new EntityTfError(`${where}: filter value has no type`);
64
+ if (type === "null")
65
+ return { kind: "null" };
66
+ if (type === "current_user") {
67
+ const raw = typeof value.current_user_type === "string" ? value.current_user_type.toLowerCase() : "id";
68
+ const currentUserType = raw === "email" || raw === "domain" ? raw : "id";
69
+ return { kind: "currentUser", currentUserType };
70
+ }
71
+ if (["text", "number", "boolean", "uuid", "date", "datetime"].includes(type)) {
72
+ return { kind: type, value: value.value };
73
+ }
74
+ if (type === "field")
75
+ return { kind: "reference", ref: fieldRef(value.value, owner, where) };
76
+ throw new EntityTfError(`${where}: unsupported filter value type "${type}"`);
77
+ }
78
+ /**
79
+ * Decode one `filter` attribute. Coverage matches automation's own
80
+ * `decodeFilter` (`entities/automation/from-tf.ts`) — the only proven,
81
+ * working filter-grammar round-trip in this codebase — minus the
82
+ * trigger/task `left_value.value_reference` branch, which cannot occur here
83
+ * (access policies have no trigger/task context to reference; the left side
84
+ * is always a `field_id`).
85
+ */
86
+ function decodeFilter(value, owner, where) {
87
+ if (!isObject(value) || isTfExpr(value) || typeof value.type !== "string")
88
+ throw new EntityTfError(`${where}: invalid filter object`);
89
+ const type = value.type.toLowerCase();
90
+ if (type === "true" || type === "false")
91
+ return { kind: type };
92
+ if (type === "and" || type === "or") {
93
+ if (!Array.isArray(value.children))
94
+ throw new EntityTfError(`${where}: ${type} filter has no children`);
95
+ return { kind: type, children: value.children.map((child) => decodeFilter(child, owner, where)) };
96
+ }
97
+ if (value.field_id === undefined)
98
+ throw new EntityTfError(`${where}: ${type} filter has no field_id`);
99
+ const left = fieldRef(value.field_id, owner, where);
100
+ const not = value.not === true ? { not: true } : {};
101
+ if (type === "is_null")
102
+ return { kind: "isNull", left, ...not };
103
+ if (type === "in") {
104
+ if (!Array.isArray(value.values))
105
+ throw new EntityTfError(`${where}: in filter has no values`);
106
+ return { kind: "in", left, values: value.values.map((item) => filterValue(item, owner, where)), ...not };
107
+ }
108
+ if (type === "between") {
109
+ if (!Array.isArray(value.values) || value.values.length !== 2)
110
+ throw new EntityTfError(`${where}: between filter requires two values`);
111
+ return { kind: "between", left, values: [filterValue(value.values[0], owner, where), filterValue(value.values[1], owner, where)], ...not };
112
+ }
113
+ const kindByType = {
114
+ equals: "eq", greater_than: "gt", greater_than_equals: "gte", less_than: "lt", less_than_equals: "lte", like: "like",
115
+ };
116
+ const kind = kindByType[type];
117
+ if (kind === undefined || value.value === undefined)
118
+ throw new EntityTfError(`${where}: unsupported filter type "${type}"`);
119
+ const right = filterValue(value.value, owner, where);
120
+ return kind === "like"
121
+ ? { kind, left, right, ...not, ...(typeof value.case_insensitive === "boolean" ? { caseInsensitive: value.case_insensitive } : {}), ...(typeof value.mode === "string" ? { mode: value.mode.toLowerCase() } : {}) }
122
+ : { kind, left, right, ...not };
123
+ }
124
+ /** Decode one `user_ids`/`group_ids` list item: a `data.elementum_user|group` lookup, or a raw platform id fallback. undefined = dropped, with a diagnostic already pushed. */
125
+ function principalListItem(item, dataType, where, ctx) {
126
+ const label = dataRefLabel(item, dataType);
127
+ if (label !== undefined) {
128
+ const value = ctx.dataName(dataType, label);
129
+ if (value !== undefined)
130
+ return { __kind: "orgPrincipalRef", dataType, label, value };
131
+ ctx.diagnostics.push(`${where}: references data.${dataType}.${label}, but the stream has no matching data block; dropped`);
132
+ return undefined;
133
+ }
134
+ if (typeof item === "string")
135
+ return item;
136
+ ctx.diagnostics.push(`${where}: list item has an unrecognized shape; dropped`);
137
+ return undefined;
138
+ }
139
+ function principalList(value, dataType, where, ctx) {
140
+ if (value === undefined)
141
+ return undefined;
142
+ if (!Array.isArray(value)) {
143
+ ctx.diagnostics.push(`${where}: is not a list; dropped`);
144
+ return undefined;
145
+ }
146
+ const items = [];
147
+ for (const item of value) {
148
+ const decoded = principalListItem(item, dataType, where, ctx);
149
+ if (decoded !== undefined)
150
+ items.push(decoded);
151
+ }
152
+ return items.length > 0 ? items : undefined;
153
+ }
154
+ /** One `elementum_access_policy` block → its normalized shape, or undefined when it belongs to a different owner. */
155
+ export function accessPolicyFromTf(block, owner, ctx) {
156
+ const label = block.label;
157
+ if (label === undefined || label === "")
158
+ throw new EntityTfError("elementum_access_policy block is missing its label");
159
+ const where = `access policy (${block.type}.${label})`;
160
+ const attrs = block.attrs;
161
+ for (const key of Object.keys(attrs)) {
162
+ if (!KNOWN_ACCESS_POLICY_ATTRS.has(key)) {
163
+ ctx.diagnostics.push(`${where}: unhandled attribute "${key}" — the export dialect grew; extend accessPolicyFromTf deliberately`);
164
+ }
165
+ }
166
+ if (resourceRefLabel(attrs["object_id"], owner.type) !== owner.label) {
167
+ ctx.diagnostics.push(`${where}: object_id does not reference ${owner.type}.${owner.label}; skipped`);
168
+ return undefined;
169
+ }
170
+ const filter = attrs["filter"] !== undefined ? decodeFilter(attrs["filter"], owner, where) : { kind: "true" };
171
+ const userIds = principalList(attrs["user_ids"], "elementum_user", `${where}: user_ids`, ctx);
172
+ const groupIds = principalList(attrs["group_ids"], "elementum_group", `${where}: group_ids`, ctx);
173
+ let serviceAccountIds;
174
+ const saAttr = attrs["service_account_ids"];
175
+ if (Array.isArray(saAttr)) {
176
+ serviceAccountIds = saAttr.filter((id) => typeof id === "string");
177
+ if (serviceAccountIds.length === 0)
178
+ serviceAccountIds = undefined;
179
+ }
180
+ else if (saAttr !== undefined) {
181
+ ctx.diagnostics.push(`${where}: service_account_ids is not a list; dropped`);
182
+ }
183
+ return {
184
+ filter,
185
+ ...(userIds !== undefined && { userIds }),
186
+ ...(groupIds !== undefined && { groupIds }),
187
+ ...(serviceAccountIds !== undefined && { serviceAccountIds }),
188
+ };
189
+ }
@@ -0,0 +1,3 @@
1
+ /** The access-policy entity's registry entry (see src/graph/). */
2
+ import { type EntityKindModule } from "../../graph/types.js";
3
+ export declare const accessPolicyModule: EntityKindModule;