@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,169 @@
1
+ /**
2
+ * Element emission: `defineElement` DeployableEntity → `elementum_element` +
3
+ * field resources in ei's dialect. No status_options/stages (apps always
4
+ * emit those; element captures do not).
5
+ */
6
+ import { EntityTfError } from "../../engine/entity.js";
7
+ import { expr } from "../../engine/tf/index.js";
8
+ import { accessPolicyToTf } from "../access-policy/to-tf.js";
9
+ import { fieldToTf } from "../field/to-tf.js";
10
+ import { CATEGORY_ORG_BAG } from "../org/category.js";
11
+ import { CLOUD_LINK_ORG_BAG } from "../org/cloud-link.js";
12
+ import { viewToTf } from "../view/to-tf.js";
13
+ import { ELEMENT_RESOURCE_TYPE } from "./module.js";
14
+ /** System-field tags that fold into the element resource (no field resource). */
15
+ const SYSTEM_FIELD_TAGS = new Set([
16
+ "TITLE",
17
+ "HANDLE",
18
+ "STATUS",
19
+ "STAGE",
20
+ "CREATED_AT",
21
+ "CREATED_BY",
22
+ "UPDATED_AT",
23
+ "UPDATED_BY",
24
+ "CLOSED_AT",
25
+ "CLOSED_BY",
26
+ ]);
27
+ /** `elementum_element` + one field resource per custom field. */
28
+ export function elementToTf(entity, ctx) {
29
+ if (entity.kind !== "element") {
30
+ throw new EntityTfError(`elementToTf expects kind "element"; got "${entity.kind}" (refName "${entity.refName}")`);
31
+ }
32
+ const payload = entity.payload;
33
+ if (payload === null || typeof payload !== "object") {
34
+ throw new EntityTfError(`element "${entity.refName}" has a non-object payload`);
35
+ }
36
+ const elementAttrs = {
37
+ name: payload.name ?? "",
38
+ };
39
+ // Optional+Computed on the provider: omitting it (rather than forcing a
40
+ // default) lets the platform's current value ride through unchanged.
41
+ if (payload.commentsEnabled !== undefined)
42
+ elementAttrs["comments_enabled"] = payload.commentsEnabled;
43
+ if (payload.namespace !== undefined)
44
+ elementAttrs["namespace"] = payload.namespace;
45
+ if (payload.handle !== undefined)
46
+ elementAttrs["handle"] = payload.handle;
47
+ if (payload.description !== undefined)
48
+ elementAttrs["description"] = payload.description;
49
+ if (payload.icon !== undefined)
50
+ elementAttrs["icon"] = payload.icon;
51
+ if (payload.color !== undefined)
52
+ elementAttrs["color"] = payload.color;
53
+ // A LINKED element's Snowflake table mapping — create-only (the table
54
+ // binding is immutable once set), but sent every build so a rebuild
55
+ // doesn't null it out on an in-place update.
56
+ const cloudConnection = payload.cloudConnection;
57
+ if (cloudConnection !== undefined) {
58
+ if (cloudConnection.database !== undefined)
59
+ elementAttrs["cloud_mapping_snowflake_database"] = cloudConnection.database;
60
+ if (cloudConnection.schema !== undefined)
61
+ elementAttrs["cloud_mapping_snowflake_schema"] = cloudConnection.schema;
62
+ if (cloudConnection.table !== undefined)
63
+ elementAttrs["cloud_mapping_snowflake_table"] = cloudConnection.table;
64
+ if (cloudConnection.hybridTable !== undefined)
65
+ elementAttrs["snowflake_hybrid_table"] = cloudConnection.hybridTable;
66
+ if (cloudConnection.titleColumnName !== undefined)
67
+ elementAttrs["title_column_name"] = cloudConnection.titleColumnName;
68
+ if (cloudConnection.idColumnName !== undefined)
69
+ elementAttrs["id_column_name"] = cloudConnection.idColumnName;
70
+ }
71
+ const categoryName = payload.category?.name;
72
+ if (categoryName !== undefined && categoryName !== "") {
73
+ const category = ctx.orgRefs.byName(CATEGORY_ORG_BAG, categoryName);
74
+ if (category === undefined) {
75
+ ctx.diagnostics.push(`category "${categoryName}" is not in the org catalog — re-run \`edk pull org --data-only\` (categories must already exist in the org)`);
76
+ }
77
+ else {
78
+ elementAttrs["category_id"] = expr.dataAttr("elementum_category", category.tfLabel, ["id"]);
79
+ }
80
+ }
81
+ const cloudLink = payload.cloudLinkId;
82
+ if (cloudLink !== undefined) {
83
+ const tsLabel = cloudLink.refName ?? "";
84
+ const resolved = ctx.orgRefs.byTsLabel(CLOUD_LINK_ORG_BAG, tsLabel);
85
+ if (resolved === undefined) {
86
+ ctx.diagnostics.push(`cloud link token "${tsLabel}" is not in the org catalog — re-run \`edk pull org --data-only\``);
87
+ }
88
+ else {
89
+ elementAttrs["cloud_link_id"] = expr.dataAttr("elementum_cloudlink", resolved.tfLabel, ["id"]);
90
+ }
91
+ }
92
+ if (payload.cloudOptions !== undefined) {
93
+ ctx.diagnostics.push("cloudOptions are not supported on the terraform path yet; dropped");
94
+ }
95
+ if (payload.displayBlocks !== undefined || payload.recordCreateDisplayBlocks !== undefined) {
96
+ ctx.diagnostics.push("display blocks are not supported on the terraform path; dropped");
97
+ }
98
+ const blocks = [];
99
+ const fieldAddresses = new Map();
100
+ const objectId = expr.resourceAttr(ELEMENT_RESOURCE_TYPE, ctx.appTfLabel, ["id"]);
101
+ for (const fieldEntry of payload.fields ?? []) {
102
+ const typeKey = Object.keys(fieldEntry)[0];
103
+ if (typeKey === undefined)
104
+ continue;
105
+ const inner = fieldEntry[typeKey];
106
+ const name = inner.name ?? "";
107
+ const systemTag = inner.tags?.find((tag) => SYSTEM_FIELD_TAGS.has(tag));
108
+ if (systemTag !== undefined) {
109
+ switch (systemTag) {
110
+ case "TITLE":
111
+ if (name !== "Title")
112
+ elementAttrs["title_field_name"] = name;
113
+ if (inner.description !== undefined)
114
+ elementAttrs["title_field_description"] = inner.description;
115
+ break;
116
+ case "HANDLE":
117
+ if (name !== "ID")
118
+ elementAttrs["id_field_name"] = name;
119
+ if (inner.description !== undefined)
120
+ elementAttrs["id_field_description"] = inner.description;
121
+ break;
122
+ case "STATUS":
123
+ case "STAGE":
124
+ ctx.diagnostics.push(`systemFields.${systemTag.toLowerCase()}: elements do not carry status/stages on the terraform path; dropped`);
125
+ break;
126
+ default:
127
+ // Audit fields are provider-managed; nothing to emit.
128
+ break;
129
+ }
130
+ continue;
131
+ }
132
+ const field = fieldToTf(typeKey, inner, {
133
+ ownerTfLabel: ctx.appTfLabel,
134
+ scope: "element",
135
+ objectId,
136
+ diagnostics: ctx.diagnostics,
137
+ orgRefs: ctx.orgRefs,
138
+ });
139
+ if (field === undefined)
140
+ continue;
141
+ blocks.push(field.block);
142
+ fieldAddresses.set(field.bagKey, field.address);
143
+ }
144
+ const { blocks: viewBlocks } = viewToTf(payload.layouts, payload.listViews, payload.viewOrder, {
145
+ ownerTfLabel: ctx.appTfLabel,
146
+ scope: "element",
147
+ aspectName: payload.name ?? "",
148
+ objectId,
149
+ diagnostics: ctx.diagnostics,
150
+ });
151
+ blocks.push(...viewBlocks);
152
+ for (const [index, entry] of (payload.accessPolicies ?? []).entries()) {
153
+ const { block } = accessPolicyToTf(entry, index, {
154
+ ownerTfLabel: ctx.appTfLabel,
155
+ scope: "element",
156
+ objectId,
157
+ orgRefs: ctx.orgRefs,
158
+ diagnostics: ctx.diagnostics,
159
+ });
160
+ blocks.push(block);
161
+ }
162
+ blocks.unshift({
163
+ kind: "resource",
164
+ type: ELEMENT_RESOURCE_TYPE,
165
+ label: ctx.appTfLabel,
166
+ attrs: elementAttrs,
167
+ });
168
+ return { blocks, fieldAddresses };
169
+ }
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Typed field factories — the authoring surface for `defineApp`'s (and
3
+ * `defineElement`'s) `fields:` bag. One factory per field sub-type row
4
+ * (types.ts), each taking only the options valid for its kind:
5
+ *
6
+ * fields: {
7
+ * glamourShot: attachmentField({ name: "Glamour Shot" }),
8
+ * hasPetLlama: booleanField({ name: "Has Pet Llama", required: true }),
9
+ * club: picklistField({ name: "Club", options: ["FFA", "Rex Kwon Do"] }),
10
+ * }
11
+ *
12
+ * Each factory returns a plain {@link AppField} with the `type` discriminator
13
+ * baked in — the factories are sugar over the same authoring shape, so the
14
+ * literal form (`{ name, type: "TEXT" }`) remains valid where ever an
15
+ * AppField is accepted.
16
+ */
17
+ import type { AppField, AppPicklistConfig, PicklistOption } from "../app/build.js";
18
+ import type { FieldRef } from "../../catalog/index.js";
19
+ import type { Expr, ExprType } from "./calc/types.js";
20
+ /** Options every field kind accepts (everything on {@link AppField} that isn't kind-specific). */
21
+ export interface BaseFieldOptions {
22
+ readonly name: string;
23
+ readonly required?: boolean;
24
+ readonly requiredOnClose?: boolean;
25
+ readonly showOnCreate?: boolean;
26
+ readonly lockOnCreate?: boolean;
27
+ readonly description?: string;
28
+ readonly columnName?: string;
29
+ readonly defaultValue?: unknown;
30
+ /** Platform semantic role tags for system fields (e.g. `["STATUS"]`). */
31
+ readonly tags?: readonly string[];
32
+ /**
33
+ * A calculated-field expression (from the `calc.*` builder). When set, the
34
+ * field serializes as a calculated field; the factory's kind is the
35
+ * declared output type.
36
+ */
37
+ readonly expression?: Expr<ExprType>;
38
+ }
39
+ /** Extra options for the picklist kinds (`picklistField` / `multiPicklistField`). */
40
+ export interface PicklistFieldOptions extends BaseFieldOptions {
41
+ /** Static options; omit for dynamic picklists (`config.dynamic`). */
42
+ readonly options?: readonly (string | PicklistOption)[];
43
+ /** Parent picklist for a dependent dropdown. */
44
+ readonly parentField?: FieldRef;
45
+ readonly config?: AppPicklistConfig;
46
+ }
47
+ /** Extra options for the numeric kinds (`numberField` / `decimalField`). */
48
+ export interface NumericFieldOptions extends BaseFieldOptions {
49
+ readonly numericFormat?: Record<string, unknown>;
50
+ /** `decimalField` only — display/storage precision. */
51
+ readonly decimalPlaces?: number;
52
+ }
53
+ /** Extra options for `textField`. */
54
+ export interface TextFieldOptions extends BaseFieldOptions {
55
+ readonly qrFormat?: Record<string, unknown>;
56
+ }
57
+ /**
58
+ * Options for `relationField` — a dynamic dropdown sourced from another
59
+ * App/Element/Task's records (`elementum_relation_field`), distinct from a
60
+ * static `picklistField`. `relatedAspectId`/`relatedLabelFieldId` are raw
61
+ * platform ids (see {@link RelationAppField}), not catalog tokens.
62
+ */
63
+ export interface RelationFieldOptions extends BaseFieldOptions {
64
+ readonly relatedAspectId: string;
65
+ readonly relatedLabelFieldId: string;
66
+ /** Defaults to `true` on the platform. */
67
+ readonly autoRelate?: boolean;
68
+ }
69
+ export declare function textField(opts: TextFieldOptions): AppField & {
70
+ readonly type: "TEXT";
71
+ };
72
+ export declare function htmlField(opts: BaseFieldOptions): AppField & {
73
+ readonly type: "HTML";
74
+ };
75
+ export declare function numberField(opts: NumericFieldOptions): AppField & {
76
+ readonly type: "NUMBER";
77
+ };
78
+ export declare function decimalField(opts: NumericFieldOptions): AppField & {
79
+ readonly type: "DECIMAL";
80
+ };
81
+ export declare function booleanField(opts: BaseFieldOptions): AppField & {
82
+ readonly type: "BOOLEAN";
83
+ };
84
+ export declare function dateField(opts: BaseFieldOptions): AppField & {
85
+ readonly type: "DATE";
86
+ };
87
+ export declare function dateTimeField(opts: BaseFieldOptions): AppField & {
88
+ readonly type: "DATETIME";
89
+ };
90
+ export declare function userField(opts: BaseFieldOptions): AppField & {
91
+ readonly type: "USER";
92
+ };
93
+ export declare function groupField(opts: BaseFieldOptions): AppField & {
94
+ readonly type: "GROUP";
95
+ };
96
+ export declare function attachmentField(opts: BaseFieldOptions): AppField & {
97
+ readonly type: "ATTACHMENT";
98
+ };
99
+ export declare function jsonField(opts: BaseFieldOptions): AppField & {
100
+ readonly type: "JSON";
101
+ };
102
+ export declare function picklistField(opts: PicklistFieldOptions): AppField & {
103
+ readonly type: "PICKLIST";
104
+ };
105
+ export declare function multiPicklistField(opts: PicklistFieldOptions): AppField & {
106
+ readonly type: "MULTI_PICKLIST";
107
+ };
108
+ export declare function relationField(opts: RelationFieldOptions): AppField & {
109
+ readonly type: "RELATION";
110
+ };
111
+ /** Authoring field type → its factory's exported name (the printer's emission table). */
112
+ export declare const FIELD_FACTORY_BY_TYPE: ReadonlyMap<string, string>;
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Typed field factories — the authoring surface for `defineApp`'s (and
3
+ * `defineElement`'s) `fields:` bag. One factory per field sub-type row
4
+ * (types.ts), each taking only the options valid for its kind:
5
+ *
6
+ * fields: {
7
+ * glamourShot: attachmentField({ name: "Glamour Shot" }),
8
+ * hasPetLlama: booleanField({ name: "Has Pet Llama", required: true }),
9
+ * club: picklistField({ name: "Club", options: ["FFA", "Rex Kwon Do"] }),
10
+ * }
11
+ *
12
+ * Each factory returns a plain {@link AppField} with the `type` discriminator
13
+ * baked in — the factories are sugar over the same authoring shape, so the
14
+ * literal form (`{ name, type: "TEXT" }`) remains valid where ever an
15
+ * AppField is accepted.
16
+ */
17
+ // Generic over the literal type discriminator so a field factory's return
18
+ // type carries e.g. `type: "PICKLIST"`, not the widened `WorkflowFieldType`
19
+ // union — required for the live catalog path (`defineApp`'s `.ref()`) to
20
+ // preserve per-field literal typing all the way to `RecordShape`
21
+ // (`entities/field/record-shape.ts`), the same way the old baked
22
+ // `fieldRef({ fieldType: "PICKLIST" })` literal did.
23
+ function field(type, opts) {
24
+ return { ...opts, type };
25
+ }
26
+ export function textField(opts) {
27
+ return field("TEXT", opts);
28
+ }
29
+ export function htmlField(opts) {
30
+ return field("HTML", opts);
31
+ }
32
+ export function numberField(opts) {
33
+ return field("NUMBER", opts);
34
+ }
35
+ export function decimalField(opts) {
36
+ return field("DECIMAL", opts);
37
+ }
38
+ export function booleanField(opts) {
39
+ return field("BOOLEAN", opts);
40
+ }
41
+ export function dateField(opts) {
42
+ return field("DATE", opts);
43
+ }
44
+ export function dateTimeField(opts) {
45
+ return field("DATETIME", opts);
46
+ }
47
+ export function userField(opts) {
48
+ return field("USER", opts);
49
+ }
50
+ export function groupField(opts) {
51
+ return field("GROUP", opts);
52
+ }
53
+ export function attachmentField(opts) {
54
+ return field("ATTACHMENT", opts);
55
+ }
56
+ export function jsonField(opts) {
57
+ return field("JSON", opts);
58
+ }
59
+ export function picklistField(opts) {
60
+ return field("PICKLIST", opts);
61
+ }
62
+ export function multiPicklistField(opts) {
63
+ return field("MULTI_PICKLIST", opts);
64
+ }
65
+ export function relationField(opts) {
66
+ return field("RELATION", opts);
67
+ }
68
+ /** Authoring field type → its factory's exported name (the printer's emission table). */
69
+ export const FIELD_FACTORY_BY_TYPE = new Map([
70
+ ["TEXT", "textField"],
71
+ ["HTML", "htmlField"],
72
+ ["NUMBER", "numberField"],
73
+ ["DECIMAL", "decimalField"],
74
+ ["BOOLEAN", "booleanField"],
75
+ ["DATE", "dateField"],
76
+ ["DATETIME", "dateTimeField"],
77
+ ["USER", "userField"],
78
+ ["GROUP", "groupField"],
79
+ ["ATTACHMENT", "attachmentField"],
80
+ ["JSON", "jsonField"],
81
+ ["PICKLIST", "picklistField"],
82
+ ["MULTI_PICKLIST", "multiPicklistField"],
83
+ ["RELATION", "relationField"],
84
+ ]);
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Tier-2 specialized aggregations — `countIf`, `sumIf`, `stringAgg`,
3
+ * `stringAggUnique`. These have argument shapes that don't fit the
4
+ * generic aggregation pattern in `index.ts`:
5
+ *
6
+ * - `countIf` / `sumIf` accept a *predicate text* second argument
7
+ * (e.g. `'>30'`, `'<30'`, `'30'`). The EDK models this as a
8
+ * structured `Predicate` object — `{ op, value }` — so the
9
+ * comparison operator is a typed literal union rather than a
10
+ * free-form string. The serializer assembles the wire predicate
11
+ * text.
12
+ *
13
+ * - `stringAgg` accepts an optional `ORDER BY` clause embedded
14
+ * inside its separator argument on the wire. The EDK models that
15
+ * as a structured `orderBy` option — `{ field, direction }`. The
16
+ * direction defaults to ASC if omitted.
17
+ */
18
+ import type { Expr, ExprLike, ExprType } from "./types.js";
19
+ /** Comparison operators the wire `COUNTIF` / `SUMIF` predicate accepts. */
20
+ export type PredicateOp = "=" | ">" | "<" | ">=" | "<=" | "!=";
21
+ /**
22
+ * Predicate for `countIf` / `sumIf`. The operator defaults to `"="`
23
+ * when omitted (matches the wire form: a bare value like `'30'` means
24
+ * "equal to 30"). The value is stringified before quoting.
25
+ */
26
+ export interface Predicate {
27
+ readonly op?: PredicateOp;
28
+ readonly value: string | number;
29
+ }
30
+ /**
31
+ * Count rows where `field` matches the predicate. Wire form:
32
+ * `COUNTIF(field, 'predicate')` — the predicate is a quoted string
33
+ * with the comparison operator prefix (e.g. `'>30'`) and value.
34
+ */
35
+ export declare function countIf<T extends ExprType>(field: ExprLike<T>, predicate: Predicate): Expr<"number">;
36
+ /**
37
+ * Sum rows of `field` where the value matches the predicate. Wire form:
38
+ * `SUMIF(field, 'predicate')`. Output brand is `decimal` — server may
39
+ * return either NUMBER or DECIMAL depending on input; we collapse to
40
+ * the wider brand.
41
+ */
42
+ export declare function sumIf(field: ExprLike<"number"> | ExprLike<"decimal">, predicate: Predicate): Expr<"decimal">;
43
+ /** Sort direction for the optional `ORDER BY` clause on `stringAgg`. */
44
+ export type OrderByDirection = "ASC" | "DESC";
45
+ /**
46
+ * Optional ORDER BY shape for `stringAgg` / `stringAggUnique`. The
47
+ * field can be any expression — typically the same field being
48
+ * aggregated, but the server accepts any.
49
+ */
50
+ export interface StringAggOrderBy {
51
+ readonly field: ExprLike<ExprType>;
52
+ readonly direction?: OrderByDirection;
53
+ }
54
+ /**
55
+ * Concatenate `field` values across related rows, separated by
56
+ * `separator`. Optional `orderBy` controls row ordering.
57
+ */
58
+ export declare function stringAgg(field: ExprLike<ExprType>, separator: ExprLike<"text">, orderBy?: StringAggOrderBy): Expr<"text">;
59
+ /** Distinct-only variant of `stringAgg`. Server emits duplicates once. */
60
+ export declare function stringAggUnique(field: ExprLike<ExprType>, separator: ExprLike<"text">, orderBy?: StringAggOrderBy): Expr<"text">;
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Tier-2 specialized aggregations — `countIf`, `sumIf`, `stringAgg`,
3
+ * `stringAggUnique`. These have argument shapes that don't fit the
4
+ * generic aggregation pattern in `index.ts`:
5
+ *
6
+ * - `countIf` / `sumIf` accept a *predicate text* second argument
7
+ * (e.g. `'>30'`, `'<30'`, `'30'`). The EDK models this as a
8
+ * structured `Predicate` object — `{ op, value }` — so the
9
+ * comparison operator is a typed literal union rather than a
10
+ * free-form string. The serializer assembles the wire predicate
11
+ * text.
12
+ *
13
+ * - `stringAgg` accepts an optional `ORDER BY` clause embedded
14
+ * inside its separator argument on the wire. The EDK models that
15
+ * as a structured `orderBy` option — `{ field, direction }`. The
16
+ * direction defaults to ASC if omitted.
17
+ */
18
+ import { coerce, emitStringLiteral, makeExpr } from "./runtime.js";
19
+ function formatPredicate(p) {
20
+ const op = p.op === undefined || p.op === "=" ? "" : p.op;
21
+ return emitStringLiteral(`${op}${String(p.value)}`);
22
+ }
23
+ // ---------------------------------------------------------------------------
24
+ // COUNTIF / SUMIF
25
+ // ---------------------------------------------------------------------------
26
+ /**
27
+ * Count rows where `field` matches the predicate. Wire form:
28
+ * `COUNTIF(field, 'predicate')` — the predicate is a quoted string
29
+ * with the comparison operator prefix (e.g. `'>30'`) and value.
30
+ */
31
+ export function countIf(field, predicate) {
32
+ const f = coerce(field);
33
+ return makeExpr("number", () => `COUNTIF(${f.toCalcString()}, ${formatPredicate(predicate)})`);
34
+ }
35
+ /**
36
+ * Sum rows of `field` where the value matches the predicate. Wire form:
37
+ * `SUMIF(field, 'predicate')`. Output brand is `decimal` — server may
38
+ * return either NUMBER or DECIMAL depending on input; we collapse to
39
+ * the wider brand.
40
+ */
41
+ export function sumIf(field, predicate) {
42
+ const f = coerce(field);
43
+ return makeExpr("decimal", () => `SUMIF(${f.toCalcString()}, ${formatPredicate(predicate)})`);
44
+ }
45
+ function formatStringAggArgs(field, separator, orderBy) {
46
+ const f = coerce(field);
47
+ const s = coerce(separator);
48
+ if (orderBy === undefined) {
49
+ return `${f.toCalcString()}, ${s.toCalcString()}`;
50
+ }
51
+ const o = coerce(orderBy.field);
52
+ const dir = orderBy.direction ?? "ASC";
53
+ // Wire form: STRING_AGG(field, 'sep' ORDER BY orderField DIR) —
54
+ // the ORDER BY clause is embedded inside the second arg slot per
55
+ // the ANTLR grammar.
56
+ const dirSuffix = dir === "ASC" ? "" : ` ${dir}`;
57
+ return `${f.toCalcString()}, ${s.toCalcString()} ORDER BY ${o.toCalcString()}${dirSuffix}`;
58
+ }
59
+ /**
60
+ * Concatenate `field` values across related rows, separated by
61
+ * `separator`. Optional `orderBy` controls row ordering.
62
+ */
63
+ export function stringAgg(field, separator, orderBy) {
64
+ const inner = formatStringAggArgs(field, separator, orderBy);
65
+ return makeExpr("text", () => `STRING_AGG(${inner})`);
66
+ }
67
+ /** Distinct-only variant of `stringAgg`. Server emits duplicates once. */
68
+ export function stringAggUnique(field, separator, orderBy) {
69
+ const inner = formatStringAggArgs(field, separator, orderBy);
70
+ return makeExpr("text", () => `STRING_AGG_UNIQUE(${inner})`);
71
+ }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Tier-2 date and date/time builders for the calc DSL.
3
+ *
4
+ * The platform's calc grammar treats DATE and DATETIME as distinct
5
+ * brands — DATE is calendar date (no time component), DATETIME is
6
+ * instant-in-time. Most extraction functions accept either, and a few
7
+ * builders are DATETIME-only (HOUR, MINUTE, SECOND, DATETIME_TRUNC).
8
+ *
9
+ * Constrained string arguments are typed as literal unions so the
10
+ * agent gets autocomplete and compile-time validation:
11
+ * - `dateDif` unit: 'D' | 'H' | 'M'
12
+ * - `dateTimeTrunc` precision: a date-part literal union
13
+ * - `weekday` mode: 1 | 2 | 3
14
+ */
15
+ import type { Expr, ExprLike } from "./types.js";
16
+ /** Either a DATE-typed or DATETIME-typed expression. */
17
+ type DateOrDateTimeLike = ExprLike<"date"> | ExprLike<"datetime">;
18
+ /** Current instant. Wire `NOW()`. Returns DATETIME. */
19
+ export declare function now(): Expr<"datetime">;
20
+ /** Today's calendar date. Wire `TODAY()`. Returns DATE. */
21
+ export declare function today(): Expr<"date">;
22
+ /**
23
+ * Build a DATE from numeric year / month / day components.
24
+ * Wire `DATE(year, month, day)`. The `make` prefix avoids colliding
25
+ * with the JS `Date` global if someone destructures `calc`.
26
+ */
27
+ export declare function makeDate(year: ExprLike<"number">, month: ExprLike<"number">, day: ExprLike<"number">): Expr<"date">;
28
+ /**
29
+ * Parse a text expression into a DATE. The server accepts ISO-style
30
+ * `YYYY-MM-DD` literals; with a text expression as input the server
31
+ * does a TRY_CAST and returns null on parse failure.
32
+ */
33
+ export declare function dateValue(value: ExprLike<"text">): Expr<"date">;
34
+ /** Unit codes accepted by the wire `DATEDIF` function. */
35
+ export type DateDifUnit = "D" | "H" | "M";
36
+ /**
37
+ * Difference between `end` and `start` in the specified unit.
38
+ * - `'D'` — days
39
+ * - `'H'` — hours
40
+ * - `'M'` — months
41
+ */
42
+ export declare function dateDif(start: DateOrDateTimeLike, end: DateOrDateTimeLike, unit: DateDifUnit): Expr<"number">;
43
+ /** Precision values accepted by the wire `DATETIME_TRUNC` function. */
44
+ export type DateTimeTruncPrecision = "YEAR" | "QUARTER" | "MONTH" | "WEEK" | "DAY" | "HOUR" | "MINUTE" | "SECOND";
45
+ /**
46
+ * Truncate a DATETIME to the given precision. E.g.
47
+ * `dateTimeTrunc(t, "MONTH")` returns the first instant of `t`'s month.
48
+ */
49
+ export declare function dateTimeTrunc(value: ExprLike<"datetime">, precision: DateTimeTruncPrecision): Expr<"datetime">;
50
+ /**
51
+ * Modes accepted by the wire `WEEKDAY` function.
52
+ * - 1 — Sunday=1 .. Saturday=7 (default)
53
+ * - 2 — Monday=1 .. Sunday=7
54
+ * - 3 — Monday=0 .. Sunday=6
55
+ */
56
+ export type WeekdayMode = 1 | 2 | 3;
57
+ /**
58
+ * Day-of-week as a numeric, optionally selecting the numbering scheme.
59
+ */
60
+ export declare function weekday(value: DateOrDateTimeLike, mode?: WeekdayMode): Expr<"number">;
61
+ /** Year component as NUMBER. */
62
+ export declare function year(value: DateOrDateTimeLike): Expr<"number">;
63
+ /** Month component (1–12) as NUMBER. */
64
+ export declare function month(value: DateOrDateTimeLike): Expr<"number">;
65
+ /** Day-of-month (1–31) as NUMBER. */
66
+ export declare function day(value: DateOrDateTimeLike): Expr<"number">;
67
+ /** Hour (0–23) from a DATETIME. */
68
+ export declare function hour(value: ExprLike<"datetime">): Expr<"number">;
69
+ /** Minute (0–59) from a DATETIME. */
70
+ export declare function minute(value: ExprLike<"datetime">): Expr<"number">;
71
+ /** Second (0–59) from a DATETIME. */
72
+ export declare function second(value: ExprLike<"datetime">): Expr<"number">;
73
+ export {};