Skip to content

Commit

Permalink
wrap request executor
Browse files Browse the repository at this point in the history
  • Loading branch information
InventivetalentDev committed Jan 29, 2025
1 parent e356f8f commit dca1a7d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
16 changes: 16 additions & 0 deletions src/WrappedRequestExecutor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { IRequestExecutor } from "@mineskin/core";
import { AxiosRequestConfig, AxiosResponse } from "axios";
import { injectable } from "inversify";
import { Requests } from "./generator/Requests";

//TODO: properly implement this
@injectable()
export class WrappedRequestExecutor implements IRequestExecutor {

constructor() {
}

dynamicRequest<K extends unknown>(key: K, request: AxiosRequestConfig, breadcrumb?: string): Promise<AxiosResponse> {
return Requests.dynamicRequest(key as string, request, breadcrumb);
}
}
2 changes: 2 additions & 0 deletions src/inversify.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
TYPES as GeneratorTypes
} from "@mineskin/generator";
import { MineSkinMetrics } from "./util/metrics";
import { WrappedRequestExecutor } from "./WrappedRequestExecutor";

const container = new Container({defaultScope: 'Singleton'});
try{
Expand All @@ -29,5 +30,6 @@ container.load(billingModule);
container.load(generatorModule);

container.bind(GeneratorTypes.GeneratorClient).to(MongoGeneratorClient).inSingletonScope();
container.bind(CoreTypes.RequestExecutor).to(WrappedRequestExecutor).inSingletonScope();

export { container };
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,7 @@ __metadata:

"@mineskin/generator@git+ssh://[email protected]/MineSkin/mineskin-generator.git":
version: 0.0.0
resolution: "@mineskin/generator@git+ssh://[email protected]/MineSkin/mineskin-generator.git#commit=88dd3c9d5f952274fa7ed5c92e81988d36c8077d"
resolution: "@mineskin/generator@git+ssh://[email protected]/MineSkin/mineskin-generator.git#commit=f0d0299b31055df4b9d89874a019cbbf5fde9bc8"
dependencies:
"@hoangducnhuan/redlock": "npm:^6.0.0"
"@inventivetalent/imghash": "npm:^1.1.1"
Expand Down Expand Up @@ -1506,7 +1506,7 @@ __metadata:
winston: "npm:^3.14.2"
winston-daily-rotate-file: "npm:^5.0.0"
winston-transport-sentry-node: "npm:^3.0.0"
checksum: 10c0/97602ed882ec689bf45f4739f81f78b9287514f7addcd715b3f00bbbff1d5723d6404431809b097a688a06ec4f56256b27819298bfc037c648b8a8b52739bddf
checksum: 10c0/67021e1d638d81cbd17b170efea5e80cd856f05540624ff31083c80e49d8c7396b7b216529f47b8b20a5b168f1cc2316b04cb8e7fd2946211a845ac2de9c4a3a
languageName: node
linkType: hard

Expand Down

0 comments on commit dca1a7d

Please sign in to comment.