@elementumai/edk 0.0.0-oidc-bootstrap → 0.8.0-preview.11

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 (360) hide show
  1. package/README.md +408 -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/factories.d.ts +189 -0
  47. package/dist-sdk/src/catalog/factories.js +202 -0
  48. package/dist-sdk/src/catalog/from-authoring.d.ts +103 -0
  49. package/dist-sdk/src/catalog/from-authoring.js +462 -0
  50. package/dist-sdk/src/catalog/index.d.ts +11 -0
  51. package/dist-sdk/src/catalog/index.js +11 -0
  52. package/dist-sdk/src/catalog/org.d.ts +11 -0
  53. package/dist-sdk/src/catalog/org.js +211 -0
  54. package/dist-sdk/src/catalog/render-helpers.d.ts +35 -0
  55. package/dist-sdk/src/catalog/render-helpers.js +82 -0
  56. package/dist-sdk/src/catalog/render.d.ts +36 -0
  57. package/dist-sdk/src/catalog/render.js +176 -0
  58. package/dist-sdk/src/catalog/token.d.ts +10 -0
  59. package/dist-sdk/src/catalog/token.js +62 -0
  60. package/dist-sdk/src/catalog/types.d.ts +158 -0
  61. package/dist-sdk/src/catalog/types.js +83 -0
  62. package/dist-sdk/src/catalog/write.d.ts +43 -0
  63. package/dist-sdk/src/catalog/write.js +109 -0
  64. package/dist-sdk/src/core/app-to-ui.d.ts +22 -0
  65. package/dist-sdk/src/core/app-to-ui.js +75 -0
  66. package/dist-sdk/src/core/index.d.ts +10 -0
  67. package/dist-sdk/src/core/index.js +9 -0
  68. package/dist-sdk/src/core/system-fields.d.ts +93 -0
  69. package/dist-sdk/src/core/system-fields.js +151 -0
  70. package/dist-sdk/src/core/triggers/on-demand.d.ts +144 -0
  71. package/dist-sdk/src/core/triggers/on-demand.js +112 -0
  72. package/dist-sdk/src/core/types/ai-provider.d.ts +36 -0
  73. package/dist-sdk/src/core/types/ai-provider.js +32 -0
  74. package/dist-sdk/src/core/types/app.d.ts +838 -0
  75. package/dist-sdk/src/core/types/app.js +210 -0
  76. package/dist-sdk/src/core/types/aspect-category.d.ts +35 -0
  77. package/dist-sdk/src/core/types/aspect-category.js +33 -0
  78. package/dist-sdk/src/core/types/cloud-link.d.ts +34 -0
  79. package/dist-sdk/src/core/types/cloud-link.js +32 -0
  80. package/dist-sdk/src/core/types/display-block.d.ts +149 -0
  81. package/dist-sdk/src/core/types/display-block.js +61 -0
  82. package/dist-sdk/src/core/types/group.d.ts +13 -0
  83. package/dist-sdk/src/core/types/group.js +6 -0
  84. package/dist-sdk/src/core/types/platform.d.ts +2 -0
  85. package/dist-sdk/src/core/types/platform.js +1 -0
  86. package/dist-sdk/src/core/types/user.d.ts +20 -0
  87. package/dist-sdk/src/core/types/user.js +8 -0
  88. package/dist-sdk/src/core/wire/ref-serializer.d.ts +45 -0
  89. package/dist-sdk/src/core/wire/ref-serializer.js +89 -0
  90. package/dist-sdk/src/engine/build/context.d.ts +49 -0
  91. package/dist-sdk/src/engine/build/context.js +6 -0
  92. package/dist-sdk/src/engine/entity.d.ts +44 -0
  93. package/dist-sdk/src/engine/entity.js +15 -0
  94. package/dist-sdk/src/engine/pull/context.d.ts +23 -0
  95. package/dist-sdk/src/engine/pull/context.js +44 -0
  96. package/dist-sdk/src/engine/pull/org.d.ts +44 -0
  97. package/dist-sdk/src/engine/pull/org.js +104 -0
  98. package/dist-sdk/src/engine/tf/escape.d.ts +22 -0
  99. package/dist-sdk/src/engine/tf/escape.js +28 -0
  100. package/dist-sdk/src/engine/tf/expr.d.ts +25 -0
  101. package/dist-sdk/src/engine/tf/expr.js +405 -0
  102. package/dist-sdk/src/engine/tf/index.d.ts +12 -0
  103. package/dist-sdk/src/engine/tf/index.js +11 -0
  104. package/dist-sdk/src/engine/tf/labels.d.ts +31 -0
  105. package/dist-sdk/src/engine/tf/labels.js +125 -0
  106. package/dist-sdk/src/engine/tf/model.d.ts +84 -0
  107. package/dist-sdk/src/engine/tf/model.js +49 -0
  108. package/dist-sdk/src/engine/tf/parse.d.ts +41 -0
  109. package/dist-sdk/src/engine/tf/parse.js +189 -0
  110. package/dist-sdk/src/engine/tf/render.d.ts +13 -0
  111. package/dist-sdk/src/engine/tf/render.js +102 -0
  112. package/dist-sdk/src/engine/workspace/authoring-layout.d.ts +43 -0
  113. package/dist-sdk/src/engine/workspace/authoring-layout.js +201 -0
  114. package/dist-sdk/src/entities/agent/build.d.ts +108 -0
  115. package/dist-sdk/src/entities/agent/build.js +148 -0
  116. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +18 -0
  117. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +177 -0
  118. package/dist-sdk/src/entities/agent/from-tf.d.ts +50 -0
  119. package/dist-sdk/src/entities/agent/from-tf.js +169 -0
  120. package/dist-sdk/src/entities/agent/index.d.ts +7 -0
  121. package/dist-sdk/src/entities/agent/index.js +7 -0
  122. package/dist-sdk/src/entities/agent/module.d.ts +4 -0
  123. package/dist-sdk/src/entities/agent/module.js +116 -0
  124. package/dist-sdk/src/entities/agent/to-tf.d.ts +33 -0
  125. package/dist-sdk/src/entities/agent/to-tf.js +136 -0
  126. package/dist-sdk/src/entities/agent/tools.d.ts +205 -0
  127. package/dist-sdk/src/entities/agent/tools.js +199 -0
  128. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +63 -0
  129. package/dist-sdk/src/entities/agent-tool/from-tf.js +169 -0
  130. package/dist-sdk/src/entities/agent-tool/module.d.ts +3 -0
  131. package/dist-sdk/src/entities/agent-tool/module.js +32 -0
  132. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +38 -0
  133. package/dist-sdk/src/entities/agent-tool/to-tf.js +164 -0
  134. package/dist-sdk/src/entities/agent-tool/types.d.ts +42 -0
  135. package/dist-sdk/src/entities/agent-tool/types.js +70 -0
  136. package/dist-sdk/src/entities/app/build.d.ts +318 -0
  137. package/dist-sdk/src/entities/app/build.js +325 -0
  138. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +165 -0
  139. package/dist-sdk/src/entities/app/deserializer/normalize.js +12 -0
  140. package/dist-sdk/src/entities/app/display-blocks.d.ts +26 -0
  141. package/dist-sdk/src/entities/app/display-blocks.js +34 -0
  142. package/dist-sdk/src/entities/app/from-tf.d.ts +23 -0
  143. package/dist-sdk/src/entities/app/from-tf.js +180 -0
  144. package/dist-sdk/src/entities/app/index.d.ts +11 -0
  145. package/dist-sdk/src/entities/app/index.js +10 -0
  146. package/dist-sdk/src/entities/app/locals.d.ts +11 -0
  147. package/dist-sdk/src/entities/app/locals.js +31 -0
  148. package/dist-sdk/src/entities/app/module.d.ts +4 -0
  149. package/dist-sdk/src/entities/app/module.js +59 -0
  150. package/dist-sdk/src/entities/app/to-tf.d.ts +28 -0
  151. package/dist-sdk/src/entities/app/to-tf.js +183 -0
  152. package/dist-sdk/src/entities/approval-chain/build.d.ts +24 -0
  153. package/dist-sdk/src/entities/approval-chain/build.js +56 -0
  154. package/dist-sdk/src/entities/approval-chain/index.d.ts +6 -0
  155. package/dist-sdk/src/entities/approval-chain/index.js +6 -0
  156. package/dist-sdk/src/entities/approval-chain/steps.d.ts +24 -0
  157. package/dist-sdk/src/entities/approval-chain/steps.js +20 -0
  158. package/dist-sdk/src/entities/automation/build.d.ts +215 -0
  159. package/dist-sdk/src/entities/automation/build.js +424 -0
  160. package/dist-sdk/src/entities/automation/catalog-render.d.ts +5 -0
  161. package/dist-sdk/src/entities/automation/catalog-render.js +35 -0
  162. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +135 -0
  163. package/dist-sdk/src/entities/automation/deserializer/ast.js +13 -0
  164. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +40 -0
  165. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +1040 -0
  166. package/dist-sdk/src/entities/automation/filter.d.ts +81 -0
  167. package/dist-sdk/src/entities/automation/filter.js +146 -0
  168. package/dist-sdk/src/entities/automation/from-tf.d.ts +36 -0
  169. package/dist-sdk/src/entities/automation/from-tf.js +252 -0
  170. package/dist-sdk/src/entities/automation/index.d.ts +18 -0
  171. package/dist-sdk/src/entities/automation/index.js +21 -0
  172. package/dist-sdk/src/entities/automation/module.d.ts +3 -0
  173. package/dist-sdk/src/entities/automation/module.js +153 -0
  174. package/dist-sdk/src/entities/automation/operators.d.ts +66 -0
  175. package/dist-sdk/src/entities/automation/operators.js +43 -0
  176. package/dist-sdk/src/entities/automation/script-code.d.ts +62 -0
  177. package/dist-sdk/src/entities/automation/script-code.js +366 -0
  178. package/dist-sdk/src/entities/automation/serialize.d.ts +6 -0
  179. package/dist-sdk/src/entities/automation/serialize.js +41 -0
  180. package/dist-sdk/src/entities/automation/tasks.d.ts +535 -0
  181. package/dist-sdk/src/entities/automation/tasks.js +697 -0
  182. package/dist-sdk/src/entities/automation/to-tf.d.ts +38 -0
  183. package/dist-sdk/src/entities/automation/to-tf.js +266 -0
  184. package/dist-sdk/src/entities/automation/triggers.d.ts +197 -0
  185. package/dist-sdk/src/entities/automation/triggers.js +202 -0
  186. package/dist-sdk/src/entities/automation/types.d.ts +53 -0
  187. package/dist-sdk/src/entities/automation/types.js +101 -0
  188. package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +76 -0
  189. package/dist-sdk/src/entities/automation/value-ref-tf.js +190 -0
  190. package/dist-sdk/src/entities/element/build.d.ts +108 -0
  191. package/dist-sdk/src/entities/element/build.js +109 -0
  192. package/dist-sdk/src/entities/element/from-tf.d.ts +19 -0
  193. package/dist-sdk/src/entities/element/from-tf.js +155 -0
  194. package/dist-sdk/src/entities/element/index.d.ts +9 -0
  195. package/dist-sdk/src/entities/element/index.js +9 -0
  196. package/dist-sdk/src/entities/element/locals.d.ts +7 -0
  197. package/dist-sdk/src/entities/element/locals.js +12 -0
  198. package/dist-sdk/src/entities/element/module.d.ts +8 -0
  199. package/dist-sdk/src/entities/element/module.js +63 -0
  200. package/dist-sdk/src/entities/element/to-tf.d.ts +14 -0
  201. package/dist-sdk/src/entities/element/to-tf.js +151 -0
  202. package/dist-sdk/src/entities/field/build.d.ts +69 -0
  203. package/dist-sdk/src/entities/field/build.js +74 -0
  204. package/dist-sdk/src/entities/field/calc/aggregate.d.ts +60 -0
  205. package/dist-sdk/src/entities/field/calc/aggregate.js +71 -0
  206. package/dist-sdk/src/entities/field/calc/date.d.ts +73 -0
  207. package/dist-sdk/src/entities/field/calc/date.js +109 -0
  208. package/dist-sdk/src/entities/field/calc/index.d.ts +229 -0
  209. package/dist-sdk/src/entities/field/calc/index.js +433 -0
  210. package/dist-sdk/src/entities/field/calc/numeric.d.ts +22 -0
  211. package/dist-sdk/src/entities/field/calc/numeric.js +67 -0
  212. package/dist-sdk/src/entities/field/calc/runtime.d.ts +61 -0
  213. package/dist-sdk/src/entities/field/calc/runtime.js +170 -0
  214. package/dist-sdk/src/entities/field/calc/text.d.ts +100 -0
  215. package/dist-sdk/src/entities/field/calc/text.js +208 -0
  216. package/dist-sdk/src/entities/field/calc/types.d.ts +86 -0
  217. package/dist-sdk/src/entities/field/calc/types.js +23 -0
  218. package/dist-sdk/src/entities/field/calc.d.ts +108 -0
  219. package/dist-sdk/src/entities/field/calc.js +54 -0
  220. package/dist-sdk/src/entities/field/from-tf.d.ts +29 -0
  221. package/dist-sdk/src/entities/field/from-tf.js +73 -0
  222. package/dist-sdk/src/entities/field/locals.d.ts +8 -0
  223. package/dist-sdk/src/entities/field/locals.js +24 -0
  224. package/dist-sdk/src/entities/field/module.d.ts +3 -0
  225. package/dist-sdk/src/entities/field/module.js +49 -0
  226. package/dist-sdk/src/entities/field/options.d.ts +27 -0
  227. package/dist-sdk/src/entities/field/options.js +76 -0
  228. package/dist-sdk/src/entities/field/record-shape.d.ts +57 -0
  229. package/dist-sdk/src/entities/field/record-shape.js +1 -0
  230. package/dist-sdk/src/entities/field/to-tf.d.ts +55 -0
  231. package/dist-sdk/src/entities/field/to-tf.js +97 -0
  232. package/dist-sdk/src/entities/field/types.d.ts +27 -0
  233. package/dist-sdk/src/entities/field/types.js +46 -0
  234. package/dist-sdk/src/entities/file-reader/build.d.ts +124 -0
  235. package/dist-sdk/src/entities/file-reader/build.js +105 -0
  236. package/dist-sdk/src/entities/file-reader/index.d.ts +5 -0
  237. package/dist-sdk/src/entities/file-reader/index.js +5 -0
  238. package/dist-sdk/src/entities/flow/activities/agent.d.ts +15 -0
  239. package/dist-sdk/src/entities/flow/activities/agent.js +29 -0
  240. package/dist-sdk/src/entities/flow/activities/approval.d.ts +9 -0
  241. package/dist-sdk/src/entities/flow/activities/approval.js +18 -0
  242. package/dist-sdk/src/entities/flow/activities/automation.d.ts +12 -0
  243. package/dist-sdk/src/entities/flow/activities/automation.js +22 -0
  244. package/dist-sdk/src/entities/flow/activities/ctx.d.ts +34 -0
  245. package/dist-sdk/src/entities/flow/activities/ctx.js +38 -0
  246. package/dist-sdk/src/entities/flow/activities/form.d.ts +22 -0
  247. package/dist-sdk/src/entities/flow/activities/form.js +36 -0
  248. package/dist-sdk/src/entities/flow/activities/index.d.ts +14 -0
  249. package/dist-sdk/src/entities/flow/activities/index.js +13 -0
  250. package/dist-sdk/src/entities/flow/activities/input-refs.d.ts +39 -0
  251. package/dist-sdk/src/entities/flow/activities/input-refs.js +19 -0
  252. package/dist-sdk/src/entities/flow/activities/prompt-template.d.ts +13 -0
  253. package/dist-sdk/src/entities/flow/activities/prompt-template.js +34 -0
  254. package/dist-sdk/src/entities/flow/activities/render-catalog.d.ts +140 -0
  255. package/dist-sdk/src/entities/flow/activities/render-catalog.js +174 -0
  256. package/dist-sdk/src/entities/flow/activities/types.d.ts +33 -0
  257. package/dist-sdk/src/entities/flow/activities/types.js +1 -0
  258. package/dist-sdk/src/entities/flow/build.d.ts +38 -0
  259. package/dist-sdk/src/entities/flow/build.js +115 -0
  260. package/dist-sdk/src/entities/flow/index.d.ts +8 -0
  261. package/dist-sdk/src/entities/flow/index.js +7 -0
  262. package/dist-sdk/src/entities/flow/serialize.d.ts +51 -0
  263. package/dist-sdk/src/entities/flow/serialize.js +94 -0
  264. package/dist-sdk/src/entities/flow/util.d.ts +27 -0
  265. package/dist-sdk/src/entities/flow/util.js +38 -0
  266. package/dist-sdk/src/entities/org/category.d.ts +5 -0
  267. package/dist-sdk/src/entities/org/category.js +33 -0
  268. package/dist-sdk/src/entities/org/cloud-link.d.ts +5 -0
  269. package/dist-sdk/src/entities/org/cloud-link.js +33 -0
  270. package/dist-sdk/src/entities/org/connector.d.ts +5 -0
  271. package/dist-sdk/src/entities/org/connector.js +37 -0
  272. package/dist-sdk/src/entities/org/group.d.ts +5 -0
  273. package/dist-sdk/src/entities/org/group.js +31 -0
  274. package/dist-sdk/src/entities/org/index.d.ts +10 -0
  275. package/dist-sdk/src/entities/org/index.js +10 -0
  276. package/dist-sdk/src/entities/org/role.d.ts +7 -0
  277. package/dist-sdk/src/entities/org/role.js +21 -0
  278. package/dist-sdk/src/entities/org/user.d.ts +7 -0
  279. package/dist-sdk/src/entities/org/user.js +21 -0
  280. package/dist-sdk/src/entities/search-table/build.d.ts +41 -0
  281. package/dist-sdk/src/entities/search-table/build.js +79 -0
  282. package/dist-sdk/src/entities/search-table/index.d.ts +5 -0
  283. package/dist-sdk/src/entities/search-table/index.js +5 -0
  284. package/dist-sdk/src/entities/search-table/module.d.ts +6 -0
  285. package/dist-sdk/src/entities/search-table/module.js +64 -0
  286. package/dist-sdk/src/entities/shared/context.d.ts +93 -0
  287. package/dist-sdk/src/entities/shared/context.js +156 -0
  288. package/dist-sdk/src/entities/shared/filters/ast.d.ts +242 -0
  289. package/dist-sdk/src/entities/shared/filters/ast.js +65 -0
  290. package/dist-sdk/src/entities/shared/filters/index.d.ts +211 -0
  291. package/dist-sdk/src/entities/shared/filters/index.js +372 -0
  292. package/dist-sdk/src/entities/shared/filters/types.d.ts +170 -0
  293. package/dist-sdk/src/entities/shared/filters/types.js +7 -0
  294. package/dist-sdk/src/entities/shared/ref.d.ts +160 -0
  295. package/dist-sdk/src/entities/shared/ref.js +119 -0
  296. package/dist-sdk/src/entities/shared/types/common.d.ts +106 -0
  297. package/dist-sdk/src/entities/shared/types/common.js +64 -0
  298. package/dist-sdk/src/entities/shared/types/field-types.d.ts +49 -0
  299. package/dist-sdk/src/entities/shared/types/field-types.js +48 -0
  300. package/dist-sdk/src/entities/shared/types/platform.d.ts +46 -0
  301. package/dist-sdk/src/entities/shared/types/platform.js +10 -0
  302. package/dist-sdk/src/entities/skill/build.d.ts +25 -0
  303. package/dist-sdk/src/entities/skill/build.js +50 -0
  304. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +20 -0
  305. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +96 -0
  306. package/dist-sdk/src/entities/skill/from-tf.d.ts +33 -0
  307. package/dist-sdk/src/entities/skill/from-tf.js +95 -0
  308. package/dist-sdk/src/entities/skill/index.d.ts +7 -0
  309. package/dist-sdk/src/entities/skill/index.js +7 -0
  310. package/dist-sdk/src/entities/skill/module.d.ts +4 -0
  311. package/dist-sdk/src/entities/skill/module.js +106 -0
  312. package/dist-sdk/src/entities/skill/to-tf.d.ts +33 -0
  313. package/dist-sdk/src/entities/skill/to-tf.js +58 -0
  314. package/dist-sdk/src/entities/skill/tools.d.ts +71 -0
  315. package/dist-sdk/src/entities/skill/tools.js +88 -0
  316. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +47 -0
  317. package/dist-sdk/src/entities/skill-tool/from-tf.js +121 -0
  318. package/dist-sdk/src/entities/skill-tool/module.d.ts +3 -0
  319. package/dist-sdk/src/entities/skill-tool/module.js +21 -0
  320. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +32 -0
  321. package/dist-sdk/src/entities/skill-tool/to-tf.js +107 -0
  322. package/dist-sdk/src/entities/skill-tool/types.d.ts +40 -0
  323. package/dist-sdk/src/entities/skill-tool/types.js +67 -0
  324. package/dist-sdk/src/entities/table/build.d.ts +74 -0
  325. package/dist-sdk/src/entities/table/build.js +339 -0
  326. package/dist-sdk/src/entities/table/catalog-render.d.ts +5 -0
  327. package/dist-sdk/src/entities/table/catalog-render.js +39 -0
  328. package/dist-sdk/src/entities/table/fields.d.ts +81 -0
  329. package/dist-sdk/src/entities/table/fields.js +70 -0
  330. package/dist-sdk/src/entities/table/filter.d.ts +41 -0
  331. package/dist-sdk/src/entities/table/filter.js +89 -0
  332. package/dist-sdk/src/entities/table/index.d.ts +8 -0
  333. package/dist-sdk/src/entities/table/index.js +12 -0
  334. package/dist-sdk/src/entities/table/joins.d.ts +26 -0
  335. package/dist-sdk/src/entities/table/joins.js +31 -0
  336. package/dist-sdk/src/entities/table/keys.d.ts +11 -0
  337. package/dist-sdk/src/entities/table/keys.js +25 -0
  338. package/dist-sdk/src/entities/table/module.d.ts +5 -0
  339. package/dist-sdk/src/entities/table/module.js +25 -0
  340. package/dist-sdk/src/entities/table/state.d.ts +39 -0
  341. package/dist-sdk/src/entities/table/state.js +43 -0
  342. package/dist-sdk/src/entities/view/from-tf.d.ts +25 -0
  343. package/dist-sdk/src/entities/view/from-tf.js +233 -0
  344. package/dist-sdk/src/entities/view/module.d.ts +24 -0
  345. package/dist-sdk/src/entities/view/module.js +61 -0
  346. package/dist-sdk/src/entities/view/to-tf.d.ts +63 -0
  347. package/dist-sdk/src/entities/view/to-tf.js +156 -0
  348. package/dist-sdk/src/entities/view/types.d.ts +58 -0
  349. package/dist-sdk/src/entities/view/types.js +89 -0
  350. package/dist-sdk/src/graph/deferred-catalog-render.d.ts +14 -0
  351. package/dist-sdk/src/graph/deferred-catalog-render.js +37 -0
  352. package/dist-sdk/src/graph/index.d.ts +83 -0
  353. package/dist-sdk/src/graph/index.js +207 -0
  354. package/dist-sdk/src/graph/modules.d.ts +7 -0
  355. package/dist-sdk/src/graph/modules.js +37 -0
  356. package/dist-sdk/src/graph/types.d.ts +301 -0
  357. package/dist-sdk/src/graph/types.js +102 -0
  358. package/dist-sdk/src/internal/sdk-package.d.ts +7 -0
  359. package/dist-sdk/src/internal/sdk-package.js +23 -0
  360. package/package.json +173 -8
@@ -0,0 +1,204 @@
1
+ /**
2
+ * Shared wire-shape and identifier helpers used by anything that
3
+ * translates wire data into EDK TypeScript source — both the
4
+ * `defineX.fromJSON` deserializer pipeline and the
5
+ * `fetch-app-definition` renderer that emits standalone
6
+ * `defineApp({...})` files.
7
+ *
8
+ * Helpers that turn out to be useful across more than one of those
9
+ * paths live here so we have a single implementation of each
10
+ * convention (camelCase identifier shape, dedup-with-suffix rule, …)
11
+ * instead of duplicating them per-module and quietly drifting.
12
+ */
13
+ /**
14
+ * Returns a shallow copy of the input object with the `type` key
15
+ * removed. Idempotent — no-op if `type` isn't present. Returns `{}`
16
+ * for `undefined` so callers can chain without null checks.
17
+ *
18
+ * **Why this exists.** Wire shapes carry the task / trigger
19
+ * discriminator inline as `properties.type` (SCREAMING_SNAKE):
20
+ *
21
+ * ```
22
+ * properties: { type: "RECORD_SEARCH", aspectId: "...", filter: {...} }
23
+ * ```
24
+ *
25
+ * The deserializer's serializer-input shape carries the
26
+ * discriminator as the *wrapping key* (camelCase) instead:
27
+ *
28
+ * ```
29
+ * { recordSearch: { aspectId: "...", filter: {...} } }
30
+ * ```
31
+ *
32
+ * So normalize wraps via `{ [camelKey]: stripType(props) }` — the
33
+ * wrapping key is the new discriminator, and the previously-inline
34
+ * `type` becomes redundant. Carrying both could confuse downstream
35
+ * code switching on either form, so we drop it.
36
+ */
37
+ export function stripType(props) {
38
+ if (!props)
39
+ return {};
40
+ const { type: _type, ...rest } = props;
41
+ void _type;
42
+ return rest;
43
+ }
44
+ /**
45
+ * Convert a human-readable label into a camelCase JS identifier:
46
+ * `"P1 Critical"` → `"p1Critical"`, `"App Version"` → `"appVersion"`,
47
+ * `"first NAME"` → `"firstName"`. Strips non-alphanumeric characters,
48
+ * collapses runs of separators, lowercases the leading character of
49
+ * the first part and Pascal-cases the rest.
50
+ *
51
+ * Returns `""` for inputs that contain no alphanumerics — callers
52
+ * decide what fallback to use (e.g. `"item1"`).
53
+ */
54
+ export function camelCase(input) {
55
+ // Wire data occasionally hands us an absent name (e.g. a search-table summary
56
+ // with no `name`) even though the type says `string`. Degrade to "" so the
57
+ // callers' `camelCase(x) || fallback` picks up rather than throwing on
58
+ // `undefined.replace`.
59
+ if (!input)
60
+ return "";
61
+ const parts = input
62
+ .replace(/[^A-Za-z0-9]+/g, " ")
63
+ .trim()
64
+ .split(/\s+/);
65
+ if (parts.length === 0 || parts[0] === "")
66
+ return "";
67
+ const [head, ...rest] = parts;
68
+ const headLower = head.charAt(0).toLowerCase() + head.slice(1);
69
+ const restCapped = rest.map((p) => p.charAt(0).toUpperCase() + p.slice(1).toLowerCase());
70
+ return [headLower, ...restCapped].join("");
71
+ }
72
+ /**
73
+ * Mobius's `ValueReference.ofTriggerReference` canonicalizes onDemand
74
+ * parameter reference names so the UI picker can resolve them:
75
+ * - all alphanumeric → first char lowercased (`amountUsd` stays
76
+ * `amountUsd`, `AmountUsd` → `amountUsd`)
77
+ * - contains non-alnum char → camelCase via {@link camelCase}
78
+ * (`amount_usd` → `amountUsd`,
79
+ * `has receipt` → `hasReceipt`)
80
+ *
81
+ * Lives here (not in the serializer) because both sides of the wire
82
+ * need it: the serializer applies it on-write so saved triggerReference
83
+ * names match the picker's canonical form, and the deserializer
84
+ * applies it on-read to map wire reference names back to the source's
85
+ * declared parameter names.
86
+ */
87
+ export function normalizeOnDemandParamKey(name) {
88
+ if (!name)
89
+ return "";
90
+ if (/[^A-Za-z0-9]/.test(name)) {
91
+ return camelCase(name);
92
+ }
93
+ return name.charAt(0).toLowerCase() + name.substring(1);
94
+ }
95
+ /**
96
+ * Pair each item with a unique camelCase key derived from
97
+ * `nameOf(item)`. Collisions are disambiguated with numeric suffixes
98
+ * (`foo`, `foo2`, `foo3`, …) so an emitted object literal never has
99
+ * duplicate keys. Source order is preserved.
100
+ *
101
+ * `fallbackPrefix` is used when an item's name camelCases to `""`
102
+ * (e.g. all-punctuation names) — callers pass `"field"` /
103
+ * `"automation"` / etc. so the fallback is self-documenting.
104
+ *
105
+ * Used by both the deserializer's catalog (`pull/catalog.ts`) and the
106
+ * fetch-app-definition renderer (`src/scripts/fetch-app-definition.ts`)
107
+ * so a fetched app file and a pulled entity file disambiguate the
108
+ * same way for the same input.
109
+ */
110
+ export function withUniqueKeys(items, nameOf, fallbackPrefix = "item", handleOf) {
111
+ const used = new Set();
112
+ const out = [];
113
+ for (const item of items) {
114
+ // Prefer a server-assigned handle (`clientHandle`) when present: it's
115
+ // stable, globally unique, and already a valid identifier, so it's used
116
+ // verbatim (no camelCase). Fall back to the name-derived key + dedupe
117
+ // when absent — the rollout window where antman hasn't stamped a handle.
118
+ const serverHandle = handleOf?.(item);
119
+ const base = serverHandle != null && serverHandle !== ""
120
+ ? serverHandle
121
+ : camelCase(nameOf(item)) || `${fallbackPrefix}${out.length + 1}`;
122
+ let key = base;
123
+ let i = 2;
124
+ while (used.has(key))
125
+ key = `${base}${i++}`;
126
+ used.add(key);
127
+ out.push({ key, item });
128
+ }
129
+ return out;
130
+ }
131
+ /**
132
+ * Build the JS identifier used as both the exported variable name
133
+ * and the import binding for an app's generated `.ts` file. The
134
+ * generated file is consumed by other generated files that
135
+ * `import { agentToolPlaygroundApp } from "../apps/agent-tool-playground.js"`,
136
+ * so the binding must be a valid JS identifier.
137
+ *
138
+ * camelCases the app name and appends `App` (idempotently). Two apps
139
+ * whose names happen to camel-case to the same identifier can still
140
+ * be disambiguated downstream by the catalog's per-handle pass.
141
+ */
142
+ export function handleFromName(name) {
143
+ const base = camelCase(name) || "app";
144
+ return base.endsWith("App") ? base : `${base}App`;
145
+ }
146
+ /**
147
+ * Quote a value as a TypeScript string literal — uses
148
+ * `JSON.stringify` so all whitespace, control characters, and
149
+ * non-ASCII code points are escaped to valid TS source. Naming an
150
+ * obvious case to remember why this matters: a field name with an
151
+ * embedded newline would render as an unescaped literal newline
152
+ * inside the emitted `"..."` and break parsing.
153
+ */
154
+ export function quote(s) {
155
+ return JSON.stringify(s);
156
+ }
157
+ /**
158
+ * Unwrap a GraphQL `Connection<T>` into a flat readonly array of
159
+ * nodes. Accepts `null | undefined` so callers don't have to
160
+ * distinguish "field not requested" (undefined) from "field
161
+ * explicitly null" (null) — both yield an empty list.
162
+ */
163
+ export function unwrapConnection(conn) {
164
+ return conn?.edges?.map((e) => e.node) ?? [];
165
+ }
166
+ /**
167
+ * RFC 4122 UUID test. Used by both write- and read-side code:
168
+ *
169
+ * - `aspects/serializer/field-serializers.ts` strips non-UUID
170
+ * author ids (placeholders like `"f-1"`) so ultron mints one
171
+ * server-side — Java's `UUID`-typed `AbstractAspectFieldInput.id`
172
+ * would otherwise reject the body with a generic Jackson 400.
173
+ * - `aspects/serializer/index.ts` (no-delete picklist guard) and
174
+ * `normalizePicklistValueIds` drop non-UUID `id` slots on
175
+ * picklist values for the same reason.
176
+ * - `aspects/index.ts` routes `defineApp({...}).deploy()` to PUT
177
+ * when `app.id` is a real aspect UUID (existing aspect, update
178
+ * path) and POST when it's a placeholder (new aspect, create
179
+ * path). Pulled sources from `defineApp.fromJSON` always carry
180
+ * a real UUID, so the round-trip naturally goes through update.
181
+ *
182
+ * Lives in `pull/util.ts` next to the other shared identifier helpers
183
+ * (`camelCase`, `handleFromName`, `quote`) since it serves both the
184
+ * pull/print pipeline and the serializer/deploy pipeline — a single
185
+ * source of truth for the regex.
186
+ */
187
+ const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
188
+ export function isUuid(value) {
189
+ return UUID_PATTERN.test(value);
190
+ }
191
+ /**
192
+ * Format a stage's identity slots as a TypeScript object literal —
193
+ * `{ id, name, color?, icon? }`. `color`/`icon` are omitted when null,
194
+ * undefined, or empty so the catalog (wire-shape) and round-trip
195
+ * (normalized) printers agree on the emitted source.
196
+ */
197
+ export function formatStageBody(stage) {
198
+ const parts = [`id: ${quote(stage.id)}`, `name: ${quote(stage.name)}`];
199
+ if (stage.color != null && stage.color !== "")
200
+ parts.push(`color: ${quote(stage.color)}`);
201
+ if (stage.icon != null && stage.icon !== "")
202
+ parts.push(`icon: ${quote(stage.icon)}`);
203
+ return `{ ${parts.join(", ")} }`;
204
+ }
@@ -0,0 +1,189 @@
1
+ /**
2
+ * Typed factory functions for every catalog ref kind.
3
+ *
4
+ * Each function accepts all fields except `__kind` and `handle`, so generated
5
+ * and authored code never contains a raw `__kind` string literal — and, for
6
+ * every kind here, never an identity property either. `resolveRef`
7
+ * (`src/deploy/resolve/resolve.ts`) and `resolvePayload` read `.handle`
8
+ * directly off an embedded ref with no other context available once it's been
9
+ * destructured out of its parent bag, so that property has to keep existing
10
+ * on the *returned* `CatalogRef` — but inside a catalog file, every ref is
11
+ * constructed as a bag entry (`agents: { agent11: agentRef() }`), and the
12
+ * bag's own object-literal key *is* the ref name. `appCatalog`/`elementCatalog`/
13
+ * `orgCatalog` read that key, stamp it onto `.handle`, and also inject `parent`
14
+ * from the catalog root's own identity — so no factory call for automations or
15
+ * agents needs to restate either property.
16
+ *
17
+ * Each factory still sets `.handle`/`.name` to something internally purely so
18
+ * the object satisfies `CatalogRef`'s structural shape before bag-level stamping;
19
+ * nothing reads those interim values.
20
+ */
21
+ import type { AgentRef, ApprovalChainRef, AutomationCatalogRef, CatalogRef, CategoryRef, CloudLinkRef, ConnectorRef, GroupRef, FileReaderCatalogRef, DocumentModelFieldRef, FieldRef, FlowRef, OutputPropertyRef, SearchTableRef, SkillRef, TableColumnRef, TableRef, TriggerParameterRef } from "./types.js";
22
+ /** An app/element catalog's bags: reference-only kinds plus behavioral kinds sourced from authoring files. */
23
+ interface AppCatalogBags {
24
+ readonly fields?: Record<string, FieldRef>;
25
+ readonly searchTables?: Record<string, SearchTableRef>;
26
+ readonly fileReaders?: Record<string, FileReaderCatalogRef>;
27
+ readonly automations?: Record<string, AutomationCatalogRef>;
28
+ readonly agents?: Record<string, AgentRef>;
29
+ readonly skills?: Record<string, SkillRef>;
30
+ }
31
+ /**
32
+ * Automation ref. Accepts optional `trigger` and `outputs` bags of typed parameter/property refs —
33
+ * e.g. `automationRef({ trigger: { topic: triggerParameterRef({ name: "topic", parent: "auto" }) } })`
34
+ * gives `catalog.app.automations.auto.trigger.topic` as a typed `TriggerParameterRef` usable in
35
+ * `executeWorkflow` inputs. `handle` and `parent` are injected by the enclosing `appCatalog`/
36
+ * `elementCatalog`; factory calls need not supply them.
37
+ *
38
+ * Generic parameters `T`/`O` preserve specific key shapes on the returned ref so TypeScript can
39
+ * narrow `.trigger.<name>` and `.outputs.<name>` at the call site.
40
+ */
41
+ export declare function automationRef<T extends Readonly<Record<string, TriggerParameterRef>> | undefined = undefined, O extends Readonly<Record<string, OutputPropertyRef>> | undefined = undefined>(opts?: {
42
+ readonly trigger?: T;
43
+ readonly outputs?: O;
44
+ }): AutomationCatalogRef & {
45
+ readonly trigger: T;
46
+ readonly outputs: O;
47
+ };
48
+ /**
49
+ * Build a trigger parameter ref — keyed by parameter name; `parent` is the
50
+ * owning automation's refName. `const T` (not plain `T`) so `required: true`
51
+ * infers as the LITERAL — that literal is what `agentRunAutomation`'s mapped
52
+ * input types key off (same trick as {@link fieldRef}'s `fieldType`).
53
+ */
54
+ export declare const triggerParameterRef: <const T extends {
55
+ readonly name: string;
56
+ readonly parent: string;
57
+ readonly required?: true;
58
+ }>(opts: T) => T & {
59
+ readonly __kind: "triggerParameter";
60
+ readonly refName: string;
61
+ };
62
+ /**
63
+ * Document model ref. Accepts an optional `fields` bag of typed field refs —
64
+ * mirrors {@link automationRef}'s `trigger`/`outputs` bags. `handle` and
65
+ * `parent` are injected by the enclosing `appCatalog`/`elementCatalog`;
66
+ * factory calls need no `parent` argument.
67
+ */
68
+ export declare function documentModelRef<F extends Readonly<Record<string, DocumentModelFieldRef>> | undefined = undefined>(opts: {
69
+ readonly name: string;
70
+ readonly parent?: string;
71
+ readonly fields?: F;
72
+ }): FileReaderCatalogRef & {
73
+ readonly fields: F;
74
+ };
75
+ /** Build a document model field ref — keyed by field name; `parent` is the owning document model's refName. */
76
+ export declare function documentModelFieldRef(opts: {
77
+ readonly name: string;
78
+ readonly parent: string;
79
+ }): DocumentModelFieldRef;
80
+ /** Build an output property ref — keyed by property name; `parent` is the owning automation's refName. */
81
+ export declare function outputPropertyRef(opts: {
82
+ readonly name: string;
83
+ readonly parent: string;
84
+ }): OutputPropertyRef;
85
+ /**
86
+ * Agent ref — no required arguments. `handle` and `parent` are injected by the enclosing
87
+ * `appCatalog`/`elementCatalog`; `name` defaults to `""`.
88
+ */
89
+ export declare function agentRef(opts?: {
90
+ readonly name?: string;
91
+ readonly parent?: string;
92
+ }): AgentRef;
93
+ /**
94
+ * Skill ref — no required arguments, same shape as {@link agentRef}. `handle` and `parent`
95
+ * are injected by the enclosing `appCatalog`/`elementCatalog`; `name` defaults to `""`.
96
+ */
97
+ export declare function skillRef(opts?: {
98
+ readonly name?: string;
99
+ readonly parent?: string;
100
+ }): SkillRef;
101
+ export declare const flowRef: (opts: Omit<FlowRef, "refName" | "__kind">) => Omit<FlowRef, "refName" | "__kind"> & {
102
+ readonly __kind: "flow";
103
+ readonly refName: string;
104
+ };
105
+ export declare const approvalChainRef: (opts: Omit<ApprovalChainRef, "refName" | "__kind">) => Omit<ApprovalChainRef, "refName" | "__kind"> & {
106
+ readonly __kind: "approvalChain";
107
+ readonly refName: string;
108
+ };
109
+ export declare const searchTableRef: (opts: Omit<SearchTableRef, "refName" | "__kind">) => Omit<SearchTableRef, "refName" | "__kind"> & {
110
+ readonly __kind: "searchTable";
111
+ readonly refName: string;
112
+ };
113
+ export declare const connectorRef: (opts: Omit<ConnectorRef, "refName" | "__kind">) => Omit<ConnectorRef, "refName" | "__kind"> & {
114
+ readonly __kind: "connector";
115
+ readonly refName: string;
116
+ };
117
+ export declare const cloudLinkRef: (opts: Omit<CloudLinkRef, "refName" | "__kind">) => Omit<CloudLinkRef, "refName" | "__kind"> & {
118
+ readonly __kind: "cloudLink";
119
+ readonly refName: string;
120
+ };
121
+ export declare const categoryRef: (opts: Omit<CategoryRef, "refName" | "__kind">) => Omit<CategoryRef, "refName" | "__kind"> & {
122
+ readonly __kind: "category";
123
+ readonly refName: string;
124
+ };
125
+ export declare const groupRef: (opts: Omit<GroupRef, "refName" | "__kind">) => Omit<GroupRef, "refName" | "__kind"> & {
126
+ readonly __kind: "group";
127
+ readonly refName: string;
128
+ };
129
+ export declare function tableColumnRef(opts: Omit<TableColumnRef, "__kind" | "refName" | "parent"> & {
130
+ readonly parent?: string;
131
+ }): TableColumnRef;
132
+ export declare function tableRef(opts: Omit<TableRef, "__kind" | "refName">): TableRef;
133
+ /**
134
+ * `refName` is optional and defaults to `name` — for a caller with no bag-key
135
+ * context (e.g. a cross-aspect field ref where the field belongs to an aspect
136
+ * that isn't being printed in this pass), matching resolution falls back to
137
+ * `name`. A caller that *does* know the field's real bag key (its own app's
138
+ * pull printer, printing a display-block/parentField/calc reference to one of
139
+ * its own fields) should pass it explicitly — that's what lets the reference
140
+ * survive a later `name` rename instead of going stale (#230).
141
+ *
142
+ * `const T` (not plain `T`) so `fieldType: "PICKLIST"` infers as the literal,
143
+ * not widened to `string` — required for `RecordShape` (`entities/field/record-shape.ts`)
144
+ * to discriminate per-field value types from a catalog app's `fields` bag.
145
+ */
146
+ export declare const fieldRef: <const T extends Omit<FieldRef, "__kind" | "refName"> & {
147
+ readonly refName?: string;
148
+ }>(opts: T) => T & {
149
+ readonly __kind: "field";
150
+ readonly refName: string;
151
+ };
152
+ /**
153
+ * Assemble an app catalog object. Injects `__kind: "app"` so the result
154
+ * satisfies `CatalogRef<"app">` (accepted by aspect-ref parameters) without
155
+ * any raw `__kind` string in the call site. `B` is inferred from the bags
156
+ * argument, preserving specific field / search-table key shapes. Every bag
157
+ * entry's `.handle` is stamped from its own key. Automation, agent, skill,
158
+ * and search-table entries also get `.parent` injected from
159
+ * `identity.refName` — their factory calls (`automationRef()`, `agentRef()`,
160
+ * `searchTableRef({ name })`, …) need no `parent` argument.
161
+ */
162
+ export declare function appCatalog<B extends AppCatalogBags>(identity: {
163
+ readonly refName: string;
164
+ readonly name: string;
165
+ }, bags: B): CatalogRef<"app"> & B;
166
+ /** Same as {@link appCatalog}, but for an element catalog root. */
167
+ export declare function elementCatalog<B extends AppCatalogBags>(identity: {
168
+ readonly refName: string;
169
+ readonly name: string;
170
+ }, bags: B): CatalogRef<"element"> & B;
171
+ /**
172
+ * Assemble the org catalog object. Produces `{ handle: "org", name: "Org", ...bags }`.
173
+ * No `__kind` — the org is not a `CatalogRef` kind and is referenced only as
174
+ * a namespace (`org.connectors.X`, `org.cloudLinks.Y`), never passed as a ref.
175
+ * `"org"` is a fixed singleton namespace, not derived from any entity's name —
176
+ * unlike every other identity in this file, it's not a ref name. Bag entries'
177
+ * `.handle` are stamped from their own key, same as `appCatalog`.
178
+ */
179
+ export declare function orgCatalog<B extends {
180
+ connectors?: Record<string, ConnectorRef>;
181
+ cloudLinks?: Record<string, CloudLinkRef>;
182
+ categories?: Record<string, CategoryRef>;
183
+ groups?: Record<string, GroupRef>;
184
+ tables?: Record<string, TableRef>;
185
+ }>(bags: B): {
186
+ readonly handle: "org";
187
+ readonly name: "Org";
188
+ } & B;
189
+ export {};
@@ -0,0 +1,202 @@
1
+ /** Build a ref-kind factory: no identity parameter, `.refName` defaults to `name` (stamped over by the enclosing bag). */
2
+ function refFactory(kind) {
3
+ return (opts) => ({ __kind: kind, refName: opts.name, ...opts });
4
+ }
5
+ /**
6
+ * Automation ref. Accepts optional `trigger` and `outputs` bags of typed parameter/property refs —
7
+ * e.g. `automationRef({ trigger: { topic: triggerParameterRef({ name: "topic", parent: "auto" }) } })`
8
+ * gives `catalog.app.automations.auto.trigger.topic` as a typed `TriggerParameterRef` usable in
9
+ * `executeWorkflow` inputs. `handle` and `parent` are injected by the enclosing `appCatalog`/
10
+ * `elementCatalog`; factory calls need not supply them.
11
+ *
12
+ * Generic parameters `T`/`O` preserve specific key shapes on the returned ref so TypeScript can
13
+ * narrow `.trigger.<name>` and `.outputs.<name>` at the call site.
14
+ */
15
+ export function automationRef(opts) {
16
+ return {
17
+ __kind: "automation",
18
+ refName: "",
19
+ name: "",
20
+ ...(opts?.trigger !== undefined ? { trigger: opts.trigger } : {}),
21
+ ...(opts?.outputs !== undefined ? { outputs: opts.outputs } : {}),
22
+ };
23
+ }
24
+ /**
25
+ * Build a trigger parameter ref — keyed by parameter name; `parent` is the
26
+ * owning automation's refName. `const T` (not plain `T`) so `required: true`
27
+ * infers as the LITERAL — that literal is what `agentRunAutomation`'s mapped
28
+ * input types key off (same trick as {@link fieldRef}'s `fieldType`).
29
+ */
30
+ export const triggerParameterRef = (opts) => ({ __kind: "triggerParameter", refName: opts.name, ...opts });
31
+ /**
32
+ * Document model ref. Accepts an optional `fields` bag of typed field refs —
33
+ * mirrors {@link automationRef}'s `trigger`/`outputs` bags. `handle` and
34
+ * `parent` are injected by the enclosing `appCatalog`/`elementCatalog`;
35
+ * factory calls need no `parent` argument.
36
+ */
37
+ export function documentModelRef(opts) {
38
+ return {
39
+ __kind: "documentModel",
40
+ refName: opts.name,
41
+ name: opts.name,
42
+ ...(opts.parent !== undefined ? { parent: opts.parent } : {}),
43
+ ...(opts.fields !== undefined ? { fields: opts.fields } : {}),
44
+ };
45
+ }
46
+ /** Build a document model field ref — keyed by field name; `parent` is the owning document model's refName. */
47
+ export function documentModelFieldRef(opts) {
48
+ return { __kind: "documentModelField", refName: opts.name, name: opts.name, parent: opts.parent };
49
+ }
50
+ /** Build an output property ref — keyed by property name; `parent` is the owning automation's refName. */
51
+ export function outputPropertyRef(opts) {
52
+ return { __kind: "outputProperty", refName: opts.name, name: opts.name, parent: opts.parent };
53
+ }
54
+ /**
55
+ * Agent ref — no required arguments. `handle` and `parent` are injected by the enclosing
56
+ * `appCatalog`/`elementCatalog`; `name` defaults to `""`.
57
+ */
58
+ export function agentRef(opts) {
59
+ return { __kind: "agent", refName: "", name: opts?.name ?? "", ...(opts?.parent !== undefined ? { parent: opts.parent } : {}) };
60
+ }
61
+ /**
62
+ * Skill ref — no required arguments, same shape as {@link agentRef}. `handle` and `parent`
63
+ * are injected by the enclosing `appCatalog`/`elementCatalog`; `name` defaults to `""`.
64
+ */
65
+ export function skillRef(opts) {
66
+ return { __kind: "skill", refName: "", name: opts?.name ?? "", ...(opts?.parent !== undefined ? { parent: opts.parent } : {}) };
67
+ }
68
+ export const flowRef = refFactory("flow");
69
+ export const approvalChainRef = refFactory("approvalChain");
70
+ export const searchTableRef = refFactory("searchTable");
71
+ export const connectorRef = refFactory("connector");
72
+ export const cloudLinkRef = refFactory("cloudLink");
73
+ export const categoryRef = refFactory("category");
74
+ export const groupRef = refFactory("group");
75
+ export function tableColumnRef(opts) {
76
+ return {
77
+ __kind: "tableColumn",
78
+ refName: opts.name,
79
+ parent: opts.parent ?? "",
80
+ name: opts.name,
81
+ ...(opts.fieldType !== undefined ? { fieldType: opts.fieldType } : {}),
82
+ ...(opts.tags !== undefined ? { tags: opts.tags } : {}),
83
+ };
84
+ }
85
+ export function tableRef(opts) {
86
+ return {
87
+ __kind: "table",
88
+ refName: opts.name,
89
+ name: opts.name,
90
+ ...(opts.columns !== undefined ? { columns: opts.columns } : {}),
91
+ ...(opts.categoryId !== undefined ? { categoryId: opts.categoryId } : {}),
92
+ };
93
+ }
94
+ /**
95
+ * `refName` is optional and defaults to `name` — for a caller with no bag-key
96
+ * context (e.g. a cross-aspect field ref where the field belongs to an aspect
97
+ * that isn't being printed in this pass), matching resolution falls back to
98
+ * `name`. A caller that *does* know the field's real bag key (its own app's
99
+ * pull printer, printing a display-block/parentField/calc reference to one of
100
+ * its own fields) should pass it explicitly — that's what lets the reference
101
+ * survive a later `name` rename instead of going stale (#230).
102
+ *
103
+ * `const T` (not plain `T`) so `fieldType: "PICKLIST"` infers as the literal,
104
+ * not widened to `string` — required for `RecordShape` (`entities/field/record-shape.ts`)
105
+ * to discriminate per-field value types from a catalog app's `fields` bag.
106
+ */
107
+ export const fieldRef = (opts) => ({ __kind: "field", ...opts, refName: opts.refName ?? opts.name });
108
+ /**
109
+ * Stamp each bag entry's `.handle` to match its own object key — the one place a ref name is
110
+ * actually carried. For field/automation/agent/skill/searchTable bags `injectParent` is the
111
+ * catalog root's refName, which is injected as `.parent` so factory calls for those kinds need
112
+ * no `parent` argument. A field's (or search table's) `.parent` identifies which aspect's state
113
+ * a resolver should look it up against — it's unrelated to the aspect's own
114
+ * parent-in-the-org-hierarchy (always "org" for apps/elements).
115
+ */
116
+ function withOwnKeyAsHandle(bag, injectParent) {
117
+ if (bag === undefined)
118
+ return undefined;
119
+ const out = {};
120
+ for (const [refName, ref] of Object.entries(bag)) {
121
+ out[refName] = { ...ref, refName: refName, ...(injectParent !== undefined ? { parent: injectParent } : {}) };
122
+ }
123
+ return out;
124
+ }
125
+ function stampTableRefs(bag) {
126
+ if (bag === undefined)
127
+ return undefined;
128
+ const out = {};
129
+ for (const [tableRefName, ref] of Object.entries(bag)) {
130
+ const columns = ref.columns === undefined
131
+ ? undefined
132
+ : Object.fromEntries(Object.entries(ref.columns).map(([columnRefName, column]) => [
133
+ columnRefName,
134
+ { ...column, refName: columnRefName, parent: tableRefName },
135
+ ]));
136
+ out[tableRefName] = {
137
+ ...ref,
138
+ refName: tableRefName,
139
+ ...(columns !== undefined ? { columns } : {}),
140
+ };
141
+ }
142
+ return out;
143
+ }
144
+ /**
145
+ * Assemble an app catalog object. Injects `__kind: "app"` so the result
146
+ * satisfies `CatalogRef<"app">` (accepted by aspect-ref parameters) without
147
+ * any raw `__kind` string in the call site. `B` is inferred from the bags
148
+ * argument, preserving specific field / search-table key shapes. Every bag
149
+ * entry's `.handle` is stamped from its own key. Automation, agent, skill,
150
+ * and search-table entries also get `.parent` injected from
151
+ * `identity.refName` — their factory calls (`automationRef()`, `agentRef()`,
152
+ * `searchTableRef({ name })`, …) need no `parent` argument.
153
+ */
154
+ export function appCatalog(identity, bags) {
155
+ return {
156
+ __kind: "app",
157
+ refName: identity.refName,
158
+ name: identity.name,
159
+ ...bags,
160
+ fields: withOwnKeyAsHandle(bags.fields, identity.refName) ?? {},
161
+ searchTables: withOwnKeyAsHandle(bags.searchTables, identity.refName) ?? {},
162
+ fileReaders: withOwnKeyAsHandle(bags.fileReaders, identity.refName) ?? {},
163
+ automations: withOwnKeyAsHandle(bags.automations, identity.refName) ?? {},
164
+ agents: withOwnKeyAsHandle(bags.agents, identity.refName) ?? {},
165
+ skills: withOwnKeyAsHandle(bags.skills, identity.refName) ?? {},
166
+ };
167
+ }
168
+ /** Same as {@link appCatalog}, but for an element catalog root. */
169
+ export function elementCatalog(identity, bags) {
170
+ return {
171
+ __kind: "element",
172
+ refName: identity.refName,
173
+ name: identity.name,
174
+ ...bags,
175
+ fields: withOwnKeyAsHandle(bags.fields, identity.refName) ?? {},
176
+ searchTables: withOwnKeyAsHandle(bags.searchTables, identity.refName) ?? {},
177
+ fileReaders: withOwnKeyAsHandle(bags.fileReaders, identity.refName) ?? {},
178
+ automations: withOwnKeyAsHandle(bags.automations, identity.refName) ?? {},
179
+ agents: withOwnKeyAsHandle(bags.agents, identity.refName) ?? {},
180
+ skills: withOwnKeyAsHandle(bags.skills, identity.refName) ?? {},
181
+ };
182
+ }
183
+ /**
184
+ * Assemble the org catalog object. Produces `{ handle: "org", name: "Org", ...bags }`.
185
+ * No `__kind` — the org is not a `CatalogRef` kind and is referenced only as
186
+ * a namespace (`org.connectors.X`, `org.cloudLinks.Y`), never passed as a ref.
187
+ * `"org"` is a fixed singleton namespace, not derived from any entity's name —
188
+ * unlike every other identity in this file, it's not a ref name. Bag entries'
189
+ * `.handle` are stamped from their own key, same as `appCatalog`.
190
+ */
191
+ export function orgCatalog(bags) {
192
+ return {
193
+ handle: "org",
194
+ name: "Org",
195
+ ...bags,
196
+ connectors: withOwnKeyAsHandle(bags.connectors) ?? {},
197
+ cloudLinks: withOwnKeyAsHandle(bags.cloudLinks) ?? {},
198
+ categories: withOwnKeyAsHandle(bags.categories) ?? {},
199
+ groups: withOwnKeyAsHandle(bags.groups) ?? {},
200
+ tables: stampTableRefs(bags.tables) ?? {},
201
+ };
202
+ }