@checkstack/integration-teams-backend 0.0.22 → 0.0.24

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # @checkstack/integration-teams-backend
2
2
 
3
+ ## 0.0.24
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [26d8bae]
8
+ - @checkstack/backend-api@0.12.0
9
+ - @checkstack/integration-backend@0.1.19
10
+
11
+ ## 0.0.23
12
+
13
+ ### Patch Changes
14
+
15
+ - d1a2796: Enforce stricter code quality standards and eliminate AI slop anti-patterns.
16
+
17
+ **New utility**
18
+
19
+ - `extractErrorMessage(error, fallback?)` in `@checkstack/common` for consistent error extraction
20
+
21
+ **ESLint rules**
22
+
23
+ - `react-hooks/rules-of-hooks` and `exhaustive-deps` for hook correctness
24
+ - `no-console` in frontend packages — forces `toast` over silent `console.error`
25
+ - `no-restricted-syntax` banning `instanceof Error` — forces `extractErrorMessage`
26
+ - Custom `no-eslint-disable-any` rule preventing `@typescript-eslint/no-explicit-any` circumvention
27
+
28
+ **Refactoring**
29
+
30
+ - Replace 141 `instanceof Error` boilerplate patterns across the codebase
31
+ - Replace swallowed `console.error` with user-visible `toast.error()` feedback
32
+ - Remove 15 redundant `as` type casts in IntegrationsPage and ProviderConnectionsPage
33
+ - Consolidate 3 identical callback handlers into `handleDialogClose`
34
+ - Fix conditional React hook call in `FormField.tsx`
35
+ - Fix unstable useMemo deps in `Dashboard.tsx`
36
+ - Replace `useEffect`→`setState` with derived `useMemo` in `RegisterPage.tsx`
37
+ - Rewrite `keystore.test.ts` with typed `DrizzleMockChain` (eliminating 7 `any` suppressions)
38
+ - Delete obvious comments in `encryption.ts` and Teams `provider.ts`
39
+
40
+ - Updated dependencies [d1a2796]
41
+ - @checkstack/common@0.6.5
42
+ - @checkstack/backend-api@0.11.1
43
+ - @checkstack/integration-backend@0.1.18
44
+
3
45
  ## 0.0.22
4
46
 
5
47
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/integration-teams-backend",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "checkstack": {
@@ -12,14 +12,14 @@
12
12
  "lint:code": "eslint . --max-warnings 0"
13
13
  },
14
14
  "dependencies": {
15
- "@checkstack/backend-api": "0.10.0",
16
- "@checkstack/integration-backend": "0.1.15",
17
- "@checkstack/common": "0.6.4",
15
+ "@checkstack/backend-api": "0.11.1",
16
+ "@checkstack/integration-backend": "0.1.18",
17
+ "@checkstack/common": "0.6.5",
18
18
  "zod": "^4.2.1"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/bun": "^1.0.0",
22
22
  "typescript": "^5.0.0",
23
- "@checkstack/tsconfig": "0.0.4"
23
+ "@checkstack/tsconfig": "0.0.5"
24
24
  }
25
25
  }
package/src/provider.ts CHANGED
@@ -8,6 +8,7 @@ import type {
8
8
  ConnectionOption,
9
9
  TestConnectionResult,
10
10
  } from "@checkstack/integration-backend";
11
+ import { extractErrorMessage } from "@checkstack/common";
11
12
 
12
13
  // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
13
14
  // Resolver Names
@@ -124,7 +125,7 @@ async function getAppToken(
124
125
  const data = (await response.json()) as TokenResponse;
125
126
  return { success: true, token: data.access_token };
126
127
  } catch (error) {
127
- const message = error instanceof Error ? error.message : "Unknown error";
128
+ const message = extractErrorMessage(error, "Unknown error");
128
129
  return { success: false, error: message };
129
130
  }
130
131
  }
@@ -149,7 +150,7 @@ async function fetchTeams(
149
150
  const data = (await response.json()) as GraphTeamsResponse;
150
151
  return { success: true, teams: data.value ?? [] };
151
152
  } catch (error) {
152
- const message = error instanceof Error ? error.message : "Unknown error";
153
+ const message = extractErrorMessage(error, "Unknown error");
153
154
  return { success: false, error: message };
154
155
  }
155
156
  }
@@ -176,7 +177,7 @@ async function fetchChannels(
176
177
  const data = (await response.json()) as GraphChannelsResponse;
177
178
  return { success: true, channels: data.value ?? [] };
178
179
  } catch (error) {
179
- const message = error instanceof Error ? error.message : "Unknown error";
180
+ const message = extractErrorMessage(error, "Unknown error");
180
181
  return { success: false, error: message };
181
182
  }
182
183
  }
@@ -297,7 +298,7 @@ For the app to send messages, it must be installed in the target Team:
297
298
  getConnectionWithCredentials,
298
299
  } = params;
299
300
 
300
- // Get connection credentials
301
+
301
302
  const connection = await getConnectionWithCredentials(connectionId);
302
303
  if (!connection) {
303
304
  return [];
@@ -305,7 +306,7 @@ For the app to send messages, it must be installed in the target Team:
305
306
 
306
307
  const config = connection.config as TeamsConnectionConfig;
307
308
 
308
- // Get app token
309
+
309
310
  const tokenResult = await getAppToken(config);
310
311
  if (!tokenResult.success) {
311
312
  return [];
@@ -353,7 +354,7 @@ For the app to send messages, it must be installed in the target Team:
353
354
  };
354
355
  }
355
356
 
356
- // Verify we can list teams
357
+ // Verify Graph API access by listing teams
357
358
  const teamsResult = await fetchTeams(tokenResult.token);
358
359
  if (!teamsResult.success) {
359
360
  return {
@@ -368,7 +369,7 @@ For the app to send messages, it must be installed in the target Team:
368
369
  };
369
370
  } catch (error) {
370
371
  const message =
371
- error instanceof Error ? error.message : "Invalid configuration";
372
+ extractErrorMessage(error, "Invalid configuration");
372
373
  return {
373
374
  success: false,
374
375
  message: `Validation failed: ${message}`,
@@ -381,10 +382,8 @@ For the app to send messages, it must be installed in the target Team:
381
382
  ): Promise<IntegrationDeliveryResult> {
382
383
  const { event, subscription, providerConfig, logger } = context;
383
384
 
384
- // Parse and validate config
385
385
  const config = TeamsSubscriptionSchema.parse(providerConfig);
386
386
 
387
- // Get connection with credentials
388
387
  if (!context.getConnectionWithCredentials) {
389
388
  return {
390
389
  success: false,
@@ -405,7 +404,7 @@ For the app to send messages, it must be installed in the target Team:
405
404
 
406
405
  const connectionConfig = connection.config as TeamsConnectionConfig;
407
406
 
408
- // Get app token
407
+
409
408
  const tokenResult = await getAppToken(connectionConfig);
410
409
  if (!tokenResult.success) {
411
410
  logger.error("Failed to get Graph API token", {
@@ -417,7 +416,7 @@ For the app to send messages, it must be installed in the target Team:
417
416
  };
418
417
  }
419
418
 
420
- // Build Adaptive Card
419
+
421
420
  const adaptiveCard = buildAdaptiveCard({
422
421
  eventId: event.eventId,
423
422
  payload: event.payload as Record<string, unknown>,
@@ -425,7 +424,7 @@ For the app to send messages, it must be installed in the target Team:
425
424
  timestamp: event.timestamp,
426
425
  });
427
426
 
428
- // Send message to channel
427
+
429
428
  try {
430
429
  const response = await fetch(
431
430
  `${GRAPH_API_BASE}/teams/${config.teamId}/channels/${config.channelId}/messages`,
@@ -476,7 +475,7 @@ For the app to send messages, it must be installed in the target Team:
476
475
  };
477
476
  } catch (error) {
478
477
  const message =
479
- error instanceof Error ? error.message : "Unknown Graph API error";
478
+ extractErrorMessage(error, "Unknown Graph API error");
480
479
  logger.error("Teams delivery error", { error: message });
481
480
  return {
482
481
  success: false,