@wabot-dev/framework 0.1.0-beta.71 → 0.1.0-beta.73

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.
@@ -16,6 +16,15 @@ let Auth = class Auth {
16
16
  }
17
17
  this.authInfo = authInfo;
18
18
  }
19
+ override(authInfo) {
20
+ this.authInfo = authInfo;
21
+ }
22
+ clear() {
23
+ this.authInfo = null;
24
+ }
25
+ isAssigned() {
26
+ return this.authInfo !== null;
27
+ }
19
28
  };
20
29
  Auth = __decorate([
21
30
  scoped(Lifecycle.ContainerScoped)
@@ -134,8 +134,8 @@ let MindsetOperator = class MindsetOperator {
134
134
  ? await response.json()
135
135
  : await response.text();
136
136
  }
137
- catch {
138
- body = { message: 'Unable to parse error body' };
137
+ catch (error) {
138
+ body = { message: response.ok ? 'OK' : 'Unable to parse error body' };
139
139
  }
140
140
  return JSON.stringify({
141
141
  httpCode: response.status,
@@ -154,6 +154,9 @@ let MindsetOperator = class MindsetOperator {
154
154
  }
155
155
  }
156
156
  async functionErrorToString(error) {
157
+ if (error instanceof Response) {
158
+ return await this.functionResponseToString(error);
159
+ }
157
160
  if (error?.response && typeof error.response === 'object' && error.response.status) {
158
161
  const { status, data } = error.response;
159
162
  return JSON.stringify({
@@ -161,9 +164,6 @@ let MindsetOperator = class MindsetOperator {
161
164
  body: typeof data === 'object' ? data : { message: data?.toString?.() || 'Unknown error' },
162
165
  });
163
166
  }
164
- if (error instanceof Response) {
165
- return await this.functionResponseToString(error);
166
- }
167
167
  if (error?.message) {
168
168
  return error.message;
169
169
  }
@@ -25,6 +25,9 @@ declare class Auth<D extends IStorableData> {
25
25
  private authInfo;
26
26
  require(): D;
27
27
  assign(authInfo: D): void;
28
+ override(authInfo: D): void;
29
+ clear(): void;
30
+ isAssigned(): boolean;
28
31
  }
29
32
 
30
33
  interface IEntityData extends IStorableData {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wabot-dev/framework",
3
- "version": "0.1.0-beta.71",
3
+ "version": "0.1.0-beta.73",
4
4
  "description": "Framework for IA Chat Bots",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",