@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.
Files changed (35) hide show
  1. package/dist/github/additional-events.d.ts +219 -16710
  2. package/dist/github/additional-events.js +67 -98
  3. package/dist/github/index.d.ts +97 -2
  4. package/dist/github/index.js +382 -5
  5. package/dist/github/openapi-types.d.ts +21 -0
  6. package/dist/github/openapi-types.generated.d.ts +52350 -0
  7. package/dist/github/openapi-types.generated.js +1 -0
  8. package/dist/github/openapi-types.js +1 -0
  9. package/dist/github/resources.d.ts +7435 -17936
  10. package/dist/github/resources.js +40 -135
  11. package/dist/github/rest-schemas.d.ts +11 -0
  12. package/dist/github/rest-schemas.generated.json +1 -0
  13. package/dist/github/rest-schemas.js +24 -0
  14. package/dist/github/schemas.d.ts +4554 -7321
  15. package/dist/github/schemas.js +68 -77
  16. package/dist/github/webhook-operations.d.ts +52 -0
  17. package/dist/github/webhook-operations.js +134 -0
  18. package/dist/github/webhook-schemas.d.ts +12 -0
  19. package/dist/github/webhook-schemas.generated.json +1 -0
  20. package/dist/github/webhook-schemas.js +28 -0
  21. package/dist/linear/schemas.d.ts +1 -1
  22. package/dist/vercel/index.d.ts +12 -12
  23. package/dist/vercel/schemas.d.ts +18 -18
  24. package/package.json +6 -3
  25. package/src/github/additional-events.ts +631 -273
  26. package/src/github/index.ts +761 -8
  27. package/src/github/openapi-types.generated.ts +52352 -0
  28. package/src/github/openapi-types.ts +59 -0
  29. package/src/github/resources.ts +106 -303
  30. package/src/github/rest-schemas.generated.json +1 -0
  31. package/src/github/rest-schemas.ts +35 -0
  32. package/src/github/schemas.ts +593 -195
  33. package/src/github/webhook-operations.ts +171 -0
  34. package/src/github/webhook-schemas.generated.json +1 -0
  35. 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
+ }