@pikku/addon-twist 0.0.2

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 (307) hide show
  1. package/README.md +12 -0
  2. package/dist/.pikku/addon/pikku-addon-types.gen.d.ts +67 -0
  3. package/dist/.pikku/addon/pikku-addon-types.gen.d.ts.map +1 -0
  4. package/dist/.pikku/addon/pikku-addon-types.gen.js +78 -0
  5. package/dist/.pikku/addon/pikku-addon-types.gen.js.map +1 -0
  6. package/dist/.pikku/addon/pikku-addon-types.gen.ts +106 -0
  7. package/dist/.pikku/addon/pikku-package.gen.d.ts +2 -0
  8. package/dist/.pikku/addon/pikku-package.gen.d.ts.map +1 -0
  9. package/dist/.pikku/addon/pikku-package.gen.js +11 -0
  10. package/dist/.pikku/addon/pikku-package.gen.js.map +1 -0
  11. package/dist/.pikku/addon/pikku-package.gen.ts +13 -0
  12. package/dist/.pikku/agent/pikku-agent-map.gen.d.ts +4 -0
  13. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +47 -0
  14. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts.map +1 -0
  15. package/dist/.pikku/agent/pikku-agent-types.gen.js +18 -0
  16. package/dist/.pikku/agent/pikku-agent-types.gen.js.map +1 -0
  17. package/dist/.pikku/agent/pikku-agent-types.gen.ts +82 -0
  18. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +112 -0
  19. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts.map +1 -0
  20. package/dist/.pikku/channel/pikku-channel-types.gen.js +60 -0
  21. package/dist/.pikku/channel/pikku-channel-types.gen.js.map +1 -0
  22. package/dist/.pikku/channel/pikku-channel-types.gen.ts +177 -0
  23. package/dist/.pikku/console/pikku-addon-meta.gen.json +14 -0
  24. package/dist/.pikku/console/pikku-node-types.gen.d.ts +7 -0
  25. package/dist/.pikku/console/pikku-node-types.gen.d.ts.map +1 -0
  26. package/dist/.pikku/console/pikku-node-types.gen.js +2 -0
  27. package/dist/.pikku/console/pikku-node-types.gen.js.map +1 -0
  28. package/dist/.pikku/console/pikku-node-types.gen.ts +8 -0
  29. package/dist/.pikku/credentials/pikku-credentials-meta.gen.json +20 -0
  30. package/dist/.pikku/credentials/pikku-credentials.gen.d.ts +15 -0
  31. package/dist/.pikku/credentials/pikku-credentials.gen.d.ts.map +1 -0
  32. package/dist/.pikku/credentials/pikku-credentials.gen.js +13 -0
  33. package/dist/.pikku/credentials/pikku-credentials.gen.js.map +1 -0
  34. package/dist/.pikku/credentials/pikku-credentials.gen.ts +23 -0
  35. package/dist/.pikku/function/pikku-function-types.gen.d.ts +490 -0
  36. package/dist/.pikku/function/pikku-function-types.gen.d.ts.map +1 -0
  37. package/dist/.pikku/function/pikku-function-types.gen.js +334 -0
  38. package/dist/.pikku/function/pikku-function-types.gen.js.map +1 -0
  39. package/dist/.pikku/function/pikku-function-types.gen.ts +754 -0
  40. package/dist/.pikku/function/pikku-functions-meta-verbose.gen.json +640 -0
  41. package/dist/.pikku/function/pikku-functions-meta.gen.d.ts +2 -0
  42. package/dist/.pikku/function/pikku-functions-meta.gen.d.ts.map +1 -0
  43. package/dist/.pikku/function/pikku-functions-meta.gen.js +7 -0
  44. package/dist/.pikku/function/pikku-functions-meta.gen.js.map +1 -0
  45. package/dist/.pikku/function/pikku-functions-meta.gen.json +420 -0
  46. package/dist/.pikku/function/pikku-functions-meta.gen.ts +7 -0
  47. package/dist/.pikku/function/pikku-functions.gen.d.ts +2 -0
  48. package/dist/.pikku/function/pikku-functions.gen.d.ts.map +1 -0
  49. package/dist/.pikku/function/pikku-functions.gen.js +50 -0
  50. package/dist/.pikku/function/pikku-functions.gen.js.map +1 -0
  51. package/dist/.pikku/function/pikku-functions.gen.ts +50 -0
  52. package/dist/.pikku/http/pikku-http-types.gen.d.ts +120 -0
  53. package/dist/.pikku/http/pikku-http-types.gen.d.ts.map +1 -0
  54. package/dist/.pikku/http/pikku-http-types.gen.js +72 -0
  55. package/dist/.pikku/http/pikku-http-types.gen.js.map +1 -0
  56. package/dist/.pikku/http/pikku-http-types.gen.ts +147 -0
  57. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +131 -0
  58. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts.map +1 -0
  59. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +38 -0
  60. package/dist/.pikku/mcp/pikku-mcp-types.gen.js.map +1 -0
  61. package/dist/.pikku/mcp/pikku-mcp-types.gen.ts +183 -0
  62. package/dist/.pikku/pikku-bootstrap.gen.d.ts +9 -0
  63. package/dist/.pikku/pikku-bootstrap.gen.d.ts.map +1 -0
  64. package/dist/.pikku/pikku-bootstrap.gen.js +9 -0
  65. package/dist/.pikku/pikku-bootstrap.gen.js.map +1 -0
  66. package/dist/.pikku/pikku-bootstrap.gen.ts +8 -0
  67. package/dist/.pikku/pikku-meta-service.gen.d.ts +8 -0
  68. package/dist/.pikku/pikku-meta-service.gen.d.ts.map +1 -0
  69. package/dist/.pikku/pikku-meta-service.gen.js +10 -0
  70. package/dist/.pikku/pikku-meta-service.gen.js.map +1 -0
  71. package/dist/.pikku/pikku-meta-service.gen.ts +10 -0
  72. package/dist/.pikku/pikku-services.gen.d.ts +36 -0
  73. package/dist/.pikku/pikku-services.gen.d.ts.map +1 -0
  74. package/dist/.pikku/pikku-services.gen.js +32 -0
  75. package/dist/.pikku/pikku-services.gen.js.map +1 -0
  76. package/dist/.pikku/pikku-services.gen.ts +45 -0
  77. package/dist/.pikku/pikku-types.gen.d.ts +12 -0
  78. package/dist/.pikku/pikku-types.gen.d.ts.map +1 -0
  79. package/dist/.pikku/pikku-types.gen.js +17 -0
  80. package/dist/.pikku/pikku-types.gen.js.map +1 -0
  81. package/dist/.pikku/pikku-types.gen.ts +21 -0
  82. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +24 -0
  83. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts.map +1 -0
  84. package/dist/.pikku/queue/pikku-queue-types.gen.js +17 -0
  85. package/dist/.pikku/queue/pikku-queue-types.gen.js.map +1 -0
  86. package/dist/.pikku/queue/pikku-queue-types.gen.ts +27 -0
  87. package/dist/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +248 -0
  88. package/dist/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +270 -0
  89. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts +2 -0
  90. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts.map +1 -0
  91. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +7 -0
  92. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js.map +1 -0
  93. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +24 -0
  94. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +6 -0
  95. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +22 -0
  96. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts.map +1 -0
  97. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +17 -0
  98. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js.map +1 -0
  99. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.ts +25 -0
  100. package/dist/.pikku/schemas/register.gen.d.ts +2 -0
  101. package/dist/.pikku/schemas/register.gen.d.ts.map +1 -0
  102. package/dist/.pikku/schemas/register.gen.js +99 -0
  103. package/dist/.pikku/schemas/register.gen.js.map +1 -0
  104. package/dist/.pikku/schemas/register.gen.ts +191 -0
  105. package/dist/.pikku/schemas/schemas/ChannelArchiveInput.schema.json +1 -0
  106. package/dist/.pikku/schemas/schemas/ChannelArchiveOutput.schema.json +1 -0
  107. package/dist/.pikku/schemas/schemas/ChannelCreateInput.schema.json +1 -0
  108. package/dist/.pikku/schemas/schemas/ChannelCreateOutput.schema.json +1 -0
  109. package/dist/.pikku/schemas/schemas/ChannelDeleteInput.schema.json +1 -0
  110. package/dist/.pikku/schemas/schemas/ChannelDeleteOutput.schema.json +1 -0
  111. package/dist/.pikku/schemas/schemas/ChannelGetAllInput.schema.json +1 -0
  112. package/dist/.pikku/schemas/schemas/ChannelGetAllOutput.schema.json +1 -0
  113. package/dist/.pikku/schemas/schemas/ChannelGetInput.schema.json +1 -0
  114. package/dist/.pikku/schemas/schemas/ChannelGetOutput.schema.json +1 -0
  115. package/dist/.pikku/schemas/schemas/ChannelUnarchiveInput.schema.json +1 -0
  116. package/dist/.pikku/schemas/schemas/ChannelUnarchiveOutput.schema.json +1 -0
  117. package/dist/.pikku/schemas/schemas/ChannelUpdateInput.schema.json +1 -0
  118. package/dist/.pikku/schemas/schemas/ChannelUpdateOutput.schema.json +1 -0
  119. package/dist/.pikku/schemas/schemas/CommentCreateInput.schema.json +1 -0
  120. package/dist/.pikku/schemas/schemas/CommentCreateOutput.schema.json +1 -0
  121. package/dist/.pikku/schemas/schemas/CommentDeleteInput.schema.json +1 -0
  122. package/dist/.pikku/schemas/schemas/CommentDeleteOutput.schema.json +1 -0
  123. package/dist/.pikku/schemas/schemas/CommentGetAllInput.schema.json +1 -0
  124. package/dist/.pikku/schemas/schemas/CommentGetAllOutput.schema.json +1 -0
  125. package/dist/.pikku/schemas/schemas/CommentGetInput.schema.json +1 -0
  126. package/dist/.pikku/schemas/schemas/CommentGetOutput.schema.json +1 -0
  127. package/dist/.pikku/schemas/schemas/CommentUpdateInput.schema.json +1 -0
  128. package/dist/.pikku/schemas/schemas/CommentUpdateOutput.schema.json +1 -0
  129. package/dist/.pikku/schemas/schemas/CredentialSchema_twist.schema.json +1 -0
  130. package/dist/.pikku/schemas/schemas/MessageCreateInput.schema.json +1 -0
  131. package/dist/.pikku/schemas/schemas/MessageCreateOutput.schema.json +1 -0
  132. package/dist/.pikku/schemas/schemas/MessageDeleteInput.schema.json +1 -0
  133. package/dist/.pikku/schemas/schemas/MessageDeleteOutput.schema.json +1 -0
  134. package/dist/.pikku/schemas/schemas/MessageGetAllInput.schema.json +1 -0
  135. package/dist/.pikku/schemas/schemas/MessageGetAllOutput.schema.json +1 -0
  136. package/dist/.pikku/schemas/schemas/MessageGetInput.schema.json +1 -0
  137. package/dist/.pikku/schemas/schemas/MessageGetOutput.schema.json +1 -0
  138. package/dist/.pikku/schemas/schemas/MessageUpdateInput.schema.json +1 -0
  139. package/dist/.pikku/schemas/schemas/MessageUpdateOutput.schema.json +1 -0
  140. package/dist/.pikku/schemas/schemas/SecretSchema_twistOAuthApp.schema.json +1 -0
  141. package/dist/.pikku/schemas/schemas/ThreadCreateInput.schema.json +1 -0
  142. package/dist/.pikku/schemas/schemas/ThreadCreateOutput.schema.json +1 -0
  143. package/dist/.pikku/schemas/schemas/ThreadDeleteInput.schema.json +1 -0
  144. package/dist/.pikku/schemas/schemas/ThreadDeleteOutput.schema.json +1 -0
  145. package/dist/.pikku/schemas/schemas/ThreadGetAllInput.schema.json +1 -0
  146. package/dist/.pikku/schemas/schemas/ThreadGetAllOutput.schema.json +1 -0
  147. package/dist/.pikku/schemas/schemas/ThreadGetInput.schema.json +1 -0
  148. package/dist/.pikku/schemas/schemas/ThreadGetOutput.schema.json +1 -0
  149. package/dist/.pikku/schemas/schemas/ThreadUpdateInput.schema.json +1 -0
  150. package/dist/.pikku/schemas/schemas/ThreadUpdateOutput.schema.json +1 -0
  151. package/dist/.pikku/schemas/schemas/VariableSchema_TWIST_BASE_URL.schema.json +1 -0
  152. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +6 -0
  153. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts.map +1 -0
  154. package/dist/.pikku/secrets/pikku-secret-types.gen.js +5 -0
  155. package/dist/.pikku/secrets/pikku-secret-types.gen.js.map +1 -0
  156. package/dist/.pikku/secrets/pikku-secret-types.gen.ts +5 -0
  157. package/dist/.pikku/secrets/pikku-secrets-meta.gen.json +10 -0
  158. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +15 -0
  159. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts.map +1 -0
  160. package/dist/.pikku/secrets/pikku-secrets.gen.js +13 -0
  161. package/dist/.pikku/secrets/pikku-secrets.gen.js.map +1 -0
  162. package/dist/.pikku/secrets/pikku-secrets.gen.ts +23 -0
  163. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +114 -0
  164. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts.map +1 -0
  165. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +34 -0
  166. package/dist/.pikku/trigger/pikku-trigger-types.gen.js.map +1 -0
  167. package/dist/.pikku/trigger/pikku-trigger-types.gen.ts +160 -0
  168. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +6 -0
  169. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts.map +1 -0
  170. package/dist/.pikku/variables/pikku-variable-types.gen.js +5 -0
  171. package/dist/.pikku/variables/pikku-variable-types.gen.js.map +1 -0
  172. package/dist/.pikku/variables/pikku-variable-types.gen.ts +5 -0
  173. package/dist/.pikku/variables/pikku-variables-meta.gen.json +10 -0
  174. package/dist/.pikku/variables/pikku-variables.gen.d.ts +15 -0
  175. package/dist/.pikku/variables/pikku-variables.gen.d.ts.map +1 -0
  176. package/dist/.pikku/variables/pikku-variables.gen.js +13 -0
  177. package/dist/.pikku/variables/pikku-variables.gen.js.map +1 -0
  178. package/dist/.pikku/variables/pikku-variables.gen.ts +23 -0
  179. package/dist/.pikku/workflow/pikku-workflow-map.gen.d.ts +38 -0
  180. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +90 -0
  181. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts.map +1 -0
  182. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +18 -0
  183. package/dist/.pikku/workflow/pikku-workflow-types.gen.js.map +1 -0
  184. package/dist/.pikku/workflow/pikku-workflow-types.gen.ts +167 -0
  185. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.d.ts +2 -0
  186. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.d.ts.map +1 -0
  187. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +7 -0
  188. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js.map +1 -0
  189. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +9 -0
  190. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +5 -0
  191. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts.map +1 -0
  192. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +5 -0
  193. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js.map +1 -0
  194. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.ts +3 -0
  195. package/dist/src/functions/channelArchive.function.d.ts +13 -0
  196. package/dist/src/functions/channelArchive.function.d.ts.map +1 -0
  197. package/dist/src/functions/channelArchive.function.js +15 -0
  198. package/dist/src/functions/channelArchive.function.js.map +1 -0
  199. package/dist/src/functions/channelCreate.function.d.ts +17 -0
  200. package/dist/src/functions/channelCreate.function.d.ts.map +1 -0
  201. package/dist/src/functions/channelCreate.function.js +16 -0
  202. package/dist/src/functions/channelCreate.function.js.map +1 -0
  203. package/dist/src/functions/channelDelete.function.d.ts +13 -0
  204. package/dist/src/functions/channelDelete.function.d.ts.map +1 -0
  205. package/dist/src/functions/channelDelete.function.js +15 -0
  206. package/dist/src/functions/channelDelete.function.js.map +1 -0
  207. package/dist/src/functions/channelGet.function.d.ts +13 -0
  208. package/dist/src/functions/channelGet.function.d.ts.map +1 -0
  209. package/dist/src/functions/channelGet.function.js +15 -0
  210. package/dist/src/functions/channelGet.function.js.map +1 -0
  211. package/dist/src/functions/channelGetAll.function.d.ts +13 -0
  212. package/dist/src/functions/channelGetAll.function.d.ts.map +1 -0
  213. package/dist/src/functions/channelGetAll.function.js +15 -0
  214. package/dist/src/functions/channelGetAll.function.js.map +1 -0
  215. package/dist/src/functions/channelUnarchive.function.d.ts +13 -0
  216. package/dist/src/functions/channelUnarchive.function.d.ts.map +1 -0
  217. package/dist/src/functions/channelUnarchive.function.js +15 -0
  218. package/dist/src/functions/channelUnarchive.function.js.map +1 -0
  219. package/dist/src/functions/channelUpdate.function.d.ts +17 -0
  220. package/dist/src/functions/channelUpdate.function.d.ts.map +1 -0
  221. package/dist/src/functions/channelUpdate.function.js +16 -0
  222. package/dist/src/functions/channelUpdate.function.js.map +1 -0
  223. package/dist/src/functions/commentCreate.function.d.ts +17 -0
  224. package/dist/src/functions/commentCreate.function.d.ts.map +1 -0
  225. package/dist/src/functions/commentCreate.function.js +16 -0
  226. package/dist/src/functions/commentCreate.function.js.map +1 -0
  227. package/dist/src/functions/commentDelete.function.d.ts +13 -0
  228. package/dist/src/functions/commentDelete.function.d.ts.map +1 -0
  229. package/dist/src/functions/commentDelete.function.js +15 -0
  230. package/dist/src/functions/commentDelete.function.js.map +1 -0
  231. package/dist/src/functions/commentGet.function.d.ts +13 -0
  232. package/dist/src/functions/commentGet.function.d.ts.map +1 -0
  233. package/dist/src/functions/commentGet.function.js +15 -0
  234. package/dist/src/functions/commentGet.function.js.map +1 -0
  235. package/dist/src/functions/commentGetAll.function.d.ts +13 -0
  236. package/dist/src/functions/commentGetAll.function.d.ts.map +1 -0
  237. package/dist/src/functions/commentGetAll.function.js +15 -0
  238. package/dist/src/functions/commentGetAll.function.js.map +1 -0
  239. package/dist/src/functions/commentUpdate.function.d.ts +17 -0
  240. package/dist/src/functions/commentUpdate.function.d.ts.map +1 -0
  241. package/dist/src/functions/commentUpdate.function.js +16 -0
  242. package/dist/src/functions/commentUpdate.function.js.map +1 -0
  243. package/dist/src/functions/messageCreate.function.d.ts +21 -0
  244. package/dist/src/functions/messageCreate.function.d.ts.map +1 -0
  245. package/dist/src/functions/messageCreate.function.js +17 -0
  246. package/dist/src/functions/messageCreate.function.js.map +1 -0
  247. package/dist/src/functions/messageDelete.function.d.ts +13 -0
  248. package/dist/src/functions/messageDelete.function.d.ts.map +1 -0
  249. package/dist/src/functions/messageDelete.function.js +15 -0
  250. package/dist/src/functions/messageDelete.function.js.map +1 -0
  251. package/dist/src/functions/messageGet.function.d.ts +13 -0
  252. package/dist/src/functions/messageGet.function.d.ts.map +1 -0
  253. package/dist/src/functions/messageGet.function.js +15 -0
  254. package/dist/src/functions/messageGet.function.js.map +1 -0
  255. package/dist/src/functions/messageGetAll.function.d.ts +13 -0
  256. package/dist/src/functions/messageGetAll.function.d.ts.map +1 -0
  257. package/dist/src/functions/messageGetAll.function.js +15 -0
  258. package/dist/src/functions/messageGetAll.function.js.map +1 -0
  259. package/dist/src/functions/messageUpdate.function.d.ts +17 -0
  260. package/dist/src/functions/messageUpdate.function.d.ts.map +1 -0
  261. package/dist/src/functions/messageUpdate.function.js +16 -0
  262. package/dist/src/functions/messageUpdate.function.js.map +1 -0
  263. package/dist/src/functions/threadCreate.function.d.ts +21 -0
  264. package/dist/src/functions/threadCreate.function.d.ts.map +1 -0
  265. package/dist/src/functions/threadCreate.function.js +17 -0
  266. package/dist/src/functions/threadCreate.function.js.map +1 -0
  267. package/dist/src/functions/threadDelete.function.d.ts +13 -0
  268. package/dist/src/functions/threadDelete.function.d.ts.map +1 -0
  269. package/dist/src/functions/threadDelete.function.js +15 -0
  270. package/dist/src/functions/threadDelete.function.js.map +1 -0
  271. package/dist/src/functions/threadGet.function.d.ts +13 -0
  272. package/dist/src/functions/threadGet.function.d.ts.map +1 -0
  273. package/dist/src/functions/threadGet.function.js +15 -0
  274. package/dist/src/functions/threadGet.function.js.map +1 -0
  275. package/dist/src/functions/threadGetAll.function.d.ts +13 -0
  276. package/dist/src/functions/threadGetAll.function.d.ts.map +1 -0
  277. package/dist/src/functions/threadGetAll.function.js +15 -0
  278. package/dist/src/functions/threadGetAll.function.js.map +1 -0
  279. package/dist/src/functions/threadUpdate.function.d.ts +21 -0
  280. package/dist/src/functions/threadUpdate.function.d.ts.map +1 -0
  281. package/dist/src/functions/threadUpdate.function.js +17 -0
  282. package/dist/src/functions/threadUpdate.function.js.map +1 -0
  283. package/dist/src/index.d.ts +23 -0
  284. package/dist/src/index.d.ts.map +1 -0
  285. package/dist/src/index.js +23 -0
  286. package/dist/src/index.js.map +1 -0
  287. package/dist/src/services.d.ts +2 -0
  288. package/dist/src/services.d.ts.map +1 -0
  289. package/dist/src/services.js +7 -0
  290. package/dist/src/services.js.map +1 -0
  291. package/dist/src/twist-api.service.d.ts +15 -0
  292. package/dist/src/twist-api.service.d.ts.map +1 -0
  293. package/dist/src/twist-api.service.js +219 -0
  294. package/dist/src/twist-api.service.js.map +1 -0
  295. package/dist/src/twist.credential.d.ts +10 -0
  296. package/dist/src/twist.credential.d.ts.map +1 -0
  297. package/dist/src/twist.credential.js +33 -0
  298. package/dist/src/twist.credential.js.map +1 -0
  299. package/dist/src/twist.types.d.ts +7 -0
  300. package/dist/src/twist.types.d.ts.map +1 -0
  301. package/dist/src/twist.types.js +8 -0
  302. package/dist/src/twist.types.js.map +1 -0
  303. package/dist/src/twist.variable.d.ts +5 -0
  304. package/dist/src/twist.variable.d.ts.map +1 -0
  305. package/dist/src/twist.variable.js +11 -0
  306. package/dist/src/twist.variable.js.map +1 -0
  307. package/package.json +39 -0
@@ -0,0 +1,754 @@
1
+ /**
2
+ * This file was generated by @pikku/cli@0.12.54
3
+ */
4
+ /**
5
+ * Core function, middleware, and permission types for all wirings
6
+ */
7
+
8
+ import type { CorePikkuMiddleware, CorePermissionGroup, ListInput, ListOutput, PikkuWire, PickRequired } from '@pikku/core'
9
+ import type { CorePikkuFunctionConfig, CorePikkuAuth, CorePikkuAuthConfig, CorePikkuPermission } from '@pikku/core/function'
10
+ import { pikkuAuth as pikkuAuthCore } from '@pikku/core/function'
11
+ import {
12
+ addTagMiddleware as addTagMiddlewareCore,
13
+ addGlobalMiddleware as addGlobalMiddlewareCore,
14
+ addTagPermission as addTagPermissionCore,
15
+ addGlobalPermission as addGlobalPermissionCore,
16
+ } from '@pikku/core/middleware'
17
+ import { pikkuState as __pikkuState, CreateWireServices } from '@pikku/core/internal'
18
+ import type { NodeType } from '@pikku/core/node'
19
+ import type { StandardSchemaV1 } from '@standard-schema/spec'
20
+ import { CorePikkuFunction, CorePikkuFunctionSessionless } from '@pikku/core/function'
21
+
22
+ import type { UserSession } from '../../types/application-types.d.js'
23
+ import type { SingletonServices } from '../../types/application-types.d.js'
24
+ import type { Services } from '../../types/application-types.d.js'
25
+ import type { Config } from '../../types/application-types.d.js'
26
+ import type { TypedPikkuRPC, FlattenedRPCMap } from '../rpc/pikku-rpc-wirings-map.internal.gen.d.js'
27
+ import type { RequiredSingletonServices, RequiredWireServices } from '../pikku-services.gen.js'
28
+ import type { TypedWorkflow } from '../workflow/pikku-workflow-types.gen.js'
29
+
30
+ export type { SingletonServices as SingletonServices }
31
+ export type { Services as Services }
32
+ export type Session = UserSession
33
+
34
+
35
+ /**
36
+ * Inline node configuration for function definitions.
37
+ */
38
+ export type NodeConfig = {
39
+ displayName: string
40
+ category: string
41
+ type: NodeType
42
+ errorOutput?: boolean
43
+ }
44
+
45
+ /**
46
+ * Type-safe API permission definition that integrates with your application's session type.
47
+ * Use this to define authorization logic for your API endpoints.
48
+ *
49
+ * @template In - The input type that the permission check will receive
50
+ * @template RequiredServices - The services required for this permission check
51
+ */
52
+ export type PikkuPermission<In = unknown, RequiredServices extends Services = Services> = CorePikkuPermission<In, RequiredServices, PikkuWire<In, never, false, Session>>
53
+
54
+ /**
55
+ * Type-safe middleware definition that can access your application's services and session.
56
+ * Use this to define reusable middleware that can be applied to multiple wirings.
57
+ *
58
+ * @template RequiredServices - The services required for this middleware
59
+ */
60
+ export type PikkuMiddleware<RequiredServices extends SingletonServices = SingletonServices> = CorePikkuMiddleware<RequiredServices>
61
+
62
+ /**
63
+ * Configuration object for creating a permission with metadata
64
+ */
65
+ export type PikkuPermissionConfig<In = unknown, RequiredServices extends Services = Services> = {
66
+ /** The permission function */
67
+ func: PikkuPermission<In, RequiredServices>
68
+ /** Optional human-readable name for the permission */
69
+ name?: string
70
+ /** Optional description of what the permission checks */
71
+ description?: string
72
+ }
73
+
74
+ /**
75
+ * Factory function for creating permissions with tree-shaking support.
76
+ * Supports both direct function and configuration object syntax.
77
+ *
78
+ * @example
79
+ * ```typescript
80
+ * // Direct function syntax
81
+ * const permission = pikkuPermission(async ({ logger }, data, { session }) => {
82
+ * const session = await session?.get()
83
+ * return session?.role === 'admin'
84
+ * })
85
+ *
86
+ * // Configuration object syntax with metadata
87
+ * const adminPermission = pikkuPermission({
88
+ * name: 'Admin Permission',
89
+ * description: 'Checks if user has admin role',
90
+ * func: async ({ logger }, data, { session }) => {
91
+ * const session = await session?.get()
92
+ * return session?.role === 'admin'
93
+ * }
94
+ * })
95
+ * ```
96
+ */
97
+ export const pikkuPermission = <In>(
98
+ permission: PikkuPermission<In> | PikkuPermissionConfig<In>
99
+ ): PikkuPermission<In> => {
100
+ return typeof permission === 'function' ? permission : permission.func
101
+ }
102
+
103
+ /**
104
+ * Type-safe auth-only permission that only needs services and session.
105
+ * Use this for upfront authorization gates (MCP tools, AI agents, workflows)
106
+ * where request data isn't available yet.
107
+ *
108
+ * @template RequiredServices - The services required for this auth check
109
+ */
110
+ export type PikkuAuth<RequiredServices extends SingletonServices = SingletonServices> = CorePikkuAuth<RequiredServices, Session>
111
+
112
+ /**
113
+ * Configuration object for creating an auth permission with metadata
114
+ */
115
+ export type PikkuAuthConfig<RequiredServices extends SingletonServices = SingletonServices> = CorePikkuAuthConfig<RequiredServices, Session>
116
+
117
+ /**
118
+ * Factory function for creating auth-only permissions with tree-shaking support.
119
+ * Auth permissions only receive services and session (no request data),
120
+ * making them evaluable before request data is available.
121
+ *
122
+ * @example
123
+ * \`\`\`typescript
124
+ * const isAuthenticated = pikkuAuth(async ({ logger }, session) => {
125
+ * return !!session
126
+ * })
127
+ *
128
+ * const isAdmin = pikkuAuth({
129
+ * name: 'Admin Auth',
130
+ * description: 'Checks if user is an admin',
131
+ * func: async ({ logger }, session) => {
132
+ * return session?.role === 'admin'
133
+ * }
134
+ * })
135
+ * \`\`\`
136
+ */
137
+ export const pikkuAuth = <RequiredServices extends SingletonServices = SingletonServices>(
138
+ auth: PikkuAuth<RequiredServices> | PikkuAuthConfig<RequiredServices>
139
+ ): PikkuPermission<any, any> => {
140
+ return pikkuAuthCore(auth as any) as any
141
+ }
142
+
143
+ /**
144
+ * Configuration object for creating middleware with metadata
145
+ */
146
+ export type PikkuMiddlewareConfig<RequiredServices extends SingletonServices = SingletonServices> = {
147
+ /** The middleware function */
148
+ func: PikkuMiddleware<RequiredServices>
149
+ /** Optional human-readable name for the middleware */
150
+ name?: string
151
+ /** Optional description of what the middleware does */
152
+ description?: string
153
+ }
154
+
155
+ /**
156
+ * Factory function for creating middleware with tree-shaking support.
157
+ * Supports both direct function and configuration object syntax.
158
+ *
159
+ * @example
160
+ * ```typescript
161
+ * // Direct function syntax
162
+ * const middleware = pikkuMiddleware(({ logger }, wires, next) => {
163
+ * logger.info('Middleware executed')
164
+ * await next()
165
+ * })
166
+ *
167
+ * // Configuration object syntax with metadata
168
+ * const logMiddleware = pikkuMiddleware({
169
+ * name: 'Request Logger',
170
+ * description: 'Logs all incoming requests',
171
+ * func: async ({ logger }, wires, next) => {
172
+ * logger.info('Request started')
173
+ * await next()
174
+ * }
175
+ * })
176
+ * ```
177
+ */
178
+ export const pikkuMiddleware = <RequiredServices extends SingletonServices = SingletonServices>(
179
+ middleware: PikkuMiddleware<RequiredServices> | PikkuMiddlewareConfig<RequiredServices>
180
+ ): PikkuMiddleware<RequiredServices> => {
181
+ return typeof middleware === 'function' ? middleware : middleware.func
182
+ }
183
+
184
+ /**
185
+ * Factory function for creating middleware factories
186
+ * Use this when your middleware needs configuration/input parameters
187
+ *
188
+ * @example
189
+ * ```typescript
190
+ * export const logMiddleware = pikkuMiddlewareFactory<LogOptions>(({
191
+ * message,
192
+ * level = 'info'
193
+ * }) => {
194
+ * return pikkuMiddleware(async ({ logger }, next) => {
195
+ * logger[level](message)
196
+ * await next()
197
+ * })
198
+ * })
199
+ * ```
200
+ */
201
+ export const pikkuMiddlewareFactory = <In = any>(
202
+ factory: (input: In) => PikkuMiddleware
203
+ ): ((input: In) => PikkuMiddleware) => {
204
+ return factory
205
+ }
206
+
207
+ /**
208
+ * Factory function for creating permission factories
209
+ * Use this when your permission needs configuration/input parameters
210
+ *
211
+ * @example
212
+ * ```typescript
213
+ * export const requireRole = pikkuPermissionFactory<{ role: string }>(({
214
+ * role
215
+ * }) => {
216
+ * return pikkuPermission(async ({ logger }, data, { session }) => {
217
+ * if (!session || session.role !== role) {
218
+ * logger.warn(`Permission denied: required role '${role}'`)
219
+ * return false
220
+ * }
221
+ * return true
222
+ * })
223
+ * })
224
+ * ```
225
+ */
226
+ export const pikkuPermissionFactory = <In = any>(
227
+ factory: (input: In) => PikkuPermission<any>
228
+ ): ((input: In) => PikkuPermission<any>) => {
229
+ return factory
230
+ }
231
+
232
+ /**
233
+ * A function that generates a human-readable description of a pending approval action.
234
+ * Used by AI agents to show meaningful approval prompts instead of raw tool arguments.
235
+ *
236
+ * @template In - The input type (same as the function it describes)
237
+ * @template RequiredServices - The services required for this description function
238
+ */
239
+ export type PikkuApprovalDescription<In = unknown, RequiredServices extends Services = Services> = (
240
+ services: RequiredServices,
241
+ data: In
242
+ ) => Promise<string>
243
+
244
+ /**
245
+ * Factory function for creating approval description functions with tree-shaking support.
246
+ *
247
+ * @example
248
+ * ```typescript
249
+ * export const deleteTodoApproval = pikkuApprovalDescription(
250
+ * async ({ todoStore }, { id }) => {
251
+ * const todo = await todoStore.get(id)
252
+ * return \`Delete todo: "${todo.title}"\`
253
+ * }
254
+ * )
255
+ * ```
256
+ */
257
+ export const pikkuApprovalDescription = <In = unknown, RequiredServices extends Services = Services>(
258
+ fn: PikkuApprovalDescription<In, RequiredServices>
259
+ ): PikkuApprovalDescription<In, RequiredServices> => {
260
+ return fn
261
+ }
262
+
263
+ /**
264
+ * A sessionless API function that doesn't require user authentication.
265
+ * Use this for public endpoints, health checks, or operations that don't need user context.
266
+ *
267
+ * @template In - The input type
268
+ * @template Out - The output type that the function returns
269
+ * @template RequiredServices - Services required by this function
270
+ */
271
+ export type PikkuFunctionSessionless<
272
+ In = unknown,
273
+ Out = never,
274
+ RequiredWires extends keyof PikkuWire = never,
275
+ RequiredServices extends Services = Services
276
+ > = CorePikkuFunctionSessionless<
277
+ In,
278
+ Out,
279
+ RequiredServices,
280
+ Session,
281
+ PickRequired<PikkuWire<In, Out, false, Session, TypedPikkuRPC, null, any, TypedWorkflow>, RequiredWires>
282
+ >
283
+
284
+ /**
285
+ * A session-aware API function that requires user authentication.
286
+ * Use this for protected endpoints that need access to user session data.
287
+ *
288
+ * @template In - The input type
289
+ * @template Out - The output type that the function returns
290
+ * @template RequiredServices - Services required by this function
291
+ */
292
+ export type PikkuFunction<
293
+ In = unknown,
294
+ Out = never,
295
+ RequiredWires extends keyof PikkuWire = 'session',
296
+ RequiredServices extends Services = Services
297
+ > = CorePikkuFunction<
298
+ In,
299
+ Out,
300
+ RequiredServices,
301
+ Session,
302
+ PickRequired<PikkuWire<In, Out, true, Session, TypedPikkuRPC, null, any, TypedWorkflow>, RequiredWires>
303
+ >
304
+
305
+ /**
306
+ * Helper type to infer the output type from a Standard Schema
307
+ */
308
+ export type InferSchemaOutput<T> = T extends StandardSchemaV1<any, infer Output> ? Output : never
309
+
310
+ /**
311
+ * Configuration object for Pikku functions with optional middleware, permissions, tags, and documentation.
312
+ * This type wraps CorePikkuFunctionConfig with the user's custom types.
313
+ *
314
+ * @template In - The input type
315
+ * @template Out - The output type
316
+ * @template PikkuFunc - The function type (can be narrowed to PikkuFunction or PikkuFunctionSessionless)
317
+ */
318
+ export type PikkuFunctionConfig<
319
+ In = unknown,
320
+ Out = unknown,
321
+ RequiredWires extends keyof PikkuWire = never,
322
+ PikkuFunc extends PikkuFunction<In, Out, RequiredWires> | PikkuFunctionSessionless<In, Out, RequiredWires> = PikkuFunction<In, Out, RequiredWires> | PikkuFunctionSessionless<In, Out, RequiredWires>,
323
+ InputSchema extends StandardSchemaV1 | undefined = undefined,
324
+ OutputSchema extends StandardSchemaV1 | undefined = undefined
325
+ > = CorePikkuFunctionConfig<PikkuFunc, PikkuPermission<In>, PikkuMiddleware, InputSchema, OutputSchema>
326
+
327
+ /**
328
+ * Configuration object for Pikku functions with Zod schema validation.
329
+ * Use this when you want to define input/output schemas using Zod.
330
+ * Types are automatically inferred from the schemas.
331
+ */
332
+ type SchemaInferred<S, Fallback = unknown> = S extends StandardSchemaV1
333
+ ? InferSchemaOutput<S>
334
+ : Fallback
335
+
336
+ /**
337
+ * Schema-overload variant for pikkuFunc. Derived from CorePikkuFunctionConfig
338
+ * so adding a field on the core type automatically propagates here.
339
+ */
340
+ export type PikkuFunctionConfigWithSchema<
341
+ InputSchema extends StandardSchemaV1 | undefined = undefined,
342
+ OutputSchema extends StandardSchemaV1 | undefined = undefined,
343
+ RequiredWires extends keyof PikkuWire = never
344
+ > = Omit<
345
+ CorePikkuFunctionConfig<
346
+ | PikkuFunction<SchemaInferred<InputSchema>, SchemaInferred<OutputSchema>, RequiredWires>
347
+ | PikkuFunctionSessionless<SchemaInferred<InputSchema>, SchemaInferred<OutputSchema>, RequiredWires>
348
+ >,
349
+ 'func' | 'input' | 'output' | 'permissions' | 'approvalDescription'
350
+ > & {
351
+ func:
352
+ | PikkuFunction<SchemaInferred<InputSchema>, SchemaInferred<OutputSchema>, RequiredWires>
353
+ | PikkuFunctionSessionless<SchemaInferred<InputSchema>, SchemaInferred<OutputSchema>, RequiredWires>
354
+ input?: InputSchema
355
+ output?: OutputSchema
356
+ permissions?: InputSchema extends StandardSchemaV1
357
+ ? CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>>
358
+ : undefined
359
+ approvalDescription?: InputSchema extends StandardSchemaV1
360
+ ? PikkuApprovalDescription<InferSchemaOutput<InputSchema>>
361
+ : never
362
+ }
363
+
364
+ /**
365
+ * Creates a Pikku function that can be either session-aware or sessionless.
366
+ * This is the main function wrapper for creating API endpoints.
367
+ *
368
+ * Supports two patterns:
369
+ * 1. Generic types: `pikkuFunc<Input, Output>({ func: ... })`
370
+ * 2. Zod schemas: `pikkuFunc({ input: z.object(...), output: z.object(...), func: ... })`
371
+ *
372
+ * @template In - Input type for the function (inferred from schema if provided)
373
+ * @template Out - Output type for the function (inferred from schema if provided)
374
+ * @param func - Function definition, either direct function or configuration object
375
+ * @returns The normalized configuration object
376
+ *
377
+ * @example
378
+ * ```typescript
379
+ * // Pattern 1: Using generic types
380
+ * const createUser = pikkuFunc<{name: string, email: string}, {id: number}>({
381
+ * func: async ({db}, input) => {
382
+ * const user = await db.users.create(input)
383
+ * return { id: user.id }
384
+ * }
385
+ * })
386
+ *
387
+ * // Pattern 2: Using Zod schemas (types inferred automatically)
388
+ * const createUserInput = z.object({ name: z.string(), email: z.string() })
389
+ * const createUserOutput = z.object({ id: z.number() })
390
+ *
391
+ * const createUser = pikkuFunc({
392
+ * input: createUserInput,
393
+ * output: createUserOutput,
394
+ * func: async ({db}, input) => {
395
+ * // input is typed as { name: string, email: string }
396
+ * const user = await db.users.create(input)
397
+ * return { id: user.id } // must match output schema
398
+ * }
399
+ * })
400
+ * ```
401
+ */
402
+ export function pikkuFunc<
403
+ InputSchema extends StandardSchemaV1 | undefined = undefined,
404
+ OutputSchema extends StandardSchemaV1 | undefined = undefined
405
+ >(
406
+ config: PikkuFunctionConfigWithSchema<InputSchema, OutputSchema, 'session' | 'rpc'>
407
+ ): PikkuFunctionConfig<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'session' | 'rpc'>
408
+ export function pikkuFunc<In, Out = unknown>(
409
+ func:
410
+ | PikkuFunction<In, Out, 'session' | 'rpc'>
411
+ | PikkuFunctionConfig<In, Out, 'session' | 'rpc'>
412
+ ): PikkuFunctionConfig<In, Out, 'session' | 'rpc'>
413
+ export function pikkuFunc(func: any) {
414
+ return typeof func === 'function' ? { func } : func
415
+ }
416
+
417
+ export type PikkuListFunction<
418
+ F extends Record<string, unknown> = {},
419
+ Row = unknown,
420
+ S extends string = never
421
+ > =
422
+ | PikkuFunction<ListInput<F, S>, ListOutput<Row>, 'session' | 'rpc'>
423
+ | PikkuFunctionSessionless<
424
+ ListInput<F, S>,
425
+ ListOutput<Row>,
426
+ 'session' | 'rpc'
427
+ >
428
+
429
+ export const pikkuListFunc = <
430
+ F extends Record<string, unknown> = {},
431
+ Row = unknown,
432
+ S extends string = never
433
+ >(
434
+ config: PikkuFunctionConfig<
435
+ ListInput<F, S>,
436
+ ListOutput<Row>,
437
+ 'session' | 'rpc'
438
+ >
439
+ ): PikkuFunctionConfig<ListInput<F, S>, ListOutput<Row>, 'session' | 'rpc'> => {
440
+ return pikkuFunc(config)
441
+ }
442
+
443
+ /**
444
+ * Configuration object for sessionless Pikku functions with Zod schema validation.
445
+ */
446
+ /**
447
+ * Schema-overload variant for pikkuSessionlessFunc. Derived from
448
+ * CorePikkuFunctionConfig to stay in sync with the generic-typed config.
449
+ */
450
+ export type PikkuFunctionSessionlessConfigWithSchema<
451
+ InputSchema extends StandardSchemaV1 | undefined = undefined,
452
+ OutputSchema extends StandardSchemaV1 | undefined = undefined,
453
+ RequiredWires extends keyof PikkuWire = never
454
+ > = Omit<
455
+ CorePikkuFunctionConfig<
456
+ PikkuFunctionSessionless<SchemaInferred<InputSchema>, SchemaInferred<OutputSchema>, RequiredWires>
457
+ >,
458
+ 'func' | 'input' | 'output' | 'permissions' | 'approvalDescription'
459
+ > & {
460
+ func: PikkuFunctionSessionless<
461
+ SchemaInferred<InputSchema>,
462
+ SchemaInferred<OutputSchema>,
463
+ RequiredWires
464
+ >
465
+ input?: InputSchema
466
+ output?: OutputSchema
467
+ permissions?: InputSchema extends StandardSchemaV1
468
+ ? CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>>
469
+ : undefined
470
+ approvalDescription?: InputSchema extends StandardSchemaV1
471
+ ? PikkuApprovalDescription<InferSchemaOutput<InputSchema>>
472
+ : never
473
+ }
474
+
475
+ /**
476
+ * Creates a sessionless Pikku function that doesn't require user authentication.
477
+ * Use this for public endpoints, webhooks, or background tasks.
478
+ *
479
+ * Supports two patterns:
480
+ * 1. Generic types: `pikkuSessionlessFunc<Input, Output>({ func: ... })`
481
+ * 2. Zod schemas: `pikkuSessionlessFunc({ input: z.object(...), func: ... })`
482
+ *
483
+ * @template In - Input type for the function (inferred from schema if provided)
484
+ * @template Out - Output type for the function (inferred from schema if provided)
485
+ * @param func - Function definition, either direct function or configuration object
486
+ * @returns The normalized configuration object
487
+ *
488
+ * @example
489
+ * ```typescript
490
+ * // Pattern 1: Using generic types
491
+ * const healthCheck = pikkuSessionlessFunc<void, {status: string}>({
492
+ * func: async ({logger}) => {
493
+ * return { status: 'healthy' }
494
+ * }
495
+ * })
496
+ *
497
+ * // Pattern 2: Using Zod schemas
498
+ * const greetInput = z.object({ name: z.string() })
499
+ * const greetOutput = z.object({ message: z.string() })
500
+ *
501
+ * const greet = pikkuSessionlessFunc({
502
+ * input: greetInput,
503
+ * output: greetOutput,
504
+ * func: async (_services, { name }) => {
505
+ * return { message: `Hello, ${name}!` }
506
+ * }
507
+ * })
508
+ * ```
509
+ */
510
+ export function pikkuSessionlessFunc<
511
+ InputSchema extends StandardSchemaV1 | undefined = undefined,
512
+ OutputSchema extends StandardSchemaV1 | undefined = undefined
513
+ >(
514
+ config: PikkuFunctionSessionlessConfigWithSchema<InputSchema, OutputSchema, 'session' | 'rpc'>
515
+ ): PikkuFunctionConfig<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'session' | 'rpc'>
516
+ export function pikkuSessionlessFunc<In, Out = unknown>(
517
+ func:
518
+ | PikkuFunctionSessionless<In, Out, 'session' | 'rpc'>
519
+ | PikkuFunctionConfig<In, Out, 'session' | 'rpc'>
520
+ ): PikkuFunctionConfig<In, Out, 'session' | 'rpc'>
521
+ export function pikkuSessionlessFunc(func: any) {
522
+ return typeof func === 'function' ? { func } : func
523
+ }
524
+
525
+ /**
526
+ * Creates a function that takes no input and returns no output.
527
+ * Useful for health checks, triggers, or cleanup operations.
528
+ *
529
+ * @param func - Function definition, either direct function or configuration object
530
+ * @returns The normalized configuration object
531
+ *
532
+ * @example
533
+ * ```typescript
534
+ * const cleanupTempFiles = pikkuVoidFunc(async ({fileSystem, logger}) => {
535
+ * logger.info('Starting cleanup of temporary files')
536
+ * await fileSystem.deleteDirectory('/tmp/uploads')
537
+ * logger.info('Cleanup completed')
538
+ * })
539
+ * ```
540
+ */
541
+ export const pikkuVoidFunc = (
542
+ func:
543
+ | PikkuFunctionSessionless<void, void, 'session' | 'rpc'>
544
+ | PikkuFunctionConfig<void, void, 'session' | 'rpc'>
545
+ ) => {
546
+ return typeof func === 'function' ? { func } : func
547
+ }
548
+
549
+ /**
550
+ * References a registered function by name for use in any wiring.
551
+ * Works for both local and addon functions — resolves via RPC at runtime.
552
+ *
553
+ * @template Name - The function name (must be a key in FlattenedRPCMap)
554
+ * @param rpcName - The name of the function to reference
555
+ * @returns A Pikku function config that proxies calls via RPC
556
+ *
557
+ * @example
558
+ * ```typescript
559
+ * // Use in agent tools
560
+ * tools: [ref('todos:listTodos'), ref('myLocalFunc')]
561
+ *
562
+ * // Use in HTTP wiring
563
+ * wireHTTP({ route: '/greet', method: 'post', func: ref('greet') })
564
+ * ```
565
+ */
566
+ export const ref = <Name extends keyof FlattenedRPCMap>(
567
+ rpcName: Name
568
+ ): PikkuFunctionConfig<
569
+ FlattenedRPCMap[Name]['input'],
570
+ FlattenedRPCMap[Name]['output'],
571
+ 'session' | 'rpc'
572
+ > => {
573
+ return {
574
+ func: async (_services: any, data: FlattenedRPCMap[Name]['input'], { rpc }: any) => {
575
+ return rpc.invoke(rpcName, data)
576
+ }
577
+ } as PikkuFunctionConfig<
578
+ FlattenedRPCMap[Name]['input'],
579
+ FlattenedRPCMap[Name]['output'],
580
+ 'session' | 'rpc'
581
+ >
582
+ }
583
+
584
+ /**
585
+ * Creates a Pikku config factory.
586
+ * Use this to define your application's configuration factory.
587
+ *
588
+ * @param func - Config factory function that returns your application's config
589
+ * @returns The config factory function
590
+ *
591
+ * @example
592
+ * ```typescript
593
+ * export const createConfig = pikkuConfig(async () => {
594
+ * return {
595
+ * apiUrl: process.env.API_URL || 'http://localhost:3000',
596
+ * dbUrl: process.env.DATABASE_URL
597
+ * }
598
+ * })
599
+ * ```
600
+ */
601
+ export const pikkuConfig = (
602
+ func: (variables?: any, ...args: any[]) => Promise<Config>
603
+ ) => func
604
+
605
+
606
+ /**
607
+ * Creates a Pikku singleton services factory.
608
+ * Use this to define services that are created once and shared across all requests.
609
+ *
610
+ * @param func - Singleton services factory function
611
+ * @returns The singleton services factory function
612
+ *
613
+ * @example
614
+ * ```typescript
615
+ * export const createSingletonServices = pikkuServices(async (config, existingServices) => {
616
+ * return {
617
+ * config,
618
+ * logger: new CustomLogger(),
619
+ * db: await createDatabaseConnection(config.dbUrl)
620
+ * }
621
+ * })
622
+ * ```
623
+ */
624
+ export const pikkuServices = (
625
+ func: (config: Config, existingServices: Partial<SingletonServices>) => Promise<Partial<Omit<RequiredSingletonServices, 'auth'>>>
626
+ ) => {
627
+ return async (config: Config, existingServices: Partial<SingletonServices> = {}) => {
628
+ const createdServices = await func(config, existingServices)
629
+ const services = { ...existingServices, ...createdServices }
630
+ const authFactory = __pikkuState(null, 'package', 'authFactory')
631
+ if (authFactory) {
632
+ let authInstance: Promise<unknown> | undefined
633
+ ;(services as any).auth = () => {
634
+ authInstance ??= Promise.resolve()
635
+ .then(() => authFactory(services as any))
636
+ .catch((error) => {
637
+ authInstance = undefined
638
+ throw error
639
+ })
640
+ return authInstance
641
+ }
642
+ }
643
+ const resolved = services as RequiredSingletonServices
644
+ __pikkuState(null, 'package', 'singletonServices', resolved as any)
645
+ return resolved
646
+ }
647
+ }
648
+
649
+ /**
650
+ * Creates a Pikku wire services factory.
651
+ * Use this to define services that are created per-request/session.
652
+ *
653
+ * @param func - Wire services factory function
654
+ * @returns The wire services factory function
655
+ *
656
+ * @example
657
+ * ```typescript
658
+ * export const createWireServices = pikkuWireServices(async (services, wire) => {
659
+ * const session = await wire.session?.get()
660
+ * return {
661
+ * userCache: new UserCache(session?.userId)
662
+ * }
663
+ * })
664
+ * ```
665
+ */
666
+ export const pikkuWireServices = (
667
+ func: (
668
+ services: SingletonServices,
669
+ wire: any
670
+ ) => Promise<RequiredWireServices>
671
+ ): CreateWireServices => {
672
+ const factories = __pikkuState(null, 'package', 'factories')
673
+ __pikkuState(null, 'package', 'factories', { ...factories, createWireServices: func as any })
674
+ return func as unknown as CreateWireServices
675
+ }
676
+
677
+ /**
678
+ * Tag-scoped middleware. Applies to any wiring that carries the matching tag.
679
+ *
680
+ * @example
681
+ * addTagMiddleware('admin', [adminMiddleware])
682
+ */
683
+ export const addTagMiddleware = (tag: string, middleware: PikkuMiddleware[]) => {
684
+ addTagMiddlewareCore(tag, middleware as any, '@pikku/addon-twist')
685
+ }
686
+
687
+ /**
688
+ * Wire-agnostic global middleware. Runs at the top of every wiring's
689
+ * middleware chain — before wire-, tag-, and function-level entries.
690
+ *
691
+ * Resolution order: global -> wire -> tag -> function.
692
+ *
693
+ * @example
694
+ * addGlobalMiddleware([telemetryMiddleware])
695
+ */
696
+ export const addGlobalMiddleware = (middleware: PikkuMiddleware[]) => {
697
+ addGlobalMiddlewareCore(middleware as any, '@pikku/addon-twist')
698
+ }
699
+
700
+ /**
701
+ * Tag-scoped permissions. Applies to any wiring that carries the matching tag.
702
+ *
703
+ * @example
704
+ * addTagPermission('admin', [adminPermission])
705
+ */
706
+ export const addTagPermission = <In = unknown>(tag: string, permissions: CorePermissionGroup<PikkuPermission<In>> | PikkuPermission<In>[]) => {
707
+ addTagPermissionCore(tag, permissions as any, '@pikku/addon-twist')
708
+ }
709
+
710
+ /**
711
+ * Wire-agnostic global permissions. Runs at the top of every wiring's
712
+ * permission resolution — before wire-, tag-, and function-level entries.
713
+ *
714
+ * Resolution order: global -> wire -> tag -> function.
715
+ *
716
+ * @example
717
+ * addGlobalPermission([signedInUser])
718
+ */
719
+ export const addGlobalPermission = <In = unknown>(permissions: CorePermissionGroup<PikkuPermission<In>> | PikkuPermission<In>[]) => {
720
+ addGlobalPermissionCore(permissions as any, '@pikku/addon-twist')
721
+ }
722
+
723
+ export { wireAddon } from '@pikku/core/rpc'
724
+ export type { WireAddonConfig } from '@pikku/core/rpc'
725
+
726
+
727
+ /**
728
+ * Addon contract references. Generated from each wired addon's published
729
+ * contract metadata — no addon source is imported. Functions are proxied via
730
+ * ref() (RPC) exactly like ref('namespace:fn').
731
+ */
732
+ const __addonHttp = {} as const
733
+ const __addonChannel = {} as const
734
+ const __addonCli = {} as const
735
+
736
+ export const refHTTP = <Name extends keyof typeof __addonHttp>(
737
+ name: Name,
738
+ options?: { basePath?: string }
739
+ ): (typeof __addonHttp)[Name] => {
740
+ const contract = __addonHttp[name] as any
741
+ return (
742
+ options?.basePath !== undefined
743
+ ? { ...contract, basePath: options.basePath }
744
+ : contract
745
+ ) as (typeof __addonHttp)[Name]
746
+ }
747
+
748
+ export const refChannel = <Name extends keyof typeof __addonChannel>(
749
+ name: Name
750
+ ): (typeof __addonChannel)[Name] => __addonChannel[name]
751
+
752
+ export const refCLI = <Name extends keyof typeof __addonCli>(
753
+ name: Name
754
+ ): (typeof __addonCli)[Name] => __addonCli[name]