Interface KosExecutionContext<Paths, Path, Method>

Execution context passed to decorated methods for accessing decorator-injected functionality.

This context provides a type-safe way for decorators to inject runtime functionality into methods without polluting the class interface or relying on magic parameters.

Currently used by

Kos Service Request

to inject the $request executor. Designed to be extensible for future decorators that need to inject runtime functionality.

Example

Using with

Kos Service Request

@kosServiceRequest({
path: PATH_VM_INSTALL,
method: 'post'
})
async createRelease(
path: string,
keysetId?: string,
ctx: KosExecutionContext<paths, typeof PATH_VM_INSTALL, 'post'>
): Promise<void> {
const [error, response] = await ctx.$request({
queryParams: { keySetId: keysetId },
body: { path }
});
if (error) throw new Error(error);
return response?.data;
}
interface KosExecutionContext<Paths, Path, Method> {
    $request?: ServiceRequestExecutor<Paths, Path, Method>;
    $tracker?: string;
}

Type Parameters

  • Paths extends Record<string, any> = Record<string, any>
  • Path extends keyof Paths = string
  • Method extends HttpMethod = "get"

Properties

Properties

Service request executor (injected by @kosServiceRequest) Executes the service request defined in the decorator configuration.

$tracker?: string

Future tracker ID string (injected by

Kos Future

when trackerPolicy is 'context') This is the tracker ID that can be used with future management utilities.