@checkstack/integration-common 0.3.2 → 0.5.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 +109 -0
- package/package.json +4 -4
- package/src/rpc-contract.ts +13 -16
- package/src/schemas.ts +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,114 @@
|
|
|
1
1
|
# @checkstack/integration-common
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f23f3c9: Sweep every paginated `*-common` contract onto the canonical
|
|
8
|
+
`PaginationInput` / `PaginatedResult` from `@checkstack/common` and
|
|
9
|
+
remove the now-unused legacy exports.
|
|
10
|
+
|
|
11
|
+
**BREAKING CHANGE** - `@checkstack/common` drops the deprecated
|
|
12
|
+
`PaginationInputSchema`, `paginatedOutput`, and `PaginatedResponse`
|
|
13
|
+
symbols. Callers must consume `PaginationInput` (input) and
|
|
14
|
+
`PaginatedResult(itemSchema)` (output) instead. The canonical input is
|
|
15
|
+
`{ limit (1-100, default 20), offset (>= 0, default 0) }`; the
|
|
16
|
+
canonical output envelope is
|
|
17
|
+
`{ items, total, limit, offset }`.
|
|
18
|
+
|
|
19
|
+
**BREAKING CHANGE** - `@checkstack/notification-common` migrates
|
|
20
|
+
`getNotifications` off the legacy `PaginationInputSchema`
|
|
21
|
+
(`{ limit, offset, unreadOnly }` with output `{ notifications, total }`)
|
|
22
|
+
onto `ListNotificationsInputSchema =
|
|
23
|
+
PaginationInput.extend({ unreadOnly })` and
|
|
24
|
+
`PaginatedResult(NotificationSchema)`. The output key changes from
|
|
25
|
+
`notifications` to `items`, and `limit` / `offset` are now echoed on
|
|
26
|
+
the response. The `PaginationInput` type alias previously exported
|
|
27
|
+
from `notification-common` is removed - use `ListNotificationsInput`
|
|
28
|
+
or the canonical `PaginationInput` from `@checkstack/common`.
|
|
29
|
+
|
|
30
|
+
**BREAKING CHANGE** - `@checkstack/integration-common` migrates
|
|
31
|
+
`listSubscriptions` (inline `{ page, pageSize, ... }` -> output
|
|
32
|
+
`{ subscriptions, total }`) and `getDeliveryLogs` (via
|
|
33
|
+
`DeliveryLogQueryInputSchema` `{ subscriptionId?, eventType?, status?,
|
|
34
|
+
page, pageSize }` -> output `{ logs, total }`) onto the canonical
|
|
35
|
+
`PaginationInput.extend({...})` input and
|
|
36
|
+
`PaginatedResult(itemSchema)` output. External callers must switch
|
|
37
|
+
from `{ page, pageSize }` to `{ limit, offset }` and read response
|
|
38
|
+
items from `data.items` (no more `data.subscriptions` / `data.logs`).
|
|
39
|
+
|
|
40
|
+
The matching `*-backend` handlers were updated to consume the new
|
|
41
|
+
input shape (`offset` arithmetic in lieu of `(page - 1) * pageSize`)
|
|
42
|
+
and to echo `limit` / `offset` on the response. The `*-frontend` call
|
|
43
|
+
sites in `NotificationsPage`, `NotificationBell`, `IntegrationsPage`,
|
|
44
|
+
and `DeliveryLogsPage` were updated to send the new input shape and
|
|
45
|
+
read `data.items`.
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [f23f3c9]
|
|
50
|
+
- Updated dependencies [f23f3c9]
|
|
51
|
+
- @checkstack/common@0.11.0
|
|
52
|
+
- @checkstack/signal-common@0.2.4
|
|
53
|
+
|
|
54
|
+
## 0.4.0
|
|
55
|
+
|
|
56
|
+
### Minor Changes
|
|
57
|
+
|
|
58
|
+
- 9016526: Add a `/rest/:pluginId/*` HTTP mount that serves every plugin's oRPC contract
|
|
59
|
+
through the REST/OpenAPI shape described by `/api/openapi.json`. Queries are
|
|
60
|
+
`GET` with query parameters, mutations are `POST` with the input as the raw
|
|
61
|
+
JSON body. The existing `/api/:pluginId/*` mount continues to serve oRPC's
|
|
62
|
+
native wire protocol unchanged, so existing clients are not affected.
|
|
63
|
+
|
|
64
|
+
The OpenAPI spec at `/api/openapi.json` now reflects the real mount: every
|
|
65
|
+
`paths` entry is prefixed with `/rest` instead of `/api`.
|
|
66
|
+
|
|
67
|
+
Also fixes a SPA-fallback bug: the backend's `/api-docs` route previously
|
|
68
|
+
returned 404 on production deployments because the static-file middleware
|
|
69
|
+
skipped any path starting with `/api`, capturing `/api-docs` along with real
|
|
70
|
+
API routes. The skip now requires a trailing slash (`/api/`, `/rest/`).
|
|
71
|
+
|
|
72
|
+
Required access rules are now visible in the API Docs UI. The OpenAPI spec
|
|
73
|
+
generator was reading a non-existent `accessRules` field on procedure
|
|
74
|
+
metadata; the real field is `access: AccessRule[]`. Each procedure's access
|
|
75
|
+
rules are now flattened to fully-qualified IDs (e.g. `catalog.system.read`)
|
|
76
|
+
and emitted under `x-orpc-meta.accessRules`, which the existing
|
|
77
|
+
`Required Access Rules` section in the docs UI already knew how to render.
|
|
78
|
+
|
|
79
|
+
The API Docs schema renderer now handles record types (zod `z.record`),
|
|
80
|
+
`$ref`s into `components.schemas`, `oneOf`/`anyOf`/`allOf`, nullable union
|
|
81
|
+
types (`type: ["string", "null"]`), and `format` qualifiers. Previously
|
|
82
|
+
record outputs like `{ statuses: object }` masked the actual value type;
|
|
83
|
+
they now render as `{ [key]: <ResolvedType> { ... } }` with the inner
|
|
84
|
+
schema expanded, capped at 12 levels with cycle detection.
|
|
85
|
+
|
|
86
|
+
**REST method conventions.** `proc()` now defaults to `GET` for queries and
|
|
87
|
+
`POST` for mutations on the `/rest` mount, using bracket-notation query
|
|
88
|
+
params (`?filter[status]=active&ids[0]=a`) for GET inputs. Existing
|
|
89
|
+
procedures were updated to follow REST semantics:
|
|
90
|
+
|
|
91
|
+
- `update*` mutations → `PATCH`
|
|
92
|
+
- `delete*` / `remove*` mutations → `DELETE`
|
|
93
|
+
- `getBulk*` queries and any query taking a large array input → `POST`
|
|
94
|
+
(because `@orpc/openapi@1.13.x` has no GET→POST URL-length fallback)
|
|
95
|
+
|
|
96
|
+
GET endpoints require an `object` input — bare scalars like
|
|
97
|
+
`.input(z.string())` are not valid on GET. `getSystemConfigurations` was
|
|
98
|
+
refactored from `.input(z.string())` to `.input(z.object({ systemId: ... }))`
|
|
99
|
+
to fit the GET shape; the only call-site update was the in-process router
|
|
100
|
+
unpacking `input.systemId` instead of passing `input` directly.
|
|
101
|
+
|
|
102
|
+
The API Docs UI now renders query parameters (path/query/header/cookie) in a
|
|
103
|
+
dedicated table for GET endpoints, and the fetch example shows them in the
|
|
104
|
+
URL with `<required>` / `<optional>` placeholders.
|
|
105
|
+
|
|
106
|
+
### Patch Changes
|
|
107
|
+
|
|
108
|
+
- Updated dependencies [9016526]
|
|
109
|
+
- @checkstack/common@0.10.0
|
|
110
|
+
- @checkstack/signal-common@0.2.3
|
|
111
|
+
|
|
3
112
|
## 0.3.2
|
|
4
113
|
|
|
5
114
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/integration-common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.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.
|
|
14
|
-
"@checkstack/signal-common": "0.2.
|
|
13
|
+
"@checkstack/common": "0.10.0",
|
|
14
|
+
"@checkstack/signal-common": "0.2.3",
|
|
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.
|
|
21
|
+
"@checkstack/scripts": "0.3.2"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"typecheck": "tsgo -b",
|
package/src/rpc-contract.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { integrationAccess } from "./access";
|
|
3
3
|
import { pluginMetadata } from "./plugin-metadata";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
createClientDefinition,
|
|
6
|
+
PaginatedResult,
|
|
7
|
+
PaginationInput,
|
|
8
|
+
proc,
|
|
9
|
+
} from "@checkstack/common";
|
|
5
10
|
import {
|
|
6
11
|
WebhookSubscriptionSchema,
|
|
7
12
|
CreateSubscriptionInputSchema,
|
|
@@ -32,20 +37,13 @@ export const integrationContract = {
|
|
|
32
37
|
access: [integrationAccess.manage],
|
|
33
38
|
})
|
|
34
39
|
.input(
|
|
35
|
-
|
|
36
|
-
page: z.number().min(1).default(1),
|
|
37
|
-
pageSize: z.number().min(1).max(100).default(20),
|
|
40
|
+
PaginationInput.extend({
|
|
38
41
|
providerId: z.string().optional(),
|
|
39
42
|
eventType: z.string().optional(),
|
|
40
43
|
enabled: z.boolean().optional(),
|
|
41
44
|
})
|
|
42
45
|
)
|
|
43
|
-
.output(
|
|
44
|
-
z.object({
|
|
45
|
-
subscriptions: z.array(WebhookSubscriptionSchema),
|
|
46
|
-
total: z.number(),
|
|
47
|
-
})
|
|
48
|
-
),
|
|
46
|
+
.output(PaginatedResult(WebhookSubscriptionSchema)),
|
|
49
47
|
|
|
50
48
|
/** Get a single subscription by ID */
|
|
51
49
|
getSubscription: proc({
|
|
@@ -71,6 +69,7 @@ export const integrationContract = {
|
|
|
71
69
|
userType: "authenticated",
|
|
72
70
|
access: [integrationAccess.manage],
|
|
73
71
|
})
|
|
72
|
+
.route({ method: "PATCH" })
|
|
74
73
|
.input(UpdateSubscriptionInputSchema)
|
|
75
74
|
.output(WebhookSubscriptionSchema),
|
|
76
75
|
|
|
@@ -80,6 +79,7 @@ export const integrationContract = {
|
|
|
80
79
|
userType: "authenticated",
|
|
81
80
|
access: [integrationAccess.manage],
|
|
82
81
|
})
|
|
82
|
+
.route({ method: "DELETE" })
|
|
83
83
|
.input(z.object({ id: z.string() }))
|
|
84
84
|
.output(z.object({ success: z.boolean() })),
|
|
85
85
|
|
|
@@ -155,6 +155,7 @@ export const integrationContract = {
|
|
|
155
155
|
userType: "authenticated",
|
|
156
156
|
access: [integrationAccess.manage],
|
|
157
157
|
})
|
|
158
|
+
.route({ method: "PATCH" })
|
|
158
159
|
.input(UpdateConnectionInputSchema)
|
|
159
160
|
.output(ProviderConnectionRedactedSchema),
|
|
160
161
|
|
|
@@ -164,6 +165,7 @@ export const integrationContract = {
|
|
|
164
165
|
userType: "authenticated",
|
|
165
166
|
access: [integrationAccess.manage],
|
|
166
167
|
})
|
|
168
|
+
.route({ method: "DELETE" })
|
|
167
169
|
.input(z.object({ connectionId: z.string() }))
|
|
168
170
|
.output(z.object({ success: z.boolean() })),
|
|
169
171
|
|
|
@@ -230,12 +232,7 @@ export const integrationContract = {
|
|
|
230
232
|
access: [integrationAccess.manage],
|
|
231
233
|
})
|
|
232
234
|
.input(DeliveryLogQueryInputSchema)
|
|
233
|
-
.output(
|
|
234
|
-
z.object({
|
|
235
|
-
logs: z.array(DeliveryLogSchema),
|
|
236
|
-
total: z.number(),
|
|
237
|
-
})
|
|
238
|
-
),
|
|
235
|
+
.output(PaginatedResult(DeliveryLogSchema)),
|
|
239
236
|
|
|
240
237
|
/** Get a single delivery log entry */
|
|
241
238
|
getDeliveryLog: proc({
|
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 =
|
|
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
|
|