Skip to content

Commit

Permalink
fix(js-sdk): resolve circular import (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
ewanharris authored Apr 9, 2024
2 parents e047a0c + 54808b5 commit 37663a5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
3 changes: 2 additions & 1 deletion config/clients/js/config.overrides.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
"example/example1/package.json.mustache": {
"destinationFilename": "example/example1/package.json",
"templateType": "SupportingFiles"
}
},
".madgerc": {}
}
}
2 changes: 2 additions & 0 deletions config/clients/js/template/.github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ updates:
dependencies:
patterns:
- "*"
exclude-patterns:
- "eslint"
7 changes: 7 additions & 0 deletions config/clients/js/template/.madgerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"detectiveOptions": {
"ts": {
"skipTypeImports": true
}
}
}
8 changes: 3 additions & 5 deletions config/clients/js/template/common.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios";

import { Configuration } from "./configuration";
import { Credentials } from "./credentials";
import type { Credentials } from "./credentials";
import {
FgaApiError,
FgaApiInternalError,
Expand Down Expand Up @@ -169,15 +169,13 @@ export async function attemptHttpRequest<B, R>(
/**
* creates an axios request function
*/
export const createRequestFunction = function (axiosArgs: RequestArgs, axiosInstance: AxiosInstance, configuration: Configuration, credentials?: Credentials) {
export const createRequestFunction = function (axiosArgs: RequestArgs, axiosInstance: AxiosInstance, configuration: Configuration, credentials: Credentials) {
configuration.isValid();
const retryParams = axiosArgs.options?.retryParams ? axiosArgs.options?.retryParams : configuration.retryParams;
const maxRetry:number = retryParams ? retryParams.maxRetry : 0;
const minWaitInMs:number = retryParams ? retryParams.minWaitInMs : 0;
if (!credentials) {
credentials = Credentials.init(configuration);
}
return async (axios: AxiosInstance = axiosInstance) : PromiseResult<any> => {
await setBearerAuthToObject(axiosArgs.options.headers, credentials!);
Expand Down

0 comments on commit 37663a5

Please sign in to comment.