* GraphQL operation name. Prefers an explicit `{ name: 'x' }` or a leading * string literal (`@Query('users')`); otherwise the field name defaults to the * handler method name. Avoids mistaking a `description` string for the name.
(args: string, handler: string | null)
| 708 | * handler method name. Avoids mistaking a `description` string for the name. |
| 709 | */ |
| 710 | function parseGraphqlName(args: string, handler: string | null): string { |
| 711 | const named = args.match(/name\s*:\s*['"`]([^'"`]*)['"`]/); |
| 712 | if (named) return named[1]!; |
| 713 | const lead = args.match(/^\s*['"`]([^'"`]*)['"`]/); |
| 714 | if (lead) return lead[1]!; |
| 715 | return handler ?? ''; |
| 716 | } |
| 717 | |
| 718 | // --------------------------------------------------------------------------- |
| 719 | // Path helpers |