Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions types/gimloader/gimloader-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 24 additions & 2 deletions types/gimloader/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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";
Expand All @@ -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;
/**
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion types/migrate-mongo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"dependencies": {
"@types/node": "*",
"mongodb": "^6.1.0"
"mongodb": "^7.0.0"
},
"devDependencies": {
"@types/migrate-mongo": "workspace:."
Expand Down