Files
puter/extensions/api.d.ts
2025-09-26 15:27:58 -04:00

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 {};