@openapi-flow/n8n 0.0.0-stage → 0.3.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 (332) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +129 -2
  3. package/THIRD_PARTY_NOTICES.md +9 -0
  4. package/dist/legacy/workflow/common/plan-validation.d.ts +1 -0
  5. package/dist/legacy/workflow/common/plan-validation.js +11 -0
  6. package/dist/legacy/workflow/common/workflow-id.d.ts +1 -0
  7. package/dist/legacy/workflow/common/workflow-id.js +8 -0
  8. package/dist/legacy/workflow/inbound/build-inbound-workflow.d.ts +2 -0
  9. package/dist/legacy/workflow/inbound/build-inbound-workflow.js +60 -0
  10. package/dist/legacy/workflow/inbound/compile-inbound-workflow.d.ts +2 -0
  11. package/dist/legacy/workflow/inbound/compile-inbound-workflow.js +25 -0
  12. package/dist/legacy/workflow/inbound/inbound-response.d.ts +2 -0
  13. package/dist/legacy/workflow/inbound/inbound-response.js +51 -0
  14. package/dist/legacy/workflow/request/base-url.d.ts +1 -0
  15. package/dist/legacy/workflow/request/base-url.js +14 -0
  16. package/dist/legacy/workflow/request/build-request-workflow.d.ts +3 -0
  17. package/dist/legacy/workflow/request/build-request-workflow.js +47 -0
  18. package/dist/legacy/workflow/request/build-sequence-workflow.d.ts +3 -0
  19. package/dist/legacy/workflow/request/build-sequence-workflow.js +53 -0
  20. package/dist/legacy/workflow/request/compile-catalog-sequence.d.ts +2 -0
  21. package/dist/legacy/workflow/request/compile-catalog-sequence.js +122 -0
  22. package/dist/legacy/workflow/request/compile-sequence.d.ts +2 -0
  23. package/dist/legacy/workflow/request/compile-sequence.js +41 -0
  24. package/dist/legacy/workflow/request/compile-workflow.d.ts +4 -0
  25. package/dist/legacy/workflow/request/compile-workflow.js +93 -0
  26. package/dist/legacy/workflow/request/credential-binding.d.ts +5 -0
  27. package/dist/legacy/workflow/request/credential-binding.js +31 -0
  28. package/dist/legacy/workflow/request/effect-policy.d.ts +4 -0
  29. package/dist/legacy/workflow/request/effect-policy.js +16 -0
  30. package/dist/legacy/workflow/request/http-request-node.d.ts +2 -0
  31. package/dist/legacy/workflow/request/http-request-node.js +69 -0
  32. package/dist/legacy/workflow/request/prepare-sequence.d.ts +4 -0
  33. package/dist/legacy/workflow/request/prepare-sequence.js +103 -0
  34. package/dist/legacy/workflow/request/request-body.d.ts +4 -0
  35. package/dist/legacy/workflow/request/request-body.js +64 -0
  36. package/dist/legacy/workflow/request/request-headers.d.ts +4 -0
  37. package/dist/legacy/workflow/request/request-headers.js +30 -0
  38. package/dist/legacy/workflow/request/request-url.d.ts +4 -0
  39. package/dist/legacy/workflow/request/request-url.js +34 -0
  40. package/dist/legacy/workflow/request/response-assertion-code.d.ts +3 -0
  41. package/dist/legacy/workflow/request/response-assertion-code.js +28 -0
  42. package/dist/legacy/workflow/request/sequence-url.d.ts +4 -0
  43. package/dist/legacy/workflow/request/sequence-url.js +104 -0
  44. package/dist/legacy-api.d.ts +25 -0
  45. package/dist/legacy-api.js +20 -0
  46. package/dist/nodes/common/validation/compile-standalone-validator.d.ts +3 -0
  47. package/dist/nodes/common/validation/compile-standalone-validator.js +44 -0
  48. package/dist/nodes/gap/create-gap-node.d.ts +3 -0
  49. package/dist/nodes/gap/create-gap-node.js +35 -0
  50. package/dist/nodes/inputs/compile-template-input-validators.d.ts +3 -0
  51. package/dist/nodes/inputs/compile-template-input-validators.js +26 -0
  52. package/dist/nodes/inputs/create-template-input-nodes.d.ts +4 -0
  53. package/dist/nodes/inputs/create-template-input-nodes.js +61 -0
  54. package/dist/nodes/native/arrays/create-array-node-fragment.d.ts +4 -0
  55. package/dist/nodes/native/arrays/create-array-node-fragment.js +42 -0
  56. package/dist/nodes/native/arrays/create-array-reader-code.d.ts +3 -0
  57. package/dist/nodes/native/arrays/create-array-reader-code.js +12 -0
  58. package/dist/nodes/native/arrays/create-bound-native-array-capability.d.ts +4 -0
  59. package/dist/nodes/native/arrays/create-bound-native-array-capability.js +81 -0
  60. package/dist/nodes/native/arrays/create-native-array-capability.d.ts +4 -0
  61. package/dist/nodes/native/arrays/create-native-array-capability.js +12 -0
  62. package/dist/nodes/native/arrays/native-array-definition.d.ts +2 -0
  63. package/dist/nodes/native/arrays/native-array-definition.js +27 -0
  64. package/dist/nodes/native/common/create-material-planning-capability.d.ts +4 -0
  65. package/dist/nodes/native/common/create-material-planning-capability.js +14 -0
  66. package/dist/nodes/native/common/create-native-fragment.d.ts +2 -0
  67. package/dist/nodes/native/common/create-native-fragment.js +10 -0
  68. package/dist/nodes/native/common/define-material-bound-capability.d.ts +4 -0
  69. package/dist/nodes/native/common/define-material-bound-capability.js +33 -0
  70. package/dist/nodes/native/common/resolve-native-runtime-source.d.ts +3 -0
  71. package/dist/nodes/native/common/resolve-native-runtime-source.js +15 -0
  72. package/dist/nodes/native/common/response-reference-bindings.d.ts +4 -0
  73. package/dist/nodes/native/common/response-reference-bindings.js +15 -0
  74. package/dist/nodes/native/common/response-references.d.ts +3 -0
  75. package/dist/nodes/native/common/response-references.js +5 -0
  76. package/dist/nodes/native/create-exclusive-branch-merge-capability.d.ts +3 -0
  77. package/dist/nodes/native/create-exclusive-branch-merge-capability.js +43 -0
  78. package/dist/nodes/native/create-json-output-capability.d.ts +3 -0
  79. package/dist/nodes/native/create-json-output-capability.js +48 -0
  80. package/dist/nodes/native/create-native-capabilities.d.ts +2 -0
  81. package/dist/nodes/native/create-native-capabilities.js +15 -0
  82. package/dist/nodes/native/create-pass-through-capability.d.ts +3 -0
  83. package/dist/nodes/native/create-pass-through-capability.js +32 -0
  84. package/dist/nodes/native/create-response-array-capability.d.ts +3 -0
  85. package/dist/nodes/native/create-response-array-capability.js +78 -0
  86. package/dist/nodes/native/create-response-collection-capability.d.ts +3 -0
  87. package/dist/nodes/native/create-response-collection-capability.js +134 -0
  88. package/dist/nodes/native/if-capability.d.ts +2 -0
  89. package/dist/nodes/native/if-capability.js +80 -0
  90. package/dist/nodes/native/inputs/native-input-runtime.bundle.js +24 -0
  91. package/dist/nodes/native/inputs/prepend-native-parameter-guard.d.ts +4 -0
  92. package/dist/nodes/native/inputs/prepend-native-parameter-guard.js +52 -0
  93. package/dist/nodes/native/item-join/create-bound-item-join-capability.d.ts +3 -0
  94. package/dist/nodes/native/item-join/create-bound-item-join-capability.js +169 -0
  95. package/dist/nodes/native/item-join/create-item-join-capability.d.ts +4 -0
  96. package/dist/nodes/native/item-join/create-item-join-capability.js +10 -0
  97. package/dist/nodes/native/item-join/create-item-join-reader-code.d.ts +2 -0
  98. package/dist/nodes/native/item-join/create-item-join-reader-code.js +18 -0
  99. package/dist/nodes/native/item-join/item-join-definition.d.ts +2 -0
  100. package/dist/nodes/native/item-join/item-join-definition.js +33 -0
  101. package/dist/nodes/native/item-join/runtime/item-join-runtime.bundle.js +24 -0
  102. package/dist/nodes/native/item-join/runtime/join-api-items.d.ts +3 -0
  103. package/dist/nodes/native/item-join/runtime/join-api-items.js +37 -0
  104. package/dist/nodes/native/merge-append-capability.d.ts +2 -0
  105. package/dist/nodes/native/merge-append-capability.js +33 -0
  106. package/dist/nodes/native/registry/native-feature-definitions.d.ts +4 -0
  107. package/dist/nodes/native/registry/native-feature-definitions.js +93 -0
  108. package/dist/nodes/native/registry/native-feature-material-requirements.d.ts +3 -0
  109. package/dist/nodes/native/registry/native-feature-material-requirements.js +10 -0
  110. package/dist/nodes/native/registry/resolve-n8n-native-features.d.ts +3 -0
  111. package/dist/nodes/native/registry/resolve-n8n-native-features.js +6 -0
  112. package/dist/nodes/native/registry/resolve-n8n-native-planning-features.d.ts +3 -0
  113. package/dist/nodes/native/registry/resolve-n8n-native-planning-features.js +5 -0
  114. package/dist/nodes/native/registry/resolve-native-feature-registry.d.ts +3 -0
  115. package/dist/nodes/native/registry/resolve-native-feature-registry.js +99 -0
  116. package/dist/nodes/native/registry/validate-native-feature-context.d.ts +2 -0
  117. package/dist/nodes/native/registry/validate-native-feature-context.js +46 -0
  118. package/dist/nodes/native/response-array-definition.d.ts +2 -0
  119. package/dist/nodes/native/response-array-definition.js +27 -0
  120. package/dist/nodes/native/response-assertion-capability.d.ts +2 -0
  121. package/dist/nodes/native/response-assertion-capability.js +57 -0
  122. package/dist/nodes/native/response-check-code.d.ts +3 -0
  123. package/dist/nodes/native/response-check-code.js +65 -0
  124. package/dist/nodes/native/response-checks/create-response-check-guard.d.ts +4 -0
  125. package/dist/nodes/native/response-checks/create-response-check-guard.js +22 -0
  126. package/dist/nodes/native/response-checks/create-response-check-reader.d.ts +3 -0
  127. package/dist/nodes/native/response-checks/create-response-check-reader.js +23 -0
  128. package/dist/nodes/native/response-collection-definition.d.ts +2 -0
  129. package/dist/nodes/native/response-collection-definition.js +27 -0
  130. package/dist/nodes/native/stop-and-error-capability.d.ts +2 -0
  131. package/dist/nodes/native/stop-and-error-capability.js +43 -0
  132. package/dist/nodes/request/authentication/credential-field-name.d.ts +1 -0
  133. package/dist/nodes/request/authentication/credential-field-name.js +3 -0
  134. package/dist/nodes/request/authentication/resolve-http-request-authentication.d.ts +2 -0
  135. package/dist/nodes/request/authentication/resolve-http-request-authentication.js +42 -0
  136. package/dist/nodes/request/bindings/compile-native-output-validators.d.ts +3 -0
  137. package/dist/nodes/request/bindings/compile-native-output-validators.js +12 -0
  138. package/dist/nodes/request/bindings/compile-request-validator.d.ts +3 -0
  139. package/dist/nodes/request/bindings/compile-request-validator.js +13 -0
  140. package/dist/nodes/request/bindings/compile-source-response-validators.d.ts +2 -0
  141. package/dist/nodes/request/bindings/compile-source-response-validators.js +12 -0
  142. package/dist/nodes/request/bindings/create-bound-request-fragment.d.ts +3 -0
  143. package/dist/nodes/request/bindings/create-bound-request-fragment.js +82 -0
  144. package/dist/nodes/request/bindings/create-output-item-reader-code.d.ts +2 -0
  145. package/dist/nodes/request/bindings/create-output-item-reader-code.js +7 -0
  146. package/dist/nodes/request/bindings/create-output-reader-code.d.ts +3 -0
  147. package/dist/nodes/request/bindings/create-output-reader-code.js +26 -0
  148. package/dist/nodes/request/bindings/resolve-output-binding-sources.d.ts +3 -0
  149. package/dist/nodes/request/bindings/resolve-output-binding-sources.js +36 -0
  150. package/dist/nodes/request/create-http-request-node.d.ts +2 -0
  151. package/dist/nodes/request/create-http-request-node.js +73 -0
  152. package/dist/nodes/request/deployment/create-request-deployment-notes.d.ts +2 -0
  153. package/dist/nodes/request/deployment/create-request-deployment-notes.js +3 -0
  154. package/dist/nodes/request/deployment/resolve-http-request-deployment.d.ts +2 -0
  155. package/dist/nodes/request/deployment/resolve-http-request-deployment.js +33 -0
  156. package/dist/nodes/request/finalize-http-request-fragment.d.ts +3 -0
  157. package/dist/nodes/request/finalize-http-request-fragment.js +22 -0
  158. package/dist/nodes/request/resolve-http-request-node-configuration.d.ts +4 -0
  159. package/dist/nodes/request/resolve-http-request-node-configuration.js +41 -0
  160. package/dist/nodes/request/response/create-http-response-decoder.d.ts +4 -0
  161. package/dist/nodes/request/response/create-http-response-decoder.js +57 -0
  162. package/dist/nodes/request/response/decode-http-response.d.ts +3 -0
  163. package/dist/nodes/request/response/decode-http-response.js +42 -0
  164. package/dist/nodes/request/response/http-response-media.d.ts +2 -0
  165. package/dist/nodes/request/response/http-response-media.js +32 -0
  166. package/dist/nodes/request/response/http-response-node-name.d.ts +2 -0
  167. package/dist/nodes/request/response/http-response-node-name.js +4 -0
  168. package/dist/nodes/request/response/response-runtime.bundle.js +24 -0
  169. package/dist/nodes/request/runtime/materialize-http-request.d.ts +4 -0
  170. package/dist/nodes/request/runtime/materialize-http-request.js +35 -0
  171. package/dist/nodes/request/runtime/request-runtime.bundle.js +24 -0
  172. package/dist/nodes/request/serialization/create-serialized-http-request-node.d.ts +3 -0
  173. package/dist/nodes/request/serialization/create-serialized-http-request-node.js +17 -0
  174. package/dist/nodes/request/serialization/serialize-http-request.d.ts +5 -0
  175. package/dist/nodes/request/serialization/serialize-http-request.js +70 -0
  176. package/dist/public-api.d.ts +43 -0
  177. package/dist/public-api.js +26 -0
  178. package/dist/schemas/batch-execution-schema.d.ts +15 -0
  179. package/dist/schemas/batch-execution-schema.js +14 -0
  180. package/dist/schemas/create-native-comparison-planning-schema.d.ts +81 -0
  181. package/dist/schemas/create-native-comparison-planning-schema.js +36 -0
  182. package/dist/schemas/exclusive-branch-merge-schema.d.ts +4 -0
  183. package/dist/schemas/exclusive-branch-merge-schema.js +7 -0
  184. package/dist/schemas/item-join-schema.d.ts +13 -0
  185. package/dist/schemas/item-join-schema.js +26 -0
  186. package/dist/schemas/native-array-schema.d.ts +11 -0
  187. package/dist/schemas/native-array-schema.js +19 -0
  188. package/dist/schemas/native-capability-schemas.d.ts +100 -0
  189. package/dist/schemas/native-capability-schemas.js +62 -0
  190. package/dist/schemas/native-feature-registry-schema.d.ts +17 -0
  191. package/dist/schemas/native-feature-registry-schema.js +8 -0
  192. package/dist/schemas/native-runtime-input-schema.d.ts +5 -0
  193. package/dist/schemas/native-runtime-input-schema.js +5 -0
  194. package/dist/schemas/request-deployment-schema.d.ts +9 -0
  195. package/dist/schemas/request-deployment-schema.js +27 -0
  196. package/dist/schemas/response-array-schema.d.ts +11 -0
  197. package/dist/schemas/response-array-schema.js +19 -0
  198. package/dist/schemas/response-collection-schema.d.ts +11 -0
  199. package/dist/schemas/response-collection-schema.js +19 -0
  200. package/dist/schemas/template-deployment-selection-schema.d.ts +3 -0
  201. package/dist/schemas/template-deployment-selection-schema.js +10 -0
  202. package/dist/schemas/workflow-input-value-map-schema.d.ts +5 -0
  203. package/dist/schemas/workflow-input-value-map-schema.js +5 -0
  204. package/dist/schemas/workflow-template-schema.d.ts +11 -0
  205. package/dist/schemas/workflow-template-schema.js +10 -0
  206. package/dist/types/array-iteration.d.ts +8 -0
  207. package/dist/types/array-iteration.js +1 -0
  208. package/dist/types/array-split.d.ts +13 -0
  209. package/dist/types/array-split.js +1 -0
  210. package/dist/types/authentication.d.ts +14 -0
  211. package/dist/types/authentication.js +1 -0
  212. package/dist/types/batch-execution.d.ts +23 -0
  213. package/dist/types/batch-execution.js +1 -0
  214. package/dist/types/http-response-decoding.d.ts +16 -0
  215. package/dist/types/http-response-decoding.js +1 -0
  216. package/dist/types/item-join.d.ts +40 -0
  217. package/dist/types/item-join.js +1 -0
  218. package/dist/types/legacy/catalog-workflow.d.ts +37 -0
  219. package/dist/types/legacy/catalog-workflow.js +1 -0
  220. package/dist/types/legacy/inbound-workflow.d.ts +27 -0
  221. package/dist/types/legacy/inbound-workflow.js +1 -0
  222. package/dist/types/legacy/request-node.d.ts +23 -0
  223. package/dist/types/legacy/request-node.js +1 -0
  224. package/dist/types/legacy/request-workflow.d.ts +43 -0
  225. package/dist/types/legacy/request-workflow.js +1 -0
  226. package/dist/types/legacy/sequence-workflow.d.ts +57 -0
  227. package/dist/types/legacy/sequence-workflow.js +1 -0
  228. package/dist/types/native-array.d.ts +8 -0
  229. package/dist/types/native-array.js +1 -0
  230. package/dist/types/native-capability.d.ts +46 -0
  231. package/dist/types/native-capability.js +1 -0
  232. package/dist/types/native-feature-registry.d.ts +70 -0
  233. package/dist/types/native-feature-registry.js +14 -0
  234. package/dist/types/native-material-binding.d.ts +56 -0
  235. package/dist/types/native-material-binding.js +1 -0
  236. package/dist/types/native-runtime-parameters.d.ts +55 -0
  237. package/dist/types/native-runtime-parameters.js +1 -0
  238. package/dist/types/node-fragment.d.ts +51 -0
  239. package/dist/types/node-fragment.js +1 -0
  240. package/dist/types/output-binding-source.d.ts +27 -0
  241. package/dist/types/output-binding-source.js +1 -0
  242. package/dist/types/request-deployment.d.ts +17 -0
  243. package/dist/types/request-deployment.js +1 -0
  244. package/dist/types/request-materialization.d.ts +30 -0
  245. package/dist/types/request-materialization.js +1 -0
  246. package/dist/types/request-node-configuration.d.ts +13 -0
  247. package/dist/types/request-node-configuration.js +1 -0
  248. package/dist/types/response-check-compilation.d.ts +11 -0
  249. package/dist/types/response-check-compilation.js +1 -0
  250. package/dist/types/response-check-guard.d.ts +6 -0
  251. package/dist/types/response-check-guard.js +1 -0
  252. package/dist/types/response-collection.d.ts +7 -0
  253. package/dist/types/response-collection.js +1 -0
  254. package/dist/types/reviewable-workflow.d.ts +29 -0
  255. package/dist/types/reviewable-workflow.js +1 -0
  256. package/dist/types/schema-compilation.d.ts +5 -0
  257. package/dist/types/schema-compilation.js +1 -0
  258. package/dist/types/serialized-http-request.d.ts +4 -0
  259. package/dist/types/serialized-http-request.js +1 -0
  260. package/dist/types/workflow-compilation.d.ts +39 -0
  261. package/dist/types/workflow-compilation.js +1 -0
  262. package/dist/types/workflow-template.d.ts +121 -0
  263. package/dist/types/workflow-template.js +1 -0
  264. package/dist/utils/bundled-license-banner.d.ts +3 -0
  265. package/dist/utils/bundled-license-banner.js +32 -0
  266. package/dist/utils/javascript-json-literal.d.ts +2 -0
  267. package/dist/utils/javascript-json-literal.js +10 -0
  268. package/dist/utils/json-values-equal.cjs +24 -0
  269. package/dist/utils/json-values-equal.d.cts +1 -0
  270. package/dist/workflow/assemble-n8n-workflow.d.ts +2 -0
  271. package/dist/workflow/assemble-n8n-workflow.js +11 -0
  272. package/dist/workflow/batch/compile-batched-n8n-workflow.d.ts +3 -0
  273. package/dist/workflow/batch/compile-batched-n8n-workflow.js +36 -0
  274. package/dist/workflow/batch/create-batch-execution-scopes.d.ts +3 -0
  275. package/dist/workflow/batch/create-batch-execution-scopes.js +59 -0
  276. package/dist/workflow/batch/validate-batch-exclusive-rejoin.d.ts +3 -0
  277. package/dist/workflow/batch/validate-batch-exclusive-rejoin.js +49 -0
  278. package/dist/workflow/batch/validate-batch-item-flow.d.ts +3 -0
  279. package/dist/workflow/batch/validate-batch-item-flow.js +98 -0
  280. package/dist/workflow/build-n8n-workflow.d.ts +2 -0
  281. package/dist/workflow/build-n8n-workflow.js +140 -0
  282. package/dist/workflow/compile-native-material-fragments.d.ts +3 -0
  283. package/dist/workflow/compile-native-material-fragments.js +76 -0
  284. package/dist/workflow/compile-native-workflow-nodes.d.ts +3 -0
  285. package/dist/workflow/compile-native-workflow-nodes.js +25 -0
  286. package/dist/workflow/compile-planned-n8n-workflow.d.ts +3 -0
  287. package/dist/workflow/compile-planned-n8n-workflow.js +42 -0
  288. package/dist/workflow/compile-reviewable-n8n-workflow.d.ts +3 -0
  289. package/dist/workflow/compile-reviewable-n8n-workflow.js +92 -0
  290. package/dist/workflow/compile-validated-workflow-fragments.d.ts +3 -0
  291. package/dist/workflow/compile-validated-workflow-fragments.js +20 -0
  292. package/dist/workflow/compile-workflow-material-fragments.d.ts +4 -0
  293. package/dist/workflow/compile-workflow-material-fragments.js +18 -0
  294. package/dist/workflow/create-n8n-native-output-sources.d.ts +3 -0
  295. package/dist/workflow/create-n8n-native-output-sources.js +58 -0
  296. package/dist/workflow/entrypoint/manual-trigger.d.ts +4 -0
  297. package/dist/workflow/entrypoint/manual-trigger.js +16 -0
  298. package/dist/workflow/find-singleton-api-responses.d.ts +3 -0
  299. package/dist/workflow/find-singleton-api-responses.js +22 -0
  300. package/dist/workflow/inputs/compile-native-runtime-inputs.d.ts +5 -0
  301. package/dist/workflow/inputs/compile-native-runtime-inputs.js +129 -0
  302. package/dist/workflow/inputs/create-runtime-input-native-capabilities.d.ts +4 -0
  303. package/dist/workflow/inputs/create-runtime-input-native-capabilities.js +36 -0
  304. package/dist/workflow/resolve-n8n-native-materials.d.ts +2 -0
  305. package/dist/workflow/resolve-n8n-native-materials.js +16 -0
  306. package/dist/workflow/review/create-gap-review-content.d.ts +2 -0
  307. package/dist/workflow/review/create-gap-review-content.js +28 -0
  308. package/dist/workflow/review/create-gap-review-region.d.ts +2 -0
  309. package/dist/workflow/review/create-gap-review-region.js +23 -0
  310. package/dist/workflow/review/escape-review-markdown.d.ts +1 -0
  311. package/dist/workflow/review/escape-review-markdown.js +7 -0
  312. package/dist/workflow/review/gap-review-region-layout.d.ts +4 -0
  313. package/dist/workflow/review/gap-review-region-layout.js +21 -0
  314. package/dist/workflow/templates/compile-n8n-workflow-template.d.ts +3 -0
  315. package/dist/workflow/templates/compile-n8n-workflow-template.js +211 -0
  316. package/dist/workflow/templates/create-template-artifact-mapping.d.ts +2 -0
  317. package/dist/workflow/templates/create-template-artifact-mapping.js +58 -0
  318. package/dist/workflow/templates/create-template-gap-regions.d.ts +5 -0
  319. package/dist/workflow/templates/create-template-gap-regions.js +22 -0
  320. package/dist/workflow/templates/create-workflow-template-guide.d.ts +3 -0
  321. package/dist/workflow/templates/create-workflow-template-guide.js +44 -0
  322. package/dist/workflow/templates/prepare-template-api-fragments.d.ts +3 -0
  323. package/dist/workflow/templates/prepare-template-api-fragments.js +74 -0
  324. package/dist/workflow/templates/select-n8n-template-deployments.d.ts +3 -0
  325. package/dist/workflow/templates/select-n8n-template-deployments.js +12 -0
  326. package/dist/workflow/templates/workflow-template-identities.d.ts +5 -0
  327. package/dist/workflow/templates/workflow-template-identities.js +5 -0
  328. package/dist/workflow/validate-compiled-binding-sources.d.ts +4 -0
  329. package/dist/workflow/validate-compiled-binding-sources.js +40 -0
  330. package/dist/workflow/validate-node-fragments.d.ts +3 -0
  331. package/dist/workflow/validate-node-fragments.js +58 -0
  332. package/package.json +59 -4
@@ -0,0 +1,122 @@
1
+ import { createOperationCatalog } from '@openapi-flow/core/internal';
2
+ import { operationFromDocument } from '@openapi-flow/core/internal';
3
+ import { isObject } from '@openapi-flow/core/internal';
4
+ import { assertSerializablePlan } from '../common/plan-validation.js';
5
+ import { originFrom } from './base-url.js';
6
+ import { isSafeMethod } from './effect-policy.js';
7
+ import { buildSequenceWorkflow } from './build-sequence-workflow.js';
8
+ import { prepareSteps } from './prepare-sequence.js';
9
+ export async function compileCatalogSequence({ sources, profile, plan, }) {
10
+ if (profile !== 'read-only' && profile !== 'test')
11
+ throw new Error('profile must be read-only or test');
12
+ if (!isObject(plan) ||
13
+ plan.version !== '1' ||
14
+ typeof plan.goal !== 'string' ||
15
+ !plan.goal.trim() ||
16
+ !Array.isArray(plan.steps) ||
17
+ (plan.gaps !== undefined && !Array.isArray(plan.gaps)) ||
18
+ (plan.steps.length === 0 && (!plan.gaps || plan.gaps.length === 0)))
19
+ throw new Error('plan must contain version 1, goal, steps or gaps');
20
+ assertSerializablePlan(plan);
21
+ const catalog = await createOperationCatalog(sources);
22
+ const gaps = plan.gaps ?? [];
23
+ for (const gap of gaps) {
24
+ if (!isObject(gap) ||
25
+ (gap.kind !== 'missing_operation' &&
26
+ gap.kind !== 'insufficient_contract') ||
27
+ typeof gap.description !== 'string' ||
28
+ !gap.description.trim())
29
+ throw new Error('plan.gaps[] must contain kind and non-empty description');
30
+ if (gap.kind === 'missing_operation' &&
31
+ (gap.documentId !== undefined || gap.operationRef !== undefined))
32
+ throw new Error('plan.gaps[] missing_operation must not identify an operation');
33
+ if (gap.kind === 'insufficient_contract') {
34
+ if (typeof gap.documentId !== 'string' ||
35
+ typeof gap.operationRef !== 'string')
36
+ throw new Error('plan.gaps[] insufficient_contract needs documentId and operationRef');
37
+ const source = catalog.sources.get(gap.documentId);
38
+ if (!source ||
39
+ !source.operations.some((operation) => operation.operationRef === gap.operationRef))
40
+ throw new Error('plan.gaps[] insufficient_contract operation is not in sources');
41
+ }
42
+ }
43
+ const stepById = new Map();
44
+ for (const step of plan.steps) {
45
+ if (!isObject(step) ||
46
+ typeof step.documentId !== 'string' ||
47
+ !step.documentId.trim())
48
+ throw new Error('plan.steps[].documentId must be non-empty');
49
+ if (typeof step.id !== 'string' || !step.id.trim() || stepById.has(step.id))
50
+ throw new Error('plan.steps must have unique non-empty id values');
51
+ stepById.set(step.id, step.documentId);
52
+ }
53
+ const prepared = prepareSteps({
54
+ profile,
55
+ plan,
56
+ resolveStep: (step) => {
57
+ const documentId = stepById.get(step.id);
58
+ const source = documentId === undefined ? undefined : catalog.sources.get(documentId);
59
+ if (!source)
60
+ throw new Error(`plan.steps[${step.id}].documentId is not in sources: ${documentId}`);
61
+ const target = sources.find((item) => item.id === source.id);
62
+ if (!target)
63
+ throw new Error(`sources[${source.id}] execution configuration is missing`);
64
+ return {
65
+ operation: operationFromDocument(source.document, step.operationRef),
66
+ origin: originFrom(target.baseUrl),
67
+ effectPolicy: target.effectPolicy,
68
+ credentialBindings: target.credentialBindings,
69
+ };
70
+ },
71
+ });
72
+ const evidence = prepared.evidence.map((entry) => ({
73
+ ...entry,
74
+ documentId: stepById.get(entry.stepId),
75
+ }));
76
+ const diagnostics = [
77
+ ...gaps.map((gap) => ({
78
+ code: gap.kind,
79
+ message: gap.description,
80
+ ...(gap.documentId === undefined ? {} : { documentId: gap.documentId }),
81
+ ...(gap.operationRef === undefined
82
+ ? {}
83
+ : { operationRef: gap.operationRef }),
84
+ })),
85
+ ...prepared.missingInputs.map((missing) => ({
86
+ code: 'missing_input',
87
+ message: missing,
88
+ stepId: missing.split('.')[0],
89
+ })),
90
+ ...evidence
91
+ .filter((entry) => entry.effect === 'unknown' ||
92
+ (!isSafeMethod(entry.method) && entry.effect !== 'write') ||
93
+ (profile === 'read-only' &&
94
+ (!isSafeMethod(entry.method) || entry.effect !== 'read')))
95
+ .map((entry) => ({
96
+ code: 'effect_not_approved',
97
+ message: `step ${entry.stepId} requires an approved effect`,
98
+ stepId: entry.stepId,
99
+ })),
100
+ ];
101
+ const status = gaps.length
102
+ ? 'needs_capability'
103
+ : prepared.blocked
104
+ ? 'blocked'
105
+ : prepared.missingInputs.length
106
+ ? 'needs_input'
107
+ : 'complete';
108
+ if (status !== 'complete')
109
+ return { status, plan, evidence, diagnostics };
110
+ return {
111
+ status,
112
+ plan,
113
+ evidence,
114
+ diagnostics,
115
+ workflow: buildSequenceWorkflow({
116
+ baseUrl: JSON.stringify(sources.map(({ id, baseUrl }) => ({ id, baseUrl }))),
117
+ plan,
118
+ nodes: prepared.nodes,
119
+ requiredOutputs: prepared.requiredOutputs,
120
+ }),
121
+ };
122
+ }
@@ -0,0 +1,2 @@
1
+ import type { SequenceRequest, SequenceResult } from '../../../types/legacy/sequence-workflow.js';
2
+ export declare function compileSequence({ spec, baseUrl, profile, effectPolicy, credentialBindings, plan, }: SequenceRequest): Promise<SequenceResult>;
@@ -0,0 +1,41 @@
1
+ import { validateAndResolveOpenApiDocument } from '@openapi-flow/core/internal';
2
+ import { isObject } from '@openapi-flow/core/internal';
3
+ import { assertSerializablePlan } from '../common/plan-validation.js';
4
+ import { originFrom } from './base-url.js';
5
+ import { buildSequenceWorkflow } from './build-sequence-workflow.js';
6
+ import { prepareSequence } from './prepare-sequence.js';
7
+ export async function compileSequence({ spec, baseUrl, profile, effectPolicy, credentialBindings, plan, }) {
8
+ const origin = originFrom(baseUrl);
9
+ if (profile !== 'read-only' && profile !== 'test')
10
+ throw new Error('profile must be read-only or test');
11
+ if (!isObject(plan) ||
12
+ plan.version !== '1' ||
13
+ typeof plan.goal !== 'string' ||
14
+ !plan.goal.trim() ||
15
+ !Array.isArray(plan.steps) ||
16
+ plan.steps.length < 1) {
17
+ throw new Error('plan must contain version 1, goal, and non-empty steps');
18
+ }
19
+ assertSerializablePlan(plan);
20
+ const document = await validateAndResolveOpenApiDocument(spec);
21
+ const prepared = prepareSequence({
22
+ document,
23
+ origin,
24
+ profile,
25
+ effectPolicy,
26
+ credentialBindings,
27
+ plan,
28
+ });
29
+ const { evidence, missingInputs, nodes, requiredOutputs, blocked } = prepared;
30
+ if (blocked)
31
+ return { status: 'blocked', plan, evidence, missingInputs };
32
+ if (missingInputs.length)
33
+ return { status: 'needs_input', plan, evidence, missingInputs };
34
+ return {
35
+ status: 'complete',
36
+ plan,
37
+ evidence,
38
+ missingInputs,
39
+ workflow: buildSequenceWorkflow({ baseUrl, plan, nodes, requiredOutputs }),
40
+ };
41
+ }
@@ -0,0 +1,4 @@
1
+ import type { Operation } from '@openapi-flow/core/internal';
2
+ import type { CompileOperationRequest, CompileRequest, CompileResult } from '../../../types/legacy/request-workflow.js';
3
+ export declare function compileWorkflow(request: CompileRequest): Promise<CompileResult>;
4
+ export declare function compileWorkflowFromOperation({ baseUrl, profile, effectPolicy, credentialBindings, plan, }: CompileOperationRequest, operation: Operation): CompileResult;
@@ -0,0 +1,93 @@
1
+ import { operationFromSpec } from '@openapi-flow/core/internal';
2
+ import { validateResponseField } from '@openapi-flow/core/internal';
3
+ import { isObject } from '@openapi-flow/core/internal';
4
+ import { assertSerializablePlan } from '../common/plan-validation.js';
5
+ import { originFrom } from './base-url.js';
6
+ import { approvedEffect, isSafeMethod } from './effect-policy.js';
7
+ import { looksLikeCredential, resolveCredentialBinding, } from './credential-binding.js';
8
+ import { makeBody } from './request-body.js';
9
+ import { makeHeaders } from './request-headers.js';
10
+ import { makeUrl } from './request-url.js';
11
+ import { buildRequestWorkflow } from './build-request-workflow.js';
12
+ export async function compileWorkflow(request) {
13
+ if (!isObject(request.plan) ||
14
+ typeof request.plan.operationRef !== 'string') {
15
+ throw new Error('plan must contain version 1, goal, and operationRef');
16
+ }
17
+ const operation = await operationFromSpec(request.spec, request.plan.operationRef);
18
+ return compileWorkflowFromOperation(request, operation);
19
+ }
20
+ export function compileWorkflowFromOperation({ baseUrl, profile, effectPolicy, credentialBindings, plan, }, operation) {
21
+ const origin = originFrom(baseUrl);
22
+ if (profile !== 'read-only' && profile !== 'test')
23
+ throw new Error('profile must be read-only or test');
24
+ if (!isObject(plan) ||
25
+ plan.version !== '1' ||
26
+ typeof plan.goal !== 'string' ||
27
+ !plan.goal.trim() ||
28
+ typeof plan.operationRef !== 'string') {
29
+ throw new Error('plan must contain version 1, goal, and operationRef');
30
+ }
31
+ assertSerializablePlan(plan);
32
+ const effect = approvedEffect(operation, effectPolicy);
33
+ const authentication = resolveCredentialBinding(operation, credentialBindings);
34
+ const evidence = {
35
+ operationRef: operation.operationRef,
36
+ operationId: operation.operationId,
37
+ method: operation.method,
38
+ path: operation.path,
39
+ effect,
40
+ };
41
+ const inputs = plan.inputs === undefined ? {} : plan.inputs;
42
+ if (!isObject(inputs))
43
+ throw new Error('plan.inputs must be an object');
44
+ const expectedBody = plan.expectedBody === undefined ? {} : plan.expectedBody;
45
+ if (!isObject(expectedBody))
46
+ throw new Error('plan.expectedBody must be an object');
47
+ for (const [key, value] of Object.entries(expectedBody)) {
48
+ if (looksLikeCredential(key)) {
49
+ throw new Error('plan.expectedBody.' + key + ' looks like a credential');
50
+ }
51
+ validateResponseField(operation, key, value, 'plan.expectedBody.' + key);
52
+ }
53
+ const allowed = new Set(operation.parameters.map((parameter) => parameter.in + '.' + parameter.name));
54
+ if (operation.body)
55
+ allowed.add('body');
56
+ for (const key of Object.keys(inputs)) {
57
+ if (!allowed.has(key))
58
+ throw new Error('plan.inputs.' + key + ' is not declared in the OAS operation');
59
+ if (looksLikeCredential(key)) {
60
+ throw new Error('plan.inputs.' +
61
+ key +
62
+ ' looks like a credential; bind an existing n8n credential through credentialBindings instead');
63
+ }
64
+ }
65
+ const missingInputs = [];
66
+ const url = makeUrl(operation, origin, inputs, missingInputs);
67
+ const body = makeBody(operation, inputs, missingInputs, plan.requestMediaType);
68
+ const headers = makeHeaders(operation, inputs, missingInputs);
69
+ if (effect === 'unknown' ||
70
+ (!isSafeMethod(operation.method) && effect !== 'write') ||
71
+ (profile === 'read-only' &&
72
+ (!isSafeMethod(operation.method) || effect !== 'read'))) {
73
+ return { status: 'blocked', plan, evidence, missingInputs };
74
+ }
75
+ if (missingInputs.length)
76
+ return { status: 'needs_input', plan, evidence, missingInputs };
77
+ return {
78
+ status: 'complete',
79
+ plan,
80
+ evidence,
81
+ missingInputs,
82
+ workflow: buildRequestWorkflow({
83
+ baseUrl,
84
+ plan,
85
+ operation,
86
+ url,
87
+ body,
88
+ headers,
89
+ authentication,
90
+ expectedBody,
91
+ }),
92
+ };
93
+ }
@@ -0,0 +1,5 @@
1
+ import type { CredentialBindingRequest } from '../../../types/authentication.js';
2
+ import type { CredentialBindings } from '../../../types/legacy/request-workflow.js';
3
+ import type { ResolvedAuthentication } from '../../../types/legacy/request-node.js';
4
+ export { looksLikeCredential } from '../../../nodes/request/authentication/credential-field-name.js';
5
+ export declare function resolveCredentialBinding(operation: CredentialBindingRequest, credentialBindings: CredentialBindings): ResolvedAuthentication | undefined;
@@ -0,0 +1,31 @@
1
+ import { newCredential } from '@n8n/workflow-sdk';
2
+ import { isObject } from '@openapi-flow/core/internal';
3
+ export { looksLikeCredential } from '../../../nodes/request/authentication/credential-field-name.js';
4
+ export function resolveCredentialBinding(operation, credentialBindings) {
5
+ if (!isObject(credentialBindings)) {
6
+ throw new Error('credentialBindings must be an OAS-scheme-to-n8n-credential map');
7
+ }
8
+ if (operation.authentication === undefined)
9
+ return undefined;
10
+ const schemeName = operation.authentication.schemeName;
11
+ const binding = credentialBindings[schemeName];
12
+ if (!isObject(binding) ||
13
+ Object.keys(binding).some((key) => key !== 'id' && key !== 'name') ||
14
+ typeof binding.id !== 'string' ||
15
+ !binding.id.trim() ||
16
+ typeof binding.name !== 'string' ||
17
+ !binding.name.trim()) {
18
+ throw new Error('credentialBindings.' +
19
+ schemeName +
20
+ ' must contain an existing n8n credential id and name');
21
+ }
22
+ return {
23
+ parameters: {
24
+ authentication: 'genericCredentialType',
25
+ genericAuthType: operation.authentication.credentialType,
26
+ },
27
+ credentials: {
28
+ [operation.authentication.credentialType]: newCredential(binding.name, binding.id),
29
+ },
30
+ };
31
+ }
@@ -0,0 +1,4 @@
1
+ import type { Operation } from '@openapi-flow/core/internal';
2
+ import type { EffectPolicy, OperationEffect } from '../../../types/legacy/request-workflow.js';
3
+ export declare function isSafeMethod(method: string): boolean;
4
+ export declare function approvedEffect(operation: Operation, effectPolicy: EffectPolicy): OperationEffect;
@@ -0,0 +1,16 @@
1
+ import { isObject } from '@openapi-flow/core/internal';
2
+ export function isSafeMethod(method) {
3
+ return ['GET', 'HEAD', 'OPTIONS', 'TRACE', 'QUERY'].includes(method);
4
+ }
5
+ export function approvedEffect(operation, effectPolicy) {
6
+ if (!isObject(effectPolicy)) {
7
+ throw new Error('effectPolicy must be a trusted operationRef-to-effect map');
8
+ }
9
+ if (!Object.hasOwn(effectPolicy, operation.operationRef))
10
+ return 'unknown';
11
+ const effect = effectPolicy[operation.operationRef];
12
+ if (effect !== 'read' && effect !== 'write') {
13
+ throw new Error('effectPolicy.' + operation.operationRef + ' must be read or write');
14
+ }
15
+ return effect;
16
+ }
@@ -0,0 +1,2 @@
1
+ import type { HttpRequestNodeInput } from '../../../types/legacy/request-node.js';
2
+ export declare function httpRequestNode({ operation, id, name, position, url, body, headers, authentication, shouldAssert, }: HttpRequestNodeInput): import("@n8n/workflow-sdk").NodeInstance<string, `${number}`, unknown>;
@@ -0,0 +1,69 @@
1
+ import { node } from '@n8n/workflow-sdk';
2
+ import { UnsupportedOperationError } from '@openapi-flow/core/internal';
3
+ // n8n HTTP Request V3, node version 4.3 (verified against n8n 2.37.10).
4
+ const httpRequestMethods = new Set([
5
+ 'DELETE',
6
+ 'GET',
7
+ 'HEAD',
8
+ 'OPTIONS',
9
+ 'PATCH',
10
+ 'POST',
11
+ 'PUT',
12
+ ]);
13
+ export function httpRequestNode({ operation, id, name, position, url, body, headers, authentication, shouldAssert, }) {
14
+ if (operation.source !== 'paths') {
15
+ throw new Error(`operationRef ${operation.operationRef} is not an outgoing path request`);
16
+ }
17
+ if (!httpRequestMethods.has(operation.method)) {
18
+ throw new UnsupportedOperationError(operation.operationRef, `operationRef ${operation.operationRef} uses HTTP method ${operation.method}, which n8n HTTP Request node v4.3 does not expose`);
19
+ }
20
+ if (body !== undefined && ['HEAD', 'OPTIONS'].includes(operation.method)) {
21
+ throw new UnsupportedOperationError(operation.operationRef, `operationRef ${operation.operationRef} has a request body that n8n HTTP Request node v4.3 does not send for ${operation.method}`);
22
+ }
23
+ return node({
24
+ type: 'n8n-nodes-base.httpRequest',
25
+ version: 4.3,
26
+ config: {
27
+ id,
28
+ name,
29
+ position,
30
+ parameters: {
31
+ method: operation.method,
32
+ url,
33
+ ...authentication?.parameters,
34
+ ...(headers.length
35
+ ? {
36
+ sendHeaders: true,
37
+ specifyHeaders: 'keypair',
38
+ headerParameters: { parameters: headers },
39
+ }
40
+ : {}),
41
+ ...(body === undefined
42
+ ? {}
43
+ : body.contentType === 'json'
44
+ ? {
45
+ sendBody: true,
46
+ contentType: 'json',
47
+ specifyBody: 'json',
48
+ jsonBody: body.value,
49
+ }
50
+ : {
51
+ sendBody: true,
52
+ contentType: 'raw',
53
+ rawContentType: 'application/x-www-form-urlencoded',
54
+ body: body.value,
55
+ }),
56
+ options: {
57
+ response: {
58
+ response: {
59
+ fullResponse: true,
60
+ ...(shouldAssert ? { neverError: true } : {}),
61
+ responseFormat: 'autodetect',
62
+ },
63
+ },
64
+ },
65
+ },
66
+ ...(authentication ? { credentials: authentication.credentials } : {}),
67
+ },
68
+ });
69
+ }
@@ -0,0 +1,4 @@
1
+ import type { PrepareStepsInput } from './../../../types/legacy/catalog-workflow.js';
2
+ import type { PreparedSequence, PrepareSequenceInput } from '../../../types/legacy/sequence-workflow.js';
3
+ export declare function prepareSequence({ document, origin, profile, effectPolicy, credentialBindings, plan, }: PrepareSequenceInput): PreparedSequence;
4
+ export declare function prepareSteps({ profile, plan, resolveStep, }: PrepareStepsInput): PreparedSequence;
@@ -0,0 +1,103 @@
1
+ import { operationFromDocument } from '@openapi-flow/core/internal';
2
+ import { validateResponseField } from '@openapi-flow/core/internal';
3
+ import { isObject } from '@openapi-flow/core/internal';
4
+ import { approvedEffect, isSafeMethod } from './effect-policy.js';
5
+ import { looksLikeCredential, resolveCredentialBinding, } from './credential-binding.js';
6
+ import { makeBody } from './request-body.js';
7
+ import { makeHeaders } from './request-headers.js';
8
+ import { sequenceUrl } from './sequence-url.js';
9
+ export function prepareSequence({ document, origin, profile, effectPolicy, credentialBindings, plan, }) {
10
+ return prepareSteps({
11
+ profile,
12
+ plan,
13
+ resolveStep: (step) => ({
14
+ operation: operationFromDocument(document, step.operationRef),
15
+ origin,
16
+ effectPolicy,
17
+ credentialBindings,
18
+ }),
19
+ });
20
+ }
21
+ export function prepareSteps({ profile, plan, resolveStep, }) {
22
+ const previous = new Map();
23
+ const requiredOutputs = new Map();
24
+ const evidence = [];
25
+ const missingInputs = [];
26
+ const nodes = [];
27
+ let blocked = false;
28
+ for (const step of plan.steps) {
29
+ if (!isObject(step) ||
30
+ typeof step.id !== 'string' ||
31
+ !step.id.trim() ||
32
+ previous.has(step.id) ||
33
+ typeof step.operationRef !== 'string') {
34
+ throw new Error('plan.steps must have unique id and operationRef values');
35
+ }
36
+ const source = resolveStep(step);
37
+ const { operation, origin, effectPolicy, credentialBindings } = source;
38
+ const effect = approvedEffect(operation, effectPolicy);
39
+ const authentication = resolveCredentialBinding(operation, credentialBindings);
40
+ const inputs = step.inputs === undefined ? {} : step.inputs;
41
+ const expectedBody = step.expectedBody === undefined ? {} : step.expectedBody;
42
+ if (!isObject(inputs) || !isObject(expectedBody)) {
43
+ throw new Error('plan.steps[' + step.id + '] inputs and expectedBody must be objects');
44
+ }
45
+ for (const [key, value] of Object.entries(expectedBody)) {
46
+ if (looksLikeCredential(key)) {
47
+ throw new Error('plan.steps[' +
48
+ step.id +
49
+ '].expectedBody.' +
50
+ key +
51
+ ' looks like a credential');
52
+ }
53
+ validateResponseField(operation, key, value, 'plan.steps[' + step.id + '].expectedBody.' + key);
54
+ }
55
+ const allowed = new Set(operation.parameters.map((parameter) => parameter.in + '.' + parameter.name));
56
+ if (operation.body)
57
+ allowed.add('body');
58
+ for (const key of Object.keys(inputs)) {
59
+ if (!allowed.has(key))
60
+ throw new Error('plan.steps[' +
61
+ step.id +
62
+ '].inputs.' +
63
+ key +
64
+ ' is not declared in OAS');
65
+ if (looksLikeCredential(key)) {
66
+ throw new Error('plan.steps[' +
67
+ step.id +
68
+ '].inputs.' +
69
+ key +
70
+ ' looks like a credential');
71
+ }
72
+ }
73
+ const stepMissing = [];
74
+ const url = sequenceUrl(operation, origin, inputs, previous, requiredOutputs, stepMissing);
75
+ const body = makeBody(operation, inputs, stepMissing, step.requestMediaType);
76
+ const headers = makeHeaders(operation, inputs, stepMissing);
77
+ missingInputs.push(...stepMissing.map((key) => step.id + '.' + key));
78
+ if (effect === 'unknown' ||
79
+ (!isSafeMethod(operation.method) && effect !== 'write') ||
80
+ (profile === 'read-only' &&
81
+ (!isSafeMethod(operation.method) || effect !== 'read')))
82
+ blocked = true;
83
+ evidence.push({
84
+ stepId: step.id,
85
+ operationRef: operation.operationRef,
86
+ operationId: operation.operationId,
87
+ method: operation.method,
88
+ path: operation.path,
89
+ effect,
90
+ });
91
+ nodes.push({
92
+ operation,
93
+ id: step.id,
94
+ url,
95
+ body,
96
+ headers,
97
+ expectedBody: expectedBody,
98
+ authentication,
99
+ });
100
+ previous.set(step.id, operation);
101
+ }
102
+ return { evidence, missingInputs, nodes, requiredOutputs, blocked };
103
+ }
@@ -0,0 +1,4 @@
1
+ import type { Operation } from '@openapi-flow/core/internal';
2
+ import type { PreparedRequestBody } from '../../../types/legacy/request-node.js';
3
+ import type { InputValues } from '../../../types/legacy/request-workflow.js';
4
+ export declare function makeBody(operation: Operation, inputs: InputValues, missing: string[], requestMediaType?: string): PreparedRequestBody | undefined;
@@ -0,0 +1,64 @@
1
+ import { checkSchemaValue } from '@openapi-flow/core/internal';
2
+ import { UnsupportedOperationError } from '@openapi-flow/core/internal';
3
+ import { serializeFormBody } from '@openapi-flow/core/internal';
4
+ import { isObject } from '@openapi-flow/core/internal';
5
+ import { looksLikeCredential } from '../../../nodes/request/authentication/credential-field-name.js';
6
+ export function makeBody(operation, inputs, missing, requestMediaType) {
7
+ if (!operation.body) {
8
+ if (requestMediaType !== undefined)
9
+ throw new Error('plan.requestMediaType is not declared by the OAS operation');
10
+ return undefined;
11
+ }
12
+ if (requestMediaType !== undefined &&
13
+ !Object.hasOwn(operation.body.mediaTypes, requestMediaType)) {
14
+ throw new Error('plan.requestMediaType is not declared by the OAS operation');
15
+ }
16
+ const value = inputs.body;
17
+ if (value === undefined) {
18
+ if (operation.body.required)
19
+ missing.push('body');
20
+ return undefined;
21
+ }
22
+ const declared = Object.keys(operation.body.mediaTypes);
23
+ const mediaType = requestMediaType ?? (declared.length === 1 ? declared[0] : undefined);
24
+ if (mediaType === undefined) {
25
+ missing.push('requestMediaType');
26
+ return undefined;
27
+ }
28
+ const media = operation.body.mediaTypes[mediaType];
29
+ if (mediaType !== 'application/json' &&
30
+ mediaType !== 'application/x-www-form-urlencoded') {
31
+ throw new UnsupportedOperationError(operation.operationRef, `operationRef ${operation.operationRef}.requestBody media type ${mediaType} has no n8n mapping`);
32
+ }
33
+ if (isObject(value)) {
34
+ for (const name of Object.keys(value)) {
35
+ if (looksLikeCredential(name)) {
36
+ throw new Error('plan.inputs.body.' +
37
+ name +
38
+ ' looks like a credential; bind an existing n8n credential through credentialBindings instead');
39
+ }
40
+ }
41
+ if (typeof media.schema === 'object' &&
42
+ Array.isArray(media.schema.required)) {
43
+ for (const name of media.schema.required) {
44
+ if (typeof name === 'string' && !Object.hasOwn(value, name)) {
45
+ missing.push('body.' + name);
46
+ }
47
+ }
48
+ }
49
+ }
50
+ if (missing.some((key) => key.startsWith('body.')))
51
+ return undefined;
52
+ if (media.schema !== undefined)
53
+ checkSchemaValue(value, media.schema, 'plan.inputs.body');
54
+ if (mediaType === 'application/json') {
55
+ return { contentType: 'json', value: JSON.stringify(value) };
56
+ }
57
+ if (!isObject(value)) {
58
+ throw new Error('plan.inputs.body must be an object for application/x-www-form-urlencoded');
59
+ }
60
+ return {
61
+ contentType: 'form-urlencoded',
62
+ value: serializeFormBody(operation.operationRef, media, value),
63
+ };
64
+ }
@@ -0,0 +1,4 @@
1
+ import type { Operation } from '@openapi-flow/core/internal';
2
+ import type { RequestHeader } from '../../../types/legacy/request-node.js';
3
+ import type { InputValues } from '../../../types/legacy/request-workflow.js';
4
+ export declare function makeHeaders(operation: Operation, inputs: InputValues, missing: string[]): RequestHeader[];
@@ -0,0 +1,30 @@
1
+ import { checkSchemaValue } from '@openapi-flow/core/internal';
2
+ import { serializeCookieParameter, serializeHeaderParameter, } from '@openapi-flow/core/internal';
3
+ export function makeHeaders(operation, inputs, missing) {
4
+ const headers = [];
5
+ const cookies = [];
6
+ for (const parameter of operation.parameters) {
7
+ if (parameter.in !== 'header' && parameter.in !== 'cookie')
8
+ continue;
9
+ const key = parameter.in + '.' + parameter.name;
10
+ const value = inputs[key];
11
+ if (value === undefined) {
12
+ if (parameter.required)
13
+ missing.push(key);
14
+ continue;
15
+ }
16
+ checkSchemaValue(value, parameter.schema, 'plan.inputs.' + key);
17
+ if (parameter.in === 'header') {
18
+ headers.push({
19
+ name: parameter.name,
20
+ value: serializeHeaderParameter(parameter, operation.operationRef, value),
21
+ });
22
+ }
23
+ else {
24
+ cookies.push(...serializeCookieParameter(parameter, operation.operationRef, value));
25
+ }
26
+ }
27
+ if (cookies.length)
28
+ headers.push({ name: 'Cookie', value: cookies.join('; ') });
29
+ return headers;
30
+ }
@@ -0,0 +1,4 @@
1
+ import type { Operation } from '@openapi-flow/core/internal';
2
+ import type { InputValues } from '../../../types/legacy/request-workflow.js';
3
+ export declare function absoluteOperationPath(baseUrl: URL, path: string): string;
4
+ export declare function makeUrl(operation: Operation, origin: URL, inputs: InputValues, missing: string[]): string;