@checkstack/integration-teams-backend 0.0.21 → 0.0.23
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 +42 -0
- package/package.json +4 -4
- package/src/provider.ts +12 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# @checkstack/integration-teams-backend
|
|
2
2
|
|
|
3
|
+
## 0.0.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d1a2796: Enforce stricter code quality standards and eliminate AI slop anti-patterns.
|
|
8
|
+
|
|
9
|
+
**New utility**
|
|
10
|
+
|
|
11
|
+
- `extractErrorMessage(error, fallback?)` in `@checkstack/common` for consistent error extraction
|
|
12
|
+
|
|
13
|
+
**ESLint rules**
|
|
14
|
+
|
|
15
|
+
- `react-hooks/rules-of-hooks` and `exhaustive-deps` for hook correctness
|
|
16
|
+
- `no-console` in frontend packages — forces `toast` over silent `console.error`
|
|
17
|
+
- `no-restricted-syntax` banning `instanceof Error` — forces `extractErrorMessage`
|
|
18
|
+
- Custom `no-eslint-disable-any` rule preventing `@typescript-eslint/no-explicit-any` circumvention
|
|
19
|
+
|
|
20
|
+
**Refactoring**
|
|
21
|
+
|
|
22
|
+
- Replace 141 `instanceof Error` boilerplate patterns across the codebase
|
|
23
|
+
- Replace swallowed `console.error` with user-visible `toast.error()` feedback
|
|
24
|
+
- Remove 15 redundant `as` type casts in IntegrationsPage and ProviderConnectionsPage
|
|
25
|
+
- Consolidate 3 identical callback handlers into `handleDialogClose`
|
|
26
|
+
- Fix conditional React hook call in `FormField.tsx`
|
|
27
|
+
- Fix unstable useMemo deps in `Dashboard.tsx`
|
|
28
|
+
- Replace `useEffect`→`setState` with derived `useMemo` in `RegisterPage.tsx`
|
|
29
|
+
- Rewrite `keystore.test.ts` with typed `DrizzleMockChain` (eliminating 7 `any` suppressions)
|
|
30
|
+
- Delete obvious comments in `encryption.ts` and Teams `provider.ts`
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [d1a2796]
|
|
33
|
+
- @checkstack/common@0.6.5
|
|
34
|
+
- @checkstack/backend-api@0.11.1
|
|
35
|
+
- @checkstack/integration-backend@0.1.18
|
|
36
|
+
|
|
37
|
+
## 0.0.22
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [54a5f80]
|
|
42
|
+
- @checkstack/backend-api@0.11.0
|
|
43
|
+
- @checkstack/integration-backend@0.1.17
|
|
44
|
+
|
|
3
45
|
## 0.0.21
|
|
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.
|
|
3
|
+
"version": "0.0.23",
|
|
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.
|
|
16
|
-
"@checkstack/integration-backend": "0.1.
|
|
15
|
+
"@checkstack/backend-api": "0.11.0",
|
|
16
|
+
"@checkstack/integration-backend": "0.1.17",
|
|
17
17
|
"@checkstack/common": "0.6.4",
|
|
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.
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
478
|
+
extractErrorMessage(error, "Unknown Graph API error");
|
|
480
479
|
logger.error("Teams delivery error", { error: message });
|
|
481
480
|
return {
|
|
482
481
|
success: false,
|