@tennantje/identity-types 1.0.7 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ApiResponse.d.ts +10 -0
- package/dist/ApiResponse.js +14 -1
- package/dist/Miscellaneous.d.ts +2 -2
- package/package.json +1 -1
package/dist/ApiResponse.d.ts
CHANGED
|
@@ -8,3 +8,13 @@ export interface ApiErrorResponse {
|
|
|
8
8
|
details?: any;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
+
export interface OAuthErrorResponse {
|
|
12
|
+
error: string;
|
|
13
|
+
error_description: string;
|
|
14
|
+
code?: number;
|
|
15
|
+
state?: string;
|
|
16
|
+
redirect_uri?: string;
|
|
17
|
+
iss?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const isOAuthError: (data: unknown) => data is OAuthErrorResponse;
|
|
20
|
+
export declare const isApiError: (data: unknown) => data is ApiErrorResponse;
|
package/dist/ApiResponse.js
CHANGED
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
// Type guards
|
|
2
|
+
export const isOAuthError = (data) => {
|
|
3
|
+
return typeof data === 'object' &&
|
|
4
|
+
data !== null &&
|
|
5
|
+
typeof data.error === 'string' &&
|
|
6
|
+
typeof data.error_description === 'string';
|
|
7
|
+
};
|
|
8
|
+
export const isApiError = (data) => {
|
|
9
|
+
return typeof data === 'object' &&
|
|
10
|
+
data !== null &&
|
|
11
|
+
typeof data.error === 'object' &&
|
|
12
|
+
data.error !== null &&
|
|
13
|
+
typeof data.error.message === 'string';
|
|
14
|
+
};
|
package/dist/Miscellaneous.d.ts
CHANGED