@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,34 @@
|
|
|
1
|
+
import { checkSchemaValue } from '@openapi-flow/core/internal';
|
|
2
|
+
import { serializePathParameter, serializeQueryParameter, } from '@openapi-flow/core/internal';
|
|
3
|
+
export function absoluteOperationPath(baseUrl, path) {
|
|
4
|
+
return baseUrl.origin + baseUrl.pathname.replace(/\/$/, '') + path;
|
|
5
|
+
}
|
|
6
|
+
export function makeUrl(operation, origin, inputs, missing) {
|
|
7
|
+
let path = operation.path;
|
|
8
|
+
for (const parameter of operation.parameters) {
|
|
9
|
+
if (parameter.in !== 'path' && parameter.in !== 'query')
|
|
10
|
+
continue;
|
|
11
|
+
const key = parameter.in + '.' + parameter.name;
|
|
12
|
+
const value = inputs[key];
|
|
13
|
+
if (value === undefined) {
|
|
14
|
+
if (parameter.required)
|
|
15
|
+
missing.push(key);
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
checkSchemaValue(value, parameter.schema, 'plan.inputs.' + key);
|
|
19
|
+
if (parameter.in === 'path')
|
|
20
|
+
path = path.replace('{' + parameter.name + '}', serializePathParameter(parameter, operation.operationRef, value));
|
|
21
|
+
}
|
|
22
|
+
const url = new URL(absoluteOperationPath(origin, path));
|
|
23
|
+
const query = [];
|
|
24
|
+
for (const parameter of operation.parameters) {
|
|
25
|
+
if (parameter.in !== 'query')
|
|
26
|
+
continue;
|
|
27
|
+
const key = 'query.' + parameter.name;
|
|
28
|
+
if (inputs[key] !== undefined)
|
|
29
|
+
query.push(...serializeQueryParameter(parameter, operation.operationRef, inputs[key]));
|
|
30
|
+
}
|
|
31
|
+
if (query.length)
|
|
32
|
+
url.search = query.join('&');
|
|
33
|
+
return url.href;
|
|
34
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function assertionCode(expectedBody, requiredFields = {}) {
|
|
2
|
+
const expected = JSON.stringify(expectedBody);
|
|
3
|
+
const required = JSON.stringify(requiredFields);
|
|
4
|
+
return [
|
|
5
|
+
'const items = $input.all();',
|
|
6
|
+
"if (items.length !== 1) throw new Error('Expected one response item');",
|
|
7
|
+
'const response = items[0].json;',
|
|
8
|
+
'const expected = ' + expected + ';',
|
|
9
|
+
'const required = ' + required + ';',
|
|
10
|
+
'function equal(actual, expectedValue) {',
|
|
11
|
+
' if (Object.is(actual, expectedValue)) return true;',
|
|
12
|
+
' if (actual === null || expectedValue === null || typeof actual !== "object" || typeof expectedValue !== "object") return false;',
|
|
13
|
+
' if (Array.isArray(actual) !== Array.isArray(expectedValue)) return false;',
|
|
14
|
+
' const keys = Object.keys(expectedValue);',
|
|
15
|
+
' if (Object.keys(actual).length !== keys.length) return false;',
|
|
16
|
+
' return keys.every((key) => Object.prototype.hasOwnProperty.call(actual, key) && equal(actual[key], expectedValue[key]));',
|
|
17
|
+
'}',
|
|
18
|
+
'for (const [key, type] of Object.entries(required)) {',
|
|
19
|
+
' const value = response.body?.[key];',
|
|
20
|
+
' const valid = type === "integer" ? Number.isSafeInteger(value) : type === "number" ? typeof value === "number" && Number.isFinite(value) : typeof value === type;',
|
|
21
|
+
' if (!valid) throw new Error("Missing or invalid response body field: " + key);',
|
|
22
|
+
'}',
|
|
23
|
+
'for (const [key, value] of Object.entries(expected)) {',
|
|
24
|
+
' if (!equal(response.body?.[key], value)) throw new Error("Unexpected response body field: " + key);',
|
|
25
|
+
'}',
|
|
26
|
+
'return items;',
|
|
27
|
+
].join('\n');
|
|
28
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Operation } from '@openapi-flow/core/internal';
|
|
2
|
+
import type { InputValues } from '../../../types/legacy/request-workflow.js';
|
|
3
|
+
import type { PreviousOperations, RequiredOutputs } from '../../../types/legacy/sequence-workflow.js';
|
|
4
|
+
export declare function sequenceUrl(operation: Operation, origin: URL, inputs: InputValues, previous: PreviousOperations, requiredOutputs: RequiredOutputs, missing: string[]): string;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { responseFieldSchemas, responseFieldType, } from '@openapi-flow/core/internal';
|
|
2
|
+
import { checkSchemaValue } from '@openapi-flow/core/internal';
|
|
3
|
+
import { serializePathParameter, serializeQueryParameter, } from '@openapi-flow/core/internal';
|
|
4
|
+
import { UnsupportedOperationError } from '@openapi-flow/core/internal';
|
|
5
|
+
import { isObject } from '@openapi-flow/core/internal';
|
|
6
|
+
import { looksLikeCredential } from './credential-binding.js';
|
|
7
|
+
import { absoluteOperationPath, makeUrl } from './request-url.js';
|
|
8
|
+
export function sequenceUrl(operation, origin, inputs, previous, requiredOutputs, missing) {
|
|
9
|
+
let path = operation.path;
|
|
10
|
+
const references = new Map();
|
|
11
|
+
for (const parameter of operation.parameters) {
|
|
12
|
+
if (parameter.in !== 'path' && parameter.in !== 'query')
|
|
13
|
+
continue;
|
|
14
|
+
const key = parameter.in + '.' + parameter.name;
|
|
15
|
+
const value = inputs[key];
|
|
16
|
+
if (value === undefined) {
|
|
17
|
+
if (parameter.required)
|
|
18
|
+
missing.push(key);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (isObject(value)) {
|
|
22
|
+
if (typeof value.fromStep !== 'string' ||
|
|
23
|
+
typeof value.field !== 'string' ||
|
|
24
|
+
Object.keys(value).length !== 2) {
|
|
25
|
+
throw new Error('plan.inputs.' + key + ' must have fromStep and field');
|
|
26
|
+
}
|
|
27
|
+
if (looksLikeCredential(value.field)) {
|
|
28
|
+
throw new Error('plan.inputs.' + key + ' references a credential-like response field');
|
|
29
|
+
}
|
|
30
|
+
const source = previous.get(value.fromStep);
|
|
31
|
+
if (!source || responseFieldSchemas(source, value.field).length === 0) {
|
|
32
|
+
throw new Error('plan.inputs.' + key + ' must reference a prior response field');
|
|
33
|
+
}
|
|
34
|
+
const sourceType = responseFieldType(source, value.field);
|
|
35
|
+
const targetType = typeof parameter.schema === 'object'
|
|
36
|
+
? parameter.schema.type
|
|
37
|
+
: undefined;
|
|
38
|
+
if ((parameter.in === 'path' && parameter.style !== 'simple') ||
|
|
39
|
+
(parameter.in === 'query' && parameter.style !== 'form') ||
|
|
40
|
+
parameter.contentMediaType !== undefined ||
|
|
41
|
+
parameter.allowReserved ||
|
|
42
|
+
!['string', 'number', 'integer', 'boolean'].includes(String(targetType)))
|
|
43
|
+
throw new UnsupportedOperationError(operation.operationRef, `operationRef ${operation.operationRef} parameter ${key} cannot serialize a sequence response reference`);
|
|
44
|
+
if (sourceType !== targetType &&
|
|
45
|
+
!(sourceType === 'integer' && targetType === 'number')) {
|
|
46
|
+
throw new Error('plan.inputs.' + key + ' has a response type mismatch');
|
|
47
|
+
}
|
|
48
|
+
const required = requiredOutputs.get(value.fromStep) ?? new Set();
|
|
49
|
+
required.add(value.field);
|
|
50
|
+
requiredOutputs.set(value.fromStep, required);
|
|
51
|
+
references.set(key, '$node[' +
|
|
52
|
+
JSON.stringify('Request ' + value.fromStep) +
|
|
53
|
+
'].json.body[' +
|
|
54
|
+
JSON.stringify(value.field) +
|
|
55
|
+
']');
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
checkSchemaValue(value, parameter.schema, 'plan.inputs.' + key);
|
|
59
|
+
if (parameter.in === 'path')
|
|
60
|
+
path = path.replace('{' + parameter.name + '}', serializePathParameter(parameter, operation.operationRef, value));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (missing.length)
|
|
64
|
+
return '';
|
|
65
|
+
if (references.size === 0)
|
|
66
|
+
return makeUrl(operation, origin, inputs, []);
|
|
67
|
+
const absolute = absoluteOperationPath(origin, path);
|
|
68
|
+
const parts = [];
|
|
69
|
+
let offset = 0;
|
|
70
|
+
for (const match of absolute.matchAll(/\{([^}]+)\}/g)) {
|
|
71
|
+
const key = 'path.' + match[1];
|
|
72
|
+
const reference = references.get(key);
|
|
73
|
+
if (!reference)
|
|
74
|
+
throw new Error('plan.inputs.' + key + ' is required');
|
|
75
|
+
parts.push(JSON.stringify(absolute.slice(offset, match.index)), 'encodeURIComponent(' + reference + ')');
|
|
76
|
+
offset = match.index + match[0].length;
|
|
77
|
+
}
|
|
78
|
+
parts.push(JSON.stringify(absolute.slice(offset)));
|
|
79
|
+
let expression = parts.join(' + ');
|
|
80
|
+
let firstQuery = true;
|
|
81
|
+
for (const parameter of operation.parameters) {
|
|
82
|
+
if (parameter.in !== 'query' ||
|
|
83
|
+
inputs['query.' + parameter.name] === undefined)
|
|
84
|
+
continue;
|
|
85
|
+
const key = 'query.' + parameter.name;
|
|
86
|
+
const reference = references.get(key);
|
|
87
|
+
if (reference) {
|
|
88
|
+
expression +=
|
|
89
|
+
' + ' +
|
|
90
|
+
JSON.stringify((firstQuery ? '?' : '&') + encodeURIComponent(parameter.name) + '=') +
|
|
91
|
+
' + encodeURIComponent(' +
|
|
92
|
+
reference +
|
|
93
|
+
')';
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
expression +=
|
|
97
|
+
' + ' +
|
|
98
|
+
JSON.stringify((firstQuery ? '?' : '&') +
|
|
99
|
+
serializeQueryParameter(parameter, operation.operationRef, inputs[key]).join('&'));
|
|
100
|
+
}
|
|
101
|
+
firstQuery = false;
|
|
102
|
+
}
|
|
103
|
+
return '={{ ' + expression + ' }}';
|
|
104
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export * from './legacy/workflow/common/plan-validation.js';
|
|
2
|
+
export * from './legacy/workflow/common/workflow-id.js';
|
|
3
|
+
export * from './legacy/workflow/inbound/build-inbound-workflow.js';
|
|
4
|
+
export * from './legacy/workflow/inbound/compile-inbound-workflow.js';
|
|
5
|
+
export * from './legacy/workflow/inbound/inbound-response.js';
|
|
6
|
+
export * from './legacy/workflow/request/base-url.js';
|
|
7
|
+
export * from './legacy/workflow/request/build-request-workflow.js';
|
|
8
|
+
export * from './legacy/workflow/request/build-sequence-workflow.js';
|
|
9
|
+
export * from './legacy/workflow/request/compile-catalog-sequence.js';
|
|
10
|
+
export * from './legacy/workflow/request/compile-sequence.js';
|
|
11
|
+
export * from './legacy/workflow/request/compile-workflow.js';
|
|
12
|
+
export * from './legacy/workflow/request/credential-binding.js';
|
|
13
|
+
export * from './legacy/workflow/request/effect-policy.js';
|
|
14
|
+
export * from './legacy/workflow/request/http-request-node.js';
|
|
15
|
+
export * from './legacy/workflow/request/prepare-sequence.js';
|
|
16
|
+
export * from './legacy/workflow/request/request-body.js';
|
|
17
|
+
export * from './legacy/workflow/request/request-headers.js';
|
|
18
|
+
export * from './legacy/workflow/request/request-url.js';
|
|
19
|
+
export * from './legacy/workflow/request/response-assertion-code.js';
|
|
20
|
+
export * from './legacy/workflow/request/sequence-url.js';
|
|
21
|
+
export type * from './types/legacy/catalog-workflow.js';
|
|
22
|
+
export type * from './types/legacy/inbound-workflow.js';
|
|
23
|
+
export type * from './types/legacy/request-node.js';
|
|
24
|
+
export type * from './types/legacy/request-workflow.js';
|
|
25
|
+
export type * from './types/legacy/sequence-workflow.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from './legacy/workflow/common/plan-validation.js';
|
|
2
|
+
export * from './legacy/workflow/common/workflow-id.js';
|
|
3
|
+
export * from './legacy/workflow/inbound/build-inbound-workflow.js';
|
|
4
|
+
export * from './legacy/workflow/inbound/compile-inbound-workflow.js';
|
|
5
|
+
export * from './legacy/workflow/inbound/inbound-response.js';
|
|
6
|
+
export * from './legacy/workflow/request/base-url.js';
|
|
7
|
+
export * from './legacy/workflow/request/build-request-workflow.js';
|
|
8
|
+
export * from './legacy/workflow/request/build-sequence-workflow.js';
|
|
9
|
+
export * from './legacy/workflow/request/compile-catalog-sequence.js';
|
|
10
|
+
export * from './legacy/workflow/request/compile-sequence.js';
|
|
11
|
+
export * from './legacy/workflow/request/compile-workflow.js';
|
|
12
|
+
export * from './legacy/workflow/request/credential-binding.js';
|
|
13
|
+
export * from './legacy/workflow/request/effect-policy.js';
|
|
14
|
+
export * from './legacy/workflow/request/http-request-node.js';
|
|
15
|
+
export * from './legacy/workflow/request/prepare-sequence.js';
|
|
16
|
+
export * from './legacy/workflow/request/request-body.js';
|
|
17
|
+
export * from './legacy/workflow/request/request-headers.js';
|
|
18
|
+
export * from './legacy/workflow/request/request-url.js';
|
|
19
|
+
export * from './legacy/workflow/request/response-assertion-code.js';
|
|
20
|
+
export * from './legacy/workflow/request/sequence-url.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CompileStandaloneValidatorInput } from '../../../types/schema-compilation.js';
|
|
2
|
+
/** Compile on the host; generated n8n nodes receive validators, not eval. */
|
|
3
|
+
export declare function compileStandaloneValidator({ schema, globalName, }: CompileStandaloneValidatorInput): string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Ajv2020 } from 'ajv/dist/2020.js';
|
|
2
|
+
import { _ } from 'ajv/dist/compile/codegen/index.js';
|
|
3
|
+
import addFormats from 'ajv-formats';
|
|
4
|
+
import standaloneCode from 'ajv/dist/standalone/index.js';
|
|
5
|
+
import { buildSync } from 'esbuild';
|
|
6
|
+
import { createRequire } from 'node:module';
|
|
7
|
+
import { dirname } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { bundledLicenseBanner } from '../../../utils/bundled-license-banner.js';
|
|
10
|
+
/** Compile on the host; generated n8n nodes receive validators, not eval. */
|
|
11
|
+
export function compileStandaloneValidator({ schema, globalName, }) {
|
|
12
|
+
const ajv = new Ajv2020({
|
|
13
|
+
strict: false,
|
|
14
|
+
allErrors: true,
|
|
15
|
+
discriminator: true,
|
|
16
|
+
code: {
|
|
17
|
+
source: true,
|
|
18
|
+
// Own the standalone format expression with this compiler's Code class.
|
|
19
|
+
formats: _ `require("ajv-formats/dist/formats").fullFormats`,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
addFormats.default(ajv);
|
|
23
|
+
const compiled = standaloneCode.default(ajv, ajv.compile(schema));
|
|
24
|
+
const built = buildSync({
|
|
25
|
+
stdin: { contents: compiled, resolveDir: import.meta.dirname },
|
|
26
|
+
bundle: true,
|
|
27
|
+
platform: 'browser',
|
|
28
|
+
format: 'iife',
|
|
29
|
+
globalName,
|
|
30
|
+
target: 'es2022',
|
|
31
|
+
minify: true,
|
|
32
|
+
write: false,
|
|
33
|
+
legalComments: 'inline',
|
|
34
|
+
metafile: true,
|
|
35
|
+
// Standard keywords stay intact. JSON equality must not inspect constructors.
|
|
36
|
+
alias: {
|
|
37
|
+
'ajv/dist/runtime/equal': fileURLToPath(new URL('../../../utils/json-values-equal.cjs', import.meta.url)),
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
const require = createRequire(import.meta.url);
|
|
41
|
+
return (bundledLicenseBanner(built.metafile, [
|
|
42
|
+
dirname(require.resolve('ajv/package.json')),
|
|
43
|
+
]) + built.outputFiles[0].text);
|
|
44
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { node } from '@n8n/workflow-sdk';
|
|
2
|
+
import { javascriptJsonLiteral } from '../../utils/javascript-json-literal.js';
|
|
3
|
+
export function createGapNode(input) {
|
|
4
|
+
if (!input.nodeId.trim() || !input.gaps.length)
|
|
5
|
+
throw new Error('gap node requires an ID and reported gaps');
|
|
6
|
+
const message = 'OPENAPI_FLOW_UNRESOLVED_STEP ' +
|
|
7
|
+
input.nodeId +
|
|
8
|
+
': ' +
|
|
9
|
+
input.gaps.map((gap) => gap.description).join('; ');
|
|
10
|
+
const placeholder = node({
|
|
11
|
+
type: 'n8n-nodes-base.code',
|
|
12
|
+
version: 2,
|
|
13
|
+
config: {
|
|
14
|
+
id: input.nodeId,
|
|
15
|
+
name: '확인 필요 · ' + input.nodeId,
|
|
16
|
+
position: input.position,
|
|
17
|
+
notes: '미해결 단계입니다. 실행하면 오류로 중단됩니다.',
|
|
18
|
+
notesInFlow: true,
|
|
19
|
+
onError: 'stopWorkflow',
|
|
20
|
+
parameters: {
|
|
21
|
+
mode: 'runOnceForAllItems',
|
|
22
|
+
language: 'javaScript',
|
|
23
|
+
jsCode: `throw new Error(${javascriptJsonLiteral(message)});`,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
nodeId: input.nodeId,
|
|
29
|
+
nodes: [placeholder],
|
|
30
|
+
entry: placeholder,
|
|
31
|
+
exit: placeholder,
|
|
32
|
+
inputPorts: { main: 0 },
|
|
33
|
+
outputPorts: { main: 0 },
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createWorkflowRuntimeInputsSchema } from '@openapi-flow/core';
|
|
3
|
+
import { createWorkflowInputValueMapSchema } from '../../schemas/workflow-input-value-map-schema.js';
|
|
4
|
+
import { javascriptJsonLiteral } from '../../utils/javascript-json-literal.js';
|
|
5
|
+
import { compileStandaloneValidator } from '../common/validation/compile-standalone-validator.js';
|
|
6
|
+
/** Preserve every original $id and local $ref by compiling slot roots separately. */
|
|
7
|
+
export function compileTemplateInputValidators(slots) {
|
|
8
|
+
const contract = createWorkflowRuntimeInputsSchema(slots);
|
|
9
|
+
const envelope = compileStandaloneValidator({
|
|
10
|
+
schema: z.toJSONSchema(createWorkflowInputValueMapSchema(Object.keys(contract.shape)), { io: 'input' }),
|
|
11
|
+
globalName: 'OpenApiFlowInputsValidator',
|
|
12
|
+
});
|
|
13
|
+
const values = Object.entries(contract.shape).map(([id, schema], index) => {
|
|
14
|
+
const name = `OpenApiFlowInputSlotValidator${index}`;
|
|
15
|
+
const validator = compileStandaloneValidator({
|
|
16
|
+
schema: z.toJSONSchema(schema, { io: 'input' }),
|
|
17
|
+
globalName: name,
|
|
18
|
+
});
|
|
19
|
+
const slot = slots.find((entry) => entry.id === id);
|
|
20
|
+
const presence = slot.kind === 'api-request-input' && slot.requestedInputs !== undefined
|
|
21
|
+
? `\n{const missing=OpenApiFlowRequestRuntime.listMissingRequestedApiInputs({source:${javascriptJsonLiteral('Runtime input ' + id)},rootPointer:${javascriptJsonLiteral(slot.targetPointer)},value:payload.values[${javascriptJsonLiteral(id)}],requestedInputs:${javascriptJsonLiteral(slot.requestedInputs)}});if(missing.length)throw new Error('Workflow input omits scenario-requested inputs: '+missing.join(', '));}`
|
|
22
|
+
: '';
|
|
23
|
+
return `${validator}\nif(!${name}(payload.values[${javascriptJsonLiteral(id)}]))throw new Error('Workflow inputs do not match declared slots: '+${javascriptJsonLiteral(id)}+': '+JSON.stringify(${name}.errors));${presence}`;
|
|
24
|
+
});
|
|
25
|
+
return `${envelope}\nif(!OpenApiFlowInputsValidator(payload.values))throw new Error('Workflow inputs do not match declared slots: '+JSON.stringify(OpenApiFlowInputsValidator.errors));\n${values.join('\n')}`;
|
|
26
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CreateTemplateInputNodesInput } from '../../types/workflow-template.js';
|
|
2
|
+
import type { N8nNodeFragment } from '../../types/node-fragment.js';
|
|
3
|
+
/** Compile immutable contracts; the user edits only the separate actual-value map. */
|
|
4
|
+
export declare function createTemplateInputNodes(input: CreateTemplateInputNodesInput): N8nNodeFragment[];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { node } from '@n8n/workflow-sdk';
|
|
3
|
+
import { javascriptJsonLiteral } from '../../utils/javascript-json-literal.js';
|
|
4
|
+
import { compileTemplateInputValidators } from './compile-template-input-validators.js';
|
|
5
|
+
import { compileRequestValidator } from '../request/bindings/compile-request-validator.js';
|
|
6
|
+
import { compileStandaloneValidator } from '../common/validation/compile-standalone-validator.js';
|
|
7
|
+
import { createNativeFragment } from '../native/common/create-native-fragment.js';
|
|
8
|
+
import { TEMPLATE_INPUT_ID, TEMPLATE_INPUT_NAME, TEMPLATE_PREFLIGHT_ID, TEMPLATE_PREFLIGHT_NAME, } from '../../workflow/templates/workflow-template-identities.js';
|
|
9
|
+
/** Compile immutable contracts; the user edits only the separate actual-value map. */
|
|
10
|
+
export function createTemplateInputNodes(input) {
|
|
11
|
+
const validators = compileTemplateInputValidators(input.slots);
|
|
12
|
+
const setup = node({
|
|
13
|
+
type: 'n8n-nodes-base.code',
|
|
14
|
+
version: 2,
|
|
15
|
+
config: {
|
|
16
|
+
id: TEMPLATE_INPUT_ID,
|
|
17
|
+
name: TEMPLATE_INPUT_NAME,
|
|
18
|
+
position: [220, 0],
|
|
19
|
+
notes: '실제 값은 inputValues 객체에 슬롯 ID를 키로 추가하세요. 미입력 키는 생략하세요. 타입·스키마·revision은 바꾸지 마세요. 인증 비밀값은 n8n credential에 설정하세요.',
|
|
20
|
+
notesInFlow: true,
|
|
21
|
+
parameters: {
|
|
22
|
+
mode: 'runOnceForAllItems',
|
|
23
|
+
jsCode: `// 실제 값만 입력하세요. 미입력 값에 임시 값을 넣지 마세요.\nconst inputValues=${javascriptJsonLiteral(input.inputValues)};\nreturn [{json:{revision:${input.revision},values:inputValues}}];`,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const runtime = readFileSync(new URL('../request/runtime/request-runtime.bundle.js', import.meta.url), 'utf8');
|
|
28
|
+
const nativeRuntime = readFileSync(new URL('../native/inputs/native-input-runtime.bundle.js', import.meta.url), 'utf8');
|
|
29
|
+
// A request without runtime response dependencies can be checked completely
|
|
30
|
+
// before any branch performs an external call. Dependent requests are checked
|
|
31
|
+
// again by their materializers after the actual producers have executed.
|
|
32
|
+
const earlyChecks = input.requests
|
|
33
|
+
.filter((request) => !request.arguments.bindings.length)
|
|
34
|
+
.map((request, index) => {
|
|
35
|
+
const name = `OpenApiFlowInitialRequestValidator${index}`;
|
|
36
|
+
return `${compileRequestValidator(request, name)}\nOpenApiFlowRequestRuntime.materializeHttpRequest(${javascriptJsonLiteral(request)},Object.create(null),${name},payload.values);`;
|
|
37
|
+
});
|
|
38
|
+
const nativeChecks = input.nativeParameters.map((material, index) => {
|
|
39
|
+
const name = `OpenApiFlowInitialNativeValidator${index}`;
|
|
40
|
+
return `${compileStandaloneValidator({ schema: material.schema, globalName: name })}\n{const parameters=OpenApiFlowNativeInputRuntime.materializeNativeRuntimeParameters(${javascriptJsonLiteral(material)},payload.values);if(!${name}(parameters))throw new Error('Native runtime input violates complete original schema for '+${javascriptJsonLiteral(material.nodeId)}+': '+JSON.stringify(${name}.errors));}`;
|
|
41
|
+
});
|
|
42
|
+
const preflight = node({
|
|
43
|
+
type: 'n8n-nodes-base.code',
|
|
44
|
+
version: 2,
|
|
45
|
+
config: {
|
|
46
|
+
id: TEMPLATE_PREFLIGHT_ID,
|
|
47
|
+
name: TEMPLATE_PREFLIGHT_NAME,
|
|
48
|
+
position: [440, 0],
|
|
49
|
+
notes: '모든 초기 입력을 외부 호출 전에 검사합니다. 선행 응답을 사용하는 요청은 해당 응답을 합친 후 전송 직전에 전체 OAS를 다시 검사합니다. 부분 실행·pinning으로 검사를 건너뛰지 마세요.',
|
|
50
|
+
notesInFlow: true,
|
|
51
|
+
parameters: {
|
|
52
|
+
mode: 'runOnceForAllItems',
|
|
53
|
+
jsCode: `${runtime}\n${nativeRuntime}\nconst items=$input.all();if(items.length!==1)throw new Error('Workflow input setup requires exactly one JSON item');const payload=items[0].json;if(!payload||payload.revision!==${input.revision})throw new Error('Missing or stale workflow input revision');\n${validators}\n${nativeChecks.join('\n')}\n${earlyChecks.join('\n')}\nreturn [{json:payload,pairedItem:{item:0}}];`,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
return [
|
|
58
|
+
createNativeFragment(setup, ['main'], ['main']),
|
|
59
|
+
createNativeFragment(preflight, ['main'], ['main']),
|
|
60
|
+
];
|
|
61
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CreateArrayNodeFragmentInput } from '../../../types/array-split.js';
|
|
2
|
+
import type { N8nNodeFragment } from '../../../types/node-fragment.js';
|
|
3
|
+
/** Share SDK array mechanics without merging API and native source contracts. */
|
|
4
|
+
export declare function createArrayNodeFragment({ planned, position, source, parameters, linked, }: CreateArrayNodeFragmentInput): N8nNodeFragment;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { node } from '@n8n/workflow-sdk';
|
|
2
|
+
import { createArrayReaderCode } from './create-array-reader-code.js';
|
|
3
|
+
/** Share SDK array mechanics without merging API and native source contracts. */
|
|
4
|
+
export function createArrayNodeFragment({ planned, position, source, parameters, linked, }) {
|
|
5
|
+
const extract = node({
|
|
6
|
+
type: 'n8n-nodes-base.code',
|
|
7
|
+
version: 2,
|
|
8
|
+
config: {
|
|
9
|
+
id: `${planned.id}-read-array`,
|
|
10
|
+
name: `Read array ${planned.id}`,
|
|
11
|
+
position,
|
|
12
|
+
parameters: {
|
|
13
|
+
mode: 'runOnceForAllItems',
|
|
14
|
+
jsCode: createArrayReaderCode(source, parameters, linked),
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
const split = node({
|
|
19
|
+
type: 'n8n-nodes-base.splitOut',
|
|
20
|
+
version: 1,
|
|
21
|
+
config: {
|
|
22
|
+
id: planned.id,
|
|
23
|
+
name: planned.id,
|
|
24
|
+
position: [position[0] + 220, position[1]],
|
|
25
|
+
parameters: {
|
|
26
|
+
fieldToSplitOut: 'items',
|
|
27
|
+
include: 'noOtherFields',
|
|
28
|
+
options: { destinationFieldName: 'item', disableDotNotation: true },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
nodeId: planned.id,
|
|
34
|
+
bindingSources: [source],
|
|
35
|
+
nodes: [extract, split],
|
|
36
|
+
entry: extract,
|
|
37
|
+
exit: split,
|
|
38
|
+
inputPorts: { main: 0 },
|
|
39
|
+
outputPorts: { main: 0 },
|
|
40
|
+
internalEdges: [{ from: extract.id, output: 0, to: split.id, input: 0 }],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { N8nOutputBindingSource } from '../../../types/output-binding-source.js';
|
|
2
|
+
import type { ArraySplitParameters } from '../../../types/array-split.js';
|
|
3
|
+
export declare function createArrayReaderCode(source: N8nOutputBindingSource, parameters: ArraySplitParameters, linked: boolean): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { createOutputReaderCode } from '../../request/bindings/create-output-reader-code.js';
|
|
3
|
+
import { javascriptJsonLiteral } from '../../../utils/javascript-json-literal.js';
|
|
4
|
+
export function createArrayReaderCode(source, parameters, linked) {
|
|
5
|
+
const runtime = readFileSync(new URL('../../request/runtime/request-runtime.bundle.js', import.meta.url), 'utf8');
|
|
6
|
+
const read = createOutputReaderCode([source], linked);
|
|
7
|
+
const extract = `${read}\nconst parameters=${javascriptJsonLiteral(parameters)};\nconst array=OpenApiFlowRequestRuntime.pointerValue(responses[parameters.sourceNodeId],parameters.pointer);if(array===undefined)throw new Error('Missing array pointer '+parameters.sourceNodeId+parameters.pointer);if(!Array.isArray(array))throw new Error('Output '+parameters.sourceNodeId+parameters.pointer+' must be an array');`;
|
|
8
|
+
const iteration = linked
|
|
9
|
+
? `return inputItems.map((_,inputIndex)=>{${extract}\nreturn {json:{items:array},pairedItem:{item:inputIndex}};});`
|
|
10
|
+
: `if(inputItems.length!==1)throw new Error('Array extraction requires one input item; got '+inputItems.length);\n${extract}\nreturn [{json:{items:array},pairedItem:{item:0}}];`;
|
|
11
|
+
return `${runtime}\nconst inputItems=$input.all();\n${iteration}`;
|
|
12
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { N8nNativeCapability } from '../../../types/native-capability.js';
|
|
2
|
+
import type { BoundNativeArrayCapabilityInput } from '../../../types/native-material-binding.js';
|
|
3
|
+
/** Data-contract binding is independent of runtime SDK producer names. */
|
|
4
|
+
export declare function createBoundNativeArrayCapability(input: BoundNativeArrayCapabilityInput): N8nNativeCapability;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { defineMaterialBoundCapability } from '../common/define-material-bound-capability.js';
|
|
2
|
+
import { createNativeArrayItemSchema, validateNativeOutputContracts, } from '@openapi-flow/core';
|
|
3
|
+
import { createNativeArrayParametersSchema } from '../../../schemas/native-array-schema.js';
|
|
4
|
+
import { nativeArrayDefinition } from './native-array-definition.js';
|
|
5
|
+
import { createArrayNodeFragment } from './create-array-node-fragment.js';
|
|
6
|
+
import { resolveNativeRuntimeSource } from '../common/resolve-native-runtime-source.js';
|
|
7
|
+
/** Data-contract binding is independent of runtime SDK producer names. */
|
|
8
|
+
export function createBoundNativeArrayCapability(input) {
|
|
9
|
+
if (input.itemMode !== undefined && input.itemMode !== 'linked')
|
|
10
|
+
throw new Error('native array capability: itemMode must be linked or omitted');
|
|
11
|
+
validateNativeOutputContracts(input.sources);
|
|
12
|
+
if (!input.sources.length)
|
|
13
|
+
throw new Error('native array capability requires source contracts');
|
|
14
|
+
const contracts = input.sources.map(({ nodeId, schema }) => ({
|
|
15
|
+
nodeId,
|
|
16
|
+
schema,
|
|
17
|
+
}));
|
|
18
|
+
const sources = new Map(contracts.map((source) => [source.nodeId, source]));
|
|
19
|
+
const parametersSchema = createNativeArrayParametersSchema([
|
|
20
|
+
...sources.keys(),
|
|
21
|
+
]);
|
|
22
|
+
function source(parameters) {
|
|
23
|
+
const output = sources.get(parameters.sourceNodeId);
|
|
24
|
+
if (!output)
|
|
25
|
+
throw new Error(`native array: unknown sourceNodeId ${parameters.sourceNodeId}`);
|
|
26
|
+
createNativeArrayItemSchema(output, parameters.pointer);
|
|
27
|
+
return output;
|
|
28
|
+
}
|
|
29
|
+
return defineMaterialBoundCapability({
|
|
30
|
+
...nativeArrayDefinition,
|
|
31
|
+
parametersSchema,
|
|
32
|
+
materialSources: {
|
|
33
|
+
apiMaterials: [],
|
|
34
|
+
nativeOutputs: structuredClone(contracts),
|
|
35
|
+
},
|
|
36
|
+
bindMaterialContracts: (contracts) => createBoundNativeArrayCapability({
|
|
37
|
+
sources: contracts.nativeOutputs,
|
|
38
|
+
itemMode: input.itemMode,
|
|
39
|
+
runtime: { kind: 'compiled' },
|
|
40
|
+
}),
|
|
41
|
+
responseReferences: () => [],
|
|
42
|
+
nodeOutputReferences: (values) => {
|
|
43
|
+
const parameters = parametersSchema.parse(values);
|
|
44
|
+
source(parameters);
|
|
45
|
+
return [
|
|
46
|
+
{
|
|
47
|
+
source: 'node-output',
|
|
48
|
+
nodeId: parameters.sourceNodeId,
|
|
49
|
+
pointer: parameters.pointer,
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
},
|
|
53
|
+
outputSchema: (values) => {
|
|
54
|
+
const parameters = parametersSchema.parse(values);
|
|
55
|
+
return {
|
|
56
|
+
type: 'object',
|
|
57
|
+
properties: {
|
|
58
|
+
item: createNativeArrayItemSchema(source(parameters), parameters.pointer),
|
|
59
|
+
},
|
|
60
|
+
required: ['item'],
|
|
61
|
+
additionalProperties: false,
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
compile: ({ planned, position, nativeOutputSources }) => {
|
|
65
|
+
const parameters = parametersSchema.parse(planned.parameters);
|
|
66
|
+
const runtime = resolveNativeRuntimeSource({
|
|
67
|
+
binding: input.runtime,
|
|
68
|
+
contract: source(parameters),
|
|
69
|
+
compiledSources: nativeOutputSources,
|
|
70
|
+
consumerId: planned.id,
|
|
71
|
+
});
|
|
72
|
+
return createArrayNodeFragment({
|
|
73
|
+
planned,
|
|
74
|
+
position,
|
|
75
|
+
source: { ...runtime, kind: 'native-json' },
|
|
76
|
+
parameters,
|
|
77
|
+
linked: input.itemMode === 'linked',
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { N8nNativeCapability } from '../../../types/native-capability.js';
|
|
2
|
+
import type { CreateNativeArrayCapabilityInput } from '../../../types/native-array.js';
|
|
3
|
+
/** Existing explicitly named sources remain an immutable binding. New revisions bind contracts separately. */
|
|
4
|
+
export declare function createNativeArrayCapability(input: CreateNativeArrayCapabilityInput): N8nNativeCapability;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createBoundNativeArrayCapability } from './create-bound-native-array-capability.js';
|
|
2
|
+
/** Existing explicitly named sources remain an immutable binding. New revisions bind contracts separately. */
|
|
3
|
+
export function createNativeArrayCapability(input) {
|
|
4
|
+
if (!input.sources.length ||
|
|
5
|
+
input.sources.some((source) => typeof source.nodeName !== 'string' || !source.nodeName.trim()))
|
|
6
|
+
throw new Error('native array capability requires sources with compiled names');
|
|
7
|
+
return createBoundNativeArrayCapability({
|
|
8
|
+
sources: input.sources,
|
|
9
|
+
itemMode: input.itemMode,
|
|
10
|
+
runtime: { kind: 'provided', sources: input.sources },
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { nativeArrayParametersSchema } from '../../../schemas/native-array-schema.js';
|
|
2
|
+
export const nativeArrayDefinition = {
|
|
3
|
+
name: 'split-native-output-array',
|
|
4
|
+
materialRequirements: [{ field: 'nativeOutputs', minimumItems: 1 }],
|
|
5
|
+
description: 'Split a supplied native JSON output array into {item: unchangedElement} using official n8n Split Out. Validate the full native output schema first. Linked mode preserves parent ancestry across nested splits. Empty arrays emit no child items; never convert, flatten or fabricate values.',
|
|
6
|
+
parametersSchema: nativeArrayParametersSchema,
|
|
7
|
+
parameterReferenceSources: ['node-output'],
|
|
8
|
+
inputPorts: () => ['main'],
|
|
9
|
+
outputPorts: () => ['main'],
|
|
10
|
+
referenceStructureSchema: nativeArrayParametersSchema,
|
|
11
|
+
parameterReferenceBindings: (values) => {
|
|
12
|
+
const parameters = nativeArrayParametersSchema.parse(values);
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
nodeIdPointer: '/sourceNodeId',
|
|
16
|
+
valuePointer: '/pointer',
|
|
17
|
+
reference: {
|
|
18
|
+
source: 'node-output',
|
|
19
|
+
nodeId: parameters.sourceNodeId,
|
|
20
|
+
pointer: parameters.pointer,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
},
|
|
25
|
+
waitsForAllInputs: false,
|
|
26
|
+
exclusiveOutputPorts: false,
|
|
27
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { N8nNativeCapability } from '../../../types/native-capability.js';
|
|
2
|
+
import type { NativeMaterialFeatureDefinition } from '../../../types/native-material-binding.js';
|
|
3
|
+
/** A stable implementation definition, not a ready output contract or executable node. */
|
|
4
|
+
export declare function createMaterialPlanningCapability(definition: NativeMaterialFeatureDefinition, bind: NonNullable<N8nNativeCapability['bindMaterialContracts']>): N8nNativeCapability;
|