@automate.ax/integration-contracts 0.88.2 → 0.88.4
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/dist/github/additional-events.d.ts +219 -16710
- package/dist/github/additional-events.js +67 -98
- package/dist/github/index.d.ts +97 -2
- package/dist/github/index.js +382 -5
- package/dist/github/openapi-types.d.ts +21 -0
- package/dist/github/openapi-types.generated.d.ts +52350 -0
- package/dist/github/openapi-types.generated.js +1 -0
- package/dist/github/openapi-types.js +1 -0
- package/dist/github/resources.d.ts +7435 -17936
- package/dist/github/resources.js +40 -135
- package/dist/github/rest-schemas.d.ts +11 -0
- package/dist/github/rest-schemas.generated.json +1 -0
- package/dist/github/rest-schemas.js +24 -0
- package/dist/github/schemas.d.ts +4554 -7321
- package/dist/github/schemas.js +68 -77
- package/dist/github/webhook-operations.d.ts +52 -0
- package/dist/github/webhook-operations.js +134 -0
- package/dist/github/webhook-schemas.d.ts +12 -0
- package/dist/github/webhook-schemas.generated.json +1 -0
- package/dist/github/webhook-schemas.js +28 -0
- package/dist/linear/schemas.d.ts +1 -1
- package/dist/vercel/index.d.ts +12 -12
- package/dist/vercel/schemas.d.ts +18 -18
- package/package.json +6 -3
- package/src/github/additional-events.ts +631 -273
- package/src/github/index.ts +761 -8
- package/src/github/openapi-types.generated.ts +52352 -0
- package/src/github/openapi-types.ts +59 -0
- package/src/github/resources.ts +106 -303
- package/src/github/rest-schemas.generated.json +1 -0
- package/src/github/rest-schemas.ts +35 -0
- package/src/github/schemas.ts +593 -195
- package/src/github/webhook-operations.ts +171 -0
- package/src/github/webhook-schemas.generated.json +1 -0
- package/src/github/webhook-schemas.ts +43 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* oxlint-disable typescript/no-unsafe-type-assertion -- Frozen generated JSON is indexed only through the checked operation map. */
|
|
2
|
+
import { Validator } from "@cfworker/json-schema"
|
|
3
|
+
import * as z from "zod"
|
|
4
|
+
import schemaData from "./webhook-schemas.generated.json" with { type: "json" }
|
|
5
|
+
import {
|
|
6
|
+
getGitHubWebhookOperation,
|
|
7
|
+
type GitHubWebhookEventName,
|
|
8
|
+
} from "./webhook-operations"
|
|
9
|
+
|
|
10
|
+
/** Runtime validator for one typed GitHub webhook payload. */
|
|
11
|
+
export type GitHubWebhookSchema<TEvent> = z.ZodType<TEvent>
|
|
12
|
+
|
|
13
|
+
/** One interpreter lookup shares the definition graph across every operation. */
|
|
14
|
+
const VALIDATOR = new Validator(
|
|
15
|
+
{
|
|
16
|
+
$defs: schemaData.definitions,
|
|
17
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
18
|
+
additionalProperties: false,
|
|
19
|
+
maxProperties: 1,
|
|
20
|
+
minProperties: 1,
|
|
21
|
+
properties: schemaData.operations,
|
|
22
|
+
type: "object",
|
|
23
|
+
},
|
|
24
|
+
"2020-12",
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Validates a GitHub webhook against the frozen 2026-03-10 provider schema. The
|
|
29
|
+
* JSON Schema interpreter shares the generated definition data instead of
|
|
30
|
+
* compiling and retaining one large executable graph per provider operation.
|
|
31
|
+
*
|
|
32
|
+
* @param eventName - GitHub event header value.
|
|
33
|
+
*/
|
|
34
|
+
export function githubWebhookEventSchema<TEvent>(
|
|
35
|
+
eventName: GitHubWebhookEventName,
|
|
36
|
+
): GitHubWebhookSchema<TEvent> {
|
|
37
|
+
return z.custom<TEvent>((value) => {
|
|
38
|
+
const operation = getGitHubWebhookOperation(eventName, value)
|
|
39
|
+
return Boolean(
|
|
40
|
+
operation && VALIDATOR.validate({ [operation]: value }).valid,
|
|
41
|
+
)
|
|
42
|
+
})
|
|
43
|
+
}
|