@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,288 @@
1
+ /**
2
+ * Regenerate the shared org catalog barrel (`generated/catalog.ts`): imports
3
+ * every app's, element's, and table's own per-entity `generated/catalog.ts`
4
+ * (written by `writeAppCatalog`/`writeAppCatalogFromAuthoring`) and exposes
5
+ * apps/elements flat plus tables under `catalog.tables`, alongside org
6
+ * AI providers/cloud links. `import catalog from "@catalog"` gives
7
+ * `catalog.testingAles`, `catalog.tables.orders`,
8
+ * `catalog.aiProviders.anthropic.models.claudeOpus_4_6`, etc.
9
+ *
10
+ * Elements and apps share the exact same per-entity catalog shape — an
11
+ * element just lives under `elements/<handle>/` instead of `apps/<handle>/`.
12
+ * There's nothing element-specific left in this file; it only needs to know
13
+ * where to look.
14
+ *
15
+ * Called by every import command that touches org state (importApp,
16
+ * importCloudLinks, importConnectors) so the catalog is always in sync.
17
+ */
18
+ import { existsSync } from "node:fs";
19
+ import { readdir } from "node:fs/promises";
20
+ import { mkdir, writeFile } from "node:fs/promises";
21
+ import { join } from "node:path";
22
+ import { AI_PROVIDER_TYPE_BY_RESOURCE_TYPE, ORG_IDENTITY_BAGS, orgRootOwnFileBags } from "../graph/index.js";
23
+ import { sanitizeName, tfLabelToTsLabel, tsLabelToTfLabel } from "../engine/tf/index.js";
24
+ import { sdkPackageSpecifier } from "../internal/sdk-package.js";
25
+ import { OrgExtractError } from "../engine/pull/org.js";
26
+ // ---------------------------------------------------------------------------
27
+ // Public entry points
28
+ // ---------------------------------------------------------------------------
29
+ export async function writeOrgCatalogFromExtract(root, extract) {
30
+ const genDir = join(root, "generated");
31
+ const catalogPath = join(genDir, "catalog.ts");
32
+ const orgPath = join(root, "org.ts");
33
+ const { appHandles, elementHandles, tableHandles } = await discoverOrgRootHandles(root);
34
+ await mkdir(genDir, { recursive: true });
35
+ await writeFile(orgPath, renderOrgTs(extract), "utf8");
36
+ await writeFile(catalogPath, renderBarrel(appHandles, elementHandles, tableHandles), "utf8");
37
+ return { catalogPath, orgPath };
38
+ }
39
+ /**
40
+ * Rewrite generated/catalog.ts ALONE from the current file tree — org.ts is
41
+ * untouched (it belongs to `pull org`). Called after a pull writes new
42
+ * authoring (apps/agents) so `@catalog` resolves the fresh entries.
43
+ */
44
+ export async function writeCatalogBarrel(root) {
45
+ const genDir = join(root, "generated");
46
+ const catalogPath = join(genDir, "catalog.ts");
47
+ const { appHandles, elementHandles, tableHandles } = await discoverOrgRootHandles(root);
48
+ await mkdir(genDir, { recursive: true });
49
+ await writeFile(catalogPath, renderBarrel(appHandles, elementHandles, tableHandles), "utf8");
50
+ return catalogPath;
51
+ }
52
+ /** Render generated/org.ts from the stream extract — bag/factory from CatalogFacet. */
53
+ function renderOrgTs(extract) {
54
+ const bags = ORG_IDENTITY_BAGS.flatMap((m) => {
55
+ if (!m.data.participates || m.data.orgBag === undefined || !m.catalog.participates)
56
+ return [];
57
+ const bag = m.data.orgBag;
58
+ const factory = m.catalog.factoryName ?? `${m.catalog.refKind}Ref`;
59
+ const entries = extract[bag];
60
+ if (entries.length === 0)
61
+ return [];
62
+ return [{ bag, factory, entries, order: m.catalog.renderOrder }];
63
+ }).sort((a, b) => a.order - b.order || a.bag.localeCompare(b.bag));
64
+ // connector and the 10 ai-provider-* kinds are all `catalog: NO_CATALOG` —
65
+ // they never appear in `bags` above. Models nest on their provider instead
66
+ // (`aiProviders.<provider>.models.<model>`), rendered specially here.
67
+ const aiProvidersLines = renderAiProvidersBag(extract);
68
+ const factories = new Set(["orgCatalog", ...bags.map((b) => b.factory)]);
69
+ if (aiProvidersLines.length > 0) {
70
+ factories.add("defineAiProvider");
71
+ factories.add("connectorRef");
72
+ }
73
+ const lines = [
74
+ "// Org reference identities from `elementum pull org --data-only` — refresh by re-running it.",
75
+ "// Each key IS the identity's terraform label in camelCase: tfLabel = tsLabelToTfLabel(key)",
76
+ "// (the lossless bijection in src/tf/labels.ts — the stable naming contract).",
77
+ `import { ${[...factories].sort().join(", ")} } from "${sdkPackageSpecifier("catalog")}";`,
78
+ "",
79
+ "export const org = orgCatalog({",
80
+ ...aiProvidersLines,
81
+ ];
82
+ for (const { bag, factory, entries } of bags) {
83
+ lines.push(` ${bag}: {`);
84
+ for (const e of entries) {
85
+ lines.push(` ${e.tsLabel}: ${factory}({ name: ${q(e.name)} }),`);
86
+ }
87
+ lines.push(" },");
88
+ }
89
+ lines.push("});", "");
90
+ return lines.join("\n");
91
+ }
92
+ /**
93
+ * Connectors nest one level under their provider — model names alone collide
94
+ * across providers, so `aiProviders.<provider>.models.<model>` disambiguates
95
+ * instead of a flat `connectors.<model>`. Provider/model keys are
96
+ * independently derived from `name`/`model_name` (never split out of the
97
+ * connector's combined tfLabel) and cross-checked against the recorded
98
+ * tfLabel — a mismatch means ei's label construction drifted from this
99
+ * derivation. Every connector is required (by `extractOrg`) to carry a
100
+ * resolved `providerRef`, so an unresolved one here means its provider
101
+ * wasn't itself exported — loud, not silent.
102
+ */
103
+ function renderAiProvidersBag(extract) {
104
+ if (extract.aiProviders.length === 0)
105
+ return [];
106
+ const providerByRef = new Map();
107
+ for (const provider of extract.aiProviders) {
108
+ providerByRef.set(`${provider.resourceType}.${provider.tfLabel}`, provider);
109
+ }
110
+ const modelsByProviderKey = new Map();
111
+ for (const connector of extract.connectors) {
112
+ if (connector.providerRef === undefined) {
113
+ throw new OrgExtractError(`connector "${connector.name}" (${connector.tfLabel}) has no resolved provider reference`);
114
+ }
115
+ const providerRefKey = `${connector.providerRef.resourceType}.${connector.providerRef.tfLabel}`;
116
+ const provider = providerByRef.get(providerRefKey);
117
+ if (provider === undefined) {
118
+ throw new OrgExtractError(`connector "${connector.name}" (${connector.tfLabel}): its provider (${providerRefKey}) was not exported`);
119
+ }
120
+ const providerKey = tfLabelToTsLabel(sanitizeName(provider.name));
121
+ const modelKey = tfLabelToTsLabel(sanitizeName(connector.name));
122
+ const rebuilt = `${tsLabelToTfLabel(providerKey)}_${tsLabelToTfLabel(modelKey)}`;
123
+ if (rebuilt !== connector.tfLabel) {
124
+ throw new OrgExtractError(`connector "${connector.name}" / provider "${provider.name}": derived label "${rebuilt}" doesn't match ei's recorded label "${connector.tfLabel}" — label derivation drifted`);
125
+ }
126
+ const models = modelsByProviderKey.get(providerKey) ?? [];
127
+ if (models.some((m) => m.modelKey === modelKey)) {
128
+ throw new OrgExtractError(`provider "${provider.name}": two connectors both derive the model key "${modelKey}"`);
129
+ }
130
+ models.push({ modelKey, connector });
131
+ modelsByProviderKey.set(providerKey, models);
132
+ }
133
+ const providers = extract.aiProviders
134
+ .map((provider) => ({ provider, providerKey: tfLabelToTsLabel(sanitizeName(provider.name)) }))
135
+ .sort((a, b) => a.providerKey.localeCompare(b.providerKey));
136
+ const lines = [" aiProviders: {"];
137
+ for (const { provider, providerKey } of providers) {
138
+ const type = AI_PROVIDER_TYPE_BY_RESOURCE_TYPE.get(provider.resourceType);
139
+ if (type === undefined) {
140
+ throw new OrgExtractError(`provider "${provider.name}": unrecognized resource type "${provider.resourceType}"`);
141
+ }
142
+ const models = (modelsByProviderKey.get(providerKey) ?? []).sort((a, b) => a.modelKey.localeCompare(b.modelKey));
143
+ if (models.length === 0) {
144
+ lines.push(` ${providerKey}: defineAiProvider({ name: ${q(provider.name)}, type: ${q(type)} }),`);
145
+ continue;
146
+ }
147
+ lines.push(` ${providerKey}: defineAiProvider({ name: ${q(provider.name)}, type: ${q(type)}, models: {`);
148
+ for (const { modelKey, connector } of models) {
149
+ lines.push(` ${modelKey}: connectorRef({ name: ${q(connector.name)} }),`);
150
+ }
151
+ lines.push(" } }),");
152
+ }
153
+ lines.push(" },");
154
+ return lines;
155
+ }
156
+ /** Render generated/catalog.ts as a pure barrel over org.ts + disk-scanned catalogs. */
157
+ function renderBarrel(appHandles, elementHandles, tableHandles) {
158
+ const { elementKeys, tableImports, lines: importLines } = aspectImportLines(appHandles, elementHandles, tableHandles);
159
+ const lines = [
160
+ 'import { org } from "../org.js";',
161
+ 'import { usersCatalog } from "@elementumai/edk/catalog";',
162
+ ...importLines,
163
+ "",
164
+ "const catalog = {",
165
+ ];
166
+ for (const h of appHandles)
167
+ lines.push(` ${h},`);
168
+ for (const h of elementHandles) {
169
+ const key = elementKeys.get(h);
170
+ lines.push(key === h ? ` ${h},` : ` ${key},`);
171
+ }
172
+ lines.push(" users: usersCatalog,");
173
+ lines.push(" aiProviders: org.aiProviders,");
174
+ lines.push(" cloudLinks: org.cloudLinks,");
175
+ lines.push(" categories: org.categories,");
176
+ lines.push(" groups: org.groups,");
177
+ if (tableHandles.length > 0) {
178
+ lines.push(" tables: {");
179
+ for (const h of tableHandles)
180
+ lines.push(` ${safeKey(h)}: ${tableImports.get(h)},`);
181
+ lines.push(" },");
182
+ }
183
+ lines.push("};", "", "export { org };", "export type Ref = typeof catalog;", "export default catalog;", "");
184
+ return lines.join("\n");
185
+ }
186
+ /** Shared import-line rendering for the barrel (element collision + table alias rules). */
187
+ function aspectImportLines(appHandles, elementHandles, tableHandles) {
188
+ const used = new Set(appHandles);
189
+ const elementKeys = new Map();
190
+ for (const h of elementHandles) {
191
+ if (!used.has(h)) {
192
+ elementKeys.set(h, h);
193
+ used.add(h);
194
+ continue;
195
+ }
196
+ let i = 2;
197
+ let candidate = `${h}${i}`;
198
+ while (used.has(candidate)) {
199
+ i++;
200
+ candidate = `${h}${i}`;
201
+ }
202
+ elementKeys.set(h, candidate);
203
+ used.add(candidate);
204
+ console.error(`[elementum] warning: "${h}" names both an app and an element — the element is exposed as catalog.${candidate} (the app keeps catalog.${h}) to avoid a collision.`);
205
+ }
206
+ const tableImports = localTableNames(tableHandles, new Set([...appHandles, ...elementHandles.map((h) => `${h}$element`)]));
207
+ const lines = [];
208
+ for (const h of appHandles)
209
+ lines.push(`import { ${h} } from "../apps/${h}/generated/catalog.js";`);
210
+ for (const h of elementHandles) {
211
+ const key = elementKeys.get(h);
212
+ lines.push(key === h
213
+ ? `import { ${h} } from "../elements/${h}/generated/catalog.js";`
214
+ : `import { ${h} as ${key} } from "../elements/${h}/generated/catalog.js";`);
215
+ }
216
+ for (const h of tableHandles)
217
+ lines.push(`import ${tableImports.get(h)} from "../tables/${h}/generated/catalog.js";`);
218
+ return { elementKeys, tableImports, lines };
219
+ }
220
+ // ---------------------------------------------------------------------------
221
+ // App / element / table handle discovery (dirs from orgRootOwnFileBags)
222
+ // ---------------------------------------------------------------------------
223
+ async function discoverHandles(root, subdir) {
224
+ const dir = join(root, subdir);
225
+ const handles = [];
226
+ try {
227
+ const entries = await readdir(dir, { withFileTypes: true });
228
+ for (const e of entries) {
229
+ if (!e.isDirectory())
230
+ continue;
231
+ if (existsSync(join(dir, e.name, "generated", "catalog.ts"))) {
232
+ handles.push(e.name);
233
+ }
234
+ }
235
+ }
236
+ catch { /* subdir doesn't exist yet — no handles */ }
237
+ return handles.sort();
238
+ }
239
+ /**
240
+ * Scan org-root own-file bags from the graph. Apps/elements stay flat on the
241
+ * barrel; `tables` nests under `catalog.tables` (historical shape).
242
+ */
243
+ async function discoverOrgRootHandles(root) {
244
+ const bags = new Set(orgRootOwnFileBags());
245
+ const appHandles = bags.has("apps") ? await discoverHandles(root, "apps") : [];
246
+ const elementHandles = bags.has("elements") ? await discoverHandles(root, "elements") : [];
247
+ const tableHandles = bags.has("tables") ? await discoverHandles(root, "tables") : [];
248
+ return { appHandles, elementHandles, tableHandles };
249
+ }
250
+ // ---------------------------------------------------------------------------
251
+ // Renderer
252
+ // ---------------------------------------------------------------------------
253
+ function q(s) {
254
+ return JSON.stringify(s);
255
+ }
256
+ const RESERVED_IDENT = new Set([
257
+ "break", "case", "catch", "class", "const", "continue", "debugger", "default",
258
+ "delete", "do", "else", "export", "extends", "false", "finally", "for",
259
+ "function", "if", "import", "in", "instanceof", "new", "null", "return",
260
+ "super", "switch", "this", "throw", "true", "try", "typeof", "var", "void",
261
+ "while", "with", "let", "static", "yield", "enum",
262
+ ]);
263
+ function safeKey(name) {
264
+ return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) && !RESERVED_IDENT.has(name)
265
+ ? name
266
+ : q(name);
267
+ }
268
+ function localTableNames(handles, usedNames) {
269
+ const out = new Map();
270
+ for (const handle of handles) {
271
+ const base = `${identifierBase(handle)}$table`;
272
+ let candidate = base;
273
+ let n = 2;
274
+ while (usedNames.has(candidate) || RESERVED_IDENT.has(candidate)) {
275
+ candidate = `${base}${n}`;
276
+ n += 1;
277
+ }
278
+ usedNames.add(candidate);
279
+ out.set(handle, candidate);
280
+ }
281
+ return out;
282
+ }
283
+ function identifierBase(handle) {
284
+ const sanitized = handle.replace(/[^A-Za-z0-9_$]/g, "_");
285
+ if (sanitized === "")
286
+ return "_";
287
+ return /^[A-Za-z_$]/.test(sanitized) ? sanitized : `_${sanitized}`;
288
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Entity-agnostic helpers for CatalogFacet.renderEntry implementations.
3
+ * Engine render.ts only dispatches; dialect lives on facets / deferred meta.
4
+ */
5
+ import type { CatalogRenderResult } from "../graph/types.js";
6
+ /** Quote bag keys that are not safe bare identifiers. */
7
+ export declare function safeCatalogKey(name: string): string;
8
+ /** `key: factoryName(),` — agent/skill/empty automation style. */
9
+ export declare function bareFactoryEntry(factoryName: string, keyName: string, baseIndent: string): CatalogRenderResult;
10
+ export interface NamedFactoryEntryOpts {
11
+ readonly factoryName: string;
12
+ readonly keyName: string;
13
+ readonly baseIndent: string;
14
+ readonly name: string;
15
+ /** When set, emit `parent: …`. Omit for appCatalog-injected kinds. */
16
+ readonly parent?: string;
17
+ /** Extra `key: value` fragments already formatted (e.g. `fieldType: "TEXT"`). */
18
+ readonly extraParts?: readonly string[];
19
+ readonly extraFactories?: readonly string[];
20
+ }
21
+ /** `key: factoryName({ name, … }),` */
22
+ export declare function namedFactoryEntry(opts: NamedFactoryEntryOpts): CatalogRenderResult;
23
+ /** Narrow an unknown catalog ref to a name-bearing record. */
24
+ export declare function asNamedRef(ref: unknown): {
25
+ name: string;
26
+ parent?: string;
27
+ refName?: string;
28
+ };
29
+ /** `{ name }` only — org identity bags and similar. */
30
+ export declare function namedOnlyFactoryEntry(factoryName: string): (args: import("../graph/types.js").CatalogRenderArgs) => CatalogRenderResult;
31
+ /**
32
+ * `{ name }` with parent omitted — appCatalog injects parent from the root
33
+ * (fields, search tables).
34
+ */
35
+ export declare function rootParentFactoryEntry(factoryName: string, extraParts?: (ref: unknown) => readonly string[]): (args: import("../graph/types.js").CatalogRenderArgs) => CatalogRenderResult;
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Entity-agnostic helpers for CatalogFacet.renderEntry implementations.
3
+ * Engine render.ts only dispatches; dialect lives on facets / deferred meta.
4
+ */
5
+ const RESERVED_IDENT = new Set([
6
+ "break", "case", "catch", "class", "const", "continue", "debugger", "default",
7
+ "delete", "do", "else", "export", "extends", "false", "finally", "for",
8
+ "function", "if", "import", "in", "instanceof", "new", "null", "return",
9
+ "super", "switch", "this", "throw", "true", "try", "typeof", "var", "void",
10
+ "while", "with", "let", "static", "yield", "enum",
11
+ ]);
12
+ /** Quote bag keys that are not safe bare identifiers. */
13
+ export function safeCatalogKey(name) {
14
+ if (!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) || RESERVED_IDENT.has(name)) {
15
+ return JSON.stringify(name);
16
+ }
17
+ return name;
18
+ }
19
+ /** `key: factoryName(),` — agent/skill/empty automation style. */
20
+ export function bareFactoryEntry(factoryName, keyName, baseIndent) {
21
+ return {
22
+ lines: [`${baseIndent}${safeCatalogKey(keyName)}: ${factoryName}(),`],
23
+ };
24
+ }
25
+ /** `key: factoryName({ name, … }),` */
26
+ export function namedFactoryEntry(opts) {
27
+ const parts = [`name: ${JSON.stringify(opts.name)}`];
28
+ if (opts.parent !== undefined) {
29
+ parts.push(`parent: ${JSON.stringify(opts.parent)}`);
30
+ }
31
+ if (opts.extraParts !== undefined)
32
+ parts.push(...opts.extraParts);
33
+ return {
34
+ lines: [
35
+ `${opts.baseIndent}${safeCatalogKey(opts.keyName)}: ${opts.factoryName}({ ${parts.join(", ")} }),`,
36
+ ],
37
+ extraFactories: opts.extraFactories,
38
+ };
39
+ }
40
+ /** Narrow an unknown catalog ref to a name-bearing record. */
41
+ export function asNamedRef(ref) {
42
+ if (ref === null || typeof ref !== "object") {
43
+ throw new Error("catalog renderEntry expected an object ref");
44
+ }
45
+ const r = ref;
46
+ if (typeof r.name !== "string") {
47
+ throw new Error("catalog renderEntry expected ref.name: string");
48
+ }
49
+ return {
50
+ name: r.name,
51
+ parent: typeof r.parent === "string" ? r.parent : undefined,
52
+ refName: typeof r.refName === "string" ? r.refName : undefined,
53
+ };
54
+ }
55
+ /** `{ name }` only — org identity bags and similar. */
56
+ export function namedOnlyFactoryEntry(factoryName) {
57
+ return (args) => {
58
+ const named = asNamedRef(args.ref);
59
+ return namedFactoryEntry({
60
+ factoryName,
61
+ keyName: args.keyName,
62
+ baseIndent: args.baseIndent,
63
+ name: named.name,
64
+ });
65
+ };
66
+ }
67
+ /**
68
+ * `{ name }` with parent omitted — appCatalog injects parent from the root
69
+ * (fields, search tables).
70
+ */
71
+ export function rootParentFactoryEntry(factoryName, extraParts) {
72
+ return (args) => {
73
+ const named = asNamedRef(args.ref);
74
+ return namedFactoryEntry({
75
+ factoryName,
76
+ keyName: args.keyName,
77
+ baseIndent: args.baseIndent,
78
+ name: named.name,
79
+ extraParts: extraParts?.(args.ref),
80
+ });
81
+ };
82
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Pure rendering for the v2 catalog.
3
+ *
4
+ * `renderCatalog` is the canonical renderer: it produces a single flat
5
+ * TypeScript file per catalog root (app, element, or org). Per-kind emission
6
+ * dialect lives on CatalogFacet.renderEntry (and deferred graph meta) — this
7
+ * file only orchestrates imports, bag order, and indentation.
8
+ */
9
+ import type { CatalogRef, CatalogRefKind } from "./types.js";
10
+ /** Identity of the catalog root the file represents. */
11
+ export interface BarrelRoot {
12
+ readonly kind: "app" | "element" | "org";
13
+ readonly refName: string;
14
+ readonly name: string;
15
+ }
16
+ /**
17
+ * The app/element's own authoring file, imported live so identity + fields
18
+ * never need re-baking when the file's content changes — only the file's
19
+ * *existence* is a catalog-generation event (adding/removing an own-file
20
+ * child still goes through `edk new agent`/`edk new skill`/pull). Safe
21
+ * because an app/element file is always a leaf: it never imports `@catalog`
22
+ * itself, so importing it from the catalog can't cycle.
23
+ */
24
+ export interface OwnFileRef {
25
+ readonly importPath: string;
26
+ readonly identifier: string;
27
+ }
28
+ /**
29
+ * Render a single flat catalog file. App/element catalogs use `appCatalog()` /
30
+ * `elementCatalog()` so `__kind` stays inside the factory. The org catalog uses
31
+ * `orgCatalog()`. Behavioral kinds (automation/agent) have their own entity
32
+ * files — their refs land here too, but the caller sources them by calling
33
+ * `.ref()` on each entity file's `defineX(...)` result
34
+ * (`src/catalog/from-authoring.ts`), not from server-side import data.
35
+ *
36
+ * @deprecated `automationTriggerKinds` is no longer used — pass nothing or omit.
37
+ */
38
+ export declare function renderCatalog(root: BarrelRoot, refs: readonly CatalogRef[], _automationTriggerKinds?: Map<string, string>, ownFile?: OwnFileRef): string;
39
+ /** One entry the barrel imports and aggregates. */
40
+ export interface BarrelEntry {
41
+ readonly kind: CatalogRefKind;
42
+ readonly refName: string;
43
+ readonly importPath: string;
44
+ }
45
+ /** @deprecated Use renderCatalog instead. */
46
+ export declare function renderFragment(ref: CatalogRef): string;
47
+ /** @deprecated Use renderCatalog instead. */
48
+ export declare function renderBarrel(root: BarrelRoot, entries: readonly BarrelEntry[]): string;
@@ -0,0 +1,193 @@
1
+ /**
2
+ * Pure rendering for the v2 catalog.
3
+ *
4
+ * `renderCatalog` is the canonical renderer: it produces a single flat
5
+ * TypeScript file per catalog root (app, element, or org). Per-kind emission
6
+ * dialect lives on CatalogFacet.renderEntry (and deferred graph meta) — this
7
+ * file only orchestrates imports, bag order, and indentation.
8
+ */
9
+ import { catalogKindsForRoot, catalogBagForRefKind, } from "../graph/index.js";
10
+ import { sdkPackageSpecifier } from "../internal/sdk-package.js";
11
+ import { safeCatalogKey } from "./render-helpers.js";
12
+ function bagName(kind) {
13
+ const bag = catalogBagForRefKind(kind);
14
+ if (bag === undefined) {
15
+ throw new Error(`catalog bag name unknown for ref kind "${kind}" — register a CatalogFacet or deferred meta`);
16
+ }
17
+ return bag;
18
+ }
19
+ /**
20
+ * Render a single flat catalog file. App/element catalogs use `appCatalog()` /
21
+ * `elementCatalog()` so `__kind` stays inside the factory. The org catalog uses
22
+ * `orgCatalog()`. Behavioral kinds (automation/agent) have their own entity
23
+ * files — their refs land here too, but the caller sources them by calling
24
+ * `.ref()` on each entity file's `defineX(...)` result
25
+ * (`src/catalog/from-authoring.ts`), not from server-side import data.
26
+ *
27
+ * @deprecated `automationTriggerKinds` is no longer used — pass nothing or omit.
28
+ */
29
+ export function renderCatalog(root, refs, _automationTriggerKinds, ownFile) {
30
+ const isApp = root.kind === "app" || root.kind === "element";
31
+ // Graph CatalogFacet (+ deferred meta) drives which kinds belong on this root
32
+ // and their emission order — no hard-wired KIND_ORDER / bag lists here.
33
+ const usedMeta = catalogKindsForRoot(root.kind).filter((m) => refs.some((r) => r.__kind === m.refKind));
34
+ // Fields resolve live off `ownFile` (identity + fields come straight from
35
+ // the app/element's own `.ref()` call) — never rendered as baked entries,
36
+ // so `fieldRef` never needs importing and the per-entry loop skips "field".
37
+ const liveMeta = ownFile !== undefined ? usedMeta.filter((m) => m.refKind !== "field") : usedMeta;
38
+ const factoryNames = new Set();
39
+ if (isApp) {
40
+ factoryNames.add(root.kind === "element" ? "elementCatalog" : "appCatalog");
41
+ }
42
+ else {
43
+ factoryNames.add("orgCatalog");
44
+ }
45
+ for (const m of liveMeta)
46
+ factoryNames.add(m.factoryName);
47
+ const entryIndent = isApp ? " " : " ";
48
+ for (const m of liveMeta) {
49
+ const kindRefs = refs.filter((r) => r.__kind === m.refKind);
50
+ for (const ref of kindRefs) {
51
+ const rendered = m.renderEntry({
52
+ ref,
53
+ keyName: ref.refName,
54
+ baseIndent: entryIndent,
55
+ });
56
+ for (const f of rendered.extraFactories ?? [])
57
+ factoryNames.add(f);
58
+ }
59
+ }
60
+ const lines = [];
61
+ if (ownFile !== undefined) {
62
+ lines.push(`import ${ownFile.identifier} from ${JSON.stringify(ownFile.importPath)};`);
63
+ }
64
+ lines.push(`import { ${[...factoryNames].sort().join(", ")} } from "${sdkPackageSpecifier("catalog")}";`);
65
+ lines.push("");
66
+ if (isApp) {
67
+ const catalogFn = root.kind === "element" ? "elementCatalog" : "appCatalog";
68
+ if (ownFile !== undefined) {
69
+ lines.push(`const __own = ${ownFile.identifier}.ref(${JSON.stringify(root.refName)});`);
70
+ lines.push("");
71
+ }
72
+ lines.push(`export const ${root.refName} = ${catalogFn}(`);
73
+ lines.push(ownFile !== undefined
74
+ ? ` { refName: __own.refName, name: __own.name },`
75
+ : ` { refName: ${JSON.stringify(root.refName)}, name: ${JSON.stringify(root.name)} },`);
76
+ lines.push(` {`);
77
+ for (const m of usedMeta) {
78
+ const bag = bagName(m.refKind);
79
+ if (m.refKind === "field" && ownFile !== undefined) {
80
+ lines.push(` ${bag}: __own.fields,`);
81
+ continue;
82
+ }
83
+ const kindRefs = refs
84
+ .filter((r) => r.__kind === m.refKind)
85
+ .sort((a, b) => a.refName.localeCompare(b.refName));
86
+ lines.push(` ${bag}: {`);
87
+ for (const ref of kindRefs) {
88
+ const rendered = m.renderEntry({
89
+ ref,
90
+ keyName: ref.refName,
91
+ baseIndent: entryIndent,
92
+ });
93
+ lines.push(...rendered.lines);
94
+ }
95
+ lines.push(` },`);
96
+ }
97
+ lines.push(` },`);
98
+ lines.push(`);`);
99
+ }
100
+ else {
101
+ lines.push(`export const org = orgCatalog({`);
102
+ for (const m of usedMeta) {
103
+ const bag = bagName(m.refKind);
104
+ const kindRefs = refs
105
+ .filter((r) => r.__kind === m.refKind)
106
+ .sort((a, b) => a.refName.localeCompare(b.refName));
107
+ lines.push(` ${bag}: {`);
108
+ for (const ref of kindRefs) {
109
+ const rendered = m.renderEntry({
110
+ ref,
111
+ keyName: ref.refName,
112
+ baseIndent: entryIndent,
113
+ });
114
+ lines.push(...rendered.lines);
115
+ }
116
+ lines.push(` },`);
117
+ }
118
+ lines.push(`});`);
119
+ lines.push("");
120
+ lines.push(`export type Ref = typeof org;`);
121
+ }
122
+ lines.push("");
123
+ return lines.join("\n");
124
+ }
125
+ /** @deprecated Use renderCatalog instead. */
126
+ export function renderFragment(ref) {
127
+ const lines = [
128
+ `export const ${ref.refName} = {`,
129
+ ` __kind: ${JSON.stringify(ref.__kind)},`,
130
+ ` refName: ${JSON.stringify(ref.refName)},`,
131
+ ` name: ${JSON.stringify(ref.name)},`,
132
+ ];
133
+ if (ref.parent !== undefined)
134
+ lines.push(` parent: ${JSON.stringify(ref.parent)},`);
135
+ if (ref.__kind === "field") {
136
+ const field = ref;
137
+ lines.push(` fieldType: ${JSON.stringify(field.fieldType)},`);
138
+ if (field.tags !== undefined) {
139
+ lines.push(` tags: ${JSON.stringify(field.tags)},`);
140
+ }
141
+ }
142
+ if (ref.__kind === "automation") {
143
+ lines.push(...renderMemberBag("trigger", ref.trigger));
144
+ lines.push(...renderMemberBag("outputs", ref.outputs));
145
+ }
146
+ lines.push(`} as const;`, "");
147
+ return lines.join("\n");
148
+ }
149
+ /**
150
+ * Render a nested ref bag (`trigger` / `outputs`) inside an automation fragment:
151
+ * `bag: { <key>: { __kind, refName, name, parent }, … }`. Keys are sorted for
152
+ * byte-stability; an empty/absent bag emits nothing.
153
+ */
154
+ function renderMemberBag(bag, members) {
155
+ const keys = Object.keys(members ?? {}).sort();
156
+ if (keys.length === 0)
157
+ return [];
158
+ const entries = keys.map((key) => {
159
+ const m = members[key];
160
+ const parts = [
161
+ `__kind: ${JSON.stringify(m.__kind)}`,
162
+ `refName: ${JSON.stringify(m.refName)}`,
163
+ `name: ${JSON.stringify(m.name)}`,
164
+ ...(m.parent !== undefined ? [`parent: ${JSON.stringify(m.parent)}`] : []),
165
+ ];
166
+ return ` ${safeCatalogKey(key)}: { ${parts.join(", ")} },`;
167
+ });
168
+ return [` ${bag}: {`, ...entries, ` },`];
169
+ }
170
+ /** @deprecated Use renderCatalog instead. */
171
+ export function renderBarrel(root, entries) {
172
+ const imports = [...entries]
173
+ .sort((a, b) => (a.importPath < b.importPath ? -1 : a.importPath > b.importPath ? 1 : 0))
174
+ .map((e) => `import { ${e.refName} } from ${JSON.stringify(e.importPath)};`);
175
+ const lines = [];
176
+ if (imports.length > 0)
177
+ lines.push(...imports, "");
178
+ lines.push(`export const ${root.refName} = {`);
179
+ lines.push(` __kind: ${JSON.stringify(root.kind)},`);
180
+ lines.push(` refName: ${JSON.stringify(root.refName)},`);
181
+ lines.push(` name: ${JSON.stringify(root.name)},`);
182
+ for (const meta of catalogKindsForRoot(root.kind)) {
183
+ const refNames = entries
184
+ .filter((e) => e.kind === meta.refKind)
185
+ .map((e) => e.refName)
186
+ .sort();
187
+ if (refNames.length === 0)
188
+ continue;
189
+ lines.push(` ${meta.catalogBag}: { ${refNames.join(", ")} },`);
190
+ }
191
+ lines.push(`} as const;`, "");
192
+ return lines.join("\n");
193
+ }
@@ -0,0 +1,10 @@
1
+ /** True when `v` is a catalog ref token (`__kind ∈ REF_SCOPE` + a string refName). */
2
+ export declare function isCatalogToken(v: unknown): boolean;
3
+ /** Reduce a catalog token to its canonical fields (dropping barrel bags etc.). */
4
+ export declare function slimToken(token: Record<string, unknown>): Record<string, unknown>;
5
+ /**
6
+ * Deep-walk `node`, replacing every catalog token with its slim canonical form.
7
+ * Non-token objects/arrays are recursed; scalars pass through. Tokens are not
8
+ * recursed into (their bags are dropped wholesale).
9
+ */
10
+ export declare function slimTokens(node: unknown): unknown;