@wireapp/api-client 27.88.0 → 27.89.1

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.
@@ -1,25 +1,8 @@
1
- import { StatusCodes as StatusCode } from 'http-status-codes';
2
1
  import { MLSGroupOutOfSyncError } from '../conversation/';
3
- import { BackendError, BackendErrorLabel } from './';
4
- type BackendErrorWithLabel = BackendError & {
5
- label: BackendErrorLabel;
6
- };
7
- type ErrorBuilder = (e: BackendErrorWithLabel) => BackendError;
8
- type ErrorLabelToBuilderMap = Partial<Record<BackendErrorLabel, ErrorBuilder>>;
9
- type StatusCodeToLabelMap = Partial<Record<StatusCode, ErrorLabelToBuilderMap>>;
10
- export declare class BackendErrorMapper {
11
- /**
12
- * Baseline/default handler for each (code, label). Used when no message variant matches.
13
- */
14
- static defaultHandlers: StatusCodeToLabelMap;
15
- /**
16
- * Message-specific variants for known texts under a given (code,label).
17
- * Provides finer granularity when wording matches; otherwise we fall back to defaultHandlers.
18
- */
19
- private static messageVariantHandlers;
20
- private static logUnmapped;
21
- static isMlsGroupOutOfSyncError(error: BackendError): error is MLSGroupOutOfSyncError;
22
- static map(error: BackendError): BackendError;
23
- }
24
- export {};
2
+ import { BackendError } from './';
3
+ export declare function isMlsGroupOutOfSyncError(error: BackendError): error is MLSGroupOutOfSyncError;
4
+ /**
5
+ * Map a BackendError to a more specific error instance based on its code, label, and message.
6
+ */
7
+ export declare function mapBackendError(error: BackendError): BackendError;
25
8
  //# sourceMappingURL=BackendErrorMapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BackendErrorMapper.d.ts","sourceRoot":"","sources":["../../src/http/BackendErrorMapper.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,IAAI,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAc5D,OAAO,EAGL,sBAAsB,EAIvB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAAC,YAAY,EAAE,iBAAiB,EAAC,MAAM,IAAI,CAAC;AAEnD,KAAK,qBAAqB,GAAG,YAAY,GAAG;IAAC,KAAK,EAAE,iBAAiB,CAAA;CAAC,CAAC;AACvE,KAAK,YAAY,GAAG,CAAC,CAAC,EAAE,qBAAqB,KAAK,YAAY,CAAC;AAG/D,KAAK,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC,CAAC;AAE/E,KAAK,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,sBAAsB,CAAC,CAAC,CAAC;AAQhF,qBAAa,kBAAkB;IAC7B;;OAEG;IACH,OAAc,eAAe,EAAE,oBAAoB,CAmDjD;IAEF;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB,CA6CnC;IAEF,OAAO,CAAC,MAAM,CAAC,WAAW;WAWZ,wBAAwB,CAAC,KAAK,EAAE,YAAY,GAAG,KAAK,IAAI,sBAAsB;WAQ9E,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY;CAyBrD"}
1
+ {"version":3,"file":"BackendErrorMapper.d.ts","sourceRoot":"","sources":["../../src/http/BackendErrorMapper.ts"],"names":[],"mappings":"AAiCA,OAAO,EAGL,sBAAsB,EAIvB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAAC,YAAY,EAAoB,MAAM,IAAI,CAAC;AAgKnD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,YAAY,GAAG,KAAK,IAAI,sBAAsB,CAM7F;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CAmCjE"}
@@ -18,7 +18,8 @@
18
18
  *
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.BackendErrorMapper = void 0;
21
+ exports.isMlsGroupOutOfSyncError = isMlsGroupOutOfSyncError;
22
+ exports.mapBackendError = mapBackendError;
22
23
  const http_status_codes_1 = require("http-status-codes");
23
24
  const commons_1 = require("@wireapp/commons");
24
25
  const auth_1 = require("../auth/");
@@ -27,113 +28,145 @@ const team_1 = require("../team/");
27
28
  const user_1 = require("../user/");
28
29
  const _1 = require("./");
29
30
  const logger = commons_1.LogFactory.getLogger('@wireapp/api-client/http/BackendErrorMapper');
30
- class BackendErrorMapper {
31
- /**
32
- * Baseline/default handler for each (code, label). Used when no message variant matches.
33
- */
34
- static defaultHandlers = {
35
- [http_status_codes_1.StatusCodes.BAD_REQUEST]: {
36
- [_1.BackendErrorLabel.CLIENT_ERROR]: e => new _1.BackendError('Wrong set of parameters.', e.label, e.code),
37
- [_1.BackendErrorLabel.INVALID_INVITATION_CODE]: e => new team_1.InvalidInvitationCodeError('Invalid invitation code.', e.label, e.code),
31
+ // BAD_REQUEST / CLIENT_ERROR
32
+ const MESSAGE_BAD_REQUEST_SATISFY = 'Error in $: Failed reading: satisfy';
33
+ const MESSAGE_INVALID_CONVERSATION_UUID = "[path] 'cnv' invalid: Failed reading: Invalid UUID";
34
+ const MESSAGE_INVALID_USER_UUID = "[path] 'usr' invalid: Failed reading: Invalid UUID";
35
+ // BAD_REQUEST / MLS
36
+ const MESSAGE_MLS_INVALID_LEAF_NODE_SIGNATURE = 'Invalid leaf node signature';
37
+ const MESSAGE_MLS_INVALID_LEAF_NODE_INDEX = 'Invalid leaf node index';
38
+ // FORBIDDEN / INVALID_CREDENTIALS and related variants
39
+ const MESSAGE_INVALID_ZAUTH_TOKEN = 'Invalid zauth token';
40
+ const MESSAGE_INVALID_TOKEN = 'Invalid token';
41
+ const MESSAGE_AUTHENTICATION_FAILED = 'Authentication failed.';
42
+ const MESSAGE_MISSING_COOKIE = 'Missing cookie';
43
+ const MESSAGE_TOKEN_EXPIRED = 'Token expired';
44
+ const MESSAGE_MISSING_COOKIE_AND_TOKEN = 'Missing cookie and token';
45
+ // FORBIDDEN / INVALID_OPERATION
46
+ const MESSAGE_INVALID_OPERATION_FOR_ONE_TO_ONE = 'invalid operation for 1:1 conversations';
47
+ // FORBIDDEN / CLIENT_ERROR variant
48
+ const MESSAGE_FAILED_READING_INVALID_ZAUTH_TOKEN = 'Failed reading: Invalid zauth token';
49
+ // Consolidated token-invalid messages to reduce duplication across variants.
50
+ const INVALID_TOKEN_MESSAGES = new Set([
51
+ MESSAGE_INVALID_ZAUTH_TOKEN,
52
+ MESSAGE_INVALID_TOKEN,
53
+ MESSAGE_FAILED_READING_INVALID_ZAUTH_TOKEN,
54
+ ]);
55
+ /**
56
+ * Baseline/default handler for each (code, label). Used when no message variant matches.
57
+ */
58
+ const defaultHandlers = {
59
+ [http_status_codes_1.StatusCodes.BAD_REQUEST]: {
60
+ [_1.BackendErrorLabel.CLIENT_ERROR]: e => new _1.BackendError('Wrong set of parameters.', e.label, e.code),
61
+ [_1.BackendErrorLabel.INVALID_INVITATION_CODE]: e => new team_1.InvalidInvitationCodeError('Invalid invitation code.', e.label, e.code),
62
+ },
63
+ [http_status_codes_1.StatusCodes.FORBIDDEN]: {
64
+ [_1.BackendErrorLabel.INVALID_CREDENTIALS]: e =>
65
+ // default to logout-safe type for unknown messages
66
+ new auth_1.InvalidTokenError('Authentication failed because the token is invalid.', e.label, e.code),
67
+ [_1.BackendErrorLabel.CLIENT_ERROR]: e => new _1.BackendError('Operation not permitted.', e.label, e.code),
68
+ [_1.BackendErrorLabel.NOT_CONNECTED]: e => new user_1.UnconnectedUserError('Users are not connected.', e.label, e.code),
69
+ [_1.BackendErrorLabel.INVALID_OPERATION]: e => new conversation_1.ConversationOperationError('Cannot perform this operation.', e.label, e.code),
70
+ [_1.BackendErrorLabel.SUSPENDED_ACCOUNT]: e => new auth_1.SuspendedAccountError('Account suspended.', e.label, e.code),
71
+ },
72
+ [http_status_codes_1.StatusCodes.TOO_MANY_REQUESTS]: {
73
+ [_1.BackendErrorLabel.CLIENT_ERROR]: e => new auth_1.LoginTooFrequentError('Logins too frequent. User login temporarily disabled.', e.label, e.code),
74
+ },
75
+ [http_status_codes_1.StatusCodes.CONFLICT]: {
76
+ [_1.BackendErrorLabel.INVITE_EMAIL_EXISTS]: e => new team_1.InviteEmailInUseError('The given e-mail address is in use.', e.label, e.code),
77
+ [_1.BackendErrorLabel.KEY_EXISTS]: e => new auth_1.IdentifierExistsError('The given e-mail address is in use.', e.label, e.code),
78
+ [_1.BackendErrorLabel.MLS_STALE_MESSAGE]: e => new conversation_1.MLSStaleMessageError('The conversation epoch in a message is too old', e.label, e.code),
79
+ [_1.BackendErrorLabel.MLS_GROUP_OUT_OF_SYNC]: error => {
80
+ if (isMlsGroupOutOfSyncError(error)) {
81
+ return new conversation_1.MLSGroupOutOfSyncError(error.code, error.missing_users, error.message);
82
+ }
83
+ logger.warn('Failed to detect missing_users field in MLSGroupOutOfSyncError, using empty array for missing_users', { error });
84
+ return new conversation_1.MLSGroupOutOfSyncError(error.code, [], error.message);
38
85
  },
39
- [http_status_codes_1.StatusCodes.FORBIDDEN]: {
40
- [_1.BackendErrorLabel.INVALID_CREDENTIALS]: e =>
41
- // default to logout-safe type for unknown messages
42
- new auth_1.InvalidTokenError('Authentication failed because the token is invalid.', e.label, e.code),
43
- [_1.BackendErrorLabel.CLIENT_ERROR]: e => new _1.BackendError('Operation not permitted.', e.label, e.code),
44
- [_1.BackendErrorLabel.NOT_CONNECTED]: e => new user_1.UnconnectedUserError('Users are not connected.', e.label, e.code),
45
- [_1.BackendErrorLabel.INVALID_OPERATION]: e => new conversation_1.ConversationOperationError('Cannot perform this operation.', e.label, e.code),
46
- [_1.BackendErrorLabel.SUSPENDED_ACCOUNT]: e => new auth_1.SuspendedAccountError('Account suspended.', e.label, e.code),
86
+ },
87
+ [http_status_codes_1.StatusCodes.NOT_FOUND]: {
88
+ [_1.BackendErrorLabel.NOT_FOUND]: e => new team_1.ServiceNotFoundError('Service not found', e.label, e.code),
89
+ },
90
+ };
91
+ /**
92
+ * Message-specific variants for known texts under a given (code,label).
93
+ * Provides finer granularity when wording matches; otherwise we fall back to defaultHandlers.
94
+ */
95
+ const messageVariantHandlers = {
96
+ [http_status_codes_1.StatusCodes.BAD_REQUEST]: {
97
+ [_1.BackendErrorLabel.CLIENT_ERROR]: {
98
+ [MESSAGE_BAD_REQUEST_SATISFY]: e => new _1.BackendError('Wrong set of parameters.', e.label, e.code),
99
+ [MESSAGE_INVALID_CONVERSATION_UUID]: e => new conversation_1.ConversationIsUnknownError('Conversation ID is unknown.', e.label, e.code),
100
+ [MESSAGE_INVALID_USER_UUID]: e => new user_1.UserIsUnknownError('User ID is unknown.', e.label, e.code),
47
101
  },
48
- [http_status_codes_1.StatusCodes.TOO_MANY_REQUESTS]: {
49
- [_1.BackendErrorLabel.CLIENT_ERROR]: e => new auth_1.LoginTooFrequentError('Logins too frequent. User login temporarily disabled.', e.label, e.code),
102
+ [_1.BackendErrorLabel.MLS_INVALID_LEAF_NODE_SIGNATURE]: {
103
+ [MESSAGE_MLS_INVALID_LEAF_NODE_SIGNATURE]: e => new conversation_1.MLSInvalidLeafNodeSignatureError('Invalid leaf node signature', e.label, e.code),
50
104
  },
51
- [http_status_codes_1.StatusCodes.CONFLICT]: {
52
- [_1.BackendErrorLabel.INVITE_EMAIL_EXISTS]: e => new team_1.InviteEmailInUseError('The given e-mail address is in use.', e.label, e.code),
53
- [_1.BackendErrorLabel.KEY_EXISTS]: e => new auth_1.IdentifierExistsError('The given e-mail address is in use.', e.label, e.code),
54
- [_1.BackendErrorLabel.MLS_STALE_MESSAGE]: e => new conversation_1.MLSStaleMessageError('The conversation epoch in a message is too old', e.label, e.code),
55
- [_1.BackendErrorLabel.MLS_GROUP_OUT_OF_SYNC]: error => {
56
- if (BackendErrorMapper.isMlsGroupOutOfSyncError(error)) {
57
- return new conversation_1.MLSGroupOutOfSyncError(error.code, error.missing_users, error.message);
58
- }
59
- logger.warn('Failed to detect missing_users field in MLSGroupOutOfSyncError, using empty array for missing_users', { error });
60
- return new conversation_1.MLSGroupOutOfSyncError(error.code, [], error.message);
61
- },
105
+ [_1.BackendErrorLabel.MLS_INVALID_LEAF_NODE_INDEX]: {
106
+ [MESSAGE_MLS_INVALID_LEAF_NODE_INDEX]: e => new conversation_1.MLSInvalidLeafNodeIndexError('Invalid leaf node index', e.label, e.code),
62
107
  },
63
- [http_status_codes_1.StatusCodes.NOT_FOUND]: {
64
- [_1.BackendErrorLabel.NOT_FOUND]: e => new team_1.ServiceNotFoundError('Service not found', e.label, e.code),
108
+ },
109
+ [http_status_codes_1.StatusCodes.FORBIDDEN]: {
110
+ [_1.BackendErrorLabel.INVALID_CREDENTIALS]: {
111
+ [MESSAGE_INVALID_ZAUTH_TOKEN]: e => new auth_1.InvalidTokenError('Authentication failed because the token is invalid.', e.label, e.code),
112
+ [MESSAGE_INVALID_TOKEN]: e => new auth_1.InvalidTokenError('Authentication failed because the token is invalid.', e.label, e.code),
113
+ [MESSAGE_AUTHENTICATION_FAILED]: e => new auth_1.InvalidCredentialsError('Authentication failed because of invalid credentials.', e.label, e.code),
114
+ [MESSAGE_MISSING_COOKIE]: e => new auth_1.MissingCookieError('Authentication failed because the cookie is missing.', e.label, e.code),
115
+ [MESSAGE_TOKEN_EXPIRED]: e => new auth_1.TokenExpiredError('Authentication failed because the token is expired.', e.label, e.code),
116
+ [MESSAGE_MISSING_COOKIE_AND_TOKEN]: e => new auth_1.MissingCookieAndTokenError('Authentication failed because both cookie and token are missing.', e.label, e.code),
65
117
  },
66
- };
67
- /**
68
- * Message-specific variants for known texts under a given (code,label).
69
- * Provides finer granularity when wording matches; otherwise we fall back to defaultHandlers.
70
- */
71
- static messageVariantHandlers = {
72
- [http_status_codes_1.StatusCodes.BAD_REQUEST]: {
73
- [_1.BackendErrorLabel.CLIENT_ERROR]: {
74
- 'Error in $: Failed reading: satisfy': e => new _1.BackendError('Wrong set of parameters.', e.label, e.code),
75
- "[path] 'cnv' invalid: Failed reading: Invalid UUID": e => new conversation_1.ConversationIsUnknownError('Conversation ID is unknown.', e.label, e.code),
76
- "[path] 'usr' invalid: Failed reading: Invalid UUID": e => new user_1.UserIsUnknownError('User ID is unknown.', e.label, e.code),
77
- },
78
- [_1.BackendErrorLabel.MLS_INVALID_LEAF_NODE_SIGNATURE]: {
79
- 'Invalid leaf node signature': e => new conversation_1.MLSInvalidLeafNodeSignatureError('Invalid leaf node signature', e.label, e.code),
80
- },
81
- [_1.BackendErrorLabel.MLS_INVALID_LEAF_NODE_INDEX]: {
82
- 'Invalid leaf node index': e => new conversation_1.MLSInvalidLeafNodeIndexError('Invalid leaf node index', e.label, e.code),
83
- },
118
+ [_1.BackendErrorLabel.INVALID_OPERATION]: {
119
+ [MESSAGE_INVALID_OPERATION_FOR_ONE_TO_ONE]: e => new conversation_1.ConversationOperationError('Cannot leave 1:1 conversation.', e.label, e.code),
84
120
  },
85
- [http_status_codes_1.StatusCodes.FORBIDDEN]: {
86
- [_1.BackendErrorLabel.INVALID_CREDENTIALS]: {
87
- 'Invalid zauth token': e => new auth_1.InvalidTokenError('Authentication failed because the token is invalid.', e.label, e.code),
88
- 'Invalid token': e => new auth_1.InvalidTokenError('Authentication failed because the token is invalid.', e.label, e.code),
89
- 'Authentication failed.': e => new auth_1.InvalidCredentialsError('Authentication failed because of invalid credentials.', e.label, e.code),
90
- 'Missing cookie': e => new auth_1.MissingCookieError('Authentication failed because the cookie is missing.', e.label, e.code),
91
- 'Token expired': e => new auth_1.TokenExpiredError('Authentication failed because the token is expired.', e.label, e.code),
92
- 'Missing cookie and token': e => new auth_1.MissingCookieAndTokenError('Authentication failed because both cookie and token are missing.', e.label, e.code),
93
- },
94
- [_1.BackendErrorLabel.INVALID_OPERATION]: {
95
- 'invalid operation for 1:1 conversations': e => new conversation_1.ConversationOperationError('Cannot leave 1:1 conversation.', e.label, e.code),
96
- },
97
- [_1.BackendErrorLabel.CLIENT_ERROR]: {
98
- 'Failed reading: Invalid zauth token': e => new auth_1.InvalidTokenError('Authentication failed because the token is invalid.', e.label, e.code),
99
- },
121
+ [_1.BackendErrorLabel.CLIENT_ERROR]: {
122
+ [MESSAGE_FAILED_READING_INVALID_ZAUTH_TOKEN]: e => new auth_1.InvalidTokenError('Authentication failed because the token is invalid.', e.label, e.code),
100
123
  },
101
- };
102
- static logUnmapped(error, reason) {
103
- if (process.env.NODE_ENV === 'development') {
104
- console.warn('[BackendErrorMapper] Unmapped error:', {
105
- code: error.code,
106
- label: error.label,
107
- message: error.message,
108
- reason,
109
- });
110
- }
124
+ },
125
+ };
126
+ function logUnmapped(error, reason) {
127
+ if (process.env.NODE_ENV === 'development') {
128
+ logger.warn('[BackendErrorMapper] Unmapped error:', {
129
+ code: error.code,
130
+ label: error.label,
131
+ message: error.message,
132
+ reason,
133
+ });
111
134
  }
112
- static isMlsGroupOutOfSyncError(error) {
113
- return (error.code === http_status_codes_1.StatusCodes.CONFLICT &&
114
- error.label === _1.BackendErrorLabel.MLS_GROUP_OUT_OF_SYNC &&
115
- 'missing_users' in error);
135
+ }
136
+ function isMlsGroupOutOfSyncError(error) {
137
+ return (error.code === http_status_codes_1.StatusCodes.CONFLICT &&
138
+ error.label === _1.BackendErrorLabel.MLS_GROUP_OUT_OF_SYNC &&
139
+ 'missing_users' in error);
140
+ }
141
+ /**
142
+ * Map a BackendError to a more specific error instance based on its code, label, and message.
143
+ */
144
+ function mapBackendError(error) {
145
+ const code = Number(error.code);
146
+ const label = error.label;
147
+ const message = (error.message ?? '').trim();
148
+ // Special-case: MLS group out of sync (structural field-based)
149
+ if (isMlsGroupOutOfSyncError(error)) {
150
+ return new conversation_1.MLSGroupOutOfSyncError(error.code, error.missing_users, error.message);
116
151
  }
117
- static map(error) {
118
- const code = Number(error.code);
119
- const label = error.label;
120
- const message = error.message ?? '';
121
- if (BackendErrorMapper.isMlsGroupOutOfSyncError(error)) {
122
- return new conversation_1.MLSGroupOutOfSyncError(error.code, error.missing_users, error.message);
123
- }
124
- // 1) Message-specific variant
125
- const messageVariantHandler = BackendErrorMapper.messageVariantHandlers[code]?.[label]?.[message];
126
- if (messageVariantHandler) {
127
- return messageVariantHandler(error);
128
- }
129
- // 2) Default fallback for this (code,label)
130
- const fallbackHandler = BackendErrorMapper.defaultHandlers[code]?.[label];
131
- if (fallbackHandler) {
132
- return fallbackHandler(error);
152
+ // Consolidated handling for common "invalid token" variants
153
+ if (code === http_status_codes_1.StatusCodes.FORBIDDEN) {
154
+ if ((label === _1.BackendErrorLabel.INVALID_CREDENTIALS || label === _1.BackendErrorLabel.CLIENT_ERROR) &&
155
+ INVALID_TOKEN_MESSAGES.has(message)) {
156
+ return new auth_1.InvalidTokenError('Authentication failed because the token is invalid.', label, code);
133
157
  }
134
- // 3) Unknown (code,label) — keep original but log in dev
135
- this.logUnmapped(error, 'No mapping for code+label (+message)');
136
- return error;
137
158
  }
159
+ // 1) Message-specific variant
160
+ const messageVariantHandler = messageVariantHandlers[code]?.[label]?.[message];
161
+ if (messageVariantHandler) {
162
+ return messageVariantHandler({ ...error, label });
163
+ }
164
+ // 2) Default fallback for this (code,label)
165
+ const fallbackHandler = defaultHandlers[code]?.[label];
166
+ if (fallbackHandler) {
167
+ return fallbackHandler({ ...error, label });
168
+ }
169
+ // 3) Unknown (code,label) — keep original but log in dev
170
+ logUnmapped(error, 'No mapping for code+label (+message)');
171
+ return error;
138
172
  }
139
- exports.BackendErrorMapper = BackendErrorMapper;
@@ -1 +1 @@
1
- {"version":3,"file":"HttpClient.d.ts","sourceRoot":"","sources":["../../src/http/HttpClient.ts"],"names":[],"mappings":"AAmBA,OAAc,EAAC,UAAU,EAAgB,aAAa,EAAE,kBAAkB,EAAE,aAAa,EAAC,MAAM,OAAO,CAAC;AAKxG,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAKpC,OAAO,EACL,eAAe,EACf,gBAAgB,EAEhB,iBAAiB,EAEjB,kBAAkB,EAEnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,YAAY,EAAsB,eAAe,EAA0B,MAAM,UAAU,CAAC;AAIpG,aAAK,KAAK;IACR,0BAA0B,gDAAgD;IAC1E,gBAAgB,sCAAsC;CACvD;AAED,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,CAAC,CAAC,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAQjE,kBAAkB,CAAC,CAAC,EACzB,MAAM,EAAE,kBAAkB,EAC1B,oBAAoB,GAAE,OAAe,GACpC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAQrB,eAAe,CAAC,CAAC,EACtB,MAAM,EAAE,kBAAkB,EAC1B,oBAAoB,GAAE,OAAe,GACpC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;CAO7B"}
@@ -170,7 +170,7 @@ class HttpClient extends events_1.EventEmitter {
170
170
  return retryWithTokenRefresh();
171
171
  }
172
172
  if (HttpClient.isBackendError(error)) {
173
- const mappedError = http_1.BackendErrorMapper.map(new http_1.BackendError(error.response.data.message, error.response.data.label, error.response.data.code));
173
+ const mappedError = (0, http_1.mapBackendError)(new http_1.BackendError(error.response.data.message, error.response.data.label, error.response.data.code));
174
174
  const isUnauthorized = mappedError.code === http_1.StatusCode.UNAUTHORIZED;
175
175
  const isExpiredTokenError = mappedError instanceof auth_1.TokenExpiredError;
176
176
  if ((isExpiredTokenError || isUnauthorized) && hasAccessToken && isFirstTry) {
@@ -16,8 +16,9 @@ export declare class UserGroupAPI {
16
16
  createUserGroup(body: UserGroupCreateRequest): Promise<UserGroup>;
17
17
  /**
18
18
  * Get a user group by ID.
19
+ * @param includeChannels Whether to include the channels in the response (default: true).
19
20
  */
20
- getUserGroup(gid: string): Promise<UserGroup>;
21
+ getUserGroup(gid: string, includeChannels?: boolean): Promise<UserGroup>;
21
22
  /**
22
23
  * Update a user group by ID.
23
24
  */
@@ -1 +1 @@
1
- {"version":3,"file":"UserGroupAPI.d.ts","sourceRoot":"","sources":["../../src/userGroups/UserGroupAPI.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AA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C,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAe,UAAU,EAAE,iBAAiB,EAAsB,MAAM,SAAS,CAAC;AAGzF,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAE/C;;OAEG;IACU,gBAAgB,CAAC,EAAC,KAAK,EAAE,GAAG,OAAO,EAAC,GAAE,sBAA2B,GAAG,OAAO,CACtF,iBAAiB,CAAC,qBAAqB,CAAC,CACzC;IA+BD;;OAEG;IACU,eAAe,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,SAAS,CAAC;IAW9E;;;OAGG;IACU,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,eAAe,UAAO,GAAG,OAAO,CAAC,SAAS,CAAC;IAWlF;;OAEG;IACU,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUtE;;OAEG;IACU,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASxD;;OAEG;IACU,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAUtF;;OAEG;IACU,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAS3F"}
@@ -69,11 +69,13 @@ class UserGroupAPI {
69
69
  }
70
70
  /**
71
71
  * Get a user group by ID.
72
+ * @param includeChannels Whether to include the channels in the response (default: true).
72
73
  */
73
- async getUserGroup(gid) {
74
+ async getUserGroup(gid, includeChannels = true) {
74
75
  const config = {
75
76
  url: `/user-groups/${gid}`,
76
77
  method: 'get',
78
+ params: { include_channels: includeChannels },
77
79
  };
78
80
  const { data } = await this.client.sendJSON(config);
79
81
  return data;
package/package.json CHANGED
@@ -70,6 +70,6 @@
70
70
  "watch": "webpack serve --config webpack.browser.js",
71
71
  "prepare": "yarn dist"
72
72
  },
73
- "version": "27.88.0",
74
- "gitHead": "08b1f644410ec68bf35c063c3c49eaae4e2a95e7"
73
+ "version": "27.89.1",
74
+ "gitHead": "339f094534dc6fd02506beec40c66d60720db49d"
75
75
  }