@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,171 @@
|
|
|
1
|
+
/* oxlint-disable typescript/no-unsafe-type-assertion -- Membership checks narrow the two disjoint generated operation maps. */
|
|
2
|
+
const GITHUB_WEBHOOK_ACTIONS = {
|
|
3
|
+
check_run: ["completed", "created", "requested_action", "rerequested"],
|
|
4
|
+
check_suite: ["completed", "requested", "rerequested"],
|
|
5
|
+
commit_comment: ["created"],
|
|
6
|
+
deployment: ["created"],
|
|
7
|
+
deployment_protection_rule: ["requested"],
|
|
8
|
+
deployment_review: ["approved", "rejected", "requested"],
|
|
9
|
+
deployment_status: ["created"],
|
|
10
|
+
installation: [
|
|
11
|
+
"created",
|
|
12
|
+
"deleted",
|
|
13
|
+
"new_permissions_accepted",
|
|
14
|
+
"suspend",
|
|
15
|
+
"unsuspend",
|
|
16
|
+
],
|
|
17
|
+
installation_repositories: ["added", "removed"],
|
|
18
|
+
installation_target: ["renamed"],
|
|
19
|
+
issue_comment: ["created", "deleted", "edited", "pinned", "unpinned"],
|
|
20
|
+
issue_dependencies: [
|
|
21
|
+
"blocked_by_added",
|
|
22
|
+
"blocked_by_removed",
|
|
23
|
+
"blocking_added",
|
|
24
|
+
"blocking_removed",
|
|
25
|
+
],
|
|
26
|
+
issues: [
|
|
27
|
+
"assigned",
|
|
28
|
+
"closed",
|
|
29
|
+
"deleted",
|
|
30
|
+
"demilestoned",
|
|
31
|
+
"edited",
|
|
32
|
+
"field_added",
|
|
33
|
+
"field_removed",
|
|
34
|
+
"labeled",
|
|
35
|
+
"locked",
|
|
36
|
+
"milestoned",
|
|
37
|
+
"opened",
|
|
38
|
+
"pinned",
|
|
39
|
+
"reopened",
|
|
40
|
+
"transferred",
|
|
41
|
+
"typed",
|
|
42
|
+
"unassigned",
|
|
43
|
+
"unlabeled",
|
|
44
|
+
"unlocked",
|
|
45
|
+
"unpinned",
|
|
46
|
+
"untyped",
|
|
47
|
+
],
|
|
48
|
+
merge_group: ["checks_requested", "destroyed"],
|
|
49
|
+
pull_request: [
|
|
50
|
+
"assigned",
|
|
51
|
+
"auto_merge_disabled",
|
|
52
|
+
"auto_merge_enabled",
|
|
53
|
+
"closed",
|
|
54
|
+
"converted_to_draft",
|
|
55
|
+
"demilestoned",
|
|
56
|
+
"dequeued",
|
|
57
|
+
"edited",
|
|
58
|
+
"enqueued",
|
|
59
|
+
"labeled",
|
|
60
|
+
"locked",
|
|
61
|
+
"milestoned",
|
|
62
|
+
"opened",
|
|
63
|
+
"ready_for_review",
|
|
64
|
+
"reopened",
|
|
65
|
+
"review_request_removed",
|
|
66
|
+
"review_requested",
|
|
67
|
+
"stacked",
|
|
68
|
+
"synchronize",
|
|
69
|
+
"unassigned",
|
|
70
|
+
"unlabeled",
|
|
71
|
+
"unlocked",
|
|
72
|
+
],
|
|
73
|
+
pull_request_review: ["dismissed", "edited", "submitted"],
|
|
74
|
+
pull_request_review_comment: ["created", "deleted", "edited"],
|
|
75
|
+
pull_request_review_thread: ["resolved", "unresolved"],
|
|
76
|
+
release: [
|
|
77
|
+
"created",
|
|
78
|
+
"deleted",
|
|
79
|
+
"edited",
|
|
80
|
+
"prereleased",
|
|
81
|
+
"published",
|
|
82
|
+
"released",
|
|
83
|
+
"unpublished",
|
|
84
|
+
],
|
|
85
|
+
repository: [
|
|
86
|
+
"archived",
|
|
87
|
+
"created",
|
|
88
|
+
"deleted",
|
|
89
|
+
"edited",
|
|
90
|
+
"privatized",
|
|
91
|
+
"publicized",
|
|
92
|
+
"renamed",
|
|
93
|
+
"transferred",
|
|
94
|
+
"unarchived",
|
|
95
|
+
],
|
|
96
|
+
sub_issues: [
|
|
97
|
+
"parent_issue_added",
|
|
98
|
+
"parent_issue_removed",
|
|
99
|
+
"sub_issue_added",
|
|
100
|
+
"sub_issue_removed",
|
|
101
|
+
],
|
|
102
|
+
workflow_job: ["completed", "in_progress", "queued", "waiting"],
|
|
103
|
+
workflow_run: ["completed", "in_progress", "requested"],
|
|
104
|
+
} as const
|
|
105
|
+
|
|
106
|
+
const GITHUB_ACTIONLESS_WEBHOOK_OPERATIONS = {
|
|
107
|
+
create: "create",
|
|
108
|
+
delete: "delete",
|
|
109
|
+
push: "push",
|
|
110
|
+
repository_dispatch: "repository-dispatch-sample.collected",
|
|
111
|
+
status: "status",
|
|
112
|
+
workflow_dispatch: "workflow-dispatch",
|
|
113
|
+
} as const
|
|
114
|
+
|
|
115
|
+
/** Resolves an action discriminator across the generated event family map. */
|
|
116
|
+
type GitHubWebhookActionForOperation<TOperation extends string> = {
|
|
117
|
+
[TEventName in keyof typeof GITHUB_WEBHOOK_ACTIONS]: {
|
|
118
|
+
[TAction in (typeof GITHUB_WEBHOOK_ACTIONS)[TEventName][number]]: `${ReplaceUnderscores<TEventName>}-${ReplaceUnderscores<TAction>}` extends TOperation
|
|
119
|
+
? TAction
|
|
120
|
+
: never
|
|
121
|
+
}[(typeof GITHUB_WEBHOOK_ACTIONS)[TEventName][number]]
|
|
122
|
+
}[keyof typeof GITHUB_WEBHOOK_ACTIONS]
|
|
123
|
+
|
|
124
|
+
/** Action discriminator required by one classified webhook operation. */
|
|
125
|
+
export type GitHubWebhookAction<TOperation extends string> =
|
|
126
|
+
TOperation extends string
|
|
127
|
+
? GitHubWebhookActionForOperation<TOperation>
|
|
128
|
+
: never
|
|
129
|
+
|
|
130
|
+
type ReplaceUnderscores<TValue extends string> =
|
|
131
|
+
TValue extends `${infer THead}_${infer TTail}`
|
|
132
|
+
? `${THead}-${ReplaceUnderscores<TTail>}`
|
|
133
|
+
: TValue
|
|
134
|
+
|
|
135
|
+
export type GitHubWebhookEventName =
|
|
136
|
+
| keyof typeof GITHUB_ACTIONLESS_WEBHOOK_OPERATIONS
|
|
137
|
+
| keyof typeof GITHUB_WEBHOOK_ACTIONS
|
|
138
|
+
|
|
139
|
+
export const GITHUB_WEBHOOK_OPERATIONS = [
|
|
140
|
+
...Object.values(GITHUB_ACTIONLESS_WEBHOOK_OPERATIONS),
|
|
141
|
+
...Object.entries(GITHUB_WEBHOOK_ACTIONS).flatMap(([eventName, actions]) =>
|
|
142
|
+
actions.map(
|
|
143
|
+
(action) =>
|
|
144
|
+
`${eventName.replaceAll("_", "-")}-${action.replaceAll("_", "-")}`,
|
|
145
|
+
),
|
|
146
|
+
),
|
|
147
|
+
] as const
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Resolves one GitHub event header and body to its frozen OpenAPI operation.
|
|
151
|
+
*
|
|
152
|
+
* @param eventName - GitHub event header value.
|
|
153
|
+
* @param value - Parsed webhook body.
|
|
154
|
+
*/
|
|
155
|
+
export function getGitHubWebhookOperation(
|
|
156
|
+
eventName: GitHubWebhookEventName,
|
|
157
|
+
value: unknown,
|
|
158
|
+
) {
|
|
159
|
+
if (eventName in GITHUB_ACTIONLESS_WEBHOOK_OPERATIONS) {
|
|
160
|
+
return GITHUB_ACTIONLESS_WEBHOOK_OPERATIONS[
|
|
161
|
+
eventName as keyof typeof GITHUB_ACTIONLESS_WEBHOOK_OPERATIONS
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
if (!value || typeof value !== "object" || !("action" in value)) return
|
|
165
|
+
const action = value.action
|
|
166
|
+
const actions = GITHUB_WEBHOOK_ACTIONS[
|
|
167
|
+
eventName as keyof typeof GITHUB_WEBHOOK_ACTIONS
|
|
168
|
+
] as readonly string[]
|
|
169
|
+
if (typeof action !== "string" || !actions.includes(action)) return
|
|
170
|
+
return `${eventName.replaceAll("_", "-")}-${action.replaceAll("_", "-")}`
|
|
171
|
+
}
|