| 332 | // is spliced into the operation at invoke time. A real field argument named |
| 333 | // `select` (rare) is left untouched. |
| 334 | const withSelectInput = (inputSchema: unknown, returnTypeName: string): unknown => { |
| 335 | const base = |
| 336 | inputSchema && typeof inputSchema === "object" |
| 337 | ? (inputSchema as Record<string, unknown>) |
| 338 | : { type: "object", properties: {} }; |
| 339 | const properties = { |
| 340 | ...((base.properties as Record<string, unknown> | undefined) ?? {}), |
| 341 | }; |
| 342 | if (!("select" in properties)) { |
| 343 | properties.select = { |
| 344 | type: "string", |
| 345 | 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.`, |
| 346 | }; |
| 347 | } |
| 348 | return { ...base, type: "object", properties }; |
| 349 | }; |
| 350 | |
| 351 | const prepareOperations = ( |
| 352 | fields: readonly ExtractedField[], |