@keboola/api-client 54.0.0 → 56.0.0

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 (304) hide show
  1. package/API-SURFACE.md +3 -1
  2. package/CHANGELOG.md +61 -0
  3. package/README.md +1 -1
  4. package/dist/{adminRoles-BTKVwEy8.d.cts → adminRoles-BFOPSedO.d.cts} +2 -2
  5. package/dist/{adminRoles-Cm513r1G.d.ts → adminRoles-CUB0JddB.d.ts} +2 -2
  6. package/dist/ai/index.d.cts +2 -2
  7. package/dist/ai/index.d.ts +2 -2
  8. package/dist/ai/types.d.cts +1 -1
  9. package/dist/ai/types.d.ts +1 -1
  10. package/dist/apps/index.d.cts +2 -2
  11. package/dist/apps/index.d.ts +2 -2
  12. package/dist/apps/types.d.cts +1 -1
  13. package/dist/apps/types.d.ts +1 -1
  14. package/dist/assets/index.d.cts +1 -1
  15. package/dist/assets/index.d.ts +1 -1
  16. package/dist/auth/index.cjs +1 -1
  17. package/dist/auth/index.d.cts +1 -1
  18. package/dist/auth/index.d.ts +1 -1
  19. package/dist/auth/index.js +1 -1
  20. package/dist/auth/types.d.cts +1 -1
  21. package/dist/auth/types.d.ts +1 -1
  22. package/dist/{authClient-BM4L8XEN.js → authClient-B_Mb4Vzs.js} +3 -45
  23. package/dist/authClient-B_Mb4Vzs.js.map +1 -0
  24. package/dist/{authClient-DspK50e7.cjs → authClient-C9QqhT2M.cjs} +6 -60
  25. package/dist/authClient-C9QqhT2M.cjs.map +1 -0
  26. package/dist/{authClient-NBi0pqD5.d.cts → authClient-DOetdp2k.d.cts} +4 -4
  27. package/dist/{authClient-ij_Rm2Yn.d.ts → authClient-Dgyb0EFi.d.ts} +4 -4
  28. package/dist/billing/index.d.cts +1 -1
  29. package/dist/billing/index.d.ts +1 -1
  30. package/dist/billing/types.d.cts +1 -1
  31. package/dist/billing/types.d.ts +1 -1
  32. package/dist/chat/index.d.cts +2 -2
  33. package/dist/chat/index.d.ts +2 -2
  34. package/dist/chat/types.d.cts +1 -1
  35. package/dist/chat/types.d.ts +1 -1
  36. package/dist/collectByCursor-2-8SuJ-8.js +76 -0
  37. package/dist/collectByCursor-2-8SuJ-8.js.map +1 -0
  38. package/dist/collectByCursor-D58__WD1.cjs +105 -0
  39. package/dist/collectByCursor-D58__WD1.cjs.map +1 -0
  40. package/dist/{componentId-Cps6WBy1.js → componentId-Ba4gsJ9O.js} +3 -1
  41. package/dist/componentId-Ba4gsJ9O.js.map +1 -0
  42. package/dist/{componentId-_tRhEv6W.cjs → componentId-Ba_1Gv_A.cjs} +3 -1
  43. package/dist/componentId-Ba_1Gv_A.cjs.map +1 -0
  44. package/dist/componentsMcp/index.d.cts +1 -1
  45. package/dist/componentsMcp/index.d.ts +1 -1
  46. package/dist/componentsMcp/types.d.cts +1 -1
  47. package/dist/componentsMcp/types.d.ts +1 -1
  48. package/dist/constants/index.cjs +3 -2
  49. package/dist/constants/index.d.cts +4 -4
  50. package/dist/constants/index.d.ts +4 -4
  51. package/dist/constants/index.js +3 -3
  52. package/dist/{constants-DLPkpnGv.js → constants-HccvU5kx.js} +9 -2
  53. package/dist/constants-HccvU5kx.js.map +1 -0
  54. package/dist/{constants-Day8CU5i.cjs → constants-V9hAyPTo.cjs} +14 -1
  55. package/dist/constants-V9hAyPTo.cjs.map +1 -0
  56. package/dist/dataScience/index.d.cts +3 -3
  57. package/dist/dataScience/index.d.ts +3 -3
  58. package/dist/dataScience/types.d.cts +1 -1
  59. package/dist/dataScience/types.d.ts +1 -1
  60. package/dist/developerPortal/index.d.cts +2 -2
  61. package/dist/developerPortal/index.d.ts +2 -2
  62. package/dist/developerPortal/types.d.cts +1 -1
  63. package/dist/developerPortal/types.d.ts +1 -1
  64. package/dist/domain/permissions/index.d.cts +1 -1
  65. package/dist/domain/permissions/index.d.ts +1 -1
  66. package/dist/editor/index.d.cts +2 -2
  67. package/dist/editor/index.d.ts +2 -2
  68. package/dist/editor/types.d.cts +1 -1
  69. package/dist/editor/types.d.ts +1 -1
  70. package/dist/encryption/index.d.cts +1 -1
  71. package/dist/encryption/index.d.ts +1 -1
  72. package/dist/encryption/types.d.cts +1 -1
  73. package/dist/encryption/types.d.ts +1 -1
  74. package/dist/import/index.d.cts +3 -3
  75. package/dist/import/index.d.ts +3 -3
  76. package/dist/{index-DLWMm1-T.d.ts → index-A8udJCGv.d.ts} +4 -4
  77. package/dist/{index-d9zxFmNI.d.cts → index-B-HhOTVk.d.cts} +4 -4
  78. package/dist/{index-BVe4S2CK.d.ts → index-B2YNTI4p.d.ts} +4 -4
  79. package/dist/{index-CEDjFidH.d.ts → index-B30dBBBH.d.ts} +3 -3
  80. package/dist/{index-DbStyQKc.d.ts → index-B7Ogo2SK.d.ts} +12 -3
  81. package/dist/{index-CdeWTy8t.d.ts → index-BH1jo-bb.d.ts} +4 -4
  82. package/dist/{index-DTGOEke4.d.ts → index-BaJ-GMa7.d.ts} +3 -3
  83. package/dist/{index-DzqHh0lE.d.ts → index-Bgu3hnMO.d.ts} +528 -32
  84. package/dist/{index-DCfumWzq.d.ts → index-C6FI_Lc7.d.ts} +3 -3
  85. package/dist/{index-BGE3eZfd.d.cts → index-CLqZfRpv.d.cts} +3 -3
  86. package/dist/{index-CZvBjQvl.d.ts → index-CLxvW_pn.d.ts} +4 -4
  87. package/dist/{index-CQNwp6wX.d.ts → index-C_A0JS9s.d.ts} +3 -3
  88. package/dist/{index-B04rWq_0.d.cts → index-CmtqbTse.d.cts} +3 -3
  89. package/dist/{index-DX7qciZA.d.cts → index-CpidrJQc.d.cts} +528 -32
  90. package/dist/{index-Cd0naVic.d.cts → index-CxoJuIzB.d.cts} +12 -3
  91. package/dist/{index-B8K-Bbdq.d.cts → index-DAb1g6je.d.cts} +3 -3
  92. package/dist/{index-BtvWJBYh.d.cts → index-DPhGNQC5.d.cts} +150 -67
  93. package/dist/{index-CNJBmCHM.d.cts → index-DXNRd61K.d.cts} +4 -4
  94. package/dist/{index-FrsEkDvX.d.cts → index-DcKc3_Y1.d.cts} +3 -2
  95. package/dist/{index-FrsEkDvX.d.ts → index-DcKc3_Y1.d.ts} +3 -2
  96. package/dist/{index-8QhOqFLY.d.cts → index-Dx02AUpZ.d.cts} +4 -4
  97. package/dist/{index-BXgjPlZN.d.cts → index-DxbqDi_0.d.cts} +4 -4
  98. package/dist/{index-Df30jjpZ.d.ts → index-GlHJ4j3a.d.ts} +150 -67
  99. package/dist/{index-iFCann29.d.cts → index-RHYdFrfn.d.cts} +3 -3
  100. package/dist/index.cjs +14 -19
  101. package/dist/index.cjs.map +1 -1
  102. package/dist/index.d.cts +6 -6
  103. package/dist/index.d.ts +6 -6
  104. package/dist/index.js +10 -15
  105. package/dist/index.js.map +1 -1
  106. package/dist/kaiAgent/index.d.cts +2 -2
  107. package/dist/kaiAgent/index.d.ts +2 -2
  108. package/dist/kaiAgent/types.d.cts +1 -1
  109. package/dist/kaiAgent/types.d.ts +1 -1
  110. package/dist/management/index.cjs +1 -1
  111. package/dist/management/index.d.cts +1 -1
  112. package/dist/management/index.d.ts +1 -1
  113. package/dist/management/index.js +1 -1
  114. package/dist/management/types.d.cts +2 -2
  115. package/dist/management/types.d.ts +2 -2
  116. package/dist/{management-BAfg8BmK.js → management-BlMQnPNS.js} +10 -16
  117. package/dist/management-BlMQnPNS.js.map +1 -0
  118. package/dist/{management-BuNIc7Mr.cjs → management-dIMrTTpI.cjs} +10 -16
  119. package/dist/management-dIMrTTpI.cjs.map +1 -0
  120. package/dist/{metaObject-D7oudegV.d.cts → metaObject-BsBMgWRt.d.cts} +2 -2
  121. package/dist/{metaObject-ClvW342q.d.ts → metaObject-qWyZAD-5.d.ts} +2 -2
  122. package/dist/metastore/index.d.cts +1 -1
  123. package/dist/metastore/index.d.ts +1 -1
  124. package/dist/metastore/types.d.cts +1 -1
  125. package/dist/metastore/types.d.ts +1 -1
  126. package/dist/microsoftGraph/index.d.cts +2 -2
  127. package/dist/microsoftGraph/index.d.ts +2 -2
  128. package/dist/microsoftGraph/types.d.cts +1 -1
  129. package/dist/microsoftGraph/types.d.ts +1 -1
  130. package/dist/notifications/index.d.cts +2 -2
  131. package/dist/notifications/index.d.ts +2 -2
  132. package/dist/notifications/types.d.cts +1 -1
  133. package/dist/notifications/types.d.ts +1 -1
  134. package/dist/oauth/index.cjs +1 -1
  135. package/dist/oauth/index.d.cts +9 -2
  136. package/dist/oauth/index.d.ts +9 -2
  137. package/dist/oauth/index.js +1 -1
  138. package/dist/oauth/types.d.cts +2 -2
  139. package/dist/oauth/types.d.ts +2 -2
  140. package/dist/{oauth-CXcrilOp.cjs → oauth-CEW2AvDV.cjs} +9 -1
  141. package/dist/{oauth-CXcrilOp.cjs.map → oauth-CEW2AvDV.cjs.map} +1 -1
  142. package/dist/{oauth-Ci0qeaS2.js → oauth-Fri6IthS.js} +9 -1
  143. package/dist/{oauth-Ci0qeaS2.js.map → oauth-Fri6IthS.js.map} +1 -1
  144. package/dist/omnisearch/index.d.cts +2 -2
  145. package/dist/omnisearch/index.d.ts +2 -2
  146. package/dist/omnisearch/types.d.cts +1 -1
  147. package/dist/omnisearch/types.d.ts +1 -1
  148. package/dist/{project-DS0HOV3M.d.ts → project-CmV1OhK4.d.ts} +3 -3
  149. package/dist/{project-BGk9CtOq.d.cts → project-F6eHCACz.d.cts} +3 -3
  150. package/dist/queryService/index.d.cts +1 -1
  151. package/dist/queryService/index.d.ts +1 -1
  152. package/dist/queryService/types.d.cts +1 -1
  153. package/dist/queryService/types.d.ts +1 -1
  154. package/dist/queue/index.d.cts +3 -3
  155. package/dist/queue/index.d.ts +3 -3
  156. package/dist/queue/types.d.cts +1 -1
  157. package/dist/queue/types.d.ts +1 -1
  158. package/dist/scheduler/index.d.cts +2 -2
  159. package/dist/scheduler/index.d.ts +2 -2
  160. package/dist/scheduler/types.d.cts +1 -1
  161. package/dist/scheduler/types.d.ts +1 -1
  162. package/dist/sdk/configurations/index.cjs +47 -2
  163. package/dist/sdk/configurations/index.cjs.map +1 -1
  164. package/dist/sdk/configurations/index.d.cts +231 -3
  165. package/dist/sdk/configurations/index.d.ts +231 -3
  166. package/dist/sdk/configurations/index.js +47 -2
  167. package/dist/sdk/configurations/index.js.map +1 -1
  168. package/dist/sdk/dataAppServer/index.cjs +1 -1
  169. package/dist/sdk/dataAppServer/index.cjs.map +1 -1
  170. package/dist/sdk/dataAppServer/index.d.cts +1 -1
  171. package/dist/sdk/dataAppServer/index.d.ts +1 -1
  172. package/dist/sdk/dataAppServer/index.js +1 -1
  173. package/dist/sdk/dataAppServer/index.js.map +1 -1
  174. package/dist/sdk/developerPortal/index.d.cts +3 -3
  175. package/dist/sdk/developerPortal/index.d.ts +3 -3
  176. package/dist/sdk/kaiMemory/index.d.cts +1 -1
  177. package/dist/sdk/kaiMemory/index.d.ts +1 -1
  178. package/dist/sdk/kaiMemory/types.d.cts +1 -1
  179. package/dist/sdk/kaiMemory/types.d.ts +1 -1
  180. package/dist/sdk/queryService/index.d.cts +1 -1
  181. package/dist/sdk/queryService/index.d.ts +1 -1
  182. package/dist/sdk/securityPolicy/index.cjs +13 -3
  183. package/dist/sdk/securityPolicy/index.cjs.map +1 -1
  184. package/dist/sdk/securityPolicy/index.d.cts +13 -3
  185. package/dist/sdk/securityPolicy/index.d.ts +13 -3
  186. package/dist/sdk/securityPolicy/index.js +12 -4
  187. package/dist/sdk/securityPolicy/index.js.map +1 -1
  188. package/dist/sdk/securityPolicy/types.d.cts +1 -1
  189. package/dist/sdk/securityPolicy/types.d.ts +1 -1
  190. package/dist/sdk/semanticLayer/index.d.cts +1 -1
  191. package/dist/sdk/semanticLayer/index.d.ts +1 -1
  192. package/dist/sdk/semanticLayer/types.d.cts +1 -1
  193. package/dist/sdk/semanticLayer/types.d.ts +1 -1
  194. package/dist/sdk/tag/index.d.cts +2 -2
  195. package/dist/sdk/tag/index.d.ts +2 -2
  196. package/dist/sdk/tag/types.d.cts +1 -1
  197. package/dist/sdk/tag/types.d.ts +1 -1
  198. package/dist/sdk/vault/index.cjs +3 -12
  199. package/dist/sdk/vault/index.cjs.map +1 -1
  200. package/dist/sdk/vault/index.d.cts +1 -1
  201. package/dist/sdk/vault/index.d.ts +1 -1
  202. package/dist/sdk/vault/index.js +3 -12
  203. package/dist/sdk/vault/index.js.map +1 -1
  204. package/dist/status/index.d.cts +1 -1
  205. package/dist/status/index.d.ts +1 -1
  206. package/dist/storage/index.cjs +4 -4
  207. package/dist/storage/index.d.cts +3 -3
  208. package/dist/storage/index.d.ts +3 -3
  209. package/dist/storage/index.js +2 -2
  210. package/dist/storage/types.d.cts +6 -6
  211. package/dist/storage/types.d.ts +6 -6
  212. package/dist/{storage--2FvvLAw.js → storage-Bw-HSnPp.js} +56 -3
  213. package/dist/storage-Bw-HSnPp.js.map +1 -0
  214. package/dist/{storage-BMrYlyLB.cjs → storage-jLhVrKZh.cjs} +58 -5
  215. package/dist/storage-jLhVrKZh.cjs.map +1 -0
  216. package/dist/stream/index.d.cts +2 -2
  217. package/dist/stream/index.d.ts +2 -2
  218. package/dist/stream/types.d.cts +1 -1
  219. package/dist/stream/types.d.ts +1 -1
  220. package/dist/syncActions/index.cjs +1 -1
  221. package/dist/syncActions/index.d.cts +2 -2
  222. package/dist/syncActions/index.d.ts +2 -2
  223. package/dist/syncActions/index.js +1 -1
  224. package/dist/syncActions/types.d.cts +1 -1
  225. package/dist/syncActions/types.d.ts +1 -1
  226. package/dist/{syncActions-CR7xvuIv.cjs → syncActions-B9JTiSao.cjs} +2 -2
  227. package/dist/{syncActions-CR7xvuIv.cjs.map → syncActions-B9JTiSao.cjs.map} +1 -1
  228. package/dist/{syncActions-CU4cIGRf.js → syncActions-W98Jme2Z.js} +2 -2
  229. package/dist/{syncActions-CU4cIGRf.js.map → syncActions-W98Jme2Z.js.map} +1 -1
  230. package/dist/telemetry/index.d.cts +2 -2
  231. package/dist/telemetry/index.d.ts +2 -2
  232. package/dist/telemetry/types.d.cts +1 -1
  233. package/dist/telemetry/types.d.ts +1 -1
  234. package/dist/{types-B6f6LpZ_.d.cts → types--mz2z0Zm.d.cts} +2 -2
  235. package/dist/{types-B7FKoyfy.d.cts → types-2CMPwArl.d.ts} +820 -389
  236. package/dist/{types-CRC4lbPw.d.cts → types-3ZE32k8V.d.cts} +2 -2
  237. package/dist/{types-Do3__S4Q.d.cts → types-6oLbURTK.d.cts} +2 -2
  238. package/dist/{types-B4Vwz45w.d.cts → types-B452bFfS.d.ts} +2 -2
  239. package/dist/{types-zlYUn0oi.d.ts → types-B5FgsIiY.d.ts} +3 -3
  240. package/dist/{types-DFcj9YyQ.d.ts → types-B6OG1lLf.d.cts} +222 -55
  241. package/dist/{types-DNwIMEuB.d.cts → types-BDGkMVWf.d.cts} +2 -2
  242. package/dist/{types-CQYyULrw.d.ts → types-BEEGI4aq.d.ts} +2 -2
  243. package/dist/{types-Bv2Ds1hL.d.cts → types-BJRRAQ9R.d.cts} +2 -2
  244. package/dist/{types-D5bxXqEU.d.ts → types-B_yv00AL.d.ts} +2 -2
  245. package/dist/{types-DoSZQ1Bi.d.ts → types-BhGr9OQ4.d.ts} +2 -2
  246. package/dist/{types-D-ufoskb.d.cts → types-BmcZyKgM.d.cts} +17 -2
  247. package/dist/{types-dU3EA8gk.d.ts → types-BnkHyxdp.d.ts} +2 -2
  248. package/dist/{types-B4ezB18r.d.cts → types-BqJycQNM.d.cts} +2 -2
  249. package/dist/{types-CaBcgsT2.d.cts → types-ByKSM08P.d.ts} +222 -55
  250. package/dist/{types-Y4e8GGa3.d.cts → types-C3Kf_ggm.d.cts} +2 -2
  251. package/dist/{types-CIlBSV99.d.cts → types-CF5ZROX5.d.cts} +2 -2
  252. package/dist/{types-ChOJ-Az7.d.cts → types-CFuT8zr3.d.cts} +2 -2
  253. package/dist/{types-BXKL0wTI.d.cts → types-CNDemlfn.d.cts} +3 -3
  254. package/dist/{types-Rrcx-8LM.d.ts → types-CUovU--e.d.ts} +2 -2
  255. package/dist/{types-DU8aPTFW.d.cts → types-C_JO7FI9.d.cts} +2 -2
  256. package/dist/{types-BVJmcoqA.d.cts → types-CbPO9cGq.d.cts} +2 -2
  257. package/dist/{types-Dsf7CYmm.d.ts → types-Cg_66Toy.d.ts} +2 -2
  258. package/dist/{types-COb2O9c1.d.ts → types-CjqFLXVx.d.cts} +820 -389
  259. package/dist/{types-CSE8bHiq.d.cts → types-Cm1iOHE5.d.cts} +3 -3
  260. package/dist/{types-BD0B1KQ6.d.ts → types-CnKiVVb8.d.ts} +2 -2
  261. package/dist/{types-D2hhEGem.d.cts → types-CrXoqs8E.d.cts} +2 -2
  262. package/dist/{types-DCARsJWs.d.cts → types-CuYaiy4R.d.cts} +4 -4
  263. package/dist/{types-DjSjUKUl.d.ts → types-Cvbcjdgf.d.ts} +2 -2
  264. package/dist/{types-DKKHKj19.d.cts → types-D0BOES7q.d.cts} +2 -2
  265. package/dist/{types-kGZQQcIK.d.ts → types-D0Gqu-Xz.d.cts} +2 -2
  266. package/dist/{types-d5Bt8Mr3.d.ts → types-D2J3SaoY.d.ts} +2 -2
  267. package/dist/{types-Bp8G9yta.d.ts → types-D4knWlwr.d.ts} +2 -2
  268. package/dist/{types-BDgOF2WN.d.ts → types-D6Fbf_y3.d.ts} +4 -4
  269. package/dist/{types-Tg3euEN_.d.ts → types-DMEl2iet.d.ts} +2 -2
  270. package/dist/{types-CTYTMXXj.d.ts → types-DPFG6AAA.d.ts} +2 -2
  271. package/dist/{types-BynQKst1.d.cts → types-DQguGTlM.d.cts} +2 -2
  272. package/dist/{types-DbthI3r-.d.ts → types-DaRxZt3v.d.ts} +2 -2
  273. package/dist/{types-DX1Dz0xK.d.ts → types-DgAMVyiT.d.ts} +2 -2
  274. package/dist/{types-Cr6WA6CN.d.ts → types-DhE7iY90.d.ts} +17 -2
  275. package/dist/{types-B6JcEPEu.d.ts → types-DiXeO0yB.d.ts} +2 -2
  276. package/dist/{types-CKdNf_2k.d.cts → types-DslO1S5E.d.cts} +3 -3
  277. package/dist/{types-Cf0WE6qK.d.cts → types-DtS7qAdz.d.cts} +2 -2
  278. package/dist/{types-C5B3Pfob.d.cts → types-DykEfF2N.d.cts} +2 -2
  279. package/dist/{types-DSWIIMdv.d.ts → types-EdL0Eb0B.d.ts} +3 -3
  280. package/dist/{types-DK1bSUNr.d.ts → types-Foy0RnqF.d.ts} +3 -3
  281. package/dist/{types-BEw98Dd2.d.cts → types-LOf_GCej.d.cts} +2 -2
  282. package/dist/{types-OHt0D_f2.d.ts → types-lZRyNwOH.d.ts} +2 -2
  283. package/dist/{types-CepTvkfm.d.ts → types-p6UYqJo_.d.ts} +2 -2
  284. package/dist/vault/index.d.cts +1 -1
  285. package/dist/vault/index.d.ts +1 -1
  286. package/dist/vault/types.d.cts +1 -1
  287. package/dist/vault/types.d.ts +1 -1
  288. package/package.json +3 -3
  289. package/surface/management.md +25 -25
  290. package/surface/storage.md +5 -0
  291. package/dist/authClient-BM4L8XEN.js.map +0 -1
  292. package/dist/authClient-DspK50e7.cjs.map +0 -1
  293. package/dist/componentId-Cps6WBy1.js.map +0 -1
  294. package/dist/componentId-_tRhEv6W.cjs.map +0 -1
  295. package/dist/constants-DLPkpnGv.js.map +0 -1
  296. package/dist/constants-Day8CU5i.cjs.map +0 -1
  297. package/dist/management-BAfg8BmK.js.map +0 -1
  298. package/dist/management-BuNIc7Mr.cjs.map +0 -1
  299. package/dist/storage--2FvvLAw.js.map +0 -1
  300. package/dist/storage-BMrYlyLB.cjs.map +0 -1
  301. package/dist/validateConnectionStatus-DV00sDmu.js +0 -34
  302. package/dist/validateConnectionStatus-DV00sDmu.js.map +0 -1
  303. package/dist/validateConnectionStatus-ckaHcRx8.cjs +0 -51
  304. package/dist/validateConnectionStatus-ckaHcRx8.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["snowflakeCommon"],"sources":["../../../src/sdks/configurations/schemas/appDataGatewaySchema.ts","../../../src/sdks/configurations/schemas/common/dbConfig.ts","../../../src/sdks/configurations/schemas/common/dbConnection.ts","../../../src/sdks/configurations/schemas/common/forbidden.ts","../../../src/sdks/configurations/schemas/common/oauthAuthorization.ts","../../../src/sdks/configurations/schemas/common/sshTunnelSchema.ts","../../../src/sdks/configurations/schemas/common/sslSchema.ts","../../../src/sdks/configurations/schemas/appSnowflakeDwhManagerSchema.ts","../../../src/sdks/configurations/schemas/ex/exAwsS3Schema.ts","../../../src/sdks/configurations/schemas/ex/exAzureBlobStorageSchema.ts","../../../src/sdks/configurations/schemas/ex/exAzureDataLakeSchema.ts","../../../src/sdks/configurations/schemas/ex/exFtpSchema.ts","../../../src/sdks/configurations/schemas/ex/exHttpSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbDefaultSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbPgsqlSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbProgressSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbMysqlSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbMssqlSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbOracleSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbFirebirdSchema.ts","../../../src/sdks/configurations/schemas/exDb/exTeradataSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbInformixSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbSnowflakeSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbNetsuiteSchema.ts","../../../src/sdks/configurations/schemas/gooddataWriterSchema.ts","../../../src/sdks/configurations/schemas/googleAdsSchema.ts","../../../src/sdks/configurations/schemas/schedulerSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrDbDefaultSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrDbPgsqlSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrDbOracleSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrSynapseSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrRedshiftSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrDbMssqlSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrDbImpalaSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrExasolSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrFireboltSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrHiveCsasSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrThoughtspotSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrSisenseSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrDbSnowflakeSchema.ts","../../../src/sdks/configurations/createRegistry/createRegistry.ts","../../../src/sdks/configurations/registry.ts","../../../src/sdks/configurations/configurationsSdk.ts"],"sourcesContent":["import { z } from 'zod';\n\n/**\n * `keboola.app-data-gateway` — the Data Gateway provisions and manages its own Snowflake\n * workspace, so the config carries no credentials: just the id of the workspace it runs\n * against, stored at `parameters.db.workspaceId`.\n */\nexport const appDataGatewaySchema = z.object({\n parameters: z.object({\n db: z.object({\n workspaceId: z.number(),\n }),\n }),\n});\n","import { z } from 'zod';\n\n/** Wrap a `parameters.db` credential schema into the full component config shape. */\nexport const dbConfig = <Db extends z.ZodType>(db: Db) =>\n z.object({ parameters: z.object({ db }) });\n","import { z } from 'zod';\n\n/**\n * The credential fields shared by virtually every DB writer, stored at `parameters.db`.\n * Components extend this with driver-specific fields (`schema`, `warehouse`, `ssh`, …) and\n * override where they differ (e.g. Snowflake makes `#password` optional). Secret leaves use\n * the `#` prefix the encryption service recognizes.\n */\nexport const dbConnectionSchema = z.object({\n host: z.string().describe('Hostname'),\n port: z.number().describe('Port'),\n user: z.string().describe('Username'),\n '#password': z.string().describe('Password'),\n database: z.string().describe('Database Name'),\n});\n","import { z } from 'zod';\n\n/**\n * Marks a field as \"must be absent\" in one arm of a mutually-exclusive union: `z.undefined()`\n * rejects any value while `.optional()` lets the key be omitted entirely. Pairing it with a\n * required field in the sibling arm (e.g. `#password` XOR `#privateKey`) is what makes an\n * \"exactly one of\" union reject configs that set both keys — or neither — at runtime and in\n * the inferred type. Without it the arms would be open objects that silently strip the extra key.\n */\nexport const forbidden = z.undefined().optional();\n","import { z } from 'zod';\n\n/**\n * The OAuth credential reference components store under a top-level `authorization` key. `id`\n * points at the vault-stored credential; `version` is the OAuth-API version (3 on modern stacks).\n * Shared by every OAuth-backed component (Google family, Facebook, …).\n */\nexport const oauthAuthorizationSchema = z.object({\n oauth_api: z.object({\n id: z.string(),\n version: z.number().optional(),\n }),\n});\n","import { z } from 'zod';\n\nexport const sshTunnelSchema = z.object({\n enabled: z.boolean(),\n sshHost: z.string().optional(),\n user: z.string().optional(),\n sshPort: z.number().optional(),\n /** FTP passive-mode port range (e.g. `10000:10005`); only relevant to FTP extractors. */\n passivePortRange: z.string().optional(),\n keys: z\n .object({\n public: z.string().optional(),\n '#private': z.string().optional(),\n })\n .optional(),\n});\n","import { z } from 'zod';\n\n/** SSL options nested at `parameters.db.ssl` (drivers that support it, e.g. MySQL, Hive). */\nexport const sslSchema = z.object({\n enabled: z.boolean(),\n cert: z.string().optional(),\n '#key': z.string().optional(),\n ca: z.string().optional(),\n cipher: z.string().optional(),\n verifyServerCert: z.boolean().optional(),\n});\n","import { z } from 'zod';\n\nimport { forbidden } from './common';\n\n/**\n * `keboola.app-snowflake-dwh-manager` — master Snowflake connection. Auth is a password OR a\n * key-pair (exactly one). The common fields are shared; each variant requires its own secret and\n * *forbids the other* (`forbidden`), so a config carrying both — or neither — is rejected at\n * runtime and at the type level, matching the `wr-db-snowflake` XOR pattern.\n */\nconst dwhMasterBase = z.object({\n master_host: z.string(),\n master_user: z.string(),\n master_database: z.string(),\n warehouse: z.string(),\n});\n\nexport const appSnowflakeDwhManagerSchema = z.object({\n parameters: z.union([\n dwhMasterBase.extend({ '#master_password': z.string(), '#master_private_key': forbidden }),\n dwhMasterBase.extend({ '#master_private_key': z.string(), '#master_password': forbidden }),\n ]),\n});\n","import { z } from 'zod';\n\nimport { forbidden } from '../common';\n\n// `.loose()`: the auth block is validated, but the extractor's other `parameters` (bucket, key,\n// saveAs, …) are component-managed and must pass through rather than be stripped on create/update.\n/** Access-key credentials — forbids the IAM-role fields so the variants stay exclusive. */\nconst awsCredentialsAuth = z\n .object({\n loginType: z.literal('credentials'),\n accessKeyId: z.string(),\n '#secretAccessKey': z.string(),\n accountId: forbidden,\n roleName: forbidden,\n })\n .loose();\n\n/** IAM-role auth — forbids the access-key fields so the variants stay exclusive. */\nconst awsRoleAuth = z\n .object({\n loginType: z.literal('role'),\n accountId: z.string(),\n roleName: z.string(),\n accessKeyId: forbidden,\n '#secretAccessKey': forbidden,\n })\n .loose();\n\n/**\n * `keboola.ex-aws-s3` — access-key credentials OR IAM-role auth (exactly one). `loginType` is the\n * discriminant, and each arm *forbids the other* variant's fields (`z.undefined()`) so a config\n * mixing both — e.g. credentials + a stale `roleName` — is rejected rather than silently stripped.\n * The outer object is `.loose()` so top-level component-managed keys (`storage`, `processors`)\n * pass through.\n */\nexport const exAwsS3Schema = z\n .object({\n parameters: z.union([awsCredentialsAuth, awsRoleAuth]),\n })\n .loose();\n","import { z } from 'zod';\n\n/**\n * `kds-team.ex-azure-blob-storage-v2` — account name + key + container. Both levels are `.loose()`:\n * the connection block is validated, but component-managed `parameters` and top-level keys\n * (`storage`, `processors`) pass through rather than being stripped on create/update.\n */\nexport const exAzureBlobSchema = z\n .object({\n parameters: z\n .object({\n account_name: z.string(),\n '#account_key': z.string(),\n container_name: z.string(),\n })\n .loose(),\n })\n .loose();\n","import { z } from 'zod';\n\n/**\n * `kds-team.ex-azure-data-lake-gen2` — like Blob, but a `file_system` instead of a container. Both\n * levels are `.loose()`: the connection block is validated, but component-managed `parameters` and\n * top-level keys (`storage`, `processors`) pass through rather than being stripped on create/update.\n */\nexport const exAzureDataLakeSchema = z\n .object({\n parameters: z\n .object({\n account_name: z.string(),\n '#account_key': z.string(),\n file_system: z.string(),\n })\n .loose(),\n })\n .loose();\n","import { z } from 'zod';\n\nimport { forbidden, sshTunnelSchema } from '../common';\n\n/** Connection fields shared by both auth variants. */\nconst ftpConnection = z.object({\n host: z.string(),\n port: z.number(),\n connectionType: z.enum(['FTP', 'FTPS', 'SFTP']),\n username: z.string(),\n ignorePassiveAddress: z.boolean().optional(),\n ssh: sshTunnelSchema.optional(),\n path: z.string().optional(),\n onlyNewFiles: z.boolean().optional(),\n});\n\n// `.loose()`: validate the connection block but let component-managed parameter keys pass through.\n/** Password auth — forbids the private key so the variants stay exclusive. */\nconst ftpPasswordAuth = ftpConnection\n .extend({ '#password': z.string(), '#privateKey': forbidden })\n .loose();\n\n/** Private-key auth — forbids the password so the variants stay exclusive. */\nconst ftpPrivateKeyAuth = ftpConnection\n .extend({ '#privateKey': z.string(), '#password': forbidden })\n .loose();\n\n/**\n * `keboola.ex-ftp` / `keboola.ex-ftp-csas` — FTP/FTPS/SFTP server connection. Auth is a password\n * OR a private key (exactly one): each variant requires its secret and *forbids the other*\n * (`z.undefined()`), so a config with both — or neither — is rejected, and switching variants via\n * an update drops the abandoned secret (the whole `parameters` union subtree is replaced wholesale\n * by `schemaGuidedMerge`, so a partial patch must carry the complete connection block). The outer\n * object is `.loose()` so top-level component-managed keys (`storage`, `processors`) pass through.\n */\nexport const exFtpSchema = z\n .object({\n parameters: z.union([ftpPasswordAuth, ftpPrivateKeyAuth]),\n })\n .loose();\n","import { z } from 'zod';\n\n/**\n * `keboola.ex-http` — only the connection block is stable here. The request/job definitions are\n * component-managed and left unvalidated, so both levels are `.loose()`: extra `parameters` keys\n * and top-level keys (`storage`, `processors`) pass through `schema`/`inputSchema` unchanged rather\n * than being stripped on create/update.\n */\nexport const exHttpSchema = z\n .object({\n parameters: z.object({ baseUrl: z.string(), maxRedirects: z.number().optional() }).loose(),\n })\n .loose();\n","import { dbConfig, dbConnectionSchema, sshTunnelSchema } from '../common';\n\n/**\n * Default extractor credentials with an optional SSH tunnel, for the generic SSH-only drivers.\n *\n * - Keep in sync with kbc-ui's `hasSshTunnel` / `hasSsl` (`ex-db-generic/helpers.ts`).\n * - SSL-capable, tunnel-less and extra-field drivers get their own schema.\n */\nexport const exDbDefaultSchema = dbConfig(\n dbConnectionSchema.extend({ ssh: sshTunnelSchema.optional() }),\n);\n","import { dbConfig, dbConnectionSchema, sshTunnelSchema, sslSchema } from '../common';\n\n/** `keboola.ex-db-pgsql` — generic credentials that also accept SSL. */\nexport const exDbPgsqlSchema = dbConfig(\n dbConnectionSchema.extend({ ssh: sshTunnelSchema.optional(), ssl: sslSchema.optional() }),\n);\n","import { dbConfig, dbConnectionSchema } from '../common';\n\n/** `kds-team.ex-progress-db` — generic credentials, no SSH tunnel or SSL. */\nexport const exDbProgressSchema = dbConfig(dbConnectionSchema);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema, sslSchema } from '../common';\n\n/** `keboola.ex-db-mysql` — `database` optional + transaction-isolation / network-compression. */\nexport const exDbMysqlSchema = dbConfig(\n dbConnectionSchema.extend({\n database: z.string().optional(),\n transactionIsolationLevel: z\n .enum(['REPEATABLE READ', 'READ COMMITTED', 'READ UNCOMMITTED', 'SERIALIZABLE'])\n .optional(),\n networkCompression: z.boolean().optional(),\n ssh: sshTunnelSchema.optional(),\n ssl: sslSchema.optional(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema, sslSchema } from '../common';\n\n/** `keboola.ex-db-mssql` — `port` optional, otherwise the shared base. */\nexport const exDbMssqlSchema = dbConfig(\n dbConnectionSchema.extend({\n port: z.number().optional(),\n ssh: sshTunnelSchema.optional(),\n ssl: sslSchema.optional(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema } from '../common';\n\n/** `keboola.ex-db-oracle` — host/port/database all optional (tnsnames is the alternative). */\nexport const exDbOracleSchema = dbConfig(\n dbConnectionSchema.omit({ host: true, port: true, database: true }).extend({\n host: z.string().optional(),\n port: z.number().optional(),\n database: z.string().optional(),\n tnsnames: z.string().optional(),\n connectThrough: z.boolean().optional(),\n ssh: sshTunnelSchema.optional(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig } from '../common';\n\n/** `keboola.ex-db-firebird` — `dbname` + user/#password only (no host/port/database fields). */\nexport const exDbFirebirdSchema = dbConfig(\n z.object({ dbname: z.string(), user: z.string(), '#password': z.string() }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema } from '../common';\n\n/** `keboola.ex-teradata` — shared base with optional `database`. */\nexport const exTeradataSchema = dbConfig(\n dbConnectionSchema.extend({ database: z.string().optional() }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema } from '../common';\n\n/** `keboola.ex-db-informix` — Informix server name + protocol + optional locale. */\nexport const exDbInformixSchema = dbConfig(\n dbConnectionSchema.extend({\n serverName: z.string(),\n protocol: z.enum(['onsoctcp', 'onsocssl']),\n dbLocale: z.string().optional(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, forbidden } from '../common';\n\n/**\n * `keboola.ex-db-snowflake` — auth is a union: password OR key-pair (exactly one). The common\n * fields (host/port/user/database + optional schema/warehouse) are shared; each variant requires\n * its own secret and forbids the other, so a config carrying both — or neither — is rejected at\n * runtime and at the type level.\n */\nconst snowflakeCommon = dbConnectionSchema\n .omit({ '#password': true })\n .extend({ schema: z.string().optional(), warehouse: z.string().optional() });\n\nexport const exDbSnowflakeSchema = dbConfig(\n z.union([\n snowflakeCommon.extend({ '#password': z.string(), '#privateKey': forbidden }),\n snowflakeCommon.extend({ '#privateKey': z.string(), '#password': forbidden }),\n ]),\n);\n","import { z } from 'zod';\n\nimport { dbConfig } from '../common';\n\n/** `keboola.ex-db-netsuite` — SuiteAnalytics account/role + user/#password (no host/port/db). */\nexport const exDbNetsuiteSchema = dbConfig(\n z.object({\n accountId: z.string(),\n roleId: z.string(),\n user: z.string(),\n '#password': z.string(),\n }),\n);\n\n/** `kds-team.ex-netsuite` — Connect host/port + server data source + account/role. */\nexport const exKdsNetsuiteSchema = dbConfig(\n z.object({\n host: z.string(),\n port: z.number(),\n server_data_source: z.enum(['NetSuite.com', 'NetSuite2.com']),\n account_id: z.string(),\n role_id: z.string(),\n user: z.string(),\n '#password': z.string(),\n }),\n);\n","import { z } from 'zod';\n\n/**\n * A single exported column. `type` is always present and drives which of the other fields the\n * UI shows (and persists): `dataType`/`dataTypeSize` for the base types + LABEL, `reference` for\n * LABEL/HYPERLINK, `schemaReference` for REFERENCE, `format`/`dateDimension` for DATE, and\n * `sortLabel`/`sortOrder` + the `identifier*` fields for ATTRIBUTE. They're optional here since a\n * given column only carries the subset relevant to its type. Mirrors the kbc-ui column adapter\n * (`apps/kbc-ui/src/scripts/modules/gooddata-writer-v3/helpers/makeColumnDefinition.ts`).\n */\nconst gooddataColumn = z.object({\n type: z.enum([\n 'ATTRIBUTE',\n 'CONNECTION_POINT',\n 'DATE',\n 'FACT',\n 'HYPERLINK',\n 'LABEL',\n 'REFERENCE',\n 'IGNORE',\n ]),\n id: z.string().optional(),\n title: z.string().optional(),\n dataType: z.enum(['BIGINT', 'DATE', 'DECIMAL', 'INT', 'VARCHAR']).optional(),\n dataTypeSize: z.string().optional(),\n reference: z.string().optional(),\n schemaReference: z.string().optional(),\n sortLabel: z.string().optional(),\n sortOrder: z.enum(['ASC', 'DESC']).optional(),\n format: z.string().optional(),\n dateDimension: z.string().optional(),\n identifier: z.string().optional(),\n identifierLabel: z.string().optional(),\n identifierSortLabel: z.string().optional(),\n});\n\n/** One exported table: a GoodData `title`, its `columns` keyed by source column name, and an\n * optional `disabled` flag toggled when export is switched off. */\nconst gooddataTable = z.object({\n title: z.string(),\n disabled: z.boolean().optional(),\n identifier: z.string().optional(),\n columns: z.record(z.string(), gooddataColumn),\n});\n\n/** One date dimension; `template` selects the date-dimension template (`gooddata` / `keboola` /\n * a custom template id). */\nconst gooddataDimension = z.object({\n template: z.string(),\n includeTime: z.boolean().optional(),\n identifier: z.string().optional(),\n});\n\n/**\n * `keboola.gooddata-writer` — GoodData project + login credentials plus the exported model:\n * `tables` (keyed by source table id) and `dimensions` (keyed by dimension name). Both are\n * optional — a fresh config has credentials before any table/dimension is mapped — and must be\n * declared: the registry validates create/update input with a deep-partial that strips keys\n * absent from this shape, so an undeclared `tables`/`dimensions` payload would be dropped before\n * it's stored.\n */\nexport const gooddataWriterSchema = z.object({\n parameters: z.object({\n project: z.object({ pid: z.string(), backendUrl: z.string().optional() }),\n user: z.object({ login: z.string(), '#password': z.string() }),\n loadOnly: z.boolean().optional(),\n multiLoad: z.boolean().optional(),\n tables: z.record(z.string(), gooddataTable).optional(),\n dimensions: z.record(z.string(), gooddataDimension).optional(),\n }),\n});\n","import { z } from 'zod';\n\nimport { oauthAuthorizationSchema } from './common';\n\n/** `keboola.ex-google-ads` — OAuth credential reference + account selection. */\nexport const exGoogleAdsSchema = z.object({\n authorization: oauthAuthorizationSchema,\n parameters: z.object({\n customerId: z.array(z.string()),\n onlyEnabledCustomers: z.boolean().optional(),\n continueOnFailure: z.boolean().optional(),\n getAccountChildren: z.boolean().optional(),\n }),\n});\n","import { z } from 'zod';\n\n/**\n * `keboola.scheduler` — drives a target component config on a cron schedule. Unlike the\n * writer configs, scheduler state lives at the top level (no `parameters` wrapper):\n * `schedule` holds the cron expression + timezone + enabled/disabled state, `target`\n * identifies which component configuration to run.\n */\nexport const schedulerSchema = z.object({\n schedule: z.object({\n cronTab: z.string(),\n // Legacy configs predate the timezone field; the UI falls back to 'UTC' when it's\n // missing, so a config without it is still runnable. Keep it optional to match.\n timezone: z.string().optional(),\n state: z.enum(['enabled', 'disabled']),\n }),\n target: z.object({\n componentId: z.string(),\n configurationId: z.string(),\n mode: z.literal('run'),\n }),\n});\n","import { dbConfig, dbConnectionSchema, sshTunnelSchema, sslSchema } from '../common';\n\n/**\n * Default writer credentials — host/port/user/#password/database + optional SSH and SSL tunnels.\n * Shared by the writers that add no extra fields (`keboola.wr-db-mysql`, `keboola.wr-db-hive`);\n * writers that add or rename fields get their own schema.\n */\nexport const wrDbDefaultSchema = dbConfig(\n dbConnectionSchema.extend({ ssh: sshTunnelSchema.optional(), ssl: sslSchema.optional() }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema } from '../common';\n\n/** `keboola.wr-db-pgsql` — adds a required `schema`, optional SSH. */\nexport const wrDbPgsqlSchema = dbConfig(\n dbConnectionSchema.extend({ schema: z.string(), ssh: sshTunnelSchema.optional() }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema } from '../common';\n\n/** `keboola.wr-db-oracle` — optional `schema`, optional SSH. */\nexport const wrDbOracleSchema = dbConfig(\n dbConnectionSchema.extend({ schema: z.string().optional(), ssh: sshTunnelSchema.optional() }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema } from '../common';\n\n/** `keboola.wr-synapse` — optional `schema` (defaults to `dbo` in the UI). */\nexport const wrSynapseSchema = dbConfig(\n dbConnectionSchema.extend({ schema: z.string().optional() }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema } from '../common';\n\n/** `keboola.wr-redshift-v2` — required `schema`, optional SSH. */\nexport const wrRedshiftSchema = dbConfig(\n dbConnectionSchema.extend({ schema: z.string(), ssh: sshTunnelSchema.optional() }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema } from '../common';\n\n/** `keboola.wr-db-mssql-v2` — optional `instance`, required `tdsVersion`, optional SSH. */\nexport const wrDbMssqlSchema = dbConfig(\n dbConnectionSchema.extend({\n instance: z.string().optional(),\n tdsVersion: z.enum(['7.0', '7.1', '7.2', '7.3', '7.4']),\n ssh: sshTunnelSchema.optional(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema } from '../common';\n\n/** `keboola.wr-db-impala` — adds `auth_mech`, optional SSH. */\nexport const wrDbImpalaSchema = dbConfig(\n dbConnectionSchema.extend({ auth_mech: z.number(), ssh: sshTunnelSchema.optional() }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig } from '../common';\n\n/**\n * `kds-team.wr-exasol` — no `database`; auth is password OR SaaS personal-access-token\n * (`#refresh_token`), at least one required (both may coexist). Mirrors kbc-ui's\n * `apps/kbc-ui/src/scripts/modules/wr-db/templates/hasValidCredentials.ts`, which drops the\n * `#password` requirement once a `#refresh_token` is present.\n */\nconst exasolBase = z.object({\n host: z.string(),\n port: z.number(),\n user: z.string(),\n schema: z.string(),\n});\n\nexport const wrExasolSchema = dbConfig(\n z.union([\n exasolBase.extend({ '#password': z.string(), '#refresh_token': z.string().optional() }),\n exasolBase.extend({ '#refresh_token': z.string(), '#password': z.string().optional() }),\n ]),\n);\n","import { z } from 'zod';\n\nimport { dbConfig } from '../common';\n\n/** `kds-team.wr-firebolt` — no host/port; engine + AWS staging credentials. */\nexport const wrFireboltSchema = dbConfig(\n z.object({\n user: z.string(),\n '#password': z.string(),\n database: z.string(),\n aws_api_key_id: z.string(),\n '#aws_api_key_secret': z.string(),\n staging_bucket: z.string(),\n engine_name: z.string().optional(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema } from '../common';\n\n/** `kds-team.wr-hive-csas` — Hive base + Kerberos auth. */\nexport const wrHiveCsasSchema = dbConfig(\n dbConnectionSchema.extend({\n kinitPrincipal: z.string(),\n servicePrincipal: z.string(),\n config: z.string(),\n '#keytab': z.string(),\n ssh: sshTunnelSchema.optional(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema } from '../common';\n\n/** `keboola.wr-thoughtspot` — SSH tunnel creds carried as top-level fields, not nested. */\nexport const wrThoughtspotSchema = dbConfig(\n dbConnectionSchema.extend({\n schema: z.string().optional(),\n sshUser: z.string(),\n '#sshPassword': z.string(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig } from '../common';\n\n/** `keboola.wr-sisense` — uses `username` (not `user`). */\nexport const wrSisenseSchema = dbConfig(\n z.object({\n host: z.string(),\n port: z.number(),\n username: z.string(),\n '#password': z.string(),\n database: z.string(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, forbidden } from '../common';\n\n/**\n * `keboola.wr-db-snowflake` — auth is a union: password OR key-pair (exactly one). The common\n * fields (host/port/user/database/schema/warehouse) are shared; each variant requires its own\n * secret and *forbids the other* (`z.undefined()`), so a config carrying both — or neither —\n * is rejected at runtime and at the type level. Without the `forbidden` half, the variants\n * would be open objects: the extra key is excess (TS allows it) and stripped (Zod accepts it).\n */\nconst snowflakeCommon = dbConnectionSchema\n .omit({ '#password': true })\n .extend({ schema: z.string(), warehouse: z.string().optional() });\n\nexport const wrDbSnowflakeSchema = dbConfig(\n z.union([\n snowflakeCommon.extend({ '#password': z.string(), '#privateKey': forbidden }),\n snowflakeCommon.extend({ '#privateKey': z.string(), '#password': forbidden }),\n ]),\n);\n","import { z } from 'zod';\n\n/** Deep-partial any schema: objects → keys optional (recursing), unions → each member\n * deep-partialed, anything else left as-is. Lets a union schema (e.g. Snowflake's\n * password | key-pair auth) still produce a partial input schema. */\nconst partialize = (schema: z.ZodType): z.ZodType => {\n if (schema instanceof z.ZodObject) return deepPartial(schema);\n if (schema instanceof z.ZodUnion) {\n const options = (schema.options as z.ZodType[]).map(partialize);\n return z.union(options as [z.ZodType, z.ZodType, ...z.ZodType[]]);\n }\n return schema;\n};\n\nconst deepPartial = (schema: z.ZodObject): z.ZodObject => {\n const shape: Record<string, z.ZodType> = {};\n for (const [key, value] of Object.entries(schema.shape)) {\n const field = value as z.ZodType;\n const inner = field instanceof z.ZodOptional ? (field.unwrap() as z.ZodType) : field;\n shape[key] = partialize(inner);\n }\n const partial = z.object(shape).partial();\n // Preserve the source object's catchall (e.g. a `.loose()` `parameters` block that must let\n // component-managed keys pass through) — rebuilding via `z.object` would otherwise strip it.\n return schema.def.catchall ? partial.catchall(schema.def.catchall) : partial;\n};\n\nexport type Registry<M extends Record<string, z.ZodObject>> = {\n add: <const Id extends string, Schema extends z.ZodObject>(\n componentId: Id,\n schema: Schema,\n ) => Registry<M & Record<Id, Schema>>;\n get: <Id extends keyof M>(\n componentId: Id,\n ) => {\n /** The component's complete runnable schema (precise per id). */\n schema: M[Id];\n /** Its deep-partial — the accepted create/update input. Loose `z.ZodObject` (the precise\n * partial type isn't worth deriving; callers get input typing from `schema` via `z.input`). */\n inputSchema: z.ZodObject;\n };\n has: (componentId: string) => boolean;\n};\n\n/** Extracts the registered component-id union from a registry instance type. */\nexport type InferComponentId<R> = R extends Registry<infer M> ? keyof M & string : never;\n\nexport const createRegistry = (): Registry<Record<never, never>> => {\n const map = new Map<string, z.ZodObject>();\n\n const registry = {\n add(componentId: string, schema: z.ZodObject) {\n map.set(componentId, schema);\n return registry;\n },\n get(componentId: string) {\n const schema = map.get(componentId);\n if (!schema) throw new Error(`No configuration registered for component \"${componentId}\".`);\n return { schema, inputSchema: deepPartial(schema) };\n },\n has: (componentId: string) => map.has(componentId),\n };\n\n return registry as unknown as Registry<Record<never, never>>;\n};\n","import { ComponentId } from '../../constants/componentId';\n\nimport { appDataGatewaySchema } from './schemas/appDataGatewaySchema';\nimport { appSnowflakeDwhManagerSchema } from './schemas/appSnowflakeDwhManagerSchema';\nimport {\n exAwsS3Schema,\n exAzureBlobSchema,\n exAzureDataLakeSchema,\n exFtpSchema,\n exHttpSchema,\n} from './schemas/ex';\nimport {\n exDbDefaultSchema,\n exDbFirebirdSchema,\n exDbInformixSchema,\n exDbMssqlSchema,\n exDbMysqlSchema,\n exDbNetsuiteSchema,\n exDbOracleSchema,\n exDbPgsqlSchema,\n exDbProgressSchema,\n exDbSnowflakeSchema,\n exKdsNetsuiteSchema,\n exTeradataSchema,\n} from './schemas/exDb';\nimport { gooddataWriterSchema } from './schemas/gooddataWriterSchema';\nimport { exGoogleAdsSchema } from './schemas/googleAdsSchema';\nimport { schedulerSchema } from './schemas/schedulerSchema';\nimport {\n wrDbDefaultSchema,\n wrDbImpalaSchema,\n wrDbMssqlSchema,\n wrDbOracleSchema,\n wrDbPgsqlSchema,\n wrDbSnowflakeSchema,\n wrExasolSchema,\n wrFireboltSchema,\n wrHiveCsasSchema,\n wrRedshiftSchema,\n wrSisenseSchema,\n wrSynapseSchema,\n wrThoughtspotSchema,\n} from './schemas/wrDb';\nimport { createRegistry, type GetRegisteredId } from './createRegistry';\n\nexport const registry = createRegistry()\n /**\n * DB writers (`wr-db-*` family + related SaaS targets). Split into the standard writers\n * built on the shared `parameters.db` connection base and the special-cased targets whose\n * config diverges (extra auth, no host/port, or a provisioned workspace).\n */\n\n // Standard writers — host/port/user/#password/database, plus per-driver extras (schema, ssh…).\n .add(ComponentId.WR_DB_MYSQL, wrDbDefaultSchema)\n .add(ComponentId.WR_DB_PGSQL, wrDbPgsqlSchema)\n .add(ComponentId.WR_PAIRITY, wrDbPgsqlSchema) // pgsql variant\n .add(ComponentId.WR_DB_ORACLE, wrDbOracleSchema)\n .add(ComponentId.WR_DB_SNOWFLAKE, wrDbSnowflakeSchema)\n .add(ComponentId.WR_DB_SNOWFLAKE_GCS, wrDbSnowflakeSchema)\n .add(ComponentId.WR_DB_SNOWFLAKE_GCS_S3, wrDbSnowflakeSchema)\n .add(ComponentId.WR_SNOWFLAKE_BLOB_STORAGE, wrDbSnowflakeSchema)\n .add(ComponentId.WR_LOOKER_V2, wrDbSnowflakeSchema) // legacy snowflake\n .add(ComponentId.WR_SYNAPSE, wrSynapseSchema)\n .add(ComponentId.WR_REDSHIFT, wrRedshiftSchema)\n .add(ComponentId.WR_DB_MSSQL, wrDbMssqlSchema)\n .add(ComponentId.WR_DB_HIVE, wrDbDefaultSchema)\n .add(ComponentId.WR_DB_IMPALA, wrDbImpalaSchema)\n\n // Special-cased targets — diverging auth or credential shape.\n .add(ComponentId.WR_HIVE_CSAS, wrHiveCsasSchema) // Kerberos auth\n .add(ComponentId.WR_THOUGHTSPOT, wrThoughtspotSchema) // top-level SSH creds\n .add(ComponentId.WR_EXASOL, wrExasolSchema)\n .add(ComponentId.WR_FIREBOLT, wrFireboltSchema)\n .add(ComponentId.WR_SISENSE, wrSisenseSchema)\n .add(ComponentId.APP_DATA_GATEWAY, appDataGatewaySchema) // provisioned workspace, no creds\n .add(ComponentId.SCHEDULER, schedulerSchema)\n\n // App-specific writers — bespoke credential blocks.\n .add(ComponentId.APP_SNOWFLAKE_DWH_MANAGER, appSnowflakeDwhManagerSchema)\n .add(ComponentId.GOODDATA_WRITER, gooddataWriterSchema)\n\n /**\n * DB extractors (`ex-db-*` family) — same `parameters.db` credentials as the writers above.\n * Split into the generic-credentials drivers that reuse `exDbDefaultSchema` and the drivers\n * whose credentials diverge enough to need their own schema.\n */\n\n // Default credentials — host/port/user/#password/database + optional SSH tunnel.\n .add(ComponentId.EX_DB_REDSHIFT, exDbDefaultSchema)\n .add(ComponentId.EX_DB_DB2, exDbDefaultSchema)\n .add(ComponentId.EX_DB_DB2_BATA, exDbDefaultSchema)\n .add(ComponentId.EX_DB_MSSQL_CDATA, exDbDefaultSchema)\n .add(ComponentId.EX_DB_IMPALA, exDbDefaultSchema)\n .add(ComponentId.EX_DB_HIVE, exDbDefaultSchema)\n .add(ComponentId.EX_DB_HIVE_CSAS, exDbDefaultSchema)\n .add(ComponentId.EX_DB_HIVE_CSAS_TEST, exDbDefaultSchema)\n\n // Driver-specific credentials — extra/renamed fields or different SSH tunnel / SSL support.\n .add(ComponentId.EX_DB_PGSQL, exDbPgsqlSchema) // generic creds + SSL\n .add(ComponentId.EX_DB_MYSQL, exDbMysqlSchema)\n .add(ComponentId.EX_DB_MSSQL, exDbMssqlSchema)\n .add(ComponentId.EX_DB_ORACLE, exDbOracleSchema)\n .add(ComponentId.EX_DB_SNOWFLAKE, exDbSnowflakeSchema)\n .add(ComponentId.EX_DB_FIREBIRD, exDbFirebirdSchema)\n .add(ComponentId.EX_DB_NETSUITE, exDbNetsuiteSchema)\n .add(ComponentId.EX_DB_INFORMIX, exDbInformixSchema)\n .add(ComponentId.EX_TERADATA, exTeradataSchema)\n .add(ComponentId.KDS_EX_NETSUITE, exKdsNetsuiteSchema)\n .add(ComponentId.KDS_EX_PROGRESS_DB, exDbProgressSchema) // generic creds, no SSH/SSL\n // Google (OAuth) components\n .add(ComponentId.EX_GOOGLE_ADS, exGoogleAdsSchema)\n\n /**\n * File/connection extractors (`ex` family) — no shared credential base; each has its own\n * connection/credentials shape, so each is its own schema (ftp-csas reuses ftp).\n */\n .add(ComponentId.EX_HTTP, exHttpSchema)\n .add(ComponentId.EX_FTP, exFtpSchema)\n .add(ComponentId.EX_FTP_CSAS, exFtpSchema) // same shape as ftp\n .add(ComponentId.EX_AWS_S3, exAwsS3Schema)\n .add(ComponentId.KDS_EX_AZURE_BLOB_STORAGE_V2, exAzureBlobSchema)\n .add(ComponentId.KDS_EX_AZURE_DATA_LAKE_GEN2, exAzureDataLakeSchema);\n\nexport type RegisteredComponentId = GetRegisteredId<typeof registry>;\n","import type { z } from 'zod';\n\nimport type { createEncryptionClient } from '../../clients/encryption/encryptionClient';\nimport type * as storage from '../../clients/storage';\nimport type {\n BaseComponentConfig,\n ConfigurationPath,\n CreateConfigurationInput,\n UpdateConfigurationInput,\n} from '../../clients/storage/types';\nimport type { BranchRefs } from '../../domain/branchRefs';\nimport {\n assertCanCreateConfiguration,\n assertCanUpdateConfiguration,\n} from '../../domain/permissions/configurations';\nimport type { Project } from '../../domain/project';\nimport { isEmptyDeep } from '../../utils/isEmptyDeep';\nimport { schemaGuidedMerge } from '../../utils/schemaGuidedMerge';\n\nimport { type RegisteredComponentId, registry } from './registry';\n\ntype ConfigurationSdkContext = {\n project: Project;\n branchRefs: BranchRefs;\n};\n\ntype Options = {\n storageClient: ReturnType<typeof storage.createStorageClient>;\n encryptionClient: ReturnType<typeof createEncryptionClient>;\n context: ConfigurationSdkContext;\n};\n\ntype DeepPartial<T> = T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;\n\ntype ConfigurationSchema<ComponentId extends RegisteredComponentId> = z.input<\n ReturnType<typeof registry.get<ComponentId>>['schema']\n>;\n\ntype TypedConfiguration<ComponentId extends RegisteredComponentId> = {\n componentId: ComponentId;\n configuration: DeepPartial<ConfigurationSchema<ComponentId>>;\n};\n\n/**\n * How an update writes the patch against the stored configuration:\n * - `'merge'` (default) — reads the config, deep-merges by schema; credential unions and arrays are\n * replaced wholesale (dropping an abandoned secret), out-of-schema keys kept.\n * - `'replace'` — stores exactly what is sent (validated + encrypted); anything omitted,\n * e.g. `storage`, is gone.\n */\ntype UpdateMode = 'merge' | 'replace';\n\nconst toConfigResult = <ComponentId extends RegisteredComponentId>(\n data: BaseComponentConfig,\n schema: z.ZodType,\n) => {\n const result = schema.safeParse(data.configuration);\n\n return {\n data: data as BaseComponentConfig<ConfigurationSchema<ComponentId>>,\n runnable: result.success,\n error: result.error,\n };\n};\n\nexport const createConfigurationSdk = ({ storageClient, encryptionClient, context }: Options) => {\n const _encrypt = async (\n componentId: RegisteredComponentId,\n data: Record<string, unknown>,\n ): Promise<Record<string, unknown>> => {\n if (isEmptyDeep(data)) return data;\n\n return encryptionClient.encryptScopedSecrets({\n scope: 'ProjectSecure',\n componentId,\n projectId: context.project.sapiToken.owner.id,\n data,\n });\n };\n\n const getConfiguration = async <ComponentId extends RegisteredComponentId>(\n path: ConfigurationPath<ComponentId>,\n ) => {\n const data = await storageClient.configurations.getConfiguration(path);\n const def = registry.get(path.componentId);\n\n return toConfigResult<ComponentId>(data, def.schema);\n };\n\n const createConfiguration = async <ComponentId extends RegisteredComponentId>(\n input: Omit<CreateConfigurationInput<ComponentId>, 'componentId' | 'configuration'> &\n TypedConfiguration<ComponentId>,\n ) => {\n const { componentId, branchId, configuration, ...rest } = input;\n assertCanCreateConfiguration(context.project.sapiToken, {\n isDevModeActive: context.branchRefs.isDev(branchId),\n });\n const def = registry.get(componentId);\n const validated = def.inputSchema.parse(configuration);\n const encrypted = await _encrypt(componentId, validated);\n\n const data = await storageClient.configurations.createConfiguration({\n ...rest,\n branchId,\n componentId,\n configuration: encrypted,\n });\n\n return toConfigResult<ComponentId>(data, def.schema);\n };\n\n const updateConfiguration = async <ComponentId extends RegisteredComponentId>(\n input: Omit<UpdateConfigurationInput<ComponentId>, 'componentId' | 'configuration'> &\n TypedConfiguration<ComponentId> & { mode?: UpdateMode },\n ) => {\n const { componentId, branchId, configId, configuration, mode = 'merge', ...rest } = input;\n assertCanUpdateConfiguration(context.project.sapiToken, {\n isDevModeActive: context.branchRefs.isDev(branchId),\n });\n const def = registry.get(componentId);\n\n const validated = def.inputSchema.parse(configuration);\n const encrypted = await _encrypt(componentId, validated);\n\n let newConfiguration: Record<string, unknown> = encrypted;\n if (mode === 'merge') {\n const original = await storageClient.configurations.getConfiguration({\n componentId,\n branchId,\n configId,\n });\n newConfiguration = schemaGuidedMerge(def.schema, original.configuration ?? {}, encrypted);\n }\n\n const { configuration: data } = await storageClient.configurations.updateConfiguration({\n ...rest,\n branchId,\n componentId,\n configId,\n configuration: newConfiguration,\n });\n\n return toConfigResult<ComponentId>(data, def.schema);\n };\n\n return { getConfiguration, createConfiguration, updateConfiguration };\n};\n"],"mappings":";;;;;;;;;;AAOA,MAAa,uBAAuB,EAAE,OAAO,EAC3C,YAAY,EAAE,OAAO,EACnB,IAAI,EAAE,OAAO,EACX,aAAa,EAAE,OAAO,EACxB,CAAC,EACH,CAAC,EACH,CAAC;;;ACVD,MAAa,YAAkC,OAC7C,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC;;;;;;;;ACI3C,MAAa,qBAAqB,EAAE,OAAO;CACzC,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,UAAU;CACpC,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,MAAM;CAChC,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,UAAU;CACpC,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS,UAAU;CAC3C,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS,eAAe;AAC/C,CAAC;;;;;;;;;ACLD,MAAa,YAAY,EAAE,UAAU,CAAC,CAAC,SAAS;;;;;;;ACFhD,MAAa,2BAA2B,EAAE,OAAO,EAC/C,WAAW,E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AG;GACH;GACA;GACA,eAAe;EACjB,CAAC;EAED,OAAO,eAA4B,MAAM,IAAI,MAAM;CACrD;CAEA,MAAM,sBAAsB,OAC1B,UAEG;EACH,MAAM,EAAE,aAAa,UAAU,UAAU,eAAe,OAAO,SAAS,GAAG,SAAS;EACpF,6BAA6B,QAAQ,QAAQ,WAAW,EACtD,iBAAiB,QAAQ,WAAW,MAAM,QAAQ,EACpD,CAAC;EACD,MAAM,MAAM,SAAS,IAAI,WAAW;EAEpC,MAAM,YAAY,IAAI,YAAY,MAAM,aAAa;EACrD,MAAM,YAAY,MAAM,SAAS,aAAa,SAAS;EAEvD,IAAI,mBAA4C;EAChD,IAAI,SAAS,SAAS;GACpB,MAAM,WAAW,MAAM,cAAc,eAAe,iBAAiB;IACnE;IACA;IACA;GACF,CAAC;GACD,mBAAmB,kBAAkB,IAAI,QAAQ,SAAS,iBAAiB,CAAC,GAAG,SAAS;EAC1F;EAEA,MAAM,EAAE,eAAe,SAAS,MAAM,cAAc,eAAe,oBAAoB;GACrF,GAAG;GACH;GACA;GACA;GACA,eAAe;EACjB,CAAC;EAED,OAAO,eAA4B,MAAM,IAAI,MAAM;CACrD;CAEA,OAAO;EAAE;EAAkB;EAAqB;CAAoB;AACtE"}
1
+ {"version":3,"file":"index.js","names":["snowflakeCommon"],"sources":["../../../src/sdks/configurations/schemas/appDataGatewaySchema.ts","../../../src/sdks/configurations/schemas/common/dbConfig.ts","../../../src/sdks/configurations/schemas/common/dbConnection.ts","../../../src/sdks/configurations/schemas/common/forbidden.ts","../../../src/sdks/configurations/schemas/common/oauthAuthorization.ts","../../../src/sdks/configurations/schemas/common/sshTunnelSchema.ts","../../../src/sdks/configurations/schemas/common/sslSchema.ts","../../../src/sdks/configurations/schemas/appSnowflakeDwhManagerSchema.ts","../../../src/sdks/configurations/schemas/ex/exAwsS3Schema.ts","../../../src/sdks/configurations/schemas/ex/exAzureBlobStorageSchema.ts","../../../src/sdks/configurations/schemas/ex/exAzureDataLakeSchema.ts","../../../src/sdks/configurations/schemas/ex/exFtpSchema.ts","../../../src/sdks/configurations/schemas/ex/exHttpSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbDefaultSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbPgsqlSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbProgressSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbMysqlSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbMssqlSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbOracleSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbOracleAdwSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbFirebirdSchema.ts","../../../src/sdks/configurations/schemas/exDb/exTeradataSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbInformixSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbSnowflakeSchema.ts","../../../src/sdks/configurations/schemas/exDb/exDbNetsuiteSchema.ts","../../../src/sdks/configurations/schemas/gooddataWriterSchema.ts","../../../src/sdks/configurations/schemas/googleAdsSchema.ts","../../../src/sdks/configurations/schemas/schedulerSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrDbDefaultSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrDbPgsqlSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrDbOracleSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrDbOracleAdwSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrSynapseSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrRedshiftSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrDbMssqlSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrDbImpalaSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrExasolSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrFireboltSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrHiveCsasSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrThoughtspotSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrSisenseSchema.ts","../../../src/sdks/configurations/schemas/wrDb/wrDbSnowflakeSchema.ts","../../../src/sdks/configurations/createRegistry/createRegistry.ts","../../../src/sdks/configurations/registry.ts","../../../src/sdks/configurations/configurationsSdk.ts"],"sourcesContent":["import { z } from 'zod';\n\n/**\n * `keboola.app-data-gateway` — the Data Gateway provisions and manages its own Snowflake\n * workspace, so the config carries no credentials: just the id of the workspace it runs\n * against, stored at `parameters.db.workspaceId`.\n */\nexport const appDataGatewaySchema = z.object({\n parameters: z.object({\n db: z.object({\n workspaceId: z.number(),\n }),\n }),\n});\n","import { z } from 'zod';\n\n/** Wrap a `parameters.db` credential schema into the full component config shape. */\nexport const dbConfig = <Db extends z.ZodType>(db: Db) =>\n z.object({ parameters: z.object({ db }) });\n","import { z } from 'zod';\n\n/**\n * The credential fields shared by virtually every DB writer, stored at `parameters.db`.\n * Components extend this with driver-specific fields (`schema`, `warehouse`, `ssh`, …) and\n * override where they differ (e.g. Snowflake makes `#password` optional). Secret leaves use\n * the `#` prefix the encryption service recognizes.\n */\nexport const dbConnectionSchema = z.object({\n host: z.string().describe('Hostname'),\n port: z.number().describe('Port'),\n user: z.string().describe('Username'),\n '#password': z.string().describe('Password'),\n database: z.string().describe('Database Name'),\n});\n","import { z } from 'zod';\n\n/**\n * Marks a field as \"must be absent\" in one arm of a mutually-exclusive union: `z.undefined()`\n * rejects any value while `.optional()` lets the key be omitted entirely. Pairing it with a\n * required field in the sibling arm (e.g. `#password` XOR `#privateKey`) is what makes an\n * \"exactly one of\" union reject configs that set both keys — or neither — at runtime and in\n * the inferred type. Without it the arms would be open objects that silently strip the extra key.\n */\nexport const forbidden = z.undefined().optional();\n","import { z } from 'zod';\n\n/**\n * The OAuth credential reference components store under a top-level `authorization` key. `id`\n * points at the vault-stored credential; `version` is the OAuth-API version (3 on modern stacks).\n * Shared by every OAuth-backed component (Google family, Facebook, …).\n */\nexport const oauthAuthorizationSchema = z.object({\n oauth_api: z.object({\n id: z.string(),\n version: z.number().optional(),\n }),\n});\n","import { z } from 'zod';\n\nexport const sshTunnelSchema = z.object({\n enabled: z.boolean(),\n sshHost: z.string().optional(),\n user: z.string().optional(),\n sshPort: z.number().optional(),\n /** FTP passive-mode port range (e.g. `10000:10005`); only relevant to FTP extractors. */\n passivePortRange: z.string().optional(),\n keys: z\n .object({\n public: z.string().optional(),\n '#private': z.string().optional(),\n })\n .optional(),\n});\n","import { z } from 'zod';\n\n/** SSL options nested at `parameters.db.ssl` (drivers that support it, e.g. MySQL, Hive). */\nexport const sslSchema = z.object({\n enabled: z.boolean(),\n cert: z.string().optional(),\n '#key': z.string().optional(),\n ca: z.string().optional(),\n cipher: z.string().optional(),\n verifyServerCert: z.boolean().optional(),\n});\n","import { z } from 'zod';\n\nimport { forbidden } from './common';\n\n/**\n * `keboola.app-snowflake-dwh-manager` — master Snowflake connection. Auth is a password OR a\n * key-pair (exactly one). The common fields are shared; each variant requires its own secret and\n * *forbids the other* (`forbidden`), so a config carrying both — or neither — is rejected at\n * runtime and at the type level, matching the `wr-db-snowflake` XOR pattern.\n */\nconst dwhMasterBase = z.object({\n master_host: z.string(),\n master_user: z.string(),\n master_database: z.string(),\n warehouse: z.string(),\n});\n\nexport const appSnowflakeDwhManagerSchema = z.object({\n parameters: z.union([\n dwhMasterBase.extend({ '#master_password': z.string(), '#master_private_key': forbidden }),\n dwhMasterBase.extend({ '#master_private_key': z.string(), '#master_password': forbidden }),\n ]),\n});\n","import { z } from 'zod';\n\nimport { forbidden } from '../common';\n\n// `.loose()`: the auth block is validated, but the extractor's other `parameters` (bucket, key,\n// saveAs, …) are component-managed and must pass through rather than be stripped on create/update.\n/** Access-key credentials — forbids the IAM-role fields so the variants stay exclusive. */\nconst awsCredentialsAuth = z\n .object({\n loginType: z.literal('credentials'),\n accessKeyId: z.string(),\n '#secretAccessKey': z.string(),\n accountId: forbidden,\n roleName: forbidden,\n })\n .loose();\n\n/** IAM-role auth — forbids the access-key fields so the variants stay exclusive. */\nconst awsRoleAuth = z\n .object({\n loginType: z.literal('role'),\n accountId: z.string(),\n roleName: z.string(),\n accessKeyId: forbidden,\n '#secretAccessKey': forbidden,\n })\n .loose();\n\n/**\n * `keboola.ex-aws-s3` — access-key credentials OR IAM-role auth (exactly one). `loginType` is the\n * discriminant, and each arm *forbids the other* variant's fields (`z.undefined()`) so a config\n * mixing both — e.g. credentials + a stale `roleName` — is rejected rather than silently stripped.\n * The outer object is `.loose()` so top-level component-managed keys (`storage`, `processors`)\n * pass through.\n */\nexport const exAwsS3Schema = z\n .object({\n parameters: z.union([awsCredentialsAuth, awsRoleAuth]),\n })\n .loose();\n","import { z } from 'zod';\n\n/**\n * `kds-team.ex-azure-blob-storage-v2` — account name + key + container. Both levels are `.loose()`:\n * the connection block is validated, but component-managed `parameters` and top-level keys\n * (`storage`, `processors`) pass through rather than being stripped on create/update.\n */\nexport const exAzureBlobSchema = z\n .object({\n parameters: z\n .object({\n account_name: z.string(),\n '#account_key': z.string(),\n container_name: z.string(),\n })\n .loose(),\n })\n .loose();\n","import { z } from 'zod';\n\n/**\n * `kds-team.ex-azure-data-lake-gen2` — like Blob, but a `file_system` instead of a container. Both\n * levels are `.loose()`: the connection block is validated, but component-managed `parameters` and\n * top-level keys (`storage`, `processors`) pass through rather than being stripped on create/update.\n */\nexport const exAzureDataLakeSchema = z\n .object({\n parameters: z\n .object({\n account_name: z.string(),\n '#account_key': z.string(),\n file_system: z.string(),\n })\n .loose(),\n })\n .loose();\n","import { z } from 'zod';\n\nimport { forbidden, sshTunnelSchema } from '../common';\n\n/** Connection fields shared by both auth variants. */\nconst ftpConnection = z.object({\n host: z.string(),\n port: z.number(),\n connectionType: z.enum(['FTP', 'FTPS', 'SFTP']),\n username: z.string(),\n ignorePassiveAddress: z.boolean().optional(),\n ssh: sshTunnelSchema.optional(),\n path: z.string().optional(),\n onlyNewFiles: z.boolean().optional(),\n});\n\n// `.loose()`: validate the connection block but let component-managed parameter keys pass through.\n/** Password auth — forbids the private key so the variants stay exclusive. */\nconst ftpPasswordAuth = ftpConnection\n .extend({ '#password': z.string(), '#privateKey': forbidden })\n .loose();\n\n/** Private-key auth — forbids the password so the variants stay exclusive. */\nconst ftpPrivateKeyAuth = ftpConnection\n .extend({ '#privateKey': z.string(), '#password': forbidden })\n .loose();\n\n/**\n * `keboola.ex-ftp` / `keboola.ex-ftp-csas` — FTP/FTPS/SFTP server connection. Auth is a password\n * OR a private key (exactly one): each variant requires its secret and *forbids the other*\n * (`z.undefined()`), so a config with both — or neither — is rejected, and switching variants via\n * an update drops the abandoned secret (the whole `parameters` union subtree is replaced wholesale\n * by `schemaGuidedMerge`, so a partial patch must carry the complete connection block). The outer\n * object is `.loose()` so top-level component-managed keys (`storage`, `processors`) pass through.\n */\nexport const exFtpSchema = z\n .object({\n parameters: z.union([ftpPasswordAuth, ftpPrivateKeyAuth]),\n })\n .loose();\n","import { z } from 'zod';\n\n/**\n * `keboola.ex-http` — only the connection block is stable here. The request/job definitions are\n * component-managed and left unvalidated, so both levels are `.loose()`: extra `parameters` keys\n * and top-level keys (`storage`, `processors`) pass through `schema`/`inputSchema` unchanged rather\n * than being stripped on create/update.\n */\nexport const exHttpSchema = z\n .object({\n parameters: z.object({ baseUrl: z.string(), maxRedirects: z.number().optional() }).loose(),\n })\n .loose();\n","import { dbConfig, dbConnectionSchema, sshTunnelSchema } from '../common';\n\n/**\n * Default extractor credentials with an optional SSH tunnel, for the generic SSH-only drivers.\n *\n * - Keep in sync with kbc-ui's `hasSshTunnel` / `hasSsl` (`ex-db-generic/helpers.ts`).\n * - SSL-capable, tunnel-less and extra-field drivers get their own schema.\n */\nexport const exDbDefaultSchema = dbConfig(\n dbConnectionSchema.extend({ ssh: sshTunnelSchema.optional() }),\n);\n","import { dbConfig, dbConnectionSchema, sshTunnelSchema, sslSchema } from '../common';\n\n/** `keboola.ex-db-pgsql` — generic credentials that also accept SSL. */\nexport const exDbPgsqlSchema = dbConfig(\n dbConnectionSchema.extend({ ssh: sshTunnelSchema.optional(), ssl: sslSchema.optional() }),\n);\n","import { dbConfig, dbConnectionSchema } from '../common';\n\n/** `kds-team.ex-progress-db` — generic credentials, no SSH tunnel or SSL. */\nexport const exDbProgressSchema = dbConfig(dbConnectionSchema);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema, sslSchema } from '../common';\n\n/** `keboola.ex-db-mysql` — `database` optional + transaction-isolation / network-compression. */\nexport const exDbMysqlSchema = dbConfig(\n dbConnectionSchema.extend({\n database: z.string().optional(),\n transactionIsolationLevel: z\n .enum(['REPEATABLE READ', 'READ COMMITTED', 'READ UNCOMMITTED', 'SERIALIZABLE'])\n .optional(),\n networkCompression: z.boolean().optional(),\n ssh: sshTunnelSchema.optional(),\n ssl: sslSchema.optional(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema, sslSchema } from '../common';\n\n/** `keboola.ex-db-mssql` — `port` optional, otherwise the shared base. */\nexport const exDbMssqlSchema = dbConfig(\n dbConnectionSchema.extend({\n port: z.number().optional(),\n ssh: sshTunnelSchema.optional(),\n ssl: sslSchema.optional(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema } from '../common';\n\n/** `keboola.ex-db-oracle` — host/port/database all optional (tnsnames is the alternative). */\nexport const exDbOracleSchema = dbConfig(\n dbConnectionSchema.omit({ host: true, port: true, database: true }).extend({\n host: z.string().optional(),\n port: z.number().optional(),\n database: z.string().optional(),\n tnsnames: z.string().optional(),\n connectThrough: z.boolean().optional(),\n ssh: sshTunnelSchema.optional(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema } from '../common';\n\n/**\n * `keboola.ex-db-oracle-adw` — the Oracle extractor with Oracle Cloud Autonomous Database support.\n * Same connection as `keboola.ex-db-oracle` (host/port/database all optional, tnsnames is the\n * alternative), plus the database wallet: `walletServiceName` with `walletFileId`.\n */\nexport const exDbOracleAdwSchema = dbConfig(\n dbConnectionSchema.omit({ host: true, port: true, database: true }).extend({\n host: z.string().optional(),\n port: z.number().optional(),\n database: z.string().optional(),\n tnsnames: z.string().optional(),\n walletServiceName: z.string().optional(),\n walletFileId: z.union([z.number(), z.literal('')]).optional(),\n connectThrough: z.boolean().optional(),\n ssh: sshTunnelSchema.optional(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig } from '../common';\n\n/** `keboola.ex-db-firebird` — `dbname` + user/#password only (no host/port/database fields). */\nexport const exDbFirebirdSchema = dbConfig(\n z.object({ dbname: z.string(), user: z.string(), '#password': z.string() }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema } from '../common';\n\n/** `keboola.ex-teradata` — shared base with optional `database`. */\nexport const exTeradataSchema = dbConfig(\n dbConnectionSchema.extend({ database: z.string().optional() }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema } from '../common';\n\n/** `keboola.ex-db-informix` — Informix server name + protocol + optional locale. */\nexport const exDbInformixSchema = dbConfig(\n dbConnectionSchema.extend({\n serverName: z.string(),\n protocol: z.enum(['onsoctcp', 'onsocssl']),\n dbLocale: z.string().optional(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, forbidden } from '../common';\n\n/**\n * `keboola.ex-db-snowflake` — auth is a union: password OR key-pair (exactly one). The common\n * fields (host/port/user/database + optional schema/warehouse) are shared; each variant requires\n * its own secret and forbids the other, so a config carrying both — or neither — is rejected at\n * runtime and at the type level.\n */\nconst snowflakeCommon = dbConnectionSchema\n .omit({ '#password': true })\n .extend({ schema: z.string().optional(), warehouse: z.string().optional() });\n\nexport const exDbSnowflakeSchema = dbConfig(\n z.union([\n snowflakeCommon.extend({ '#password': z.string(), '#privateKey': forbidden }),\n snowflakeCommon.extend({ '#privateKey': z.string(), '#password': forbidden }),\n ]),\n);\n","import { z } from 'zod';\n\nimport { dbConfig } from '../common';\n\n/** `keboola.ex-db-netsuite` — SuiteAnalytics account/role + user/#password (no host/port/db). */\nexport const exDbNetsuiteSchema = dbConfig(\n z.object({\n accountId: z.string(),\n roleId: z.string(),\n user: z.string(),\n '#password': z.string(),\n }),\n);\n\n/** `kds-team.ex-netsuite` — Connect host/port + server data source + account/role. */\nexport const exKdsNetsuiteSchema = dbConfig(\n z.object({\n host: z.string(),\n port: z.number(),\n server_data_source: z.enum(['NetSuite.com', 'NetSuite2.com']),\n account_id: z.string(),\n role_id: z.string(),\n user: z.string(),\n '#password': z.string(),\n }),\n);\n","import { z } from 'zod';\n\n/**\n * A single exported column. `type` is always present and drives which of the other fields the\n * UI shows (and persists): `dataType`/`dataTypeSize` for the base types + LABEL, `reference` for\n * LABEL/HYPERLINK, `schemaReference` for REFERENCE, `format`/`dateDimension` for DATE, and\n * `sortLabel`/`sortOrder` + the `identifier*` fields for ATTRIBUTE. They're optional here since a\n * given column only carries the subset relevant to its type. Mirrors the kbc-ui column adapter\n * (`apps/kbc-ui/src/scripts/modules/gooddata-writer-v3/helpers/makeColumnDefinition.ts`).\n */\nconst gooddataColumn = z.object({\n type: z.enum([\n 'ATTRIBUTE',\n 'CONNECTION_POINT',\n 'DATE',\n 'FACT',\n 'HYPERLINK',\n 'LABEL',\n 'REFERENCE',\n 'IGNORE',\n ]),\n id: z.string().optional(),\n title: z.string().optional(),\n dataType: z.enum(['BIGINT', 'DATE', 'DECIMAL', 'INT', 'VARCHAR']).optional(),\n dataTypeSize: z.string().optional(),\n reference: z.string().optional(),\n schemaReference: z.string().optional(),\n sortLabel: z.string().optional(),\n sortOrder: z.enum(['ASC', 'DESC']).optional(),\n format: z.string().optional(),\n dateDimension: z.string().optional(),\n identifier: z.string().optional(),\n identifierLabel: z.string().optional(),\n identifierSortLabel: z.string().optional(),\n});\n\n/** One exported table: a GoodData `title`, its `columns` keyed by source column name, and an\n * optional `disabled` flag toggled when export is switched off. */\nconst gooddataTable = z.object({\n title: z.string(),\n disabled: z.boolean().optional(),\n identifier: z.string().optional(),\n columns: z.record(z.string(), gooddataColumn),\n});\n\n/** One date dimension; `template` selects the date-dimension template (`gooddata` / `keboola` /\n * a custom template id). */\nconst gooddataDimension = z.object({\n template: z.string(),\n includeTime: z.boolean().optional(),\n identifier: z.string().optional(),\n});\n\n/**\n * `keboola.gooddata-writer` — GoodData project + login credentials plus the exported model:\n * `tables` (keyed by source table id) and `dimensions` (keyed by dimension name). Both are\n * optional — a fresh config has credentials before any table/dimension is mapped — and must be\n * declared: the registry validates create/update input with a deep-partial that strips keys\n * absent from this shape, so an undeclared `tables`/`dimensions` payload would be dropped before\n * it's stored.\n */\nexport const gooddataWriterSchema = z.object({\n parameters: z.object({\n project: z.object({ pid: z.string(), backendUrl: z.string().optional() }),\n user: z.object({ login: z.string(), '#password': z.string() }),\n loadOnly: z.boolean().optional(),\n multiLoad: z.boolean().optional(),\n tables: z.record(z.string(), gooddataTable).optional(),\n dimensions: z.record(z.string(), gooddataDimension).optional(),\n }),\n});\n","import { z } from 'zod';\n\nimport { oauthAuthorizationSchema } from './common';\n\n/** `keboola.ex-google-ads` — OAuth credential reference + account selection. */\nexport const exGoogleAdsSchema = z.object({\n authorization: oauthAuthorizationSchema,\n parameters: z.object({\n customerId: z.array(z.string()),\n onlyEnabledCustomers: z.boolean().optional(),\n continueOnFailure: z.boolean().optional(),\n getAccountChildren: z.boolean().optional(),\n }),\n});\n","import { z } from 'zod';\n\n/**\n * `keboola.scheduler` — drives a target component config on a cron schedule. Unlike the\n * writer configs, scheduler state lives at the top level (no `parameters` wrapper):\n * `schedule` holds the cron expression + timezone + enabled/disabled state, `target`\n * identifies which component configuration to run.\n */\nexport const schedulerSchema = z.object({\n schedule: z.object({\n cronTab: z.string(),\n // Legacy configs predate the timezone field; the UI falls back to 'UTC' when it's\n // missing, so a config without it is still runnable. Keep it optional to match.\n timezone: z.string().optional(),\n state: z.enum(['enabled', 'disabled']),\n }),\n target: z.object({\n componentId: z.string(),\n configurationId: z.string(),\n mode: z.literal('run'),\n }),\n});\n","import { dbConfig, dbConnectionSchema, sshTunnelSchema, sslSchema } from '../common';\n\n/**\n * Default writer credentials — host/port/user/#password/database + optional SSH and SSL tunnels.\n * Shared by the writers that add no extra fields (`keboola.wr-db-mysql`, `keboola.wr-db-hive`);\n * writers that add or rename fields get their own schema.\n */\nexport const wrDbDefaultSchema = dbConfig(\n dbConnectionSchema.extend({ ssh: sshTunnelSchema.optional(), ssl: sslSchema.optional() }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema } from '../common';\n\n/** `keboola.wr-db-pgsql` — adds a required `schema`, optional SSH. */\nexport const wrDbPgsqlSchema = dbConfig(\n dbConnectionSchema.extend({ schema: z.string(), ssh: sshTunnelSchema.optional() }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema } from '../common';\n\n/** `keboola.wr-db-oracle` — optional `schema`, optional SSH. */\nexport const wrDbOracleSchema = dbConfig(\n dbConnectionSchema.extend({ schema: z.string().optional(), ssh: sshTunnelSchema.optional() }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema } from '../common';\n\n/**\n * `keboola.wr-db-oracle-adw` — the Oracle writer with Oracle Cloud Autonomous Database support.\n * Connects by host/port/database (optional `schema`, optional SSH) like `keboola.wr-db-oracle`,\n * or through the database wallet: `walletServiceName` (a service from the wallet's tnsnames.ora)\n * plus `walletFileId` (the wallet ZIP in Storage). Wallet mode refuses `host` and ignores the\n * `port` that the credentials form saves by default. The form saves a cleared field as an empty\n * string, so `''` counts as \"not set\" on both sides.\n */\nconst hostConnection = dbConnectionSchema.extend({\n schema: z.string().optional(),\n ssh: sshTunnelSchema.optional(),\n walletServiceName: z.literal('').optional(),\n walletFileId: z.literal('').optional(),\n});\n\nconst walletConnection = z.object({\n walletServiceName: z.string().min(1).describe('Wallet Service Name'),\n walletFileId: z\n .union([z.number(), z.literal('')])\n .optional()\n .describe('Wallet File ID'),\n user: z.string().describe('Username'),\n '#password': z.string().describe('Password'),\n schema: z.string().optional(),\n port: z.number().optional(),\n host: z.literal('').optional(),\n});\n\nexport const wrDbOracleAdwSchema = dbConfig(z.union([hostConnection, walletConnection]));\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema } from '../common';\n\n/** `keboola.wr-synapse` — optional `schema` (defaults to `dbo` in the UI). */\nexport const wrSynapseSchema = dbConfig(\n dbConnectionSchema.extend({ schema: z.string().optional() }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema } from '../common';\n\n/** `keboola.wr-redshift-v2` — required `schema`, optional SSH. */\nexport const wrRedshiftSchema = dbConfig(\n dbConnectionSchema.extend({ schema: z.string(), ssh: sshTunnelSchema.optional() }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema } from '../common';\n\n/** `keboola.wr-db-mssql-v2` — optional `instance`, required `tdsVersion`, optional SSH. */\nexport const wrDbMssqlSchema = dbConfig(\n dbConnectionSchema.extend({\n instance: z.string().optional(),\n tdsVersion: z.enum(['7.0', '7.1', '7.2', '7.3', '7.4']),\n ssh: sshTunnelSchema.optional(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema } from '../common';\n\n/** `keboola.wr-db-impala` — adds `auth_mech`, optional SSH. */\nexport const wrDbImpalaSchema = dbConfig(\n dbConnectionSchema.extend({ auth_mech: z.number(), ssh: sshTunnelSchema.optional() }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig } from '../common';\n\n/**\n * `kds-team.wr-exasol` — no `database`; auth is password OR SaaS personal-access-token\n * (`#refresh_token`), at least one required (both may coexist). Mirrors kbc-ui's\n * `apps/kbc-ui/src/scripts/modules/wr-db/templates/hasValidCredentials.ts`, which drops the\n * `#password` requirement once a `#refresh_token` is present.\n */\nconst exasolBase = z.object({\n host: z.string(),\n port: z.number(),\n user: z.string(),\n schema: z.string(),\n});\n\nexport const wrExasolSchema = dbConfig(\n z.union([\n exasolBase.extend({ '#password': z.string(), '#refresh_token': z.string().optional() }),\n exasolBase.extend({ '#refresh_token': z.string(), '#password': z.string().optional() }),\n ]),\n);\n","import { z } from 'zod';\n\nimport { dbConfig } from '../common';\n\n/** `kds-team.wr-firebolt` — no host/port; engine + AWS staging credentials. */\nexport const wrFireboltSchema = dbConfig(\n z.object({\n user: z.string(),\n '#password': z.string(),\n database: z.string(),\n aws_api_key_id: z.string(),\n '#aws_api_key_secret': z.string(),\n staging_bucket: z.string(),\n engine_name: z.string().optional(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, sshTunnelSchema } from '../common';\n\n/** `kds-team.wr-hive-csas` — Hive base + Kerberos auth. */\nexport const wrHiveCsasSchema = dbConfig(\n dbConnectionSchema.extend({\n kinitPrincipal: z.string(),\n servicePrincipal: z.string(),\n config: z.string(),\n '#keytab': z.string(),\n ssh: sshTunnelSchema.optional(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema } from '../common';\n\n/** `keboola.wr-thoughtspot` — SSH tunnel creds carried as top-level fields, not nested. */\nexport const wrThoughtspotSchema = dbConfig(\n dbConnectionSchema.extend({\n schema: z.string().optional(),\n sshUser: z.string(),\n '#sshPassword': z.string(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig } from '../common';\n\n/** `keboola.wr-sisense` — uses `username` (not `user`). */\nexport const wrSisenseSchema = dbConfig(\n z.object({\n host: z.string(),\n port: z.number(),\n username: z.string(),\n '#password': z.string(),\n database: z.string(),\n }),\n);\n","import { z } from 'zod';\n\nimport { dbConfig, dbConnectionSchema, forbidden } from '../common';\n\n/**\n * `keboola.wr-db-snowflake` — auth is a union: password OR key-pair (exactly one). The common\n * fields (host/port/user/database/schema/warehouse) are shared; each variant requires its own\n * secret and *forbids the other* (`z.undefined()`), so a config carrying both — or neither —\n * is rejected at runtime and at the type level. Without the `forbidden` half, the variants\n * would be open objects: the extra key is excess (TS allows it) and stripped (Zod accepts it).\n */\nconst snowflakeCommon = dbConnectionSchema\n .omit({ '#password': true })\n .extend({ schema: z.string(), warehouse: z.string().optional() });\n\nexport const wrDbSnowflakeSchema = dbConfig(\n z.union([\n snowflakeCommon.extend({ '#password': z.string(), '#privateKey': forbidden }),\n snowflakeCommon.extend({ '#privateKey': z.string(), '#password': forbidden }),\n ]),\n);\n","import { z } from 'zod';\n\n/** Deep-partial any schema: objects → keys optional (recursing), unions → each member\n * deep-partialed, anything else left as-is. Lets a union schema (e.g. Snowflake's\n * password | key-pair auth) still produce a partial input schema. */\nconst partialize = (schema: z.ZodType): z.ZodType => {\n if (schema instanceof z.ZodObject) return deepPartial(schema);\n if (schema instanceof z.ZodUnion) {\n const options = (schema.options as z.ZodType[]).map(partialize);\n return z.union(options as [z.ZodType, z.ZodType, ...z.ZodType[]]);\n }\n return schema;\n};\n\nconst deepPartial = (schema: z.ZodObject): z.ZodObject => {\n const shape: Record<string, z.ZodType> = {};\n for (const [key, value] of Object.entries(schema.shape)) {\n const field = value as z.ZodType;\n const inner = field instanceof z.ZodOptional ? (field.unwrap() as z.ZodType) : field;\n shape[key] = partialize(inner);\n }\n const partial = z.object(shape).partial();\n // Preserve the source object's catchall (e.g. a `.loose()` `parameters` block that must let\n // component-managed keys pass through) — rebuilding via `z.object` would otherwise strip it.\n return schema.def.catchall ? partial.catchall(schema.def.catchall) : partial;\n};\n\nexport type Registry<M extends Record<string, z.ZodObject>> = {\n add: <const Id extends string, Schema extends z.ZodObject>(\n componentId: Id,\n schema: Schema,\n ) => Registry<M & Record<Id, Schema>>;\n get: <Id extends keyof M>(\n componentId: Id,\n ) => {\n /** The component's complete runnable schema (precise per id). */\n schema: M[Id];\n /** Its deep-partial — the accepted create/update input. Loose `z.ZodObject` (the precise\n * partial type isn't worth deriving; callers get input typing from `schema` via `z.input`). */\n inputSchema: z.ZodObject;\n };\n has: (componentId: string) => boolean;\n};\n\n/** Extracts the registered component-id union from a registry instance type. */\nexport type InferComponentId<R> = R extends Registry<infer M> ? keyof M & string : never;\n\nexport const createRegistry = (): Registry<Record<never, never>> => {\n const map = new Map<string, z.ZodObject>();\n\n const registry = {\n add(componentId: string, schema: z.ZodObject) {\n map.set(componentId, schema);\n return registry;\n },\n get(componentId: string) {\n const schema = map.get(componentId);\n if (!schema) throw new Error(`No configuration registered for component \"${componentId}\".`);\n return { schema, inputSchema: deepPartial(schema) };\n },\n has: (componentId: string) => map.has(componentId),\n };\n\n return registry as unknown as Registry<Record<never, never>>;\n};\n","import { ComponentId } from '../../constants/componentId';\n\nimport { appDataGatewaySchema } from './schemas/appDataGatewaySchema';\nimport { appSnowflakeDwhManagerSchema } from './schemas/appSnowflakeDwhManagerSchema';\nimport {\n exAwsS3Schema,\n exAzureBlobSchema,\n exAzureDataLakeSchema,\n exFtpSchema,\n exHttpSchema,\n} from './schemas/ex';\nimport {\n exDbDefaultSchema,\n exDbFirebirdSchema,\n exDbInformixSchema,\n exDbMssqlSchema,\n exDbMysqlSchema,\n exDbNetsuiteSchema,\n exDbOracleAdwSchema,\n exDbOracleSchema,\n exDbPgsqlSchema,\n exDbProgressSchema,\n exDbSnowflakeSchema,\n exKdsNetsuiteSchema,\n exTeradataSchema,\n} from './schemas/exDb';\nimport { gooddataWriterSchema } from './schemas/gooddataWriterSchema';\nimport { exGoogleAdsSchema } from './schemas/googleAdsSchema';\nimport { schedulerSchema } from './schemas/schedulerSchema';\nimport {\n wrDbDefaultSchema,\n wrDbImpalaSchema,\n wrDbMssqlSchema,\n wrDbOracleAdwSchema,\n wrDbOracleSchema,\n wrDbPgsqlSchema,\n wrDbSnowflakeSchema,\n wrExasolSchema,\n wrFireboltSchema,\n wrHiveCsasSchema,\n wrRedshiftSchema,\n wrSisenseSchema,\n wrSynapseSchema,\n wrThoughtspotSchema,\n} from './schemas/wrDb';\nimport { createRegistry, type GetRegisteredId } from './createRegistry';\n\nexport const registry = createRegistry()\n /**\n * DB writers (`wr-db-*` family + related SaaS targets). Split into the standard writers\n * built on the shared `parameters.db` connection base and the special-cased targets whose\n * config diverges (extra auth, no host/port, or a provisioned workspace).\n */\n\n // Standard writers — host/port/user/#password/database, plus per-driver extras (schema, ssh…).\n .add(ComponentId.WR_DB_MYSQL, wrDbDefaultSchema)\n .add(ComponentId.WR_DB_PGSQL, wrDbPgsqlSchema)\n .add(ComponentId.WR_PAIRITY, wrDbPgsqlSchema) // pgsql variant\n .add(ComponentId.WR_DB_ORACLE, wrDbOracleSchema)\n .add(ComponentId.WR_DB_ORACLE_ADW, wrDbOracleAdwSchema) // oracle + Autonomous Database wallet\n .add(ComponentId.WR_DB_SNOWFLAKE, wrDbSnowflakeSchema)\n .add(ComponentId.WR_DB_SNOWFLAKE_GCS, wrDbSnowflakeSchema)\n .add(ComponentId.WR_DB_SNOWFLAKE_GCS_S3, wrDbSnowflakeSchema)\n .add(ComponentId.WR_SNOWFLAKE_BLOB_STORAGE, wrDbSnowflakeSchema)\n .add(ComponentId.WR_LOOKER_V2, wrDbSnowflakeSchema) // legacy snowflake\n .add(ComponentId.WR_SYNAPSE, wrSynapseSchema)\n .add(ComponentId.WR_REDSHIFT, wrRedshiftSchema)\n .add(ComponentId.WR_DB_MSSQL, wrDbMssqlSchema)\n .add(ComponentId.WR_DB_HIVE, wrDbDefaultSchema)\n .add(ComponentId.WR_DB_IMPALA, wrDbImpalaSchema)\n\n // Special-cased targets — diverging auth or credential shape.\n .add(ComponentId.WR_HIVE_CSAS, wrHiveCsasSchema) // Kerberos auth\n .add(ComponentId.WR_THOUGHTSPOT, wrThoughtspotSchema) // top-level SSH creds\n .add(ComponentId.WR_EXASOL, wrExasolSchema)\n .add(ComponentId.WR_FIREBOLT, wrFireboltSchema)\n .add(ComponentId.WR_SISENSE, wrSisenseSchema)\n .add(ComponentId.APP_DATA_GATEWAY, appDataGatewaySchema) // provisioned workspace, no creds\n .add(ComponentId.SCHEDULER, schedulerSchema)\n\n // App-specific writers — bespoke credential blocks.\n .add(ComponentId.APP_SNOWFLAKE_DWH_MANAGER, appSnowflakeDwhManagerSchema)\n .add(ComponentId.GOODDATA_WRITER, gooddataWriterSchema)\n\n /**\n * DB extractors (`ex-db-*` family) — same `parameters.db` credentials as the writers above.\n * Split into the generic-credentials drivers that reuse `exDbDefaultSchema` and the drivers\n * whose credentials diverge enough to need their own schema.\n */\n\n // Default credentials — host/port/user/#password/database + optional SSH tunnel.\n .add(ComponentId.EX_DB_REDSHIFT, exDbDefaultSchema)\n .add(ComponentId.EX_DB_DB2, exDbDefaultSchema)\n .add(ComponentId.EX_DB_DB2_BATA, exDbDefaultSchema)\n .add(ComponentId.EX_DB_MSSQL_CDATA, exDbDefaultSchema)\n .add(ComponentId.EX_DB_IMPALA, exDbDefaultSchema)\n .add(ComponentId.EX_DB_HIVE, exDbDefaultSchema)\n .add(ComponentId.EX_DB_HIVE_CSAS, exDbDefaultSchema)\n .add(ComponentId.EX_DB_HIVE_CSAS_TEST, exDbDefaultSchema)\n\n // Driver-specific credentials — extra/renamed fields or different SSH tunnel / SSL support.\n .add(ComponentId.EX_DB_PGSQL, exDbPgsqlSchema) // generic creds + SSL\n .add(ComponentId.EX_DB_MYSQL, exDbMysqlSchema)\n .add(ComponentId.EX_DB_MSSQL, exDbMssqlSchema)\n .add(ComponentId.EX_DB_ORACLE, exDbOracleSchema)\n .add(ComponentId.EX_DB_ORACLE_ADW, exDbOracleAdwSchema) // oracle + Autonomous Database wallet\n .add(ComponentId.EX_DB_SNOWFLAKE, exDbSnowflakeSchema)\n .add(ComponentId.EX_DB_FIREBIRD, exDbFirebirdSchema)\n .add(ComponentId.EX_DB_NETSUITE, exDbNetsuiteSchema)\n .add(ComponentId.EX_DB_INFORMIX, exDbInformixSchema)\n .add(ComponentId.EX_TERADATA, exTeradataSchema)\n .add(ComponentId.KDS_EX_NETSUITE, exKdsNetsuiteSchema)\n .add(ComponentId.KDS_EX_PROGRESS_DB, exDbProgressSchema) // generic creds, no SSH/SSL\n // Google (OAuth) components\n .add(ComponentId.EX_GOOGLE_ADS, exGoogleAdsSchema)\n\n /**\n * File/connection extractors (`ex` family) — no shared credential base; each has its own\n * connection/credentials shape, so each is its own schema (ftp-csas reuses ftp).\n */\n .add(ComponentId.EX_HTTP, exHttpSchema)\n .add(ComponentId.EX_FTP, exFtpSchema)\n .add(ComponentId.EX_FTP_CSAS, exFtpSchema) // same shape as ftp\n .add(ComponentId.EX_AWS_S3, exAwsS3Schema)\n .add(ComponentId.KDS_EX_AZURE_BLOB_STORAGE_V2, exAzureBlobSchema)\n .add(ComponentId.KDS_EX_AZURE_DATA_LAKE_GEN2, exAzureDataLakeSchema);\n\nexport type RegisteredComponentId = GetRegisteredId<typeof registry>;\n","import type { z } from 'zod';\n\nimport type { createEncryptionClient } from '../../clients/encryption/encryptionClient';\nimport type * as storage from '../../clients/storage';\nimport type {\n BaseComponentConfig,\n ConfigurationPath,\n CreateConfigurationInput,\n UpdateConfigurationInput,\n} from '../../clients/storage/types';\nimport type { BranchRefs } from '../../domain/branchRefs';\nimport {\n assertCanCreateConfiguration,\n assertCanUpdateConfiguration,\n} from '../../domain/permissions/configurations';\nimport type { Project } from '../../domain/project';\nimport { isEmptyDeep } from '../../utils/isEmptyDeep';\nimport { schemaGuidedMerge } from '../../utils/schemaGuidedMerge';\n\nimport { type RegisteredComponentId, registry } from './registry';\n\ntype ConfigurationSdkContext = {\n project: Project;\n branchRefs: BranchRefs;\n};\n\ntype Options = {\n storageClient: ReturnType<typeof storage.createStorageClient>;\n encryptionClient: ReturnType<typeof createEncryptionClient>;\n context: ConfigurationSdkContext;\n};\n\ntype DeepPartial<T> = T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;\n\ntype ConfigurationSchema<ComponentId extends RegisteredComponentId> = z.input<\n ReturnType<typeof registry.get<ComponentId>>['schema']\n>;\n\ntype TypedConfiguration<ComponentId extends RegisteredComponentId> = {\n componentId: ComponentId;\n configuration: DeepPartial<ConfigurationSchema<ComponentId>>;\n};\n\n/**\n * How an update writes the patch against the stored configuration:\n * - `'merge'` (default) — reads the config, deep-merges by schema; credential unions and arrays are\n * replaced wholesale (dropping an abandoned secret), out-of-schema keys kept.\n * - `'replace'` — stores exactly what is sent (validated + encrypted); anything omitted,\n * e.g. `storage`, is gone.\n */\ntype UpdateMode = 'merge' | 'replace';\n\nconst toConfigResult = <ComponentId extends RegisteredComponentId>(\n data: BaseComponentConfig,\n schema: z.ZodType,\n) => {\n const result = schema.safeParse(data.configuration);\n\n return {\n data: data as BaseComponentConfig<ConfigurationSchema<ComponentId>>,\n runnable: result.success,\n error: result.error,\n };\n};\n\nexport const createConfigurationSdk = ({ storageClient, encryptionClient, context }: Options) => {\n const _encrypt = async (\n componentId: RegisteredComponentId,\n data: Record<string, unknown>,\n ): Promise<Record<string, unknown>> => {\n if (isEmptyDeep(data)) return data;\n\n return encryptionClient.encryptScopedSecrets({\n scope: 'ProjectSecure',\n componentId,\n projectId: context.project.sapiToken.owner.id,\n data,\n });\n };\n\n const getConfiguration = async <ComponentId extends RegisteredComponentId>(\n path: ConfigurationPath<ComponentId>,\n ) => {\n const data = await storageClient.configurations.getConfiguration(path);\n const def = registry.get(path.componentId);\n\n return toConfigResult<ComponentId>(data, def.schema);\n };\n\n const createConfiguration = async <ComponentId extends RegisteredComponentId>(\n input: Omit<CreateConfigurationInput<ComponentId>, 'componentId' | 'configuration'> &\n TypedConfiguration<ComponentId>,\n ) => {\n const { componentId, branchId, configuration, ...rest } = input;\n assertCanCreateConfiguration(context.project.sapiToken, {\n isDevModeActive: context.branchRefs.isDev(branchId),\n });\n const def = registry.get(componentId);\n const validated = def.inputSchema.parse(configuration);\n const encrypted = await _encrypt(componentId, validated);\n\n const data = await storageClient.configurations.createConfiguration({\n ...rest,\n branchId,\n componentId,\n configuration: encrypted,\n });\n\n return toConfigResult<ComponentId>(data, def.schema);\n };\n\n const updateConfiguration = async <ComponentId extends RegisteredComponentId>(\n input: Omit<UpdateConfigurationInput<ComponentId>, 'componentId' | 'configuration'> &\n TypedConfiguration<ComponentId> & { mode?: UpdateMode },\n ) => {\n const { componentId, branchId, configId, configuration, mode = 'merge', ...rest } = input;\n assertCanUpdateConfiguration(context.project.sapiToken, {\n isDevModeActive: context.branchRefs.isDev(branchId),\n });\n const def = registry.get(componentId);\n\n const validated = def.inputSchema.parse(configuration);\n const encrypted = await _encrypt(componentId, validated);\n\n let newConfiguration: Record<string, unknown> = encrypted;\n if (mode === 'merge') {\n const original = await storageClient.configurations.getConfiguration({\n componentId,\n branchId,\n configId,\n });\n newConfiguration = schemaGuidedMerge(def.schema, original.configuration ?? {}, encrypted);\n }\n\n const { configuration: data } = await storageClient.configurations.updateConfiguration({\n ...rest,\n branchId,\n componentId,\n configId,\n configuration: newConfiguration,\n });\n\n return toConfigResult<ComponentId>(data, def.schema);\n };\n\n return { getConfiguration, createConfiguration, updateConfiguration };\n};\n"],"mappings":";;;;;;;;;;AAOA,MAAa,uBAAuB,EAAE,OAAO,EAC3C,YAAY,EAAE,OAAO,EACnB,IAAI,EAAE,OAAO,EACX,aAAa,EAAE,OAAO,EACxB,CAAC,EACH,CAAC,EACH,CAAC;;;ACVD,MAAa,YAAkC,OAC7C,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC;;;;;;;;ACI3C,MAAa,qBAAqB,EAAE,OAAO;CACzC,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,UAAU;CACpC,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,MAAM;CAChC,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,UAAU;CACpC,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS,UAAU;CAC3C,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS,eAAe;AAC/C,CAAC;;;;;;;;;ACLD,MAAa,YAAY,EAAE,UAAU,CAAC,CAAC,SAAS;;;;;;;ACFhD,MAAa,2BAA2B,EAAE,OAAO,EAC/C,WAAW,EAAE,OAAO;CAClB,IAAI,EAAE,OAAO;CACb,SAAS,EAAE,OAAO,CAAC,C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,MAAM,YAAY,MAAM,SAAS,aAAa,SAAS;EAEvD,MAAM,OAAO,MAAM,cAAc,eAAe,oBAAoB;GAClE,GAAG;GACH;GACA;GACA,eAAe;EACjB,CAAC;EAED,OAAO,eAA4B,MAAM,IAAI,MAAM;CACrD;CAEA,MAAM,sBAAsB,OAC1B,UAEG;EACH,MAAM,EAAE,aAAa,UAAU,UAAU,eAAe,OAAO,SAAS,GAAG,SAAS;EACpF,6BAA6B,QAAQ,QAAQ,WAAW,EACtD,iBAAiB,QAAQ,WAAW,MAAM,QAAQ,EACpD,CAAC;EACD,MAAM,MAAM,SAAS,IAAI,WAAW;EAEpC,MAAM,YAAY,IAAI,YAAY,MAAM,aAAa;EACrD,MAAM,YAAY,MAAM,SAAS,aAAa,SAAS;EAEvD,IAAI,mBAA4C;EAChD,IAAI,SAAS,SAAS;GACpB,MAAM,WAAW,MAAM,cAAc,eAAe,iBAAiB;IACnE;IACA;IACA;GACF,CAAC;GACD,mBAAmB,kBAAkB,IAAI,QAAQ,SAAS,iBAAiB,CAAC,GAAG,SAAS;EAC1F;EAEA,MAAM,EAAE,eAAe,SAAS,MAAM,cAAc,eAAe,oBAAoB;GACrF,GAAG;GACH;GACA;GACA;GACA,eAAe;EACjB,CAAC;EAED,OAAO,eAA4B,MAAM,IAAI,MAAM;CACrD;CAEA,OAAO;EAAE;EAAkB;EAAqB;CAAoB;AACtE"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_createFetchClient = require("../../createFetchClient-CDKSkd7i.cjs");
3
- const require_storage = require("../../storage-BMrYlyLB.cjs");
3
+ const require_storage = require("../../storage-jLhVrKZh.cjs");
4
4
  const require_RowLevelSecurityError = require("../../RowLevelSecurityError-RK_NhhAx.cjs");
5
5
  const require_transientRetries = require("../../transientRetries-CBorl4Ue.cjs");
6
6
  const require_isPlainObject = require("../../isPlainObject-CcvQt0qB.cjs");
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["isRowLevelSecurityError","HttpStatus","APP_USER_TOKEN_HEADER","readJwtClaims","AsyncLocalStorage","APP_USER_TOKEN_HEADER","cellParser","createQueryServiceSdk","createQueryServiceClient","isRowLevelSecurityError","readFile","isPlainObject","createStorageClient","ServiceId","lazy"],"sources":["../../../src/sdks/dataAppServer/express.ts","../../../src/sdks/dataAppServer/requestContext.ts","../../../src/sdks/dataAppServer/runQuery.ts","../../../src/sdks/dataAppServer/settings.ts","../../../src/sdks/dataAppServer/initializeApp.ts"],"sourcesContent":["import { isRowLevelSecurityError } from '../../errors';\nimport { HttpStatus } from '../../internal';\n\ntype ErrorResponse = {\n headersSent: boolean;\n status(code: number): { json(body: unknown): unknown };\n};\n\n/** Answers a row-level security refusal with 403 and passes any other error on. */\nexport const createExpressErrorHandler =\n () => (err: unknown, _req: unknown, res: ErrorResponse, next: (err?: unknown) => void) => {\n if (res.headersSent || !isRowLevelSecurityError(err)) {\n next(err);\n return;\n }\n res.status(HttpStatus.FORBIDDEN).json({ error: err.message, code: 'ROW_LEVEL_SECURITY' });\n };\n","import { AsyncLocalStorage } from 'node:async_hooks';\n\nimport { APP_USER_TOKEN_HEADER } from '../../internal';\nimport { readJwtClaims } from '../../utils/readJwtClaims';\n\ntype NodeHeaders = Record<string, string | string[] | undefined>;\n\ntype HeadersLike = { get(name: string): string | null };\n\n/** A Fetch `Request` or `Headers`, or a Node request (Express, Fastify) with its lower-case `headers`. */\nexport type AppRequest = HeadersLike | { headers: HeadersLike | NodeHeaders };\n\n/** The signed-in user as the app user token names them; `email` only when the IdP verified it. */\nexport type AppUser = { idp: string; sub: string; email?: string };\n\ntype Scope = { appUserToken: string | undefined; user: AppUser | undefined };\n\nexport type RequestContext = ReturnType<typeof createRequestContext>;\n\nconst isHeadersLike = (headers: object): headers is HeadersLike =>\n 'get' in headers && typeof headers.get === 'function';\n\nconst appUserTokenOf = (request: AppRequest): string | undefined => {\n const headers = 'headers' in request ? request.headers : request;\n if (isHeadersLike(headers)) return headers.get(APP_USER_TOKEN_HEADER) || undefined;\n const value = headers[APP_USER_TOKEN_HEADER.toLowerCase()];\n return (Array.isArray(value) ? value[0] : value) || undefined;\n};\n\nconst userOf = (token: string): AppUser | undefined => {\n const { idp, sub, email } = readJwtClaims(token) ?? {};\n if (typeof idp !== 'string' || typeof sub !== 'string' || !idp || !sub) return undefined;\n return typeof email === 'string' && email ? { idp, sub, email } : { idp, sub };\n};\n\n/**\n * The signed-in user of the request being handled, kept across every `await` the request makes.\n *\n * - Work the request starts keeps its user: a timer, a promise cached at module level, a listener.\n * - `currentUser()` reads the token payload unverified: safe only behind Keboola's apps proxy.\n * - `currentUserKey()` is the same for every token of one user (`idp` + `sub`): a per-user cache key.\n */\nexport const createRequestContext = () => {\n const storage = new AsyncLocalStorage<Scope>();\n const current = () => storage.getStore();\n\n return {\n runWithRequest: <T>(request: AppRequest, fn: () => T): T => {\n const appUserToken = appUserTokenOf(request);\n return storage.run(\n { appUserToken, user: appUserToken ? userOf(appUserToken) : undefined },\n fn,\n );\n },\n current,\n currentUser: () => current()?.user,\n currentUserKey: () => {\n const user = current()?.user;\n return user && JSON.stringify([user.idp, user.sub]);\n },\n };\n};\n","import { createQueryServiceClient, type QueryServiceCredential } from '../../clients/queryService';\nimport type { QueryResult } from '../../clients/queryService/types';\nimport { isRowLevelSecurityError } from '../../errors';\nimport { APP_USER_TOKEN_HEADER } from '../../internal';\nimport { cellParser, createQueryServiceSdk, type ExecuteQueryOptions } from '../queryService';\n\nimport type { RequestContext } from './requestContext';\nimport type { Settings } from './settings';\n\nexport type RunQueryOptions = Pick<ExecuteQueryOptions, 'timeout' | 'maxRows' | 'signal'>;\n\nconst PAGE_SIZE = 10_000;\nconst TIMEOUT = 60_000;\n\nconst refusalWarning = (scope: ReturnType<RequestContext['current']>) => {\n const prefix = '[dataAppServer] row-level security refused';\n if (scope?.appUserToken) return `${prefix} the query for this user`;\n const reason = scope\n ? 'the request has none'\n : 'it ran outside a user request (startup, timer, background job)';\n return `${prefix} a query sent without ${APP_USER_TOKEN_HEADER}: ${reason}`;\n};\n\nconst toRecords = ({ columns = [], data = [], numberOfRows }: QueryResult, capped: boolean) => {\n const parsers = columns.map(({ name, type }) => ({\n key: name.toLowerCase(),\n parse: cellParser(type),\n }));\n const keys = new Set<string>();\n for (const { key } of parsers) {\n if (keys.has(key))\n throw new Error(`runQuery: two columns are named \"${key}\"; alias one with AS`);\n keys.add(key);\n }\n const rows = data.map((row) => {\n const record: Record<string, unknown> = {};\n parsers.forEach(({ key, parse }, i) => {\n const cell = row[i];\n record[key] = cell == null ? null : parse(cell);\n });\n return record;\n });\n if (!capped && numberOfRows !== undefined && rows.length < numberOfRows) {\n throw new Error(`runQuery: got ${rows.length} of ${numberOfRows} rows`);\n }\n return rows;\n};\n\n/**\n * Runs one SQL statement in the app's workspace and resolves every row as a record.\n *\n * - Sends the request's user token with the app's Storage token; without a user, the Storage token.\n * - A repeated column name, or fewer rows than counted (no `maxRows`), throws instead of losing data.\n */\nexport const createRunQuery = (settings: Settings, requestContext: RequestContext) => {\n const queryService = createQueryServiceSdk({\n queryServiceClient: createQueryServiceClient({\n baseUrl: settings.queryServiceUrl,\n auth: async (): Promise<QueryServiceCredential> => {\n const storageToken = await settings.storageToken();\n const appUserToken = requestContext.current()?.appUserToken;\n return appUserToken\n ? { type: 'app-user-token', token: appUserToken, storageToken }\n : { type: 'sapi-token', token: storageToken };\n },\n }),\n });\n\n return async (sql: string, options: RunQueryOptions = {}): Promise<Record<string, unknown>[]> => {\n const scope = requestContext.current();\n const [result] = await queryService\n .executeQuery(\n settings.branchId(),\n await settings.workspaceId(),\n { statements: [sql], transactional: false },\n { ...options, pageSize: PAGE_SIZE, timeout: options.timeout ?? TIMEOUT },\n )\n .catch((error: unknown) => {\n if (isRowLevelSecurityError(error)) console.warn(refusalWarning(scope));\n throw error;\n });\n return result ? toRecords(result, options.maxRows !== undefined) : [];\n };\n};\n","import { readFile } from 'node:fs/promises';\n\nimport { createStorageClient } from '../../clients/storage';\nimport { ServiceId } from '../../constants/serviceIds';\nimport { lazy } from '../../utils/async';\nimport { isPlainObject } from '../../utils/isPlainObject';\n\nexport type Env = Record<string, string | undefined>;\n\n/** A setting the app needs is missing or unreadable; the message names the variable or file. */\nexport class AppConfigError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'AppConfigError';\n }\n}\n\nexport type Settings = ReturnType<typeof createSettings>;\n\nconst STACK_INDEX_TIMEOUT = 10_000;\n\nconst required = (env: Env, name: string) => {\n const value = env[name];\n if (!value) throw new AppConfigError(`Missing environment variable ${name}`);\n return value;\n};\n\nconst storageTokenFrom = async (env: Env) => {\n const file = env.STORAGE_API_TOKEN_PATH;\n if (!file) {\n if (env.KBC_TOKEN) return env.KBC_TOKEN;\n throw new AppConfigError('Missing Storage token: set STORAGE_API_TOKEN_PATH or KBC_TOKEN');\n }\n const content = await readFile(file, 'utf8').catch((error: unknown) => {\n throw new AppConfigError(`Cannot read the file in STORAGE_API_TOKEN_PATH: ${file}`, {\n cause: error,\n });\n });\n const token = content.trim();\n if (!token)\n throw new AppConfigError(`The token file in STORAGE_API_TOKEN_PATH is empty: ${file}`);\n return token;\n};\n\nconst manifestWorkspaceId = async (file: string) => {\n let manifest: unknown;\n try {\n manifest = JSON.parse(await readFile(file, 'utf8'));\n } catch (error) {\n throw new AppConfigError(`Cannot read the JSON in KBC_WORKSPACE_MANIFEST_PATH: ${file}`, {\n cause: error,\n });\n }\n const id = isPlainObject(manifest) ? manifest.workspaceId : undefined;\n if ((typeof id === 'string' && id) || typeof id === 'number') return String(id);\n throw new AppConfigError(\n `The manifest in KBC_WORKSPACE_MANIFEST_PATH has no workspaceId: ${file}`,\n );\n};\n\nconst queryServiceUrlFromIndex = async (kbcUrl: string, token: string) => {\n const { services } = await createStorageClient({\n baseUrl: kbcUrl,\n auth: { type: 'sapi-token', token },\n }).getStackInfo({ exclude: 'components' }, AbortSignal.timeout(STACK_INDEX_TIMEOUT));\n const url = services.find(({ id }) => id === ServiceId.Query)?.url;\n if (!url) throw new AppConfigError('The stack index of KBC_URL lists no query service');\n return url;\n};\n\n/**\n * What the platform provides a data app, read on first use; a missing value throws `AppConfigError`.\n *\n * - The Storage token is read on every call: the platform rotates the file in `STORAGE_API_TOKEN_PATH`.\n * - The workspace ID and the Query Service URL are read once per process.\n * - The Query Service URL is `QUERY_SERVICE_URL`, or the stack index of `KBC_URL` (local runs).\n */\nexport const createSettings = (env: Env) => {\n const storageToken = () => storageTokenFrom(env);\n const manifest = env.KBC_WORKSPACE_MANIFEST_PATH;\n\n return {\n branchId: () => required(env, 'BRANCH_ID'),\n storageToken,\n workspaceId: lazy(() =>\n manifest ? manifestWorkspaceId(manifest) : required(env, 'WORKSPACE_ID'),\n ),\n queryServiceUrl: lazy(\n async () =>\n env.QUERY_SERVICE_URL ||\n queryServiceUrlFromIndex(required(env, 'KBC_URL'), await storageToken()),\n ),\n hasWorkspace: Boolean(manifest || env.WORKSPACE_ID),\n };\n};\n","import { createExpressErrorHandler } from './express';\nimport { type AppRequest, createRequestContext } from './requestContext';\nimport { createRunQuery } from './runQuery';\nimport { createSettings, type Env } from './settings';\n\n/** `env` replaces `process.env` (tests, local runs). */\nexport type DataAppServerOptions = { env?: Env };\n\n/**\n * Sets up Keboola access for this data app process; call it once.\n *\n * - Synchronous, no network call, never throws: each setting is read on first use.\n * - `workspace` is `undefined` when no workspace is configured (the app has no Storage access).\n * - `server.expressMiddleware()` goes first and `server.expressErrorHandler()` last.\n */\nexport const initializeApp = ({ env = process.env }: DataAppServerOptions = {}) => {\n const settings = createSettings(env);\n const requestContext = createRequestContext();\n\n return {\n server: {\n runWithRequest: requestContext.runWithRequest,\n currentUser: requestContext.currentUser,\n currentUserKey: requestContext.currentUserKey,\n expressMiddleware: () => (req: AppRequest, _res: unknown, next: () => void) =>\n requestContext.runWithRequest(req, next),\n expressErrorHandler: createExpressErrorHandler,\n },\n workspace: settings.hasWorkspace\n ? { runQuery: createRunQuery(settings, requestContext)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;;;AC/EA,MAAa,iBAAiB,EAAE,MAAM,QAAQ,QAA8B,CAAC,MAAM;CACjF,MAAM,WAAW,eAAe,GAAG;CACnC,MAAM,iBAAiB,qBAAqB;CAE5C,OAAO;EACL,QAAQ;GACN,gBAAgB,eAAe;GAC/B,aAAa,eAAe;GAC5B,gBAAgB,eAAe;GAC/B,0BAA0B,KAAiB,MAAe,SACxD,eAAe,eAAe,KAAK,IAAI;GACzC,qBAAqB;EACvB;EACA,WAAW,SAAS,eAChB,EAAE,UAAU,eAAe,UAAU,cAAc,EAAE,IACrD,KAAA;CACN;AACF"}
1
+ {"version":3,"file":"index.cjs","names":["isRowLevelSecurityError","HttpStatus","APP_USER_TOKEN_HEADER","readJwtClaims","AsyncLocalStorage","APP_USER_TOKEN_HEADER","cellParser","createQueryServiceSdk","createQueryServiceClient","isRowLevelSecurityError","readFile","isPlainObject","createStorageClient","ServiceId","lazy"],"sources":["../../../src/sdks/dataAppServer/express.ts","../../../src/sdks/dataAppServer/requestContext.ts","../../../src/sdks/dataAppServer/runQuery.ts","../../../src/sdks/dataAppServer/settings.ts","../../../src/sdks/dataAppServer/initializeApp.ts"],"sourcesContent":["import { isRowLevelSecurityError } from '../../errors';\nimport { HttpStatus } from '../../internal';\n\ntype ErrorResponse = {\n headersSent: boolean;\n status(code: number): { json(body: unknown): unknown };\n};\n\n/** Answers a row-level security refusal with 403 and passes any other error on. */\nexport const createExpressErrorHandler =\n () => (err: unknown, _req: unknown, res: ErrorResponse, next: (err?: unknown) => void) => {\n if (res.headersSent || !isRowLevelSecurityError(err)) {\n next(err);\n return;\n }\n res.status(HttpStatus.FORBIDDEN).json({ error: err.message, code: 'ROW_LEVEL_SECURITY' });\n };\n","import { AsyncLocalStorage } from 'node:async_hooks';\n\nimport { APP_USER_TOKEN_HEADER } from '../../internal';\nimport { readJwtClaims } from '../../utils/readJwtClaims';\n\ntype NodeHeaders = Record<string, string | string[] | undefined>;\n\ntype HeadersLike = { get(name: string): string | null };\n\n/** A Fetch `Request` or `Headers`, or a Node request (Express, Fastify) with its lower-case `headers`. */\nexport type AppRequest = HeadersLike | { headers: HeadersLike | NodeHeaders };\n\n/** The signed-in user as the app user token names them; `email` only when the IdP verified it. */\nexport type AppUser = { idp: string; sub: string; email?: string };\n\ntype Scope = { appUserToken: string | undefined; user: AppUser | undefined };\n\nexport type RequestContext = ReturnType<typeof createRequestContext>;\n\nconst isHeadersLike = (headers: HeadersLike | NodeHeaders): headers is HeadersLike =>\n 'get' in headers && typeof headers.get === 'function';\n\nconst appUserTokenOf = (request: AppRequest): string | undefined => {\n const headers = 'headers' in request ? request.headers : request;\n if (isHeadersLike(headers)) return headers.get(APP_USER_TOKEN_HEADER) || undefined;\n const value = headers[APP_USER_TOKEN_HEADER.toLowerCase()];\n return (Array.isArray(value) ? value[0] : value) || undefined;\n};\n\nconst userOf = (token: string): AppUser | undefined => {\n const { idp, sub, email } = readJwtClaims(token) ?? {};\n if (typeof idp !== 'string' || typeof sub !== 'string' || !idp || !sub) return undefined;\n return typeof email === 'string' && email ? { idp, sub, email } : { idp, sub };\n};\n\n/**\n * The signed-in user of the request being handled, kept across every `await` the request makes.\n *\n * - Work the request starts keeps its user: a timer, a promise cached at module level, a listener.\n * - `currentUser()` reads the token payload unverified: safe only behind Keboola's apps proxy.\n * - `currentUserKey()` is the same for every token of one user (`idp` + `sub`): a per-user cache key.\n */\nexport const createRequestContext = () => {\n const storage = new AsyncLocalStorage<Scope>();\n const current = () => storage.getStore();\n\n return {\n runWithRequest: <T>(request: AppRequest, fn: () => T): T => {\n const appUserToken = appUserTokenOf(request);\n return storage.run(\n { appUserToken, user: appUserToken ? userOf(appUserToken) : undefined },\n fn,\n );\n },\n current,\n currentUser: () => current()?.user,\n currentUserKey: () => {\n const user = current()?.user;\n return user && JSON.stringify([user.idp, user.sub]);\n },\n };\n};\n","import { createQueryServiceClient, type QueryServiceCredential } from '../../clients/queryService';\nimport type { QueryResult } from '../../clients/queryService/types';\nimport { isRowLevelSecurityError } from '../../errors';\nimport { APP_USER_TOKEN_HEADER } from '../../internal';\nimport { cellParser, createQueryServiceSdk, type ExecuteQueryOptions } from '../queryService';\n\nimport type { RequestContext } from './requestContext';\nimport type { Settings } from './settings';\n\nexport type RunQueryOptions = Pick<ExecuteQueryOptions, 'timeout' | 'maxRows' | 'signal'>;\n\nconst PAGE_SIZE = 10_000;\nconst TIMEOUT = 60_000;\n\nconst refusalWarning = (scope: ReturnType<RequestContext['current']>) => {\n const prefix = '[dataAppServer] row-level security refused';\n if (scope?.appUserToken) return `${prefix} the query for this user`;\n const reason = scope\n ? 'the request has none'\n : 'it ran outside a user request (startup, timer, background job)';\n return `${prefix} a query sent without ${APP_USER_TOKEN_HEADER}: ${reason}`;\n};\n\nconst toRecords = ({ columns = [], data = [], numberOfRows }: QueryResult, capped: boolean) => {\n const parsers = columns.map(({ name, type }) => ({\n key: name.toLowerCase(),\n parse: cellParser(type),\n }));\n const keys = new Set<string>();\n for (const { key } of parsers) {\n if (keys.has(key))\n throw new Error(`runQuery: two columns are named \"${key}\"; alias one with AS`);\n keys.add(key);\n }\n const rows = data.map((row) => {\n const record: Record<string, unknown> = {};\n parsers.forEach(({ key, parse }, i) => {\n const cell = row[i];\n record[key] = cell == null ? null : parse(cell);\n });\n return record;\n });\n if (!capped && numberOfRows !== undefined && rows.length < numberOfRows) {\n throw new Error(`runQuery: got ${rows.length} of ${numberOfRows} rows`);\n }\n return rows;\n};\n\n/**\n * Runs one SQL statement in the app's workspace and resolves every row as a record.\n *\n * - Sends the request's user token with the app's Storage token; without a user, the Storage token.\n * - A repeated column name, or fewer rows than counted (no `maxRows`), throws instead of losing data.\n */\nexport const createRunQuery = (settings: Settings, requestContext: RequestContext) => {\n const queryService = createQueryServiceSdk({\n queryServiceClient: createQueryServiceClient({\n baseUrl: settings.queryServiceUrl,\n auth: async (): Promise<QueryServiceCredential> => {\n const storageToken = await settings.storageToken();\n const appUserToken = requestContext.current()?.appUserToken;\n return appUserToken\n ? { type: 'app-user-token', token: appUserToken, storageToken }\n : { type: 'sapi-token', token: storageToken };\n },\n }),\n });\n\n return async (sql: string, options: RunQueryOptions = {}): Promise<Record<string, unknown>[]> => {\n const scope = requestContext.current();\n const [result] = await queryService\n .executeQuery(\n settings.branchId(),\n await settings.workspaceId(),\n { statements: [sql], transactional: false },\n { ...options, pageSize: PAGE_SIZE, timeout: options.timeout ?? TIMEOUT },\n )\n .catch((error: unknown) => {\n if (isRowLevelSecurityError(error)) console.warn(refusalWarning(scope));\n throw error;\n });\n return result ? toRecords(result, options.maxRows !== undefined) : [];\n };\n};\n","import { readFile } from 'node:fs/promises';\n\nimport { createStorageClient } from '../../clients/storage';\nimport { ServiceId } from '../../constants/serviceIds';\nimport { lazy } from '../../utils/async';\nimport { isPlainObject } from '../../utils/isPlainObject';\n\nexport type Env = Record<string, string | undefined>;\n\n/** A setting the app needs is missing or unreadable; the message names the variable or file. */\nexport class AppConfigError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'AppConfigError';\n }\n}\n\nexport type Settings = ReturnType<typeof createSettings>;\n\nconst STACK_INDEX_TIMEOUT = 10_000;\n\nconst required = (env: Env, name: string) => {\n const value = env[name];\n if (!value) throw new AppConfigError(`Missing environment variable ${name}`);\n return value;\n};\n\nconst storageTokenFrom = async (env: Env) => {\n const file = env.STORAGE_API_TOKEN_PATH;\n if (!file) {\n if (env.KBC_TOKEN) return env.KBC_TOKEN;\n throw new AppConfigError('Missing Storage token: set STORAGE_API_TOKEN_PATH or KBC_TOKEN');\n }\n const content = await readFile(file, 'utf8').catch((error: unknown) => {\n throw new AppConfigError(`Cannot read the file in STORAGE_API_TOKEN_PATH: ${file}`, {\n cause: error,\n });\n });\n const token = content.trim();\n if (!token)\n throw new AppConfigError(`The token file in STORAGE_API_TOKEN_PATH is empty: ${file}`);\n return token;\n};\n\nconst manifestWorkspaceId = async (file: string) => {\n let manifest: unknown;\n try {\n manifest = JSON.parse(await readFile(file, 'utf8'));\n } catch (error) {\n throw new AppConfigError(`Cannot read the JSON in KBC_WORKSPACE_MANIFEST_PATH: ${file}`, {\n cause: error,\n });\n }\n const id = isPlainObject(manifest) ? manifest.workspaceId : undefined;\n if ((typeof id === 'string' && id) || typeof id === 'number') return String(id);\n throw new AppConfigError(\n `The manifest in KBC_WORKSPACE_MANIFEST_PATH has no workspaceId: ${file}`,\n );\n};\n\nconst queryServiceUrlFromIndex = async (kbcUrl: string, token: string) => {\n const { services } = await createStorageClient({\n baseUrl: kbcUrl,\n auth: { type: 'sapi-token', token },\n }).getStackInfo({ exclude: 'components' }, AbortSignal.timeout(STACK_INDEX_TIMEOUT));\n const url = services.find(({ id }) => id === ServiceId.Query)?.url;\n if (!url) throw new AppConfigError('The stack index of KBC_URL lists no query service');\n return url;\n};\n\n/**\n * What the platform provides a data app, read on first use; a missing value throws `AppConfigError`.\n *\n * - The Storage token is read on every call: the platform rotates the file in `STORAGE_API_TOKEN_PATH`.\n * - The workspace ID and the Query Service URL are read once per process.\n * - The Query Service URL is `QUERY_SERVICE_URL`, or the stack index of `KBC_URL` (local runs).\n */\nexport const createSettings = (env: Env) => {\n const storageToken = () => storageTokenFrom(env);\n const manifest = env.KBC_WORKSPACE_MANIFEST_PATH;\n\n return {\n branchId: () => required(env, 'BRANCH_ID'),\n storageToken,\n workspaceId: lazy(() =>\n manifest ? manifestWorkspaceId(manifest) : required(env, 'WORKSPACE_ID'),\n ),\n queryServiceUrl: lazy(\n async () =>\n env.QUERY_SERVICE_URL ||\n queryServiceUrlFromIndex(required(env, 'KBC_URL'), await storageToken()),\n ),\n hasWorkspace: Boolean(manifest || env.WORKSPACE_ID),\n };\n};\n","import { createExpressErrorHandler } from './express';\nimport { type AppRequest, createRequestContext } from './requestContext';\nimport { createRunQuery } from './runQuery';\nimport { createSettings, type Env } from './settings';\n\n/** `env` replaces `process.env` (tests, local runs). */\nexport type DataAppServerOptions = { env?: Env };\n\n/**\n * Sets up Keboola access for this data app process; call it once.\n *\n * - Synchronous, no network call, never throws: each setting is read on first use.\n * - `workspace` is `undefined` when no workspace is configured (the app has no Storage access).\n * - `server.expressMiddleware()` goes first and `server.expressErrorHandler()` last.\n */\nexport const initializeApp = ({ env = process.env }: DataAppServerOptions = {}) => {\n const settings = createSettings(env);\n const requestContext = createRequestContext();\n\n return {\n server: {\n runWithRequest: requestContext.runWithRequest,\n currentUser: requestContext.currentUser,\n currentUserKey: requestContext.currentUserKey,\n expressMiddleware: () => (req: AppRequest, _res: unknown, next: () => void) =>\n requestContext.runWithRequest(req, next),\n expressErrorHandler: createExpressErrorHandler,\n },\n workspace: settings.hasWorkspace\n ? { runQuery: createRunQuery(settings, requestContext) }\n : undefined,\n };\n};\n\nexport type DataAppServer = ReturnType<typeof initializeApp>;\n"],"mappings":";;;;;;;;;;;;;;AASA,MAAa,mCACJ,KAAc,MAAe,KAAoB,SAAkC;CACxF,IAAI,IAAI,eAAe,CAACA,8BAAAA,wBAAwB,GAAG,GAAG;EACpD,KAAK,GAAG;EACR;CACF;CACA,IAAI,OAAOC,0BAAAA,WAAW,SAAS,CAAC,CAAC,KAAK;EAAE,OAAO,IAAI;EAAS,MAAM;CAAqB,CAAC;AAC1F;;ACGF,MAAM,iBAAiB,YACrB,SAAS,WAAW,OAAO,QAAQ,QAAQ;AAE7C,MAAM,kBAAkB,YAA4C;CAClE,MAAM,UAAU,aAAa,UAAU,QAAQ,UAAU;CACzD,IAAI,cAAc,OAAO,GAAG,OAAO,QAAQ,IAAA,sBAAyB,KAAK,KAAA;CACzE,MAAM,QAAQ,QAAQC,0BAAAA,sBAAsB,YAAY;CACxD,QAAQ,MAAM,QAAQ,KAAK,IAAI,MAAM,KAAK,UAAU,KAAA;AACtD;AAEA,MAAM,UAAU,UAAuC;CACrD,MAAM,EAAE,KAAK,KAAK,UAAUC,sBAAAA,cAAc,KAAK,KAAK,CAAC;CACrD,IAAI,OAAO,QAAQ,YAAY,OAAO,QAAQ,YAAY,CAAC,OAAO,CAAC,KAAK,OAAO,KAAA;CAC/E,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,mDAAmD;CACtF,OAAO;AACT;;;;;;;;AASA,MAAa,kBAAkB,QAAa;CAC1C,MAAM,qBAAqB,iBAAiB,GAAG;CAC/C,MAAM,WAAW,IAAI;CAErB,OAAO;EACL,gBAAgB,SAAS,KAAK,WAAW;EACzC;EACA,aAAaC,yBAAAA,WACX,WAAW,oBAAoB,QAAQ,IAAI,SAAS,KAAK,cAAc,CACzE;EACA,iBAAiBA,yBAAAA,KACf,YACE,IAAI,qBACJ,yBAAyB,SAAS,KAAK,SAAS,GAAG,MAAM,aAAa,CAAC,CAC3E;EACA,cAAc,QAAQ,YAAY,IAAI,YAAY;CACpD;AACF;;;;;;;;;AC/EA,MAAa,iBAAiB,EAAE,MAAM,QAAQ,QAA8B,CAAC,MAAM;CACjF,MAAM,WAAW,eAAe,GAAG;CACnC,MAAM,iBAAiB,qBAAqB;CAE5C,OAAO;EACL,QAAQ;GACN,gBAAgB,eAAe;GAC/B,aAAa,eAAe;GAC5B,gBAAgB,eAAe;GAC/B,0BAA0B,KAAiB,MAAe,SACxD,eAAe,eAAe,KAAK,IAAI;GACzC,qBAAqB;EACvB;EACA,WAAW,SAAS,eAChB,EAAE,UAAU,eAAe,UAAU,cAAc,EAAE,IACrD,KAAA;CACN;AACF"}
@@ -1,4 +1,4 @@
1
- import { x as ExecuteQueryOptions } from "../../index-BtvWJBYh.cjs";
1
+ import { x as ExecuteQueryOptions } from "../../index-DPhGNQC5.cjs";
2
2
  type NodeHeaders = Record<string, string | string[] | undefined>;
3
3
  type HeadersLike = {
4
4
  get(name: string): string | null;
@@ -1,4 +1,4 @@
1
- import { x as ExecuteQueryOptions } from "../../index-Df30jjpZ.js";
1
+ import { x as ExecuteQueryOptions } from "../../index-GlHJ4j3a.js";
2
2
  type NodeHeaders = Record<string, string | string[] | undefined>;
3
3
  type HeadersLike = {
4
4
  get(name: string): string | null;
@@ -1,5 +1,5 @@
1
1
  import { _ as HttpStatus, m as APP_USER_TOKEN_HEADER } from "../../createFetchClient-Dc_ZMuq7.js";
2
- import { t as createStorageClient } from "../../storage--2FvvLAw.js";
2
+ import { t as createStorageClient } from "../../storage-Bw-HSnPp.js";
3
3
  import { n as isRowLevelSecurityError } from "../../RowLevelSecurityError-CObFqj3E.js";
4
4
  import { u as lazy } from "../../transientRetries-BORv47mH.js";
5
5
  import { t as isPlainObject } from "../../isPlainObject-BxsT8_t2.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/sdks/dataAppServer/express.ts","../../../src/sdks/dataAppServer/requestContext.ts","../../../src/sdks/dataAppServer/runQuery.ts","../../../src/sdks/dataAppServer/settings.ts","../../../src/sdks/dataAppServer/initializeApp.ts"],"sourcesContent":["import { isRowLevelSecurityError } from '../../errors';\nimport { HttpStatus } from '../../internal';\n\ntype ErrorResponse = {\n headersSent: boolean;\n status(code: number): { json(body: unknown): unknown };\n};\n\n/** Answers a row-level security refusal with 403 and passes any other error on. */\nexport const createExpressErrorHandler =\n () => (err: unknown, _req: unknown, res: ErrorResponse, next: (err?: unknown) => void) => {\n if (res.headersSent || !isRowLevelSecurityError(err)) {\n next(err);\n return;\n }\n res.status(HttpStatus.FORBIDDEN).json({ error: err.message, code: 'ROW_LEVEL_SECURITY' });\n };\n","import { AsyncLocalStorage } from 'node:async_hooks';\n\nimport { APP_USER_TOKEN_HEADER } from '../../internal';\nimport { readJwtClaims } from '../../utils/readJwtClaims';\n\ntype NodeHeaders = Record<string, string | string[] | undefined>;\n\ntype HeadersLike = { get(name: string): string | null };\n\n/** A Fetch `Request` or `Headers`, or a Node request (Express, Fastify) with its lower-case `headers`. */\nexport type AppRequest = HeadersLike | { headers: HeadersLike | NodeHeaders };\n\n/** The signed-in user as the app user token names them; `email` only when the IdP verified it. */\nexport type AppUser = { idp: string; sub: string; email?: string };\n\ntype Scope = { appUserToken: string | undefined; user: AppUser | undefined };\n\nexport type RequestContext = ReturnType<typeof createRequestContext>;\n\nconst isHeadersLike = (headers: object): headers is HeadersLike =>\n 'get' in headers && typeof headers.get === 'function';\n\nconst appUserTokenOf = (request: AppRequest): string | undefined => {\n const headers = 'headers' in request ? request.headers : request;\n if (isHeadersLike(headers)) return headers.get(APP_USER_TOKEN_HEADER) || undefined;\n const value = headers[APP_USER_TOKEN_HEADER.toLowerCase()];\n return (Array.isArray(value) ? value[0] : value) || undefined;\n};\n\nconst userOf = (token: string): AppUser | undefined => {\n const { idp, sub, email } = readJwtClaims(token) ?? {};\n if (typeof idp !== 'string' || typeof sub !== 'string' || !idp || !sub) return undefined;\n return typeof email === 'string' && email ? { idp, sub, email } : { idp, sub };\n};\n\n/**\n * The signed-in user of the request being handled, kept across every `await` the request makes.\n *\n * - Work the request starts keeps its user: a timer, a promise cached at module level, a listener.\n * - `currentUser()` reads the token payload unverified: safe only behind Keboola's apps proxy.\n * - `currentUserKey()` is the same for every token of one user (`idp` + `sub`): a per-user cache key.\n */\nexport const createRequestContext = () => {\n const storage = new AsyncLocalStorage<Scope>();\n const current = () => storage.getStore();\n\n return {\n runWithRequest: <T>(request: AppRequest, fn: () => T): T => {\n const appUserToken = appUserTokenOf(request);\n return storage.run(\n { appUserToken, user: appUserToken ? userOf(appUserToken) : undefined },\n fn,\n );\n },\n current,\n currentUser: () => current()?.user,\n currentUserKey: () => {\n const user = current()?.user;\n return user && JSON.stringify([user.idp, user.sub]);\n },\n };\n};\n","import { createQueryServiceClient, type QueryServiceCredential } from '../../clients/queryService';\nimport type { QueryResult } from '../../clients/queryService/types';\nimport { isRowLevelSecurityError } from '../../errors';\nimport { APP_USER_TOKEN_HEADER } from '../../internal';\nimport { cellParser, createQueryServiceSdk, type ExecuteQueryOptions } from '../queryService';\n\nimport type { RequestContext } from './requestContext';\nimport type { Settings } from './settings';\n\nexport type RunQueryOptions = Pick<ExecuteQueryOptions, 'timeout' | 'maxRows' | 'signal'>;\n\nconst PAGE_SIZE = 10_000;\nconst TIMEOUT = 60_000;\n\nconst refusalWarning = (scope: ReturnType<RequestContext['current']>) => {\n const prefix = '[dataAppServer] row-level security refused';\n if (scope?.appUserToken) return `${prefix} the query for this user`;\n const reason = scope\n ? 'the request has none'\n : 'it ran outside a user request (startup, timer, background job)';\n return `${prefix} a query sent without ${APP_USER_TOKEN_HEADER}: ${reason}`;\n};\n\nconst toRecords = ({ columns = [], data = [], numberOfRows }: QueryResult, capped: boolean) => {\n const parsers = columns.map(({ name, type }) => ({\n key: name.toLowerCase(),\n parse: cellParser(type),\n }));\n const keys = new Set<string>();\n for (const { key } of parsers) {\n if (keys.has(key))\n throw new Error(`runQuery: two columns are named \"${key}\"; alias one with AS`);\n keys.add(key);\n }\n const rows = data.map((row) => {\n const record: Record<string, unknown> = {};\n parsers.forEach(({ key, parse }, i) => {\n const cell = row[i];\n record[key] = cell == null ? null : parse(cell);\n });\n return record;\n });\n if (!capped && numberOfRows !== undefined && rows.length < numberOfRows) {\n throw new Error(`runQuery: got ${rows.length} of ${numberOfRows} rows`);\n }\n return rows;\n};\n\n/**\n * Runs one SQL statement in the app's workspace and resolves every row as a record.\n *\n * - Sends the request's user token with the app's Storage token; without a user, the Storage token.\n * - A repeated column name, or fewer rows than counted (no `maxRows`), throws instead of losing data.\n */\nexport const createRunQuery = (settings: Settings, requestContext: RequestContext) => {\n const queryService = createQueryServiceSdk({\n queryServiceClient: createQueryServiceClient({\n baseUrl: settings.queryServiceUrl,\n auth: async (): Promise<QueryServiceCredential> => {\n const storageToken = await settings.storageToken();\n const appUserToken = requestContext.current()?.appUserToken;\n return appUserToken\n ? { type: 'app-user-token', token: appUserToken, storageToken }\n : { type: 'sapi-token', token: storageToken };\n },\n }),\n });\n\n return async (sql: string, options: RunQueryOptions = {}): Promise<Record<string, unknown>[]> => {\n const scope = requestContext.current();\n const [result] = await queryService\n .executeQuery(\n settings.branchId(),\n await settings.workspaceId(),\n { statements: [sql], transactional: false },\n { ...options, pageSize: PAGE_SIZE, timeout: options.timeout ?? TIMEOUT },\n )\n .catch((error: unknown) => {\n if (isRowLevelSecurityError(error)) console.warn(refusalWarning(scope));\n throw error;\n });\n return result ? toRecords(result, options.maxRows !== undefined) : [];\n };\n};\n","import { readFile } from 'node:fs/promises';\n\nimport { createStorageClient } from '../../clients/storage';\nimport { ServiceId } from '../../constants/serviceIds';\nimport { lazy } from '../../utils/async';\nimport { isPlainObject } from '../../utils/isPlainObject';\n\nexport type Env = Record<string, string | undefined>;\n\n/** A setting the app needs is missing or unreadable; the message names the variable or file. */\nexport class AppConfigError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'AppConfigError';\n }\n}\n\nexport type Settings = ReturnType<typeof createSettings>;\n\nconst STACK_INDEX_TIMEOUT = 10_000;\n\nconst required = (env: Env, name: string) => {\n const value = env[name];\n if (!value) throw new AppConfigError(`Missing environment variable ${name}`);\n return value;\n};\n\nconst storageTokenFrom = async (env: Env) => {\n const file = env.STORAGE_API_TOKEN_PATH;\n if (!file) {\n if (env.KBC_TOKEN) return env.KBC_TOKEN;\n throw new AppConfigError('Missing Storage token: set STORAGE_API_TOKEN_PATH or KBC_TOKEN');\n }\n const content = await readFile(file, 'utf8').catch((error: unknown) => {\n throw new AppConfigError(`Cannot read the file in STORAGE_API_TOKEN_PATH: ${file}`, {\n cause: error,\n });\n });\n const token = content.trim();\n if (!token)\n throw new AppConfigError(`The token file in STORAGE_API_TOKEN_PATH is empty: ${file}`);\n return token;\n};\n\nconst manifestWorkspaceId = async (file: string) => {\n let manifest: unknown;\n try {\n manifest = JSON.parse(await readFile(file, 'utf8'));\n } catch (error) {\n throw new AppConfigError(`Cannot read the JSON in KBC_WORKSPACE_MANIFEST_PATH: ${file}`, {\n cause: error,\n });\n }\n const id = isPlainObject(manifest) ? manifest.workspaceId : undefined;\n if ((typeof id === 'string' && id) || typeof id === 'number') return String(id);\n throw new AppConfigError(\n `The manifest in KBC_WORKSPACE_MANIFEST_PATH has no workspaceId: ${file}`,\n );\n};\n\nconst queryServiceUrlFromIndex = async (kbcUrl: string, token: string) => {\n const { services } = await createStorageClient({\n baseUrl: kbcUrl,\n auth: { type: 'sapi-token', token },\n }).getStackInfo({ exclude: 'components' }, AbortSignal.timeout(STACK_INDEX_TIMEOUT));\n const url = services.find(({ id }) => id === ServiceId.Query)?.url;\n if (!url) throw new AppConfigError('The stack index of KBC_URL lists no query service');\n return url;\n};\n\n/**\n * What the platform provides a data app, read on first use; a missing value throws `AppConfigError`.\n *\n * - The Storage token is read on every call: the platform rotates the file in `STORAGE_API_TOKEN_PATH`.\n * - The workspace ID and the Query Service URL are read once per process.\n * - The Query Service URL is `QUERY_SERVICE_URL`, or the stack index of `KBC_URL` (local runs).\n */\nexport const createSettings = (env: Env) => {\n const storageToken = () => storageTokenFrom(env);\n const manifest = env.KBC_WORKSPACE_MANIFEST_PATH;\n\n return {\n branchId: () => required(env, 'BRANCH_ID'),\n storageToken,\n workspaceId: lazy(() =>\n manifest ? manifestWorkspaceId(manifest) : required(env, 'WORKSPACE_ID'),\n ),\n queryServiceUrl: lazy(\n async () =>\n env.QUERY_SERVICE_URL ||\n queryServiceUrlFromIndex(required(env, 'KBC_URL'), await storageToken()),\n ),\n hasWorkspace: Boolean(manifest || env.WORKSPACE_ID),\n };\n};\n","import { createExpressErrorHandler } from './express';\nimport { type AppRequest, createRequestContext } from './requestContext';\nimport { createRunQuery } from './runQuery';\nimport { createSettings, type Env } from './settings';\n\n/** `env` replaces `process.env` (tests, local runs). */\nexport type DataAppServerOptions = { env?: Env };\n\n/**\n * Sets up Keboola access for this data app process; call it once.\n *\n * - Synchronous, no network call, never throws: each setting is read on first use.\n * - `workspace` is `undefined` when no workspace is configured (the app has no Storage access).\n * - `server.expressMiddleware()` goes first and `server.expressErrorHandler()` last.\n */\nexport const initializeApp = ({ env = process.env }: DataAppServerOptions = {}) => {\n const settings = createSettings(env);\n const requestContext = createRequestContext();\n\n return {\n server: {\n runWithRequest: requestContext.runWithRequest,\n currentUser: requestContext.currentUser,\n currentUserKey: requestContext.currentUserKey,\n expressMiddleware: () => (req: AppRequest, _res: unknown, next: () => void) =>\n requestContext.runWithRequest(req, next),\n expressErrorHandler: createExpressErrorHandler,\n },\n workspace: settings.hasWorkspace\n ? { runQuery: createRunQuery(settings, requestContext) }\n : undefined,\n };\n};\n\nexport type DataAppServer = ReturnType<typeof initializeApp>;\n"],"mappings":";;;;;;;;;;;;;AASA,MAAa,mCACJ,KAAc,MAAe,KAAoB,SAAkC;CACxF,IAAI,IAAI,eAAe,CAAC,wBAAwB,GAAG,GAAG;EACpD,KAAK,GAAG;EACR;CACF;CACA,IAAI,OAAO,WAAW,SAAS,CAAC,CAAC,KAAK;EAAE,OAAO,IAAI;EAAS,MAAM;CAAqB,CAAC;AAC1F;;ACGF,MAAM,iBAAiB,YACrB,SAAS,WAAW,OAAO,QAAQ,QAAQ;AAE7C,MAAM,kBAAkB,YAA4C;CAClE,MAAM,UAAU,aAAa,UAAU,QAAQ,UAAU;CACzD,IAAI,cAAc,OAAO,GAAG,OAAO,QAAQ,IAAA,sBAAyB,KAAK,KAAA;CACzE,MAAM,QAAQ,QAAQ,sBAAsB,YAAY;CACxD,QAAQ,MAAM,QAAQ,KAAK,IAAI,MAAM,KAAK,UAAU,KAAA;AACtD;AAEA,MAAM,UAAU,UAAuC;CACrD,MAAM,EAAE,KAAK,KAAK,UAAU,cAAc,KAAK,KAAK,CAAC;CACrD,IAAI,OAAO,QAAQ,YAAY,OAAO,QAAQ,YAAY,CAAC,OAAO,CAAC,KAAK,OAAO,KAAA;CAC/E,OAAO,OAAO,UAAU,YAAY,QAAQ;EAAE;EAAK;EAAK;CAAM,IAAI;EAAE;EAAK;CAAI;AAC/E;;;;;;;;AASA,MAAa,6BAA6B;CACxC,MAAM,UAAU,IAAI,kBAAyB;CAC7C,MAAM,gBAAgB,QAAQ,SAAS;CAEvC,OAAO;EACL,iBAAoB,SAAqB,OAAmB;GAC1D,MAAM,eAAe,eAAe,OAAO;GAC3C,OAAO,QAAQ,IACb;IAAE;IAAc,MAAM,eAAe,OAAO,YAAY,IAAI,KAAA;GAAU,GACtE,EACF;E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G;CACnC,MAAM,iBAAiB,qBAAqB;CAE5C,OAAO;EACL,QAAQ;GACN,gBAAgB,eAAe;GAC/B,aAAa,eAAe;GAC5B,gBAAgB,eAAe;GAC/B,0BAA0B,KAAiB,MAAe,SACxD,eAAe,eAAe,KAAK,IAAI;GACzC,qBAAqB;EACvB;EACA,WAAW,SAAS,eAChB,EAAE,UAAU,eAAe,UAAU,cAAc,EAAE,IACrD,KAAA;CACN;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/sdks/dataAppServer/express.ts","../../../src/sdks/dataAppServer/requestContext.ts","../../../src/sdks/dataAppServer/runQuery.ts","../../../src/sdks/dataAppServer/settings.ts","../../../src/sdks/dataAppServer/initializeApp.ts"],"sourcesContent":["import { isRowLevelSecurityError } from '../../errors';\nimport { HttpStatus } from '../../internal';\n\ntype ErrorResponse = {\n headersSent: boolean;\n status(code: number): { json(body: unknown): unknown };\n};\n\n/** Answers a row-level security refusal with 403 and passes any other error on. */\nexport const createExpressErrorHandler =\n () => (err: unknown, _req: unknown, res: ErrorResponse, next: (err?: unknown) => void) => {\n if (res.headersSent || !isRowLevelSecurityError(err)) {\n next(err);\n return;\n }\n res.status(HttpStatus.FORBIDDEN).json({ error: err.message, code: 'ROW_LEVEL_SECURITY' });\n };\n","import { AsyncLocalStorage } from 'node:async_hooks';\n\nimport { APP_USER_TOKEN_HEADER } from '../../internal';\nimport { readJwtClaims } from '../../utils/readJwtClaims';\n\ntype NodeHeaders = Record<string, string | string[] | undefined>;\n\ntype HeadersLike = { get(name: string): string | null };\n\n/** A Fetch `Request` or `Headers`, or a Node request (Express, Fastify) with its lower-case `headers`. */\nexport type AppRequest = HeadersLike | { headers: HeadersLike | NodeHeaders };\n\n/** The signed-in user as the app user token names them; `email` only when the IdP verified it. */\nexport type AppUser = { idp: string; sub: string; email?: string };\n\ntype Scope = { appUserToken: string | undefined; user: AppUser | undefined };\n\nexport type RequestContext = ReturnType<typeof createRequestContext>;\n\nconst isHeadersLike = (headers: HeadersLike | NodeHeaders): headers is HeadersLike =>\n 'get' in headers && typeof headers.get === 'function';\n\nconst appUserTokenOf = (request: AppRequest): string | undefined => {\n const headers = 'headers' in request ? request.headers : request;\n if (isHeadersLike(headers)) return headers.get(APP_USER_TOKEN_HEADER) || undefined;\n const value = headers[APP_USER_TOKEN_HEADER.toLowerCase()];\n return (Array.isArray(value) ? value[0] : value) || undefined;\n};\n\nconst userOf = (token: string): AppUser | undefined => {\n const { idp, sub, email } = readJwtClaims(token) ?? {};\n if (typeof idp !== 'string' || typeof sub !== 'string' || !idp || !sub) return undefined;\n return typeof email === 'string' && email ? { idp, sub, email } : { idp, sub };\n};\n\n/**\n * The signed-in user of the request being handled, kept across every `await` the request makes.\n *\n * - Work the request starts keeps its user: a timer, a promise cached at module level, a listener.\n * - `currentUser()` reads the token payload unverified: safe only behind Keboola's apps proxy.\n * - `currentUserKey()` is the same for every token of one user (`idp` + `sub`): a per-user cache key.\n */\nexport const createRequestContext = () => {\n const storage = new AsyncLocalStorage<Scope>();\n const current = () => storage.getStore();\n\n return {\n runWithRequest: <T>(request: AppRequest, fn: () => T): T => {\n const appUserToken = appUserTokenOf(request);\n return storage.run(\n { appUserToken, user: appUserToken ? userOf(appUserToken) : undefined },\n fn,\n );\n },\n current,\n currentUser: () => current()?.user,\n currentUserKey: () => {\n const user = current()?.user;\n return user && JSON.stringify([user.idp, user.sub]);\n },\n };\n};\n","import { createQueryServiceClient, type QueryServiceCredential } from '../../clients/queryService';\nimport type { QueryResult } from '../../clients/queryService/types';\nimport { isRowLevelSecurityError } from '../../errors';\nimport { APP_USER_TOKEN_HEADER } from '../../internal';\nimport { cellParser, createQueryServiceSdk, type ExecuteQueryOptions } from '../queryService';\n\nimport type { RequestContext } from './requestContext';\nimport type { Settings } from './settings';\n\nexport type RunQueryOptions = Pick<ExecuteQueryOptions, 'timeout' | 'maxRows' | 'signal'>;\n\nconst PAGE_SIZE = 10_000;\nconst TIMEOUT = 60_000;\n\nconst refusalWarning = (scope: ReturnType<RequestContext['current']>) => {\n const prefix = '[dataAppServer] row-level security refused';\n if (scope?.appUserToken) return `${prefix} the query for this user`;\n const reason = scope\n ? 'the request has none'\n : 'it ran outside a user request (startup, timer, background job)';\n return `${prefix} a query sent without ${APP_USER_TOKEN_HEADER}: ${reason}`;\n};\n\nconst toRecords = ({ columns = [], data = [], numberOfRows }: QueryResult, capped: boolean) => {\n const parsers = columns.map(({ name, type }) => ({\n key: name.toLowerCase(),\n parse: cellParser(type),\n }));\n const keys = new Set<string>();\n for (const { key } of parsers) {\n if (keys.has(key))\n throw new Error(`runQuery: two columns are named \"${key}\"; alias one with AS`);\n keys.add(key);\n }\n const rows = data.map((row) => {\n const record: Record<string, unknown> = {};\n parsers.forEach(({ key, parse }, i) => {\n const cell = row[i];\n record[key] = cell == null ? null : parse(cell);\n });\n return record;\n });\n if (!capped && numberOfRows !== undefined && rows.length < numberOfRows) {\n throw new Error(`runQuery: got ${rows.length} of ${numberOfRows} rows`);\n }\n return rows;\n};\n\n/**\n * Runs one SQL statement in the app's workspace and resolves every row as a record.\n *\n * - Sends the request's user token with the app's Storage token; without a user, the Storage token.\n * - A repeated column name, or fewer rows than counted (no `maxRows`), throws instead of losing data.\n */\nexport const createRunQuery = (settings: Settings, requestContext: RequestContext) => {\n const queryService = createQueryServiceSdk({\n queryServiceClient: createQueryServiceClient({\n baseUrl: settings.queryServiceUrl,\n auth: async (): Promise<QueryServiceCredential> => {\n const storageToken = await settings.storageToken();\n const appUserToken = requestContext.current()?.appUserToken;\n return appUserToken\n ? { type: 'app-user-token', token: appUserToken, storageToken }\n : { type: 'sapi-token', token: storageToken };\n },\n }),\n });\n\n return async (sql: string, options: RunQueryOptions = {}): Promise<Record<string, unknown>[]> => {\n const scope = requestContext.current();\n const [result] = await queryService\n .executeQuery(\n settings.branchId(),\n await settings.workspaceId(),\n { statements: [sql], transactional: false },\n { ...options, pageSize: PAGE_SIZE, timeout: options.timeout ?? TIMEOUT },\n )\n .catch((error: unknown) => {\n if (isRowLevelSecurityError(error)) console.warn(refusalWarning(scope));\n throw error;\n });\n return result ? toRecords(result, options.maxRows !== undefined) : [];\n };\n};\n","import { readFile } from 'node:fs/promises';\n\nimport { createStorageClient } from '../../clients/storage';\nimport { ServiceId } from '../../constants/serviceIds';\nimport { lazy } from '../../utils/async';\nimport { isPlainObject } from '../../utils/isPlainObject';\n\nexport type Env = Record<string, string | undefined>;\n\n/** A setting the app needs is missing or unreadable; the message names the variable or file. */\nexport class AppConfigError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = 'AppConfigError';\n }\n}\n\nexport type Settings = ReturnType<typeof createSettings>;\n\nconst STACK_INDEX_TIMEOUT = 10_000;\n\nconst required = (env: Env, name: string) => {\n const value = env[name];\n if (!value) throw new AppConfigError(`Missing environment variable ${name}`);\n return value;\n};\n\nconst storageTokenFrom = async (env: Env) => {\n const file = env.STORAGE_API_TOKEN_PATH;\n if (!file) {\n if (env.KBC_TOKEN) return env.KBC_TOKEN;\n throw new AppConfigError('Missing Storage token: set STORAGE_API_TOKEN_PATH or KBC_TOKEN');\n }\n const content = await readFile(file, 'utf8').catch((error: unknown) => {\n throw new AppConfigError(`Cannot read the file in STORAGE_API_TOKEN_PATH: ${file}`, {\n cause: error,\n });\n });\n const token = content.trim();\n if (!token)\n throw new AppConfigError(`The token file in STORAGE_API_TOKEN_PATH is empty: ${file}`);\n return token;\n};\n\nconst manifestWorkspaceId = async (file: string) => {\n let manifest: unknown;\n try {\n manifest = JSON.parse(await readFile(file, 'utf8'));\n } catch (error) {\n throw new AppConfigError(`Cannot read the JSON in KBC_WORKSPACE_MANIFEST_PATH: ${file}`, {\n cause: error,\n });\n }\n const id = isPlainObject(manifest) ? manifest.workspaceId : undefined;\n if ((typeof id === 'string' && id) || typeof id === 'number') return String(id);\n throw new AppConfigError(\n `The manifest in KBC_WORKSPACE_MANIFEST_PATH has no workspaceId: ${file}`,\n );\n};\n\nconst queryServiceUrlFromIndex = async (kbcUrl: string, token: string) => {\n const { services } = await createStorageClient({\n baseUrl: kbcUrl,\n auth: { type: 'sapi-token', token },\n }).getStackInfo({ exclude: 'components' }, AbortSignal.timeout(STACK_INDEX_TIMEOUT));\n const url = services.find(({ id }) => id === ServiceId.Query)?.url;\n if (!url) throw new AppConfigError('The stack index of KBC_URL lists no query service');\n return url;\n};\n\n/**\n * What the platform provides a data app, read on first use; a missing value throws `AppConfigError`.\n *\n * - The Storage token is read on every call: the platform rotates the file in `STORAGE_API_TOKEN_PATH`.\n * - The workspace ID and the Query Service URL are read once per process.\n * - The Query Service URL is `QUERY_SERVICE_URL`, or the stack index of `KBC_URL` (local runs).\n */\nexport const createSettings = (env: Env) => {\n const storageToken = () => storageTokenFrom(env);\n const manifest = env.KBC_WORKSPACE_MANIFEST_PATH;\n\n return {\n branchId: () => required(env, 'BRANCH_ID'),\n storageToken,\n workspaceId: lazy(() =>\n manifest ? manifestWorkspaceId(manifest) : required(env, 'WORKSPACE_ID'),\n ),\n queryServiceUrl: lazy(\n async () =>\n env.QUERY_SERVICE_URL ||\n queryServiceUrlFromIndex(required(env, 'KBC_URL'), await storageToken()),\n ),\n hasWorkspace: Boolean(manifest || env.WORKSPACE_ID),\n };\n};\n","import { createExpressErrorHandler } from './express';\nimport { type AppRequest, createRequestContext } from './requestContext';\nimport { createRunQuery } from './runQuery';\nimport { createSettings, type Env } from './settings';\n\n/** `env` replaces `process.env` (tests, local runs). */\nexport type DataAppServerOptions = { env?: Env };\n\n/**\n * Sets up Keboola access for this data app process; call it once.\n *\n * - Synchronous, no network call, never throws: each setting is read on first use.\n * - `workspace` is `undefined` when no workspace is configured (the app has no Storage access).\n * - `server.expressMiddleware()` goes first and `server.expressErrorHandler()` last.\n */\nexport const initializeApp = ({ env = process.env }: DataAppServerOptions = {}) => {\n const settings = createSettings(env);\n const requestContext = createRequestContext();\n\n return {\n server: {\n runWithRequest: requestContext.runWithRequest,\n currentUser: requestContext.currentUser,\n currentUserKey: requestContext.currentUserKey,\n expressMiddleware: () => (req: AppRequest, _res: unknown, next: () => void) =>\n requestContext.runWithRequest(req, next),\n expressErrorHandler: createExpressErrorHandler,\n },\n workspace: settings.hasWorkspace\n ? { runQuery: createRunQuery(settings, requestContext) }\n : undefined,\n };\n};\n\nexport type DataAppServer = ReturnType<typeof initializeApp>;\n"],"mappings":";;;;;;;;;;;;;AASA,MAAa,mCACJ,KAAc,MAAe,KAAoB,SAAkC;CACxF,IAAI,IAAI,eAAe,CAAC,wBAAwB,GAAG,GAAG;EACpD,KAAK,GAAG;EACR;CACF;CACA,IAAI,OAAO,WAAW,SAAS,CAAC,CAAC,KAAK;EAAE,OAAO,IAAI;EAAS,MAAM;CAAqB,CAAC;AAC1F;;ACGF,MAAM,iBAAiB,YACrB,SAAS,WAAW,OAAO,QAAQ,QAAQ;AAE7C,MAAM,kBAAkB,YAA4C;CAClE,MAAM,UAAU,aAAa,UAAU,QAAQ,UAAU;CACzD,IAAI,cAAc,OAAO,GAAG,OAAO,QAAQ,IAAA,sBAAyB,KAAK,KAAA;CACzE,MAAM,QAAQ,QAAQ,sBAAsB,YAAY;CACxD,QAAQ,MAAM,QAAQ,KAAK,IAAI,MAAM,KAAK,UAAU,KAAA;AACtD;AAEA,MAAM,UAAU,UAAuC;CACrD,MAAM,EAAE,KAAK,KAAK,UAAU,cAAc,KAAK,KAAK,CAAC;CACrD,IAAI,OAAO,QAAQ,YAAY,OAAO,QAAQ,YAAY,CAAC,OAAO,CAAC,KAAK,OAAO,KAAA;CAC/E,OAAO,OAAO,UAAU,YAAY,QAAQ;EAAE;EAAK;EAAK;CAAM,IAAI;EAAE;EAAK;CAAI;AAC/E;;;;;;;;AASA,MAAa,6BAA6B;CACxC,MAAM,UAAU,IAAI,kBAAyB;CAC7C,MAAM,gBAAgB,QAAQ,SAAS;CAEvC,OAAO;EACL,iBAAoB,SAAqB,OAAmB;GAC1D,MAAM,eAAe,eAAe,OAAO;GAC3C,OAAO,QAAQ,IACb;IAAE;IAAc,MAAM,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,QAA8B,CAAC,MAAM;CACjF,MAAM,WAAW,eAAe,GAAG;CACnC,MAAM,iBAAiB,qBAAqB;CAE5C,OAAO;EACL,QAAQ;GACN,gBAAgB,eAAe;GAC/B,aAAa,eAAe;GAC5B,gBAAgB,eAAe;GAC/B,0BAA0B,KAAiB,MAAe,SACxD,eAAe,eAAe,KAAK,IAAI;GACzC,qBAAqB;EACvB;EACA,WAAW,SAAS,eAChB,EAAE,UAAU,eAAe,UAAU,cAAc,EAAE,IACrD,KAAA;CACN;AACF"}
@@ -1,6 +1,6 @@
1
- import { di as MiddlewareFn } from "../../index-FrsEkDvX.cjs";
2
- import { A as ResetPasswordConfirmInput, E as PaginationQuery, F as UpdateAppAsAdminInput, I as UpdateAppInput, L as UpdateVendorAsAdminInput, N as SignUpInput, R as UpdateVendorInput, S as LoginSuccess, W as components, _ as GetVendorUsersQuery, b as LoginInput, c as ConfirmAccountInput, d as CreateVendorAsAdminInput, f as CreateVendorInput, g as GetChangesQuery, h as GetAppsQuery, k as RejectAppInput, l as CreateAppInput, p as DeprecateAppInput, s as ApproveVendorInput, t as AdminPaginationQuery, u as CreateServiceAccountInput } from "../../types-Cf0WE6qK.cjs";
3
- import { t as DeveloperPortalTokens } from "../../index-BXgjPlZN.cjs";
1
+ import { fi as MiddlewareFn } from "../../index-DcKc3_Y1.cjs";
2
+ import { A as ResetPasswordConfirmInput, E as PaginationQuery, F as UpdateAppAsAdminInput, I as UpdateAppInput, L as UpdateVendorAsAdminInput, N as SignUpInput, R as UpdateVendorInput, S as LoginSuccess, W as components, _ as GetVendorUsersQuery, b as LoginInput, c as ConfirmAccountInput, d as CreateVendorAsAdminInput, f as CreateVendorInput, g as GetChangesQuery, h as GetAppsQuery, k as RejectAppInput, l as CreateAppInput, p as DeprecateAppInput, s as ApproveVendorInput, t as AdminPaginationQuery, u as CreateServiceAccountInput } from "../../types-DtS7qAdz.cjs";
3
+ import { t as DeveloperPortalTokens } from "../../index-DxbqDi_0.cjs";
4
4
  import { n as Listener } from "../../emitter-raKkIqRp.cjs";
5
5
  type DeveloperPortalSdkOptions = {
6
6
  baseUrl: string;
@@ -1,6 +1,6 @@
1
- import { di as MiddlewareFn } from "../../index-FrsEkDvX.js";
2
- import { A as ResetPasswordConfirmInput, E as PaginationQuery, F as UpdateAppAsAdminInput, I as UpdateAppInput, L as UpdateVendorAsAdminInput, N as SignUpInput, R as UpdateVendorInput, S as LoginSuccess, W as components, _ as GetVendorUsersQuery, b as LoginInput, c as ConfirmAccountInput, d as CreateVendorAsAdminInput, f as CreateVendorInput, g as GetChangesQuery, h as GetAppsQuery, k as RejectAppInput, l as CreateAppInput, p as DeprecateAppInput, s as ApproveVendorInput, t as AdminPaginationQuery, u as CreateServiceAccountInput } from "../../types-dU3EA8gk.js";
3
- import { t as DeveloperPortalTokens } from "../../index-DLWMm1-T.js";
1
+ import { fi as MiddlewareFn } from "../../index-DcKc3_Y1.js";
2
+ import { A as ResetPasswordConfirmInput, E as PaginationQuery, F as UpdateAppAsAdminInput, I as UpdateAppInput, L as UpdateVendorAsAdminInput, N as SignUpInput, R as UpdateVendorInput, S as LoginSuccess, W as components, _ as GetVendorUsersQuery, b as LoginInput, c as ConfirmAccountInput, d as CreateVendorAsAdminInput, f as CreateVendorInput, g as GetChangesQuery, h as GetAppsQuery, k as RejectAppInput, l as CreateAppInput, p as DeprecateAppInput, s as ApproveVendorInput, t as AdminPaginationQuery, u as CreateServiceAccountInput } from "../../types-BnkHyxdp.js";
3
+ import { t as DeveloperPortalTokens } from "../../index-A8udJCGv.js";
4
4
  import { n as Listener } from "../../emitter-raKkIqRp.js";
5
5
  type DeveloperPortalSdkOptions = {
6
6
  baseUrl: string;
@@ -1,4 +1,4 @@
1
- import { a as KaiMemoryStatus, c as KAI_MEMORY_STATUSES, o as MetastoreClient, r as KaiMemoryItem, s as UpdateKaiMemoryMeta, t as CreateKaiMemoryMeta } from "../../types-CSE8bHiq.cjs";
1
+ import { a as KaiMemoryStatus, c as KAI_MEMORY_STATUSES, o as MetastoreClient, r as KaiMemoryItem, s as UpdateKaiMemoryMeta, t as CreateKaiMemoryMeta } from "../../types-Cm1iOHE5.cjs";
2
2
  /** The metastore object type this SDK addresses — see `SEMANTIC_OBJECT_TYPE` for the convention. */
3
3
  declare const KAI_MEMORY_OBJECT_TYPE = "kai-memory";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { a as KaiMemoryStatus, c as KAI_MEMORY_STATUSES, o as MetastoreClient, r as KaiMemoryItem, s as UpdateKaiMemoryMeta, t as CreateKaiMemoryMeta } from "../../types-zlYUn0oi.js";
1
+ import { a as KaiMemoryStatus, c as KAI_MEMORY_STATUSES, o as MetastoreClient, r as KaiMemoryItem, s as UpdateKaiMemoryMeta, t as CreateKaiMemoryMeta } from "../../types-B5FgsIiY.js";
2
2
  /** The metastore object type this SDK addresses — see `SEMANTIC_OBJECT_TYPE` for the convention. */
3
3
  declare const KAI_MEMORY_OBJECT_TYPE = "kai-memory";
4
4
  /**
@@ -1,2 +1,2 @@
1
- import { a as KaiMemoryStatus, i as KaiMemoryMeta, n as KaiMemoryData, o as MetastoreClient, r as KaiMemoryItem, s as UpdateKaiMemoryMeta, t as CreateKaiMemoryMeta } from "../../types-CSE8bHiq.cjs";
1
+ import { a as KaiMemoryStatus, i as KaiMemoryMeta, n as KaiMemoryData, o as MetastoreClient, r as KaiMemoryItem, s as UpdateKaiMemoryMeta, t as CreateKaiMemoryMeta } from "../../types-Cm1iOHE5.cjs";
2
2
  export { CreateKaiMemoryMeta, KaiMemoryData, KaiMemoryItem, KaiMemoryMeta, KaiMemoryStatus, MetastoreClient, UpdateKaiMemoryMeta };
@@ -1,2 +1,2 @@
1
- import { a as KaiMemoryStatus, i as KaiMemoryMeta, n as KaiMemoryData, o as MetastoreClient, r as KaiMemoryItem, s as UpdateKaiMemoryMeta, t as CreateKaiMemoryMeta } from "../../types-zlYUn0oi.js";
1
+ import { a as KaiMemoryStatus, i as KaiMemoryMeta, n as KaiMemoryData, o as MetastoreClient, r as KaiMemoryItem, s as UpdateKaiMemoryMeta, t as CreateKaiMemoryMeta } from "../../types-B5FgsIiY.js";
2
2
  export { CreateKaiMemoryMeta, KaiMemoryData, KaiMemoryItem, KaiMemoryMeta, KaiMemoryStatus, MetastoreClient, UpdateKaiMemoryMeta };
@@ -1,2 +1,2 @@
1
- import { S as createQueryServiceSdk, b as cellParser, x as ExecuteQueryOptions } from "../../index-BtvWJBYh.cjs";
1
+ import { S as createQueryServiceSdk, b as cellParser, x as ExecuteQueryOptions } from "../../index-DPhGNQC5.cjs";
2
2
  export { ExecuteQueryOptions, cellParser, createQueryServiceSdk };
@@ -1,2 +1,2 @@
1
- import { S as createQueryServiceSdk, b as cellParser, x as ExecuteQueryOptions } from "../../index-Df30jjpZ.js";
1
+ import { S as createQueryServiceSdk, b as cellParser, x as ExecuteQueryOptions } from "../../index-GlHJ4j3a.js";
2
2
  export { ExecuteQueryOptions, cellParser, createQueryServiceSdk };