|
| 1 | +/* eslint-disable @typescript-eslint/no-empty-interface */ |
| 2 | +/* eslint-disable @typescript-eslint/no-unused-vars */ |
| 3 | +// THIS FILE FOR MONACO EDITOR CODE COMPLETION |
| 4 | + |
| 5 | +declare interface FunctionContextResponse { |
| 6 | + throws(code: number, message: any): void |
| 7 | + type(type: string): FunctionContextResponse |
| 8 | + status(code: number, statusMessage?: string): FunctionContextResponse |
| 9 | + send(data: any): void |
| 10 | +} |
| 11 | +declare interface FunctionContextRequest { |
| 12 | + query: Record<string, string> |
| 13 | + headers: Record<string, string> |
| 14 | + params: Record<string, string> |
| 15 | +} |
| 16 | + |
| 17 | +declare interface FastifyRequest { |
| 18 | + [k: string]: any |
| 19 | +} |
| 20 | +declare interface Context extends FunctionContextResponse {} |
| 21 | +declare interface Context extends FunctionContextRequest {} |
| 22 | +declare interface Context { |
| 23 | + req: FunctionContextRequest & FastifyRequest |
| 24 | + res: FunctionContextResponse |
| 25 | + |
| 26 | + model: SnippetModel |
| 27 | + document: SnippetModel & { [key: string]: any } |
| 28 | + getMaster: () => Promise<UserModel> |
| 29 | + |
| 30 | + storage: IStorage |
| 31 | + |
| 32 | + name: string |
| 33 | + reference: string |
| 34 | + |
| 35 | + writeAsset: (path: string, data: any, options: any) => void |
| 36 | + readAsset: (path: string, options: any) => void |
| 37 | +} |
| 38 | + |
| 39 | +declare interface IStorage { |
| 40 | + db: any |
| 41 | + cache: { |
| 42 | + get(key: string): Promise<string> |
| 43 | + set(key: string, value: string | object): Promise<string> |
| 44 | + dek(key: string): Promise<string> |
| 45 | + } |
| 46 | +} |
| 47 | + |
| 48 | +declare const __dirname: string |
| 49 | +declare const __filename: '' |
| 50 | + |
| 51 | +declare class Buffer { |
| 52 | + constructor(...args: any[]): Buffer |
| 53 | + from(...args: any[]): Buffer |
| 54 | + [x: string]: any |
| 55 | +} |
| 56 | + |
| 57 | +declare const console: Console |
| 58 | + |
| 59 | +declare const logger: Console |
| 60 | + |
| 61 | +declare const process: { |
| 62 | + env: Record<string, string> |
| 63 | + nextTick: (func: Function) => any |
| 64 | +} |
| 65 | +declare const context: Context |
| 66 | + |
| 67 | +declare enum SnippetType { |
| 68 | + JSON = 'json', |
| 69 | + Function = 'function', |
| 70 | + Text = 'text', |
| 71 | + YAML = 'yaml', |
| 72 | +} |
| 73 | + |
| 74 | +declare interface SnippetModel extends BaseModel { |
| 75 | + type: SnippetType |
| 76 | + private: boolean |
| 77 | + raw: string |
| 78 | + name: string |
| 79 | + reference: string |
| 80 | + comment?: string |
| 81 | + metatype?: string |
| 82 | +} |
| 83 | + |
| 84 | +declare class BaseModel { |
| 85 | + created?: Date |
| 86 | + id?: string |
| 87 | +} |
| 88 | + |
| 89 | +declare class UserModel { |
| 90 | + username: string |
| 91 | + |
| 92 | + name: string |
| 93 | + |
| 94 | + introduce?: string |
| 95 | + |
| 96 | + avatar?: string |
| 97 | + |
| 98 | + mail?: string |
| 99 | + |
| 100 | + url?: string |
| 101 | + |
| 102 | + lastLoginTime?: Date |
| 103 | + |
| 104 | + lastLoginIp?: string |
| 105 | + |
| 106 | + socialIds?: any |
| 107 | +} |
| 108 | +declare function require(id: string, useCache?: boolean): Promise<any> |
0 commit comments