@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,372 @@
1
+ /**
2
+ * v2 app/element authoring — `defineApp`. Parallel to v1 `src/aspects`,
3
+ * standalone from it.
4
+ *
5
+ * Produces a `DeployableEntity` of kind `app`/`element` with `parent: "org"` (apps are
6
+ * org-owned), whose payload is the platform's `AgentAspectInput` compose body.
7
+ * The cloud link is a `CatalogRef` token resolved at deploy; fields are authored
8
+ * inline (a new app's fields get server-assigned ids on compose). Deployed via
9
+ * the wire client's compose path (`composeAspect`).
10
+ *
11
+ * Slice scope: identity + the common scalar/picklist field types. Calc fields,
12
+ * dependent picklists, display blocks, and field-id reconciliation for updates
13
+ * follow the same pattern and land as expansion.
14
+ */
15
+ import { slimTokens } from "../../catalog/index.js";
16
+ import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_KEYS, SYSTEM_FIELD_REQUIRED, SYSTEM_FIELD_TAG_BY_KEY, WRITABLE_SYSTEM_TAG_NAMES, } from "../../core/system-fields.js";
17
+ import { serializeDisplayBlocks } from "./display-blocks.js";
18
+ /**
19
+ * Map a platform field type to the `AspectFieldInput` variant key. "relation"
20
+ * is a terraform-only synthetic key (no `elementum-entity-client` REST
21
+ * variant exists — `elementum_relation_field` never round-trips through the
22
+ * legacy compose API), hence the widened value type over `AspectFieldInputKey`.
23
+ */
24
+ const TYPE_TO_KEY = {
25
+ TEXT: "text",
26
+ RICH_TEXT: "text",
27
+ HANDLE: "handle",
28
+ HTML: "html",
29
+ NUMBER: "number",
30
+ DECIMAL: "decimal",
31
+ BOOLEAN: "bool",
32
+ DATE: "date",
33
+ DATETIME: "dateTime",
34
+ USER: "user",
35
+ USER_ID: "user",
36
+ GROUP: "group",
37
+ GROUP_ID: "group",
38
+ ATTACHMENT: "attachment",
39
+ ATTACHMENT_ID: "attachment",
40
+ JSON: "json",
41
+ PICKLIST: "picklist",
42
+ MULTI_PICKLIST: "multiPicklist",
43
+ RELATION: "relation",
44
+ };
45
+ const SYSTEM_FIELD_TAG_TO_TYPE = {
46
+ HANDLE: "HANDLE",
47
+ TITLE: "TEXT",
48
+ STATUS: "PICKLIST",
49
+ STAGE: "PICKLIST",
50
+ CREATED_AT: "DATETIME",
51
+ CREATED_BY: "USER",
52
+ UPDATED_AT: "DATETIME",
53
+ UPDATED_BY: "USER",
54
+ CLOSED_AT: "DATETIME",
55
+ CLOSED_BY: "USER",
56
+ };
57
+ function systemTag(field) {
58
+ return field.tags?.find((tag) => tag in SYSTEM_FIELD_TAG_TO_TYPE);
59
+ }
60
+ function typeMatchesSystemTag(field, expected) {
61
+ if (field.type === expected)
62
+ return true;
63
+ if (expected === "USER" && field.type === "USER_ID")
64
+ return true;
65
+ if (expected === "ATTACHMENT" && field.type === "ATTACHMENT_ID")
66
+ return true;
67
+ // The HANDLE-tagged field's own printed type varies across apps/elements
68
+ // (seen live: some pull as type "HANDLE", others as "TEXT") — accept any
69
+ // declared type for this tag rather than asserting a specific one.
70
+ if (expected === "HANDLE")
71
+ return true;
72
+ return false;
73
+ }
74
+ function assertSystemFieldRules(field) {
75
+ const tag = systemTag(field);
76
+ if (tag === undefined)
77
+ return;
78
+ const expected = SYSTEM_FIELD_TAG_TO_TYPE[tag];
79
+ if (!typeMatchesSystemTag(field, expected)) {
80
+ throw new Error(`System field "${field.name}" with tags ${JSON.stringify(field.tags)} ` +
81
+ `must keep platform type ${expected}; got ${field.type}.`);
82
+ }
83
+ if (!WRITABLE_SYSTEM_TAG_NAMES.has(tag)) {
84
+ if (field.defaultValue !== undefined) {
85
+ throw new Error(`System field "${field.name}" (${tag}) is read-only and cannot define a defaultValue.`);
86
+ }
87
+ // STAGE is the one non-writable system tag whose platform type is a
88
+ // picklist. Its options are platform-managed — the compose API rejects
89
+ // `picklistValues` for it with "This field is not a static picklist
90
+ // field.", a validation error that's opaque unless you already know
91
+ // that. Fail fast client-side with an explanation instead.
92
+ if (field.options !== undefined) {
93
+ throw new Error(`System field "${field.name}" (${tag}) is read-only and cannot define options — its picklist values are platform-managed.`);
94
+ }
95
+ }
96
+ }
97
+ function shouldSerializePicklistOptions(field) {
98
+ return field.type === "PICKLIST" || field.type === "MULTI_PICKLIST";
99
+ }
100
+ function picklistValue(opt) {
101
+ if (typeof opt === "string")
102
+ return { value: opt, label: opt };
103
+ return {
104
+ value: opt.label,
105
+ label: opt.label,
106
+ ...(opt.parentValues !== undefined ? { relatedParentValues: opt.parentValues } : {}),
107
+ ...(opt.tags !== undefined ? { tags: opt.tags } : {}),
108
+ ...(opt.color !== undefined ? { color: opt.color } : {}),
109
+ };
110
+ }
111
+ /**
112
+ * Serialize an authored field to its `AspectFieldInput` wire shape — shared
113
+ * with `defineElement`. `refName` is the field's bag key in `defineApp`'s
114
+ * `fields: {}` (e.g. `severity`) — carried as the internal `__refName` marker,
115
+ * a client-side-only bookkeeping value `applyV2`'s field reconciliation
116
+ * (`src/deploy/apply/apply.ts`, `reconcileFields`) reads to match this field
117
+ * against its previously-recorded state binding, then strips before the
118
+ * payload reaches the wire — it's never sent as `clientHandle` or anything
119
+ * else. Matching on the bag key instead of `name` is what lets a field's
120
+ * identity survive a display-`name` rename instead of being keyed by the
121
+ * mutable `name` (#230); the bag key itself is never rewritten by a rename,
122
+ * since it's just the field's fixed key in `fields: {}`.
123
+ */
124
+ export function serializeField(field, refName) {
125
+ assertSystemFieldRules(field);
126
+ const key = TYPE_TO_KEY[field.type] ?? "text";
127
+ const base = {
128
+ // No `id` yet: reconciled at deploy — `reconcileFields` matches this
129
+ // field (by `__refName`, falling back to `name`) against state and injects
130
+ // the existing id for an update; create lets the server assign one.
131
+ name: field.name,
132
+ ...(refName !== undefined ? { __refName: refName } : {}),
133
+ ...(field.columnName !== undefined ? { columnName: field.columnName } : {}),
134
+ ...(field.required !== undefined ? { required: field.required } : {}),
135
+ ...(field.requiredOnClose !== undefined ? { requiredOnClose: field.requiredOnClose } : {}),
136
+ ...(field.showOnCreate !== undefined ? { showOnCreate: field.showOnCreate } : {}),
137
+ ...(field.lockOnCreate !== undefined ? { lockOnCreate: field.lockOnCreate } : {}),
138
+ ...(field.description !== undefined ? { description: field.description } : {}),
139
+ ...(field.defaultValue !== undefined ? { defaultValue: field.defaultValue } : {}),
140
+ ...(field.tags !== undefined ? { tags: field.tags } : {}),
141
+ };
142
+ // Calculated field: the calc expression serializes to a text grammar string
143
+ // (field refs emitted by name; the platform resolves them on compose).
144
+ if (field.expression !== undefined) {
145
+ return { calculated: { ...base, calculation: { text: field.expression.toCalcString() } } };
146
+ }
147
+ if (key === "picklist" || key === "multiPicklist") {
148
+ if (shouldSerializePicklistOptions(field)) {
149
+ // Dynamic picklists must not send picklistValues — the platform rejects
150
+ // them with "This field is not a static picklist field."
151
+ if (field.options !== undefined && field.config?.dynamic === undefined) {
152
+ base.picklistValues = field.options.map(picklistValue);
153
+ }
154
+ if (field.config !== undefined) {
155
+ base.config = field.config;
156
+ }
157
+ else if (field.parentField !== undefined) {
158
+ // Dependent dropdown: parent field token → config.static.parentFieldId.
159
+ base.config = { static: { parentFieldId: field.parentField } };
160
+ }
161
+ }
162
+ }
163
+ // Pure-config formats (no refs).
164
+ if ((key === "number" || key === "decimal") && field.numericFormat !== undefined) {
165
+ base.format = field.numericFormat;
166
+ }
167
+ if (key === "decimal" && field.decimalPlaces !== undefined) {
168
+ base.decimalPlaces = field.decimalPlaces;
169
+ }
170
+ if ((key === "text" || key === "html") && field.qrFormat !== undefined) {
171
+ base.format = field.qrFormat;
172
+ }
173
+ if (key === "relation") {
174
+ if (field.relatedAspectId !== undefined)
175
+ base.relatedAspectId = field.relatedAspectId;
176
+ if (field.relatedLabelFieldId !== undefined)
177
+ base.relatedLabelFieldId = field.relatedLabelFieldId;
178
+ if (field.autoRelate !== undefined)
179
+ base.autoRelate = field.autoRelate;
180
+ }
181
+ return { [key]: base };
182
+ }
183
+ /**
184
+ * Reject a custom `fields:` bag key that is ALSO authored under
185
+ * `systemFields` — the same slot provisioned twice. Keys not present in
186
+ * systemFields stay legal as ordinary fields (existing workspaces key
187
+ * plain fields `title` etc.); full reservation of the canonical keys is
188
+ * deferred until system-field ref tokens land on `ref().fields`.
189
+ */
190
+ export function assertNoSystemKeyCollision(builder, name, fields, systemFields) {
191
+ if (systemFields === undefined)
192
+ return;
193
+ for (const key of Object.keys(fields)) {
194
+ if (systemFields[key] !== undefined) {
195
+ throw new Error(`${builder} "${name}": fields.${key} collides with the authored systemFields.${key} override — one slot, one author.`);
196
+ }
197
+ }
198
+ }
199
+ /**
200
+ * Serialize the AUTHORED system-field overrides into tagged compose entries
201
+ * (the same wire shape a system field carries on pull). Only authored keys
202
+ * are emitted — omitted keys stay platform-owned. status/stage overrides
203
+ * always carry their option set; the other keys are name-only.
204
+ */
205
+ export function serializeSystemFields(overrides) {
206
+ if (overrides === undefined)
207
+ return [];
208
+ return SYSTEM_FIELD_KEYS.filter((key) => overrides[key] !== undefined).map((key) => {
209
+ const tag = SYSTEM_FIELD_TAG_BY_KEY[key];
210
+ const override = overrides[key];
211
+ const name = override.name ?? DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES[key];
212
+ if (key === "stage") {
213
+ // Constructed directly, not via serializeField: the REST compose API
214
+ // rejects stage picklistValues (stage mutations have dedicated
215
+ // endpoints), so serializeField's system-field rules forbid them —
216
+ // but on the terraform path stages author via the app resource's
217
+ // `stages` attribute, which is exactly where toTf folds this entry.
218
+ return {
219
+ picklist: {
220
+ name,
221
+ required: SYSTEM_FIELD_REQUIRED[key],
222
+ tags: [tag],
223
+ __refName: key,
224
+ picklistValues: override.options.map(picklistValue),
225
+ },
226
+ };
227
+ }
228
+ const field = {
229
+ name,
230
+ type: SYSTEM_FIELD_TAG_TO_TYPE[tag],
231
+ required: SYSTEM_FIELD_REQUIRED[key],
232
+ tags: [tag],
233
+ ...(override.description !== undefined ? { description: override.description } : {}),
234
+ ...(key === "status" ? { options: override.options } : {}),
235
+ };
236
+ return serializeField(field, key);
237
+ });
238
+ }
239
+ /**
240
+ * Build a v2 app entity: org-owned, compose-body payload. Exposes
241
+ * `.ref(refName)` and `.def(refName)`.
242
+ *
243
+ * Elements author through `defineElement` (`@elementumai/edk/elements`,
244
+ * `src/elements/build.ts`) instead — a dedicated builder/printer, since a
245
+ * *linked* element's cloud mapping (Cloud Link + Database + Schema + Table,
246
+ * vs. a *standard* element's Elementum-managed table) has no equivalent on an
247
+ * app. `defineApp`'s `type` no longer accepts `"ELEMENT"`.
248
+ */
249
+ /**
250
+ * Client-side validation for `defineApp` — the authoring-time home for app
251
+ * validation rules, so a malformed definition fails at define time rather than
252
+ * as an opaque platform error during apply. App-specific on purpose: elements
253
+ * carry their own equivalent in `src/elements/build.ts`.
254
+ *
255
+ * - `handle` — uppercase letters only (A–Z), when provided (it's optional)
256
+ * - `namespace` — lowercase letters only (a–z), when provided
257
+ */
258
+ function validateAppOptions(opts) {
259
+ if (opts.handle !== undefined && !/^[A-Z]+$/.test(opts.handle)) {
260
+ throw new Error(`defineApp "${opts.name}": handle "${opts.handle}" must be uppercase letters only (A–Z).`);
261
+ }
262
+ if (opts.namespace !== undefined && !/^[a-z]+$/.test(opts.namespace)) {
263
+ throw new Error(`defineApp "${opts.name}": namespace "${opts.namespace}" must be lowercase letters only (a–z).`);
264
+ }
265
+ }
266
+ function picklistOptionLabels(options) {
267
+ return options.map((option) => typeof option === "string" ? option : option.label);
268
+ }
269
+ export function defineApp(opts) {
270
+ validateAppOptions(opts);
271
+ const fieldEntries = Object.values(opts.fields);
272
+ // systemFields overrides synthesize real field entries too (a pulled app can
273
+ // legitimately have zero custom fields — see the voicetest fixture).
274
+ if (fieldEntries.length === 0 && serializeSystemFields(opts.systemFields).length === 0) {
275
+ throw new Error(`defineApp "${opts.name}" requires at least one field — a fields: {} entry or a systemFields override.`);
276
+ }
277
+ const kind = "app";
278
+ return {
279
+ ref(refName) {
280
+ // `handle` here is the disambiguated bag key (the Record key, e.g.
281
+ // "severity") — kept so `renderCatalog` can derive the catalog's bag
282
+ // key from it. It's also the join key deploy resolves fields by: `def()`
283
+ // carries it as `serializeField`'s internal `__refName` marker (see its
284
+ // doc comment), and `resolveFieldBinding` tries it as a fallback after
285
+ // display `name`, so a field survives a `name` rename once its binding
286
+ // is recorded under this handle. It never appears in printed source:
287
+ // `render.ts`'s `renderRefCall` omits identity entirely for field refs,
288
+ // and `factories.ts`'s `fieldRef()` factory (used by generated code,
289
+ // with no bag-key context available) defaults it to `name` instead —
290
+ // both harmless, since printed refs re-resolve by name/bag key at their
291
+ // own deploy, not by this in-memory bag key.
292
+ const fields = {};
293
+ for (const [bagKey, field] of Object.entries(opts.fields)) {
294
+ fields[bagKey] = {
295
+ __kind: "field",
296
+ refName: bagKey,
297
+ name: field.name,
298
+ parent: refName,
299
+ fieldType: field.type,
300
+ ...(field.options !== undefined ? { options: picklistOptionLabels(field.options) } : {}),
301
+ ...(field.tags !== undefined ? { tags: field.tags } : {}),
302
+ };
303
+ }
304
+ // Every app has these platform-owned fields even when the authoring file
305
+ // omits systemFields (omission means "use the platform default", not
306
+ // "the field does not exist"). Keep them on the reference surface so
307
+ // automation authoring can always use app.fields.title/id/createdBy/etc.
308
+ // They remain absent from def().payload unless explicitly overridden.
309
+ for (const key of SYSTEM_FIELD_KEYS) {
310
+ if (fields[key] !== undefined)
311
+ continue;
312
+ const tag = SYSTEM_FIELD_TAG_BY_KEY[key];
313
+ const override = opts.systemFields?.[key];
314
+ fields[key] = {
315
+ __kind: "field",
316
+ refName: key,
317
+ name: override?.name ?? DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES[key],
318
+ parent: refName,
319
+ fieldType: SYSTEM_FIELD_TAG_TO_TYPE[tag],
320
+ tags: [tag],
321
+ ...(override !== undefined && "options" in override ? { options: picklistOptionLabels(override.options) } : {}),
322
+ };
323
+ }
324
+ // readonlyFields are platform-managed (system) fields — merged into the ref's `fields` bag
325
+ // so other entities can reference them by typed handle, but excluded from `def()` payload.
326
+ if (opts.readonlyFields !== undefined) {
327
+ for (const [bagKey, ref] of Object.entries(opts.readonlyFields)) {
328
+ fields[bagKey] = { ...ref, refName: bagKey, parent: refName };
329
+ }
330
+ }
331
+ // `fields` is built loosely (`Record<string, FieldRef>`) since the loop
332
+ // above can't statically prove per-key literal `fieldType`s to the
333
+ // compiler — the runtime values are exactly right (each field's own
334
+ // `field.type` literal), so this cast just states what's already true.
335
+ return { __kind: kind, refName: refName, name: opts.name, fields };
336
+ },
337
+ def(refName) {
338
+ assertNoSystemKeyCollision("defineApp", opts.name, opts.fields, opts.systemFields);
339
+ const displayBlocks = serializeDisplayBlocks(opts.displayBlocks, "LAYOUT");
340
+ const recordCreateDisplayBlocks = serializeDisplayBlocks(opts.recordCreateDisplayBlocks, "CREATE");
341
+ const payload = {
342
+ name: opts.name,
343
+ ...(opts.description !== undefined ? { description: opts.description } : {}),
344
+ handle: opts.handle, // wire field name is fixed by the compose API contract
345
+ namespace: opts.namespace,
346
+ type: "APP",
347
+ category: opts.category,
348
+ ...(opts.icon !== undefined ? { icon: opts.icon } : {}),
349
+ ...(opts.color !== undefined ? { color: opts.color } : {}),
350
+ ...(opts.cloudLink !== undefined ? { cloudLinkId: opts.cloudLink } : {}), // token → id at deploy
351
+ ...(opts.cloudOptions !== undefined ? { cloudOptions: opts.cloudOptions } : {}),
352
+ fields: [
353
+ ...serializeSystemFields(opts.systemFields),
354
+ ...Object.entries(opts.fields).map(([bagKey, field]) => serializeField(field, bagKey)),
355
+ ],
356
+ ...(displayBlocks !== undefined ? { displayBlocks } : {}),
357
+ ...(recordCreateDisplayBlocks !== undefined ? { recordCreateDisplayBlocks } : {}),
358
+ ...(opts.layouts !== undefined ? { layouts: opts.layouts } : {}),
359
+ ...(opts.listViews !== undefined ? { listViews: opts.listViews } : {}),
360
+ ...(opts.viewOrder !== undefined ? { viewOrder: opts.viewOrder } : {}),
361
+ ...(opts.accessPolicies !== undefined ? { accessPolicies: opts.accessPolicies } : {}),
362
+ };
363
+ return {
364
+ kind,
365
+ parent: "org",
366
+ refName,
367
+ payload: slimTokens(payload),
368
+ ...(opts.enabled !== undefined ? { enabled: opts.enabled } : {}),
369
+ };
370
+ },
371
+ };
372
+ }
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Normalized app projection types — the shape the app printer
3
+ * (`./print-app.ts`), the elements printer, the tf extractor
4
+ * (`../tf.ts` `appFromTf`), and the app-stream orchestrator
5
+ * (`../../extract/app.ts`) all consume.
6
+ *
7
+ * The legacy wire→normalized projection (`normalizeAspect` over the REST
8
+ * `AspectPullResponse`) was deleted with the REST deploy engine; on the
9
+ * pristine-refactor pipeline these shapes are produced from `ei export`
10
+ * HCL streams instead (see `appFromTf`).
11
+ */
12
+ import type { AppCategory, AppField, AppStage, AspectType } from "../../../core/types/app.js";
13
+ import type { DisplayBlock } from "../../../core/types/display-block.js";
14
+ import type { NormalizedAccessPolicy } from "../../access-policy/from-tf.js";
15
+ /**
16
+ * Keyed via `withUniqueKeys`, so two stages named "Review" become
17
+ * `review` / `review2` deterministically. The printer emits each
18
+ * as `stages.<key>`.
19
+ */
20
+ export interface NormalizedStage {
21
+ readonly key: string;
22
+ readonly stage: AppStage;
23
+ }
24
+ export interface NormalizedField {
25
+ readonly key: string;
26
+ readonly field: AppField;
27
+ /**
28
+ * Side-channel pull annotation for dependent-picklist linkage.
29
+ * Typed-ref `parentField` / `parentValues` on the runtime AppField
30
+ * need real picklist-object references, which aren't available until
31
+ * every sibling field has been projected — and emitting those refs
32
+ * from the printer requires hoisting parent / child fields to
33
+ * top-level `const`s before the `defineApp({...})` literal. We carry
34
+ * just the raw ids here; the printer resolves them against the
35
+ * other entries in the same `NormalizedApp.fields` list at emit
36
+ * time.
37
+ */
38
+ readonly parentLinkage?: {
39
+ /** Parent picklist's field id (same aspect). */
40
+ readonly parentFieldId?: string;
41
+ /** Map of this field's option id → parent option ids. */
42
+ readonly optionParents?: ReadonlyMap<string, readonly string[]>;
43
+ };
44
+ }
45
+ /**
46
+ * Snowflake-backed cloud-table mapping for a LINKED element — the terraform
47
+ * dialect's `cloud_mapping_snowflake_*` / `snowflake_hybrid_table` /
48
+ * `title_column_name` / `id_column_name` attributes on `elementum_element`.
49
+ * Real and round-tripped: `elementToTf` re-sends it on build (create-only —
50
+ * the table binding is immutable once set). Reserved for the element pull
51
+ * path; apps with no source-table binding will not populate this slot.
52
+ */
53
+ export interface NormalizedCloudConnectionSnowflake {
54
+ readonly kind: "snowflake";
55
+ readonly database?: string;
56
+ readonly schema?: string;
57
+ readonly table?: string;
58
+ readonly hybridTable?: boolean;
59
+ readonly titleColumnName?: string;
60
+ readonly idColumnName?: string;
61
+ }
62
+ /**
63
+ * Flat projection of one display block. The printer resolves
64
+ * `fieldId` → the field's hoisted-const name and `stageId` → a
65
+ * `stages.<key>` ref at emit time, mirroring how dependent-picklist
66
+ * `parentLinkage` is resolved. Groups carry `childKeys` (the bag keys
67
+ * of their children); children appear as their own entries in the
68
+ * flat list, referenced by those keys.
69
+ */
70
+ export interface NormalizedDisplayBlock {
71
+ readonly key: string;
72
+ readonly kind: DisplayBlock["kind"];
73
+ readonly id?: string;
74
+ readonly hidden?: boolean;
75
+ readonly displayLocation?: string;
76
+ /** Set only on top-level blocks (children inherit the group's stage). */
77
+ readonly stageId?: string;
78
+ /** Set on FIELD blocks — the referenced field's id. */
79
+ readonly fieldId?: string;
80
+ readonly name?: string;
81
+ readonly color?: string;
82
+ readonly icon?: string;
83
+ readonly maxColumns?: number;
84
+ readonly sideNavItem?: boolean;
85
+ readonly widgetId?: string;
86
+ readonly channels?: readonly string[];
87
+ readonly channelNames?: Readonly<Record<string, string>>;
88
+ /** GROUP children, in order, by bag key. */
89
+ readonly childKeys?: readonly string[];
90
+ }
91
+ /**
92
+ * One section of a per-stage layout (`elementum_layout`). `fields` entries
93
+ * are either a canonical system-field key (`"title"`, `"status"`, …) or a
94
+ * custom field's bag key — never a raw id (see `entities/view/from-tf.ts`).
95
+ */
96
+ export interface NormalizedLayoutSection {
97
+ readonly type: string;
98
+ readonly displayLocation?: string;
99
+ readonly displayOrder?: number;
100
+ readonly sideNavItem?: boolean;
101
+ readonly name?: string;
102
+ readonly icon?: string;
103
+ readonly color?: string;
104
+ readonly fields?: readonly string[];
105
+ }
106
+ /** A stage's record-detail layout, keyed by stage key on `NormalizedApp.layouts`. */
107
+ export interface NormalizedLayout {
108
+ readonly stageKey: string;
109
+ readonly sections: readonly NormalizedLayoutSection[];
110
+ }
111
+ /** A saved list view (`elementum_list_view`). `key` is its authoring bag key. */
112
+ export interface NormalizedListView {
113
+ readonly key: string;
114
+ readonly name: string;
115
+ readonly columns: readonly string[];
116
+ readonly allowRecordCreation?: boolean;
117
+ readonly density?: string;
118
+ readonly rows?: number;
119
+ /** Opaque JSON pass-through (see `entities/view/from-tf.ts` for why). */
120
+ readonly filter?: unknown;
121
+ /** Opaque JSON pass-through (see `entities/view/from-tf.ts` for why). */
122
+ readonly sort?: unknown;
123
+ }
124
+ /**
125
+ * Normalized aspect ready for `print-app.ts`. Carries the round-
126
+ * trip surface plus any cataloged metadata (handle for export
127
+ * binding). The wire bag fields agentsV2 / automations / search
128
+ * tables are not pulled here — those have their own pull scripts
129
+ * (`pull-agent`, `pull-automation`).
130
+ *
131
+ * `cloudLinkId`, `commentsEnabled`, and `cloudConnection` round-trip
132
+ * the metadata the discovery endpoints don't surface. They live on
133
+ * the normalized shape today; the printer wires them into the
134
+ * emitted `defineApp({...})` / `defineElement({...})` source as the
135
+ * matching authoring slots land.
136
+ */
137
+ export interface NormalizedApp {
138
+ readonly id: string;
139
+ readonly name: string;
140
+ readonly description?: string;
141
+ readonly namespace?: string;
142
+ readonly icon?: string;
143
+ readonly color?: string;
144
+ readonly type?: AspectType;
145
+ readonly category?: AppCategory;
146
+ /** camelCased identifier for the export binding and EDK refName. */
147
+ readonly refName: string;
148
+ /** Backend app/element handle authored into defineApp({ handle }). */
149
+ readonly backendHandle: string;
150
+ readonly fields: readonly NormalizedField[];
151
+ readonly stages: readonly NormalizedStage[];
152
+ readonly cloudLinkId?: string;
153
+ readonly cloudLinkClientHandle?: string;
154
+ readonly commentsEnabled?: boolean;
155
+ readonly cloudConnection?: NormalizedCloudConnectionSnowflake;
156
+ /** Record-view (LAYOUT) display blocks, flat with `childKeys` linkage. */
157
+ readonly displayBlocks?: readonly NormalizedDisplayBlock[];
158
+ /** New-record-form (CREATE) display blocks. */
159
+ readonly recordCreateDisplayBlocks?: readonly NormalizedDisplayBlock[];
160
+ /** Per-stage record layouts (terraform-path `elementum_layout`), keyed by `stageKey`. */
161
+ readonly layouts?: readonly NormalizedLayout[];
162
+ /** Saved list views (`elementum_list_view`). */
163
+ readonly listViews?: readonly NormalizedListView[];
164
+ /** Display order of `listViews`, by key (`elementum_managed_view_order`). */
165
+ readonly viewOrder?: readonly string[];
166
+ /** App/element-level sharing & row-level-security policies (`elementum_access_policy`), in export order. */
167
+ readonly accessPolicies?: readonly NormalizedAccessPolicy[];
168
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Normalized app projection types — the shape the app printer
3
+ * (`./print-app.ts`), the elements printer, the tf extractor
4
+ * (`../tf.ts` `appFromTf`), and the app-stream orchestrator
5
+ * (`../../extract/app.ts`) all consume.
6
+ *
7
+ * The legacy wire→normalized projection (`normalizeAspect` over the REST
8
+ * `AspectPullResponse`) was deleted with the REST deploy engine; on the
9
+ * pristine-refactor pipeline these shapes are produced from `ei export`
10
+ * HCL streams instead (see `appFromTf`).
11
+ */
12
+ export {};
@@ -0,0 +1,26 @@
1
+ /**
2
+ * v2 display-block authoring — the record view (LAYOUT) and new-record form
3
+ * (CREATE) surfaces. Field blocks carry a `FieldRef` token at `fieldId`
4
+ * (resolved at deploy); group blocks nest children. Mirrors v1's
5
+ * `AspectDisplayBlockInput` shape.
6
+ */
7
+ import type { FieldRef } from "../../catalog/index.js";
8
+ export type DisplayBlock = {
9
+ readonly kind: "field";
10
+ readonly field: FieldRef;
11
+ } | {
12
+ readonly kind: "group";
13
+ readonly name: string;
14
+ readonly blocks: readonly DisplayBlock[];
15
+ readonly color?: string;
16
+ readonly icon?: string;
17
+ readonly maxColumns?: number;
18
+ } | {
19
+ readonly kind: "widget";
20
+ readonly widgetId: string;
21
+ } | {
22
+ readonly kind: "comments";
23
+ readonly channels?: readonly string[];
24
+ };
25
+ /** Serialize a display-block list for one surface; `undefined`/empty → omitted. */
26
+ export declare function serializeDisplayBlocks(blocks: readonly DisplayBlock[] | undefined, displayType: "LAYOUT" | "CREATE"): Record<string, unknown>[] | undefined;
@@ -0,0 +1,34 @@
1
+ function serializeBlock(block, displayType) {
2
+ switch (block.kind) {
3
+ case "field":
4
+ return { fieldId: block.field, properties: { type: "FIELD", displayType } };
5
+ case "group":
6
+ return {
7
+ children: block.blocks.map((b) => serializeBlock(b, displayType)),
8
+ properties: {
9
+ type: "GROUP",
10
+ displayType,
11
+ name: block.name,
12
+ ...(block.color !== undefined ? { color: block.color } : {}),
13
+ ...(block.icon !== undefined ? { icon: block.icon } : {}),
14
+ ...(block.maxColumns !== undefined ? { maxColumns: block.maxColumns } : {}),
15
+ },
16
+ };
17
+ case "widget":
18
+ return { properties: { type: "WIDGET", displayType, widgetId: block.widgetId } };
19
+ case "comments":
20
+ return {
21
+ properties: {
22
+ type: "COMMENTS",
23
+ displayType,
24
+ ...(block.channels !== undefined ? { channels: block.channels } : {}),
25
+ },
26
+ };
27
+ }
28
+ }
29
+ /** Serialize a display-block list for one surface; `undefined`/empty → omitted. */
30
+ export function serializeDisplayBlocks(blocks, displayType) {
31
+ if (blocks === undefined || blocks.length === 0)
32
+ return undefined;
33
+ return blocks.map((b) => serializeBlock(b, displayType));
34
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * App extraction (M2, plan §4.3): `appFromTf` turns the `elementum_app`
3
+ * block + its field resources (delegated to `entities/field/from-tf.ts`)
4
+ * into the `NormalizedApp` the kept `printAppV2` consumes. System-field
5
+ * attributes synthesize tagged `NormalizedField` entries (the shape the wire
6
+ * normalize produced), so the printer's `systemFields:` emission works
7
+ * identically for both pull paths. Platform ids come only from the stream's
8
+ * import blocks and stay data-side — they never reach printed source.
9
+ */
10
+ import { type FromTfContext } from "../../engine/pull/context.js";
11
+ import { type TfBlock } from "../../engine/tf/index.js";
12
+ import type { NormalizedApp } from "./deserializer/normalize.js";
13
+ export interface AppFromTfResult {
14
+ readonly app: NormalizedApp;
15
+ /** org.ts `cloudLinks` bag key (the data label's tsLabel image), when the app pins one. */
16
+ readonly cloudLinkHandle?: string;
17
+ }
18
+ export interface AppFromTfViewBlocks {
19
+ readonly layoutBlocks: readonly TfBlock[];
20
+ readonly listViewBlocks: readonly TfBlock[];
21
+ readonly managedViewOrderBlocks: readonly TfBlock[];
22
+ }
23
+ export declare function appFromTf(appBlock: TfBlock, fieldBlocks: readonly TfBlock[], ctx: FromTfContext, viewBlocks?: AppFromTfViewBlocks, accessPolicyBlocks?: readonly TfBlock[]): AppFromTfResult;