| 452 | // is spliced into the operation at invoke time. A real field argument named |
| 453 | // `select` (rare) is left untouched. |
| 454 | const withSelectInput = (inputSchema: unknown, returnTypeName: string): unknown => { |
| 455 | const base = |
| 456 | inputSchema && typeof inputSchema === "object" |
| 457 | ? (inputSchema as Record<string, unknown>) |
| 458 | : { type: "object", properties: {} }; |
| 459 | const properties = { |
| 460 | ...((base.properties as Record<string, unknown> | undefined) ?? {}), |
| 461 | }; |
| 462 | if (!("select" in properties)) { |
| 463 | properties.select = { |
| 464 | type: "string", |
| 465 | description: `Optional GraphQL selection set for the \`${returnTypeName}\` return type. Overrides the default, which selects only scalar fields. Provide the fields to return, with sub-selections for nested objects and arguments where required, e.g. "id name items { id title }". Omit for the default.`, |
| 466 | }; |
| 467 | } |
| 468 | return { ...base, type: "object", properties }; |
| 469 | }; |
| 470 | |
| 471 | const prepareOperations = ( |
| 472 | fields: readonly ExtractedField[], |