24 lines · 745 B · TypeScript
RawDownload
import type { ExecutionEngine } from "@executor/execution"; export const withExecutionUsageTracking = (  organizationId: string,  engine: ExecutionEngine,  trackUsage: (organizationId: string) => void,): ExecutionEngine => ({  execute: async (code, options) => {    const result = await engine.execute(code, options);    trackUsage(organizationId);    return result;  },  executeWithPause: async (code) => {    const result = await engine.executeWithPause(code);    trackUsage(organizationId);    return result;  },  resume: async (executionId, response) => {    const result = await engine.resume(executionId, response);    // resume doesn't count as usage    return result;  },  getDescription: engine.getDescription,});

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t