MCPcopy Index your code
hub / github.com/hydro-dev/Hydro / prepare

Method prepare

framework/framework/api.ts:227–245  ·  view source on GitHub ↗
({ }, op: string)

Source from the content-addressed store, hash-verified

225
226 @param('op', Types.String)
227 async prepare({ }, op: string) {
228 if (op === 'rpc') {
229 this.isRpc = true;
230 return;
231 }
232 if (!APIS[op]) throw new BadRequestError(`Invalid API operation: ${op}`);
233 if (APIS[op].type !== 'Subscription') {
234 throw new BadRequestError('Only subscription operations are supported');
235 }
236 handleArguments(this.args);
237 // @ts-ignore
238 await this.ctx.parallel('handler/api/before', this);
239 // @ts-ignore
240 await this.ctx.parallel(`handler/api/before/${op}`, this);
241 this.dispose = await this.ctx.api.execute(
242 this, op, { domainId: this.args.domainId, ...this.args, ...(this.args.args || {}) },
243 (m, args) => (this.ctx.parallel as any)(m, args), this.args.projection, (p) => this.send(p),
244 );
245 }
246
247 async message(message) {
248 if (!this.isRpc) throw new BadRequestError('Only RPC operations are supported');

Callers

nothing calls this directly

Calls 3

handleArgumentsFunction · 0.85
executeMethod · 0.80
sendMethod · 0.45

Tested by

no test coverage detected