@wireapp/api-client 27.89.1 → 27.90.0

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 +1 @@
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"}
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;AA+InD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,YAAY,GAAG,KAAK,IAAI,sBAAsB,CAM7F;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CAuCjE"}
@@ -32,9 +32,6 @@ const logger = commons_1.LogFactory.getLogger('@wireapp/api-client/http/BackendE
32
32
  const MESSAGE_BAD_REQUEST_SATISFY = 'Error in $: Failed reading: satisfy';
33
33
  const MESSAGE_INVALID_CONVERSATION_UUID = "[path] 'cnv' invalid: Failed reading: Invalid UUID";
34
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
35
  // FORBIDDEN / INVALID_CREDENTIALS and related variants
39
36
  const MESSAGE_INVALID_ZAUTH_TOKEN = 'Invalid zauth token';
40
37
  const MESSAGE_INVALID_TOKEN = 'Invalid token';
@@ -59,6 +56,8 @@ const defaultHandlers = {
59
56
  [http_status_codes_1.StatusCodes.BAD_REQUEST]: {
60
57
  [_1.BackendErrorLabel.CLIENT_ERROR]: e => new _1.BackendError('Wrong set of parameters.', e.label, e.code),
61
58
  [_1.BackendErrorLabel.INVALID_INVITATION_CODE]: e => new team_1.InvalidInvitationCodeError('Invalid invitation code.', e.label, e.code),
59
+ [_1.BackendErrorLabel.MLS_INVALID_LEAF_NODE_SIGNATURE]: e => new conversation_1.MLSInvalidLeafNodeSignatureError('Invalid leaf node signature', e.label, e.code),
60
+ [_1.BackendErrorLabel.MLS_INVALID_LEAF_NODE_INDEX]: e => new conversation_1.MLSInvalidLeafNodeIndexError('Invalid leaf node index', e.label, e.code),
62
61
  },
63
62
  [http_status_codes_1.StatusCodes.FORBIDDEN]: {
64
63
  [_1.BackendErrorLabel.INVALID_CREDENTIALS]: e =>
@@ -99,12 +98,6 @@ const messageVariantHandlers = {
99
98
  [MESSAGE_INVALID_CONVERSATION_UUID]: e => new conversation_1.ConversationIsUnknownError('Conversation ID is unknown.', e.label, e.code),
100
99
  [MESSAGE_INVALID_USER_UUID]: e => new user_1.UserIsUnknownError('User ID is unknown.', e.label, e.code),
101
100
  },
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),
104
- },
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),
107
- },
108
101
  },
109
102
  [http_status_codes_1.StatusCodes.FORBIDDEN]: {
110
103
  [_1.BackendErrorLabel.INVALID_CREDENTIALS]: {
@@ -123,16 +116,6 @@ const messageVariantHandlers = {
123
116
  },
124
117
  },
125
118
  };
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
- });
134
- }
135
- }
136
119
  function isMlsGroupOutOfSyncError(error) {
137
120
  return (error.code === http_status_codes_1.StatusCodes.CONFLICT &&
138
121
  error.label === _1.BackendErrorLabel.MLS_GROUP_OUT_OF_SYNC &&
@@ -159,14 +142,18 @@ function mapBackendError(error) {
159
142
  // 1) Message-specific variant
160
143
  const messageVariantHandler = messageVariantHandlers[code]?.[label]?.[message];
161
144
  if (messageVariantHandler) {
162
- return messageVariantHandler({ ...error, label });
145
+ const mapped = messageVariantHandler({ ...error, label });
146
+ logger.info('Mapped backend error with message variant', { error, mapped });
147
+ return mapped;
163
148
  }
164
149
  // 2) Default fallback for this (code,label)
165
150
  const fallbackHandler = defaultHandlers[code]?.[label];
166
151
  if (fallbackHandler) {
167
- return fallbackHandler({ ...error, label });
152
+ const mapped = fallbackHandler({ ...error, label });
153
+ logger.info('Mapped backend error with default handler', { error, mapped });
154
+ return mapped;
168
155
  }
169
156
  // 3) Unknown (code,label) — keep original but log in dev
170
- logUnmapped(error, 'No mapping for code+label (+message)');
157
+ logger.warn('Failed to map backend error; returning original', { error });
171
158
  return error;
172
159
  }
@@ -118,7 +118,7 @@ class UserGroupAPI {
118
118
  async updateChannelsInGroup(gid, body) {
119
119
  const config = {
120
120
  url: `/user-groups/${gid}/channels`,
121
- method: 'post',
121
+ method: 'put',
122
122
  data: body,
123
123
  };
124
124
  await this.client.sendJSON(config);
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.89.1",
74
- "gitHead": "339f094534dc6fd02506beec40c66d60720db49d"
73
+ "version": "27.90.0",
74
+ "gitHead": "ff5b8e2b92e2dca441b28ec37108c8c7be309c7c"
75
75
  }