@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.
Files changed (239) hide show
  1. package/README.md +27 -5
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/dist/arguments/list-api-request-media-types.d.ts +2 -0
  4. package/dist/arguments/list-api-request-media-types.js +8 -0
  5. package/dist/arguments/request-contract.d.ts +4 -0
  6. package/dist/arguments/request-contract.js +38 -0
  7. package/dist/arguments/request-media-type-priority.d.ts +2 -0
  8. package/dist/arguments/request-media-type-priority.js +8 -0
  9. package/dist/arguments/select-default-api-request-media-type.d.ts +3 -0
  10. package/dist/arguments/select-default-api-request-media-type.js +17 -0
  11. package/dist/arguments/validate-api-arguments.d.ts +2 -0
  12. package/dist/arguments/validate-api-arguments.js +140 -0
  13. package/dist/bindings/combine-binding-schemas.d.ts +4 -0
  14. package/dist/bindings/combine-binding-schemas.js +17 -0
  15. package/dist/bindings/create-native-array-item-schema.d.ts +4 -0
  16. package/dist/bindings/create-native-array-item-schema.js +16 -0
  17. package/dist/bindings/json-pointer.d.ts +3 -0
  18. package/dist/bindings/json-pointer.js +24 -0
  19. package/dist/bindings/materialize-api-arguments.d.ts +4 -0
  20. package/dist/bindings/materialize-api-arguments.js +54 -0
  21. package/dist/bindings/native-binding-schema.d.ts +3 -0
  22. package/dist/bindings/native-binding-schema.js +6 -0
  23. package/dist/bindings/project-array-item-schema.d.ts +5 -0
  24. package/dist/bindings/project-array-item-schema.js +67 -0
  25. package/dist/bindings/request-binding-schema.d.ts +2 -0
  26. package/dist/bindings/request-binding-schema.js +23 -0
  27. package/dist/bindings/request-container-kind.d.ts +3 -0
  28. package/dist/bindings/request-container-kind.js +17 -0
  29. package/dist/bindings/resources/clone-schema-resource.d.ts +3 -0
  30. package/dist/bindings/resources/clone-schema-resource.js +38 -0
  31. package/dist/bindings/resources/create-schema-resource-context.d.ts +4 -0
  32. package/dist/bindings/resources/create-schema-resource-context.js +130 -0
  33. package/dist/bindings/response-binding-schema.d.ts +3 -0
  34. package/dist/bindings/response-binding-schema.js +21 -0
  35. package/dist/bindings/schema-allows-container.d.ts +3 -0
  36. package/dist/bindings/schema-allows-container.js +20 -0
  37. package/dist/bindings/schema-at-pointer.d.ts +4 -0
  38. package/dist/bindings/schema-at-pointer.js +89 -0
  39. package/dist/bindings/validate-api-binding-assignments.d.ts +2 -0
  40. package/dist/bindings/validate-api-binding-assignments.js +81 -0
  41. package/dist/bindings/validate-api-binding-gaps.d.ts +2 -0
  42. package/dist/bindings/validate-api-binding-gaps.js +10 -0
  43. package/dist/bindings/validate-api-binding-plan.d.ts +3 -0
  44. package/dist/bindings/validate-api-binding-plan.js +11 -0
  45. package/dist/bindings/validate-native-output-contracts.d.ts +3 -0
  46. package/dist/bindings/validate-native-output-contracts.js +16 -0
  47. package/dist/internal-api.d.ts +30 -0
  48. package/dist/internal-api.js +25 -0
  49. package/dist/openapi/catalog/create-api-catalog.d.ts +2 -0
  50. package/dist/openapi/catalog/create-api-catalog.js +34 -0
  51. package/dist/openapi/catalog/list-api-operations.d.ts +2 -0
  52. package/dist/openapi/catalog/list-api-operations.js +3 -0
  53. package/dist/openapi/common/check-oas-value.d.ts +3 -0
  54. package/dist/openapi/common/check-oas-value.js +6 -0
  55. package/dist/openapi/common/check-schema-value.d.ts +2 -0
  56. package/dist/openapi/common/check-schema-value.js +12 -0
  57. package/dist/openapi/common/create-oas-value-validator.d.ts +3 -0
  58. package/dist/openapi/common/create-oas-value-validator.js +39 -0
  59. package/dist/openapi/common/normalize-oas-value-schema.d.ts +4 -0
  60. package/dist/openapi/common/normalize-oas-value-schema.js +50 -0
  61. package/dist/openapi/common/operation-metadata.d.ts +2 -0
  62. package/dist/openapi/common/operation-metadata.js +25 -0
  63. package/dist/openapi/common/operation-reference.d.ts +3 -0
  64. package/dist/openapi/{operation-reference.js → common/operation-reference.js} +1 -4
  65. package/dist/openapi/common/parse-spec-utils.d.ts +3 -0
  66. package/dist/openapi/common/parse-spec-utils.js +12 -0
  67. package/dist/openapi/common/resolve-openapi-security.d.ts +3 -0
  68. package/dist/openapi/common/resolve-openapi-security.js +28 -0
  69. package/dist/openapi/common/unsupported-operation-error.d.ts +4 -0
  70. package/dist/openapi/common/unsupported-operation-error.js +8 -0
  71. package/dist/openapi/common/validate-spec.d.ts +3 -0
  72. package/dist/openapi/{validate-spec.js → common/validate-spec.js} +2 -1
  73. package/dist/openapi/inbound/callback/parse-callback-operations.d.ts +3 -0
  74. package/dist/openapi/inbound/callback/parse-callback-operations.js +31 -0
  75. package/dist/openapi/inbound/inbound-path-item-operations.d.ts +4 -0
  76. package/dist/openapi/inbound/inbound-path-item-operations.js +31 -0
  77. package/dist/openapi/inbound/list-inbound-operations.d.ts +4 -0
  78. package/dist/openapi/inbound/list-inbound-operations.js +13 -0
  79. package/dist/openapi/inbound/webhook/parse-webhook-operations.d.ts +3 -0
  80. package/dist/openapi/inbound/webhook/parse-webhook-operations.js +13 -0
  81. package/dist/openapi/request/create-operation-catalog.d.ts +2 -0
  82. package/dist/openapi/request/create-operation-catalog.js +24 -0
  83. package/dist/openapi/request/encode-form-field.d.ts +2 -0
  84. package/dist/openapi/request/encode-form-field.js +6 -0
  85. package/dist/openapi/request/map-http-operation-contract.d.ts +4 -0
  86. package/dist/openapi/request/map-http-operation-contract.js +21 -0
  87. package/dist/openapi/request/operation-mapping.d.ts +3 -0
  88. package/dist/openapi/request/operation-mapping.js +10 -0
  89. package/dist/openapi/request/parse-operation-responses.d.ts +3 -0
  90. package/dist/openapi/request/parse-operation-responses.js +30 -0
  91. package/dist/openapi/request/parse-request-body.d.ts +3 -0
  92. package/dist/openapi/request/parse-request-body.js +29 -0
  93. package/dist/openapi/request/parse-request-operations.d.ts +7 -0
  94. package/dist/openapi/request/parse-request-operations.js +50 -0
  95. package/dist/openapi/request/parse-request-parameters.d.ts +3 -0
  96. package/dist/openapi/request/parse-request-parameters.js +93 -0
  97. package/dist/openapi/request/parse-security.d.ts +3 -0
  98. package/dist/openapi/request/parse-security.js +31 -0
  99. package/dist/openapi/request/request-operation-reference.d.ts +1 -0
  100. package/dist/openapi/request/request-operation-reference.js +4 -0
  101. package/dist/openapi/request/response-contract.d.ts +6 -0
  102. package/dist/openapi/request/response-contract.js +32 -0
  103. package/dist/openapi/request/scalar-response-schema.d.ts +2 -0
  104. package/dist/openapi/request/scalar-response-schema.js +20 -0
  105. package/dist/openapi/request/serialize-form-body.d.ts +3 -0
  106. package/dist/openapi/request/serialize-form-body.js +89 -0
  107. package/dist/openapi/request/serialize-parameter.d.ts +5 -0
  108. package/dist/openapi/request/serialize-parameter.js +145 -0
  109. package/dist/openapi/resolve-api-operations.d.ts +3 -0
  110. package/dist/openapi/resolve-api-operations.js +84 -0
  111. package/dist/openapi/response/api-response-validation-value.d.ts +3 -0
  112. package/dist/openapi/response/api-response-validation-value.js +21 -0
  113. package/dist/openapi/response/create-api-response-schema.d.ts +4 -0
  114. package/dist/openapi/response/create-api-response-schema.js +114 -0
  115. package/dist/openapi/response/create-response-array-item-schema.d.ts +4 -0
  116. package/dist/openapi/response/create-response-array-item-schema.js +12 -0
  117. package/dist/openapi/response/create-response-value-schema.d.ts +4 -0
  118. package/dist/openapi/response/create-response-value-schema.js +8 -0
  119. package/dist/openapi/response/list-api-response-pointers.d.ts +4 -0
  120. package/dist/openapi/response/list-api-response-pointers.js +30 -0
  121. package/dist/openapi/response/list-declared-schema-pointers.d.ts +4 -0
  122. package/dist/openapi/response/list-declared-schema-pointers.js +91 -0
  123. package/dist/public-api.d.ts +49 -7
  124. package/dist/public-api.js +35 -5
  125. package/dist/runtime-api.d.ts +6 -0
  126. package/dist/runtime-api.js +7 -0
  127. package/dist/schemas/create-api-argument-generation-contract.d.ts +4 -0
  128. package/dist/schemas/create-api-argument-generation-contract.js +72 -0
  129. package/dist/schemas/create-api-arguments-schema.d.ts +3 -0
  130. package/dist/schemas/create-api-arguments-schema.js +4 -0
  131. package/dist/schemas/create-api-request-schema.d.ts +4 -0
  132. package/dist/schemas/create-api-request-schema.js +50 -0
  133. package/dist/schemas/create-oas-value-schema.d.ts +6 -0
  134. package/dist/schemas/create-oas-value-schema.js +25 -0
  135. package/dist/schemas/operation-plan-schema.d.ts +8 -0
  136. package/dist/schemas/operation-plan-schema.js +99 -0
  137. package/dist/schemas/project-literal-array-schema.d.ts +4 -0
  138. package/dist/schemas/project-literal-array-schema.js +55 -0
  139. package/dist/schemas/project-literal-input-schema.d.ts +3 -0
  140. package/dist/schemas/project-literal-input-schema.js +129 -0
  141. package/dist/types/api-argument-generation.d.ts +13 -0
  142. package/dist/types/api-arguments.d.ts +42 -0
  143. package/dist/types/api-arguments.js +1 -0
  144. package/dist/types/api-bindings.d.ts +34 -0
  145. package/dist/types/api-bindings.js +1 -0
  146. package/dist/types/api-catalog.d.ts +34 -0
  147. package/dist/types/api-catalog.js +1 -0
  148. package/dist/types/api-operation.d.ts +26 -0
  149. package/dist/types/api-operation.js +1 -0
  150. package/dist/types/api-response-pointers.d.ts +20 -0
  151. package/dist/types/api-response-pointers.js +1 -0
  152. package/dist/types/api-response.d.ts +14 -0
  153. package/dist/types/api-response.js +1 -0
  154. package/dist/types/array-projection.d.ts +5 -0
  155. package/dist/types/array-projection.js +1 -0
  156. package/dist/types/catalog.d.ts +17 -0
  157. package/dist/types/catalog.js +1 -0
  158. package/dist/types/inbound.d.ts +18 -0
  159. package/dist/types/inbound.js +1 -0
  160. package/dist/types/legacy-plan.d.ts +47 -0
  161. package/dist/types/legacy-plan.js +1 -0
  162. package/dist/types/node-output.d.ts +11 -0
  163. package/dist/types/node-output.js +1 -0
  164. package/dist/types/oas-value-validation.d.ts +8 -0
  165. package/dist/types/oas-value-validation.js +1 -0
  166. package/dist/types/openapi.d.ts +7 -23
  167. package/dist/types/request.d.ts +41 -0
  168. package/dist/types/request.js +1 -0
  169. package/dist/types/reviewable-workflow.d.ts +53 -0
  170. package/dist/types/reviewable-workflow.js +1 -0
  171. package/dist/types/schema-dialect.d.ts +1 -0
  172. package/dist/types/schema-dialect.js +1 -0
  173. package/dist/types/schema-json.d.ts +4 -0
  174. package/dist/types/schema-json.js +1 -0
  175. package/dist/types/schema-resource.d.ts +12 -0
  176. package/dist/types/schema-resource.js +1 -0
  177. package/dist/types/security.d.ts +17 -0
  178. package/dist/types/security.js +1 -0
  179. package/dist/types/workflow-capability-planning.d.ts +10 -0
  180. package/dist/types/workflow-capability-planning.js +1 -0
  181. package/dist/types/workflow-plan.d.ts +104 -0
  182. package/dist/types/workflow-plan.js +1 -0
  183. package/dist/utils/is-object.d.ts +2 -0
  184. package/dist/utils/is-object.js +3 -0
  185. package/dist/utils/json-values-equal.d.ts +2 -0
  186. package/dist/utils/json-values-equal.js +16 -0
  187. package/dist/workflow/assert-api-call-identities.d.ts +1 -0
  188. package/dist/workflow/assert-api-call-identities.js +6 -0
  189. package/dist/workflow/create-native-output-contracts.d.ts +3 -0
  190. package/dist/workflow/create-native-output-contracts.js +23 -0
  191. package/dist/workflow/create-reviewable-node-contracts.d.ts +3 -0
  192. package/dist/workflow/create-reviewable-node-contracts.js +36 -0
  193. package/dist/workflow/create-reviewable-workflow-graph-plan.d.ts +2 -0
  194. package/dist/workflow/create-reviewable-workflow-graph-plan.js +29 -0
  195. package/dist/workflow/create-workflow-graph-plan.d.ts +2 -0
  196. package/dist/workflow/create-workflow-graph-plan.js +17 -0
  197. package/dist/workflow/create-workflow-node-contracts.d.ts +2 -0
  198. package/dist/workflow/create-workflow-node-contracts.js +50 -0
  199. package/dist/workflow/create-workflow-planning-capabilities.d.ts +3 -0
  200. package/dist/workflow/create-workflow-planning-capabilities.js +20 -0
  201. package/dist/workflow/parse-native-node-parameters.d.ts +3 -0
  202. package/dist/workflow/parse-native-node-parameters.js +7 -0
  203. package/dist/workflow/validate-exclusive-output-rejoin.d.ts +3 -0
  204. package/dist/workflow/validate-exclusive-output-rejoin.js +26 -0
  205. package/dist/workflow/validate-native-api-response-references.d.ts +2 -0
  206. package/dist/workflow/validate-native-api-response-references.js +26 -0
  207. package/dist/workflow/validate-reviewable-workflow-graph-plan.d.ts +2 -0
  208. package/dist/workflow/validate-reviewable-workflow-graph-plan.js +98 -0
  209. package/dist/workflow/validate-workflow-edges.d.ts +2 -0
  210. package/dist/workflow/validate-workflow-edges.js +19 -0
  211. package/dist/workflow/validate-workflow-graph-plan.d.ts +3 -0
  212. package/dist/workflow/validate-workflow-graph-plan.js +41 -0
  213. package/dist/workflow/validate-workflow-topology.d.ts +2 -0
  214. package/dist/workflow/validate-workflow-topology.js +105 -0
  215. package/package.json +19 -25
  216. package/dist/openapi/operation-reference.d.ts +0 -3
  217. package/dist/openapi/parse-spec-utils.d.ts +0 -5
  218. package/dist/openapi/parse-spec-utils.js +0 -52
  219. package/dist/openapi/parse-spec.d.ts +0 -5
  220. package/dist/openapi/parse-spec.js +0 -182
  221. package/dist/openapi/validate-spec.d.ts +0 -3
  222. package/dist/planning/generate-workflow.d.ts +0 -2
  223. package/dist/planning/generate-workflow.js +0 -126
  224. package/dist/schemas/planning-schemas.d.ts +0 -62
  225. package/dist/schemas/planning-schemas.js +0 -48
  226. package/dist/types/workflow.d.ts +0 -75
  227. package/dist/utils/validation.d.ts +0 -7
  228. package/dist/utils/validation.js +0 -44
  229. package/dist/utils/workflow-id.d.ts +0 -1
  230. package/dist/utils/workflow-id.js +0 -8
  231. package/dist/workflow/compile-sequence.d.ts +0 -2
  232. package/dist/workflow/compile-sequence.js +0 -167
  233. package/dist/workflow/compile-workflow.d.ts +0 -4
  234. package/dist/workflow/compile-workflow.js +0 -128
  235. package/dist/workflow/sequence-url.d.ts +0 -3
  236. package/dist/workflow/sequence-url.js +0 -81
  237. package/dist/workflow/workflow-helpers.d.ts +0 -6
  238. package/dist/workflow/workflow-helpers.js +0 -81
  239. /package/dist/types/{workflow.js → api-argument-generation.js} +0 -0
@@ -0,0 +1,129 @@
1
+ import { isObject } from '../utils/is-object.js';
2
+ import { projectLiteralArraySchema } from './project-literal-array-schema.js';
3
+ /** Bound fields do not belong in the model's literal-value output schema. */
4
+ export function projectLiteralInputSchema(input, targets, source) {
5
+ if (targets.some((tokens) => tokens.length === 0))
6
+ return { schema: false, hasLiteralValues: false };
7
+ if (!targets.length || input === false)
8
+ return {
9
+ schema: structuredClone(input),
10
+ hasLiteralValues: input !== false,
11
+ };
12
+ if (input === true)
13
+ return projectLiteralInputSchema({}, targets, source);
14
+ const schema = structuredClone(input);
15
+ if (Array.isArray(schema.type)) {
16
+ const variants = schema.type.map((type) => projectLiteralInputSchema({ ...schema, type }, targets, source));
17
+ return {
18
+ schema: { anyOf: variants.map((variant) => variant.schema) },
19
+ hasLiteralValues: variants.some((variant) => variant.hasLiteralValues),
20
+ };
21
+ }
22
+ if (typeof schema.type === 'string' &&
23
+ !['object', 'array'].includes(schema.type))
24
+ return { schema: false, hasLiteralValues: false };
25
+ const combinations = new Map();
26
+ const conjuncts = [];
27
+ for (const key of ['allOf', 'anyOf', 'oneOf']) {
28
+ if (!Array.isArray(schema[key]))
29
+ continue;
30
+ const projected = schema[key].map((child) => {
31
+ if (typeof child !== 'boolean' && !isObject(child))
32
+ throw new Error(`${source}.${key} must contain schemas`);
33
+ return projectLiteralInputSchema(child, targets, source);
34
+ });
35
+ const alternatives = projected.map((child) => child.schema);
36
+ delete schema[key];
37
+ // Bound discriminators distinguish completed values, not partial literals.
38
+ // Preserve simultaneous composition constraints in one conjunction; exact-one
39
+ // validation belongs to the untouched OAS after materialization.
40
+ if (key === 'allOf')
41
+ conjuncts.push(...alternatives);
42
+ else
43
+ conjuncts.push({ anyOf: alternatives });
44
+ combinations.set(key, projected);
45
+ }
46
+ if (combinations.size)
47
+ schema.allOf = conjuncts;
48
+ const combinationAllowsLiterals = [...combinations].every(([kind, children]) => kind === 'allOf'
49
+ ? children.every((child) => child.hasLiteralValues)
50
+ : children.some((child) => child.hasLiteralValues));
51
+ if (schema.type === 'array')
52
+ return projectLiteralArraySchema(schema, targets, source);
53
+ if (schema.type === 'object' ||
54
+ isObject(schema.properties) ||
55
+ isObject(schema.patternProperties) ||
56
+ schema.additionalProperties !== undefined) {
57
+ const properties = Object.create(null);
58
+ const availability = new Map();
59
+ for (const [name, child] of Object.entries(isObject(schema.properties) ? schema.properties : {})) {
60
+ if (typeof child !== 'boolean' && !isObject(child))
61
+ throw new Error(`${source}.properties.${name} must be a schema`);
62
+ properties[name] = child;
63
+ availability.set(name, child !== false);
64
+ }
65
+ const names = new Set(targets.map(([name]) => name));
66
+ for (const name of names) {
67
+ const children = targets
68
+ .filter(([token]) => token === name)
69
+ .map((tokens) => tokens.slice(1));
70
+ let child;
71
+ if (Object.hasOwn(properties, name))
72
+ child = properties[name];
73
+ else {
74
+ const patterns = Object.entries(isObject(schema.patternProperties) ? schema.patternProperties : {})
75
+ .filter(([pattern]) => new RegExp(pattern).test(name))
76
+ .map(([, value]) => value);
77
+ if (patterns.length)
78
+ child = { allOf: patterns };
79
+ else {
80
+ // OAS/JSON Schema permits additional properties unless explicitly closed.
81
+ const additional = schema.additionalProperties;
82
+ if (additional === false)
83
+ return { schema: false, hasLiteralValues: false };
84
+ if (additional !== undefined &&
85
+ additional !== true &&
86
+ !isObject(additional))
87
+ throw new Error(`${source}.additionalProperties must be a schema`);
88
+ child = additional === undefined ? true : additional;
89
+ }
90
+ }
91
+ const projected = projectLiteralInputSchema(child, children, `${source}/${name}`);
92
+ // A false property blocks re-entry through additionalProperties and patterns.
93
+ properties[name] = projected.schema;
94
+ availability.set(name, projected.hasLiteralValues);
95
+ }
96
+ schema.properties = properties;
97
+ // Counts describe the completed request; preceding nodes contribute keys too.
98
+ if (typeof schema.minProperties === 'number')
99
+ schema.minProperties = Math.max(0, schema.minProperties - names.size);
100
+ if (typeof schema.maxProperties === 'number')
101
+ schema.maxProperties = Math.max(0, schema.maxProperties -
102
+ targets.filter((tokens) => tokens.length === 1).length);
103
+ const open = schema.additionalProperties !== false;
104
+ const patterns = isObject(schema.patternProperties)
105
+ ? Object.values(schema.patternProperties).some((child) => child !== false)
106
+ : false;
107
+ return {
108
+ schema,
109
+ hasLiteralValues: combinationAllowsLiterals &&
110
+ (open || patterns || [...availability.values()].some(Boolean)),
111
+ };
112
+ }
113
+ if (combinations.size)
114
+ return {
115
+ schema,
116
+ hasLiteralValues: combinationAllowsLiterals,
117
+ };
118
+ // An unconstrained OAS schema permits both containers. Keep every container
119
+ // compatible with the pointer instead of guessing whether numeric keys are arrays.
120
+ return projectLiteralInputSchema({
121
+ ...schema,
122
+ anyOf: [
123
+ { type: 'object' },
124
+ ...(targets.every(([token]) => /^(0|[1-9][0-9]*)$/.test(token))
125
+ ? [{ type: 'array' }]
126
+ : []),
127
+ ],
128
+ }, targets, source);
129
+ }
@@ -0,0 +1,13 @@
1
+ import type { z } from 'zod';
2
+ import type { ApiArgumentProposal } from './api-arguments.js';
3
+ import type { JsonObject } from './openapi.js';
4
+ export type LiteralInputSchema = JsonObject | boolean;
5
+ export interface LiteralInputProjection {
6
+ schema: LiteralInputSchema;
7
+ hasLiteralValues: boolean;
8
+ }
9
+ export interface ApiArgumentGenerationContract {
10
+ schema: z.ZodType<ApiArgumentProposal>;
11
+ literalInputSchema: JsonObject;
12
+ hasLiteralInputs: boolean;
13
+ }
@@ -0,0 +1,42 @@
1
+ import type { ApiOperationContract } from './api-operation.js';
2
+ export type JsonValue = string | number | boolean | null | JsonValue[] | JsonValueObject;
3
+ export interface JsonValueObject {
4
+ [key: string]: JsonValue;
5
+ }
6
+ export interface ApiArgumentValues {
7
+ path?: JsonValueObject;
8
+ query?: JsonValueObject;
9
+ header?: JsonValueObject;
10
+ cookie?: JsonValueObject;
11
+ querystring?: JsonValueObject;
12
+ body?: JsonValue;
13
+ }
14
+ export interface OutputBinding {
15
+ kind: 'node-output';
16
+ targetPointer: string;
17
+ sourceNodeId: string;
18
+ sourcePointer: string;
19
+ }
20
+ export interface ApiArgumentProposal {
21
+ values: ApiArgumentValues;
22
+ }
23
+ export interface ApiArgumentsSchemaInput {
24
+ operation: ApiOperationContract;
25
+ bindings: OutputBinding[];
26
+ requestMediaType?: string;
27
+ }
28
+ export type ApiRequestSchemaInput = Omit<ApiArgumentsSchemaInput, 'bindings'>;
29
+ export interface ApiCallArguments extends ApiArgumentProposal {
30
+ callId: string;
31
+ bindings: OutputBinding[];
32
+ unresolvedInputs: string[];
33
+ requestMediaType?: string;
34
+ }
35
+ export interface ValidateApiArgumentsInput extends ApiArgumentsSchemaInput {
36
+ values: ApiArgumentValues;
37
+ }
38
+ export interface ApiArgumentValidation {
39
+ valid: boolean;
40
+ missingInputs: string[];
41
+ requiresRuntimeValidation: boolean;
42
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,34 @@
1
+ import type { ApiOperationContract } from './api-operation.js';
2
+ import type { OutputBinding } from './api-arguments.js';
3
+ import type { JsonObject } from './openapi.js';
4
+ import type { NativeOutputContract } from './node-output.js';
5
+ export interface ApiBindingMaterial {
6
+ callId: string;
7
+ operation: ApiOperationContract;
8
+ requestMediaType?: string;
9
+ }
10
+ export interface PlannedApiBindings {
11
+ callId: string;
12
+ bindings: OutputBinding[];
13
+ }
14
+ export interface ApiBindingPlan {
15
+ calls: PlannedApiBindings[];
16
+ gaps: ApiBindingGap[];
17
+ }
18
+ export interface ApiBindingGap {
19
+ callId: string;
20
+ targetPointer: string;
21
+ description: string;
22
+ }
23
+ export interface ValidateApiBindingAssignmentsInput {
24
+ calls: PlannedApiBindings[];
25
+ materials: ApiBindingMaterial[];
26
+ nativeOutputs?: NativeOutputContract[];
27
+ }
28
+ export interface ValidateApiBindingPlanInput {
29
+ plan: ApiBindingPlan;
30
+ materials: ApiBindingMaterial[];
31
+ nativeOutputs?: NativeOutputContract[];
32
+ }
33
+ export type BindingSchema = JsonObject | boolean;
34
+ export type RequestContainerKind = 'array' | 'object';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,34 @@
1
+ import type { OpenApiDocument, OperationCandidate } from './openapi.js';
2
+ export interface ApiSource {
3
+ id: string;
4
+ spec: OpenApiDocument;
5
+ }
6
+ export interface ApiOperationKey {
7
+ documentId: string;
8
+ snapshotId: string;
9
+ operationRef: string;
10
+ }
11
+ export interface ApiOperationCandidate extends OperationCandidate {
12
+ key: ApiOperationKey;
13
+ }
14
+ export interface ApiCatalogDocument extends ApiSource {
15
+ snapshotId: string;
16
+ }
17
+ export interface ApiCatalog {
18
+ documents: ApiCatalogDocument[];
19
+ operations: ApiOperationCandidate[];
20
+ }
21
+ /** One scenario call instance; separate roles may reference the same operation key. */
22
+ export interface SelectedApiOperation {
23
+ key: ApiOperationKey;
24
+ purpose: string;
25
+ }
26
+ export interface ApiCapabilityGap {
27
+ kind: 'missing_operation' | 'insufficient_contract';
28
+ description: string;
29
+ operation?: ApiOperationKey;
30
+ }
31
+ export interface ApiSelection {
32
+ operations: SelectedApiOperation[];
33
+ gaps: ApiCapabilityGap[];
34
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ import type { OperationObject as Operation30, ParameterObject as Parameter30, PathItemObject as PathItem30, ServerObject as Server30 } from '@scalar/openapi-types/3.0';
2
+ import type { OperationObject as Operation31, ParameterObject as Parameter31, PathItemObject as PathItem31, ServerObject as Server31 } from '@scalar/openapi-types/3.1';
3
+ import type { OperationObject as Operation32, ParameterObject as Parameter32, PathItemObject as PathItem32, ServerObject as Server32 } from '@scalar/openapi-types/3.2';
4
+ import type { ApiOperationKey } from './api-catalog.js';
5
+ import type { JsonObject } from './openapi.js';
6
+ export type ApiOperationObject = Operation30 | Operation31 | Operation32;
7
+ export type ApiParameterObject = Parameter30 | Parameter31 | Parameter32;
8
+ export type ApiPathItemObject = PathItem30 | PathItem31 | PathItem32;
9
+ export type ApiServerObject = Server30 | Server31 | Server32;
10
+ export type ApiSecurityRequirement = Record<string, string[]>;
11
+ export interface EffectiveApiContract {
12
+ parameters: ApiParameterObject[];
13
+ security: ApiSecurityRequirement[];
14
+ securitySchemes: JsonObject;
15
+ servers?: ApiServerObject[];
16
+ }
17
+ export interface ApiOperationContract {
18
+ key: ApiOperationKey;
19
+ openapiVersion: string;
20
+ source: 'paths';
21
+ method: string;
22
+ path: string;
23
+ operation: ApiOperationObject;
24
+ pathItem: ApiPathItemObject;
25
+ effective: EffectiveApiContract;
26
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ export type ApiResponsePointerType = string | string[];
2
+ export interface ApiResponsePointer {
3
+ pointer: string;
4
+ schemaLocation: string;
5
+ type?: ApiResponsePointerType;
6
+ description?: string;
7
+ }
8
+ export type ApiResponsePointerBoundaryKind = 'additional-properties' | 'pattern-properties' | 'array-items' | 'reference' | 'recursive-schema' | 'unconstrained';
9
+ export interface ApiResponsePointerBoundary {
10
+ pointer: string;
11
+ schemaLocation: string;
12
+ kind: ApiResponsePointerBoundaryKind;
13
+ constraint?: string;
14
+ }
15
+ export interface ApiResponsePointerCatalog {
16
+ responseKey: string;
17
+ mediaType: string;
18
+ declaredPointers: ApiResponsePointer[];
19
+ dynamicLocations: ApiResponsePointerBoundary[];
20
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { ApiOperationContract } from './api-operation.js';
2
+ export interface ApiResponseValidationInput {
3
+ operation: ApiOperationContract;
4
+ }
5
+ export interface ApiResponseEnvelope {
6
+ statusCode: number;
7
+ headers: Record<string, unknown>;
8
+ body?: unknown;
9
+ }
10
+ export interface ApiResponseValidationValue {
11
+ statusCode: number;
12
+ mediaType?: string;
13
+ body?: unknown;
14
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { BindingSchema } from './api-bindings.js';
2
+ export interface ArrayItemProjection {
3
+ allowsArray: boolean;
4
+ schema: BindingSchema;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { OpenApiDocument, OperationCandidate, ParsedDocument } from './openapi.js';
2
+ export interface CatalogSource {
3
+ id: string;
4
+ spec: OpenApiDocument;
5
+ }
6
+ export interface CatalogEntry {
7
+ id: string;
8
+ candidate: OperationCandidate;
9
+ }
10
+ export interface ParsedCatalogSource extends CatalogSource {
11
+ document: ParsedDocument;
12
+ operations: OperationCandidate[];
13
+ }
14
+ export interface OperationCatalog {
15
+ sources: Map<string, ParsedCatalogSource>;
16
+ entries: CatalogEntry[];
17
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import type { JsonObject, OperationCandidate } from './openapi.js';
2
+ export interface WebhookOperationCandidate extends OperationCandidate {
3
+ source: 'webhooks';
4
+ }
5
+ export interface CallbackOperationCandidate extends OperationCandidate {
6
+ source: 'callbacks';
7
+ parentOperationRef: string;
8
+ }
9
+ export type InboundOperationCandidate = WebhookOperationCandidate | CallbackOperationCandidate;
10
+ export interface WebhookOperationSource {
11
+ candidate: WebhookOperationCandidate;
12
+ operation: JsonObject;
13
+ }
14
+ export interface CallbackOperationSource {
15
+ candidate: CallbackOperationCandidate;
16
+ operation: JsonObject;
17
+ }
18
+ export type InboundOperationSource = WebhookOperationSource | CallbackOperationSource;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,47 @@
1
+ export type ExpectedBody = Record<string, unknown>;
2
+ export type WorkflowInputs = Record<string, unknown>;
3
+ export type InputValues = Record<string, unknown>;
4
+ export interface WorkflowPlan {
5
+ version: '1';
6
+ goal: string;
7
+ operationRef: string;
8
+ inputs?: WorkflowInputs;
9
+ requestMediaType?: string;
10
+ expectedBody?: ExpectedBody;
11
+ }
12
+ export interface ResponseReference {
13
+ fromStep: string;
14
+ field: string;
15
+ }
16
+ export interface SequenceStep {
17
+ id: string;
18
+ operationRef: string;
19
+ inputs?: Record<string, unknown>;
20
+ requestMediaType?: string;
21
+ expectedBody?: ExpectedBody;
22
+ }
23
+ export interface SequencePlan {
24
+ version: '1';
25
+ goal: string;
26
+ steps: SequenceStep[];
27
+ }
28
+ export interface CatalogStep extends SequenceStep {
29
+ documentId: string;
30
+ }
31
+ export interface CapabilityGap {
32
+ kind: 'missing_operation' | 'insufficient_contract';
33
+ description: string;
34
+ documentId?: string;
35
+ operationRef?: string;
36
+ }
37
+ export interface CatalogSequencePlan extends Omit<SequencePlan, 'steps'> {
38
+ steps: CatalogStep[];
39
+ gaps?: CapabilityGap[];
40
+ }
41
+ export interface CatalogDiagnostic {
42
+ code: 'missing_operation' | 'insufficient_contract' | 'missing_input' | 'effect_not_approved';
43
+ message: string;
44
+ stepId?: string;
45
+ documentId?: string;
46
+ operationRef?: string;
47
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { BindingSchema } from './api-bindings.js';
2
+ import type { PlannedNativeNode, WorkflowCapability } from './workflow-plan.js';
3
+ /** A native node's JSON item contract, not an HTTP response envelope. */
4
+ export interface NativeOutputContract {
5
+ nodeId: string;
6
+ schema: BindingSchema;
7
+ }
8
+ export interface CreateNativeOutputContractsInput {
9
+ nativeNodes: PlannedNativeNode[];
10
+ capabilities: WorkflowCapability[];
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { createValidator } from '@scalar/json-schema-validator';
2
+ import type { JsonObject } from './openapi.js';
3
+ export type OasValueSchema = JsonObject | boolean;
4
+ export type OasValueValidation = ReturnType<typeof createValidator>;
5
+ export interface OasValueValidator {
6
+ schema: JsonObject;
7
+ validate: OasValueValidation;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,11 @@
1
+ import type { Document as OpenApi30Document } from '@scalar/openapi-types/3.0';
2
+ import type { Document as OpenApi31Document } from '@scalar/openapi-types/3.1';
3
+ import type { Document as OpenApi32Document } from '@scalar/openapi-types/3.2';
4
+ export type OpenApiDocument = OpenApi30Document | OpenApi31Document | OpenApi32Document;
1
5
  export type JsonObject = Record<string, unknown>;
2
6
  export type Scalar = string | number | boolean;
3
7
  export type OperationMethod = string;
8
+ export type OperationSourceKind = 'paths' | 'webhooks' | 'callbacks';
4
9
  export interface OperationEntry {
5
10
  method: string;
6
11
  key: string;
@@ -10,38 +15,17 @@ export interface ScalarSchema {
10
15
  type: string;
11
16
  enum?: Scalar[];
12
17
  }
13
- export type ScalarProperties = Record<string, ScalarSchema>;
14
- export interface OperationParameter {
15
- name: string;
16
- in: 'path' | 'query';
17
- required: boolean;
18
- schema: ScalarSchema;
19
- }
20
- export interface OperationBody {
21
- required: boolean;
22
- requiredProperties: string[];
23
- properties: ScalarProperties;
24
- }
25
18
  export interface OperationMetadata {
26
19
  operationId?: string;
27
20
  summary: string;
28
21
  description: string;
29
22
  tags: string[];
30
23
  }
31
- export interface Operation extends OperationMetadata {
24
+ export interface OperationCandidate extends OperationMetadata {
25
+ source: OperationSourceKind;
32
26
  operationRef: string;
33
27
  method: OperationMethod;
34
28
  path: string;
35
- effect: 'read' | 'write' | 'unknown';
36
- status: number;
37
- parameters: OperationParameter[];
38
- body?: OperationBody;
39
- responseProperties: ScalarProperties;
40
- }
41
- export type OperationCandidate = Pick<Operation, 'operationRef' | 'operationId' | 'method' | 'path' | 'summary' | 'description' | 'tags'>;
42
- export interface ObjectSchemaProperties {
43
- properties: JsonObject;
44
- required: string[];
45
29
  }
46
30
  export interface ParsedDocument {
47
31
  spec: JsonObject;
@@ -0,0 +1,41 @@
1
+ import type { JsonObject, OperationCandidate, OperationEntry, OperationMetadata, OperationMethod } from './openapi.js';
2
+ export interface OperationSource {
3
+ candidate: OperationCandidate;
4
+ pathItem: JsonObject;
5
+ entry: OperationEntry;
6
+ }
7
+ export type ResponseProperties = Record<string, JsonObject | boolean>;
8
+ export type OperationResponses = Record<string, ResponseProperties>;
9
+ export interface OperationParameter {
10
+ name: string;
11
+ in: 'path' | 'query' | 'header' | 'cookie';
12
+ required: boolean;
13
+ schema: JsonObject | boolean;
14
+ style: string;
15
+ explode: boolean;
16
+ allowReserved: boolean;
17
+ contentMediaType?: string;
18
+ }
19
+ export interface OperationBody {
20
+ required: boolean;
21
+ mediaTypes: Record<string, OperationBodyMedia>;
22
+ }
23
+ export interface OperationBodyMedia {
24
+ schema?: JsonObject | boolean;
25
+ properties: JsonObject;
26
+ encoding?: JsonObject;
27
+ }
28
+ export interface OperationAuthentication {
29
+ schemeName: string;
30
+ credentialType: 'httpBearerAuth';
31
+ }
32
+ export interface Operation extends OperationMetadata {
33
+ source: 'paths';
34
+ operationRef: string;
35
+ method: OperationMethod;
36
+ path: string;
37
+ authentication?: OperationAuthentication;
38
+ parameters: OperationParameter[];
39
+ body?: OperationBody;
40
+ responses: OperationResponses;
41
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,53 @@
1
+ import type { ApiOperationContract } from './api-operation.js';
2
+ import type { ApiOperationKey } from './api-catalog.js';
3
+ import type { OutputBinding } from './api-arguments.js';
4
+ import type { WorkflowApiMaterial, WorkflowCapability, WorkflowGraphPlan, PlannedNativeNode, WorkflowPlanEdge } from './workflow-plan.js';
5
+ export interface WorkflowReviewGap {
6
+ id: string;
7
+ stage: 'api-selection' | 'api-bindings' | 'workflow-graph';
8
+ description: string;
9
+ operation?: ApiOperationKey;
10
+ callId?: string;
11
+ targetPointer?: string;
12
+ }
13
+ export interface ReadyWorkflowApiMaterial extends WorkflowApiMaterial {
14
+ status: 'ready';
15
+ }
16
+ export interface BlockedWorkflowApiMaterial {
17
+ status: 'blocked';
18
+ callId: string;
19
+ operation: ApiOperationContract;
20
+ requestMediaType?: string;
21
+ bindings: OutputBinding[];
22
+ gapIds: string[];
23
+ }
24
+ export type ReviewableWorkflowApiMaterial = ReadyWorkflowApiMaterial | BlockedWorkflowApiMaterial;
25
+ export interface BlockedWorkflowCall {
26
+ callId: string;
27
+ gapIds: string[];
28
+ }
29
+ export interface ProposedWorkflowGap {
30
+ id: string;
31
+ description: string;
32
+ }
33
+ export interface ReviewableWorkflowGraphProposal {
34
+ nativeNodes: PlannedNativeNode[];
35
+ edges: WorkflowPlanEdge[];
36
+ additionalGaps: ProposedWorkflowGap[];
37
+ blockedCalls: BlockedWorkflowCall[];
38
+ }
39
+ export interface ReviewableWorkflowGraphPlan extends WorkflowGraphPlan {
40
+ gaps: WorkflowReviewGap[];
41
+ blockedCalls: BlockedWorkflowCall[];
42
+ }
43
+ export interface ReviewableWorkflowPlanningContext {
44
+ materials: ReviewableWorkflowApiMaterial[];
45
+ capabilities: WorkflowCapability[];
46
+ }
47
+ export interface CreateReviewableWorkflowGraphPlanInput extends ReviewableWorkflowPlanningContext {
48
+ gaps: WorkflowReviewGap[];
49
+ proposal: ReviewableWorkflowGraphProposal;
50
+ }
51
+ export interface ValidateReviewableWorkflowGraphPlanInput extends ReviewableWorkflowPlanningContext {
52
+ plan: ReviewableWorkflowGraphPlan;
53
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export type SchemaDialect = 'openapi-3.0' | 'draft-2020-12';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export type SchemaJsonValue = null | boolean | number | string | SchemaJsonValue[] | SchemaJsonObject;
2
+ export interface SchemaJsonObject {
3
+ [key: string]: SchemaJsonValue;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { BindingSchema } from './api-bindings.js';
2
+ export type SchemaDeclaredType = string | string[] | undefined;
3
+ export interface SchemaResourceLocation {
4
+ reference: string;
5
+ baseUri: string;
6
+ }
7
+ export interface SchemaResourceContext {
8
+ root: BindingSchema;
9
+ reference: (schema: BindingSchema) => BindingSchema;
10
+ resolve: (schema: BindingSchema) => BindingSchema;
11
+ bundle: (projection: BindingSchema) => BindingSchema;
12
+ }
@@ -0,0 +1 @@
1
+ export {};