(
client: ClientFrom<M>
)
| 977 | ]: StreamQueries<RT, QueryStreamHandler<typeof client[Key]>>["queryNew"] |
| 978 | } |
| 979 | ) |
| 980 | return queries |
| 981 | } |
| 982 | |
| 983 | const mapRequest = <M extends RequestsAny>( |
| 984 | client: ClientFrom<M> |
| 985 | ) => { |
| 986 | const Command = useCommand() |
| 987 | const mutations = Struct.keys(client).reduce( |
| 988 | (acc, key) => { |
| 989 | if (!(client[key].Request.type === "command" && !client[key].Request.stream)) { |
| 990 | return acc |
| 991 | } |
| 992 | const mut = client[key].handler |
| 993 | const request = mut |
| 994 | const fn = (options?: any) => Command.fn(client[key].id, options) |
| 995 | const wrap = (options?: any) => Command.wrap({ mutate: request, id: client[key].id }, options) |
| 996 | ;(acc as any)[camelCase(key) + "Request"] = Object.assign( |
| 997 | mut, |
| 998 | Command.fn(client[key].id), // to get the i18n key etc. |
| 999 | { wrap, fn, request } |
| 1000 | ) |
| 1001 | return acc |
| 1002 | }, |
| 1003 | {} as { |
| 1004 | [ |
| 1005 | Key in keyof typeof client as CommandHandler<typeof client[Key]> extends never ? never |
| 1006 | : `${ToCamel<string & Key>}Request` |
| 1007 | ]: CommandRequestWithExtensions< |
| 1008 | RT | RTHooks, |
| 1009 | CommandHandler<typeof client[Key]> |
| 1010 | > |
| 1011 | } |
| 1012 | ) |
| 1013 | return mutations |
no test coverage detected
searching dependent graphs…