@flowrunner/cli 0.1.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 (460) hide show
  1. package/README.md +148 -0
  2. package/ai-docs/instructions/service-code-format/01-service-structure.md +180 -0
  3. package/ai-docs/instructions/service-code-format/02-zod-types.md +260 -0
  4. package/ai-docs/instructions/service-code-format/03-parameters.md +193 -0
  5. package/ai-docs/instructions/service-code-format/04-http-requests.md +257 -0
  6. package/ai-docs/instructions/service-code-format/05-dictionaries.md +103 -0
  7. package/ai-docs/instructions/service-code-format/06-oauth2.md +42 -0
  8. package/ai-docs/instructions/service-code-format/07-actions.md +171 -0
  9. package/ai-docs/instructions/service-code-format/08-polling-triggers.md +54 -0
  10. package/ai-docs/instructions/service-code-format/09-realtime-triggers.md +269 -0
  11. package/ai-docs/instructions/service-code-format/10-files-api.md +148 -0
  12. package/ai-docs/instructions/service-code-format/11-output-model.md +142 -0
  13. package/ai-docs/instructions/service-code-format/12-service-readme.md +69 -0
  14. package/ai-docs/instructions/service-code-format/13-runtime-contracts.md +193 -0
  15. package/ai-docs/instructions/service-code-format/14-reference-service.md +341 -0
  16. package/ai-docs/instructions/service-code-format/15-unit-tests.md +361 -0
  17. package/ai-docs/instructions/service-code-format/16-gotchas.md +201 -0
  18. package/ai-docs/instructions/service-code-format/17-client-certificates.md +162 -0
  19. package/ai-docs/instructions/service-code-format/18-test-recipes.md +160 -0
  20. package/ai-docs/instructions/service-code-format/README.md +120 -0
  21. package/ai-docs/providers/claude/agents/flowrunner-service-code-engineer.md +139 -0
  22. package/ai-docs/providers/claude/agents/flowrunner-service-test-engineer.md +497 -0
  23. package/ai-docs/providers/claude/main-orchestrator-segment.md +51 -0
  24. package/bin/flowrunner.js +66 -0
  25. package/bin/resolve-local.js +98 -0
  26. package/dist/cli.js +10972 -0
  27. package/dist/cli.js.map +7 -0
  28. package/dist/index.d.ts +2 -0
  29. package/dist/index.js +10131 -0
  30. package/dist/index.js.map +7 -0
  31. package/dist/types/flow-extension-runner/src/common/config.d.ts +12 -0
  32. package/dist/types/flow-extension-runner/src/common/constants.d.ts +9 -0
  33. package/dist/types/flow-extension-runner/src/common/context-files.d.ts +107 -0
  34. package/dist/types/flow-extension-runner/src/common/context.d.ts +6 -0
  35. package/dist/types/flow-extension-runner/src/common/types.d.ts +11 -0
  36. package/dist/types/flow-extension-runner/src/errors/base.d.ts +17 -0
  37. package/dist/types/flow-extension-runner/src/errors/codes.d.ts +17 -0
  38. package/dist/types/flow-extension-runner/src/errors/errors.d.ts +48 -0
  39. package/dist/types/flow-extension-runner/src/errors/index.d.ts +3 -0
  40. package/dist/types/flow-extension-runner/src/global.d.ts +34 -0
  41. package/dist/types/flow-extension-runner/src/index.d.ts +15 -0
  42. package/dist/types/flow-extension-runner/src/namespace.d.ts +3 -0
  43. package/dist/types/flow-extension-runner/src/v1/config.d.ts +3 -0
  44. package/dist/types/flow-extension-runner/src/v1/constants.d.ts +4 -0
  45. package/dist/types/flow-extension-runner/src/v1/index.d.ts +11 -0
  46. package/dist/types/flow-extension-runner/src/v1/namespace.d.ts +9 -0
  47. package/dist/types/flow-extension-runner/src/v1/service.d.ts +29 -0
  48. package/dist/types/flow-extension-runner/src/v1/types.d.ts +13 -0
  49. package/dist/types/flow-extension-runner/src/v2/actions/action-method.d.ts +34 -0
  50. package/dist/types/flow-extension-runner/src/v2/context/execution-context.d.ts +25 -0
  51. package/dist/types/flow-extension-runner/src/v2/context/logger.d.ts +2 -0
  52. package/dist/types/flow-extension-runner/src/v2/context/method-input.d.ts +27 -0
  53. package/dist/types/flow-extension-runner/src/v2/context/proxies.d.ts +1 -0
  54. package/dist/types/flow-extension-runner/src/v2/create-extension.d.ts +2 -0
  55. package/dist/types/flow-extension-runner/src/v2/crypto.d.ts +6 -0
  56. package/dist/types/flow-extension-runner/src/v2/dictionaries/dictionary-method.d.ts +24 -0
  57. package/dist/types/flow-extension-runner/src/v2/dictionaries/payload-schema.d.ts +10 -0
  58. package/dist/types/flow-extension-runner/src/v2/extension.d.ts +51 -0
  59. package/dist/types/flow-extension-runner/src/v2/index.d.ts +39 -0
  60. package/dist/types/flow-extension-runner/src/v2/loaders/loader-method.d.ts +31 -0
  61. package/dist/types/flow-extension-runner/src/v2/loaders/loader-owner.d.ts +17 -0
  62. package/dist/types/flow-extension-runner/src/v2/loaders/payload-schema.d.ts +3 -0
  63. package/dist/types/flow-extension-runner/src/v2/method.d.ts +22 -0
  64. package/dist/types/flow-extension-runner/src/v2/model/field-mapper.d.ts +10 -0
  65. package/dist/types/flow-extension-runner/src/v2/model/method-model.d.ts +3 -0
  66. package/dist/types/flow-extension-runner/src/v2/model/model-types.d.ts +70 -0
  67. package/dist/types/flow-extension-runner/src/v2/model/params-model.d.ts +16 -0
  68. package/dist/types/flow-extension-runner/src/v2/oauth/method-names.d.ts +5 -0
  69. package/dist/types/flow-extension-runner/src/v2/oauth/oauth2.d.ts +9 -0
  70. package/dist/types/flow-extension-runner/src/v2/oauth/system-params.d.ts +6 -0
  71. package/dist/types/flow-extension-runner/src/v2/oauth/types.d.ts +54 -0
  72. package/dist/types/flow-extension-runner/src/v2/params/config-params.d.ts +14 -0
  73. package/dist/types/flow-extension-runner/src/v2/params/files-options.d.ts +58 -0
  74. package/dist/types/flow-extension-runner/src/v2/params/index.d.ts +19 -0
  75. package/dist/types/flow-extension-runner/src/v2/params/json/checks.d.ts +26 -0
  76. package/dist/types/flow-extension-runner/src/v2/params/json/decode.d.ts +24 -0
  77. package/dist/types/flow-extension-runner/src/v2/params/json/encode.d.ts +20 -0
  78. package/dist/types/flow-extension-runner/src/v2/params/json/types.d.ts +86 -0
  79. package/dist/types/flow-extension-runner/src/v2/params/json/values.d.ts +5 -0
  80. package/dist/types/flow-extension-runner/src/v2/params/method-params.d.ts +17 -0
  81. package/dist/types/flow-extension-runner/src/v2/params/params.d.ts +26 -0
  82. package/dist/types/flow-extension-runner/src/v2/params/schema/assert-object-schema.d.ts +6 -0
  83. package/dist/types/flow-extension-runner/src/v2/params/schema/assert-supported-schema.d.ts +8 -0
  84. package/dist/types/flow-extension-runner/src/v2/params/schema/coerce.d.ts +54 -0
  85. package/dist/types/flow-extension-runner/src/v2/params/schema/dates.d.ts +40 -0
  86. package/dist/types/flow-extension-runner/src/v2/params/schema/defaults.d.ts +36 -0
  87. package/dist/types/flow-extension-runner/src/v2/params/schema/field-plan.d.ts +33 -0
  88. package/dist/types/flow-extension-runner/src/v2/params/schema/introspect.d.ts +58 -0
  89. package/dist/types/flow-extension-runner/src/v2/params/schema/labels.d.ts +3 -0
  90. package/dist/types/flow-extension-runner/src/v2/params/schema/messages.d.ts +16 -0
  91. package/dist/types/flow-extension-runner/src/v2/params/schema/normalize.d.ts +8 -0
  92. package/dist/types/flow-extension-runner/src/v2/params/schema/parse.d.ts +7 -0
  93. package/dist/types/flow-extension-runner/src/v2/params/types.d.ts +29 -0
  94. package/dist/types/flow-extension-runner/src/v2/params/widget-types.d.ts +40 -0
  95. package/dist/types/flow-extension-runner/src/v2/params/zod.d.ts +86 -0
  96. package/dist/types/flow-extension-runner/src/v2/path.d.ts +1 -0
  97. package/dist/types/flow-extension-runner/src/v2/polling-triggers/mechanisms.d.ts +19 -0
  98. package/dist/types/flow-extension-runner/src/v2/polling-triggers/method-names.d.ts +1 -0
  99. package/dist/types/flow-extension-runner/src/v2/polling-triggers/polling-triggers.d.ts +11 -0
  100. package/dist/types/flow-extension-runner/src/v2/polling-triggers/system-params.d.ts +7 -0
  101. package/dist/types/flow-extension-runner/src/v2/polling-triggers/trigger-method.d.ts +25 -0
  102. package/dist/types/flow-extension-runner/src/v2/polling-triggers/types.d.ts +46 -0
  103. package/dist/types/flow-extension-runner/src/v2/realtime-triggers/method-names.d.ts +7 -0
  104. package/dist/types/flow-extension-runner/src/v2/realtime-triggers/realtime-setup.d.ts +10 -0
  105. package/dist/types/flow-extension-runner/src/v2/realtime-triggers/system-params.d.ts +29 -0
  106. package/dist/types/flow-extension-runner/src/v2/realtime-triggers/trigger-method.d.ts +33 -0
  107. package/dist/types/flow-extension-runner/src/v2/realtime-triggers/types.d.ts +147 -0
  108. package/dist/types/flow-extension-runner/src/v2/realtime-triggers/verify.d.ts +2 -0
  109. package/dist/types/flow-extension-runner/src/v2/registry.d.ts +20 -0
  110. package/dist/types/flow-extension-runner/src/v2/result.d.ts +13 -0
  111. package/dist/types/flow-extension-runner/src/v2/system-method.d.ts +41 -0
  112. package/dist/types/flow-extension-runner/src/v2/types.d.ts +126 -0
  113. package/dist/types/jsdoc-parser/src/custom-type-defs/files.d.ts +2 -0
  114. package/dist/types/jsdoc-parser/src/index.d.ts +2 -0
  115. package/dist/types/jsdoc-parser/src/lib.d.ts +42 -0
  116. package/dist/types/jsdoc-parser/src/types.d.ts +2 -0
  117. package/dist/types/packages/cli/src/api/console-client.d.ts +69 -0
  118. package/dist/types/packages/cli/src/constants/index.d.ts +5 -0
  119. package/dist/types/packages/cli/src/constants/packaging.d.ts +7 -0
  120. package/dist/types/packages/cli/src/constants/project.d.ts +9 -0
  121. package/dist/types/packages/cli/src/constants/providers.d.ts +30 -0
  122. package/dist/types/packages/cli/src/constants/server.d.ts +29 -0
  123. package/dist/types/packages/cli/src/constants/testing.d.ts +32 -0
  124. package/dist/types/packages/cli/src/errors.d.ts +131 -0
  125. package/dist/types/packages/cli/src/index.d.ts +29 -0
  126. package/dist/types/packages/cli/src/operations/deploy/discover-services.d.ts +26 -0
  127. package/dist/types/packages/cli/src/operations/deploy/hash.d.ts +1 -0
  128. package/dist/types/packages/cli/src/operations/deploy/index.d.ts +94 -0
  129. package/dist/types/packages/cli/src/operations/deploy/public-files.d.ts +20 -0
  130. package/dist/types/packages/cli/src/operations/deploy/select.d.ts +9 -0
  131. package/dist/types/packages/cli/src/operations/deploy/zip.d.ts +1 -0
  132. package/dist/types/packages/cli/src/operations/init/answers.d.ts +35 -0
  133. package/dist/types/packages/cli/src/operations/init/create-service.d.ts +39 -0
  134. package/dist/types/packages/cli/src/operations/init/index.d.ts +79 -0
  135. package/dist/types/packages/cli/src/operations/init/testing.d.ts +13 -0
  136. package/dist/types/packages/cli/src/operations/init-claude/index.d.ts +40 -0
  137. package/dist/types/packages/cli/src/operations/init-claude/segment.d.ts +25 -0
  138. package/dist/types/packages/cli/src/operations/login.d.ts +38 -0
  139. package/dist/types/packages/cli/src/operations/logout.d.ts +19 -0
  140. package/dist/types/packages/cli/src/operations/pull/extract.d.ts +23 -0
  141. package/dist/types/packages/cli/src/operations/pull/index.d.ts +87 -0
  142. package/dist/types/packages/cli/src/operations/server-target.d.ts +14 -0
  143. package/dist/types/packages/cli/src/operations/types.d.ts +20 -0
  144. package/dist/types/packages/cli/src/operations/use-server.d.ts +17 -0
  145. package/dist/types/packages/cli/src/project/auth.d.ts +41 -0
  146. package/dist/types/packages/cli/src/project/config.d.ts +31 -0
  147. package/dist/types/packages/cli/src/project/token.d.ts +5 -0
  148. package/dist/types/packages/cli/src/server/index.d.ts +14 -0
  149. package/dist/types/packages/cli/src/server/pages.d.ts +2 -0
  150. package/dist/types/packages/cli/src/server/routes/callback.d.ts +6 -0
  151. package/dist/types/packages/cli/src/server/types.d.ts +12 -0
  152. package/dist/types/packages/cli/src/templates/index.d.ts +8 -0
  153. package/dist/types/packages/cli/src/templates/manifest.d.ts +97 -0
  154. package/dist/types/packages/cli/src/templates/package-root.d.ts +3 -0
  155. package/dist/types/packages/cli/src/templates/paths.d.ts +3 -0
  156. package/dist/types/packages/cli/src/templates/registry.d.ts +13 -0
  157. package/dist/types/packages/cli/src/templates/render.d.ts +13 -0
  158. package/dist/types/packages/cli/src/templates/scaffold.d.ts +25 -0
  159. package/dist/types/packages/cli/src/utils/invocation.d.ts +28 -0
  160. package/dist/types/packages/cli/src/utils/open-browser.d.ts +2 -0
  161. package/dist/types/shared/src/constants/ai-agent-tools.d.ts +20 -0
  162. package/dist/types/shared/src/constants/ai.d.ts +11 -0
  163. package/dist/types/shared/src/constants/api-keys.d.ts +1 -0
  164. package/dist/types/shared/src/constants/app.d.ts +58 -0
  165. package/dist/types/shared/src/constants/billing.d.ts +16 -0
  166. package/dist/types/shared/src/constants/compliances.d.ts +3 -0
  167. package/dist/types/shared/src/constants/data-types.d.ts +26 -0
  168. package/dist/types/shared/src/constants/error-codes.d.ts +16 -0
  169. package/dist/types/shared/src/constants/flow.d.ts +12 -0
  170. package/dist/types/shared/src/constants/index.d.ts +16 -0
  171. package/dist/types/shared/src/constants/knowledge-base.d.ts +13 -0
  172. package/dist/types/shared/src/constants/notification-types.d.ts +985 -0
  173. package/dist/types/shared/src/constants/notifications.d.ts +10 -0
  174. package/dist/types/shared/src/constants/patterns.d.ts +28 -0
  175. package/dist/types/shared/src/constants/retry-policy.d.ts +30 -0
  176. package/dist/types/shared/src/constants/severity.d.ts +9 -0
  177. package/dist/types/shared/src/constants/shared-extensions-search.d.ts +6 -0
  178. package/dist/types/shared/src/constants/shared-extensions.d.ts +35 -0
  179. package/dist/types/shared/src/constants/zod.d.ts +2 -0
  180. package/dist/types/shared/src/errors/api.d.ts +4 -0
  181. package/dist/types/shared/src/errors/base.d.ts +38 -0
  182. package/dist/types/shared/src/errors/common.d.ts +39 -0
  183. package/dist/types/shared/src/errors/index.d.ts +13 -0
  184. package/dist/types/shared/src/errors/k8s.d.ts +4 -0
  185. package/dist/types/shared/src/errors/message.d.ts +48 -0
  186. package/dist/types/shared/src/errors/open-search.d.ts +4 -0
  187. package/dist/types/shared/src/errors/s3.d.ts +11 -0
  188. package/dist/types/shared/src/extensions/zod.d.ts +25 -0
  189. package/dist/types/shared/src/scheme/account/dto.d.ts +60 -0
  190. package/dist/types/shared/src/scheme/account/index.d.ts +1 -0
  191. package/dist/types/shared/src/scheme/ai-agent-tools/dto.d.ts +69 -0
  192. package/dist/types/shared/src/scheme/ai-agent-tools/index.d.ts +2 -0
  193. package/dist/types/shared/src/scheme/ai-agent-tools/parameters.d.ts +7 -0
  194. package/dist/types/shared/src/scheme/ai-router/dto.d.ts +23 -0
  195. package/dist/types/shared/src/scheme/ai-router/index.d.ts +2 -0
  196. package/dist/types/shared/src/scheme/api-keys/dto.d.ts +28 -0
  197. package/dist/types/shared/src/scheme/api-keys/index.d.ts +2 -0
  198. package/dist/types/shared/src/scheme/app/index.d.ts +1 -0
  199. package/dist/types/shared/src/scheme/app/java.dto.d.ts +6 -0
  200. package/dist/types/shared/src/scheme/billing/index.d.ts +1 -0
  201. package/dist/types/shared/src/scheme/billing/java.dto.d.ts +163 -0
  202. package/dist/types/shared/src/scheme/crm/billing.d.ts +149 -0
  203. package/dist/types/shared/src/scheme/crm/dto.d.ts +212 -0
  204. package/dist/types/shared/src/scheme/crm/index.d.ts +3 -0
  205. package/dist/types/shared/src/scheme/data-types/index.d.ts +1 -0
  206. package/dist/types/shared/src/scheme/data-types/java.dto.d.ts +23 -0
  207. package/dist/types/shared/src/scheme/dynamic-forms/dto.d.ts +30 -0
  208. package/dist/types/shared/src/scheme/dynamic-forms/index.d.ts +2 -0
  209. package/dist/types/shared/src/scheme/extensions/index.d.ts +1 -0
  210. package/dist/types/shared/src/scheme/extensions/params-to-zod.d.ts +14 -0
  211. package/dist/types/shared/src/scheme/flowrunner/custom-elements.d.ts +368 -0
  212. package/dist/types/shared/src/scheme/flowrunner/index.d.ts +3 -0
  213. package/dist/types/shared/src/scheme/flowrunner/java.dto.d.ts +628 -0
  214. package/dist/types/shared/src/scheme/index.d.ts +19 -0
  215. package/dist/types/shared/src/scheme/integration-connection/dto.d.ts +81 -0
  216. package/dist/types/shared/src/scheme/integration-connection/index.d.ts +2 -0
  217. package/dist/types/shared/src/scheme/knowledge-base/dto.d.ts +540 -0
  218. package/dist/types/shared/src/scheme/knowledge-base/index.d.ts +2 -0
  219. package/dist/types/shared/src/scheme/mcp-oauth/dto.d.ts +7 -0
  220. package/dist/types/shared/src/scheme/mcp-oauth/index.d.ts +2 -0
  221. package/dist/types/shared/src/scheme/notifications/dto.d.ts +111 -0
  222. package/dist/types/shared/src/scheme/notifications/index.d.ts +3 -0
  223. package/dist/types/shared/src/scheme/notifications/rest.d.ts +148 -0
  224. package/dist/types/shared/src/scheme/properties/account.d.ts +3 -0
  225. package/dist/types/shared/src/scheme/properties/app.d.ts +5 -0
  226. package/dist/types/shared/src/scheme/properties/billing.d.ts +12 -0
  227. package/dist/types/shared/src/scheme/properties/common.d.ts +2 -0
  228. package/dist/types/shared/src/scheme/properties/db.d.ts +8 -0
  229. package/dist/types/shared/src/scheme/properties/flow-extensions.d.ts +7 -0
  230. package/dist/types/shared/src/scheme/properties/index.d.ts +7 -0
  231. package/dist/types/shared/src/scheme/remote-mcp-server/dto.d.ts +278 -0
  232. package/dist/types/shared/src/scheme/remote-mcp-server/index.d.ts +2 -0
  233. package/dist/types/shared/src/scheme/shared-extensions/base.d.ts +56 -0
  234. package/dist/types/shared/src/scheme/shared-extensions/config.d.ts +96 -0
  235. package/dist/types/shared/src/scheme/shared-extensions/custom-extensions.d.ts +485 -0
  236. package/dist/types/shared/src/scheme/shared-extensions/extension.d.ts +387 -0
  237. package/dist/types/shared/src/scheme/shared-extensions/flow-extensions.d.ts +64 -0
  238. package/dist/types/shared/src/scheme/shared-extensions/index.d.ts +15 -0
  239. package/dist/types/shared/src/scheme/shared-extensions/light.d.ts +38 -0
  240. package/dist/types/shared/src/scheme/shared-extensions/logs.d.ts +21 -0
  241. package/dist/types/shared/src/scheme/shared-extensions/methods.d.ts +80 -0
  242. package/dist/types/shared/src/scheme/shared-extensions/params-schema.d.ts +47 -0
  243. package/dist/types/shared/src/scheme/shared-extensions/popular-pool.d.ts +11 -0
  244. package/dist/types/shared/src/scheme/shared-extensions/resolve.d.ts +364 -0
  245. package/dist/types/shared/src/scheme/shared-extensions/rest.d.ts +9 -0
  246. package/dist/types/shared/src/scheme/shared-extensions/search.d.ts +177 -0
  247. package/dist/types/shared/src/scheme/shared-extensions/service-identity.d.ts +10 -0
  248. package/dist/types/shared/src/scheme/shared-extensions/service-info.d.ts +15 -0
  249. package/dist/types/shared/src/scheme/workspace/dto.d.ts +40 -0
  250. package/dist/types/shared/src/scheme/workspace/index.d.ts +1 -0
  251. package/dist/types/shared/src/utils/object.d.ts +8 -0
  252. package/dist/types/shared/src/utils/uuid.d.ts +5 -0
  253. package/dist/types/shared/src/utils/versions.d.ts +4 -0
  254. package/dist/types/types/backendless-request.d.ts +40 -0
  255. package/package.json +66 -0
  256. package/project-files/jest.config.js +38 -0
  257. package/project-files/jest.setup.js +24 -0
  258. package/project-files/sandbox/files-mock.js +654 -0
  259. package/project-files/sandbox/index.js +32 -0
  260. package/project-files/sandbox/nock-mock.js +600 -0
  261. package/project-files/sandbox/service.js +145 -0
  262. package/runtime/index.d.ts +2 -0
  263. package/runtime/index.js +5665 -0
  264. package/runtime/index.js.map +7 -0
  265. package/runtime/types/flow-extension-runner/src/common/config.d.ts +12 -0
  266. package/runtime/types/flow-extension-runner/src/common/constants.d.ts +9 -0
  267. package/runtime/types/flow-extension-runner/src/common/context-files.d.ts +107 -0
  268. package/runtime/types/flow-extension-runner/src/common/context.d.ts +6 -0
  269. package/runtime/types/flow-extension-runner/src/common/types.d.ts +11 -0
  270. package/runtime/types/flow-extension-runner/src/errors/base.d.ts +17 -0
  271. package/runtime/types/flow-extension-runner/src/errors/codes.d.ts +17 -0
  272. package/runtime/types/flow-extension-runner/src/errors/errors.d.ts +48 -0
  273. package/runtime/types/flow-extension-runner/src/errors/index.d.ts +3 -0
  274. package/runtime/types/flow-extension-runner/src/global.d.ts +34 -0
  275. package/runtime/types/flow-extension-runner/src/index.d.ts +15 -0
  276. package/runtime/types/flow-extension-runner/src/namespace.d.ts +3 -0
  277. package/runtime/types/flow-extension-runner/src/v1/config.d.ts +3 -0
  278. package/runtime/types/flow-extension-runner/src/v1/constants.d.ts +4 -0
  279. package/runtime/types/flow-extension-runner/src/v1/index.d.ts +11 -0
  280. package/runtime/types/flow-extension-runner/src/v1/namespace.d.ts +9 -0
  281. package/runtime/types/flow-extension-runner/src/v1/service.d.ts +29 -0
  282. package/runtime/types/flow-extension-runner/src/v1/types.d.ts +13 -0
  283. package/runtime/types/flow-extension-runner/src/v2/actions/action-method.d.ts +34 -0
  284. package/runtime/types/flow-extension-runner/src/v2/context/execution-context.d.ts +25 -0
  285. package/runtime/types/flow-extension-runner/src/v2/context/logger.d.ts +2 -0
  286. package/runtime/types/flow-extension-runner/src/v2/context/method-input.d.ts +27 -0
  287. package/runtime/types/flow-extension-runner/src/v2/context/proxies.d.ts +1 -0
  288. package/runtime/types/flow-extension-runner/src/v2/create-extension.d.ts +2 -0
  289. package/runtime/types/flow-extension-runner/src/v2/crypto.d.ts +6 -0
  290. package/runtime/types/flow-extension-runner/src/v2/dictionaries/dictionary-method.d.ts +24 -0
  291. package/runtime/types/flow-extension-runner/src/v2/dictionaries/payload-schema.d.ts +10 -0
  292. package/runtime/types/flow-extension-runner/src/v2/extension.d.ts +51 -0
  293. package/runtime/types/flow-extension-runner/src/v2/index.d.ts +39 -0
  294. package/runtime/types/flow-extension-runner/src/v2/loaders/loader-method.d.ts +31 -0
  295. package/runtime/types/flow-extension-runner/src/v2/loaders/loader-owner.d.ts +17 -0
  296. package/runtime/types/flow-extension-runner/src/v2/loaders/payload-schema.d.ts +3 -0
  297. package/runtime/types/flow-extension-runner/src/v2/method.d.ts +22 -0
  298. package/runtime/types/flow-extension-runner/src/v2/model/field-mapper.d.ts +10 -0
  299. package/runtime/types/flow-extension-runner/src/v2/model/method-model.d.ts +3 -0
  300. package/runtime/types/flow-extension-runner/src/v2/model/model-types.d.ts +70 -0
  301. package/runtime/types/flow-extension-runner/src/v2/model/params-model.d.ts +16 -0
  302. package/runtime/types/flow-extension-runner/src/v2/oauth/method-names.d.ts +5 -0
  303. package/runtime/types/flow-extension-runner/src/v2/oauth/oauth2.d.ts +9 -0
  304. package/runtime/types/flow-extension-runner/src/v2/oauth/system-params.d.ts +6 -0
  305. package/runtime/types/flow-extension-runner/src/v2/oauth/types.d.ts +54 -0
  306. package/runtime/types/flow-extension-runner/src/v2/params/config-params.d.ts +14 -0
  307. package/runtime/types/flow-extension-runner/src/v2/params/files-options.d.ts +58 -0
  308. package/runtime/types/flow-extension-runner/src/v2/params/index.d.ts +19 -0
  309. package/runtime/types/flow-extension-runner/src/v2/params/json/checks.d.ts +26 -0
  310. package/runtime/types/flow-extension-runner/src/v2/params/json/decode.d.ts +24 -0
  311. package/runtime/types/flow-extension-runner/src/v2/params/json/encode.d.ts +20 -0
  312. package/runtime/types/flow-extension-runner/src/v2/params/json/types.d.ts +86 -0
  313. package/runtime/types/flow-extension-runner/src/v2/params/json/values.d.ts +5 -0
  314. package/runtime/types/flow-extension-runner/src/v2/params/method-params.d.ts +17 -0
  315. package/runtime/types/flow-extension-runner/src/v2/params/params.d.ts +26 -0
  316. package/runtime/types/flow-extension-runner/src/v2/params/schema/assert-object-schema.d.ts +6 -0
  317. package/runtime/types/flow-extension-runner/src/v2/params/schema/assert-supported-schema.d.ts +8 -0
  318. package/runtime/types/flow-extension-runner/src/v2/params/schema/coerce.d.ts +54 -0
  319. package/runtime/types/flow-extension-runner/src/v2/params/schema/dates.d.ts +40 -0
  320. package/runtime/types/flow-extension-runner/src/v2/params/schema/defaults.d.ts +36 -0
  321. package/runtime/types/flow-extension-runner/src/v2/params/schema/field-plan.d.ts +33 -0
  322. package/runtime/types/flow-extension-runner/src/v2/params/schema/introspect.d.ts +58 -0
  323. package/runtime/types/flow-extension-runner/src/v2/params/schema/labels.d.ts +3 -0
  324. package/runtime/types/flow-extension-runner/src/v2/params/schema/messages.d.ts +16 -0
  325. package/runtime/types/flow-extension-runner/src/v2/params/schema/normalize.d.ts +8 -0
  326. package/runtime/types/flow-extension-runner/src/v2/params/schema/parse.d.ts +7 -0
  327. package/runtime/types/flow-extension-runner/src/v2/params/types.d.ts +29 -0
  328. package/runtime/types/flow-extension-runner/src/v2/params/widget-types.d.ts +40 -0
  329. package/runtime/types/flow-extension-runner/src/v2/params/zod.d.ts +86 -0
  330. package/runtime/types/flow-extension-runner/src/v2/path.d.ts +1 -0
  331. package/runtime/types/flow-extension-runner/src/v2/polling-triggers/mechanisms.d.ts +19 -0
  332. package/runtime/types/flow-extension-runner/src/v2/polling-triggers/method-names.d.ts +1 -0
  333. package/runtime/types/flow-extension-runner/src/v2/polling-triggers/polling-triggers.d.ts +11 -0
  334. package/runtime/types/flow-extension-runner/src/v2/polling-triggers/system-params.d.ts +7 -0
  335. package/runtime/types/flow-extension-runner/src/v2/polling-triggers/trigger-method.d.ts +25 -0
  336. package/runtime/types/flow-extension-runner/src/v2/polling-triggers/types.d.ts +46 -0
  337. package/runtime/types/flow-extension-runner/src/v2/realtime-triggers/method-names.d.ts +7 -0
  338. package/runtime/types/flow-extension-runner/src/v2/realtime-triggers/realtime-setup.d.ts +10 -0
  339. package/runtime/types/flow-extension-runner/src/v2/realtime-triggers/system-params.d.ts +29 -0
  340. package/runtime/types/flow-extension-runner/src/v2/realtime-triggers/trigger-method.d.ts +33 -0
  341. package/runtime/types/flow-extension-runner/src/v2/realtime-triggers/types.d.ts +147 -0
  342. package/runtime/types/flow-extension-runner/src/v2/realtime-triggers/verify.d.ts +2 -0
  343. package/runtime/types/flow-extension-runner/src/v2/registry.d.ts +20 -0
  344. package/runtime/types/flow-extension-runner/src/v2/result.d.ts +13 -0
  345. package/runtime/types/flow-extension-runner/src/v2/system-method.d.ts +41 -0
  346. package/runtime/types/flow-extension-runner/src/v2/types.d.ts +126 -0
  347. package/runtime/types/jsdoc-parser/src/custom-type-defs/files.d.ts +2 -0
  348. package/runtime/types/jsdoc-parser/src/index.d.ts +2 -0
  349. package/runtime/types/jsdoc-parser/src/lib.d.ts +42 -0
  350. package/runtime/types/jsdoc-parser/src/types.d.ts +2 -0
  351. package/runtime/types/packages/cli/src/runtime/index.d.ts +5 -0
  352. package/runtime/types/shared/src/constants/ai-agent-tools.d.ts +20 -0
  353. package/runtime/types/shared/src/constants/ai.d.ts +11 -0
  354. package/runtime/types/shared/src/constants/api-keys.d.ts +1 -0
  355. package/runtime/types/shared/src/constants/app.d.ts +58 -0
  356. package/runtime/types/shared/src/constants/billing.d.ts +16 -0
  357. package/runtime/types/shared/src/constants/compliances.d.ts +3 -0
  358. package/runtime/types/shared/src/constants/data-types.d.ts +26 -0
  359. package/runtime/types/shared/src/constants/error-codes.d.ts +16 -0
  360. package/runtime/types/shared/src/constants/flow.d.ts +12 -0
  361. package/runtime/types/shared/src/constants/index.d.ts +16 -0
  362. package/runtime/types/shared/src/constants/knowledge-base.d.ts +13 -0
  363. package/runtime/types/shared/src/constants/notification-types.d.ts +985 -0
  364. package/runtime/types/shared/src/constants/notifications.d.ts +10 -0
  365. package/runtime/types/shared/src/constants/patterns.d.ts +28 -0
  366. package/runtime/types/shared/src/constants/retry-policy.d.ts +30 -0
  367. package/runtime/types/shared/src/constants/severity.d.ts +9 -0
  368. package/runtime/types/shared/src/constants/shared-extensions-search.d.ts +6 -0
  369. package/runtime/types/shared/src/constants/shared-extensions.d.ts +35 -0
  370. package/runtime/types/shared/src/constants/zod.d.ts +2 -0
  371. package/runtime/types/shared/src/errors/api.d.ts +4 -0
  372. package/runtime/types/shared/src/errors/base.d.ts +38 -0
  373. package/runtime/types/shared/src/errors/common.d.ts +39 -0
  374. package/runtime/types/shared/src/errors/index.d.ts +13 -0
  375. package/runtime/types/shared/src/errors/k8s.d.ts +4 -0
  376. package/runtime/types/shared/src/errors/message.d.ts +48 -0
  377. package/runtime/types/shared/src/errors/open-search.d.ts +4 -0
  378. package/runtime/types/shared/src/errors/s3.d.ts +11 -0
  379. package/runtime/types/shared/src/extensions/zod.d.ts +25 -0
  380. package/runtime/types/shared/src/scheme/account/dto.d.ts +60 -0
  381. package/runtime/types/shared/src/scheme/account/index.d.ts +1 -0
  382. package/runtime/types/shared/src/scheme/ai-agent-tools/dto.d.ts +69 -0
  383. package/runtime/types/shared/src/scheme/ai-agent-tools/index.d.ts +2 -0
  384. package/runtime/types/shared/src/scheme/ai-agent-tools/parameters.d.ts +7 -0
  385. package/runtime/types/shared/src/scheme/ai-router/dto.d.ts +23 -0
  386. package/runtime/types/shared/src/scheme/ai-router/index.d.ts +2 -0
  387. package/runtime/types/shared/src/scheme/api-keys/dto.d.ts +28 -0
  388. package/runtime/types/shared/src/scheme/api-keys/index.d.ts +2 -0
  389. package/runtime/types/shared/src/scheme/app/index.d.ts +1 -0
  390. package/runtime/types/shared/src/scheme/app/java.dto.d.ts +6 -0
  391. package/runtime/types/shared/src/scheme/billing/index.d.ts +1 -0
  392. package/runtime/types/shared/src/scheme/billing/java.dto.d.ts +163 -0
  393. package/runtime/types/shared/src/scheme/crm/billing.d.ts +149 -0
  394. package/runtime/types/shared/src/scheme/crm/dto.d.ts +212 -0
  395. package/runtime/types/shared/src/scheme/crm/index.d.ts +3 -0
  396. package/runtime/types/shared/src/scheme/data-types/index.d.ts +1 -0
  397. package/runtime/types/shared/src/scheme/data-types/java.dto.d.ts +23 -0
  398. package/runtime/types/shared/src/scheme/dynamic-forms/dto.d.ts +30 -0
  399. package/runtime/types/shared/src/scheme/dynamic-forms/index.d.ts +2 -0
  400. package/runtime/types/shared/src/scheme/extensions/index.d.ts +1 -0
  401. package/runtime/types/shared/src/scheme/extensions/params-to-zod.d.ts +14 -0
  402. package/runtime/types/shared/src/scheme/flowrunner/custom-elements.d.ts +368 -0
  403. package/runtime/types/shared/src/scheme/flowrunner/index.d.ts +3 -0
  404. package/runtime/types/shared/src/scheme/flowrunner/java.dto.d.ts +628 -0
  405. package/runtime/types/shared/src/scheme/index.d.ts +19 -0
  406. package/runtime/types/shared/src/scheme/integration-connection/dto.d.ts +81 -0
  407. package/runtime/types/shared/src/scheme/integration-connection/index.d.ts +2 -0
  408. package/runtime/types/shared/src/scheme/knowledge-base/dto.d.ts +540 -0
  409. package/runtime/types/shared/src/scheme/knowledge-base/index.d.ts +2 -0
  410. package/runtime/types/shared/src/scheme/mcp-oauth/dto.d.ts +7 -0
  411. package/runtime/types/shared/src/scheme/mcp-oauth/index.d.ts +2 -0
  412. package/runtime/types/shared/src/scheme/notifications/dto.d.ts +111 -0
  413. package/runtime/types/shared/src/scheme/notifications/index.d.ts +3 -0
  414. package/runtime/types/shared/src/scheme/notifications/rest.d.ts +148 -0
  415. package/runtime/types/shared/src/scheme/properties/account.d.ts +3 -0
  416. package/runtime/types/shared/src/scheme/properties/app.d.ts +5 -0
  417. package/runtime/types/shared/src/scheme/properties/billing.d.ts +12 -0
  418. package/runtime/types/shared/src/scheme/properties/common.d.ts +2 -0
  419. package/runtime/types/shared/src/scheme/properties/db.d.ts +8 -0
  420. package/runtime/types/shared/src/scheme/properties/flow-extensions.d.ts +7 -0
  421. package/runtime/types/shared/src/scheme/properties/index.d.ts +7 -0
  422. package/runtime/types/shared/src/scheme/remote-mcp-server/dto.d.ts +278 -0
  423. package/runtime/types/shared/src/scheme/remote-mcp-server/index.d.ts +2 -0
  424. package/runtime/types/shared/src/scheme/shared-extensions/base.d.ts +56 -0
  425. package/runtime/types/shared/src/scheme/shared-extensions/config.d.ts +96 -0
  426. package/runtime/types/shared/src/scheme/shared-extensions/custom-extensions.d.ts +485 -0
  427. package/runtime/types/shared/src/scheme/shared-extensions/extension.d.ts +387 -0
  428. package/runtime/types/shared/src/scheme/shared-extensions/flow-extensions.d.ts +64 -0
  429. package/runtime/types/shared/src/scheme/shared-extensions/index.d.ts +15 -0
  430. package/runtime/types/shared/src/scheme/shared-extensions/light.d.ts +38 -0
  431. package/runtime/types/shared/src/scheme/shared-extensions/logs.d.ts +21 -0
  432. package/runtime/types/shared/src/scheme/shared-extensions/methods.d.ts +80 -0
  433. package/runtime/types/shared/src/scheme/shared-extensions/params-schema.d.ts +47 -0
  434. package/runtime/types/shared/src/scheme/shared-extensions/popular-pool.d.ts +11 -0
  435. package/runtime/types/shared/src/scheme/shared-extensions/resolve.d.ts +364 -0
  436. package/runtime/types/shared/src/scheme/shared-extensions/rest.d.ts +9 -0
  437. package/runtime/types/shared/src/scheme/shared-extensions/search.d.ts +177 -0
  438. package/runtime/types/shared/src/scheme/shared-extensions/service-identity.d.ts +10 -0
  439. package/runtime/types/shared/src/scheme/shared-extensions/service-info.d.ts +15 -0
  440. package/runtime/types/shared/src/scheme/workspace/dto.d.ts +40 -0
  441. package/runtime/types/shared/src/scheme/workspace/index.d.ts +1 -0
  442. package/runtime/types/shared/src/utils/object.d.ts +8 -0
  443. package/runtime/types/shared/src/utils/uuid.d.ts +5 -0
  444. package/runtime/types/shared/src/utils/versions.d.ts +4 -0
  445. package/runtime/types/types/backendless-request.d.ts +40 -0
  446. package/templates/blank/files/README.md +28 -0
  447. package/templates/blank/files/package.json +8 -0
  448. package/templates/blank/files/public/icon.svg +5 -0
  449. package/templates/blank/files/src/index.js +130 -0
  450. package/templates/blank/template.json +61 -0
  451. package/templates/demo-todo-list/files/README.md +54 -0
  452. package/templates/demo-todo-list/files/package.json +8 -0
  453. package/templates/demo-todo-list/files/public/icon.svg +8 -0
  454. package/templates/demo-todo-list/files/src/index.js +590 -0
  455. package/templates/demo-todo-list/template.json +44 -0
  456. package/templates/qa-test/files/README.md +88 -0
  457. package/templates/qa-test/files/package.json +8 -0
  458. package/templates/qa-test/files/public/icon.svg +8 -0
  459. package/templates/qa-test/files/src/index.js +755 -0
  460. package/templates/qa-test/template.json +62 -0
@@ -0,0 +1,590 @@
1
+ // {{name}} — a FlowRunner service.
2
+ //
3
+ // A working to-do list service: create lists, add and update tasks, tick them off, read them back. Drop
4
+ // these actions straight into a flow and they do what they say.
5
+ //
6
+ // STORAGE IS IN MEMORY. Lists live in the `storage` map below, in the pod's RAM. They survive for as long
7
+ // as the pod does and are gone after a restart or redeploy — that is deliberate, so the demo needs no
8
+ // database. Swap `storage` for real API calls (see the HTTP Request action for how `apiRequest` works)
9
+ // when you build the real thing.
10
+
11
+ const z = Flowrunner.z
12
+
13
+ // ─── In-memory state ─────────────────────────────────────────────────────────
14
+ // The whole "database". The functions that read and write it are at the BOTTOM of this file, where
15
+ // module-level helpers belong — so the service’s shape reads first and its plumbing last.
16
+
17
+ const storage = {
18
+ lists : new Map(),
19
+ nextId : { list: 1, task: 1 },
20
+ }
21
+
22
+ // ─── The extension ───────────────────────────────────────────────────────────
23
+
24
+ const ext = Flowrunner.createExtension({
25
+ id : '{{id}}',
26
+ name : '{{name}}',
27
+ description: '{{description}}',
28
+ logo : '/icon.svg',
29
+
30
+ // [primary, secondary] — the node's colours in the flow editor.
31
+ appearanceColors: ['#4f46e5', '#a5b4fc'],
32
+
33
+ // {{#if useFilesApi}}
34
+ // Provisions `ctx.files` in every handler — see the Export List action at the bottom.
35
+ usesFileStorage: true,
36
+ // {{/if}}
37
+
38
+ // Workspace configuration. `owner` is the only required field — everything else has a default.
39
+ configItems: z.object({
40
+ owner : z.string().label('Owner').describe('Stamped on every list and task this service creates.'),
41
+ defaultPriority: z.enum(['low', 'normal', 'high']).optional().default('normal').label('Default Priority'),
42
+ maxTasksPerList: z.number().optional().default(50).label('Max Tasks Per List'),
43
+ autoCreateList : z.boolean().optional().default(false).label('Auto-create Missing Lists')
44
+ .describe('When on, Add Task creates the list instead of failing if it does not exist yet.'),
45
+ defaultTags : z.text().optional().label('Default Tags').describe('One tag per line, added to every new task.'),
46
+ // Sent by the HTTP Request action when "Use Stored Auth" is on.
47
+ //
48
+ // There is also a `.shared()` plugin that moves a field to a global config tier shared by every
49
+ // workspace — deliberately not used here: custom extensions deployed with this CLI have per-app config
50
+ // ONLY, so a `.shared()` field would never be filled in. It is for shared (global) extensions.
51
+ proxyAuthToken : z.string().optional().label('Proxy Auth Token'),
52
+ }),
53
+
54
+ // Runs once per invocation; whatever it returns is `context` in every handler. Note `maxTasksPerList`:
55
+ // a z.number() config field RENDERS as a text box, but the value is converted to the declared type before
56
+ // your schema validates it — so it arrives as a number and needs no conversion here.
57
+ initContext: ({ config }) => ({
58
+ owner : config.owner,
59
+ defaultPriority: config.defaultPriority,
60
+ maxTasks : config.maxTasksPerList,
61
+ autoCreateList : config.autoCreateList,
62
+ defaultTags : (config.defaultTags || '').split('\n').map(tag => tag.trim()).filter(Boolean),
63
+ authToken : config.proxyAuthToken,
64
+ }),
65
+
66
+ // The one place HTTP happens — used by the HTTP Request action. Centralizes header handling, error
67
+ // normalization and logging so handlers stay declarative.
68
+ // The argument shape is yours to define; the runtime only injects `context` and `logger`.
69
+ apiRequest: async ({ url, method = 'get', headers = {}, query, body, withAuth, context, logger }) => {
70
+ logger.debug(`[${ method.toUpperCase() }] ${ url }`)
71
+
72
+ const allHeaders = withAuth && context.authToken
73
+ ? { Authorization: `Bearer ${ context.authToken }`, ...headers }
74
+ : headers
75
+
76
+ try {
77
+ return await Flowrunner.Request[method.toLowerCase()](url)
78
+ .set(allHeaders)
79
+ .query(query)
80
+ .send(body)
81
+ } catch (error) {
82
+ logger.error(`Request to ${ url } failed: ${ error.message }`)
83
+
84
+ throw error
85
+ }
86
+ },
87
+
88
+ // Bound helpers, available as `helpers` in every handler.
89
+ helpers: ({ context }) => ({
90
+ // A new task, with the config defaults already folded in.
91
+ buildTask: input => ({
92
+ id : nextId('task'),
93
+ title : input.title,
94
+ notes : input.notes || '',
95
+ completed : false,
96
+ priority : input.priority || context.defaultPriority,
97
+ dueDate : input.dueDate ? input.dueDate.toISOString() : null,
98
+ tags : [...context.defaultTags, ...(input.tags || [])],
99
+ fields : input.fields || {},
100
+ createdBy : context.owner,
101
+ createdAt : new Date().toISOString(),
102
+ completedAt: null,
103
+ }),
104
+ }),
105
+ })
106
+
107
+ // ─── Dictionaries ────────────────────────────────────────────────────────────
108
+ // These fill the dropdowns in the flow editor. Bind one to a param with `.dictionary(ref)`.
109
+
110
+ // The minimal form — no criteria, so it can be loaded at any time.
111
+ const getListsDictionary = ext.dictionary({
112
+ id : 'getListsDictionary',
113
+ label : 'Lists',
114
+ description: 'Every to-do list currently in memory.',
115
+ execute : ({ search }) => [...storage.lists.values()]
116
+ .filter(list => !search || list.name.toLowerCase().includes(search.toLowerCase()))
117
+ .map(list => ({ label: list.name, value: list.id, note: `${ list.tasks.size } task(s)` })),
118
+ })
119
+
120
+ // With criteria: any param bound to this dictionary automatically gets `dependsOn: ['listId']`, so the
121
+ // console reloads the task options whenever the chosen list changes. Paginated through `cursor`.
122
+ const PAGE_SIZE = 25
123
+
124
+ const getTasksDictionary = ext.dictionary({
125
+ id : 'getTasksDictionary',
126
+ label : 'Tasks',
127
+ description: 'Tasks belonging to the selected list.',
128
+ criteria : z.object({
129
+ listId: z.string().label('List').dictionary(getListsDictionary),
130
+ }),
131
+ result : { items: [{ label: 'Buy milk', value: 'task-1' }], cursor: null },
132
+ execute : ({ search, cursor, criteria }) => {
133
+ const matching = [...requireList(criteria.listId).tasks.values()]
134
+ .filter(task => !search || task.title.toLowerCase().includes(search.toLowerCase()))
135
+
136
+ const offset = Number(cursor) || 0
137
+ const page = matching.slice(offset, offset + PAGE_SIZE)
138
+
139
+ return {
140
+ items : page.map(task => ({
141
+ label: task.title,
142
+ value: task.id,
143
+ note : task.completed ? 'completed' : task.priority,
144
+ })),
145
+ cursor: offset + PAGE_SIZE < matching.length ? String(offset + PAGE_SIZE) : null,
146
+ }
147
+ },
148
+ })
149
+
150
+ // ─── Shared result shapes ────────────────────────────────────────────────────
151
+ // A `result` is normally the literal sample object itself — see every action below. A zod schema with
152
+ // `.example()` earns its place only where the SAME shape is returned by several actions, as here: Add
153
+ // Task, Update Task and Mark Task Completed all answer with a task. The reuse is the justification, not
154
+ // the typing — the platform publishes the example either way.
155
+
156
+ const TASK_SAMPLE = {
157
+ id : 'task-1',
158
+ title : 'Buy milk',
159
+ notes : 'Whole, not skimmed',
160
+ completed : false,
161
+ priority : 'normal',
162
+ dueDate : '2026-02-01T00:00:00.000Z',
163
+ tags : ['groceries'],
164
+ fields : { 'Story Points': '3' },
165
+ createdBy : 'ops@example.com',
166
+ createdAt : '2026-01-31T08:00:00.000Z',
167
+ completedAt: null,
168
+ }
169
+
170
+ const taskResult = z.object({
171
+ id : z.string(),
172
+ title : z.string(),
173
+ notes : z.string(),
174
+ completed : z.boolean(),
175
+ priority : z.string(),
176
+ dueDate : z.string().nullable(),
177
+ tags : z.array(z.string()),
178
+ fields : z.record(z.string(), z.string()),
179
+ createdBy : z.string(),
180
+ createdAt : z.string(),
181
+ completedAt: z.string().nullable(),
182
+ }).example(TASK_SAMPLE)
183
+
184
+ // ─── Lists ───────────────────────────────────────────────────────────────────
185
+
186
+ ext.addAction({
187
+ category : 'Lists',
188
+ id : 'createList',
189
+ label : 'Create List',
190
+ description: 'Creates a to-do list.',
191
+ params : z.object({
192
+ name : z.string().label('Name'),
193
+ description : z.text().optional().label('Description'),
194
+ // Each label here becomes an extra input on Add Task for this list — see `dynamicParams` below.
195
+ customFields: z.array(z.string()).optional().label('Custom Fields')
196
+ .describe('Extra per-task fields, e.g. "Story Points". They appear as inputs on Add Task.'),
197
+ }),
198
+ // `result` is the literal sample `execute` returns — the object, nothing else.
199
+ result : {
200
+ id : 'list-1',
201
+ name : 'Groceries',
202
+ description : 'Weekly shop',
203
+ customFields: ['Story Points'],
204
+ createdBy : 'ops@example.com',
205
+ createdAt : '2026-01-31T08:00:00.000Z',
206
+ taskCount : 0,
207
+ openCount : 0,
208
+ },
209
+ execute : ({ params, context }) => {
210
+ const list = {
211
+ id : nextId('list'),
212
+ name : params.name,
213
+ description : params.description || '',
214
+ customFields: params.customFields || [],
215
+ createdBy : context.owner,
216
+ createdAt : new Date().toISOString(),
217
+ tasks : new Map(),
218
+ }
219
+
220
+ storage.lists.set(list.id, list)
221
+
222
+ return serializeList(list)
223
+ },
224
+ })
225
+
226
+ // `result` as a literal array — the simplest form, and it makes the return type a LIST.
227
+ ext.addAction({
228
+ category : 'Lists',
229
+ id : 'getLists',
230
+ label : 'Get Lists',
231
+ description: 'Returns every list, newest first.',
232
+ params : z.object({}),
233
+ result : [{
234
+ id : 'list-1',
235
+ name : 'Groceries',
236
+ description : 'Weekly shop',
237
+ customFields: ['Story Points'],
238
+ createdBy : 'ops@example.com',
239
+ createdAt : '2026-01-31T08:00:00.000Z',
240
+ taskCount : 2,
241
+ openCount : 1,
242
+ }],
243
+ execute : () => [...storage.lists.values()].reverse().map(serializeList),
244
+ })
245
+
246
+ ext.addAction({
247
+ category : 'Lists',
248
+ id : 'getList',
249
+ label : 'Get List',
250
+ description: 'Returns one list with its task counts.',
251
+ params : z.object({
252
+ listId: z.string().label('List').dictionary(getListsDictionary),
253
+ }),
254
+ result : {
255
+ id : 'list-1',
256
+ name : 'Groceries',
257
+ description : 'Weekly shop',
258
+ customFields: ['Story Points'],
259
+ createdBy : 'ops@example.com',
260
+ createdAt : '2026-01-31T08:00:00.000Z',
261
+ taskCount : 2,
262
+ openCount : 1,
263
+ },
264
+ execute : ({ params }) => serializeList(requireList(params.listId)),
265
+ })
266
+
267
+ ext.addAction({
268
+ category : 'Lists',
269
+ id : 'deleteList',
270
+ label : 'Delete List',
271
+ description: 'Deletes a list and every task in it.',
272
+ params : z.object({
273
+ listId: z.string().label('List').dictionary(getListsDictionary),
274
+ }),
275
+ result : { deleted: true, removedTasks: 2 },
276
+ execute : ({ params, logger }) => {
277
+ const list = requireList(params.listId)
278
+ const removedTasks = list.tasks.size
279
+
280
+ storage.lists.delete(list.id)
281
+ logger.info(`Deleted list ${ list.id } with ${ removedTasks } task(s)`)
282
+
283
+ return { deleted: true, removedTasks }
284
+ },
285
+ })
286
+
287
+ // ─── Tasks ───────────────────────────────────────────────────────────────────
288
+
289
+ ext.addAction({
290
+ category : 'Tasks',
291
+ id : 'addTask',
292
+ label : 'Add Task',
293
+ description : 'Adds a task to a list.',
294
+ params : z.object({
295
+ listId : z.string().label('List').dictionary(getListsDictionary),
296
+ title : z.string().label('Title'),
297
+ notes : z.text().optional().label('Notes'),
298
+ priority: z.enum(['low', 'normal', 'high']).optional().label('Priority')
299
+ .describe('Falls back to the Default Priority config value.'),
300
+ dueDate : z.coerce.date().optional().label('Due Date'),
301
+ tags : z.array(z.string()).optional().label('Tags'),
302
+ }),
303
+ // The list's Custom Fields become real inputs here. `criteria` is what the console watches: pick a
304
+ // different list and these fields are regenerated.
305
+ dynamicParams: {
306
+ criteria: z.object({ listId: z.string().optional() }),
307
+ resolve : ({ criteria }) => {
308
+ const list = criteria.listId && storage.lists.get(criteria.listId)
309
+ const shape = {}
310
+
311
+ for (const label of list ? list.customFields : []) {
312
+ shape[customFieldKey(label)] = z.string().optional().label(label)
313
+ }
314
+
315
+ return z.object(shape)
316
+ },
317
+ },
318
+ result : taskResult,
319
+ execute : ({ params, context, helpers }) => {
320
+ let list = storage.lists.get(params.listId)
321
+
322
+ if (!list && context.autoCreateList) {
323
+ list = {
324
+ id : params.listId,
325
+ name : params.listId,
326
+ description : '',
327
+ customFields: [],
328
+ createdBy : context.owner,
329
+ createdAt : new Date().toISOString(),
330
+ tasks : new Map(),
331
+ }
332
+
333
+ storage.lists.set(list.id, list)
334
+ }
335
+
336
+ if (!list) {
337
+ throw new Error(`List "${ params.listId }" does not exist. Turn on Auto-create Missing Lists to create it.`)
338
+ }
339
+
340
+ if (list.tasks.size >= context.maxTasks) {
341
+ throw new Error(`List "${ list.id }" already holds ${ context.maxTasks } tasks (Max Tasks Per List)`)
342
+ }
343
+
344
+ // The generated custom-field values arrive as ordinary top-level params.
345
+ const fields = {}
346
+
347
+ for (const label of list.customFields) {
348
+ const value = params[customFieldKey(label)]
349
+
350
+ if (value !== undefined) {
351
+ fields[label] = value
352
+ }
353
+ }
354
+
355
+ const task = helpers.buildTask({ ...params, fields })
356
+
357
+ list.tasks.set(task.id, task)
358
+
359
+ return task
360
+ },
361
+ })
362
+
363
+ ext.addAction({
364
+ category : 'Tasks',
365
+ id : 'updateTask',
366
+ label : 'Update Task',
367
+ description: 'Changes a task. Only the fields you fill in are touched.',
368
+ params : z.object({
369
+ listId : z.string().label('List').dictionary(getListsDictionary),
370
+ taskId : z.string().label('Task').dictionary(getTasksDictionary),
371
+ title : z.string().optional().label('Title'),
372
+ notes : z.text().optional().label('Notes'),
373
+ priority: z.enum(['low', 'normal', 'high']).optional().label('Priority'),
374
+ dueDate : z.coerce.date().optional().label('Due Date'),
375
+ }),
376
+ result : taskResult,
377
+ execute : ({ params }) => {
378
+ const task = requireTask(params.listId, params.taskId)
379
+
380
+ if (params.title !== undefined) {
381
+ task.title = params.title
382
+ }
383
+
384
+ if (params.notes !== undefined) {
385
+ task.notes = params.notes
386
+ }
387
+
388
+ if (params.priority !== undefined) {
389
+ task.priority = params.priority
390
+ }
391
+
392
+ if (params.dueDate !== undefined) {
393
+ task.dueDate = params.dueDate.toISOString()
394
+ }
395
+
396
+ return task
397
+ },
398
+ })
399
+
400
+ ext.addAction({
401
+ category : 'Tasks',
402
+ id : 'completeTask',
403
+ label : 'Mark Task Completed',
404
+ description: 'Ticks a task off, or un-ticks it.',
405
+ params : z.object({
406
+ listId : z.string().label('List').dictionary(getListsDictionary),
407
+ taskId : z.string().label('Task').dictionary(getTasksDictionary),
408
+ completed: z.boolean().optional().default(true).label('Completed'),
409
+ }),
410
+ result : taskResult,
411
+ execute : ({ params }) => {
412
+ const task = requireTask(params.listId, params.taskId)
413
+
414
+ task.completed = params.completed
415
+ task.completedAt = params.completed ? new Date().toISOString() : null
416
+
417
+ return task
418
+ },
419
+ })
420
+
421
+ ext.addAction({
422
+ category : 'Tasks',
423
+ id : 'deleteTask',
424
+ label : 'Delete Task',
425
+ description: 'Removes a task from a list.',
426
+ params : z.object({
427
+ listId: z.string().label('List').dictionary(getListsDictionary),
428
+ taskId: z.string().label('Task').dictionary(getTasksDictionary),
429
+ }),
430
+ result : { deleted: true },
431
+ execute : ({ params }) => {
432
+ const list = requireList(params.listId)
433
+
434
+ requireTask(params.listId, params.taskId)
435
+ list.tasks.delete(params.taskId)
436
+
437
+ return { deleted: true }
438
+ },
439
+ })
440
+
441
+ ext.addAction({
442
+ category : 'Tasks',
443
+ id : 'getTasks',
444
+ label : 'Get Tasks',
445
+ description: 'Returns the tasks of a list, optionally filtered by status.',
446
+ params : z.object({
447
+ listId: z.string().label('List').dictionary(getListsDictionary),
448
+ // `.labels()` shows a readable label per VALUE. The element stores the value, so renaming a label
449
+ // leaves every saved flow working.
450
+ status: z.enum(['all', 'completed', 'pending'])
451
+ .labels({ all: 'All', completed: 'Completed', pending: 'Not completed' })
452
+ .default('all').label('Status'),
453
+ search: z.string().optional().label('Search'),
454
+ limit : z.number().optional().default(50).label('Limit'),
455
+ }),
456
+ // A literal ARRAY, which is what makes the return type a LIST. `taskResult` cannot be used here: a
457
+ // zod `result` always publishes as OBJECT, whatever the schema says.
458
+ result : [TASK_SAMPLE],
459
+ execute : ({ params }) => {
460
+ const tasks = [...requireList(params.listId).tasks.values()]
461
+ // `status` is the MAPPED value here ('all' / 'completed' / 'pending'), never the label.
462
+ .filter(task => params.status === 'all' || (params.status === 'completed') === task.completed)
463
+ .filter(task => !params.search || task.title.toLowerCase().includes(params.search.toLowerCase()))
464
+
465
+ return tasks.slice(0, params.limit)
466
+ },
467
+ })
468
+
469
+ // ─── HTTP ────────────────────────────────────────────────────────────────────
470
+
471
+ // The one action that leaves the pod, and the reason `apiRequest` exists above. A real integration would
472
+ // have every action go through `apiRequest` against its vendor's API; here the URL is yours to supply.
473
+ ext.addAction({
474
+ category : 'HTTP',
475
+ id : 'httpRequest',
476
+ label : 'HTTP Request',
477
+ description: 'Sends an HTTP request and returns the response.',
478
+ params : z.object({
479
+ url : z.string().label('URL'),
480
+ method : z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']).default('GET').label('Method'),
481
+ headers : z.text().optional().label('Headers').describe('One "Name: value" per line.'),
482
+ body : z.text().optional().label('Body'),
483
+ useStoredAuth: z.boolean().optional().default(false).label('Use Stored Auth')
484
+ .describe('Send the shared Proxy Auth Token as a Bearer header.'),
485
+ }),
486
+ // `result` as a LOADER function — the sample genuinely depends on the params, so it cannot be a literal.
487
+ result : ({ params }) => (params.method === 'DELETE'
488
+ ? { ok: true }
489
+ : { id: 1, title: 'Whatever the endpoint returns' }),
490
+ execute : ({ params, apiRequest }) => {
491
+ const headers = Object.fromEntries(
492
+ (params.headers || '')
493
+ .split('\n')
494
+ .map(line => line.trim())
495
+ .filter(Boolean)
496
+ .map(line => {
497
+ const separator = line.indexOf(':')
498
+
499
+ return [line.slice(0, separator).trim(), line.slice(separator + 1).trim()]
500
+ })
501
+ .filter(([name]) => name)
502
+ )
503
+
504
+ return apiRequest({
505
+ url : params.url,
506
+ method : params.method,
507
+ headers,
508
+ withAuth: params.useStoredAuth,
509
+ body : params.body ? JSON.parse(params.body) : undefined,
510
+ })
511
+ },
512
+ })
513
+
514
+ // {{#if useFilesApi}}
515
+ // ─── Files ───────────────────────────────────────────────────────────────────
516
+ // `files` and `filesScope` are in the handler context bag because `usesFileStorage: true` is set above.
517
+ // (`filesScope` is always there — it is just the layer names — but `files` needs the opt-in.)
518
+ ext.addAction({
519
+ category : 'Lists',
520
+ id : 'exportList',
521
+ label : 'Export List',
522
+ description: 'Writes a list and its tasks to a JSON file in the workspace file storage.',
523
+ params : z.object({
524
+ listId : z.string().label('List').dictionary(getListsDictionary),
525
+ filename: z.string().optional().default('list.json').label('File name'),
526
+ }),
527
+ result : { url: 'https://files.example.invalid/list.json', size: 128 },
528
+ execute : async ({ params, files, filesScope }) => {
529
+ const list = requireList(params.listId)
530
+ const payload = { ...serializeList(list), tasks: [...list.tasks.values()] }
531
+
532
+ const saved = await files.uploadFile(Buffer.from(JSON.stringify(payload, null, 2)), {
533
+ // `filesScope` names the storage layers: WORKSPACE, FLOW or EXECUTION.
534
+ scope : filesScope.FLOW,
535
+ filename : params.filename,
536
+ generateUrl: true,
537
+ ttl : 3600,
538
+ })
539
+
540
+ return { url: saved.url, size: saved.size }
541
+ },
542
+ })
543
+ // {{/if}}
544
+
545
+ // ─── Helpers ─────────────────────────────────────────────────────────────────
546
+ // Module-level helpers: no `ctx`, so they are plain function declarations at the end of the file.
547
+ // Declarations hoist, which is what lets the actions above call them.
548
+
549
+ function nextId(kind) {
550
+ return `${ kind }-${ storage.nextId[kind]++ }`
551
+ }
552
+
553
+ function requireList(listId) {
554
+ const list = storage.lists.get(listId)
555
+
556
+ if (!list) {
557
+ throw new Error(`List "${ listId }" does not exist`)
558
+ }
559
+
560
+ return list
561
+ }
562
+
563
+ function requireTask(listId, taskId) {
564
+ const task = requireList(listId).tasks.get(taskId)
565
+
566
+ if (!task) {
567
+ throw new Error(`Task "${ taskId }" does not exist in list "${ listId }"`)
568
+ }
569
+
570
+ return task
571
+ }
572
+
573
+ // What a list looks like to a flow — the tasks Map itself never leaves the service.
574
+ function serializeList(list) {
575
+ return {
576
+ id : list.id,
577
+ name : list.name,
578
+ description : list.description,
579
+ customFields: list.customFields,
580
+ createdBy : list.createdBy,
581
+ createdAt : list.createdAt,
582
+ taskCount : list.tasks.size,
583
+ openCount : [...list.tasks.values()].filter(task => !task.completed).length,
584
+ }
585
+ }
586
+
587
+ // Turns a custom field label into a usable param name: "Story Points" → "cf_story_points".
588
+ function customFieldKey(label) {
589
+ return `cf_${ label.toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_|_$/g, '') }`
590
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "id": "demo-todo-list",
3
+ "label": "Demo To-do List",
4
+ "description": "A working to-do list service \u2014 lists, tasks, completion, plus a generic HTTP Request action.",
5
+ "prompts": [
6
+ {
7
+ "name": "id",
8
+ "label": "Service id",
9
+ "type": "string",
10
+ "default": "demo-todo-list",
11
+ "validate": "serviceId",
12
+ "hint": "Becomes the services/<id>/ folder and the service id, which is frozen once deployed."
13
+ },
14
+ {
15
+ "name": "name",
16
+ "label": "Display name",
17
+ "type": "string",
18
+ "default": "{{id|titleCase}}",
19
+ "validate": "nonEmpty"
20
+ }
21
+ ],
22
+ "values": {
23
+ "description": "Manage to-do lists and tasks from a flow.",
24
+ "useFilesApi": true
25
+ },
26
+ "files": [
27
+ {
28
+ "from": "package.json",
29
+ "to": "package.json"
30
+ },
31
+ {
32
+ "from": "src/index.js",
33
+ "to": "src/index.js"
34
+ },
35
+ {
36
+ "from": "README.md",
37
+ "to": "README.md"
38
+ },
39
+ {
40
+ "from": "public/icon.svg",
41
+ "to": "public/icon.svg"
42
+ }
43
+ ]
44
+ }