@openapi-flow/core 0.1.0 → 0.2.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/README.md +27 -5
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/arguments/list-api-request-media-types.d.ts +2 -0
- package/dist/arguments/list-api-request-media-types.js +8 -0
- package/dist/arguments/request-contract.d.ts +4 -0
- package/dist/arguments/request-contract.js +38 -0
- package/dist/arguments/request-media-type-priority.d.ts +2 -0
- package/dist/arguments/request-media-type-priority.js +8 -0
- package/dist/arguments/select-default-api-request-media-type.d.ts +3 -0
- package/dist/arguments/select-default-api-request-media-type.js +17 -0
- package/dist/arguments/validate-api-arguments.d.ts +2 -0
- package/dist/arguments/validate-api-arguments.js +140 -0
- package/dist/bindings/combine-binding-schemas.d.ts +4 -0
- package/dist/bindings/combine-binding-schemas.js +17 -0
- package/dist/bindings/create-native-array-item-schema.d.ts +4 -0
- package/dist/bindings/create-native-array-item-schema.js +16 -0
- package/dist/bindings/json-pointer.d.ts +3 -0
- package/dist/bindings/json-pointer.js +24 -0
- package/dist/bindings/materialize-api-arguments.d.ts +4 -0
- package/dist/bindings/materialize-api-arguments.js +54 -0
- package/dist/bindings/native-binding-schema.d.ts +3 -0
- package/dist/bindings/native-binding-schema.js +6 -0
- package/dist/bindings/project-array-item-schema.d.ts +5 -0
- package/dist/bindings/project-array-item-schema.js +67 -0
- package/dist/bindings/request-binding-schema.d.ts +2 -0
- package/dist/bindings/request-binding-schema.js +23 -0
- package/dist/bindings/request-container-kind.d.ts +3 -0
- package/dist/bindings/request-container-kind.js +17 -0
- package/dist/bindings/resources/clone-schema-resource.d.ts +3 -0
- package/dist/bindings/resources/clone-schema-resource.js +38 -0
- package/dist/bindings/resources/create-schema-resource-context.d.ts +4 -0
- package/dist/bindings/resources/create-schema-resource-context.js +130 -0
- package/dist/bindings/response-binding-schema.d.ts +3 -0
- package/dist/bindings/response-binding-schema.js +21 -0
- package/dist/bindings/schema-allows-container.d.ts +3 -0
- package/dist/bindings/schema-allows-container.js +20 -0
- package/dist/bindings/schema-at-pointer.d.ts +4 -0
- package/dist/bindings/schema-at-pointer.js +89 -0
- package/dist/bindings/validate-api-binding-assignments.d.ts +2 -0
- package/dist/bindings/validate-api-binding-assignments.js +81 -0
- package/dist/bindings/validate-api-binding-gaps.d.ts +2 -0
- package/dist/bindings/validate-api-binding-gaps.js +10 -0
- package/dist/bindings/validate-api-binding-plan.d.ts +3 -0
- package/dist/bindings/validate-api-binding-plan.js +11 -0
- package/dist/bindings/validate-native-output-contracts.d.ts +3 -0
- package/dist/bindings/validate-native-output-contracts.js +16 -0
- package/dist/internal-api.d.ts +30 -0
- package/dist/internal-api.js +25 -0
- package/dist/openapi/catalog/create-api-catalog.d.ts +2 -0
- package/dist/openapi/catalog/create-api-catalog.js +34 -0
- package/dist/openapi/catalog/list-api-operations.d.ts +2 -0
- package/dist/openapi/catalog/list-api-operations.js +3 -0
- package/dist/openapi/common/check-oas-value.d.ts +3 -0
- package/dist/openapi/common/check-oas-value.js +6 -0
- package/dist/openapi/common/check-schema-value.d.ts +2 -0
- package/dist/openapi/common/check-schema-value.js +12 -0
- package/dist/openapi/common/create-oas-value-validator.d.ts +3 -0
- package/dist/openapi/common/create-oas-value-validator.js +39 -0
- package/dist/openapi/common/normalize-oas-value-schema.d.ts +4 -0
- package/dist/openapi/common/normalize-oas-value-schema.js +50 -0
- package/dist/openapi/common/operation-metadata.d.ts +2 -0
- package/dist/openapi/common/operation-metadata.js +25 -0
- package/dist/openapi/common/operation-reference.d.ts +3 -0
- package/dist/openapi/{operation-reference.js → common/operation-reference.js} +1 -4
- package/dist/openapi/common/parse-spec-utils.d.ts +3 -0
- package/dist/openapi/common/parse-spec-utils.js +12 -0
- package/dist/openapi/common/resolve-openapi-security.d.ts +3 -0
- package/dist/openapi/common/resolve-openapi-security.js +28 -0
- package/dist/openapi/common/unsupported-operation-error.d.ts +4 -0
- package/dist/openapi/common/unsupported-operation-error.js +8 -0
- package/dist/openapi/common/validate-spec.d.ts +3 -0
- package/dist/openapi/{validate-spec.js → common/validate-spec.js} +2 -1
- package/dist/openapi/inbound/callback/parse-callback-operations.d.ts +3 -0
- package/dist/openapi/inbound/callback/parse-callback-operations.js +31 -0
- package/dist/openapi/inbound/inbound-path-item-operations.d.ts +4 -0
- package/dist/openapi/inbound/inbound-path-item-operations.js +31 -0
- package/dist/openapi/inbound/list-inbound-operations.d.ts +4 -0
- package/dist/openapi/inbound/list-inbound-operations.js +13 -0
- package/dist/openapi/inbound/webhook/parse-webhook-operations.d.ts +3 -0
- package/dist/openapi/inbound/webhook/parse-webhook-operations.js +13 -0
- package/dist/openapi/request/create-operation-catalog.d.ts +2 -0
- package/dist/openapi/request/create-operation-catalog.js +24 -0
- package/dist/openapi/request/encode-form-field.d.ts +2 -0
- package/dist/openapi/request/encode-form-field.js +6 -0
- package/dist/openapi/request/map-http-operation-contract.d.ts +4 -0
- package/dist/openapi/request/map-http-operation-contract.js +21 -0
- package/dist/openapi/request/operation-mapping.d.ts +3 -0
- package/dist/openapi/request/operation-mapping.js +10 -0
- package/dist/openapi/request/parse-operation-responses.d.ts +3 -0
- package/dist/openapi/request/parse-operation-responses.js +30 -0
- package/dist/openapi/request/parse-request-body.d.ts +3 -0
- package/dist/openapi/request/parse-request-body.js +29 -0
- package/dist/openapi/request/parse-request-operations.d.ts +7 -0
- package/dist/openapi/request/parse-request-operations.js +50 -0
- package/dist/openapi/request/parse-request-parameters.d.ts +3 -0
- package/dist/openapi/request/parse-request-parameters.js +93 -0
- package/dist/openapi/request/parse-security.d.ts +3 -0
- package/dist/openapi/request/parse-security.js +31 -0
- package/dist/openapi/request/request-operation-reference.d.ts +1 -0
- package/dist/openapi/request/request-operation-reference.js +4 -0
- package/dist/openapi/request/response-contract.d.ts +6 -0
- package/dist/openapi/request/response-contract.js +32 -0
- package/dist/openapi/request/scalar-response-schema.d.ts +2 -0
- package/dist/openapi/request/scalar-response-schema.js +20 -0
- package/dist/openapi/request/serialize-form-body.d.ts +3 -0
- package/dist/openapi/request/serialize-form-body.js +89 -0
- package/dist/openapi/request/serialize-parameter.d.ts +5 -0
- package/dist/openapi/request/serialize-parameter.js +145 -0
- package/dist/openapi/resolve-api-operations.d.ts +3 -0
- package/dist/openapi/resolve-api-operations.js +84 -0
- package/dist/openapi/response/api-response-validation-value.d.ts +3 -0
- package/dist/openapi/response/api-response-validation-value.js +21 -0
- package/dist/openapi/response/create-api-response-schema.d.ts +4 -0
- package/dist/openapi/response/create-api-response-schema.js +114 -0
- package/dist/openapi/response/create-response-array-item-schema.d.ts +4 -0
- package/dist/openapi/response/create-response-array-item-schema.js +12 -0
- package/dist/openapi/response/create-response-value-schema.d.ts +4 -0
- package/dist/openapi/response/create-response-value-schema.js +8 -0
- package/dist/openapi/response/list-api-response-pointers.d.ts +4 -0
- package/dist/openapi/response/list-api-response-pointers.js +30 -0
- package/dist/openapi/response/list-declared-schema-pointers.d.ts +4 -0
- package/dist/openapi/response/list-declared-schema-pointers.js +91 -0
- package/dist/public-api.d.ts +49 -7
- package/dist/public-api.js +35 -5
- package/dist/runtime-api.d.ts +6 -0
- package/dist/runtime-api.js +7 -0
- package/dist/schemas/create-api-argument-generation-contract.d.ts +4 -0
- package/dist/schemas/create-api-argument-generation-contract.js +72 -0
- package/dist/schemas/create-api-arguments-schema.d.ts +3 -0
- package/dist/schemas/create-api-arguments-schema.js +4 -0
- package/dist/schemas/create-api-request-schema.d.ts +4 -0
- package/dist/schemas/create-api-request-schema.js +50 -0
- package/dist/schemas/create-oas-value-schema.d.ts +6 -0
- package/dist/schemas/create-oas-value-schema.js +25 -0
- package/dist/schemas/operation-plan-schema.d.ts +8 -0
- package/dist/schemas/operation-plan-schema.js +99 -0
- package/dist/schemas/project-literal-array-schema.d.ts +4 -0
- package/dist/schemas/project-literal-array-schema.js +55 -0
- package/dist/schemas/project-literal-input-schema.d.ts +3 -0
- package/dist/schemas/project-literal-input-schema.js +129 -0
- package/dist/types/api-argument-generation.d.ts +13 -0
- package/dist/types/api-arguments.d.ts +42 -0
- package/dist/types/api-arguments.js +1 -0
- package/dist/types/api-bindings.d.ts +34 -0
- package/dist/types/api-bindings.js +1 -0
- package/dist/types/api-catalog.d.ts +34 -0
- package/dist/types/api-catalog.js +1 -0
- package/dist/types/api-operation.d.ts +26 -0
- package/dist/types/api-operation.js +1 -0
- package/dist/types/api-response-pointers.d.ts +20 -0
- package/dist/types/api-response-pointers.js +1 -0
- package/dist/types/api-response.d.ts +14 -0
- package/dist/types/api-response.js +1 -0
- package/dist/types/array-projection.d.ts +5 -0
- package/dist/types/array-projection.js +1 -0
- package/dist/types/catalog.d.ts +17 -0
- package/dist/types/catalog.js +1 -0
- package/dist/types/inbound.d.ts +18 -0
- package/dist/types/inbound.js +1 -0
- package/dist/types/legacy-plan.d.ts +47 -0
- package/dist/types/legacy-plan.js +1 -0
- package/dist/types/node-output.d.ts +11 -0
- package/dist/types/node-output.js +1 -0
- package/dist/types/oas-value-validation.d.ts +8 -0
- package/dist/types/oas-value-validation.js +1 -0
- package/dist/types/openapi.d.ts +7 -23
- package/dist/types/request.d.ts +41 -0
- package/dist/types/request.js +1 -0
- package/dist/types/reviewable-workflow.d.ts +53 -0
- package/dist/types/reviewable-workflow.js +1 -0
- package/dist/types/schema-dialect.d.ts +1 -0
- package/dist/types/schema-dialect.js +1 -0
- package/dist/types/schema-json.d.ts +4 -0
- package/dist/types/schema-json.js +1 -0
- package/dist/types/schema-resource.d.ts +12 -0
- package/dist/types/schema-resource.js +1 -0
- package/dist/types/security.d.ts +17 -0
- package/dist/types/security.js +1 -0
- package/dist/types/workflow-capability-planning.d.ts +10 -0
- package/dist/types/workflow-capability-planning.js +1 -0
- package/dist/types/workflow-plan.d.ts +104 -0
- package/dist/types/workflow-plan.js +1 -0
- package/dist/utils/is-object.d.ts +2 -0
- package/dist/utils/is-object.js +3 -0
- package/dist/utils/json-values-equal.d.ts +2 -0
- package/dist/utils/json-values-equal.js +16 -0
- package/dist/workflow/assert-api-call-identities.d.ts +1 -0
- package/dist/workflow/assert-api-call-identities.js +6 -0
- package/dist/workflow/create-native-output-contracts.d.ts +3 -0
- package/dist/workflow/create-native-output-contracts.js +23 -0
- package/dist/workflow/create-reviewable-node-contracts.d.ts +3 -0
- package/dist/workflow/create-reviewable-node-contracts.js +36 -0
- package/dist/workflow/create-reviewable-workflow-graph-plan.d.ts +2 -0
- package/dist/workflow/create-reviewable-workflow-graph-plan.js +29 -0
- package/dist/workflow/create-workflow-graph-plan.d.ts +2 -0
- package/dist/workflow/create-workflow-graph-plan.js +17 -0
- package/dist/workflow/create-workflow-node-contracts.d.ts +2 -0
- package/dist/workflow/create-workflow-node-contracts.js +50 -0
- package/dist/workflow/create-workflow-planning-capabilities.d.ts +3 -0
- package/dist/workflow/create-workflow-planning-capabilities.js +20 -0
- package/dist/workflow/parse-native-node-parameters.d.ts +3 -0
- package/dist/workflow/parse-native-node-parameters.js +7 -0
- package/dist/workflow/validate-exclusive-output-rejoin.d.ts +3 -0
- package/dist/workflow/validate-exclusive-output-rejoin.js +26 -0
- package/dist/workflow/validate-native-api-response-references.d.ts +2 -0
- package/dist/workflow/validate-native-api-response-references.js +26 -0
- package/dist/workflow/validate-reviewable-workflow-graph-plan.d.ts +2 -0
- package/dist/workflow/validate-reviewable-workflow-graph-plan.js +98 -0
- package/dist/workflow/validate-workflow-edges.d.ts +2 -0
- package/dist/workflow/validate-workflow-edges.js +19 -0
- package/dist/workflow/validate-workflow-graph-plan.d.ts +3 -0
- package/dist/workflow/validate-workflow-graph-plan.js +41 -0
- package/dist/workflow/validate-workflow-topology.d.ts +2 -0
- package/dist/workflow/validate-workflow-topology.js +105 -0
- package/package.json +19 -25
- package/dist/openapi/operation-reference.d.ts +0 -3
- package/dist/openapi/parse-spec-utils.d.ts +0 -5
- package/dist/openapi/parse-spec-utils.js +0 -52
- package/dist/openapi/parse-spec.d.ts +0 -5
- package/dist/openapi/parse-spec.js +0 -182
- package/dist/openapi/validate-spec.d.ts +0 -3
- package/dist/planning/generate-workflow.d.ts +0 -2
- package/dist/planning/generate-workflow.js +0 -126
- package/dist/schemas/planning-schemas.d.ts +0 -62
- package/dist/schemas/planning-schemas.js +0 -48
- package/dist/types/workflow.d.ts +0 -75
- package/dist/utils/validation.d.ts +0 -7
- package/dist/utils/validation.js +0 -44
- package/dist/utils/workflow-id.d.ts +0 -1
- package/dist/utils/workflow-id.js +0 -8
- package/dist/workflow/compile-sequence.d.ts +0 -2
- package/dist/workflow/compile-sequence.js +0 -167
- package/dist/workflow/compile-workflow.d.ts +0 -4
- package/dist/workflow/compile-workflow.js +0 -128
- package/dist/workflow/sequence-url.d.ts +0 -3
- package/dist/workflow/sequence-url.js +0 -81
- package/dist/workflow/workflow-helpers.d.ts +0 -6
- package/dist/workflow/workflow-helpers.js +0 -81
- /package/dist/types/{workflow.js → api-argument-generation.js} +0 -0
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { checkPrimitive, isObject, looksLikeCredential, } from '../utils/validation.js';
|
|
2
|
-
export function isSafeMethod(method) {
|
|
3
|
-
return ['GET', 'HEAD', 'OPTIONS', 'TRACE', 'QUERY'].includes(method);
|
|
4
|
-
}
|
|
5
|
-
export function makeUrl(operation, origin, inputs, missing) {
|
|
6
|
-
let path = operation.path;
|
|
7
|
-
for (const parameter of operation.parameters) {
|
|
8
|
-
const key = parameter.in + '.' + parameter.name;
|
|
9
|
-
const value = inputs[key];
|
|
10
|
-
if (value === undefined) {
|
|
11
|
-
if (parameter.required)
|
|
12
|
-
missing.push(key);
|
|
13
|
-
continue;
|
|
14
|
-
}
|
|
15
|
-
checkPrimitive(value, parameter.schema, 'plan.inputs.' + key);
|
|
16
|
-
if (parameter.in === 'path')
|
|
17
|
-
path = path.replace('{' + parameter.name + '}', encodeURIComponent(String(value)));
|
|
18
|
-
}
|
|
19
|
-
const url = new URL(path, origin);
|
|
20
|
-
for (const parameter of operation.parameters) {
|
|
21
|
-
if (parameter.in !== 'query')
|
|
22
|
-
continue;
|
|
23
|
-
const key = 'query.' + parameter.name;
|
|
24
|
-
if (inputs[key] !== undefined)
|
|
25
|
-
url.searchParams.set(parameter.name, String(inputs[key]));
|
|
26
|
-
}
|
|
27
|
-
return url.href;
|
|
28
|
-
}
|
|
29
|
-
export function makeBody(operation, inputs, missing) {
|
|
30
|
-
if (!operation.body)
|
|
31
|
-
return undefined;
|
|
32
|
-
const value = inputs.body;
|
|
33
|
-
if (value === undefined) {
|
|
34
|
-
if (operation.body.required)
|
|
35
|
-
missing.push('body');
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
if (!isObject(value))
|
|
39
|
-
throw new Error('plan.inputs.body must be an object');
|
|
40
|
-
for (const [name, field] of Object.entries(value)) {
|
|
41
|
-
const schema = operation.body.properties[name];
|
|
42
|
-
if (!schema)
|
|
43
|
-
throw new Error('plan.inputs.body.' + name + ' is not declared in the OAS schema');
|
|
44
|
-
if (looksLikeCredential(name)) {
|
|
45
|
-
throw new Error('plan.inputs.body.' +
|
|
46
|
-
name +
|
|
47
|
-
' looks like a credential; v1 has no credential binding');
|
|
48
|
-
}
|
|
49
|
-
checkPrimitive(field, schema, 'plan.inputs.body.' + name);
|
|
50
|
-
}
|
|
51
|
-
for (const name of operation.body.requiredProperties) {
|
|
52
|
-
if (!Object.hasOwn(value, name))
|
|
53
|
-
missing.push('body.' + name);
|
|
54
|
-
}
|
|
55
|
-
return JSON.stringify(value);
|
|
56
|
-
}
|
|
57
|
-
export function assertionCode(status, expectedBody, requiredFields = {}) {
|
|
58
|
-
const expected = JSON.stringify(expectedBody);
|
|
59
|
-
const required = JSON.stringify(requiredFields);
|
|
60
|
-
return [
|
|
61
|
-
'const items = $input.all();',
|
|
62
|
-
"if (items.length !== 1) throw new Error('Expected one response item');",
|
|
63
|
-
'const response = items[0].json;',
|
|
64
|
-
'if (response.statusCode !== ' +
|
|
65
|
-
status +
|
|
66
|
-
') throw new Error("Expected HTTP ' +
|
|
67
|
-
status +
|
|
68
|
-
', got " + response.statusCode);',
|
|
69
|
-
'const expected = ' + expected + ';',
|
|
70
|
-
'const required = ' + required + ';',
|
|
71
|
-
'for (const [key, type] of Object.entries(required)) {',
|
|
72
|
-
' const value = response.body?.[key];',
|
|
73
|
-
' const valid = type === "integer" ? Number.isSafeInteger(value) : type === "number" ? typeof value === "number" && Number.isFinite(value) : typeof value === type;',
|
|
74
|
-
' if (!valid) throw new Error("Missing or invalid response body field: " + key);',
|
|
75
|
-
'}',
|
|
76
|
-
'for (const [key, value] of Object.entries(expected)) {',
|
|
77
|
-
' if (response.body?.[key] !== value) throw new Error("Unexpected response body field: " + key);',
|
|
78
|
-
'}',
|
|
79
|
-
'return items;',
|
|
80
|
-
].join('\n');
|
|
81
|
-
}
|
|
File without changes
|