@aws/nx-plugin 1.0.0-rc.35 → 1.0.0-rc.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/nx-plugin",
3
- "version": "1.0.0-rc.35",
3
+ "version": "1.0.0-rc.37",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/awslabs/nx-plugin-for-aws.git",
@@ -49,7 +49,10 @@ const bodyMediaTypeOf = (op) => {
49
49
  return mediaTypes.find(mt => mt === 'application/json' || mt.endsWith('+json')) || mediaTypes[0];
50
50
  };
51
51
  const hasMultipartBody = allOperations.some(op => bodyMediaTypeOf(op) === 'multipart/form-data');
52
- const hasUrlEncodedBody = allOperations.some(op => bodyMediaTypeOf(op) === 'application/x-www-form-urlencoded');
52
+ // A urlencoded body is form-encoded only when its schema is an object; a
53
+ // primitive schema (e.g. a raw pre-encoded string) is sent verbatim below.
54
+ const isUrlEncodedObjectBody = (op) => bodyMediaTypeOf(op) === 'application/x-www-form-urlencoded' && !!op.parametersBody && !op.parametersBody.isPrimitive;
55
+ const hasUrlEncodedBody = allOperations.some(op => isUrlEncodedObjectBody(op));
53
56
  // Whether any operation uses matrix/label path styles or allowReserved query
54
57
  // params, so the extra $url serialisation logic is only emitted when needed.
55
58
  const hasStyledPathParams = allOperations.some(op => (op.parameters || []).some(p => p.in === 'path' && p.pathStyle));
@@ -751,10 +754,11 @@ export class <%- className %> {
751
754
  boundary itself (so the Content-Type header is intentionally unset
752
755
  above). */ _%>
753
756
  const body = <% if (!op.parametersBody.isRequired) { %>input === undefined ? undefined : <% } %>this.$formData(<%- op.explicitRequestBodyParameter ? `$IO.${op.operationIdPascalCase}RequestBodyParameters.toJson(input).${op.explicitRequestBodyParameter.prop}` : renderToJsonValue(op.parametersBody, 'input') %><% if (op.parametersBody.partContentTypes) { %>, <%- JSON.stringify(op.parametersBody.partContentTypes) %><% } %>);
754
- <%_ } else if (bodyMediaTypeOf(op) === 'application/x-www-form-urlencoded') { _%>
755
- <%_ /* A urlencoded body is sent as `key=value&...` pairs — the JSON
757
+ <%_ } else if (isUrlEncodedObjectBody(op)) { _%>
758
+ <%_ /* An object urlencoded body is sent as `key=value&...` pairs — the JSON
756
759
  serialisation the wire type declares would be rejected by the
757
- server's form parser. */ _%>
760
+ server's form parser. A primitive urlencoded body (e.g. a raw
761
+ pre-encoded string) falls through to the String(input) branch. */ _%>
758
762
  const body = <% if (!op.parametersBody.isRequired) { %>input === undefined ? undefined : <% } %>this.$urlEncodedForm(<%- op.explicitRequestBodyParameter ? `$IO.${op.operationIdPascalCase}RequestBodyParameters.toJson(input).${op.explicitRequestBodyParameter.prop}` : renderToJsonValue(op.parametersBody, 'input') %>).toString();
759
763
  <%_ } else if (op.parametersBody.isPrimitive && ['number', 'boolean', 'string'].includes(op.parametersBody.type) && !['array', 'dictionary'].includes(op.parametersBody.export) && !["date", "date-time"].includes(op.parametersBody.format)) { _%>
760
764
  const body = <% if (!op.parametersBody.isRequired) { %>input === undefined ? undefined : <% } %>String(input<%- op.explicitRequestBodyParameter ? `.${op.explicitRequestBodyParameter.typescriptName}` : '' %>);
@@ -36,6 +36,9 @@ import { isRef, resolveIfRef, splitRef } from "./refs.js";
36
36
  assertNoClashingPropertyNames(model);
37
37
  assertNoConflictingUnionMemberMarshalling(model);
38
38
  }
39
+ for (const op of allOperations){
40
+ assertEncodableUrlEncodedBody(op);
41
+ }
39
42
  data.models = orderBy(data.models, (d)=>d.name);
40
43
  // Default service first, then by name.
41
44
  data.services = orderBy(data.services, (s)=>s.name === DEFAULT_SERVICE_NAME ? '' : s.name);
@@ -357,6 +360,28 @@ import { isRef, resolveIfRef, splitRef } from "./refs.js";
357
360
  }
358
361
  }
359
362
  };
363
+ /**
364
+ * An `application/x-www-form-urlencoded` body is form-encoded as `key=value`
365
+ * pairs, so the wire form is only defined for a schema with named properties
366
+ * (an object) or a primitive sent verbatim. A top-level array or tuple has no
367
+ * property names to key on — encoding it would emit index keys (`0=a&1=b`) that
368
+ * no form parser can decode — so fail fast rather than generate a client that
369
+ * is silently wrong on the wire.
370
+ */ const assertEncodableUrlEncodedBody = (op)=>{
371
+ const body = op.parametersBody;
372
+ if (!body?.mediaTypes) return;
373
+ const mediaTypes = Array.isArray(body.mediaTypes) ? body.mediaTypes : [
374
+ body.mediaTypes
375
+ ];
376
+ // Match the wire media type the client actually sends: JSON is preferred, so
377
+ // an array body offering both JSON and urlencoded is sent as JSON and is fine.
378
+ const chosenMediaType = mediaTypes.find((mt)=>mt === 'application/json' || mt.endsWith('+json')) ?? mediaTypes[0];
379
+ if (chosenMediaType !== 'application/x-www-form-urlencoded') return;
380
+ if (body.isPrimitive) return;
381
+ if (body.export === 'array' || body.export === 'tuple') {
382
+ throw new Error(`Operation ${op.method} ${op.path} has an application/x-www-form-urlencoded request body whose schema is a ${body.export}, which has no defined form encoding. Use an object schema (its properties become the form fields) or a primitive schema (sent verbatim) in your OpenAPI specification.`);
383
+ }
384
+ };
360
385
  /**
361
386
  * Group operations by their (camelCased) tags, collecting any untagged
362
387
  * operations separately.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/open-api/utils/codegen-data.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport orderBy from 'lodash.orderby';\nimport trim from 'lodash.trim';\nimport uniqBy from 'lodash.uniqby';\nimport type { OpenAPIV3 } from 'openapi-types';\nimport {\n camelCase,\n pascalCase,\n snakeCase,\n toClassName,\n upperFirst,\n} from '../../utils/names';\nimport {\n toPythonName,\n toPythonType,\n toTypeScriptModelName,\n toTypeScriptName,\n toTypeScriptType,\n} from './codegen-data/languages';\nimport {\n COLLECTION_TYPES,\n COMPOSED_SCHEMA_TYPES,\n type CodeGenData,\n type CollectionFormat,\n createModel,\n DEFAULT_SERVICE_NAME,\n indexModelsByName,\n type Model,\n type ModelsByName,\n type Operation,\n type PatternPropertyModel,\n PRIMITIVE_TYPES,\n type Service,\n STREAMING_CONTENT_TYPES,\n VENDOR_EXTENSIONS,\n type VendorExtensions,\n} from './codegen-data/types';\nimport { normaliseOpenApiSpecForCodeGen } from './normalise';\nimport {\n buildClientData,\n buildInlineModel,\n compositeMemberSchemas,\n getSpecOperation,\n getSpecParametersByKey,\n getSpecPathParameters,\n linkModel,\n specParameterKey,\n} from './parser';\nimport { isRef, resolveIfRef, splitRef } from './refs';\nimport type { OpenApiSchema, OpenApiSchemaOrRef, Spec } from './types';\n\n/**\n * Build the data structure used to generate code from an OpenAPI spec.\n */\nexport const buildOpenApiCodeGenData = (inSpec: Spec): CodeGenData => {\n const spec = normaliseOpenApiSpecForCodeGen(inSpec);\n const data = buildClientData(spec);\n\n const modelsByName = indexModelsByName(data.models);\n\n for (const service of data.services) {\n augmentService(spec, service, modelsByName);\n }\n\n const allOperations = uniqBy(\n data.services.flatMap((s) => s.operations),\n (o) => o.uniqueName,\n );\n\n // A model per operation request parameter position (query/path/body/...).\n data.models = [\n ...data.models,\n ...allOperations.flatMap((op) =>\n buildRequestParameterModels(op, modelsByName),\n ),\n ];\n\n for (const model of data.models) {\n augmentModel(spec, model, modelsByName);\n }\n for (const model of data.models) {\n model.typescriptName = toTypeScriptModelName(model.name);\n model.typescriptType = model.typescriptName;\n }\n\n for (const model of data.models) {\n assertNoClashingPropertyNames(model);\n assertNoConflictingUnionMemberMarshalling(model);\n }\n\n data.models = orderBy(data.models, (d) => d.name);\n // Default service first, then by name.\n data.services = orderBy(data.services, (s) =>\n s.name === DEFAULT_SERVICE_NAME ? '' : s.name,\n );\n\n const { operationsByTag, untaggedOperations } =\n groupOperationsByTag(allOperations);\n\n return {\n ...data,\n operationsByTag,\n untaggedOperations,\n info: spec.info,\n allOperations,\n vendorExtensions: vendorExtensionsOf(spec),\n className: toClassName(spec.info.title),\n };\n};\n\n/**\n * Augment a service and each of its operations with the data needed for code\n * generation (names, imports, result/request types, behavioural flags), and\n * compute the set of models the service (ie API client) needs to import.\n */\nconst augmentService = (\n spec: Spec,\n service: Service,\n modelsByName: ModelsByName,\n): void => {\n const modelImports = service.operations.flatMap((op) =>\n augmentOperation(spec, op, modelsByName),\n );\n\n service.operations = orderBy(service.operations, (op) => op.uniqueName);\n service.modelImports = orderBy(\n uniqBy([...service.imports, ...modelImports], (x) => x),\n );\n service.className = `${service.name}Api`;\n service.nameSnakeCase = snakeCase(service.name);\n};\n\n/**\n * Augment a single operation with all the data the templates need, returning\n * the names of the models it references (for the service's import list).\n */\nconst augmentOperation = (\n spec: Spec,\n op: Operation,\n modelsByName: ModelsByName,\n): string[] => {\n const specOp = getSpecOperation(spec, op);\n\n assignOperationNames(op, specOp);\n\n op.vendorExtensions = vendorExtensionsOf(specOp);\n\n const modelImports = [\n ...(specOp ? augmentResponses(spec, op, specOp, modelsByName) : []),\n ...augmentParameters(spec, op, specOp, modelsByName),\n ];\n\n op.responses.forEach(addLanguageTypes);\n op.responses = orderBy(op.responses, (r) => r.code);\n\n // Result is the lowest successful response, otherwise the 2XX or default.\n op.result =\n op.responses.find(\n (r) => typeof r.code === 'number' && r.code >= 200 && r.code < 300,\n ) ?? op.responses.find((r) => r.code === '2XX' || r.code === 'default');\n\n op.operationIdPascalCase = pascalCase(op.uniqueName);\n op.operationIdSnakeCase = toPythonName('operation', op.uniqueName);\n\n if (op.parameters.length > 0) {\n const baseRequestTypeName = `${op.operationIdPascalCase}Request`;\n // Use the OperationRequest suffix when the standard Request name clashes\n // with an existing schema.\n op.requestTypeName = spec.components?.schemas?.[baseRequestTypeName]\n ? `${op.operationIdPascalCase}OperationRequest`\n : baseRequestTypeName;\n }\n\n augmentOperationBehaviour(op);\n\n return modelImports;\n};\n\n/**\n * Set an operation's name and its deduplicated variants from the vendor\n * extensions the normaliser added.\n */\nconst assignOperationNames = (\n op: Operation,\n specOp: OpenAPIV3.OperationObject | undefined,\n): void => {\n const deduplicatedOpId = specOp?.['x-aws-nx-deduplicated-op-id'] as\n | string\n | undefined;\n const dotNotationOpId = specOp?.['x-aws-nx-deduplicated-dot-op-id'] as\n | string\n | undefined;\n\n op.name = op.id ?? op.name;\n op.uniqueName = deduplicatedOpId ?? op.name;\n if (dotNotationOpId) {\n op.dotNotationName = dotNotationOpId;\n }\n};\n\n/**\n * Augment an operation's response models with schema-derived data, resolving\n * void responses and streaming item schemas. Returns the response model names\n * to import.\n */\nconst augmentResponses = (\n spec: Spec,\n op: Operation,\n specOp: OpenAPIV3.OperationObject,\n modelsByName: ModelsByName,\n): string[] => {\n const modelImports = op.responses\n .filter((r) => r.export === 'reference')\n .map((r) => r.type);\n\n for (const response of op.responses) {\n // We cannot distinguish a composite of primitives at runtime (it all comes\n // back as text), so validate this away.\n if (\n response.export === 'reference' &&\n COMPOSED_SCHEMA_TYPES.has(modelsByName[response.type]?.export)\n ) {\n const composedPrimitives = (\n modelsByName[response.type].composedPrimitives ?? []\n ).filter((p) => !COLLECTION_TYPES.has(p.export));\n if (composedPrimitives.length > 0) {\n throw new Error(\n `Operation \"${op.method} ${op.path}\" returns a composite schema of primitives with ${camelCase(modelsByName[response.type].export)}, which cannot be distinguished at runtime`,\n );\n }\n }\n\n const matchingSpecResponse = specOp.responses[`${response.code}`];\n if (!matchingSpecResponse) continue;\n\n const specResponse = resolveIfRef(spec, matchingSpecResponse);\n\n // When there's no content, the response type is 'void'\n if (!specResponse.content) {\n response.type = 'void';\n continue;\n }\n\n const mediaTypes = Object.keys(specResponse.content);\n response.mediaTypes = mediaTypes;\n\n for (const mediaType of mediaTypes) {\n const responseContent = specResponse.content[mediaType];\n const responseSchema = resolveIfRef(spec, responseContent.schema);\n if (responseSchema) {\n augmentModelFromSchema(spec, response, responseSchema, modelsByName);\n }\n if (\n STREAMING_CONTENT_TYPES.has(mediaType) &&\n 'itemSchema' in responseContent\n ) {\n response.isJsonlStreaming = true;\n response.itemSchemaModel = buildOrReferenceModel(\n spec,\n modelsByName,\n responseContent.itemSchema as OpenApiSchemaOrRef,\n );\n }\n }\n }\n\n return modelImports;\n};\n\n/**\n * Augment an operation's parameter models with schema-derived data, resolving\n * request bodies and query/header collection formats. Returns the parameter\n * model names to import.\n */\nconst augmentParameters = (\n spec: Spec,\n op: Operation,\n specOp: OpenAPIV3.OperationObject | undefined,\n modelsByName: ModelsByName,\n): string[] => {\n const specParametersByKey = getSpecParametersByKey(\n spec,\n specOp,\n getSpecPathParameters(spec, op),\n );\n\n const modelImports: string[] = [];\n\n for (const parameter of op.parameters) {\n if (parameter.export === 'reference') {\n modelImports.push(parameter.type);\n }\n\n const specParameter =\n specParametersByKey[\n specParameterKey({ in: parameter.in, name: parameter.prop })\n ];\n const specParameterSchema = resolveIfRef(spec, specParameter?.schema);\n if (specParameterSchema) {\n augmentModelFromSchema(\n spec,\n parameter,\n specParameterSchema,\n modelsByName,\n );\n }\n\n if (parameter.in === 'body') {\n augmentBodyParameter(spec, parameter, specOp, modelsByName);\n } else if (\n (parameter.in === 'query' || parameter.in === 'header') &&\n specParameter\n ) {\n parameter.collectionFormat = getCollectionFormat(\n parameter.in,\n specParameter,\n );\n if (parameter.in === 'query' && specParameter.allowReserved) {\n parameter.allowReserved = true;\n }\n } else if (parameter.in === 'path' && specParameter) {\n const style = specParameter.style;\n if (style === 'matrix' || style === 'label') {\n parameter.pathStyle = style;\n parameter.pathExplode = !!specParameter.explode;\n }\n }\n\n addLanguageTypes(parameter);\n }\n\n return modelImports;\n};\n\n/**\n * Augment a request body parameter with its schema (the body is not in the\n * spec's `parameters`, so it is resolved from `requestBody` here) and record\n * its acceptable media types.\n */\nconst augmentBodyParameter = (\n spec: Spec,\n parameter: Model,\n specOp: OpenAPIV3.OperationObject | undefined,\n modelsByName: ModelsByName,\n): void => {\n // The request body parameter is named 'body' downstream.\n parameter.name = 'body';\n parameter.prop = 'body';\n\n const specBody = resolveIfRef(spec, specOp?.requestBody);\n if (!specBody) return;\n\n if (parameter.mediaType) {\n const bodySchema = resolveIfRef(\n spec,\n specBody.content?.[parameter.mediaType]?.schema,\n );\n if (bodySchema) {\n augmentModelFromSchema(spec, parameter, bodySchema, modelsByName);\n }\n }\n // Track all the media types that can be accepted in the request body\n parameter.mediaTypes = Object.keys(specBody.content);\n};\n\n/**\n * Translate an OpenAPI v3 parameter's style/explode into a v2-style\n * collectionFormat used when serialising array parameters.\n * @see https://spec.openapis.org/oas/v3.0.3.html#style-values\n */\nconst getCollectionFormat = (\n position: 'query' | 'header',\n specParameter: OpenAPIV3.ParameterObject,\n): CollectionFormat => {\n const style =\n specParameter.style ?? (position === 'query' ? 'form' : 'simple');\n const explode = specParameter.explode ?? style === 'form';\n\n if (position === 'header') {\n return explode ? 'multi' : 'csv';\n }\n // `deepObject` serialises an object as `key[prop]=value` pairs regardless of\n // explode; the object shape (not array collection) drives its serialisation.\n if (style === 'deepObject') {\n return 'deepObject';\n }\n return explode\n ? 'multi'\n : ((\n {\n spaceDelimited: 'ssv',\n pipeDelimited: 'pipes',\n simple: 'csv',\n form: 'csv',\n } as const\n )[style] ?? 'multi');\n};\n\n/**\n * Build the request parameter models for an operation — one model per parameter\n * position (query/path/header/cookie/body), named e.g.\n * `FooRequestQueryParameters`. Request bodies that can be represented directly\n * (the sole parameter, or a non-clashing object reference) are inlined rather\n * than given a wrapper model, and recorded on `op.explicitRequestBodyParameter`.\n */\nconst buildRequestParameterModels = (\n op: Operation,\n modelsByName: ModelsByName,\n): Model[] => {\n if (!op.parameters || op.parameters.length === 0) {\n return [];\n }\n\n // Whether the request body can be represented directly, without a wrapper\n // model (ie the request will be the body itself).\n const canInlineBody = (body: Model): boolean => {\n // If the body is the only parameter, we can inline it no matter the type\n if (op.parameters.length === 1) {\n return true;\n }\n // We inline object bodies, so long as they aren't dictionaries (as\n // dictionary keys could clash with other parameters), and so long as they\n // don't have a property name that clashes with another parameter\n const hasClashingPropertyName = (\n modelsByName?.[body.type]?.properties ?? []\n ).some((prop) => op.parameters.some((param) => param.name === prop.name));\n return (\n body.export === 'reference' &&\n modelsByName?.[body.type]?.export !== 'dictionary' &&\n !hasClashingPropertyName\n );\n };\n\n // Group parameters by their position (`in`: query/path/header/cookie/body),\n // dropping any body that can be inlined.\n const parametersByPosition = op.parameters\n .filter((p) => !(p.in === 'body' && canInlineBody(p)))\n .reduce<{ [position: string]: Model[] }>(\n (acc, p) => ({ ...acc, [p.in]: [...(acc[p.in] ?? []), p] }),\n {},\n );\n\n // The body parameter was already renamed to \"body\" by augmentBodyParameter.\n op.explicitRequestBodyParameter = parametersByPosition['body']?.[0];\n\n return Object.entries(parametersByPosition).map(([position, parameters]) => {\n const name = `${op.operationIdPascalCase}Request${upperFirst(position)}Parameters`;\n return createModel({\n description: op.description,\n export: 'interface',\n name,\n properties: parameters,\n type: name,\n isRequired: true,\n });\n });\n};\n\n/**\n * Augment a single model with schema-derived data (from its matching spec\n * schema, if any) and language-specific names and types.\n */\nconst augmentModel = (\n spec: Spec,\n model: Model,\n modelsByName: ModelsByName,\n): void => {\n model.nameSnakeCase = toPythonName('model', model.name);\n\n const matchingSpecModel = spec?.components?.schemas?.[model.name];\n if (matchingSpecModel) {\n const specModel = resolveIfRef(spec, matchingSpecModel);\n\n augmentModelFromSchema(spec, model, specModel, modelsByName);\n\n for (const property of model.properties) {\n const matchingSpecProperty = specModel.properties?.[property.name];\n if (matchingSpecProperty) {\n const specProperty = resolveIfRef(spec, matchingSpecProperty);\n augmentModelFromSchema(spec, property, specProperty, modelsByName);\n }\n }\n }\n\n model.properties.forEach(addLanguageTypes);\n\n // Resolve the discriminator's TypeScript property name for marshalling.\n if (model.discriminator) {\n model.discriminator.typescriptPropertyName = toTypeScriptName(\n model.discriminator.propertyName,\n );\n }\n};\n\n/**\n * Ensure no two properties/parameters of an object model collapse onto the same\n * TypeScript identifier (e.g. `foo-bar` and `foo_bar` both camelCase to\n * `fooBar`, or a query and header parameter sharing a name within one request\n * position). Such a clash would emit a type with duplicate members that does\n * not compile, so fail fast with an actionable error instead.\n */\nconst assertNoClashingPropertyNames = (model: Model): void => {\n const seen = new Map<string, string>();\n for (const property of model.properties) {\n // Composite members are unnamed (their names are empty); skip them.\n if (!property.name) continue;\n const existing = seen.get(property.typescriptName!);\n if (existing !== undefined && existing !== property.name) {\n throw new Error(\n `Property name conflict in \"${model.name}\": \"${existing}\" and \"${property.name}\" both map to the TypeScript name \"${property.typescriptName}\". Please rename one of these in your OpenAPI specification.`,\n );\n }\n seen.set(property.typescriptName!, property.name);\n }\n};\n\n/**\n * The marshalling semantics of a property — two properties with the same key\n * convert identically on the wire (so either branch's conversion is safe).\n */\nconst marshallingKey = (m: Model): string => {\n if (['date', 'date-time'].includes(m.format ?? '')) return 'date';\n if (m.type === 'binary') return 'binary';\n // Enums serialise as their bare primitive (no conversion).\n if (m.isEnum || m.export === 'enum') return 'plain';\n if (COLLECTION_TYPES.has(m.export)) {\n return `${m.export}<${m.link ? marshallingKey(m.link) : 'plain'}>`;\n }\n if (m.export === 'tuple') {\n return `tuple<${m.properties.map(marshallingKey).join(',')}>`;\n }\n if (m.export === 'reference' && !PRIMITIVE_TYPES.has(m.type)) {\n return `ref:${m.type}`;\n }\n return 'plain';\n};\n\n/**\n * A non-discriminated `oneOf`/`anyOf` of object members marshals by composing\n * every member, taking only the properties present on the value. That is sound\n * exactly when no wire property is claimed by two members with different\n * marshalling (e.g. a `date-time` in one and a plain string in another) —\n * otherwise the branch cannot be determined without guessing, so fail fast and\n * ask for a discriminator rather than corrupt data at runtime.\n */\nconst assertNoConflictingUnionMemberMarshalling = (model: Model): void => {\n if (\n (model.export !== 'one-of' && model.export !== 'any-of') ||\n model.discriminator\n ) {\n return;\n }\n const seen = new Map<string, { memberName: string; key: string }>();\n for (const member of model.composedModels ?? []) {\n for (const property of member.properties) {\n if (!property.name) continue;\n const key = marshallingKey(property);\n const existing = seen.get(property.name);\n if (existing && existing.key !== key) {\n throw new Error(\n `Schema \"${model.name}\" is a non-discriminated ${camelCase(model.export)} of \"${existing.memberName}\" and \"${member.name}\", which both declare a property \"${property.name}\" with different types, so the correct conversion cannot be determined. Add a discriminator to the union in your OpenAPI specification (e.g. with Pydantic, Field(discriminator=...)).`,\n );\n }\n if (!existing) {\n seen.set(property.name, { memberName: member.name, key });\n }\n }\n }\n};\n\n/**\n * Group operations by their (camelCased) tags, collecting any untagged\n * operations separately.\n */\nconst groupOperationsByTag = (\n allOperations: Operation[],\n): {\n operationsByTag: { [tag: string]: Operation[] };\n untaggedOperations: Operation[];\n} => {\n const isTagged = (op: Operation): boolean => !!op.tags && op.tags.length > 0;\n\n const operationsByTag = allOperations\n .filter(isTagged)\n .flatMap((op) => op.tags!.map((tag) => [camelCase(tag), op] as const))\n .reduce<{ [tag: string]: Operation[] }>(\n (acc, [tag, op]) => ({ ...acc, [tag]: [...(acc[tag] ?? []), op] }),\n {},\n );\n\n return {\n operationsByTag,\n untaggedOperations: allOperations.filter((op) => !isTagged(op)),\n };\n};\n\n/**\n * Resolve a schema to its model: an existing named model for a `$ref`, or a\n * freshly built-and-augmented model for an inline (nested value) schema.\n */\nconst buildOrReferenceModel = (\n spec: Spec,\n modelsByName: ModelsByName,\n schema: OpenApiSchemaOrRef,\n): Model => {\n if (isRef(schema)) {\n const name = splitRef(schema.$ref)[2];\n return modelsByName[name];\n }\n const model = buildInlineModel(spec, schema);\n linkModel(spec, modelsByName, model, schema);\n augmentModelFromSchema(spec, model, schema, modelsByName);\n return model;\n};\n\n/**\n * The `x-*` vendor extensions declared on an object.\n */\nconst vendorExtensionsOf = (object: object | undefined): VendorExtensions =>\n Object.fromEntries(\n Object.entries(object ?? {}).filter(([key]) => key.startsWith('x-')),\n );\n\nconst augmentModelFromSchema = (\n spec: Spec,\n model: Model,\n schema: OpenApiSchema,\n modelsByName: ModelsByName,\n visited: Set<Model> = new Set(),\n) => {\n model.format = schema.format;\n model.deprecated = !!schema.deprecated;\n model.openapiType = schema.type;\n model.isEnum = !!schema.enum && schema.enum.length > 0;\n model.vendorExtensions = vendorExtensionsOf(schema);\n\n // A \"dictionary\" has only additional properties; an \"interface\" may mix\n // explicit and additional properties.\n if (schema.additionalProperties) {\n const additionalPropertiesModel = buildOrReferenceModel(\n spec,\n modelsByName,\n schema.additionalProperties === true ? {} : schema.additionalProperties,\n );\n\n if (model.export === 'dictionary') {\n // A dictionary carries a self-referential property; the rest are explicit\n const explicitProperties = model.properties.filter(\n (p) => !(p.export === 'dictionary' && p.name === model.name),\n );\n\n // Explicit properties make this an interface rather than a dictionary\n if (explicitProperties.length > 0 || schema.patternProperties) {\n model.export = 'interface';\n model.hasAdditionalProperties = true;\n model.additionalPropertiesModel = additionalPropertiesModel;\n model.properties = explicitProperties;\n }\n } else {\n model.hasAdditionalProperties = true;\n model.additionalPropertiesModel = additionalPropertiesModel;\n }\n }\n\n // Pattern properties can have different value types per pattern, so the model\n // is an interface rather than a dictionary.\n if (schema.patternProperties) {\n const patternProperties = resolveIfRef(spec, schema.patternProperties);\n\n if (model.export === 'dictionary') {\n model.export = 'interface';\n }\n\n model.hasPatternProperties = true;\n model.patternPropertiesModels = Object.entries(patternProperties)\n .map(([pattern, patternProperty]) => ({\n pattern,\n model: buildOrReferenceModel(spec, modelsByName, patternProperty),\n }))\n .filter((entry): entry is PatternPropertyModel => !!entry.model);\n }\n\n addLanguageTypes(model);\n\n visited.add(model);\n\n const recurse = (target: Model, subSchema: OpenApiSchema): void =>\n augmentModelFromSchema(spec, target, subSchema, modelsByName, visited);\n\n // Array element type.\n if (\n model.export === 'array' &&\n model.link &&\n 'items' in schema &&\n schema.items &&\n !visited.has(model.link)\n ) {\n recurse(model.link, resolveIfRef(spec, schema.items));\n }\n\n // Dictionary value type (additionalProperties may be `true` rather than a\n // schema).\n if (\n model.export === 'dictionary' &&\n model.link &&\n 'additionalProperties' in schema &&\n schema.additionalProperties &&\n !visited.has(model.link)\n ) {\n const subSchema = resolveIfRef(spec, schema.additionalProperties);\n if (subSchema !== true) {\n recurse(model.link, subSchema);\n }\n }\n\n // Tuple element types (3.1 `prefixItems`), positionally.\n if (model.export === 'tuple' && 'prefixItems' in schema) {\n const memberSchemas =\n (schema as { prefixItems?: OpenApiSchemaOrRef[] }).prefixItems ?? [];\n model.properties.forEach((member, i) => {\n const subSchema = resolveIfRef(spec, memberSchemas[i]);\n if (subSchema && !visited.has(member)) {\n recurse(member, subSchema);\n }\n });\n }\n\n model.properties\n .filter((p) => !visited.has(p) && schema.properties?.[trim(p.name, `\"'`)])\n .forEach((property) =>\n recurse(\n property,\n resolveIfRef(spec, schema.properties![trim(property.name, `\"'`)]),\n ),\n );\n\n if (COMPOSED_SCHEMA_TYPES.has(model.export)) {\n const memberSchemas = compositeMemberSchemas(schema, model.export);\n model.properties.forEach((property, i) => {\n const subSchema = resolveIfRef(spec, memberSchemas[i]);\n if (subSchema) {\n recurse(property, subSchema);\n }\n });\n }\n};\n\nconst addLanguageTypes = (model: Model) => {\n model.name = trim(model.name, `\"'`);\n model.typescriptName = toTypeScriptName(model.name);\n model.typescriptType = toTypeScriptType(model);\n model.pythonName = toPythonName('property', model.name);\n model.pythonType = toPythonType(model);\n model.isPrimitive =\n PRIMITIVE_TYPES.has(model.type) &&\n !COMPOSED_SCHEMA_TYPES.has(model.export) &&\n !COLLECTION_TYPES.has(model.export);\n};\n\nconst isOperationMutation = (op: Operation): boolean => {\n // x-mutation/x-query override the HTTP-method default.\n const { vendorExtensions } = op;\n if (vendorExtensions?.[VENDOR_EXTENSIONS.MUTATION]) {\n return true;\n } else if (vendorExtensions?.[VENDOR_EXTENSIONS.QUERY]) {\n return false;\n }\n return ['PATCH', 'POST', 'PUT', 'DELETE'].includes(op.method);\n};\n\nconst augmentInfiniteQuery = (op: Operation) => {\n const { paginationDisabled, cursorPropertyName } = getCursorOptions(op);\n\n const cursorProperty = op.parameters.find(\n (p) => p.name === cursorPropertyName,\n );\n\n // An infinite query is a paginated operation that accepts the cursor parameter\n op.isInfiniteQuery = !paginationDisabled && !!cursorProperty;\n if (op.isInfiniteQuery) {\n op.infiniteQueryCursorProperty = cursorProperty;\n }\n};\n\n/**\n * Resolve the pagination cursor options from an operation's `x-cursor` vendor\n * extension. Accepted forms (object variants exist because Smithy vendor\n * extensions must be objects):\n *\n * - `'property'` / `{ inputToken: 'property' }` — the input property to page on\n * - `false` / `{ enabled: false }` — disable pagination\n */\nconst getCursorOptions = (\n op: Operation,\n): { paginationDisabled: boolean; cursorPropertyName: string } => {\n const cursor = op.vendorExtensions?.[VENDOR_EXTENSIONS.CURSOR];\n\n // Defaults: pagination enabled, paging on a property named 'cursor'.\n if (cursor === false) {\n return { paginationDisabled: true, cursorPropertyName: 'cursor' };\n }\n if (typeof cursor === 'string') {\n return { paginationDisabled: false, cursorPropertyName: cursor };\n }\n const options = (cursor ?? {}) as { enabled?: boolean; inputToken?: unknown };\n return {\n paginationDisabled: options.enabled === false,\n cursorPropertyName:\n typeof options.inputToken === 'string' ? options.inputToken : 'cursor',\n };\n};\n\n/**\n * Add query/mutation, streaming and infinite-query flags to an operation.\n */\nconst augmentOperationBehaviour = (op: Operation) => {\n const isMutation = isOperationMutation(op);\n op.isMutation = isMutation;\n op.isQuery = !isMutation;\n\n op.isStreaming =\n !!op.vendorExtensions?.[VENDOR_EXTENSIONS.STREAMING] ||\n op.responses.some((res) => res.isJsonlStreaming);\n\n // For JSON-lines streaming, the result is each streamed item, so the client\n // method returns AsyncIterableIterator<itemSchemaModel>. Named (hoisted)\n // item schemas become references; inline primitives keep their own type.\n const jsonlResponse = op.responses.find((res) => res.isJsonlStreaming);\n if (jsonlResponse) {\n const itemSchemaModel = jsonlResponse.itemSchemaModel;\n const result = op.result;\n if (result && itemSchemaModel) {\n if (itemSchemaModel.name) {\n result.type = itemSchemaModel.name;\n result.typescriptType = itemSchemaModel.name;\n result.export = 'reference';\n } else {\n result.type = itemSchemaModel.type;\n result.typescriptType = itemSchemaModel.typescriptType;\n result.export = itemSchemaModel.export;\n result.format = itemSchemaModel.format;\n result.link = itemSchemaModel.link;\n result.isPrimitive = itemSchemaModel.isPrimitive;\n }\n }\n }\n\n // Add infinite query details if applicable\n if (!isMutation) {\n augmentInfiniteQuery(op);\n }\n};\n"],"names":["orderBy","trim","uniqBy","camelCase","pascalCase","snakeCase","toClassName","upperFirst","toPythonName","toPythonType","toTypeScriptModelName","toTypeScriptName","toTypeScriptType","COLLECTION_TYPES","COMPOSED_SCHEMA_TYPES","createModel","DEFAULT_SERVICE_NAME","indexModelsByName","PRIMITIVE_TYPES","STREAMING_CONTENT_TYPES","VENDOR_EXTENSIONS","normaliseOpenApiSpecForCodeGen","buildClientData","buildInlineModel","compositeMemberSchemas","getSpecOperation","getSpecParametersByKey","getSpecPathParameters","linkModel","specParameterKey","isRef","resolveIfRef","splitRef","buildOpenApiCodeGenData","inSpec","spec","data","modelsByName","models","service","services","augmentService","allOperations","flatMap","s","operations","o","uniqueName","op","buildRequestParameterModels","model","augmentModel","typescriptName","name","typescriptType","assertNoClashingPropertyNames","assertNoConflictingUnionMemberMarshalling","d","operationsByTag","untaggedOperations","groupOperationsByTag","info","vendorExtensions","vendorExtensionsOf","className","title","modelImports","augmentOperation","imports","x","nameSnakeCase","specOp","assignOperationNames","augmentResponses","augmentParameters","responses","forEach","addLanguageTypes","r","code","result","find","operationIdPascalCase","operationIdSnakeCase","parameters","length","baseRequestTypeName","requestTypeName","components","schemas","augmentOperationBehaviour","deduplicatedOpId","dotNotationOpId","id","dotNotationName","filter","export","map","type","response","has","composedPrimitives","p","Error","method","path","matchingSpecResponse","specResponse","content","mediaTypes","Object","keys","mediaType","responseContent","responseSchema","schema","augmentModelFromSchema","isJsonlStreaming","itemSchemaModel","buildOrReferenceModel","itemSchema","specParametersByKey","parameter","push","specParameter","in","prop","specParameterSchema","augmentBodyParameter","collectionFormat","getCollectionFormat","allowReserved","style","pathStyle","pathExplode","explode","specBody","requestBody","bodySchema","position","spaceDelimited","pipeDelimited","simple","form","canInlineBody","body","hasClashingPropertyName","properties","some","param","parametersByPosition","reduce","acc","explicitRequestBodyParameter","entries","description","isRequired","matchingSpecModel","specModel","property","matchingSpecProperty","specProperty","discriminator","typescriptPropertyName","propertyName","seen","Map","existing","get","undefined","set","marshallingKey","m","includes","format","isEnum","link","join","member","composedModels","key","memberName","isTagged","tags","tag","$ref","object","fromEntries","startsWith","visited","Set","deprecated","openapiType","enum","additionalProperties","additionalPropertiesModel","explicitProperties","patternProperties","hasAdditionalProperties","hasPatternProperties","patternPropertiesModels","pattern","patternProperty","entry","add","recurse","target","subSchema","items","memberSchemas","prefixItems","i","pythonName","pythonType","isPrimitive","isOperationMutation","MUTATION","QUERY","augmentInfiniteQuery","paginationDisabled","cursorPropertyName","getCursorOptions","cursorProperty","isInfiniteQuery","infiniteQueryCursorProperty","cursor","CURSOR","options","enabled","inputToken","isMutation","isQuery","isStreaming","STREAMING","res","jsonlResponse"],"mappings":"AAAA;;;CAGC,GAED,OAAOA,aAAa,iBAAiB;AACrC,OAAOC,UAAU,cAAc;AAC/B,OAAOC,YAAY,gBAAgB;AAEnC,SACEC,SAAS,EACTC,UAAU,EACVC,SAAS,EACTC,WAAW,EACXC,UAAU,QACL,uBAAoB;AAC3B,SACEC,YAAY,EACZC,YAAY,EACZC,qBAAqB,EACrBC,gBAAgB,EAChBC,gBAAgB,QACX,8BAA2B;AAClC,SACEC,gBAAgB,EAChBC,qBAAqB,EAGrBC,WAAW,EACXC,oBAAoB,EACpBC,iBAAiB,EAKjBC,eAAe,EAEfC,uBAAuB,EACvBC,iBAAiB,QAEZ,0BAAuB;AAC9B,SAASC,8BAA8B,QAAQ,iBAAc;AAC7D,SACEC,eAAe,EACfC,gBAAgB,EAChBC,sBAAsB,EACtBC,gBAAgB,EAChBC,sBAAsB,EACtBC,qBAAqB,EACrBC,SAAS,EACTC,gBAAgB,QACX,cAAW;AAClB,SAASC,KAAK,EAAEC,YAAY,EAAEC,QAAQ,QAAQ,YAAS;AAGvD;;CAEC,GACD,OAAO,MAAMC,0BAA0B,CAACC;IACtC,MAAMC,OAAOd,+BAA+Ba;IAC5C,MAAME,OAAOd,gBAAgBa;IAE7B,MAAME,eAA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MAAMsH,gBAAgB3L,GAAG2B,SAAS,CAACM,IAAI,CAAC,CAACyJ,MAAQA,IAAIrH,gBAAgB;IACrE,IAAIsH,eAAe;QACjB,MAAMrH,kBAAkBqH,cAAcrH,eAAe;QACrD,MAAMtC,SAAShC,GAAGgC,MAAM;QACxB,IAAIA,UAAUsC,iBAAiB;YAC7B,IAAIA,gBAAgBjE,IAAI,EAAE;gBACxB2B,OAAOkB,IAAI,GAAGoB,gBAAgBjE,IAAI;gBAClC2B,OAAO1B,cAAc,GAAGgE,gBAAgBjE,IAAI;gBAC5C2B,OAAOgB,MAAM,GAAG;YAClB,OAAO;gBACLhB,OAAOkB,IAAI,GAAGoB,gBAAgBpB,IAAI;gBAClClB,OAAO1B,cAAc,GAAGgE,gBAAgBhE,cAAc;gBACtD0B,OAAOgB,MAAM,GAAGsB,gBAAgBtB,MAAM;gBACtChB,OAAO8F,MAAM,GAAGxD,gBAAgBwD,MAAM;gBACtC9F,OAAOgG,IAAI,GAAG1D,gBAAgB0D,IAAI;gBAClChG,OAAOsI,WAAW,GAAGhG,gBAAgBgG,WAAW;YAClD;QACF;IACF;IAEA,2CAA2C;IAC3C,IAAI,CAACgB,YAAY;QACfZ,qBAAqB1K;IACvB;AACF"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/open-api/utils/codegen-data.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport orderBy from 'lodash.orderby';\nimport trim from 'lodash.trim';\nimport uniqBy from 'lodash.uniqby';\nimport type { OpenAPIV3 } from 'openapi-types';\nimport {\n camelCase,\n pascalCase,\n snakeCase,\n toClassName,\n upperFirst,\n} from '../../utils/names';\nimport {\n toPythonName,\n toPythonType,\n toTypeScriptModelName,\n toTypeScriptName,\n toTypeScriptType,\n} from './codegen-data/languages';\nimport {\n COLLECTION_TYPES,\n COMPOSED_SCHEMA_TYPES,\n type CodeGenData,\n type CollectionFormat,\n createModel,\n DEFAULT_SERVICE_NAME,\n indexModelsByName,\n type Model,\n type ModelsByName,\n type Operation,\n type PatternPropertyModel,\n PRIMITIVE_TYPES,\n type Service,\n STREAMING_CONTENT_TYPES,\n VENDOR_EXTENSIONS,\n type VendorExtensions,\n} from './codegen-data/types';\nimport { normaliseOpenApiSpecForCodeGen } from './normalise';\nimport {\n buildClientData,\n buildInlineModel,\n compositeMemberSchemas,\n getSpecOperation,\n getSpecParametersByKey,\n getSpecPathParameters,\n linkModel,\n specParameterKey,\n} from './parser';\nimport { isRef, resolveIfRef, splitRef } from './refs';\nimport type { OpenApiSchema, OpenApiSchemaOrRef, Spec } from './types';\n\n/**\n * Build the data structure used to generate code from an OpenAPI spec.\n */\nexport const buildOpenApiCodeGenData = (inSpec: Spec): CodeGenData => {\n const spec = normaliseOpenApiSpecForCodeGen(inSpec);\n const data = buildClientData(spec);\n\n const modelsByName = indexModelsByName(data.models);\n\n for (const service of data.services) {\n augmentService(spec, service, modelsByName);\n }\n\n const allOperations = uniqBy(\n data.services.flatMap((s) => s.operations),\n (o) => o.uniqueName,\n );\n\n // A model per operation request parameter position (query/path/body/...).\n data.models = [\n ...data.models,\n ...allOperations.flatMap((op) =>\n buildRequestParameterModels(op, modelsByName),\n ),\n ];\n\n for (const model of data.models) {\n augmentModel(spec, model, modelsByName);\n }\n for (const model of data.models) {\n model.typescriptName = toTypeScriptModelName(model.name);\n model.typescriptType = model.typescriptName;\n }\n\n for (const model of data.models) {\n assertNoClashingPropertyNames(model);\n assertNoConflictingUnionMemberMarshalling(model);\n }\n\n for (const op of allOperations) {\n assertEncodableUrlEncodedBody(op);\n }\n\n data.models = orderBy(data.models, (d) => d.name);\n // Default service first, then by name.\n data.services = orderBy(data.services, (s) =>\n s.name === DEFAULT_SERVICE_NAME ? '' : s.name,\n );\n\n const { operationsByTag, untaggedOperations } =\n groupOperationsByTag(allOperations);\n\n return {\n ...data,\n operationsByTag,\n untaggedOperations,\n info: spec.info,\n allOperations,\n vendorExtensions: vendorExtensionsOf(spec),\n className: toClassName(spec.info.title),\n };\n};\n\n/**\n * Augment a service and each of its operations with the data needed for code\n * generation (names, imports, result/request types, behavioural flags), and\n * compute the set of models the service (ie API client) needs to import.\n */\nconst augmentService = (\n spec: Spec,\n service: Service,\n modelsByName: ModelsByName,\n): void => {\n const modelImports = service.operations.flatMap((op) =>\n augmentOperation(spec, op, modelsByName),\n );\n\n service.operations = orderBy(service.operations, (op) => op.uniqueName);\n service.modelImports = orderBy(\n uniqBy([...service.imports, ...modelImports], (x) => x),\n );\n service.className = `${service.name}Api`;\n service.nameSnakeCase = snakeCase(service.name);\n};\n\n/**\n * Augment a single operation with all the data the templates need, returning\n * the names of the models it references (for the service's import list).\n */\nconst augmentOperation = (\n spec: Spec,\n op: Operation,\n modelsByName: ModelsByName,\n): string[] => {\n const specOp = getSpecOperation(spec, op);\n\n assignOperationNames(op, specOp);\n\n op.vendorExtensions = vendorExtensionsOf(specOp);\n\n const modelImports = [\n ...(specOp ? augmentResponses(spec, op, specOp, modelsByName) : []),\n ...augmentParameters(spec, op, specOp, modelsByName),\n ];\n\n op.responses.forEach(addLanguageTypes);\n op.responses = orderBy(op.responses, (r) => r.code);\n\n // Result is the lowest successful response, otherwise the 2XX or default.\n op.result =\n op.responses.find(\n (r) => typeof r.code === 'number' && r.code >= 200 && r.code < 300,\n ) ?? op.responses.find((r) => r.code === '2XX' || r.code === 'default');\n\n op.operationIdPascalCase = pascalCase(op.uniqueName);\n op.operationIdSnakeCase = toPythonName('operation', op.uniqueName);\n\n if (op.parameters.length > 0) {\n const baseRequestTypeName = `${op.operationIdPascalCase}Request`;\n // Use the OperationRequest suffix when the standard Request name clashes\n // with an existing schema.\n op.requestTypeName = spec.components?.schemas?.[baseRequestTypeName]\n ? `${op.operationIdPascalCase}OperationRequest`\n : baseRequestTypeName;\n }\n\n augmentOperationBehaviour(op);\n\n return modelImports;\n};\n\n/**\n * Set an operation's name and its deduplicated variants from the vendor\n * extensions the normaliser added.\n */\nconst assignOperationNames = (\n op: Operation,\n specOp: OpenAPIV3.OperationObject | undefined,\n): void => {\n const deduplicatedOpId = specOp?.['x-aws-nx-deduplicated-op-id'] as\n | string\n | undefined;\n const dotNotationOpId = specOp?.['x-aws-nx-deduplicated-dot-op-id'] as\n | string\n | undefined;\n\n op.name = op.id ?? op.name;\n op.uniqueName = deduplicatedOpId ?? op.name;\n if (dotNotationOpId) {\n op.dotNotationName = dotNotationOpId;\n }\n};\n\n/**\n * Augment an operation's response models with schema-derived data, resolving\n * void responses and streaming item schemas. Returns the response model names\n * to import.\n */\nconst augmentResponses = (\n spec: Spec,\n op: Operation,\n specOp: OpenAPIV3.OperationObject,\n modelsByName: ModelsByName,\n): string[] => {\n const modelImports = op.responses\n .filter((r) => r.export === 'reference')\n .map((r) => r.type);\n\n for (const response of op.responses) {\n // We cannot distinguish a composite of primitives at runtime (it all comes\n // back as text), so validate this away.\n if (\n response.export === 'reference' &&\n COMPOSED_SCHEMA_TYPES.has(modelsByName[response.type]?.export)\n ) {\n const composedPrimitives = (\n modelsByName[response.type].composedPrimitives ?? []\n ).filter((p) => !COLLECTION_TYPES.has(p.export));\n if (composedPrimitives.length > 0) {\n throw new Error(\n `Operation \"${op.method} ${op.path}\" returns a composite schema of primitives with ${camelCase(modelsByName[response.type].export)}, which cannot be distinguished at runtime`,\n );\n }\n }\n\n const matchingSpecResponse = specOp.responses[`${response.code}`];\n if (!matchingSpecResponse) continue;\n\n const specResponse = resolveIfRef(spec, matchingSpecResponse);\n\n // When there's no content, the response type is 'void'\n if (!specResponse.content) {\n response.type = 'void';\n continue;\n }\n\n const mediaTypes = Object.keys(specResponse.content);\n response.mediaTypes = mediaTypes;\n\n for (const mediaType of mediaTypes) {\n const responseContent = specResponse.content[mediaType];\n const responseSchema = resolveIfRef(spec, responseContent.schema);\n if (responseSchema) {\n augmentModelFromSchema(spec, response, responseSchema, modelsByName);\n }\n if (\n STREAMING_CONTENT_TYPES.has(mediaType) &&\n 'itemSchema' in responseContent\n ) {\n response.isJsonlStreaming = true;\n response.itemSchemaModel = buildOrReferenceModel(\n spec,\n modelsByName,\n responseContent.itemSchema as OpenApiSchemaOrRef,\n );\n }\n }\n }\n\n return modelImports;\n};\n\n/**\n * Augment an operation's parameter models with schema-derived data, resolving\n * request bodies and query/header collection formats. Returns the parameter\n * model names to import.\n */\nconst augmentParameters = (\n spec: Spec,\n op: Operation,\n specOp: OpenAPIV3.OperationObject | undefined,\n modelsByName: ModelsByName,\n): string[] => {\n const specParametersByKey = getSpecParametersByKey(\n spec,\n specOp,\n getSpecPathParameters(spec, op),\n );\n\n const modelImports: string[] = [];\n\n for (const parameter of op.parameters) {\n if (parameter.export === 'reference') {\n modelImports.push(parameter.type);\n }\n\n const specParameter =\n specParametersByKey[\n specParameterKey({ in: parameter.in, name: parameter.prop })\n ];\n const specParameterSchema = resolveIfRef(spec, specParameter?.schema);\n if (specParameterSchema) {\n augmentModelFromSchema(\n spec,\n parameter,\n specParameterSchema,\n modelsByName,\n );\n }\n\n if (parameter.in === 'body') {\n augmentBodyParameter(spec, parameter, specOp, modelsByName);\n } else if (\n (parameter.in === 'query' || parameter.in === 'header') &&\n specParameter\n ) {\n parameter.collectionFormat = getCollectionFormat(\n parameter.in,\n specParameter,\n );\n if (parameter.in === 'query' && specParameter.allowReserved) {\n parameter.allowReserved = true;\n }\n } else if (parameter.in === 'path' && specParameter) {\n const style = specParameter.style;\n if (style === 'matrix' || style === 'label') {\n parameter.pathStyle = style;\n parameter.pathExplode = !!specParameter.explode;\n }\n }\n\n addLanguageTypes(parameter);\n }\n\n return modelImports;\n};\n\n/**\n * Augment a request body parameter with its schema (the body is not in the\n * spec's `parameters`, so it is resolved from `requestBody` here) and record\n * its acceptable media types.\n */\nconst augmentBodyParameter = (\n spec: Spec,\n parameter: Model,\n specOp: OpenAPIV3.OperationObject | undefined,\n modelsByName: ModelsByName,\n): void => {\n // The request body parameter is named 'body' downstream.\n parameter.name = 'body';\n parameter.prop = 'body';\n\n const specBody = resolveIfRef(spec, specOp?.requestBody);\n if (!specBody) return;\n\n if (parameter.mediaType) {\n const bodySchema = resolveIfRef(\n spec,\n specBody.content?.[parameter.mediaType]?.schema,\n );\n if (bodySchema) {\n augmentModelFromSchema(spec, parameter, bodySchema, modelsByName);\n }\n }\n // Track all the media types that can be accepted in the request body\n parameter.mediaTypes = Object.keys(specBody.content);\n};\n\n/**\n * Translate an OpenAPI v3 parameter's style/explode into a v2-style\n * collectionFormat used when serialising array parameters.\n * @see https://spec.openapis.org/oas/v3.0.3.html#style-values\n */\nconst getCollectionFormat = (\n position: 'query' | 'header',\n specParameter: OpenAPIV3.ParameterObject,\n): CollectionFormat => {\n const style =\n specParameter.style ?? (position === 'query' ? 'form' : 'simple');\n const explode = specParameter.explode ?? style === 'form';\n\n if (position === 'header') {\n return explode ? 'multi' : 'csv';\n }\n // `deepObject` serialises an object as `key[prop]=value` pairs regardless of\n // explode; the object shape (not array collection) drives its serialisation.\n if (style === 'deepObject') {\n return 'deepObject';\n }\n return explode\n ? 'multi'\n : ((\n {\n spaceDelimited: 'ssv',\n pipeDelimited: 'pipes',\n simple: 'csv',\n form: 'csv',\n } as const\n )[style] ?? 'multi');\n};\n\n/**\n * Build the request parameter models for an operation — one model per parameter\n * position (query/path/header/cookie/body), named e.g.\n * `FooRequestQueryParameters`. Request bodies that can be represented directly\n * (the sole parameter, or a non-clashing object reference) are inlined rather\n * than given a wrapper model, and recorded on `op.explicitRequestBodyParameter`.\n */\nconst buildRequestParameterModels = (\n op: Operation,\n modelsByName: ModelsByName,\n): Model[] => {\n if (!op.parameters || op.parameters.length === 0) {\n return [];\n }\n\n // Whether the request body can be represented directly, without a wrapper\n // model (ie the request will be the body itself).\n const canInlineBody = (body: Model): boolean => {\n // If the body is the only parameter, we can inline it no matter the type\n if (op.parameters.length === 1) {\n return true;\n }\n // We inline object bodies, so long as they aren't dictionaries (as\n // dictionary keys could clash with other parameters), and so long as they\n // don't have a property name that clashes with another parameter\n const hasClashingPropertyName = (\n modelsByName?.[body.type]?.properties ?? []\n ).some((prop) => op.parameters.some((param) => param.name === prop.name));\n return (\n body.export === 'reference' &&\n modelsByName?.[body.type]?.export !== 'dictionary' &&\n !hasClashingPropertyName\n );\n };\n\n // Group parameters by their position (`in`: query/path/header/cookie/body),\n // dropping any body that can be inlined.\n const parametersByPosition = op.parameters\n .filter((p) => !(p.in === 'body' && canInlineBody(p)))\n .reduce<{ [position: string]: Model[] }>(\n (acc, p) => ({ ...acc, [p.in]: [...(acc[p.in] ?? []), p] }),\n {},\n );\n\n // The body parameter was already renamed to \"body\" by augmentBodyParameter.\n op.explicitRequestBodyParameter = parametersByPosition['body']?.[0];\n\n return Object.entries(parametersByPosition).map(([position, parameters]) => {\n const name = `${op.operationIdPascalCase}Request${upperFirst(position)}Parameters`;\n return createModel({\n description: op.description,\n export: 'interface',\n name,\n properties: parameters,\n type: name,\n isRequired: true,\n });\n });\n};\n\n/**\n * Augment a single model with schema-derived data (from its matching spec\n * schema, if any) and language-specific names and types.\n */\nconst augmentModel = (\n spec: Spec,\n model: Model,\n modelsByName: ModelsByName,\n): void => {\n model.nameSnakeCase = toPythonName('model', model.name);\n\n const matchingSpecModel = spec?.components?.schemas?.[model.name];\n if (matchingSpecModel) {\n const specModel = resolveIfRef(spec, matchingSpecModel);\n\n augmentModelFromSchema(spec, model, specModel, modelsByName);\n\n for (const property of model.properties) {\n const matchingSpecProperty = specModel.properties?.[property.name];\n if (matchingSpecProperty) {\n const specProperty = resolveIfRef(spec, matchingSpecProperty);\n augmentModelFromSchema(spec, property, specProperty, modelsByName);\n }\n }\n }\n\n model.properties.forEach(addLanguageTypes);\n\n // Resolve the discriminator's TypeScript property name for marshalling.\n if (model.discriminator) {\n model.discriminator.typescriptPropertyName = toTypeScriptName(\n model.discriminator.propertyName,\n );\n }\n};\n\n/**\n * Ensure no two properties/parameters of an object model collapse onto the same\n * TypeScript identifier (e.g. `foo-bar` and `foo_bar` both camelCase to\n * `fooBar`, or a query and header parameter sharing a name within one request\n * position). Such a clash would emit a type with duplicate members that does\n * not compile, so fail fast with an actionable error instead.\n */\nconst assertNoClashingPropertyNames = (model: Model): void => {\n const seen = new Map<string, string>();\n for (const property of model.properties) {\n // Composite members are unnamed (their names are empty); skip them.\n if (!property.name) continue;\n const existing = seen.get(property.typescriptName!);\n if (existing !== undefined && existing !== property.name) {\n throw new Error(\n `Property name conflict in \"${model.name}\": \"${existing}\" and \"${property.name}\" both map to the TypeScript name \"${property.typescriptName}\". Please rename one of these in your OpenAPI specification.`,\n );\n }\n seen.set(property.typescriptName!, property.name);\n }\n};\n\n/**\n * The marshalling semantics of a property — two properties with the same key\n * convert identically on the wire (so either branch's conversion is safe).\n */\nconst marshallingKey = (m: Model): string => {\n if (['date', 'date-time'].includes(m.format ?? '')) return 'date';\n if (m.type === 'binary') return 'binary';\n // Enums serialise as their bare primitive (no conversion).\n if (m.isEnum || m.export === 'enum') return 'plain';\n if (COLLECTION_TYPES.has(m.export)) {\n return `${m.export}<${m.link ? marshallingKey(m.link) : 'plain'}>`;\n }\n if (m.export === 'tuple') {\n return `tuple<${m.properties.map(marshallingKey).join(',')}>`;\n }\n if (m.export === 'reference' && !PRIMITIVE_TYPES.has(m.type)) {\n return `ref:${m.type}`;\n }\n return 'plain';\n};\n\n/**\n * A non-discriminated `oneOf`/`anyOf` of object members marshals by composing\n * every member, taking only the properties present on the value. That is sound\n * exactly when no wire property is claimed by two members with different\n * marshalling (e.g. a `date-time` in one and a plain string in another) —\n * otherwise the branch cannot be determined without guessing, so fail fast and\n * ask for a discriminator rather than corrupt data at runtime.\n */\nconst assertNoConflictingUnionMemberMarshalling = (model: Model): void => {\n if (\n (model.export !== 'one-of' && model.export !== 'any-of') ||\n model.discriminator\n ) {\n return;\n }\n const seen = new Map<string, { memberName: string; key: string }>();\n for (const member of model.composedModels ?? []) {\n for (const property of member.properties) {\n if (!property.name) continue;\n const key = marshallingKey(property);\n const existing = seen.get(property.name);\n if (existing && existing.key !== key) {\n throw new Error(\n `Schema \"${model.name}\" is a non-discriminated ${camelCase(model.export)} of \"${existing.memberName}\" and \"${member.name}\", which both declare a property \"${property.name}\" with different types, so the correct conversion cannot be determined. Add a discriminator to the union in your OpenAPI specification (e.g. with Pydantic, Field(discriminator=...)).`,\n );\n }\n if (!existing) {\n seen.set(property.name, { memberName: member.name, key });\n }\n }\n }\n};\n\n/**\n * An `application/x-www-form-urlencoded` body is form-encoded as `key=value`\n * pairs, so the wire form is only defined for a schema with named properties\n * (an object) or a primitive sent verbatim. A top-level array or tuple has no\n * property names to key on — encoding it would emit index keys (`0=a&1=b`) that\n * no form parser can decode — so fail fast rather than generate a client that\n * is silently wrong on the wire.\n */\nconst assertEncodableUrlEncodedBody = (op: Operation): void => {\n const body = op.parametersBody;\n if (!body?.mediaTypes) return;\n const mediaTypes = Array.isArray(body.mediaTypes)\n ? body.mediaTypes\n : [body.mediaTypes];\n // Match the wire media type the client actually sends: JSON is preferred, so\n // an array body offering both JSON and urlencoded is sent as JSON and is fine.\n const chosenMediaType =\n mediaTypes.find(\n (mt) => mt === 'application/json' || mt.endsWith('+json'),\n ) ?? mediaTypes[0];\n if (chosenMediaType !== 'application/x-www-form-urlencoded') return;\n if (body.isPrimitive) return;\n if (body.export === 'array' || body.export === 'tuple') {\n throw new Error(\n `Operation ${op.method} ${op.path} has an application/x-www-form-urlencoded request body whose schema is a ${body.export}, which has no defined form encoding. Use an object schema (its properties become the form fields) or a primitive schema (sent verbatim) in your OpenAPI specification.`,\n );\n }\n};\n\n/**\n * Group operations by their (camelCased) tags, collecting any untagged\n * operations separately.\n */\nconst groupOperationsByTag = (\n allOperations: Operation[],\n): {\n operationsByTag: { [tag: string]: Operation[] };\n untaggedOperations: Operation[];\n} => {\n const isTagged = (op: Operation): boolean => !!op.tags && op.tags.length > 0;\n\n const operationsByTag = allOperations\n .filter(isTagged)\n .flatMap((op) => op.tags!.map((tag) => [camelCase(tag), op] as const))\n .reduce<{ [tag: string]: Operation[] }>(\n (acc, [tag, op]) => ({ ...acc, [tag]: [...(acc[tag] ?? []), op] }),\n {},\n );\n\n return {\n operationsByTag,\n untaggedOperations: allOperations.filter((op) => !isTagged(op)),\n };\n};\n\n/**\n * Resolve a schema to its model: an existing named model for a `$ref`, or a\n * freshly built-and-augmented model for an inline (nested value) schema.\n */\nconst buildOrReferenceModel = (\n spec: Spec,\n modelsByName: ModelsByName,\n schema: OpenApiSchemaOrRef,\n): Model => {\n if (isRef(schema)) {\n const name = splitRef(schema.$ref)[2];\n return modelsByName[name];\n }\n const model = buildInlineModel(spec, schema);\n linkModel(spec, modelsByName, model, schema);\n augmentModelFromSchema(spec, model, schema, modelsByName);\n return model;\n};\n\n/**\n * The `x-*` vendor extensions declared on an object.\n */\nconst vendorExtensionsOf = (object: object | undefined): VendorExtensions =>\n Object.fromEntries(\n Object.entries(object ?? {}).filter(([key]) => key.startsWith('x-')),\n );\n\nconst augmentModelFromSchema = (\n spec: Spec,\n model: Model,\n schema: OpenApiSchema,\n modelsByName: ModelsByName,\n visited: Set<Model> = new Set(),\n) => {\n model.format = schema.format;\n model.deprecated = !!schema.deprecated;\n model.openapiType = schema.type;\n model.isEnum = !!schema.enum && schema.enum.length > 0;\n model.vendorExtensions = vendorExtensionsOf(schema);\n\n // A \"dictionary\" has only additional properties; an \"interface\" may mix\n // explicit and additional properties.\n if (schema.additionalProperties) {\n const additionalPropertiesModel = buildOrReferenceModel(\n spec,\n modelsByName,\n schema.additionalProperties === true ? {} : schema.additionalProperties,\n );\n\n if (model.export === 'dictionary') {\n // A dictionary carries a self-referential property; the rest are explicit\n const explicitProperties = model.properties.filter(\n (p) => !(p.export === 'dictionary' && p.name === model.name),\n );\n\n // Explicit properties make this an interface rather than a dictionary\n if (explicitProperties.length > 0 || schema.patternProperties) {\n model.export = 'interface';\n model.hasAdditionalProperties = true;\n model.additionalPropertiesModel = additionalPropertiesModel;\n model.properties = explicitProperties;\n }\n } else {\n model.hasAdditionalProperties = true;\n model.additionalPropertiesModel = additionalPropertiesModel;\n }\n }\n\n // Pattern properties can have different value types per pattern, so the model\n // is an interface rather than a dictionary.\n if (schema.patternProperties) {\n const patternProperties = resolveIfRef(spec, schema.patternProperties);\n\n if (model.export === 'dictionary') {\n model.export = 'interface';\n }\n\n model.hasPatternProperties = true;\n model.patternPropertiesModels = Object.entries(patternProperties)\n .map(([pattern, patternProperty]) => ({\n pattern,\n model: buildOrReferenceModel(spec, modelsByName, patternProperty),\n }))\n .filter((entry): entry is PatternPropertyModel => !!entry.model);\n }\n\n addLanguageTypes(model);\n\n visited.add(model);\n\n const recurse = (target: Model, subSchema: OpenApiSchema): void =>\n augmentModelFromSchema(spec, target, subSchema, modelsByName, visited);\n\n // Array element type.\n if (\n model.export === 'array' &&\n model.link &&\n 'items' in schema &&\n schema.items &&\n !visited.has(model.link)\n ) {\n recurse(model.link, resolveIfRef(spec, schema.items));\n }\n\n // Dictionary value type (additionalProperties may be `true` rather than a\n // schema).\n if (\n model.export === 'dictionary' &&\n model.link &&\n 'additionalProperties' in schema &&\n schema.additionalProperties &&\n !visited.has(model.link)\n ) {\n const subSchema = resolveIfRef(spec, schema.additionalProperties);\n if (subSchema !== true) {\n recurse(model.link, subSchema);\n }\n }\n\n // Tuple element types (3.1 `prefixItems`), positionally.\n if (model.export === 'tuple' && 'prefixItems' in schema) {\n const memberSchemas =\n (schema as { prefixItems?: OpenApiSchemaOrRef[] }).prefixItems ?? [];\n model.properties.forEach((member, i) => {\n const subSchema = resolveIfRef(spec, memberSchemas[i]);\n if (subSchema && !visited.has(member)) {\n recurse(member, subSchema);\n }\n });\n }\n\n model.properties\n .filter((p) => !visited.has(p) && schema.properties?.[trim(p.name, `\"'`)])\n .forEach((property) =>\n recurse(\n property,\n resolveIfRef(spec, schema.properties![trim(property.name, `\"'`)]),\n ),\n );\n\n if (COMPOSED_SCHEMA_TYPES.has(model.export)) {\n const memberSchemas = compositeMemberSchemas(schema, model.export);\n model.properties.forEach((property, i) => {\n const subSchema = resolveIfRef(spec, memberSchemas[i]);\n if (subSchema) {\n recurse(property, subSchema);\n }\n });\n }\n};\n\nconst addLanguageTypes = (model: Model) => {\n model.name = trim(model.name, `\"'`);\n model.typescriptName = toTypeScriptName(model.name);\n model.typescriptType = toTypeScriptType(model);\n model.pythonName = toPythonName('property', model.name);\n model.pythonType = toPythonType(model);\n model.isPrimitive =\n PRIMITIVE_TYPES.has(model.type) &&\n !COMPOSED_SCHEMA_TYPES.has(model.export) &&\n !COLLECTION_TYPES.has(model.export);\n};\n\nconst isOperationMutation = (op: Operation): boolean => {\n // x-mutation/x-query override the HTTP-method default.\n const { vendorExtensions } = op;\n if (vendorExtensions?.[VENDOR_EXTENSIONS.MUTATION]) {\n return true;\n } else if (vendorExtensions?.[VENDOR_EXTENSIONS.QUERY]) {\n return false;\n }\n return ['PATCH', 'POST', 'PUT', 'DELETE'].includes(op.method);\n};\n\nconst augmentInfiniteQuery = (op: Operation) => {\n const { paginationDisabled, cursorPropertyName } = getCursorOptions(op);\n\n const cursorProperty = op.parameters.find(\n (p) => p.name === cursorPropertyName,\n );\n\n // An infinite query is a paginated operation that accepts the cursor parameter\n op.isInfiniteQuery = !paginationDisabled && !!cursorProperty;\n if (op.isInfiniteQuery) {\n op.infiniteQueryCursorProperty = cursorProperty;\n }\n};\n\n/**\n * Resolve the pagination cursor options from an operation's `x-cursor` vendor\n * extension. Accepted forms (object variants exist because Smithy vendor\n * extensions must be objects):\n *\n * - `'property'` / `{ inputToken: 'property' }` — the input property to page on\n * - `false` / `{ enabled: false }` — disable pagination\n */\nconst getCursorOptions = (\n op: Operation,\n): { paginationDisabled: boolean; cursorPropertyName: string } => {\n const cursor = op.vendorExtensions?.[VENDOR_EXTENSIONS.CURSOR];\n\n // Defaults: pagination enabled, paging on a property named 'cursor'.\n if (cursor === false) {\n return { paginationDisabled: true, cursorPropertyName: 'cursor' };\n }\n if (typeof cursor === 'string') {\n return { paginationDisabled: false, cursorPropertyName: cursor };\n }\n const options = (cursor ?? {}) as { enabled?: boolean; inputToken?: unknown };\n return {\n paginationDisabled: options.enabled === false,\n cursorPropertyName:\n typeof options.inputToken === 'string' ? options.inputToken : 'cursor',\n };\n};\n\n/**\n * Add query/mutation, streaming and infinite-query flags to an operation.\n */\nconst augmentOperationBehaviour = (op: Operation) => {\n const isMutation = isOperationMutation(op);\n op.isMutation = isMutation;\n op.isQuery = !isMutation;\n\n op.isStreaming =\n !!op.vendorExtensions?.[VENDOR_EXTENSIONS.STREAMING] ||\n op.responses.some((res) => res.isJsonlStreaming);\n\n // For JSON-lines streaming, the result is each streamed item, so the client\n // method returns AsyncIterableIterator<itemSchemaModel>. Named (hoisted)\n // item schemas become references; inline primitives keep their own type.\n const jsonlResponse = op.responses.find((res) => res.isJsonlStreaming);\n if (jsonlResponse) {\n const itemSchemaModel = jsonlResponse.itemSchemaModel;\n const result = op.result;\n if (result && itemSchemaModel) {\n if (itemSchemaModel.name) {\n result.type = itemSchemaModel.name;\n result.typescriptType = itemSchemaModel.name;\n result.export = 'reference';\n } else {\n result.type = itemSchemaModel.type;\n result.typescriptType = itemSchemaModel.typescriptType;\n result.export = itemSchemaModel.export;\n result.format = itemSchemaModel.format;\n result.link = itemSchemaModel.link;\n result.isPrimitive = itemSchemaModel.isPrimitive;\n }\n }\n }\n\n // Add infinite query details if applicable\n if (!isMutation) {\n augmentInfiniteQuery(op);\n }\n};\n"],"names":["orderBy","trim","uniqBy","camelCase","pascalCase","snakeCase","toClassName","upperFirst","toPythonName","toPythonType","toTypeScriptModelName","toTypeScriptName","toTypeScriptType","COLLECTION_TYPES","COMPOSED_SCHEMA_TYPES","createModel","DEFAULT_SERVICE_NAME","indexModelsByName","PRIMITIVE_TYPES","STREAMING_CONTENT_TYPES","VENDOR_EXTENSIONS","normaliseOpenApiSpecForCodeGen","buildClientData","buildInlineModel","compositeMemberSchemas","getSpecOperation","getSpecParametersByKey","getSpecPathParameters","linkModel","specParameterKey","isRef","resolveIfRef","splitRef","buildOpenApiCodeGenData","inSpec","spec","data","modelsByName","models","service","services","augmentService","allOperations","flatMap","s","operations","o","uniqueName","op","buildRequestParameterModels","model","augmentModel","typescriptName","name","typescriptType","assertNoClashingPropertyNames","assertNoConflictingUnionMemberMarshalling","assertEncodableUrlEncodedBody","d","operationsByTag","untaggedOperations","groupOperationsByTag","info","vendorExtensions","vendorExtensionsOf","className","title","modelImports","augmentOperation","imports","x","nameSnakeCase","specOp","assignOperationNames","augmentResponses","augmentParameters","responses","forEach","addLanguageTypes","r","code","result","find","operationIdPascalCase","operationIdSnakeCase","parameters","length","baseRequestTypeName","requestTypeName","components","schemas","augmentOperationBehaviour","deduplicatedOpId","dotNotationOpId","id","dotNotationName","filter","export","map","type","response","has","composedPrimitives","p","Error","method","path","matchingSpecResponse","specResponse","content","mediaTypes","Object","keys","mediaType","responseContent","responseSchema","schema","augmentModelFromSchema","isJsonlStreaming","itemSchemaModel","buildOrReferenceModel","itemSchema","specParametersByKey","parameter","push","specParameter","in","prop","specParameterSchema","augmentBodyParameter","collectionFormat","getCollectionFormat","allowReserved","style","pathStyle","pathExplode","explode","specBody","requestBody","bodySchema","position","spaceDelimited","pipeDelimited","simple","form","canInlineBody","body","hasClashingPropertyName","properties","some","param","parametersByPosition","reduce","acc","explicitRequestBodyParameter","entries","description","isRequired","matchingSpecModel","specModel","property","matchingSpecProperty","specProperty","discriminator","typescriptPropertyName","propertyName","seen","Map","existing","get","undefined","set","marshallingKey","m","includes","format","isEnum","link","join","member","composedModels","key","memberName","parametersBody","Array","isArray","chosenMediaType","mt","endsWith","isPrimitive","isTagged","tags","tag","$ref","object","fromEntries","startsWith","visited","Set","deprecated","openapiType","enum","additionalProperties","additionalPropertiesModel","explicitProperties","patternProperties","hasAdditionalProperties","hasPatternProperties","patternPropertiesModels","pattern","patternProperty","entry","add","recurse","target","subSchema","items","memberSchemas","prefixItems","i","pythonName","pythonType","isOperationMutation","MUTATION","QUERY","augmentInfiniteQuery","paginationDisabled","cursorPropertyName","getCursorOptions","cursorProperty","isInfiniteQuery","infiniteQueryCursorProperty","cursor","CURSOR","options","enabled","inputToken","isMutation","isQuery","isStreaming","STREAMING","res","jsonlResponse"],"mappings":"AAAA;;;CAGC,GAED,OAAOA,aAAa,iBAAiB;AACrC,OAAOC,UAAU,cAAc;AAC/B,OAAOC,YAAY,gBAAgB;AAEnC,SACEC,SAAS,EACTC,UAAU,EACVC,SAAS,EACTC,WAAW,EACXC,UAAU,QACL,uBAAoB;AAC3B,SACEC,YAAY,EACZC,YAAY,EACZC,qBAAqB,EACrBC,gBAAgB,EAChBC,gBAAgB,QACX,8BAA2B;AAClC,SACEC,gBAAgB,EAChBC,qBAAqB,EAGrBC,WAAW,EACXC,oBAAoB,EACpBC,iBAAiB,EAKjBC,eAAe,EAEfC,uBAAuB,EACvBC,iBAAiB,QAEZ,0BAAuB;AAC9B,SAASC,8BAA8B,QAAQ,iBAAc;AAC7D,SACEC,eAAe,EACfC,gBAAgB,EAChBC,sBAAsB,EACtBC,gBAAgB,EAChBC,sBAAsB,EACtBC,qBAAqB,EACrBC,SAAS,EACTC,gBAAgB,QACX,cAAW;AAClB,SAASC,KAAK,EAAEC,YAAY,EAAEC,QAAQ,QAAQ,YAAS;AAGvD;;CAEC,GACD,OAAO,MAAMC,0BAA0B,CAACC;IACtC,MAAMC,OAAOd,+BAA+Ba;IAC5C,MAAME,OAAOd,gBAAgBa;IAE7B,MAAME,eAAepB,kBAAkBmB,KAAKE,MAAM;IAElD,KAAK,MAAMC,WAAWH,KAAKI,QAAQ,CAAE;QACnCC,eAAeN,MAAMI,SAASF;IAChC;IAEA,MAAMK,gBAAgBxC,OACpBkC,KAAKI,QAAQ,CAACG,OAAO,CAAC,CAACC,IAAMA,EAAEC,UAAU,GACzC,CAACC,IAAMA,EAAEC,UAAU;IAGrB,0EAA0E;IAC1EX,KAAKE,MAAM,GAAG;WACTF,KAAKE,MAAM;WACXI,cAAcC,OAAO,CAAC,CAACK,KACxBC,4BAA4BD,IAAIX;KAEnC;IAED,KAAK,MAAMa,SAASd,KAAK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BAA4B,CAAC3C;IACjC,MAAM6L,aAAaf,oBAAoB9K;IACvCA,GAAG6L,UAAU,GAAGA;IAChB7L,GAAG8L,OAAO,GAAG,CAACD;IAEd7L,GAAG+L,WAAW,GACZ,CAAC,CAAC/L,GAAGe,gBAAgB,EAAE,CAAC3C,kBAAkB4N,SAAS,CAAC,IACpDhM,GAAG4B,SAAS,CAACyE,IAAI,CAAC,CAAC4F,MAAQA,IAAI3H,gBAAgB;IAEjD,4EAA4E;IAC5E,yEAAyE;IACzE,yEAAyE;IACzE,MAAM4H,gBAAgBlM,GAAG4B,SAAS,CAACM,IAAI,CAAC,CAAC+J,MAAQA,IAAI3H,gBAAgB;IACrE,IAAI4H,eAAe;QACjB,MAAM3H,kBAAkB2H,cAAc3H,eAAe;QACrD,MAAMtC,SAASjC,GAAGiC,MAAM;QACxB,IAAIA,UAAUsC,iBAAiB;YAC7B,IAAIA,gBAAgBlE,IAAI,EAAE;gBACxB4B,OAAOkB,IAAI,GAAGoB,gBAAgBlE,IAAI;gBAClC4B,OAAO3B,cAAc,GAAGiE,gBAAgBlE,IAAI;gBAC5C4B,OAAOgB,MAAM,GAAG;YAClB,OAAO;gBACLhB,OAAOkB,IAAI,GAAGoB,gBAAgBpB,IAAI;gBAClClB,OAAO3B,cAAc,GAAGiE,gBAAgBjE,cAAc;gBACtD2B,OAAOgB,MAAM,GAAGsB,gBAAgBtB,MAAM;gBACtChB,OAAO8F,MAAM,GAAGxD,gBAAgBwD,MAAM;gBACtC9F,OAAOgG,IAAI,GAAG1D,gBAAgB0D,IAAI;gBAClChG,OAAO4G,WAAW,GAAGtE,gBAAgBsE,WAAW;YAClD;QACF;IACF;IAEA,2CAA2C;IAC3C,IAAI,CAACgD,YAAY;QACfZ,qBAAqBjL;IACvB;AACF"}
@@ -20,7 +20,7 @@ CMD ["python", "bin/opentelemetry-instrument", "python", "-m", "proj_test_projec
20
20
  `;
21
21
 
22
22
  exports[`py#agent generator > should match snapshot for BedrockAgentCoreRuntime generated constructs files > agent-construct.ts 1`] = `
23
- "import { Lazy, Names } from 'aws-cdk-lib';
23
+ "import { Fn, Lazy, Names, Stack } from 'aws-cdk-lib';
24
24
  import { Platform } from 'aws-cdk-lib/aws-ecr-assets';
25
25
  import { Connections, IConnectable } from 'aws-cdk-lib/aws-ec2';
26
26
  import { Construct } from 'constructs';
@@ -121,6 +121,22 @@ export class SnapshotBedrockAgent
121
121
  return this.agentCoreRuntime.connections;
122
122
  }
123
123
 
124
+ /**
125
+ * The HTTPS invocation URL of the runtime.
126
+ */
127
+ public get invocationUrl(): string {
128
+ // The URL must URL-encode the runtime ARN (':' -> '%3A', '/' -> '%2F').
129
+ // The ARN is a CDK token, so encode at deploy time via Fn.join/Fn.split.
130
+ const encodedArn = Fn.join(
131
+ '%2F',
132
+ Fn.split(
133
+ '/',
134
+ Fn.join('%3A', Fn.split(':', this.agentCoreRuntime.agentRuntimeArn)),
135
+ ),
136
+ );
137
+ return \`https://bedrock-agentcore.\${Stack.of(this).region}.amazonaws.com/runtimes/\${encodedArn}/invocations?qualifier=DEFAULT\`;
138
+ }
139
+
124
140
  /**
125
141
  * Grants IAM permissions to invoke this agent runtime.
126
142
  *
@@ -215,7 +231,7 @@ _agent = _agent_ctx.__enter__()
215
231
 
216
232
 
217
233
  class InvokeInput(BaseModel):
218
- message: str = Field(max_length=100000)
234
+ prompt: str = Field(max_length=100000)
219
235
 
220
236
 
221
237
  class StreamChunk(BaseModel):
@@ -224,7 +240,7 @@ class StreamChunk(BaseModel):
224
240
 
225
241
  async def handle_invoke(input: InvokeInput):
226
242
  """Streaming handler for agent invocation"""
227
- stream = _agent.stream_async(input.message)
243
+ stream = _agent.stream_async(input.prompt)
228
244
  async for event in stream:
229
245
  text = (
230
246
  event.get("event", {})
@@ -454,7 +454,7 @@ class TestProjectAgentAdapter implements ChatAdapter {
454
454
  }
455
455
 
456
456
  async *sendMessage(text: string): AsyncIterable<string> {
457
- for await (const chunk of this.client.invoke({ message: text })) {
457
+ for await (const chunk of this.client.invoke({ prompt: text })) {
458
458
  if (typeof chunk.content === 'string') yield chunk.content;
459
459
  }
460
460
  }
@@ -559,7 +559,7 @@ class TestProjectAgentAdapter implements ChatAdapter {
559
559
  }
560
560
 
561
561
  async *sendMessage(text: string): AsyncIterable<string> {
562
- for await (const chunk of this.client.invoke({ message: text })) {
562
+ for await (const chunk of this.client.invoke({ prompt: text })) {
563
563
  if (typeof chunk.content === 'string') yield chunk.content;
564
564
  }
565
565
  }
@@ -110,6 +110,11 @@ output "agent_core_runtime_arn" {
110
110
  value = module.agent_core_runtime.agent_core_runtime_arn
111
111
  }
112
112
 
113
+ output "invocation_url" {
114
+ description = "HTTPS invocation URL of the runtime"
115
+ value = module.agent_core_runtime.invocation_url
116
+ }
117
+
113
118
  output "appconfig_application_id" {
114
119
  description = "AppConfig Application ID for runtime config (passthrough of the shared \`appconfig_application_id\` input)."
115
120
  value = var.appconfig_application_id
@@ -583,6 +588,12 @@ print(f'Runtime {runtime_arn} is serving MCP')
583
588
  }
584
589
 
585
590
  # Outputs
591
+ locals {
592
+ # For MCP runtimes the ARN flows through the readiness probe, so consumers
593
+ # wait until the runtime serves MCP.
594
+ ready_runtime_arn = var.server_protocol == "MCP" ? null_resource.runtime_ready[0].triggers.runtime_arn : aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_arn
595
+ }
596
+
586
597
  output "agent_core_runtime_role_arn" {
587
598
  description = "ARN of the Agent Core Runtime IAM role"
588
599
  value = aws_iam_role.agent_core_runtime_role.arn
@@ -600,7 +611,12 @@ output "agent_runtime_name" {
600
611
 
601
612
  output "agent_core_runtime_arn" {
602
613
  description = "ARN of the Bedrock Agent Core runtime. For MCP runtimes the value flows through the readiness probe, so consumers wait until the runtime serves MCP."
603
- value = var.server_protocol == "MCP" ? null_resource.runtime_ready[0].triggers.runtime_arn : aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_arn
614
+ value = local.ready_runtime_arn
615
+ }
616
+
617
+ output "invocation_url" {
618
+ description = "HTTPS invocation URL of the runtime. MCP runtimes get the MCP endpoint (e.g. for use as a Gateway target endpoint), A2A runtimes the A2A endpoint (trailing slash required). For MCP runtimes the value flows through the readiness probe, so consumers wait until the runtime serves MCP."
619
+ value = "https://bedrock-agentcore.\${local.aws_region}.amazonaws.com/runtimes/\${urlencode(local.ready_runtime_arn)}/invocations\${var.server_protocol == "A2A" ? "/" : "?qualifier=DEFAULT"}"
604
620
  }
605
621
 
606
622
  output "agent_runtime_id" {
@@ -21,7 +21,7 @@ _agent = _agent_ctx.__enter__()
21
21
 
22
22
 
23
23
  class InvokeInput(BaseModel):
24
- message: str = Field(max_length=100000)
24
+ prompt: str = Field(max_length=100000)
25
25
 
26
26
 
27
27
  class StreamChunk(BaseModel):
@@ -30,7 +30,7 @@ class StreamChunk(BaseModel):
30
30
 
31
31
  async def handle_invoke(input: InvokeInput):
32
32
  """Streaming handler for agent invocation"""
33
- stream = _agent.stream_async(input.message)
33
+ stream = _agent.stream_async(input.prompt)
34
34
  async for event in stream:
35
35
  text = event.get("event", {}).get("contentBlockDelta", {}).get("delta", {}).get("text")
36
36
  if text is not None:
@@ -16,7 +16,7 @@ _graph = get_agent()
16
16
 
17
17
 
18
18
  class InvokeInput(BaseModel):
19
- message: str = Field(max_length=100000)
19
+ prompt: str = Field(max_length=100000)
20
20
 
21
21
 
22
22
  class StreamChunk(BaseModel):
@@ -41,7 +41,7 @@ async def handle_invoke(input: InvokeInput, session_id: str):
41
41
  # Re-bind the session: the streaming body runs outside the middleware scope.
42
42
  with session_id_context(session_id):
43
43
  stream = _graph.astream(
44
- {"messages": [{"role": "user", "content": input.message}]},
44
+ {"messages": [{"role": "user", "content": input.prompt}]},
45
45
  config,
46
46
  stream_mode="messages",
47
47
  )
@@ -14,7 +14,7 @@ export * from './workspace.js';
14
14
  `;
15
15
 
16
16
  exports[`py#mcp-server generator > should match snapshot for BedrockAgentCoreRuntime generated constructs files > mcp-server-construct.ts 1`] = `
17
- "import { Lazy, Names } from 'aws-cdk-lib';
17
+ "import { Fn, Lazy, Names, Stack } from 'aws-cdk-lib';
18
18
  import { Platform } from 'aws-cdk-lib/aws-ecr-assets';
19
19
  import { Connections, IConnectable } from 'aws-cdk-lib/aws-ec2';
20
20
  import { Construct } from 'constructs';
@@ -102,6 +102,23 @@ export class SnapshotBedrockServer
102
102
  return this.agentCoreRuntime.connections;
103
103
  }
104
104
 
105
+ /**
106
+ * The MCP endpoint URL of the runtime, e.g. for use as a Gateway target
107
+ * endpoint.
108
+ */
109
+ public get invocationUrl(): string {
110
+ // The URL must URL-encode the runtime ARN (':' -> '%3A', '/' -> '%2F').
111
+ // The ARN is a CDK token, so encode at deploy time via Fn.join/Fn.split.
112
+ const encodedArn = Fn.join(
113
+ '%2F',
114
+ Fn.split(
115
+ '/',
116
+ Fn.join('%3A', Fn.split(':', this.agentCoreRuntime.agentRuntimeArn)),
117
+ ),
118
+ );
119
+ return \`https://bedrock-agentcore.\${Stack.of(this).region}.amazonaws.com/runtimes/\${encodedArn}/invocations?qualifier=DEFAULT\`;
120
+ }
121
+
105
122
  /**
106
123
  * Grants IAM permissions to invoke this agent runtime.
107
124
  *
@@ -589,6 +606,12 @@ print(f'Runtime {runtime_arn} is serving MCP')
589
606
  }
590
607
 
591
608
  # Outputs
609
+ locals {
610
+ # For MCP runtimes the ARN flows through the readiness probe, so consumers
611
+ # wait until the runtime serves MCP.
612
+ ready_runtime_arn = var.server_protocol == "MCP" ? null_resource.runtime_ready[0].triggers.runtime_arn : aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_arn
613
+ }
614
+
592
615
  output "agent_core_runtime_role_arn" {
593
616
  description = "ARN of the Agent Core Runtime IAM role"
594
617
  value = aws_iam_role.agent_core_runtime_role.arn
@@ -606,7 +629,12 @@ output "agent_runtime_name" {
606
629
 
607
630
  output "agent_core_runtime_arn" {
608
631
  description = "ARN of the Bedrock Agent Core runtime. For MCP runtimes the value flows through the readiness probe, so consumers wait until the runtime serves MCP."
609
- value = var.server_protocol == "MCP" ? null_resource.runtime_ready[0].triggers.runtime_arn : aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_arn
632
+ value = local.ready_runtime_arn
633
+ }
634
+
635
+ output "invocation_url" {
636
+ description = "HTTPS invocation URL of the runtime. MCP runtimes get the MCP endpoint (e.g. for use as a Gateway target endpoint), A2A runtimes the A2A endpoint (trailing slash required). For MCP runtimes the value flows through the readiness probe, so consumers wait until the runtime serves MCP."
637
+ value = "https://bedrock-agentcore.\${local.aws_region}.amazonaws.com/runtimes/\${urlencode(local.ready_runtime_arn)}/invocations\${var.server_protocol == "A2A" ? "/" : "?qualifier=DEFAULT"}"
610
638
  }
611
639
 
612
640
  output "agent_runtime_id" {
@@ -724,6 +752,11 @@ output "agent_core_runtime_arn" {
724
752
  value = module.agent_core_runtime.agent_core_runtime_arn
725
753
  }
726
754
 
755
+ output "invocation_url" {
756
+ description = "HTTPS invocation URL of the runtime (the MCP endpoint, e.g. for use as a Gateway target endpoint)"
757
+ value = module.agent_core_runtime.invocation_url
758
+ }
759
+
727
760
  output "appconfig_application_id" {
728
761
  description = "AppConfig Application ID for runtime config (passthrough of the shared \`appconfig_application_id\` input)."
729
762
  value = var.appconfig_application_id
@@ -444,7 +444,7 @@ class TrpcWebSocketAdapter implements ChatAdapter {
444
444
  const stream = new ReadableStream<string>({
445
445
  start: (controller) => {
446
446
  this.client.invoke.subscribe(
447
- { message: text },
447
+ { prompt: text },
448
448
  {
449
449
  onData: (chunk: string) => controller.enqueue(chunk),
450
450
  onComplete: () => controller.close(),
@@ -546,7 +546,7 @@ class TrpcWebSocketAdapter implements ChatAdapter {
546
546
  const stream = new ReadableStream<string>({
547
547
  start: (controller) => {
548
548
  this.client.invoke.subscribe(
549
- { message: text },
549
+ { prompt: text },
550
550
  {
551
551
  onData: (chunk: string) => controller.enqueue(chunk),
552
552
  onComplete: () => controller.close(),
@@ -585,7 +585,7 @@ CMD [ "node", "--require", "@aws/aws-distro-opentelemetry-node-autoinstrumentati
585
585
  `;
586
586
 
587
587
  exports[`ts#agent generator > should match snapshot for BedrockAgentCoreRuntime generated constructs files > agent-construct.ts 1`] = `
588
- "import { Lazy, Names } from 'aws-cdk-lib';
588
+ "import { Fn, Lazy, Names, Stack } from 'aws-cdk-lib';
589
589
  import { Platform } from 'aws-cdk-lib/aws-ecr-assets';
590
590
  import { Connections, IConnectable } from 'aws-cdk-lib/aws-ec2';
591
591
  import { Construct } from 'constructs';
@@ -686,6 +686,22 @@ export class SnapshotBedrockAgent
686
686
  return this.agentCoreRuntime.connections;
687
687
  }
688
688
 
689
+ /**
690
+ * The HTTPS invocation URL of the runtime.
691
+ */
692
+ public get invocationUrl(): string {
693
+ // The URL must URL-encode the runtime ARN (':' -> '%3A', '/' -> '%2F').
694
+ // The ARN is a CDK token, so encode at deploy time via Fn.join/Fn.split.
695
+ const encodedArn = Fn.join(
696
+ '%2F',
697
+ Fn.split(
698
+ '/',
699
+ Fn.join('%3A', Fn.split(':', this.agentCoreRuntime.agentRuntimeArn)),
700
+ ),
701
+ );
702
+ return \`https://bedrock-agentcore.\${Stack.of(this).region}.amazonaws.com/runtimes/\${encodedArn}/invocations?qualifier=DEFAULT\`;
703
+ }
704
+
689
705
  /**
690
706
  * Grants IAM permissions to invoke this agent runtime.
691
707
  *
@@ -835,6 +851,11 @@ output "agent_core_runtime_arn" {
835
851
  value = module.agent_core_runtime.agent_core_runtime_arn
836
852
  }
837
853
 
854
+ output "invocation_url" {
855
+ description = "HTTPS invocation URL of the runtime"
856
+ value = module.agent_core_runtime.invocation_url
857
+ }
858
+
838
859
  output "appconfig_application_id" {
839
860
  description = "AppConfig Application ID for runtime config (passthrough of the shared \`appconfig_application_id\` input)."
840
861
  value = var.appconfig_application_id
@@ -1308,6 +1329,12 @@ print(f'Runtime {runtime_arn} is serving MCP')
1308
1329
  }
1309
1330
 
1310
1331
  # Outputs
1332
+ locals {
1333
+ # For MCP runtimes the ARN flows through the readiness probe, so consumers
1334
+ # wait until the runtime serves MCP.
1335
+ ready_runtime_arn = var.server_protocol == "MCP" ? null_resource.runtime_ready[0].triggers.runtime_arn : aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_arn
1336
+ }
1337
+
1311
1338
  output "agent_core_runtime_role_arn" {
1312
1339
  description = "ARN of the Agent Core Runtime IAM role"
1313
1340
  value = aws_iam_role.agent_core_runtime_role.arn
@@ -1325,7 +1352,12 @@ output "agent_runtime_name" {
1325
1352
 
1326
1353
  output "agent_core_runtime_arn" {
1327
1354
  description = "ARN of the Bedrock Agent Core runtime. For MCP runtimes the value flows through the readiness probe, so consumers wait until the runtime serves MCP."
1328
- value = var.server_protocol == "MCP" ? null_resource.runtime_ready[0].triggers.runtime_arn : aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_arn
1355
+ value = local.ready_runtime_arn
1356
+ }
1357
+
1358
+ output "invocation_url" {
1359
+ description = "HTTPS invocation URL of the runtime. MCP runtimes get the MCP endpoint (e.g. for use as a Gateway target endpoint), A2A runtimes the A2A endpoint (trailing slash required). For MCP runtimes the value flows through the readiness probe, so consumers wait until the runtime serves MCP."
1360
+ value = "https://bedrock-agentcore.\${local.aws_region}.amazonaws.com/runtimes/\${urlencode(local.ready_runtime_arn)}/invocations\${var.server_protocol == "A2A" ? "/" : "?qualifier=DEFAULT"}"
1329
1361
  }
1330
1362
 
1331
1363
  output "agent_runtime_id" {
@@ -1661,7 +1693,7 @@ const agent = withSessionId(getAgent);
1661
1693
 
1662
1694
  export const appRouter = router({
1663
1695
  invoke: publicProcedure
1664
- .input(z.object({ message: z.string().max(100000) }))
1696
+ .input(z.object({ prompt: z.string().max(100000) }))
1665
1697
  .output(
1666
1698
  zAsyncIterable({
1667
1699
  yield: z.string(),
@@ -1671,7 +1703,7 @@ export const appRouter = router({
1671
1703
  .subscription(async function* (opts) {
1672
1704
  // Bind the session ID for this subscription so downstream MCP / A2A clients forward it on outbound calls.
1673
1705
  enterSessionContext(opts.ctx.sessionId);
1674
- for await (const event of agent.stream(opts.input.message)) {
1706
+ for await (const event of agent.stream(opts.input.prompt)) {
1675
1707
  if (
1676
1708
  event.type === 'modelStreamUpdateEvent' &&
1677
1709
  event.event.type === 'modelContentBlockDeltaEvent' &&
@@ -10,7 +10,7 @@ const agent = withSessionId(getAgent);
10
10
 
11
11
  export const appRouter = router({
12
12
  invoke: publicProcedure
13
- .input(z.object({ message: z.string().max(100000) }))
13
+ .input(z.object({ prompt: z.string().max(100000) }))
14
14
  .output(
15
15
  zAsyncIterable({
16
16
  yield: z.string(),
@@ -20,7 +20,7 @@ export const appRouter = router({
20
20
  .subscription(async function* (opts) {
21
21
  // Bind the session ID for this subscription so downstream MCP / A2A clients forward it on outbound calls.
22
22
  enterSessionContext(opts.ctx.sessionId);
23
- for await (const event of agent.stream(opts.input.message)) {
23
+ for await (const event of agent.stream(opts.input.prompt)) {
24
24
  if (
25
25
  event.type === 'modelStreamUpdateEvent' &&
26
26
  event.event.type === 'modelContentBlockDeltaEvent' &&
@@ -14,7 +14,7 @@ export * from './workspace.js';
14
14
  `;
15
15
 
16
16
  exports[`ts#mcp-server generator > should match snapshot for BedrockAgentCoreRuntime generated constructs files > mcp-server-construct.ts 1`] = `
17
- "import { Lazy, Names } from 'aws-cdk-lib';
17
+ "import { Fn, Lazy, Names, Stack } from 'aws-cdk-lib';
18
18
  import { Platform } from 'aws-cdk-lib/aws-ecr-assets';
19
19
  import { Connections, IConnectable } from 'aws-cdk-lib/aws-ec2';
20
20
  import { Construct } from 'constructs';
@@ -102,6 +102,23 @@ export class SnapshotBedrockServer
102
102
  return this.agentCoreRuntime.connections;
103
103
  }
104
104
 
105
+ /**
106
+ * The MCP endpoint URL of the runtime, e.g. for use as a Gateway target
107
+ * endpoint.
108
+ */
109
+ public get invocationUrl(): string {
110
+ // The URL must URL-encode the runtime ARN (':' -> '%3A', '/' -> '%2F').
111
+ // The ARN is a CDK token, so encode at deploy time via Fn.join/Fn.split.
112
+ const encodedArn = Fn.join(
113
+ '%2F',
114
+ Fn.split(
115
+ '/',
116
+ Fn.join('%3A', Fn.split(':', this.agentCoreRuntime.agentRuntimeArn)),
117
+ ),
118
+ );
119
+ return \`https://bedrock-agentcore.\${Stack.of(this).region}.amazonaws.com/runtimes/\${encodedArn}/invocations?qualifier=DEFAULT\`;
120
+ }
121
+
105
122
  /**
106
123
  * Grants IAM permissions to invoke this agent runtime.
107
124
  *
@@ -589,6 +606,12 @@ print(f'Runtime {runtime_arn} is serving MCP')
589
606
  }
590
607
 
591
608
  # Outputs
609
+ locals {
610
+ # For MCP runtimes the ARN flows through the readiness probe, so consumers
611
+ # wait until the runtime serves MCP.
612
+ ready_runtime_arn = var.server_protocol == "MCP" ? null_resource.runtime_ready[0].triggers.runtime_arn : aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_arn
613
+ }
614
+
592
615
  output "agent_core_runtime_role_arn" {
593
616
  description = "ARN of the Agent Core Runtime IAM role"
594
617
  value = aws_iam_role.agent_core_runtime_role.arn
@@ -606,7 +629,12 @@ output "agent_runtime_name" {
606
629
 
607
630
  output "agent_core_runtime_arn" {
608
631
  description = "ARN of the Bedrock Agent Core runtime. For MCP runtimes the value flows through the readiness probe, so consumers wait until the runtime serves MCP."
609
- value = var.server_protocol == "MCP" ? null_resource.runtime_ready[0].triggers.runtime_arn : aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_arn
632
+ value = local.ready_runtime_arn
633
+ }
634
+
635
+ output "invocation_url" {
636
+ description = "HTTPS invocation URL of the runtime. MCP runtimes get the MCP endpoint (e.g. for use as a Gateway target endpoint), A2A runtimes the A2A endpoint (trailing slash required). For MCP runtimes the value flows through the readiness probe, so consumers wait until the runtime serves MCP."
637
+ value = "https://bedrock-agentcore.\${local.aws_region}.amazonaws.com/runtimes/\${urlencode(local.ready_runtime_arn)}/invocations\${var.server_protocol == "A2A" ? "/" : "?qualifier=DEFAULT"}"
610
638
  }
611
639
 
612
640
  output "agent_runtime_id" {
@@ -724,6 +752,11 @@ output "agent_core_runtime_arn" {
724
752
  value = module.agent_core_runtime.agent_core_runtime_arn
725
753
  }
726
754
 
755
+ output "invocation_url" {
756
+ description = "HTTPS invocation URL of the runtime (the MCP endpoint, e.g. for use as a Gateway target endpoint)"
757
+ value = module.agent_core_runtime.invocation_url
758
+ }
759
+
727
760
  output "appconfig_application_id" {
728
761
  description = "AppConfig Application ID for runtime config (passthrough of the shared \`appconfig_application_id\` input)."
729
762
  value = var.appconfig_application_id
@@ -34,7 +34,7 @@ class <%- agentNameClassName %>Adapter implements ChatAdapter {
34
34
  }
35
35
 
36
36
  async *sendMessage(text: string): AsyncIterable<string> {
37
- for await (const chunk of this.client.invoke({ message: text })) {
37
+ for await (const chunk of this.client.invoke({ prompt: text })) {
38
38
  if (typeof chunk.content === 'string') yield chunk.content;
39
39
  }
40
40
  }
@@ -37,7 +37,7 @@ class TrpcWebSocketAdapter implements ChatAdapter {
37
37
  const stream = new ReadableStream<string>({
38
38
  start: (controller) => {
39
39
  this.client.invoke.subscribe(
40
- { message: text },
40
+ { prompt: text },
41
41
  {
42
42
  onData: (chunk: string) => controller.enqueue(chunk),
43
43
  onComplete: () => controller.close(),
@@ -1,4 +1,4 @@
1
- import { Lazy, Names } from 'aws-cdk-lib';
1
+ import { Fn, Lazy, Names, Stack } from 'aws-cdk-lib';
2
2
  import { Platform } from 'aws-cdk-lib/aws-ecr-assets';
3
3
  import { Connections, IConnectable } from 'aws-cdk-lib/aws-ec2';
4
4
  import { Construct } from 'constructs';
@@ -136,6 +136,29 @@ export class <%- nameClassName %> extends Construct implements IGrantable, IConn
136
136
  public get connections(): Connections {
137
137
  return this.agentCoreRuntime.connections;
138
138
  }
139
+
140
+ /**
141
+ <%_ if (serverProtocol === 'mcp') { _%>
142
+ * The MCP endpoint URL of the runtime, e.g. for use as a Gateway target
143
+ * endpoint.
144
+ <%_ } else if (serverProtocol === 'a2a') { _%>
145
+ * The A2A endpoint URL of the runtime (the trailing slash is required).
146
+ <%_ } else { _%>
147
+ * The HTTPS invocation URL of the runtime.
148
+ <%_ } _%>
149
+ */
150
+ public get invocationUrl(): string {
151
+ // The URL must URL-encode the runtime ARN (':' -> '%3A', '/' -> '%2F').
152
+ // The ARN is a CDK token, so encode at deploy time via Fn.join/Fn.split.
153
+ const encodedArn = Fn.join(
154
+ '%2F',
155
+ Fn.split(
156
+ '/',
157
+ Fn.join('%3A', Fn.split(':', this.agentCoreRuntime.agentRuntimeArn)),
158
+ ),
159
+ );
160
+ return `https://bedrock-agentcore.${Stack.of(this).region}.amazonaws.com/runtimes/${encodedArn}/invocations<%- serverProtocol === 'a2a' ? '/' : '?qualifier=DEFAULT' %>`;
161
+ }
139
162
  <%_ if (auth === 'iam') { _%>
140
163
 
141
164
  /**
@@ -133,6 +133,11 @@ output "agent_core_runtime_arn" {
133
133
  value = module.agent_core_runtime.agent_core_runtime_arn
134
134
  }
135
135
 
136
+ output "invocation_url" {
137
+ description = "HTTPS invocation URL of the runtime<% if (serverProtocol === 'mcp') { %> (the MCP endpoint, e.g. for use as a Gateway target endpoint)<% } else if (serverProtocol === 'a2a') { %> (the A2A endpoint)<% } %>"
138
+ value = module.agent_core_runtime.invocation_url
139
+ }
140
+
136
141
  output "appconfig_application_id" {
137
142
  description = "AppConfig Application ID for runtime config (passthrough of the shared `appconfig_application_id` input)."
138
143
  value = var.appconfig_application_id
@@ -458,6 +458,12 @@ print(f'Runtime {runtime_arn} is serving MCP')
458
458
  }
459
459
 
460
460
  # Outputs
461
+ locals {
462
+ # For MCP runtimes the ARN flows through the readiness probe, so consumers
463
+ # wait until the runtime serves MCP.
464
+ ready_runtime_arn = var.server_protocol == "MCP" ? null_resource.runtime_ready[0].triggers.runtime_arn : aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_arn
465
+ }
466
+
461
467
  output "agent_core_runtime_role_arn" {
462
468
  description = "ARN of the Agent Core Runtime IAM role"
463
469
  value = aws_iam_role.agent_core_runtime_role.arn
@@ -475,7 +481,12 @@ output "agent_runtime_name" {
475
481
 
476
482
  output "agent_core_runtime_arn" {
477
483
  description = "ARN of the Bedrock Agent Core runtime. For MCP runtimes the value flows through the readiness probe, so consumers wait until the runtime serves MCP."
478
- value = var.server_protocol == "MCP" ? null_resource.runtime_ready[0].triggers.runtime_arn : aws_bedrockagentcore_agent_runtime.agent_runtime.agent_runtime_arn
484
+ value = local.ready_runtime_arn
485
+ }
486
+
487
+ output "invocation_url" {
488
+ description = "HTTPS invocation URL of the runtime. MCP runtimes get the MCP endpoint (e.g. for use as a Gateway target endpoint), A2A runtimes the A2A endpoint (trailing slash required). For MCP runtimes the value flows through the readiness probe, so consumers wait until the runtime serves MCP."
489
+ value = "https://bedrock-agentcore.${local.aws_region}.amazonaws.com/runtimes/${urlencode(local.ready_runtime_arn)}/invocations${var.server_protocol == "A2A" ? "/" : "?qualifier=DEFAULT"}"
479
490
  }
480
491
 
481
492
  output "agent_runtime_id" {