mirror of
https://github.com/HeyPuter/puter.git
synced 2026-01-07 13:40:51 -06:00
49 lines
1.0 KiB
TypeScript
49 lines
1.0 KiB
TypeScript
import type { RequestHandler } from 'express';
|
|
import type helpers from '../src/backend/src/helpers.js';
|
|
|
|
declare global {
|
|
namespace Express {
|
|
interface Request {
|
|
actor: any; // TODO
|
|
}
|
|
}
|
|
}
|
|
|
|
type EndpointOptions = {
|
|
allowedMethods?: string[]
|
|
subdomain?: string
|
|
noauth?: boolean
|
|
}
|
|
|
|
type HttpMethod = 'get' | 'post' | 'put' | 'delete' | 'patch';
|
|
|
|
type AddRouteFunction = (path: string, options: EndpointOptions, handler: RequestHandler) => void
|
|
|
|
type RouterMethods = {
|
|
[K in HttpMethod]: {
|
|
(path: string, options: EndpointOptions, handler: RequestHandler): void;
|
|
(path: string, handler: RequestHandler, options?: EndpointOptions): void;
|
|
};
|
|
}
|
|
|
|
type CoreRuntimeModule = {
|
|
util: {
|
|
helpers: typeof helpers,
|
|
}
|
|
}
|
|
|
|
interface Extension extends RouterMethods {
|
|
// import(module: 'core'): {
|
|
// UserActorType: typeof UserActorType;
|
|
// };
|
|
import(module: 'core'): CoreRuntimeModule;
|
|
import(module: string): any;
|
|
}
|
|
|
|
declare global {
|
|
// Declare the extension variable
|
|
const extension: Extension;
|
|
}
|
|
|
|
export {};
|