diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 045feb1..7ce60d7 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -16,3 +16,5 @@ updates: dependencies: patterns: - "*" + exclude-patterns: + - "eslint" diff --git a/.madgerc b/.madgerc new file mode 100644 index 0000000..0646516 --- /dev/null +++ b/.madgerc @@ -0,0 +1,7 @@ +{ + "detectiveOptions": { + "ts": { + "skipTypeImports": true + } + } +} \ No newline at end of file diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 3bdd2bf..7ddd706 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -11,6 +11,7 @@ .github/workflows/semgrep.yaml .gitignore .gitignore +.madgerc .npmrc CHANGELOG.md CONTRIBUTING.md diff --git a/common.ts b/common.ts index a8b2587..2f054bd 100644 --- a/common.ts +++ b/common.ts @@ -14,7 +14,7 @@ import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios"; import { Configuration } from "./configuration"; -import { Credentials } from "./credentials"; +import type { Credentials } from "./credentials"; import { FgaApiError, FgaApiInternalError, @@ -180,15 +180,13 @@ export async function attemptHttpRequest( /** * 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 => { await setBearerAuthToObject(axiosArgs.options.headers, credentials!);