@animo-id/oauth2-utils
Advanced tools
Comparing version 0.0.2-alpha-20241107122357 to 0.0.2-alpha-20241107124724
@@ -136,2 +136,4 @@ import * as v from 'valibot'; | ||
} | ||
declare function isContentType(contentType: ContentType, value: string): boolean; | ||
declare function isResponseContentType(contentType: ContentType, response: FetchResponse): boolean; | ||
@@ -149,2 +151,2 @@ interface Oid4vcTsConfig { | ||
export { type BaseSchema, ContentType, type Fetch, type FetchHeaders, type FetchRequestInit, type FetchResponse, _Headers as Headers, type HttpMethod, type InferOutputUnion, JsonParseError, type Oid4vcTsConfig, type Optional, type Simplify, _URL as URL, _URLSearchParams as URLSearchParams, type ValibotFetcher, ValidationError, type WwwAuthenticateHeaderChallenge, addSecondsToDate, arrayEqualsIgnoreOrder, createValibotFetcher, dateToSeconds, decodeBase64, decodeUtf8String, defaultFetcher, encodeToBase64, encodeToBase64Url, encodeToUtf8String, encodeWwwAuthenticateHeader, getGlobalConfig, getQueryParams, joinUriParts, mergeDeep, objectToQueryParams, parseWithErrorHandling, parseWwwAuthenticateHeader, setGlobalConfig, stringToJsonWithErrorHandling, vHttpMethod, vHttpsUrl, vInteger, valibotRecursiveFlattenIssues }; | ||
export { type BaseSchema, ContentType, type Fetch, type FetchHeaders, type FetchRequestInit, type FetchResponse, _Headers as Headers, type HttpMethod, type InferOutputUnion, JsonParseError, type Oid4vcTsConfig, type Optional, type Simplify, _URL as URL, _URLSearchParams as URLSearchParams, type ValibotFetcher, ValidationError, type WwwAuthenticateHeaderChallenge, addSecondsToDate, arrayEqualsIgnoreOrder, createValibotFetcher, dateToSeconds, decodeBase64, decodeUtf8String, defaultFetcher, encodeToBase64, encodeToBase64Url, encodeToUtf8String, encodeWwwAuthenticateHeader, getGlobalConfig, getQueryParams, isContentType, isResponseContentType, joinUriParts, mergeDeep, objectToQueryParams, parseWithErrorHandling, parseWwwAuthenticateHeader, setGlobalConfig, stringToJsonWithErrorHandling, vHttpMethod, vHttpsUrl, vInteger, valibotRecursiveFlattenIssues }; |
@@ -52,2 +52,4 @@ "use strict"; | ||
getQueryParams: () => getQueryParams, | ||
isContentType: () => isContentType, | ||
isResponseContentType: () => isResponseContentType, | ||
joinUriParts: () => joinUriParts, | ||
@@ -218,2 +220,10 @@ mergeDeep: () => mergeDeep, | ||
})(ContentType || {}); | ||
function isContentType(contentType, value) { | ||
return value.toLowerCase().trim().split(";")[0] === contentType; | ||
} | ||
function isResponseContentType(contentType, response) { | ||
const header = response.headers.get("Content-Type"); | ||
if (!header) return false; | ||
return isContentType(contentType, header); | ||
} | ||
@@ -227,3 +237,3 @@ // src/valibot-fetcher.ts | ||
response, | ||
result: response.ok && response.headers.get("Content-Type") === "application/json" /* Json */ ? v2.safeParse(schema, await response.json()) : void 0 | ||
result: response.ok && isResponseContentType("application/json" /* Json */, response) ? v2.safeParse(schema, await response.json()) : void 0 | ||
}; | ||
@@ -350,2 +360,4 @@ }; | ||
getQueryParams, | ||
isContentType, | ||
isResponseContentType, | ||
joinUriParts, | ||
@@ -352,0 +364,0 @@ mergeDeep, |
{ | ||
"name": "@animo-id/oauth2-utils", | ||
"version": "0.0.2-alpha-20241107122357", | ||
"version": "0.0.2-alpha-20241107124724", | ||
"exports": { | ||
@@ -5,0 +5,0 @@ ".": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
77157
772