@proca/api
Advanced tools
Comparing version 3.3.2 to 3.3.3
@@ -11,8 +11,4 @@ export declare type BasicAuth = { | ||
}; | ||
export declare type AuthHeaderFetcher = () => { | ||
headers: { | ||
authorization: string; | ||
}; | ||
}; | ||
export declare type AuthHeaderFetcher = (() => string | undefined); | ||
export declare function basicAuth(cred: BasicAuth): AuthHeader; | ||
export declare function tokenAuth(cred: TokenAuth): AuthHeader; |
@@ -26,2 +26,3 @@ "use strict"; | ||
const absintheExchange_1 = __importDefault(require("./absintheExchange")); | ||
const auth_1 = require("./auth"); | ||
// hasSubscription - helper func to see if we have an operation with subscription | ||
@@ -78,10 +79,16 @@ // taken from @jumpn/utils-graphql which is not really useful as has not types | ||
return {}; | ||
let opt; | ||
if (typeof auth === 'function') { | ||
return auth; | ||
return () => { | ||
const token = auth(); | ||
if (token !== null) { | ||
return { headers: (0, auth_1.tokenAuth)({ token }) }; | ||
} | ||
else { | ||
return {}; | ||
} | ||
}; | ||
} | ||
else { | ||
opt = { headers: auth || {} }; | ||
return { headers: auth || {} }; | ||
} | ||
return opt; | ||
} | ||
@@ -88,0 +95,0 @@ function link(url, auth, options) { |
{ | ||
"name": "@proca/api", | ||
"version": "3.3.2", | ||
"version": "3.3.3", | ||
"description": "Client library for Proca API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
105027
1752