@checkstack/integration-common 0.4.0 → 0.6.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,115 @@
1
1
  # @checkstack/integration-common
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 41c77f4: feat(automation): one-time migration of webhook subscriptions + remove legacy integration backend
8
+
9
+ **BREAKING CHANGES** (platform is in BETA — no major bump):
10
+
11
+ - `IntegrationProvider` no longer carries `config` (subscription
12
+ config) or `deliver`. The interface now models a connection provider
13
+ only: connection schema + `getConnectionOptions` + `testConnection`.
14
+ - The legacy subscription / delivery-log / event endpoints
15
+ (`listSubscriptions`, `createSubscription`, `getDeliveryLogs`,
16
+ `listEventTypes`, …) are removed from `integrationContract`.
17
+ - `delivery-coordinator`, `hook-subscriber`, `event-registry`, and the
18
+ `integrationEventExtensionPoint` are deleted. Plugins that
19
+ previously called `integrationEvents.registerEvent(...)` now
20
+ register their hooks as automation triggers via
21
+ `automationTriggerExtensionPoint.registerTrigger(...)`.
22
+ - Frontend pages `IntegrationsPage` and `DeliveryLogsPage` are gone;
23
+ the integration plugin's only remaining UI is connection
24
+ management. Subscription management lives under `/automation/...`.
25
+ - `webhook_subscriptions` and `delivery_logs` tables stay in the
26
+ database for one release as a safety net (no code reads or writes
27
+ them), and will be dropped in a follow-up migration.
28
+
29
+ **New**:
30
+
31
+ - `jira.create_issue`, `teams.post_message`, `webex.post_message`,
32
+ `webhook.send`, `integration-script.run_shell`, and
33
+ `integration-script.run_script` actions registered against the
34
+ Automation Platform with matching `*.message`, `*.delivery`,
35
+ `shell.result`, and `script.result` artifact types. The script
36
+ plugin exposes **two** actions — `run_shell` runs bash via the
37
+ shared `ShellScriptRunner` (Monaco `shell` editor), `run_script`
38
+ runs an ESM module in a Bun subprocess via `EsmScriptRunner`
39
+ (Monaco `typescript` editor + `defineIntegration` helper) — to
40
+ preserve the legacy provider split. `jira.create_issue` keeps the
41
+ dynamic field-mapping dropdown (driven by
42
+ `JIRA_RESOLVERS.FIELD_OPTIONS`).
43
+ - One-time data migration runs on boot in
44
+ `automation-backend.afterPluginsReady`. It reads
45
+ `webhook_subscriptions` via a new service RPC
46
+ `IntegrationApi.listLegacySubscriptions`, translates each row into
47
+ a single-trigger / single-action automation (marked with
48
+ `managed_by = "migrated-subscription:<id>"`), and is idempotent
49
+ across restarts.
50
+ - Failed translations are recorded in a new
51
+ `automation_migration_failures` table and surfaced via
52
+ `AutomationApi.listMigrationFailures` /
53
+ `acknowledgeMigrationFailure` so admins can review and re-create
54
+ failed entries by hand.
55
+
56
+ ### Patch Changes
57
+
58
+ - Updated dependencies [6d52276]
59
+ - @checkstack/common@0.12.0
60
+ - @checkstack/signal-common@0.2.5
61
+
62
+ ## 0.5.0
63
+
64
+ ### Minor Changes
65
+
66
+ - f23f3c9: Sweep every paginated `*-common` contract onto the canonical
67
+ `PaginationInput` / `PaginatedResult` from `@checkstack/common` and
68
+ remove the now-unused legacy exports.
69
+
70
+ **BREAKING CHANGE** - `@checkstack/common` drops the deprecated
71
+ `PaginationInputSchema`, `paginatedOutput`, and `PaginatedResponse`
72
+ symbols. Callers must consume `PaginationInput` (input) and
73
+ `PaginatedResult(itemSchema)` (output) instead. The canonical input is
74
+ `{ limit (1-100, default 20), offset (>= 0, default 0) }`; the
75
+ canonical output envelope is
76
+ `{ items, total, limit, offset }`.
77
+
78
+ **BREAKING CHANGE** - `@checkstack/notification-common` migrates
79
+ `getNotifications` off the legacy `PaginationInputSchema`
80
+ (`{ limit, offset, unreadOnly }` with output `{ notifications, total }`)
81
+ onto `ListNotificationsInputSchema =
82
+ PaginationInput.extend({ unreadOnly })` and
83
+ `PaginatedResult(NotificationSchema)`. The output key changes from
84
+ `notifications` to `items`, and `limit` / `offset` are now echoed on
85
+ the response. The `PaginationInput` type alias previously exported
86
+ from `notification-common` is removed - use `ListNotificationsInput`
87
+ or the canonical `PaginationInput` from `@checkstack/common`.
88
+
89
+ **BREAKING CHANGE** - `@checkstack/integration-common` migrates
90
+ `listSubscriptions` (inline `{ page, pageSize, ... }` -> output
91
+ `{ subscriptions, total }`) and `getDeliveryLogs` (via
92
+ `DeliveryLogQueryInputSchema` `{ subscriptionId?, eventType?, status?,
93
+ page, pageSize }` -> output `{ logs, total }`) onto the canonical
94
+ `PaginationInput.extend({...})` input and
95
+ `PaginatedResult(itemSchema)` output. External callers must switch
96
+ from `{ page, pageSize }` to `{ limit, offset }` and read response
97
+ items from `data.items` (no more `data.subscriptions` / `data.logs`).
98
+
99
+ The matching `*-backend` handlers were updated to consume the new
100
+ input shape (`offset` arithmetic in lieu of `(page - 1) * pageSize`)
101
+ and to echo `limit` / `offset` on the response. The `*-frontend` call
102
+ sites in `NotificationsPage`, `NotificationBell`, `IntegrationsPage`,
103
+ and `DeliveryLogsPage` were updated to send the new input shape and
104
+ read `data.items`.
105
+
106
+ ### Patch Changes
107
+
108
+ - Updated dependencies [f23f3c9]
109
+ - Updated dependencies [f23f3c9]
110
+ - @checkstack/common@0.11.0
111
+ - @checkstack/signal-common@0.2.4
112
+
3
113
  ## 0.4.0
4
114
 
5
115
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/integration-common",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "license": "Elastic-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -10,15 +10,15 @@
10
10
  }
11
11
  },
12
12
  "dependencies": {
13
- "@checkstack/common": "0.9.0",
14
- "@checkstack/signal-common": "0.2.2",
13
+ "@checkstack/common": "0.11.0",
14
+ "@checkstack/signal-common": "0.2.4",
15
15
  "@orpc/contract": "^1.13.14",
16
16
  "zod": "^4.0.0"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@checkstack/tsconfig": "0.0.7",
20
20
  "typescript": "^5.7.2",
21
- "@checkstack/scripts": "0.3.1"
21
+ "@checkstack/scripts": "0.3.3"
22
22
  },
23
23
  "scripts": {
24
24
  "typecheck": "tsgo -b",
package/src/routes.ts CHANGED
@@ -2,14 +2,14 @@ import { createRoutes } from "@checkstack/common";
2
2
 
3
3
  /**
4
4
  * Route definitions for the integration plugin.
5
+ *
6
+ * The legacy subscription list / delivery log routes were removed when
7
+ * the platform moved to the Automation Platform model. The remaining
8
+ * surface is the per-provider connection management page.
5
9
  */
6
10
  export const integrationRoutes = createRoutes("integration", {
7
- /** Main integrations management page */
11
+ /** Main connections landing page */
8
12
  list: "/",
9
- /** Delivery logs page (all logs) */
10
- logs: "/logs",
11
- /** Delivery logs filtered by subscription */
12
- deliveryLogs: "/logs/:subscriptionId",
13
13
  /** Provider connections management */
14
14
  connections: "/connections/:providerId",
15
15
  });
@@ -1,104 +1,36 @@
1
1
  import { z } from "zod";
2
2
  import { integrationAccess } from "./access";
3
3
  import { pluginMetadata } from "./plugin-metadata";
4
- import { createClientDefinition, proc } from "@checkstack/common";
5
4
  import {
6
- WebhookSubscriptionSchema,
7
- CreateSubscriptionInputSchema,
8
- UpdateSubscriptionInputSchema,
9
- DeliveryLogSchema,
10
- DeliveryLogQueryInputSchema,
5
+ createClientDefinition,
6
+ proc,
7
+ } from "@checkstack/common";
8
+ import {
11
9
  IntegrationProviderInfoSchema,
12
- IntegrationEventInfoSchema,
13
10
  TestConnectionResultSchema,
14
11
  ProviderConnectionRedactedSchema,
15
12
  CreateConnectionInputSchema,
16
13
  UpdateConnectionInputSchema,
17
14
  GetConnectionOptionsInputSchema,
18
15
  ConnectionOptionSchema,
19
- EventPayloadSchemaOutputSchema,
20
16
  } from "./schemas";
21
17
 
22
- // Integration RPC Contract
18
+ /**
19
+ * Integration RPC contract — scoped to connection management.
20
+ *
21
+ * The legacy subscription + delivery-log + event-listing endpoints
22
+ * moved to the Automation Platform; existing subscriptions are
23
+ * auto-migrated on boot (see `@checkstack/automation-backend`'s
24
+ * migration module). All remaining endpoints relate to the connection
25
+ * store, which the Automation editor uses to pick a connection for
26
+ * provider-bound actions.
27
+ */
23
28
  export const integrationContract = {
24
- // ==========================================================================
25
- // SUBSCRIPTION MANAGEMENT (Admin only)
26
- // ==========================================================================
27
-
28
- /** List all webhook subscriptions */
29
- listSubscriptions: proc({
30
- operationType: "query",
31
- userType: "authenticated",
32
- access: [integrationAccess.manage],
33
- })
34
- .input(
35
- z.object({
36
- page: z.number().min(1).default(1),
37
- pageSize: z.number().min(1).max(100).default(20),
38
- providerId: z.string().optional(),
39
- eventType: z.string().optional(),
40
- enabled: z.boolean().optional(),
41
- })
42
- )
43
- .output(
44
- z.object({
45
- subscriptions: z.array(WebhookSubscriptionSchema),
46
- total: z.number(),
47
- })
48
- ),
49
-
50
- /** Get a single subscription by ID */
51
- getSubscription: proc({
52
- operationType: "query",
53
- userType: "authenticated",
54
- access: [integrationAccess.manage],
55
- })
56
- .input(z.object({ id: z.string() }))
57
- .output(WebhookSubscriptionSchema),
58
-
59
- /** Create a new webhook subscription */
60
- createSubscription: proc({
61
- operationType: "mutation",
62
- userType: "authenticated",
63
- access: [integrationAccess.manage],
64
- })
65
- .input(CreateSubscriptionInputSchema)
66
- .output(WebhookSubscriptionSchema),
67
-
68
- /** Update an existing subscription */
69
- updateSubscription: proc({
70
- operationType: "mutation",
71
- userType: "authenticated",
72
- access: [integrationAccess.manage],
73
- })
74
- .route({ method: "PATCH" })
75
- .input(UpdateSubscriptionInputSchema)
76
- .output(WebhookSubscriptionSchema),
77
-
78
- /** Delete a subscription */
79
- deleteSubscription: proc({
80
- operationType: "mutation",
81
- userType: "authenticated",
82
- access: [integrationAccess.manage],
83
- })
84
- .route({ method: "DELETE" })
85
- .input(z.object({ id: z.string() }))
86
- .output(z.object({ success: z.boolean() })),
87
-
88
- /** Toggle subscription enabled state */
89
- toggleSubscription: proc({
90
- operationType: "mutation",
91
- userType: "authenticated",
92
- access: [integrationAccess.manage],
93
- })
94
- .input(z.object({ id: z.string(), enabled: z.boolean() }))
95
- .output(z.object({ success: z.boolean() })),
96
-
97
29
  // ==========================================================================
98
30
  // PROVIDER DISCOVERY (Admin only)
99
31
  // ==========================================================================
100
32
 
101
- /** List all registered integration providers */
33
+ /** List all registered integration providers (connection-capable plugins) */
102
34
  listProviders: proc({
103
35
  operationType: "query",
104
36
  userType: "authenticated",
@@ -121,7 +53,6 @@ export const integrationContract = {
121
53
 
122
54
  // ==========================================================================
123
55
  // CONNECTION MANAGEMENT (Admin only)
124
- // Generic CRUD for site-wide provider connections
125
56
  // ==========================================================================
126
57
 
127
58
  /** List all connections for a provider */
@@ -190,116 +121,39 @@ export const integrationContract = {
190
121
  .output(z.array(ConnectionOptionSchema)),
191
122
 
192
123
  // ==========================================================================
193
- // EVENT DISCOVERY (Admin only)
124
+ // ONE-TIME MIGRATION SUPPORT (service-to-service)
125
+ //
126
+ // Exposed so `@checkstack/automation-backend` can read the legacy
127
+ // `webhook_subscriptions` rows during boot and translate them into
128
+ // automations. Plugins are sandboxed to their own schema, so this is
129
+ // the only way to reach the legacy table from another plugin.
130
+ // Once the legacy table is dropped in a follow-up release these
131
+ // endpoints will be removed.
194
132
  // ==========================================================================
195
133
 
196
- /** List all registered integration events */
197
- listEventTypes: proc({
134
+ listLegacySubscriptions: proc({
198
135
  operationType: "query",
199
- userType: "authenticated",
200
- access: [integrationAccess.manage],
201
- }).output(z.array(IntegrationEventInfoSchema)),
202
-
203
- /** Get events grouped by category */
204
- getEventsByCategory: proc({
205
- operationType: "query",
206
- userType: "authenticated",
207
- access: [integrationAccess.manage],
136
+ userType: "service",
137
+ access: [],
208
138
  }).output(
209
139
  z.array(
210
140
  z.object({
211
- category: z.string(),
212
- events: z.array(IntegrationEventInfoSchema),
213
- })
214
- )
215
- ),
216
-
217
- /** Get payload schema for a specific event with flattened property list for template hints */
218
- getEventPayloadSchema: proc({
219
- operationType: "query",
220
- userType: "authenticated",
221
- access: [integrationAccess.manage],
222
- })
223
- .input(z.object({ eventId: z.string() }))
224
- .output(EventPayloadSchemaOutputSchema),
225
-
226
- // ==========================================================================
227
- // DELIVERY LOGS (Admin only)
228
- // ==========================================================================
229
-
230
- /** Get delivery logs with filtering */
231
- getDeliveryLogs: proc({
232
- operationType: "query",
233
- userType: "authenticated",
234
- access: [integrationAccess.manage],
235
- })
236
- .input(DeliveryLogQueryInputSchema)
237
- .output(
238
- z.object({
239
- logs: z.array(DeliveryLogSchema),
240
- total: z.number(),
241
- })
242
- ),
243
-
244
- /** Get a single delivery log entry */
245
- getDeliveryLog: proc({
246
- operationType: "query",
247
- userType: "authenticated",
248
- access: [integrationAccess.manage],
249
- })
250
- .input(z.object({ id: z.string() }))
251
- .output(DeliveryLogSchema),
252
-
253
- /** Retry a failed delivery */
254
- retryDelivery: proc({
255
- operationType: "mutation",
256
- userType: "authenticated",
257
- access: [integrationAccess.manage],
258
- })
259
- .input(z.object({ logId: z.string() }))
260
- .output(z.object({ success: z.boolean(), message: z.string().optional() })),
261
-
262
- /** Get delivery statistics for dashboard */
263
- getDeliveryStats: proc({
264
- operationType: "query",
265
- userType: "authenticated",
266
- access: [integrationAccess.manage],
267
- })
268
- .input(
269
- z.object({
270
- /** Time range in hours (default: 24) */
271
- hours: z.number().min(1).max(720).default(24),
272
- })
273
- )
274
- .output(
275
- z.object({
276
- total: z.number(),
277
- successful: z.number(),
278
- failed: z.number(),
279
- retrying: z.number(),
280
- pending: z.number(),
281
- byEvent: z.array(
282
- z.object({
283
- eventType: z.string(),
284
- count: z.number(),
285
- })
286
- ),
287
- byProvider: z.array(
288
- z.object({
289
- providerId: z.string(),
290
- count: z.number(),
291
- })
292
- ),
293
- })
141
+ id: z.string(),
142
+ name: z.string(),
143
+ description: z.string().optional(),
144
+ providerId: z.string(),
145
+ providerConfig: z.record(z.string(), z.unknown()),
146
+ eventId: z.string(),
147
+ systemFilter: z.array(z.string()).optional(),
148
+ enabled: z.boolean(),
149
+ }),
294
150
  ),
151
+ ),
295
152
  };
296
153
 
297
- // Export contract type
298
154
  export type IntegrationContract = typeof integrationContract;
299
155
 
300
- // Export client definition for type-safe forPlugin usage
301
- // Use: const client = rpcApi.forPlugin(IntegrationApi);
302
156
  export const IntegrationApi = createClientDefinition(
303
157
  integrationContract,
304
- pluginMetadata
158
+ pluginMetadata,
305
159
  );
package/src/schemas.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { PaginationInput } from "@checkstack/common";
2
3
 
3
4
  // =============================================================================
4
5
  // Webhook Subscription Schemas
@@ -95,12 +96,10 @@ export const DeliveryLogSchema = z.object({
95
96
  export type DeliveryLog = z.infer<typeof DeliveryLogSchema>;
96
97
 
97
98
  /** Input for querying delivery logs */
98
- export const DeliveryLogQueryInputSchema = z.object({
99
+ export const DeliveryLogQueryInputSchema = PaginationInput.extend({
99
100
  subscriptionId: z.string().optional(),
100
101
  eventType: z.string().optional(),
101
102
  status: DeliveryStatusSchema.optional(),
102
- page: z.number().min(1).default(1),
103
- pageSize: z.number().min(1).max(100).default(20),
104
103
  });
105
104
  export type DeliveryLogQueryInput = z.infer<typeof DeliveryLogQueryInputSchema>;
106
105