@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.
- package/LICENSE +21 -0
- package/README.md +129 -2
- package/THIRD_PARTY_NOTICES.md +9 -0
- package/dist/legacy/workflow/common/plan-validation.d.ts +1 -0
- package/dist/legacy/workflow/common/plan-validation.js +11 -0
- package/dist/legacy/workflow/common/workflow-id.d.ts +1 -0
- package/dist/legacy/workflow/common/workflow-id.js +8 -0
- package/dist/legacy/workflow/inbound/build-inbound-workflow.d.ts +2 -0
- package/dist/legacy/workflow/inbound/build-inbound-workflow.js +60 -0
- package/dist/legacy/workflow/inbound/compile-inbound-workflow.d.ts +2 -0
- package/dist/legacy/workflow/inbound/compile-inbound-workflow.js +25 -0
- package/dist/legacy/workflow/inbound/inbound-response.d.ts +2 -0
- package/dist/legacy/workflow/inbound/inbound-response.js +51 -0
- package/dist/legacy/workflow/request/base-url.d.ts +1 -0
- package/dist/legacy/workflow/request/base-url.js +14 -0
- package/dist/legacy/workflow/request/build-request-workflow.d.ts +3 -0
- package/dist/legacy/workflow/request/build-request-workflow.js +47 -0
- package/dist/legacy/workflow/request/build-sequence-workflow.d.ts +3 -0
- package/dist/legacy/workflow/request/build-sequence-workflow.js +53 -0
- package/dist/legacy/workflow/request/compile-catalog-sequence.d.ts +2 -0
- package/dist/legacy/workflow/request/compile-catalog-sequence.js +122 -0
- package/dist/legacy/workflow/request/compile-sequence.d.ts +2 -0
- package/dist/legacy/workflow/request/compile-sequence.js +41 -0
- package/dist/legacy/workflow/request/compile-workflow.d.ts +4 -0
- package/dist/legacy/workflow/request/compile-workflow.js +93 -0
- package/dist/legacy/workflow/request/credential-binding.d.ts +5 -0
- package/dist/legacy/workflow/request/credential-binding.js +31 -0
- package/dist/legacy/workflow/request/effect-policy.d.ts +4 -0
- package/dist/legacy/workflow/request/effect-policy.js +16 -0
- package/dist/legacy/workflow/request/http-request-node.d.ts +2 -0
- package/dist/legacy/workflow/request/http-request-node.js +69 -0
- package/dist/legacy/workflow/request/prepare-sequence.d.ts +4 -0
- package/dist/legacy/workflow/request/prepare-sequence.js +103 -0
- package/dist/legacy/workflow/request/request-body.d.ts +4 -0
- package/dist/legacy/workflow/request/request-body.js +64 -0
- package/dist/legacy/workflow/request/request-headers.d.ts +4 -0
- package/dist/legacy/workflow/request/request-headers.js +30 -0
- package/dist/legacy/workflow/request/request-url.d.ts +4 -0
- package/dist/legacy/workflow/request/request-url.js +34 -0
- package/dist/legacy/workflow/request/response-assertion-code.d.ts +3 -0
- package/dist/legacy/workflow/request/response-assertion-code.js +28 -0
- package/dist/legacy/workflow/request/sequence-url.d.ts +4 -0
- package/dist/legacy/workflow/request/sequence-url.js +104 -0
- package/dist/legacy-api.d.ts +25 -0
- package/dist/legacy-api.js +20 -0
- package/dist/nodes/common/validation/compile-standalone-validator.d.ts +3 -0
- package/dist/nodes/common/validation/compile-standalone-validator.js +44 -0
- package/dist/nodes/gap/create-gap-node.d.ts +3 -0
- package/dist/nodes/gap/create-gap-node.js +35 -0
- package/dist/nodes/inputs/compile-template-input-validators.d.ts +3 -0
- package/dist/nodes/inputs/compile-template-input-validators.js +26 -0
- package/dist/nodes/inputs/create-template-input-nodes.d.ts +4 -0
- package/dist/nodes/inputs/create-template-input-nodes.js +61 -0
- package/dist/nodes/native/arrays/create-array-node-fragment.d.ts +4 -0
- package/dist/nodes/native/arrays/create-array-node-fragment.js +42 -0
- package/dist/nodes/native/arrays/create-array-reader-code.d.ts +3 -0
- package/dist/nodes/native/arrays/create-array-reader-code.js +12 -0
- package/dist/nodes/native/arrays/create-bound-native-array-capability.d.ts +4 -0
- package/dist/nodes/native/arrays/create-bound-native-array-capability.js +81 -0
- package/dist/nodes/native/arrays/create-native-array-capability.d.ts +4 -0
- package/dist/nodes/native/arrays/create-native-array-capability.js +12 -0
- package/dist/nodes/native/arrays/native-array-definition.d.ts +2 -0
- package/dist/nodes/native/arrays/native-array-definition.js +27 -0
- package/dist/nodes/native/common/create-material-planning-capability.d.ts +4 -0
- package/dist/nodes/native/common/create-material-planning-capability.js +14 -0
- package/dist/nodes/native/common/create-native-fragment.d.ts +2 -0
- package/dist/nodes/native/common/create-native-fragment.js +10 -0
- package/dist/nodes/native/common/define-material-bound-capability.d.ts +4 -0
- package/dist/nodes/native/common/define-material-bound-capability.js +33 -0
- package/dist/nodes/native/common/resolve-native-runtime-source.d.ts +3 -0
- package/dist/nodes/native/common/resolve-native-runtime-source.js +15 -0
- package/dist/nodes/native/common/response-reference-bindings.d.ts +4 -0
- package/dist/nodes/native/common/response-reference-bindings.js +15 -0
- package/dist/nodes/native/common/response-references.d.ts +3 -0
- package/dist/nodes/native/common/response-references.js +5 -0
- package/dist/nodes/native/create-exclusive-branch-merge-capability.d.ts +3 -0
- package/dist/nodes/native/create-exclusive-branch-merge-capability.js +43 -0
- package/dist/nodes/native/create-json-output-capability.d.ts +3 -0
- package/dist/nodes/native/create-json-output-capability.js +48 -0
- package/dist/nodes/native/create-native-capabilities.d.ts +2 -0
- package/dist/nodes/native/create-native-capabilities.js +15 -0
- package/dist/nodes/native/create-pass-through-capability.d.ts +3 -0
- package/dist/nodes/native/create-pass-through-capability.js +32 -0
- package/dist/nodes/native/create-response-array-capability.d.ts +3 -0
- package/dist/nodes/native/create-response-array-capability.js +78 -0
- package/dist/nodes/native/create-response-collection-capability.d.ts +3 -0
- package/dist/nodes/native/create-response-collection-capability.js +134 -0
- package/dist/nodes/native/if-capability.d.ts +2 -0
- package/dist/nodes/native/if-capability.js +80 -0
- package/dist/nodes/native/inputs/native-input-runtime.bundle.js +24 -0
- package/dist/nodes/native/inputs/prepend-native-parameter-guard.d.ts +4 -0
- package/dist/nodes/native/inputs/prepend-native-parameter-guard.js +52 -0
- package/dist/nodes/native/item-join/create-bound-item-join-capability.d.ts +3 -0
- package/dist/nodes/native/item-join/create-bound-item-join-capability.js +169 -0
- package/dist/nodes/native/item-join/create-item-join-capability.d.ts +4 -0
- package/dist/nodes/native/item-join/create-item-join-capability.js +10 -0
- package/dist/nodes/native/item-join/create-item-join-reader-code.d.ts +2 -0
- package/dist/nodes/native/item-join/create-item-join-reader-code.js +18 -0
- package/dist/nodes/native/item-join/item-join-definition.d.ts +2 -0
- package/dist/nodes/native/item-join/item-join-definition.js +33 -0
- package/dist/nodes/native/item-join/runtime/item-join-runtime.bundle.js +24 -0
- package/dist/nodes/native/item-join/runtime/join-api-items.d.ts +3 -0
- package/dist/nodes/native/item-join/runtime/join-api-items.js +37 -0
- package/dist/nodes/native/merge-append-capability.d.ts +2 -0
- package/dist/nodes/native/merge-append-capability.js +33 -0
- package/dist/nodes/native/registry/native-feature-definitions.d.ts +4 -0
- package/dist/nodes/native/registry/native-feature-definitions.js +93 -0
- package/dist/nodes/native/registry/native-feature-material-requirements.d.ts +3 -0
- package/dist/nodes/native/registry/native-feature-material-requirements.js +10 -0
- package/dist/nodes/native/registry/resolve-n8n-native-features.d.ts +3 -0
- package/dist/nodes/native/registry/resolve-n8n-native-features.js +6 -0
- package/dist/nodes/native/registry/resolve-n8n-native-planning-features.d.ts +3 -0
- package/dist/nodes/native/registry/resolve-n8n-native-planning-features.js +5 -0
- package/dist/nodes/native/registry/resolve-native-feature-registry.d.ts +3 -0
- package/dist/nodes/native/registry/resolve-native-feature-registry.js +99 -0
- package/dist/nodes/native/registry/validate-native-feature-context.d.ts +2 -0
- package/dist/nodes/native/registry/validate-native-feature-context.js +46 -0
- package/dist/nodes/native/response-array-definition.d.ts +2 -0
- package/dist/nodes/native/response-array-definition.js +27 -0
- package/dist/nodes/native/response-assertion-capability.d.ts +2 -0
- package/dist/nodes/native/response-assertion-capability.js +57 -0
- package/dist/nodes/native/response-check-code.d.ts +3 -0
- package/dist/nodes/native/response-check-code.js +65 -0
- package/dist/nodes/native/response-checks/create-response-check-guard.d.ts +4 -0
- package/dist/nodes/native/response-checks/create-response-check-guard.js +22 -0
- package/dist/nodes/native/response-checks/create-response-check-reader.d.ts +3 -0
- package/dist/nodes/native/response-checks/create-response-check-reader.js +23 -0
- package/dist/nodes/native/response-collection-definition.d.ts +2 -0
- package/dist/nodes/native/response-collection-definition.js +27 -0
- package/dist/nodes/native/stop-and-error-capability.d.ts +2 -0
- package/dist/nodes/native/stop-and-error-capability.js +43 -0
- package/dist/nodes/request/authentication/credential-field-name.d.ts +1 -0
- package/dist/nodes/request/authentication/credential-field-name.js +3 -0
- package/dist/nodes/request/authentication/resolve-http-request-authentication.d.ts +2 -0
- package/dist/nodes/request/authentication/resolve-http-request-authentication.js +42 -0
- package/dist/nodes/request/bindings/compile-native-output-validators.d.ts +3 -0
- package/dist/nodes/request/bindings/compile-native-output-validators.js +12 -0
- package/dist/nodes/request/bindings/compile-request-validator.d.ts +3 -0
- package/dist/nodes/request/bindings/compile-request-validator.js +13 -0
- package/dist/nodes/request/bindings/compile-source-response-validators.d.ts +2 -0
- package/dist/nodes/request/bindings/compile-source-response-validators.js +12 -0
- package/dist/nodes/request/bindings/create-bound-request-fragment.d.ts +3 -0
- package/dist/nodes/request/bindings/create-bound-request-fragment.js +82 -0
- package/dist/nodes/request/bindings/create-output-item-reader-code.d.ts +2 -0
- package/dist/nodes/request/bindings/create-output-item-reader-code.js +7 -0
- package/dist/nodes/request/bindings/create-output-reader-code.d.ts +3 -0
- package/dist/nodes/request/bindings/create-output-reader-code.js +26 -0
- package/dist/nodes/request/bindings/resolve-output-binding-sources.d.ts +3 -0
- package/dist/nodes/request/bindings/resolve-output-binding-sources.js +36 -0
- package/dist/nodes/request/create-http-request-node.d.ts +2 -0
- package/dist/nodes/request/create-http-request-node.js +73 -0
- package/dist/nodes/request/deployment/create-request-deployment-notes.d.ts +2 -0
- package/dist/nodes/request/deployment/create-request-deployment-notes.js +3 -0
- package/dist/nodes/request/deployment/resolve-http-request-deployment.d.ts +2 -0
- package/dist/nodes/request/deployment/resolve-http-request-deployment.js +33 -0
- package/dist/nodes/request/finalize-http-request-fragment.d.ts +3 -0
- package/dist/nodes/request/finalize-http-request-fragment.js +22 -0
- package/dist/nodes/request/resolve-http-request-node-configuration.d.ts +4 -0
- package/dist/nodes/request/resolve-http-request-node-configuration.js +41 -0
- package/dist/nodes/request/response/create-http-response-decoder.d.ts +4 -0
- package/dist/nodes/request/response/create-http-response-decoder.js +57 -0
- package/dist/nodes/request/response/decode-http-response.d.ts +3 -0
- package/dist/nodes/request/response/decode-http-response.js +42 -0
- package/dist/nodes/request/response/http-response-media.d.ts +2 -0
- package/dist/nodes/request/response/http-response-media.js +32 -0
- package/dist/nodes/request/response/http-response-node-name.d.ts +2 -0
- package/dist/nodes/request/response/http-response-node-name.js +4 -0
- package/dist/nodes/request/response/response-runtime.bundle.js +24 -0
- package/dist/nodes/request/runtime/materialize-http-request.d.ts +4 -0
- package/dist/nodes/request/runtime/materialize-http-request.js +35 -0
- package/dist/nodes/request/runtime/request-runtime.bundle.js +24 -0
- package/dist/nodes/request/serialization/create-serialized-http-request-node.d.ts +3 -0
- package/dist/nodes/request/serialization/create-serialized-http-request-node.js +17 -0
- package/dist/nodes/request/serialization/serialize-http-request.d.ts +5 -0
- package/dist/nodes/request/serialization/serialize-http-request.js +70 -0
- package/dist/public-api.d.ts +43 -0
- package/dist/public-api.js +26 -0
- package/dist/schemas/batch-execution-schema.d.ts +15 -0
- package/dist/schemas/batch-execution-schema.js +14 -0
- package/dist/schemas/create-native-comparison-planning-schema.d.ts +81 -0
- package/dist/schemas/create-native-comparison-planning-schema.js +36 -0
- package/dist/schemas/exclusive-branch-merge-schema.d.ts +4 -0
- package/dist/schemas/exclusive-branch-merge-schema.js +7 -0
- package/dist/schemas/item-join-schema.d.ts +13 -0
- package/dist/schemas/item-join-schema.js +26 -0
- package/dist/schemas/native-array-schema.d.ts +11 -0
- package/dist/schemas/native-array-schema.js +19 -0
- package/dist/schemas/native-capability-schemas.d.ts +100 -0
- package/dist/schemas/native-capability-schemas.js +62 -0
- package/dist/schemas/native-feature-registry-schema.d.ts +17 -0
- package/dist/schemas/native-feature-registry-schema.js +8 -0
- package/dist/schemas/native-runtime-input-schema.d.ts +5 -0
- package/dist/schemas/native-runtime-input-schema.js +5 -0
- package/dist/schemas/request-deployment-schema.d.ts +9 -0
- package/dist/schemas/request-deployment-schema.js +27 -0
- package/dist/schemas/response-array-schema.d.ts +11 -0
- package/dist/schemas/response-array-schema.js +19 -0
- package/dist/schemas/response-collection-schema.d.ts +11 -0
- package/dist/schemas/response-collection-schema.js +19 -0
- package/dist/schemas/template-deployment-selection-schema.d.ts +3 -0
- package/dist/schemas/template-deployment-selection-schema.js +10 -0
- package/dist/schemas/workflow-input-value-map-schema.d.ts +5 -0
- package/dist/schemas/workflow-input-value-map-schema.js +5 -0
- package/dist/schemas/workflow-template-schema.d.ts +11 -0
- package/dist/schemas/workflow-template-schema.js +10 -0
- package/dist/types/array-iteration.d.ts +8 -0
- package/dist/types/array-iteration.js +1 -0
- package/dist/types/array-split.d.ts +13 -0
- package/dist/types/array-split.js +1 -0
- package/dist/types/authentication.d.ts +14 -0
- package/dist/types/authentication.js +1 -0
- package/dist/types/batch-execution.d.ts +23 -0
- package/dist/types/batch-execution.js +1 -0
- package/dist/types/http-response-decoding.d.ts +16 -0
- package/dist/types/http-response-decoding.js +1 -0
- package/dist/types/item-join.d.ts +40 -0
- package/dist/types/item-join.js +1 -0
- package/dist/types/legacy/catalog-workflow.d.ts +37 -0
- package/dist/types/legacy/catalog-workflow.js +1 -0
- package/dist/types/legacy/inbound-workflow.d.ts +27 -0
- package/dist/types/legacy/inbound-workflow.js +1 -0
- package/dist/types/legacy/request-node.d.ts +23 -0
- package/dist/types/legacy/request-node.js +1 -0
- package/dist/types/legacy/request-workflow.d.ts +43 -0
- package/dist/types/legacy/request-workflow.js +1 -0
- package/dist/types/legacy/sequence-workflow.d.ts +57 -0
- package/dist/types/legacy/sequence-workflow.js +1 -0
- package/dist/types/native-array.d.ts +8 -0
- package/dist/types/native-array.js +1 -0
- package/dist/types/native-capability.d.ts +46 -0
- package/dist/types/native-capability.js +1 -0
- package/dist/types/native-feature-registry.d.ts +70 -0
- package/dist/types/native-feature-registry.js +14 -0
- package/dist/types/native-material-binding.d.ts +56 -0
- package/dist/types/native-material-binding.js +1 -0
- package/dist/types/native-runtime-parameters.d.ts +55 -0
- package/dist/types/native-runtime-parameters.js +1 -0
- package/dist/types/node-fragment.d.ts +51 -0
- package/dist/types/node-fragment.js +1 -0
- package/dist/types/output-binding-source.d.ts +27 -0
- package/dist/types/output-binding-source.js +1 -0
- package/dist/types/request-deployment.d.ts +17 -0
- package/dist/types/request-deployment.js +1 -0
- package/dist/types/request-materialization.d.ts +30 -0
- package/dist/types/request-materialization.js +1 -0
- package/dist/types/request-node-configuration.d.ts +13 -0
- package/dist/types/request-node-configuration.js +1 -0
- package/dist/types/response-check-compilation.d.ts +11 -0
- package/dist/types/response-check-compilation.js +1 -0
- package/dist/types/response-check-guard.d.ts +6 -0
- package/dist/types/response-check-guard.js +1 -0
- package/dist/types/response-collection.d.ts +7 -0
- package/dist/types/response-collection.js +1 -0
- package/dist/types/reviewable-workflow.d.ts +29 -0
- package/dist/types/reviewable-workflow.js +1 -0
- package/dist/types/schema-compilation.d.ts +5 -0
- package/dist/types/schema-compilation.js +1 -0
- package/dist/types/serialized-http-request.d.ts +4 -0
- package/dist/types/serialized-http-request.js +1 -0
- package/dist/types/workflow-compilation.d.ts +39 -0
- package/dist/types/workflow-compilation.js +1 -0
- package/dist/types/workflow-template.d.ts +121 -0
- package/dist/types/workflow-template.js +1 -0
- package/dist/utils/bundled-license-banner.d.ts +3 -0
- package/dist/utils/bundled-license-banner.js +32 -0
- package/dist/utils/javascript-json-literal.d.ts +2 -0
- package/dist/utils/javascript-json-literal.js +10 -0
- package/dist/utils/json-values-equal.cjs +24 -0
- package/dist/utils/json-values-equal.d.cts +1 -0
- package/dist/workflow/assemble-n8n-workflow.d.ts +2 -0
- package/dist/workflow/assemble-n8n-workflow.js +11 -0
- package/dist/workflow/batch/compile-batched-n8n-workflow.d.ts +3 -0
- package/dist/workflow/batch/compile-batched-n8n-workflow.js +36 -0
- package/dist/workflow/batch/create-batch-execution-scopes.d.ts +3 -0
- package/dist/workflow/batch/create-batch-execution-scopes.js +59 -0
- package/dist/workflow/batch/validate-batch-exclusive-rejoin.d.ts +3 -0
- package/dist/workflow/batch/validate-batch-exclusive-rejoin.js +49 -0
- package/dist/workflow/batch/validate-batch-item-flow.d.ts +3 -0
- package/dist/workflow/batch/validate-batch-item-flow.js +98 -0
- package/dist/workflow/build-n8n-workflow.d.ts +2 -0
- package/dist/workflow/build-n8n-workflow.js +140 -0
- package/dist/workflow/compile-native-material-fragments.d.ts +3 -0
- package/dist/workflow/compile-native-material-fragments.js +76 -0
- package/dist/workflow/compile-native-workflow-nodes.d.ts +3 -0
- package/dist/workflow/compile-native-workflow-nodes.js +25 -0
- package/dist/workflow/compile-planned-n8n-workflow.d.ts +3 -0
- package/dist/workflow/compile-planned-n8n-workflow.js +42 -0
- package/dist/workflow/compile-reviewable-n8n-workflow.d.ts +3 -0
- package/dist/workflow/compile-reviewable-n8n-workflow.js +92 -0
- package/dist/workflow/compile-validated-workflow-fragments.d.ts +3 -0
- package/dist/workflow/compile-validated-workflow-fragments.js +20 -0
- package/dist/workflow/compile-workflow-material-fragments.d.ts +4 -0
- package/dist/workflow/compile-workflow-material-fragments.js +18 -0
- package/dist/workflow/create-n8n-native-output-sources.d.ts +3 -0
- package/dist/workflow/create-n8n-native-output-sources.js +58 -0
- package/dist/workflow/entrypoint/manual-trigger.d.ts +4 -0
- package/dist/workflow/entrypoint/manual-trigger.js +16 -0
- package/dist/workflow/find-singleton-api-responses.d.ts +3 -0
- package/dist/workflow/find-singleton-api-responses.js +22 -0
- package/dist/workflow/inputs/compile-native-runtime-inputs.d.ts +5 -0
- package/dist/workflow/inputs/compile-native-runtime-inputs.js +129 -0
- package/dist/workflow/inputs/create-runtime-input-native-capabilities.d.ts +4 -0
- package/dist/workflow/inputs/create-runtime-input-native-capabilities.js +36 -0
- package/dist/workflow/resolve-n8n-native-materials.d.ts +2 -0
- package/dist/workflow/resolve-n8n-native-materials.js +16 -0
- package/dist/workflow/review/create-gap-review-content.d.ts +2 -0
- package/dist/workflow/review/create-gap-review-content.js +28 -0
- package/dist/workflow/review/create-gap-review-region.d.ts +2 -0
- package/dist/workflow/review/create-gap-review-region.js +23 -0
- package/dist/workflow/review/escape-review-markdown.d.ts +1 -0
- package/dist/workflow/review/escape-review-markdown.js +7 -0
- package/dist/workflow/review/gap-review-region-layout.d.ts +4 -0
- package/dist/workflow/review/gap-review-region-layout.js +21 -0
- package/dist/workflow/templates/compile-n8n-workflow-template.d.ts +3 -0
- package/dist/workflow/templates/compile-n8n-workflow-template.js +211 -0
- package/dist/workflow/templates/create-template-artifact-mapping.d.ts +2 -0
- package/dist/workflow/templates/create-template-artifact-mapping.js +58 -0
- package/dist/workflow/templates/create-template-gap-regions.d.ts +5 -0
- package/dist/workflow/templates/create-template-gap-regions.js +22 -0
- package/dist/workflow/templates/create-workflow-template-guide.d.ts +3 -0
- package/dist/workflow/templates/create-workflow-template-guide.js +44 -0
- package/dist/workflow/templates/prepare-template-api-fragments.d.ts +3 -0
- package/dist/workflow/templates/prepare-template-api-fragments.js +74 -0
- package/dist/workflow/templates/select-n8n-template-deployments.d.ts +3 -0
- package/dist/workflow/templates/select-n8n-template-deployments.js +12 -0
- package/dist/workflow/templates/workflow-template-identities.d.ts +5 -0
- package/dist/workflow/templates/workflow-template-identities.js +5 -0
- package/dist/workflow/validate-compiled-binding-sources.d.ts +4 -0
- package/dist/workflow/validate-compiled-binding-sources.js +40 -0
- package/dist/workflow/validate-node-fragments.d.ts +3 -0
- package/dist/workflow/validate-node-fragments.js +58 -0
- package/package.json +59 -4
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { node } from '@n8n/workflow-sdk';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
4
|
+
import { createNativeRuntimeParameterMaterializations } from '@openapi-flow/core';
|
|
5
|
+
import { compileStandaloneValidator } from '../../common/validation/compile-standalone-validator.js';
|
|
6
|
+
import { javascriptJsonLiteral } from '../../../utils/javascript-json-literal.js';
|
|
7
|
+
/** Validate the unchanged declared parameter object again immediately before the native node. */
|
|
8
|
+
export function prependNativeParameterGuard({ input, capability, fragment, }) {
|
|
9
|
+
const configuration = input.runtimeInput;
|
|
10
|
+
if (!configuration ||
|
|
11
|
+
typeof configuration.inputNodeName !== 'string' ||
|
|
12
|
+
!configuration.inputNodeName.trim() ||
|
|
13
|
+
!Number.isSafeInteger(configuration.revision) ||
|
|
14
|
+
configuration.revision < 0)
|
|
15
|
+
throw new Error(`node ${input.planned.id}: runtime parameters require an explicit template input source and revision`);
|
|
16
|
+
const [materialization] = createNativeRuntimeParameterMaterializations({
|
|
17
|
+
nativeNodes: [input.planned],
|
|
18
|
+
capabilities: [capability],
|
|
19
|
+
});
|
|
20
|
+
if (!materialization ||
|
|
21
|
+
!isDeepStrictEqual(materialization, configuration.materialization))
|
|
22
|
+
throw new Error(`node ${input.planned.id}: runtime parameter slot differs from its original capability contract`);
|
|
23
|
+
const validator = compileStandaloneValidator({
|
|
24
|
+
schema: materialization.schema,
|
|
25
|
+
globalName: 'OpenApiFlowNativeParametersValidator',
|
|
26
|
+
});
|
|
27
|
+
const runtime = readFileSync(new URL('./native-input-runtime.bundle.js', import.meta.url), 'utf8');
|
|
28
|
+
const read = `const configurations=$(${javascriptJsonLiteral(configuration.inputNodeName)}).all();if(configurations.length!==1)throw new Error('Native runtime input requires exactly one configuration item');const payload=configurations[0].json;if(!payload||payload.revision!==${configuration.revision})throw new Error('Missing or stale native input revision');if(!payload.values||typeof payload.values!=='object')throw new Error('Missing native runtime input values');const parameters=OpenApiFlowNativeInputRuntime.materializeNativeRuntimeParameters(${javascriptJsonLiteral(materialization)},payload.values);if(!OpenApiFlowNativeParametersValidator(parameters))throw new Error('Native runtime input violates original schema for '+${javascriptJsonLiteral(materialization.nodeId)}+': '+JSON.stringify(OpenApiFlowNativeParametersValidator.errors));`;
|
|
29
|
+
const guard = node({
|
|
30
|
+
type: 'n8n-nodes-base.code',
|
|
31
|
+
version: 2,
|
|
32
|
+
config: {
|
|
33
|
+
id: `${input.planned.id}-parameters`,
|
|
34
|
+
name: `Parameters ${input.planned.id}`,
|
|
35
|
+
position: [input.position[0] - 220, input.position[1]],
|
|
36
|
+
parameters: {
|
|
37
|
+
mode: 'runOnceForAllItems',
|
|
38
|
+
language: 'javaScript',
|
|
39
|
+
jsCode: `${runtime}\n${validator}\n${read}\nreturn $input.all().map((_,index)=>({json:parameters,pairedItem:{item:index}}));`,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
...fragment,
|
|
45
|
+
entry: guard,
|
|
46
|
+
nodes: [guard, ...fragment.nodes],
|
|
47
|
+
internalEdges: [
|
|
48
|
+
{ from: guard.id, output: 0, to: fragment.entry.id, input: 0 },
|
|
49
|
+
...(fragment.internalEdges === undefined ? [] : fragment.internalEdges),
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { N8nNativeCapability } from '../../../types/native-capability.js';
|
|
2
|
+
import type { BoundItemJoinCapabilityInput } from '../../../types/native-material-binding.js';
|
|
3
|
+
export declare function createBoundItemJoinCapability({ materials, scopes, runtime: sourceBinding, }: BoundItemJoinCapabilityInput): N8nNativeCapability;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { defineMaterialBoundCapability } from '../common/define-material-bound-capability.js';
|
|
2
|
+
import { node } from '@n8n/workflow-sdk';
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import { createResponseValueSchema, validateNativeOutputContracts, } from '@openapi-flow/core';
|
|
5
|
+
import { resolveNativeRuntimeSource } from '../common/resolve-native-runtime-source.js';
|
|
6
|
+
import { createItemJoinParametersSchema } from '../../../schemas/item-join-schema.js';
|
|
7
|
+
import { itemJoinDefinition } from './item-join-definition.js';
|
|
8
|
+
import { javascriptJsonLiteral } from '../../../utils/javascript-json-literal.js';
|
|
9
|
+
import { createItemJoinReaderCode } from './create-item-join-reader-code.js';
|
|
10
|
+
export function createBoundItemJoinCapability({ materials, scopes, runtime: sourceBinding, }) {
|
|
11
|
+
const apis = new Map(materials.map((material) => [material.callId, material]));
|
|
12
|
+
validateNativeOutputContracts(scopes);
|
|
13
|
+
const scopeContracts = scopes.map(({ nodeId, schema }) => ({
|
|
14
|
+
nodeId,
|
|
15
|
+
schema,
|
|
16
|
+
}));
|
|
17
|
+
const scopeById = new Map(scopeContracts.map((scope) => [scope.nodeId, scope]));
|
|
18
|
+
if (apis.size !== materials.length ||
|
|
19
|
+
materials.some((material) => !material.callId.trim()))
|
|
20
|
+
throw new Error('item join materials require unique non-empty callIds');
|
|
21
|
+
if (scopeById.size !== scopes.length ||
|
|
22
|
+
scopes.some((scope) => !scope.nodeId.trim()))
|
|
23
|
+
throw new Error('item join scopes require unique non-empty contract identities');
|
|
24
|
+
const parametersSchema = createItemJoinParametersSchema([...scopeById.keys()], [...apis.keys()]);
|
|
25
|
+
return defineMaterialBoundCapability({
|
|
26
|
+
...itemJoinDefinition,
|
|
27
|
+
parametersSchema,
|
|
28
|
+
materialSources: {
|
|
29
|
+
apiMaterials: structuredClone(materials),
|
|
30
|
+
nativeOutputs: structuredClone(scopeContracts),
|
|
31
|
+
},
|
|
32
|
+
bindMaterialContracts: (sources) => createBoundItemJoinCapability({
|
|
33
|
+
materials: sources.apiMaterials,
|
|
34
|
+
scopes: sources.nativeOutputs,
|
|
35
|
+
runtime: { kind: 'compiled' },
|
|
36
|
+
}),
|
|
37
|
+
responseReferences: (values) => parametersSchema.parse(values).sourceCallIds.map((nodeId) => ({
|
|
38
|
+
source: 'response',
|
|
39
|
+
nodeId,
|
|
40
|
+
pointer: '',
|
|
41
|
+
})),
|
|
42
|
+
nodeOutputReferences: (values) => [
|
|
43
|
+
{
|
|
44
|
+
source: 'node-output',
|
|
45
|
+
nodeId: parametersSchema.parse(values).scopeNodeId,
|
|
46
|
+
pointer: '',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
inputReferences: (values) => {
|
|
50
|
+
const parameters = parametersSchema.parse(values);
|
|
51
|
+
return Object.fromEntries(parameters.sourceCallIds.map((nodeId, i) => [
|
|
52
|
+
`input${i + 1}`,
|
|
53
|
+
[
|
|
54
|
+
{ source: 'response', nodeId, pointer: '' },
|
|
55
|
+
{
|
|
56
|
+
source: 'node-output',
|
|
57
|
+
nodeId: parameters.scopeNodeId,
|
|
58
|
+
pointer: '',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
]));
|
|
62
|
+
},
|
|
63
|
+
outputSchema: (values) => {
|
|
64
|
+
const parameters = parametersSchema.parse(values);
|
|
65
|
+
return {
|
|
66
|
+
type: 'object',
|
|
67
|
+
required: ['responses'],
|
|
68
|
+
additionalProperties: false,
|
|
69
|
+
properties: {
|
|
70
|
+
responses: {
|
|
71
|
+
type: 'object',
|
|
72
|
+
additionalProperties: false,
|
|
73
|
+
required: parameters.sourceCallIds,
|
|
74
|
+
properties: Object.fromEntries(parameters.sourceCallIds.map((id) => [
|
|
75
|
+
id,
|
|
76
|
+
createResponseValueSchema(apis.get(id).operation, ''),
|
|
77
|
+
])),
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
compile: ({ planned, position, apiNodeNames, nativeOutputSources }) => {
|
|
83
|
+
const parameters = parametersSchema.parse(planned.parameters);
|
|
84
|
+
const scope = resolveNativeRuntimeSource({
|
|
85
|
+
binding: sourceBinding,
|
|
86
|
+
contract: scopeById.get(parameters.scopeNodeId),
|
|
87
|
+
compiledSources: nativeOutputSources,
|
|
88
|
+
consumerId: planned.id,
|
|
89
|
+
});
|
|
90
|
+
const bindingSources = [
|
|
91
|
+
{ ...scope, kind: 'native-json' },
|
|
92
|
+
...parameters.sourceCallIds.map((id) => {
|
|
93
|
+
if (!Object.hasOwn(apiNodeNames, id) || !apiNodeNames[id].trim())
|
|
94
|
+
throw new Error(`item join apiNodeNames is missing ${id}`);
|
|
95
|
+
return {
|
|
96
|
+
kind: 'api-response',
|
|
97
|
+
nodeId: id,
|
|
98
|
+
nodeName: apiNodeNames[id],
|
|
99
|
+
operation: apis.get(id).operation,
|
|
100
|
+
};
|
|
101
|
+
}),
|
|
102
|
+
];
|
|
103
|
+
const readers = parameters.sourceCallIds.map((id, index) => node({
|
|
104
|
+
type: 'n8n-nodes-base.code',
|
|
105
|
+
version: 2,
|
|
106
|
+
config: {
|
|
107
|
+
id: `${planned.id}-read-${index}`,
|
|
108
|
+
name: `Read branch ${index + 1} ${planned.id}`,
|
|
109
|
+
position: [position[0], position[1] + index * 180],
|
|
110
|
+
parameters: {
|
|
111
|
+
mode: 'runOnceForAllItems',
|
|
112
|
+
jsCode: createItemJoinReaderCode({
|
|
113
|
+
scope,
|
|
114
|
+
sourceCallId: id,
|
|
115
|
+
sources: [bindingSources[0], bindingSources[index + 1]],
|
|
116
|
+
}),
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
}));
|
|
120
|
+
const merge = node({
|
|
121
|
+
type: 'n8n-nodes-base.merge',
|
|
122
|
+
version: 3.2,
|
|
123
|
+
config: {
|
|
124
|
+
id: `${planned.id}-wait`,
|
|
125
|
+
name: `Wait branches ${planned.id}`,
|
|
126
|
+
position: [position[0] + 220, position[1]],
|
|
127
|
+
parameters: { mode: 'append', numberInputs: readers.length },
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
const runtime = readFileSync(new URL('./runtime/item-join-runtime.bundle.js', import.meta.url), 'utf8');
|
|
131
|
+
const joined = node({
|
|
132
|
+
type: 'n8n-nodes-base.code',
|
|
133
|
+
version: 2,
|
|
134
|
+
config: {
|
|
135
|
+
id: planned.id,
|
|
136
|
+
name: planned.id,
|
|
137
|
+
position: [position[0] + 440, position[1]],
|
|
138
|
+
parameters: {
|
|
139
|
+
mode: 'runOnceForAllItems',
|
|
140
|
+
jsCode: `${runtime}\nreturn OpenApiFlowItemJoinRuntime.joinApiItems({items:$input.all(),sourceCallIds:${javascriptJsonLiteral(parameters.sourceCallIds)}});`,
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
return {
|
|
145
|
+
nodeId: planned.id,
|
|
146
|
+
joinsInputItemsByAncestry: { scopeNodeId: parameters.scopeNodeId },
|
|
147
|
+
nodes: [...readers, merge, joined],
|
|
148
|
+
entry: readers[0],
|
|
149
|
+
exit: joined,
|
|
150
|
+
inputPorts: Object.fromEntries(itemJoinDefinition.inputPorts(parameters).map((port) => [port, 0])),
|
|
151
|
+
inputEndpoints: Object.fromEntries(readers.map((reader, i) => [
|
|
152
|
+
`input${i + 1}`,
|
|
153
|
+
{ nodeId: reader.id, input: 0 },
|
|
154
|
+
])),
|
|
155
|
+
outputPorts: { main: 0 },
|
|
156
|
+
bindingSources,
|
|
157
|
+
internalEdges: [
|
|
158
|
+
...readers.map((reader, index) => ({
|
|
159
|
+
from: reader.id,
|
|
160
|
+
output: 0,
|
|
161
|
+
to: merge.id,
|
|
162
|
+
input: index,
|
|
163
|
+
})),
|
|
164
|
+
{ from: merge.id, output: 0, to: joined.id, input: 0 },
|
|
165
|
+
],
|
|
166
|
+
};
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { N8nNativeCapability } from '../../../types/native-capability.js';
|
|
2
|
+
import type { CreateItemJoinCapabilityInput } from '../../../types/item-join.js';
|
|
3
|
+
/** Preserve explicitly supplied original runtime names; later revisions bind contracts and SDK names separately. */
|
|
4
|
+
export declare function createItemJoinCapability(input: CreateItemJoinCapabilityInput): N8nNativeCapability;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createBoundItemJoinCapability } from './create-bound-item-join-capability.js';
|
|
2
|
+
/** Preserve explicitly supplied original runtime names; later revisions bind contracts and SDK names separately. */
|
|
3
|
+
export function createItemJoinCapability(input) {
|
|
4
|
+
if (input.scopes.some((scope) => typeof scope.nodeName !== 'string' || !scope.nodeName.trim()))
|
|
5
|
+
throw new Error('item join scopes require unique non-empty identities and compiled names');
|
|
6
|
+
return createBoundItemJoinCapability({
|
|
7
|
+
...input,
|
|
8
|
+
runtime: { kind: 'provided', sources: input.scopes },
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { javascriptJsonLiteral } from '../../../utils/javascript-json-literal.js';
|
|
3
|
+
import { createOutputReaderCode } from '../../request/bindings/create-output-reader-code.js';
|
|
4
|
+
export function createItemJoinReaderCode({ scope, sourceCallId, sources, }) {
|
|
5
|
+
const runtime = readFileSync(new URL('../../request/runtime/request-runtime.bundle.js', import.meta.url), 'utf8');
|
|
6
|
+
const read = createOutputReaderCode(sources, true);
|
|
7
|
+
return `${runtime}
|
|
8
|
+
const scopeName=${javascriptJsonLiteral(scope.nodeName)};
|
|
9
|
+
const sourceCallId=${javascriptJsonLiteral(sourceCallId)};
|
|
10
|
+
const scopeItems=$(scopeName).all();
|
|
11
|
+
return $input.all().map((_,inputIndex)=>{
|
|
12
|
+
${read}
|
|
13
|
+
const ancestor=$(scopeName).itemMatching(inputIndex);
|
|
14
|
+
const matches=scopeItems.flatMap((item,index)=>item===ancestor?[index]:[]);
|
|
15
|
+
if(matches.length!==1)throw new Error('Item join '+sourceCallId+': scope ancestry must identify exactly one item in the current scope execution');
|
|
16
|
+
return {json:{scopeIndex:matches[0],sourceCallId,response:responses[sourceCallId]},pairedItem:{item:inputIndex}};
|
|
17
|
+
});`;
|
|
18
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { itemJoinParametersSchema } from '../../../schemas/item-join-schema.js';
|
|
2
|
+
export const itemJoinDefinition = {
|
|
3
|
+
name: 'join-api-items',
|
|
4
|
+
materialRequirements: [
|
|
5
|
+
{ field: 'apiMaterials', minimumItems: 2 },
|
|
6
|
+
{ field: 'nativeOutputs', minimumItems: 1 },
|
|
7
|
+
],
|
|
8
|
+
description: 'Join API branches by their shared native scope item ancestry. Each participating item requires exactly one full OAS-valid response per API. Different orders and duplicate JSON values are safe. Missing/duplicate branch responses fail; no business-ID matching, index zip, Cartesian product or value conversion. Output {responses: {callId: unchangedBody}}.',
|
|
9
|
+
parametersSchema: itemJoinParametersSchema,
|
|
10
|
+
parameterReferenceSources: ['response', 'node-output'],
|
|
11
|
+
inputPorts: (values) => Array.from({ length: itemJoinParametersSchema.parse(values).sourceCallIds.length }, (_, index) => `input${index + 1}`),
|
|
12
|
+
outputPorts: () => ['main'],
|
|
13
|
+
referenceStructureSchema: itemJoinParametersSchema,
|
|
14
|
+
parameterReferenceBindings: (values) => {
|
|
15
|
+
const parameters = itemJoinParametersSchema.parse(values);
|
|
16
|
+
return [
|
|
17
|
+
...parameters.sourceCallIds.map((nodeId, index) => ({
|
|
18
|
+
nodeIdPointer: `/sourceCallIds/${index}`,
|
|
19
|
+
reference: { source: 'response', nodeId, pointer: '' },
|
|
20
|
+
})),
|
|
21
|
+
{
|
|
22
|
+
nodeIdPointer: '/scopeNodeId',
|
|
23
|
+
reference: {
|
|
24
|
+
source: 'node-output',
|
|
25
|
+
nodeId: parameters.scopeNodeId,
|
|
26
|
+
pointer: '',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
},
|
|
31
|
+
waitsForAllInputs: true,
|
|
32
|
+
exclusiveOutputPorts: false,
|
|
33
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*! MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 carefreelife98
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
var OpenApiFlowItemJoinRuntime;
|
|
24
|
+
(()=>{function r({items:p,sourceCallIds:i}){if(i.length<2||new Set(i).size!==i.length)throw new Error("item join requires unique sourceCallIds");let s=new Map;for(let[n,o]of p.entries()){let e=o.json;if(!e||!Number.isInteger(e.scopeIndex)||e.scopeIndex<0)throw new Error(`item join input ${n}: scopeIndex is missing or invalid`);if(!i.includes(e.sourceCallId))throw new Error(`item join input ${n}: unknown sourceCallId ${e.sourceCallId}`);if(!Object.hasOwn(e,"response")||e.response===void 0)throw new Error(`item join input ${n}: response is missing`);let t=s.get(e.scopeIndex);if(t||(t={values:new Map,inputIndexes:[]},s.set(e.scopeIndex,t)),t.values.has(e.sourceCallId))throw new Error(`item join scope item ${e.scopeIndex}: duplicate response ${e.sourceCallId}`);t.values.set(e.sourceCallId,e.response),t.inputIndexes.push(n)}for(let[n,o]of s)for(let e of i)if(!o.values.has(e))throw new Error(`item join scope item ${n}: missing response ${e}`);return[...s].sort(([n],[o])=>n-o).map(([,n])=>({json:{responses:Object.fromEntries(i.map(o=>[o,n.values.get(o)]))},pairedItem:n.inputIndexes.map(o=>({item:o}))}))}OpenApiFlowItemJoinRuntime={joinApiItems:r};})();
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ItemJoinOutputItem, JoinApiItemsInput } from '../../../../types/item-join.js';
|
|
2
|
+
/** Join only reader-attested ancestry, never JSON business fields or stream positions. */
|
|
3
|
+
export declare function joinApiItems({ items, sourceCallIds, }: JoinApiItemsInput): ItemJoinOutputItem[];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Join only reader-attested ancestry, never JSON business fields or stream positions. */
|
|
2
|
+
export function joinApiItems({ items, sourceCallIds, }) {
|
|
3
|
+
if (sourceCallIds.length < 2 ||
|
|
4
|
+
new Set(sourceCallIds).size !== sourceCallIds.length)
|
|
5
|
+
throw new Error('item join requires unique sourceCallIds');
|
|
6
|
+
const groups = new Map();
|
|
7
|
+
for (const [inputIndex, item] of items.entries()) {
|
|
8
|
+
const row = item.json;
|
|
9
|
+
if (!row || !Number.isInteger(row.scopeIndex) || row.scopeIndex < 0)
|
|
10
|
+
throw new Error(`item join input ${inputIndex}: scopeIndex is missing or invalid`);
|
|
11
|
+
if (!sourceCallIds.includes(row.sourceCallId))
|
|
12
|
+
throw new Error(`item join input ${inputIndex}: unknown sourceCallId ${row.sourceCallId}`);
|
|
13
|
+
if (!Object.hasOwn(row, 'response') || row.response === undefined)
|
|
14
|
+
throw new Error(`item join input ${inputIndex}: response is missing`);
|
|
15
|
+
let group = groups.get(row.scopeIndex);
|
|
16
|
+
if (!group) {
|
|
17
|
+
group = { values: new Map(), inputIndexes: [] };
|
|
18
|
+
groups.set(row.scopeIndex, group);
|
|
19
|
+
}
|
|
20
|
+
if (group.values.has(row.sourceCallId))
|
|
21
|
+
throw new Error(`item join scope item ${row.scopeIndex}: duplicate response ${row.sourceCallId}`);
|
|
22
|
+
group.values.set(row.sourceCallId, row.response);
|
|
23
|
+
group.inputIndexes.push(inputIndex);
|
|
24
|
+
}
|
|
25
|
+
for (const [scopeIndex, group] of groups)
|
|
26
|
+
for (const id of sourceCallIds)
|
|
27
|
+
if (!group.values.has(id))
|
|
28
|
+
throw new Error(`item join scope item ${scopeIndex}: missing response ${id}`);
|
|
29
|
+
return [...groups]
|
|
30
|
+
.sort(([left], [right]) => left - right)
|
|
31
|
+
.map(([, group]) => ({
|
|
32
|
+
json: {
|
|
33
|
+
responses: Object.fromEntries(sourceCallIds.map((id) => [id, group.values.get(id)])),
|
|
34
|
+
},
|
|
35
|
+
pairedItem: group.inputIndexes.map((item) => ({ item })),
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { node } from '@n8n/workflow-sdk';
|
|
2
|
+
import { mergeParametersSchema } from '../../schemas/native-capability-schemas.js';
|
|
3
|
+
import { createNativeFragment } from './common/create-native-fragment.js';
|
|
4
|
+
export function createMergeAppendCapability() {
|
|
5
|
+
return {
|
|
6
|
+
name: 'merge-append',
|
|
7
|
+
description: 'n8n Merge append: input1..inputN; main output. Waits for all independent incoming branches.',
|
|
8
|
+
parametersSchema: mergeParametersSchema,
|
|
9
|
+
parameterReferenceSources: [],
|
|
10
|
+
inputPorts: (parameters) => Array.from({ length: mergeParametersSchema.parse(parameters).numberInputs }, (_, index) => `input${index + 1}`),
|
|
11
|
+
outputPorts: () => ['main'],
|
|
12
|
+
responseReferences: () => [],
|
|
13
|
+
parameterReferenceBindings: () => [],
|
|
14
|
+
waitsForAllInputs: true,
|
|
15
|
+
exclusiveOutputPorts: false,
|
|
16
|
+
compile: ({ planned, position }) => {
|
|
17
|
+
const parameters = mergeParametersSchema.parse(planned.parameters);
|
|
18
|
+
return createNativeFragment(node({
|
|
19
|
+
type: 'n8n-nodes-base.merge',
|
|
20
|
+
version: 3.2,
|
|
21
|
+
config: {
|
|
22
|
+
id: planned.id,
|
|
23
|
+
name: planned.id,
|
|
24
|
+
position,
|
|
25
|
+
parameters: {
|
|
26
|
+
mode: 'append',
|
|
27
|
+
numberInputs: parameters.numberInputs,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
}), Array.from({ length: parameters.numberInputs }, (_, index) => `input${index + 1}`), ['main']);
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { N8nNativeFeature } from '../../../types/native-feature-registry.js';
|
|
2
|
+
import type { N8nNativeFeatureDefinition } from '../../../types/native-feature-registry.js';
|
|
3
|
+
/** Material prerequisites belong to their actual factories, not model prompts. */
|
|
4
|
+
export declare const nativeFeatureDefinitions: Record<N8nNativeFeature, N8nNativeFeatureDefinition>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { createIfCapability } from '../if-capability.js';
|
|
2
|
+
import { createMergeAppendCapability } from '../merge-append-capability.js';
|
|
3
|
+
import { createResponseAssertionCapability } from '../response-assertion-capability.js';
|
|
4
|
+
import { createStopAndErrorCapability } from '../stop-and-error-capability.js';
|
|
5
|
+
import { createPassThroughCapability } from '../create-pass-through-capability.js';
|
|
6
|
+
import { createExclusiveBranchMergeCapability } from '../create-exclusive-branch-merge-capability.js';
|
|
7
|
+
import { createJsonOutputCapability } from '../create-json-output-capability.js';
|
|
8
|
+
import { createResponseArrayCapability } from '../create-response-array-capability.js';
|
|
9
|
+
import { createResponseCollectionCapability } from '../create-response-collection-capability.js';
|
|
10
|
+
import { createNativeArrayCapability } from '../arrays/create-native-array-capability.js';
|
|
11
|
+
import { createItemJoinCapability } from '../item-join/create-item-join-capability.js';
|
|
12
|
+
import { createBoundNativeArrayCapability } from '../arrays/create-bound-native-array-capability.js';
|
|
13
|
+
import { createBoundItemJoinCapability } from '../item-join/create-bound-item-join-capability.js';
|
|
14
|
+
import { createMaterialPlanningCapability } from '../common/create-material-planning-capability.js';
|
|
15
|
+
import { responseArrayDefinition } from '../response-array-definition.js';
|
|
16
|
+
import { responseCollectionDefinition } from '../response-collection-definition.js';
|
|
17
|
+
import { nativeArrayDefinition } from '../arrays/native-array-definition.js';
|
|
18
|
+
import { itemJoinDefinition } from '../item-join/item-join-definition.js';
|
|
19
|
+
import { nativeFeatureMaterialRequirements } from './native-feature-material-requirements.js';
|
|
20
|
+
import { N8nNativeFeature } from '../../../types/native-feature-registry.js';
|
|
21
|
+
/** Material prerequisites belong to their actual factories, not model prompts. */
|
|
22
|
+
export const nativeFeatureDefinitions = {
|
|
23
|
+
[N8nNativeFeature.If]: {
|
|
24
|
+
requirements: [],
|
|
25
|
+
create: createIfCapability,
|
|
26
|
+
},
|
|
27
|
+
[N8nNativeFeature.MergeAppend]: {
|
|
28
|
+
requirements: [],
|
|
29
|
+
create: createMergeAppendCapability,
|
|
30
|
+
},
|
|
31
|
+
[N8nNativeFeature.AssertResponses]: {
|
|
32
|
+
requirements: [],
|
|
33
|
+
create: createResponseAssertionCapability,
|
|
34
|
+
},
|
|
35
|
+
[N8nNativeFeature.StopAndError]: {
|
|
36
|
+
requirements: [],
|
|
37
|
+
create: createStopAndErrorCapability,
|
|
38
|
+
},
|
|
39
|
+
[N8nNativeFeature.PassThrough]: {
|
|
40
|
+
requirements: [],
|
|
41
|
+
create: createPassThroughCapability,
|
|
42
|
+
},
|
|
43
|
+
[N8nNativeFeature.RejoinExclusiveBranches]: {
|
|
44
|
+
requirements: [],
|
|
45
|
+
create: createExclusiveBranchMergeCapability,
|
|
46
|
+
},
|
|
47
|
+
[N8nNativeFeature.JsonOutput]: {
|
|
48
|
+
requirements: [{ field: 'jsonOutput' }],
|
|
49
|
+
create: (context) => createJsonOutputCapability(context.jsonOutput),
|
|
50
|
+
},
|
|
51
|
+
[N8nNativeFeature.SplitApiResponseArray]: {
|
|
52
|
+
requirements: nativeFeatureMaterialRequirements(responseArrayDefinition),
|
|
53
|
+
createPlanning: (context) => createMaterialPlanningCapability(responseArrayDefinition, (sources) => createResponseArrayCapability({
|
|
54
|
+
materials: sources.apiMaterials,
|
|
55
|
+
itemMode: context.itemMode,
|
|
56
|
+
})),
|
|
57
|
+
create: (context) => createResponseArrayCapability({
|
|
58
|
+
materials: context.apiMaterials,
|
|
59
|
+
itemMode: context.itemMode,
|
|
60
|
+
}),
|
|
61
|
+
},
|
|
62
|
+
[N8nNativeFeature.CollectApiResponses]: {
|
|
63
|
+
requirements: nativeFeatureMaterialRequirements(responseCollectionDefinition),
|
|
64
|
+
createPlanning: () => createMaterialPlanningCapability(responseCollectionDefinition, (sources) => createResponseCollectionCapability({
|
|
65
|
+
materials: sources.apiMaterials,
|
|
66
|
+
})),
|
|
67
|
+
create: (context) => createResponseCollectionCapability({ materials: context.apiMaterials }),
|
|
68
|
+
},
|
|
69
|
+
[N8nNativeFeature.SplitNativeOutputArray]: {
|
|
70
|
+
requirements: nativeFeatureMaterialRequirements(nativeArrayDefinition),
|
|
71
|
+
createPlanning: (context) => createMaterialPlanningCapability(nativeArrayDefinition, (sources) => createBoundNativeArrayCapability({
|
|
72
|
+
sources: sources.nativeOutputs,
|
|
73
|
+
itemMode: context.itemMode,
|
|
74
|
+
runtime: { kind: 'compiled' },
|
|
75
|
+
})),
|
|
76
|
+
create: (context) => createNativeArrayCapability({
|
|
77
|
+
sources: context.nativeOutputSources,
|
|
78
|
+
itemMode: context.itemMode,
|
|
79
|
+
}),
|
|
80
|
+
},
|
|
81
|
+
[N8nNativeFeature.JoinApiItems]: {
|
|
82
|
+
requirements: nativeFeatureMaterialRequirements(itemJoinDefinition),
|
|
83
|
+
createPlanning: () => createMaterialPlanningCapability(itemJoinDefinition, (sources) => createBoundItemJoinCapability({
|
|
84
|
+
materials: sources.apiMaterials,
|
|
85
|
+
scopes: sources.nativeOutputs,
|
|
86
|
+
runtime: { kind: 'compiled' },
|
|
87
|
+
})),
|
|
88
|
+
create: (context) => createItemJoinCapability({
|
|
89
|
+
materials: context.apiMaterials,
|
|
90
|
+
scopes: context.nativeOutputSources,
|
|
91
|
+
}),
|
|
92
|
+
},
|
|
93
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { NativeMaterialFeatureDefinition } from '../../../types/native-material-binding.js';
|
|
2
|
+
import type { N8nNativeFeatureContextRequirement } from '../../../types/native-feature-registry.js';
|
|
3
|
+
export declare function nativeFeatureMaterialRequirements(definition: NativeMaterialFeatureDefinition): N8nNativeFeatureContextRequirement[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function nativeFeatureMaterialRequirements(definition) {
|
|
2
|
+
if (!definition.materialRequirements)
|
|
3
|
+
throw new Error(`Native feature ${definition.name} has no declared material requirements`);
|
|
4
|
+
return definition.materialRequirements.map((requirement) => ({
|
|
5
|
+
field: requirement.field === 'nativeOutputs'
|
|
6
|
+
? 'nativeOutputSources'
|
|
7
|
+
: requirement.field,
|
|
8
|
+
minimumItems: requirement.minimumItems,
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { N8nNativeFeatureRegistry, ResolveN8nNativeFeaturesInput } from '../../../types/native-feature-registry.js';
|
|
2
|
+
/** Construct capabilities only from already supplied source contracts. */
|
|
3
|
+
export declare function resolveN8nNativeFeatures(input?: ResolveN8nNativeFeaturesInput): N8nNativeFeatureRegistry;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { resolveNativeFeatureRegistry } from './resolve-native-feature-registry.js';
|
|
2
|
+
/** Construct capabilities only from already supplied source contracts. */
|
|
3
|
+
export function resolveN8nNativeFeatures(input = {}) {
|
|
4
|
+
const { registrations, capabilities } = resolveNativeFeatureRegistry(input, 'materials');
|
|
5
|
+
return { registrations, capabilities };
|
|
6
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { N8nNativePlanningFeatureRegistry, ResolveN8nNativeFeaturesInput } from '../../../types/native-feature-registry.js';
|
|
2
|
+
/** Expose stable definitions before API/native producer instances have been planned. */
|
|
3
|
+
export declare function resolveN8nNativePlanningFeatures(input?: ResolveN8nNativeFeaturesInput): N8nNativePlanningFeatureRegistry;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { resolveNativeFeatureRegistry } from './resolve-native-feature-registry.js';
|
|
2
|
+
/** Expose stable definitions before API/native producer instances have been planned. */
|
|
3
|
+
export function resolveN8nNativePlanningFeatures(input = {}) {
|
|
4
|
+
return resolveNativeFeatureRegistry(input, 'planning');
|
|
5
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { N8nNativePlanningFeatureRegistry, N8nNativeFeatureResolutionMode, ResolveN8nNativeFeaturesInput } from '../../../types/native-feature-registry.js';
|
|
2
|
+
/** No model calls, fabricated contracts, source discovery or automatic registration retries. */
|
|
3
|
+
export declare function resolveNativeFeatureRegistry(input: ResolveN8nNativeFeaturesInput, mode: N8nNativeFeatureResolutionMode): N8nNativePlanningFeatureRegistry;
|