@checkstack/integration-webex-backend 0.0.24 → 0.0.25
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 +19 -0
- package/package.json +3 -3
- package/src/provider.test.ts +9 -9
- package/src/provider.ts +12 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @checkstack/integration-webex-backend
|
|
2
2
|
|
|
3
|
+
## 0.0.25
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8d1ef12: ## Downstream consumer bumps for the anomaly detection + cache system rollout
|
|
8
|
+
|
|
9
|
+
Packages on this branch were updated as part of the anomaly detection feature (schema annotations on result fields, plugin metadata for the modular cache system) but were not listed in the upstream changesets.
|
|
10
|
+
|
|
11
|
+
- **`@checkstack/healthcheck-common`** (minor) — new RPC contract additions and schema changes supporting per-field anomaly metadata.
|
|
12
|
+
- **`@checkstack/cache-memory-common`** (minor) — new package providing access rules + plugin metadata for the in-memory cache backend.
|
|
13
|
+
- **healthcheck plugins** (patch) — adopt the new `x-anomaly-*` schema annotations on their result fields so anomaly detection works automatically against their checks. No public API changes.
|
|
14
|
+
- **integration / notification / auth / queue / collector plugins** (patch) — minor internal updates as consumers of upstream API changes (cache plugin registry, schema additions). No public API changes.
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [8d1ef12]
|
|
17
|
+
- Updated dependencies [8d1ef12]
|
|
18
|
+
- @checkstack/common@0.7.0
|
|
19
|
+
- @checkstack/backend-api@0.13.0
|
|
20
|
+
- @checkstack/integration-backend@0.1.20
|
|
21
|
+
|
|
3
22
|
## 0.0.24
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/integration-webex-backend",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"checkstack": {
|
|
@@ -12,8 +12,8 @@
|
|
|
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.12.0",
|
|
16
|
+
"@checkstack/integration-backend": "0.1.19",
|
|
17
17
|
"@checkstack/common": "0.6.5",
|
|
18
18
|
"zod": "^4.2.1"
|
|
19
19
|
},
|
package/src/provider.test.ts
CHANGED
|
@@ -116,9 +116,9 @@ describe("Webex Integration Provider", () => {
|
|
|
116
116
|
(async () => {
|
|
117
117
|
return new Response(
|
|
118
118
|
JSON.stringify({ id: "bot-123", displayName: "Test Bot" }),
|
|
119
|
-
{ status: 200 }
|
|
119
|
+
{ status: 200 },
|
|
120
120
|
);
|
|
121
|
-
}) as unknown as typeof fetch
|
|
121
|
+
}) as unknown as typeof fetch,
|
|
122
122
|
);
|
|
123
123
|
|
|
124
124
|
try {
|
|
@@ -137,7 +137,7 @@ describe("Webex Integration Provider", () => {
|
|
|
137
137
|
const mockFetch = spyOn(globalThis, "fetch").mockImplementation(
|
|
138
138
|
(async () => {
|
|
139
139
|
return new Response("Unauthorized", { status: 401 });
|
|
140
|
-
}) as unknown as typeof fetch
|
|
140
|
+
}) as unknown as typeof fetch,
|
|
141
141
|
);
|
|
142
142
|
|
|
143
143
|
try {
|
|
@@ -157,7 +157,7 @@ describe("Webex Integration Provider", () => {
|
|
|
157
157
|
const mockFetch = spyOn(globalThis, "fetch").mockImplementation(
|
|
158
158
|
(async () => {
|
|
159
159
|
throw new TypeError("fetch failed");
|
|
160
|
-
}) as unknown as typeof fetch
|
|
160
|
+
}) as unknown as typeof fetch,
|
|
161
161
|
);
|
|
162
162
|
|
|
163
163
|
try {
|
|
@@ -188,9 +188,9 @@ describe("Webex Integration Provider", () => {
|
|
|
188
188
|
{ id: "room-2", title: "DevOps", type: "group" },
|
|
189
189
|
],
|
|
190
190
|
}),
|
|
191
|
-
{ status: 200 }
|
|
191
|
+
{ status: 200 },
|
|
192
192
|
);
|
|
193
|
-
}) as unknown as typeof fetch
|
|
193
|
+
}) as unknown as typeof fetch,
|
|
194
194
|
);
|
|
195
195
|
|
|
196
196
|
try {
|
|
@@ -249,7 +249,7 @@ describe("Webex Integration Provider", () => {
|
|
|
249
249
|
|
|
250
250
|
const mockFetch = spyOn(globalThis, "fetch").mockImplementation((async (
|
|
251
251
|
_url: RequestInfo | URL,
|
|
252
|
-
options?: RequestInit
|
|
252
|
+
options?: RequestInit,
|
|
253
253
|
) => {
|
|
254
254
|
capturedBody = options?.body as string;
|
|
255
255
|
return new Response(JSON.stringify({ id: "msg-456" }), {
|
|
@@ -296,7 +296,7 @@ describe("Webex Integration Provider", () => {
|
|
|
296
296
|
|
|
297
297
|
const mockFetch = spyOn(globalThis, "fetch").mockImplementation((async (
|
|
298
298
|
_url: RequestInfo | URL,
|
|
299
|
-
options?: RequestInit
|
|
299
|
+
options?: RequestInit,
|
|
300
300
|
) => {
|
|
301
301
|
capturedBody = options?.body as string;
|
|
302
302
|
return new Response(JSON.stringify({ id: "msg-456" }), {
|
|
@@ -331,7 +331,7 @@ describe("Webex Integration Provider", () => {
|
|
|
331
331
|
|
|
332
332
|
const parsedBody = JSON.parse(capturedBody!);
|
|
333
333
|
expect(parsedBody.markdown).toBe(
|
|
334
|
-
"🚨 **Server Down** - Incident inc-123"
|
|
334
|
+
"🚨 **Server Down** - Incident inc-123",
|
|
335
335
|
);
|
|
336
336
|
} finally {
|
|
337
337
|
mockFetch.mockRestore();
|
package/src/provider.ts
CHANGED
|
@@ -27,7 +27,7 @@ const WEBEX_RESOLVERS = {
|
|
|
27
27
|
*/
|
|
28
28
|
export const WebexConnectionSchema = z.object({
|
|
29
29
|
botToken: configString({ "x-secret": true }).describe(
|
|
30
|
-
"Webex Bot Access Token from developer.webex.com"
|
|
30
|
+
"Webex Bot Access Token from developer.webex.com",
|
|
31
31
|
),
|
|
32
32
|
});
|
|
33
33
|
|
|
@@ -46,7 +46,7 @@ export const WebexSubscriptionSchema = z.object({
|
|
|
46
46
|
.string()
|
|
47
47
|
.optional()
|
|
48
48
|
.describe(
|
|
49
|
-
"Message template (supports {{event.payload.*}} placeholders). Leave empty for default format."
|
|
49
|
+
"Message template (supports {{event.payload.*}} placeholders). Leave empty for default format.",
|
|
50
50
|
),
|
|
51
51
|
});
|
|
52
52
|
|
|
@@ -78,7 +78,7 @@ interface WebexMessageResponse {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
async function fetchWebexRooms(
|
|
81
|
-
botToken: string
|
|
81
|
+
botToken: string,
|
|
82
82
|
): Promise<
|
|
83
83
|
{ success: true; rooms: WebexRoom[] } | { success: false; error: string }
|
|
84
84
|
> {
|
|
@@ -129,7 +129,7 @@ async function sendWebexMessage(params: {
|
|
|
129
129
|
success: false,
|
|
130
130
|
error: `Webex API error (${response.status}): ${errorText.slice(
|
|
131
131
|
0,
|
|
132
|
-
200
|
|
132
|
+
200,
|
|
133
133
|
)}`,
|
|
134
134
|
};
|
|
135
135
|
}
|
|
@@ -143,7 +143,7 @@ async function sendWebexMessage(params: {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
async function testWebexConnection(
|
|
146
|
-
botToken: string
|
|
146
|
+
botToken: string,
|
|
147
147
|
): Promise<
|
|
148
148
|
{ success: true; botName: string } | { success: false; error: string }
|
|
149
149
|
> {
|
|
@@ -173,7 +173,7 @@ async function testWebexConnection(
|
|
|
173
173
|
|
|
174
174
|
function expandTemplate(
|
|
175
175
|
template: string,
|
|
176
|
-
context: Record<string, unknown
|
|
176
|
+
context: Record<string, unknown>,
|
|
177
177
|
): string {
|
|
178
178
|
return template.replaceAll(/\{\{([^}]+)\}\}/g, (_match, path: string) => {
|
|
179
179
|
const trimmedPath = path.trim();
|
|
@@ -198,7 +198,7 @@ function expandTemplate(
|
|
|
198
198
|
function buildDefaultMessage(
|
|
199
199
|
eventId: string,
|
|
200
200
|
payload: Record<string, unknown>,
|
|
201
|
-
subscriptionName: string
|
|
201
|
+
subscriptionName: string,
|
|
202
202
|
): string {
|
|
203
203
|
const lines: string[] = [
|
|
204
204
|
`📢 **Integration Event**`,
|
|
@@ -256,7 +256,7 @@ export const webexProvider: IntegrationProvider<
|
|
|
256
256
|
},
|
|
257
257
|
|
|
258
258
|
async getConnectionOptions(
|
|
259
|
-
params: GetConnectionOptionsParams
|
|
259
|
+
params: GetConnectionOptionsParams,
|
|
260
260
|
): Promise<ConnectionOption[]> {
|
|
261
261
|
const { resolverName, connectionId, getConnectionWithCredentials } = params;
|
|
262
262
|
|
|
@@ -298,8 +298,7 @@ export const webexProvider: IntegrationProvider<
|
|
|
298
298
|
message: `Connection failed: ${result.error}`,
|
|
299
299
|
};
|
|
300
300
|
} catch (error) {
|
|
301
|
-
const message =
|
|
302
|
-
extractErrorMessage(error, "Invalid configuration");
|
|
301
|
+
const message = extractErrorMessage(error, "Invalid configuration");
|
|
303
302
|
return {
|
|
304
303
|
success: false,
|
|
305
304
|
message: `Validation failed: ${message}`,
|
|
@@ -308,7 +307,7 @@ export const webexProvider: IntegrationProvider<
|
|
|
308
307
|
},
|
|
309
308
|
|
|
310
309
|
async deliver(
|
|
311
|
-
context: IntegrationDeliveryContext<WebexSubscriptionConfig
|
|
310
|
+
context: IntegrationDeliveryContext<WebexSubscriptionConfig>,
|
|
312
311
|
): Promise<IntegrationDeliveryResult> {
|
|
313
312
|
const { event, subscription, providerConfig, logger } = context;
|
|
314
313
|
|
|
@@ -324,7 +323,7 @@ export const webexProvider: IntegrationProvider<
|
|
|
324
323
|
}
|
|
325
324
|
|
|
326
325
|
const connection = await context.getConnectionWithCredentials(
|
|
327
|
-
config.connectionId
|
|
326
|
+
config.connectionId,
|
|
328
327
|
);
|
|
329
328
|
|
|
330
329
|
if (!connection) {
|
|
@@ -356,7 +355,7 @@ export const webexProvider: IntegrationProvider<
|
|
|
356
355
|
markdown = buildDefaultMessage(
|
|
357
356
|
event.eventId,
|
|
358
357
|
event.payload as Record<string, unknown>,
|
|
359
|
-
subscription.name
|
|
358
|
+
subscription.name,
|
|
360
359
|
);
|
|
361
360
|
}
|
|
362
361
|
|