(arg)
| 65 | |
| 66 | /** @type {RemoteCommand<Input, Output> & { __: RemoteInfo }} */ |
| 67 | const wrapper = (arg) => { |
| 68 | const event = getRequestEvent(); |
| 69 | |
| 70 | if (!event.isRemoteRequest) { |
| 71 | throw new Error( |
| 72 | `Cannot call a command (\`${__.name}(${maybe_fn ? '...' : ''})\`) during server-side rendering` |
| 73 | ); |
| 74 | } |
| 75 | |
| 76 | get_event_state(event).refreshes ??= {}; |
| 77 | |
| 78 | const promise = Promise.resolve(run_remote_function(event, true, arg, validate, fn)); |
| 79 | |
| 80 | // @ts-expect-error |
| 81 | promise.updates = () => { |
| 82 | throw new Error(`Cannot call '${__.name}(...).updates(...)' on the server`); |
| 83 | }; |
| 84 | |
| 85 | return /** @type {ReturnType<RemoteCommand<Input, Output>>} */ (promise); |
| 86 | }; |
| 87 | |
| 88 | Object.defineProperty(wrapper, '__', { value: __ }); |
| 89 |
nothing calls this directly
no test coverage detected