diff --git a/types/gimloader/gimloader-tests.ts b/types/gimloader/gimloader-tests.ts index a55282e7d39dc2..381fa2f717018f 100644 --- a/types/gimloader/gimloader-tests.ts +++ b/types/gimloader/gimloader-tests.ts @@ -44,6 +44,9 @@ api.patcher.before({}, "foo", () => true); GL.net.gamemode; // $ExpectType string api.net.gamemode; // $ExpectType string api.net.onLoad((type, gamemode) => {}); +api.net.modifyFetchRequest("/path/*/thing", (options) => null); +api.net.modifyFetchRequest("/path/*/thing", (options) => options); +api.net.modifyFetchResponse("/path/*/thing", (response) => response); GL.stores.phaser; // $ExpectType Phaser window.stores.phaser; // $ExpectType Phaser diff --git a/types/gimloader/index.d.ts b/types/gimloader/index.d.ts index c1f310343351f7..3c19ae8a0bb881 100644 --- a/types/gimloader/index.d.ts +++ b/types/gimloader/index.d.ts @@ -2248,9 +2248,9 @@ declare global { webpage: string | null; needsLib: string[]; optionalLib: string[]; - syncEval: string; deprecated: string | null; gamemode: string[]; + changelog: string[]; hasSettings: string; }; /** Gets the exported values of a plugin, if it has been enabled */ @@ -2281,9 +2281,9 @@ declare global { webpage: string | null; needsLib: string[]; optionalLib: string[]; - syncEval: string; deprecated: string | null; gamemode: string[]; + changelog: string[]; hasSettings: string; }; /** Gets the exported values of a library */ @@ -2477,6 +2477,10 @@ declare global { callback: (type: ConnectionType, gamemode: string) => void, gamemode?: string | string[], ): () => void; + /** Runs a callback when a request is made that matches a certain path (can have wildcards) */ + modifyFetchRequest(path: string, callback: (options: RequesterOptions) => any): () => void; + /** Runs a callback when a response is recieved for a request under a certain path (can have wildcards) */ + modifyFetchResponse(path: string, callback: (response: any) => any): () => void; } type ConnectionType = "None" | "Colyseus" | "Blueboat"; @@ -2495,6 +2499,16 @@ declare global { send(channel: string, message: any): void; } + interface RequesterOptions { + url: string; + method?: string; + data?: any; + cacheKey?: string; + success?: (response: any, cached: boolean) => void; + both?: () => void; + error?: (error: any) => void; + } + interface NetApi extends BaseNetApi { new(): this; /** @@ -2508,6 +2522,14 @@ declare global { ): () => void; /** Cancels any calls to {@link onLoad} with the same id */ offLoad(id: string): void; + /** Runs a callback when a request is made that matches a certain path (can have wildcards) */ + modifyFetchRequest(id: string, path: string, callback: (options: RequesterOptions) => any): () => void; + /** Runs a callback when a response is recieved for a request under a certain path (can have wildcards) */ + modifyFetchResponse(id: string, path: string, callback: (response: any) => any): () => void; + /** Stops any modifications made by {@link modifyFetchRequest} with the same id */ + stopModifyRequest(id: string): void; + /** Stops any modifications made by {@link modifyFetchResponse} with the same id */ + stopModifyResponse(id: string): void; /** * @deprecated Methods for both transports are now on the base net api * @hidden diff --git a/types/migrate-mongo/package.json b/types/migrate-mongo/package.json index bc285b7b73ebb6..6d108a5b1b3f7b 100644 --- a/types/migrate-mongo/package.json +++ b/types/migrate-mongo/package.json @@ -7,7 +7,7 @@ ], "dependencies": { "@types/node": "*", - "mongodb": "^6.1.0" + "mongodb": "^7.0.0" }, "devDependencies": { "@types/migrate-mongo": "workspace:."