triangle-utils 1.4.187 → 1.4.188
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.
|
@@ -5,7 +5,9 @@ export declare class UtilsCognito {
|
|
|
5
5
|
admin_create_user(user_pool_id: string, username: string, user_id: string): Promise<Error | import("@aws-sdk/client-cognito-identity-provider").AdminCreateUserCommandOutput>;
|
|
6
6
|
admin_reset_password(user_pool_id: string, username: string): Promise<Error | import("@aws-sdk/client-cognito-identity-provider").AdminCreateUserCommandOutput>;
|
|
7
7
|
get_email(token: string): Promise<string | undefined>;
|
|
8
|
-
get_user_id(token: string
|
|
8
|
+
get_user_id(token: string, options: {
|
|
9
|
+
is_verbose?: boolean;
|
|
10
|
+
}): Promise<string | undefined>;
|
|
9
11
|
get_new_token(client_id: string, client_secret: string, refresh_token: string): Promise<string | undefined>;
|
|
10
12
|
sign_out(token: string): Promise<void>;
|
|
11
13
|
admin_disable_user(user_pool_id: string, username: string): Promise<void>;
|
package/dist/src/UtilsCognito.js
CHANGED
|
@@ -72,7 +72,8 @@ export class UtilsCognito {
|
|
|
72
72
|
return undefined;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
async get_user_id(token) {
|
|
75
|
+
async get_user_id(token, options) {
|
|
76
|
+
const is_verbose = options.is_verbose || false;
|
|
76
77
|
try {
|
|
77
78
|
const user_info = await this.cognito.getUser({
|
|
78
79
|
AccessToken: token
|
|
@@ -99,6 +100,9 @@ export class UtilsCognito {
|
|
|
99
100
|
return user_id;
|
|
100
101
|
}
|
|
101
102
|
catch (error) {
|
|
103
|
+
if (is_verbose) {
|
|
104
|
+
console.log(error.stack);
|
|
105
|
+
}
|
|
102
106
|
return undefined;
|
|
103
107
|
}
|
|
104
108
|
}
|
package/package.json
CHANGED
package/src/UtilsCognito.ts
CHANGED
|
@@ -76,7 +76,8 @@ export class UtilsCognito {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
async get_user_id(token : string) : Promise<string | undefined> {
|
|
79
|
+
async get_user_id(token : string, options : { is_verbose? : boolean }) : Promise<string | undefined> {
|
|
80
|
+
const is_verbose = options.is_verbose || false
|
|
80
81
|
try {
|
|
81
82
|
const user_info = await this.cognito.getUser({
|
|
82
83
|
AccessToken : token
|
|
@@ -101,7 +102,10 @@ export class UtilsCognito {
|
|
|
101
102
|
}
|
|
102
103
|
const user_id = user_attribute.Value
|
|
103
104
|
return user_id
|
|
104
|
-
} catch (error) {
|
|
105
|
+
} catch (error : any) {
|
|
106
|
+
if (is_verbose) {
|
|
107
|
+
console.log(error.stack)
|
|
108
|
+
}
|
|
105
109
|
return undefined
|
|
106
110
|
}
|
|
107
111
|
}
|