triangle-utils 1.4.186 → 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): Promise<string | undefined>;
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>;
@@ -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
  }
@@ -30,7 +30,7 @@ export declare class UtilsRDS {
30
30
  attribute_names?: string[];
31
31
  is_verbose?: boolean;
32
32
  is_read?: boolean;
33
- }): Promise<any[][]>;
33
+ }): Promise<any[]>;
34
34
  create(table_id: string, item: Record<string, any>, options?: {
35
35
  is_verbose?: boolean;
36
36
  is_read?: boolean;
@@ -146,7 +146,7 @@ export class UtilsRDS {
146
146
  return batch_new_items;
147
147
  }, { num_iterators: options.num_iterators, batch_num_items: batch_num_items })
148
148
  .then(new_items => new_items.filter(new_item => new_item !== undefined));
149
- return new_items;
149
+ return new_items.flat();
150
150
  }
151
151
  async create(table_id, item, options = {}) {
152
152
  const attribute_names = Object.keys(item).sort();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-utils",
3
- "version": "1.4.186",
3
+ "version": "1.4.188",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
@@ -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
  }
package/src/UtilsRDS.ts CHANGED
@@ -194,7 +194,7 @@ export class UtilsRDS {
194
194
  return batch_new_items
195
195
  }, { num_iterators : options.num_iterators, batch_num_items : batch_num_items })
196
196
  .then(new_items => new_items.filter(new_item => new_item !== undefined))
197
- return new_items
197
+ return new_items.flat()
198
198
  }
199
199
 
200
200
  async create(