@checkstack/integration-common 0.5.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,64 @@
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
+
3
62
  ## 0.5.0
4
63
 
5
64
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/integration-common",
3
- "version": "0.5.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.10.0",
14
- "@checkstack/signal-common": "0.2.3",
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.2"
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
  });
@@ -3,100 +3,34 @@ import { integrationAccess } from "./access";
3
3
  import { pluginMetadata } from "./plugin-metadata";
4
4
  import {
5
5
  createClientDefinition,
6
- PaginatedResult,
7
- PaginationInput,
8
6
  proc,
9
7
  } from "@checkstack/common";
10
8
  import {
11
- WebhookSubscriptionSchema,
12
- CreateSubscriptionInputSchema,
13
- UpdateSubscriptionInputSchema,
14
- DeliveryLogSchema,
15
- DeliveryLogQueryInputSchema,
16
9
  IntegrationProviderInfoSchema,
17
- IntegrationEventInfoSchema,
18
10
  TestConnectionResultSchema,
19
11
  ProviderConnectionRedactedSchema,
20
12
  CreateConnectionInputSchema,
21
13
  UpdateConnectionInputSchema,
22
14
  GetConnectionOptionsInputSchema,
23
15
  ConnectionOptionSchema,
24
- EventPayloadSchemaOutputSchema,
25
16
  } from "./schemas";
26
17
 
27
- // 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
+ */
28
28
  export const integrationContract = {
29
- // ==========================================================================
30
- // SUBSCRIPTION MANAGEMENT (Admin only)
31
- // ==========================================================================
32
-
33
- /** List all webhook subscriptions */
34
- listSubscriptions: proc({
35
- operationType: "query",
36
- userType: "authenticated",
37
- access: [integrationAccess.manage],
38
- })
39
- .input(
40
- PaginationInput.extend({
41
- providerId: z.string().optional(),
42
- eventType: z.string().optional(),
43
- enabled: z.boolean().optional(),
44
- })
45
- )
46
- .output(PaginatedResult(WebhookSubscriptionSchema)),
47
-
48
- /** Get a single subscription by ID */
49
- getSubscription: proc({
50
- operationType: "query",
51
- userType: "authenticated",
52
- access: [integrationAccess.manage],
53
- })
54
- .input(z.object({ id: z.string() }))
55
- .output(WebhookSubscriptionSchema),
56
-
57
- /** Create a new webhook subscription */
58
- createSubscription: proc({
59
- operationType: "mutation",
60
- userType: "authenticated",
61
- access: [integrationAccess.manage],
62
- })
63
- .input(CreateSubscriptionInputSchema)
64
- .output(WebhookSubscriptionSchema),
65
-
66
- /** Update an existing subscription */
67
- updateSubscription: proc({
68
- operationType: "mutation",
69
- userType: "authenticated",
70
- access: [integrationAccess.manage],
71
- })
72
- .route({ method: "PATCH" })
73
- .input(UpdateSubscriptionInputSchema)
74
- .output(WebhookSubscriptionSchema),
75
-
76
- /** Delete a subscription */
77
- deleteSubscription: proc({
78
- operationType: "mutation",
79
- userType: "authenticated",
80
- access: [integrationAccess.manage],
81
- })
82
- .route({ method: "DELETE" })
83
- .input(z.object({ id: z.string() }))
84
- .output(z.object({ success: z.boolean() })),
85
-
86
- /** Toggle subscription enabled state */
87
- toggleSubscription: proc({
88
- operationType: "mutation",
89
- userType: "authenticated",
90
- access: [integrationAccess.manage],
91
- })
92
- .input(z.object({ id: z.string(), enabled: z.boolean() }))
93
- .output(z.object({ success: z.boolean() })),
94
-
95
29
  // ==========================================================================
96
30
  // PROVIDER DISCOVERY (Admin only)
97
31
  // ==========================================================================
98
32
 
99
- /** List all registered integration providers */
33
+ /** List all registered integration providers (connection-capable plugins) */
100
34
  listProviders: proc({
101
35
  operationType: "query",
102
36
  userType: "authenticated",
@@ -119,7 +53,6 @@ export const integrationContract = {
119
53
 
120
54
  // ==========================================================================
121
55
  // CONNECTION MANAGEMENT (Admin only)
122
- // Generic CRUD for site-wide provider connections
123
56
  // ==========================================================================
124
57
 
125
58
  /** List all connections for a provider */
@@ -188,111 +121,39 @@ export const integrationContract = {
188
121
  .output(z.array(ConnectionOptionSchema)),
189
122
 
190
123
  // ==========================================================================
191
- // 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.
192
132
  // ==========================================================================
193
133
 
194
- /** List all registered integration events */
195
- listEventTypes: proc({
134
+ listLegacySubscriptions: proc({
196
135
  operationType: "query",
197
- userType: "authenticated",
198
- access: [integrationAccess.manage],
199
- }).output(z.array(IntegrationEventInfoSchema)),
200
-
201
- /** Get events grouped by category */
202
- getEventsByCategory: proc({
203
- operationType: "query",
204
- userType: "authenticated",
205
- access: [integrationAccess.manage],
136
+ userType: "service",
137
+ access: [],
206
138
  }).output(
207
139
  z.array(
208
140
  z.object({
209
- category: z.string(),
210
- events: z.array(IntegrationEventInfoSchema),
211
- })
212
- )
213
- ),
214
-
215
- /** Get payload schema for a specific event with flattened property list for template hints */
216
- getEventPayloadSchema: proc({
217
- operationType: "query",
218
- userType: "authenticated",
219
- access: [integrationAccess.manage],
220
- })
221
- .input(z.object({ eventId: z.string() }))
222
- .output(EventPayloadSchemaOutputSchema),
223
-
224
- // ==========================================================================
225
- // DELIVERY LOGS (Admin only)
226
- // ==========================================================================
227
-
228
- /** Get delivery logs with filtering */
229
- getDeliveryLogs: proc({
230
- operationType: "query",
231
- userType: "authenticated",
232
- access: [integrationAccess.manage],
233
- })
234
- .input(DeliveryLogQueryInputSchema)
235
- .output(PaginatedResult(DeliveryLogSchema)),
236
-
237
- /** Get a single delivery log entry */
238
- getDeliveryLog: proc({
239
- operationType: "query",
240
- userType: "authenticated",
241
- access: [integrationAccess.manage],
242
- })
243
- .input(z.object({ id: z.string() }))
244
- .output(DeliveryLogSchema),
245
-
246
- /** Retry a failed delivery */
247
- retryDelivery: proc({
248
- operationType: "mutation",
249
- userType: "authenticated",
250
- access: [integrationAccess.manage],
251
- })
252
- .input(z.object({ logId: z.string() }))
253
- .output(z.object({ success: z.boolean(), message: z.string().optional() })),
254
-
255
- /** Get delivery statistics for dashboard */
256
- getDeliveryStats: proc({
257
- operationType: "query",
258
- userType: "authenticated",
259
- access: [integrationAccess.manage],
260
- })
261
- .input(
262
- z.object({
263
- /** Time range in hours (default: 24) */
264
- hours: z.number().min(1).max(720).default(24),
265
- })
266
- )
267
- .output(
268
- z.object({
269
- total: z.number(),
270
- successful: z.number(),
271
- failed: z.number(),
272
- retrying: z.number(),
273
- pending: z.number(),
274
- byEvent: z.array(
275
- z.object({
276
- eventType: z.string(),
277
- count: z.number(),
278
- })
279
- ),
280
- byProvider: z.array(
281
- z.object({
282
- providerId: z.string(),
283
- count: z.number(),
284
- })
285
- ),
286
- })
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
+ }),
287
150
  ),
151
+ ),
288
152
  };
289
153
 
290
- // Export contract type
291
154
  export type IntegrationContract = typeof integrationContract;
292
155
 
293
- // Export client definition for type-safe forPlugin usage
294
- // Use: const client = rpcApi.forPlugin(IntegrationApi);
295
156
  export const IntegrationApi = createClientDefinition(
296
157
  integrationContract,
297
- pluginMetadata
158
+ pluginMetadata,
298
159
  );