@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,99 @@
|
|
|
1
|
+
import { N8nNativeFeature } from '../../../types/native-feature-registry.js';
|
|
2
|
+
import { n8nNativeFeatureSelectionSchema } from '../../../schemas/native-feature-registry-schema.js';
|
|
3
|
+
import { nativeFeatureDefinitions } from './native-feature-definitions.js';
|
|
4
|
+
import { validateNativeFeatureContext } from './validate-native-feature-context.js';
|
|
5
|
+
/** No model calls, fabricated contracts, source discovery or automatic registration retries. */
|
|
6
|
+
export function resolveNativeFeatureRegistry(input, mode) {
|
|
7
|
+
validateNativeFeatureContext(input);
|
|
8
|
+
const selection = n8nNativeFeatureSelectionSchema.safeParse(input.features === undefined
|
|
9
|
+
? Object.values(N8nNativeFeature)
|
|
10
|
+
: input.features);
|
|
11
|
+
if (!selection.success)
|
|
12
|
+
throw new Error('native features.features is invalid', {
|
|
13
|
+
cause: selection.error,
|
|
14
|
+
});
|
|
15
|
+
const registrations = selection.data.map((feature) => {
|
|
16
|
+
const definition = nativeFeatureDefinitions[feature];
|
|
17
|
+
if (!definition)
|
|
18
|
+
throw new Error(`native feature ${feature} has no registered factory`);
|
|
19
|
+
const missingContext = definition.requirements
|
|
20
|
+
.filter((requirement) => {
|
|
21
|
+
if (requirement.field === 'jsonOutput')
|
|
22
|
+
return input.jsonOutput === undefined;
|
|
23
|
+
const materials = input[requirement.field];
|
|
24
|
+
return (materials === undefined ||
|
|
25
|
+
materials.length < requirement.minimumItems);
|
|
26
|
+
})
|
|
27
|
+
.map((requirement) => ({ ...requirement }));
|
|
28
|
+
if (missingContext.length) {
|
|
29
|
+
if (mode === 'materials' && input.features !== undefined) {
|
|
30
|
+
const requiredFields = missingContext
|
|
31
|
+
.map((requirement) => requirement.field === 'jsonOutput'
|
|
32
|
+
? requirement.field
|
|
33
|
+
: `${requirement.field} (at least ${requirement.minimumItems})`)
|
|
34
|
+
.join(', ');
|
|
35
|
+
throw new Error(`native feature ${feature} requires ${requiredFields}`);
|
|
36
|
+
}
|
|
37
|
+
return { feature, status: 'requires-context', missingContext };
|
|
38
|
+
}
|
|
39
|
+
const capability = definition.create(input);
|
|
40
|
+
if (feature !== N8nNativeFeature.JsonOutput &&
|
|
41
|
+
capability.name !== feature)
|
|
42
|
+
throw new Error(`native feature ${feature} factory changed its identity`);
|
|
43
|
+
return { feature, status: 'ready', capability };
|
|
44
|
+
});
|
|
45
|
+
const capabilities = [
|
|
46
|
+
...registrations.flatMap((registration) => registration.status === 'ready' ? [registration.capability] : []),
|
|
47
|
+
...(input.extensions === undefined ? [] : input.extensions),
|
|
48
|
+
];
|
|
49
|
+
const planningRegistrations = registrations.flatMap((registration) => {
|
|
50
|
+
if (registration.status === 'ready')
|
|
51
|
+
return [
|
|
52
|
+
{
|
|
53
|
+
feature: registration.feature,
|
|
54
|
+
capability: registration.capability,
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
if (mode === 'materials')
|
|
58
|
+
return [];
|
|
59
|
+
const factory = nativeFeatureDefinitions[registration.feature].createPlanning;
|
|
60
|
+
return factory === undefined
|
|
61
|
+
? []
|
|
62
|
+
: [
|
|
63
|
+
{
|
|
64
|
+
feature: registration.feature,
|
|
65
|
+
capability: factory({ itemMode: input.itemMode }),
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
});
|
|
69
|
+
const planningCapabilities = [
|
|
70
|
+
...planningRegistrations.map((entry) => entry.capability),
|
|
71
|
+
...(input.extensions === undefined ? [] : input.extensions),
|
|
72
|
+
];
|
|
73
|
+
const names = new Set();
|
|
74
|
+
for (const capability of planningCapabilities) {
|
|
75
|
+
if (!capability ||
|
|
76
|
+
typeof capability.name !== 'string' ||
|
|
77
|
+
!capability.name.trim() ||
|
|
78
|
+
typeof capability.description !== 'string' ||
|
|
79
|
+
!capability.description.trim() ||
|
|
80
|
+
!capability.parametersSchema ||
|
|
81
|
+
typeof capability.parametersSchema.safeParse !== 'function' ||
|
|
82
|
+
typeof capability.compile !== 'function' ||
|
|
83
|
+
typeof capability.inputPorts !== 'function' ||
|
|
84
|
+
typeof capability.outputPorts !== 'function' ||
|
|
85
|
+
typeof capability.responseReferences !== 'function' ||
|
|
86
|
+
typeof capability.waitsForAllInputs !== 'boolean' ||
|
|
87
|
+
typeof capability.exclusiveOutputPorts !== 'boolean')
|
|
88
|
+
throw new Error('native features requires complete named capability implementations');
|
|
89
|
+
if (names.has(capability.name))
|
|
90
|
+
throw new Error(`native features contains duplicate capability ${capability.name}`);
|
|
91
|
+
names.add(capability.name);
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
registrations,
|
|
95
|
+
capabilities,
|
|
96
|
+
planningCapabilities,
|
|
97
|
+
planningRegistrations,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { validateNativeOutputContracts } from '@openapi-flow/core';
|
|
2
|
+
import { nativeItemExecutionOptionsSchema } from '../../../schemas/native-feature-registry-schema.js';
|
|
3
|
+
export function validateNativeFeatureContext(input) {
|
|
4
|
+
if (!input || typeof input !== 'object' || Array.isArray(input))
|
|
5
|
+
throw new Error('native features input must be an object');
|
|
6
|
+
const execution = nativeItemExecutionOptionsSchema.safeParse({
|
|
7
|
+
itemMode: input.itemMode,
|
|
8
|
+
});
|
|
9
|
+
if (!execution.success)
|
|
10
|
+
throw new Error('native features.itemMode must be linked or omitted', {
|
|
11
|
+
cause: execution.error,
|
|
12
|
+
});
|
|
13
|
+
if (input.apiMaterials !== undefined) {
|
|
14
|
+
if (!Array.isArray(input.apiMaterials))
|
|
15
|
+
throw new Error('native features.apiMaterials must be an array');
|
|
16
|
+
const ids = new Set();
|
|
17
|
+
for (const material of input.apiMaterials) {
|
|
18
|
+
if (!material ||
|
|
19
|
+
typeof material.callId !== 'string' ||
|
|
20
|
+
!material.callId.trim() ||
|
|
21
|
+
ids.has(material.callId) ||
|
|
22
|
+
!material.operation ||
|
|
23
|
+
material.operation.source !== 'paths')
|
|
24
|
+
throw new Error('native features.apiMaterials requires unique callIds and resolved OAS operation contracts');
|
|
25
|
+
ids.add(material.callId);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (input.nativeOutputSources !== undefined) {
|
|
29
|
+
validateNativeOutputContracts(input.nativeOutputSources);
|
|
30
|
+
if (input.nativeOutputSources.some((source) => typeof source.nodeName !== 'string' || !source.nodeName.trim()))
|
|
31
|
+
throw new Error('native features.nativeOutputSources requires actual compiled nodeName values');
|
|
32
|
+
}
|
|
33
|
+
if (input.jsonOutput !== undefined) {
|
|
34
|
+
const output = input.jsonOutput;
|
|
35
|
+
if (!output ||
|
|
36
|
+
typeof output.name !== 'string' ||
|
|
37
|
+
!output.name.trim() ||
|
|
38
|
+
typeof output.description !== 'string' ||
|
|
39
|
+
!output.description.trim() ||
|
|
40
|
+
!output.parametersSchema ||
|
|
41
|
+
typeof output.parametersSchema.safeParse !== 'function')
|
|
42
|
+
throw new Error('native features.jsonOutput requires name, description and a Zod parametersSchema');
|
|
43
|
+
}
|
|
44
|
+
if (input.extensions !== undefined && !Array.isArray(input.extensions))
|
|
45
|
+
throw new Error('native features.extensions must be an array');
|
|
46
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { responseArrayParametersSchema } from '../../schemas/response-array-schema.js';
|
|
2
|
+
export const responseArrayDefinition = {
|
|
3
|
+
name: 'split-api-response-array',
|
|
4
|
+
materialRequirements: [{ field: 'apiMaterials', minimumItems: 1 }],
|
|
5
|
+
description: 'Split a declared OAS response array into one unchanged JSON item per element using n8n Split Out. Output is {item: element}. Downstream bound requests must use linked item mode. An empty array creates no downstream items.',
|
|
6
|
+
parametersSchema: responseArrayParametersSchema,
|
|
7
|
+
parameterReferenceSources: ['response'],
|
|
8
|
+
inputPorts: () => ['main'],
|
|
9
|
+
outputPorts: () => ['main'],
|
|
10
|
+
referenceStructureSchema: responseArrayParametersSchema,
|
|
11
|
+
parameterReferenceBindings: (values) => {
|
|
12
|
+
const parameters = responseArrayParametersSchema.parse(values);
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
nodeIdPointer: '/sourceNodeId',
|
|
16
|
+
valuePointer: '/pointer',
|
|
17
|
+
reference: {
|
|
18
|
+
source: 'response',
|
|
19
|
+
nodeId: parameters.sourceNodeId,
|
|
20
|
+
pointer: parameters.pointer,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
},
|
|
25
|
+
waitsForAllInputs: false,
|
|
26
|
+
exclusiveOutputPorts: false,
|
|
27
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { node } from '@n8n/workflow-sdk';
|
|
2
|
+
import { assertionParametersSchema } from '../../schemas/native-capability-schemas.js';
|
|
3
|
+
import { createAssertionPlanningParametersSchema } from '../../schemas/create-native-comparison-planning-schema.js';
|
|
4
|
+
import { createNativeFragment } from './common/create-native-fragment.js';
|
|
5
|
+
import { responseReferences } from './common/response-references.js';
|
|
6
|
+
import { responseReferenceBindings } from './common/response-reference-bindings.js';
|
|
7
|
+
import { responseCheckCode } from './response-check-code.js';
|
|
8
|
+
import { createResponseCheckReader } from './response-checks/create-response-check-reader.js';
|
|
9
|
+
export function createResponseAssertionCapability(input = {}) {
|
|
10
|
+
return {
|
|
11
|
+
name: 'assert-responses',
|
|
12
|
+
description: 'n8n Code: library-generated JSON comparisons. main input/output. Returns pass/assertionCount on success and can be the final node; no separate success/end node is needed. Failed checks throw their message and fail the workflow, without a failure output port. Join branches before comparing their responses.',
|
|
13
|
+
parametersSchema: assertionParametersSchema,
|
|
14
|
+
parameterReferenceSources: ['response'],
|
|
15
|
+
createPlanningParametersSchema: createAssertionPlanningParametersSchema,
|
|
16
|
+
inputPorts: () => ['main'],
|
|
17
|
+
outputPorts: () => ['main'],
|
|
18
|
+
responseReferences: (parameters) => responseReferences(assertionParametersSchema.parse(parameters).checks),
|
|
19
|
+
parameterReferenceBindings: (parameters) => responseReferenceBindings(assertionParametersSchema.parse(parameters).checks, '/checks'),
|
|
20
|
+
waitsForAllInputs: false,
|
|
21
|
+
exclusiveOutputPorts: false,
|
|
22
|
+
compile: ({ planned, apiNodeNames, apiResponseContracts, singletonApiResponseIds, position, }) => {
|
|
23
|
+
const parameters = assertionParametersSchema.parse(planned.parameters);
|
|
24
|
+
const reader = createResponseCheckReader({
|
|
25
|
+
nodeId: planned.id,
|
|
26
|
+
checks: parameters.checks,
|
|
27
|
+
apiNodeNames,
|
|
28
|
+
apiResponseContracts,
|
|
29
|
+
singletonApiResponseIds,
|
|
30
|
+
linked: input.itemMode === 'linked',
|
|
31
|
+
});
|
|
32
|
+
const checkCode = `${responseCheckCode(reader.code)}\nconst checks = ${JSON.stringify(parameters.checks)};\nfor (const check of checks) if (!compare(check)) throw new Error(check.message);`;
|
|
33
|
+
const code = input.itemMode === 'linked'
|
|
34
|
+
? `return $input.all().map((_,inputIndex)=>{${checkCode}\nreturn {json:{pass:true,assertionCount:checks.length},pairedItem:{item:inputIndex}};});`
|
|
35
|
+
: `${checkCode}\nreturn [{json: {pass: true, assertionCount: checks.length}}];`;
|
|
36
|
+
const fragment = createNativeFragment(node({
|
|
37
|
+
type: 'n8n-nodes-base.code',
|
|
38
|
+
version: 2,
|
|
39
|
+
config: {
|
|
40
|
+
id: planned.id,
|
|
41
|
+
name: planned.id,
|
|
42
|
+
position,
|
|
43
|
+
parameters: {
|
|
44
|
+
mode: 'runOnceForAllItems',
|
|
45
|
+
language: 'javaScript',
|
|
46
|
+
jsCode: code,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
}), ['main'], ['main']);
|
|
50
|
+
return {
|
|
51
|
+
...fragment,
|
|
52
|
+
preservesInputItems: input.itemMode === 'linked',
|
|
53
|
+
bindingSources: reader.bindingSources,
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { NativeCheck } from '../../types/native-capability.js';
|
|
2
|
+
export declare function responseCheckCode(responseReaderCode: string): string;
|
|
3
|
+
export declare function conditionExpression(check: NativeCheck, names: Record<string, string>, linked?: boolean, singletonApiResponseIds?: string[]): string;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { javascriptJsonLiteral } from '../../utils/javascript-json-literal.js';
|
|
2
|
+
import { responseReferences } from './common/response-references.js';
|
|
3
|
+
import { createOutputItemReaderCode } from '../request/bindings/create-output-item-reader-code.js';
|
|
4
|
+
/** Library-owned runtime, shared by IF expressions and assertion Code nodes. */
|
|
5
|
+
function responseCheckRuntime() {
|
|
6
|
+
return `
|
|
7
|
+
function read(operand) {
|
|
8
|
+
if (operand.source === 'literal') return operand.value;
|
|
9
|
+
if (!Object.hasOwn(responses, operand.nodeId) || responses[operand.nodeId] === undefined)
|
|
10
|
+
throw new Error('Missing response body: ' + operand.nodeId);
|
|
11
|
+
let value = responses[operand.nodeId];
|
|
12
|
+
if (operand.pointer === '') return value;
|
|
13
|
+
for (const encoded of operand.pointer.slice(1).split('/')) {
|
|
14
|
+
const key = encoded.replace(/~1/g, '/').replace(/~0/g, '~');
|
|
15
|
+
if (value === null || typeof value !== 'object' || !Object.hasOwn(value, key))
|
|
16
|
+
throw new Error('Missing response pointer: ' + operand.nodeId + operand.pointer);
|
|
17
|
+
value = value[key];
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
function equal(a, b) {
|
|
22
|
+
if (a === b) return true;
|
|
23
|
+
if (a === null || b === null || typeof a !== 'object' || typeof b !== 'object') return false;
|
|
24
|
+
if (Array.isArray(a) !== Array.isArray(b)) return false;
|
|
25
|
+
const keys = Object.keys(a);
|
|
26
|
+
return keys.length === Object.keys(b).length && keys.every(key => Object.hasOwn(b, key) && equal(a[key], b[key]));
|
|
27
|
+
}
|
|
28
|
+
function compare(check) {
|
|
29
|
+
const left = read(check.left), right = read(check.right);
|
|
30
|
+
switch (check.operator) {
|
|
31
|
+
case 'equals': return equal(left, right);
|
|
32
|
+
case 'notEquals': return !equal(left, right);
|
|
33
|
+
case 'keysEqual':
|
|
34
|
+
if (left === null || right === null || typeof left !== 'object' || typeof right !== 'object' || Array.isArray(left) || Array.isArray(right))
|
|
35
|
+
throw new Error('keysEqual requires objects');
|
|
36
|
+
return equal(Object.keys(left).sort(), Object.keys(right).sort());
|
|
37
|
+
case 'greaterThan': case 'lessThan':
|
|
38
|
+
if (typeof left !== 'number' || typeof right !== 'number') throw new Error('Numeric comparison requires numbers');
|
|
39
|
+
return check.operator === 'greaterThan' ? left > right : left < right;
|
|
40
|
+
default: throw new Error('Unknown comparison operator');
|
|
41
|
+
}
|
|
42
|
+
}`;
|
|
43
|
+
}
|
|
44
|
+
export function responseCheckCode(responseReaderCode) {
|
|
45
|
+
return `${responseReaderCode}\n${responseCheckRuntime()}`;
|
|
46
|
+
}
|
|
47
|
+
export function conditionExpression(check, names, linked = false, singletonApiResponseIds = []) {
|
|
48
|
+
const sources = responseReferences([check]).map((ref) => ({
|
|
49
|
+
nodeId: ref.nodeId,
|
|
50
|
+
nodeName: names[ref.nodeId],
|
|
51
|
+
singleton: singletonApiResponseIds.includes(ref.nodeId),
|
|
52
|
+
}));
|
|
53
|
+
// The preceding Code guard validates full responses. Keep IF expressions small.
|
|
54
|
+
const reader = `const sources=${javascriptJsonLiteral(sources)};
|
|
55
|
+
const responses=Object.create(null);
|
|
56
|
+
for (const source of sources) {
|
|
57
|
+
${createOutputItemReaderCode(linked)}
|
|
58
|
+
const envelope=item;
|
|
59
|
+
if (!envelope || !envelope.json || !Object.hasOwn(envelope.json, 'body'))
|
|
60
|
+
throw new Error('Missing response body: '+source.nodeId);
|
|
61
|
+
responses[source.nodeId]=envelope.json.body;
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
return `={{ (() => { ${linked ? 'const inputIndex=$itemIndex;' : ''}${responseCheckCode(reader)}; return compare(${javascriptJsonLiteral(check)}); })() }}`;
|
|
65
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CreateResponseCheckGuardInput } from '../../../types/response-check-guard.js';
|
|
2
|
+
import type { N8nSdkNode } from '../../../types/node-fragment.js';
|
|
3
|
+
/** Validate in Code, not inside n8n's expression-delimited IF parameter. */
|
|
4
|
+
export declare function createResponseCheckGuard({ nodeId, readerCode, linked, position, }: CreateResponseCheckGuardInput): N8nSdkNode;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { node } from '@n8n/workflow-sdk';
|
|
2
|
+
/** Validate in Code, not inside n8n's expression-delimited IF parameter. */
|
|
3
|
+
export function createResponseCheckGuard({ nodeId, readerCode, linked, position, }) {
|
|
4
|
+
const forward = 'return {...item,pairedItem:{item:inputIndex}};';
|
|
5
|
+
const code = linked
|
|
6
|
+
? `return $input.all().map((item,inputIndex)=>{${readerCode}\n${forward}});`
|
|
7
|
+
: `${readerCode}\nreturn $input.all().map((item,inputIndex)=>{${forward}});`;
|
|
8
|
+
return node({
|
|
9
|
+
type: 'n8n-nodes-base.code',
|
|
10
|
+
version: 2,
|
|
11
|
+
config: {
|
|
12
|
+
id: `${nodeId}-response-contract`,
|
|
13
|
+
name: `Validate responses ${nodeId}`,
|
|
14
|
+
position: [position[0] - 220, position[1]],
|
|
15
|
+
parameters: {
|
|
16
|
+
mode: 'runOnceForAllItems',
|
|
17
|
+
language: 'javaScript',
|
|
18
|
+
jsCode: code,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CreateResponseCheckReaderInput, CompiledResponseCheckReader } from '../../../types/response-check-compilation.js';
|
|
2
|
+
/** Reuse full OAS response validation before native comparisons, without changing data. */
|
|
3
|
+
export declare function createResponseCheckReader({ nodeId, checks, apiNodeNames, apiResponseContracts, singletonApiResponseIds, linked, }: CreateResponseCheckReaderInput): CompiledResponseCheckReader;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { responseReferences } from '../common/response-references.js';
|
|
3
|
+
import { createOutputReaderCode } from '../../request/bindings/create-output-reader-code.js';
|
|
4
|
+
/** Reuse full OAS response validation before native comparisons, without changing data. */
|
|
5
|
+
export function createResponseCheckReader({ nodeId, checks, apiNodeNames, apiResponseContracts, singletonApiResponseIds, linked, }) {
|
|
6
|
+
const ids = [...new Set(responseReferences(checks).map((ref) => ref.nodeId))];
|
|
7
|
+
const bindingSources = ids.map((id) => {
|
|
8
|
+
const operation = apiResponseContracts?.[id];
|
|
9
|
+
if (!operation)
|
|
10
|
+
throw new Error(`native node ${nodeId}: apiResponseContracts is missing ${id}`);
|
|
11
|
+
const nodeName = apiNodeNames[id];
|
|
12
|
+
if (typeof nodeName !== 'string' || !nodeName.trim())
|
|
13
|
+
throw new Error(`native node ${nodeId}: apiNodeNames is missing ${id}`);
|
|
14
|
+
return { kind: 'api-response', nodeId: id, nodeName, operation };
|
|
15
|
+
});
|
|
16
|
+
if (!bindingSources.length)
|
|
17
|
+
return { code: 'const responses=Object.create(null);', bindingSources };
|
|
18
|
+
const runtime = readFileSync(new URL('../../request/runtime/request-runtime.bundle.js', import.meta.url), 'utf8');
|
|
19
|
+
return {
|
|
20
|
+
code: `${runtime}\n${createOutputReaderCode(bindingSources, linked, singletonApiResponseIds)}`,
|
|
21
|
+
bindingSources,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { responseCollectionParametersSchema } from '../../schemas/response-collection-schema.js';
|
|
2
|
+
export const responseCollectionDefinition = {
|
|
3
|
+
name: 'collect-api-responses',
|
|
4
|
+
materialRequirements: [{ field: 'apiMaterials', minimumItems: 1 }],
|
|
5
|
+
description: 'Collect unchanged item-linked API response values from one incoming stream into {items: values} using n8n Aggregate. Validates each full OAS response first. Preserves null, nested arrays, duplicates and received order. Not a branch join. Empty streams do not trigger this node or create an artificial result.',
|
|
6
|
+
parametersSchema: responseCollectionParametersSchema,
|
|
7
|
+
parameterReferenceSources: ['response'],
|
|
8
|
+
inputPorts: () => ['main'],
|
|
9
|
+
outputPorts: () => ['main'],
|
|
10
|
+
referenceStructureSchema: responseCollectionParametersSchema,
|
|
11
|
+
parameterReferenceBindings: (values) => {
|
|
12
|
+
const parameters = responseCollectionParametersSchema.parse(values);
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
nodeIdPointer: '/sourceNodeId',
|
|
16
|
+
valuePointer: '/pointer',
|
|
17
|
+
reference: {
|
|
18
|
+
source: 'response',
|
|
19
|
+
nodeId: parameters.sourceNodeId,
|
|
20
|
+
pointer: parameters.pointer,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
},
|
|
25
|
+
waitsForAllInputs: false,
|
|
26
|
+
exclusiveOutputPorts: false,
|
|
27
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { node } from '@n8n/workflow-sdk';
|
|
2
|
+
import { resolveNativeStructureParameters } from '@openapi-flow/core';
|
|
3
|
+
import { stopParametersSchema } from '../../schemas/native-capability-schemas.js';
|
|
4
|
+
import { createNativeFragment } from './common/create-native-fragment.js';
|
|
5
|
+
import { prependNativeParameterGuard } from './inputs/prepend-native-parameter-guard.js';
|
|
6
|
+
export function createStopAndErrorCapability() {
|
|
7
|
+
const capability = {
|
|
8
|
+
name: 'stop-and-error',
|
|
9
|
+
description: 'n8n StopAndError: main input, no outputs. Fail the workflow with an explicit message.',
|
|
10
|
+
parametersSchema: stopParametersSchema,
|
|
11
|
+
parameterReferenceSources: [],
|
|
12
|
+
supportsRuntimeParameters: true,
|
|
13
|
+
inputPorts: () => ['main'],
|
|
14
|
+
outputPorts: () => [],
|
|
15
|
+
responseReferences: () => [],
|
|
16
|
+
parameterReferenceBindings: () => [],
|
|
17
|
+
waitsForAllInputs: false,
|
|
18
|
+
exclusiveOutputPorts: false,
|
|
19
|
+
compile: (source) => {
|
|
20
|
+
const { planned, position } = source;
|
|
21
|
+
resolveNativeStructureParameters(planned, capability);
|
|
22
|
+
const fragment = createNativeFragment(node({
|
|
23
|
+
type: 'n8n-nodes-base.stopAndError',
|
|
24
|
+
version: 1,
|
|
25
|
+
config: {
|
|
26
|
+
id: planned.id,
|
|
27
|
+
name: planned.id,
|
|
28
|
+
position,
|
|
29
|
+
parameters: {
|
|
30
|
+
errorType: 'errorMessage',
|
|
31
|
+
errorMessage: planned.runtimeParameters !== undefined
|
|
32
|
+
? '={{ $json.message }}'
|
|
33
|
+
: stopParametersSchema.parse(planned.parameters).message,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
}), ['main'], []);
|
|
37
|
+
return planned.runtimeParameters !== undefined
|
|
38
|
+
? prependNativeParameterGuard({ input: source, capability, fragment })
|
|
39
|
+
: fragment;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
return capability;
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function looksLikeCredential(name: string): boolean;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { HttpRequestAuthenticationMapping, ResolveHttpRequestAuthenticationInput } from '../../../types/authentication.js';
|
|
2
|
+
export declare function resolveHttpRequestAuthentication(input: ResolveHttpRequestAuthenticationInput): HttpRequestAuthenticationMapping | undefined;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { resolveOpenApiSecurity } from '@openapi-flow/core';
|
|
2
|
+
import { UnsupportedOperationError } from '@openapi-flow/core/internal';
|
|
3
|
+
export function resolveHttpRequestAuthentication(input) {
|
|
4
|
+
const contract = input.operation;
|
|
5
|
+
const selected = resolveOpenApiSecurity({
|
|
6
|
+
operationRef: contract.key.operationRef,
|
|
7
|
+
security: contract.effective.security,
|
|
8
|
+
securitySchemes: contract.effective.securitySchemes,
|
|
9
|
+
requirementIndex: input.securityRequirementIndex,
|
|
10
|
+
});
|
|
11
|
+
if (!selected || !selected.schemes.length)
|
|
12
|
+
return undefined;
|
|
13
|
+
if (selected.schemes.length !== 1)
|
|
14
|
+
throw new UnsupportedOperationError(contract.key.operationRef, `${contract.key.operationRef}: combined security schemes require a separate composite credential mapping`);
|
|
15
|
+
const { name, definition, scopes } = selected.schemes[0];
|
|
16
|
+
if (definition.type === 'http') {
|
|
17
|
+
const scheme = String(definition.scheme).toLowerCase();
|
|
18
|
+
if (scheme === 'bearer')
|
|
19
|
+
return { schemeName: name, credentialType: 'httpBearerAuth' };
|
|
20
|
+
if (scheme === 'basic')
|
|
21
|
+
return { schemeName: name, credentialType: 'httpBasicAuth' };
|
|
22
|
+
if (scheme === 'digest')
|
|
23
|
+
return { schemeName: name, credentialType: 'httpDigestAuth' };
|
|
24
|
+
}
|
|
25
|
+
if (definition.type === 'apiKey' &&
|
|
26
|
+
['header', 'query'].includes(String(definition.in))) {
|
|
27
|
+
if (typeof definition.name !== 'string' || !definition.name.trim())
|
|
28
|
+
throw new Error(`${contract.key.operationRef}.securitySchemes.${name}.name is required`);
|
|
29
|
+
return {
|
|
30
|
+
schemeName: name,
|
|
31
|
+
credentialType: definition.in === 'header' ? 'httpHeaderAuth' : 'httpQueryAuth',
|
|
32
|
+
credentialRequirements: `OAS ${name}: configure the credential ${definition.in} Name as ${JSON.stringify(definition.name)}. The workflow contains only a credential reference; the stored secret and Name are owned by n8n.`,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (definition.type === 'oauth2')
|
|
36
|
+
return {
|
|
37
|
+
schemeName: name,
|
|
38
|
+
credentialType: 'oAuth2Api',
|
|
39
|
+
credentialRequirements: `OAS ${name}: use an existing OAuth2 credential configured for the declared flows and required scopes ${JSON.stringify(scopes)}. This compiler does not create grants, invent tokens or verify the stored credential configuration.`,
|
|
40
|
+
};
|
|
41
|
+
throw new UnsupportedOperationError(contract.key.operationRef, `${contract.key.operationRef}.securitySchemes.${name}: ${definition.type}/${definition.scheme ?? definition.in ?? ''} has no implemented HTTP Request credential mapping`);
|
|
42
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { compileStandaloneValidator } from '../../common/validation/compile-standalone-validator.js';
|
|
2
|
+
/** Every producer retains its own schema resource root and reference scope. */
|
|
3
|
+
export function compileNativeOutputValidators(sources) {
|
|
4
|
+
return sources
|
|
5
|
+
.map((source, index) => source.kind === 'native-json'
|
|
6
|
+
? compileStandaloneValidator({
|
|
7
|
+
schema: source.schema,
|
|
8
|
+
globalName: `OpenApiFlowNativeOutputValidator${index}`,
|
|
9
|
+
})
|
|
10
|
+
: '')
|
|
11
|
+
.join('\n');
|
|
12
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { RequestMaterializationConfig } from '../../../types/request-materialization.js';
|
|
2
|
+
/** Compile OAS schemas on the host; n8n receives no schema compiler/eval. */
|
|
3
|
+
export declare function compileRequestValidator(config: RequestMaterializationConfig, globalName?: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createApiRequestSchema } from '@openapi-flow/core';
|
|
2
|
+
import { compileStandaloneValidator } from '../../common/validation/compile-standalone-validator.js';
|
|
3
|
+
/** Compile OAS schemas on the host; n8n receives no schema compiler/eval. */
|
|
4
|
+
export function compileRequestValidator(config, globalName = 'OpenApiFlowRequestValidator') {
|
|
5
|
+
const schema = createApiRequestSchema({
|
|
6
|
+
operation: config.contract,
|
|
7
|
+
requestMediaType: config.arguments.requestMediaType,
|
|
8
|
+
});
|
|
9
|
+
return compileStandaloneValidator({
|
|
10
|
+
schema,
|
|
11
|
+
globalName,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createApiResponseSchema } from '@openapi-flow/core';
|
|
2
|
+
import { compileStandaloneValidator } from '../../common/validation/compile-standalone-validator.js';
|
|
3
|
+
export function compileSourceResponseValidators(sources) {
|
|
4
|
+
return sources
|
|
5
|
+
.map((source, index) => source.kind === 'api-response' && source.operation
|
|
6
|
+
? compileStandaloneValidator({
|
|
7
|
+
schema: createApiResponseSchema({ operation: source.operation }),
|
|
8
|
+
globalName: `OpenApiFlowResponseValidator${index}`,
|
|
9
|
+
})
|
|
10
|
+
: '')
|
|
11
|
+
.join('\n');
|
|
12
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CreateBoundHttpRequestNodeInput, N8nNodeFragment } from '../../../types/node-fragment.js';
|
|
2
|
+
import type { RequestMaterializationConfig } from '../../../types/request-materialization.js';
|
|
3
|
+
export declare function createBoundRequestFragment(input: CreateBoundHttpRequestNodeInput, config: RequestMaterializationConfig): N8nNodeFragment;
|