@automate.ax/integration-contracts 0.91.0 → 0.92.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.
@@ -7,6 +7,7 @@ interface CloseRequestOptions<TSchema extends z.ZodType> {
7
7
  body?: Encodable;
8
8
  method?: "DELETE" | "GET" | "POST" | "PUT";
9
9
  query?: Record<string, boolean | number | string | readonly string[] | null | undefined>;
10
+ responseKeyFormat?: "camelCase" | "provider";
10
11
  responseSchema: TSchema;
11
12
  }
12
13
  /** Error returned by a rejected Close API request. */
@@ -32,7 +33,8 @@ export declare function getCloseApi(secret: unknown): {
32
33
  *
33
34
  * Query keys are provider-native so callers can use Close's
34
35
  * double-underscore filters. Request bodies and responses use public
35
- * camelCase keys.
36
+ * camelCase keys unless an opaque provider response must retain exact
37
+ * keys.
36
38
  *
37
39
  * @param path - Relative path below Close's API root.
38
40
  * @param options - Request method, query, body, and response schema.
package/dist/close/api.js CHANGED
@@ -44,7 +44,8 @@ export function getCloseApi(secret) {
44
44
  *
45
45
  * Query keys are provider-native so callers can use Close's
46
46
  * double-underscore filters. Request bodies and responses use public
47
- * camelCase keys.
47
+ * camelCase keys unless an opaque provider response must retain exact
48
+ * keys.
48
49
  *
49
50
  * @param path - Relative path below Close's API root.
50
51
  * @param options - Request method, query, body, and response schema.
@@ -81,7 +82,8 @@ export function getCloseApi(secret) {
81
82
  method: options.method ?? "GET",
82
83
  });
83
84
  const text = await response.text();
84
- const result = CLOSE_RESPONSE_SCHEMA.safeParse(fromClose(text ? parseJson(text) : null));
85
+ const parsed = text ? parseJson(text) : null;
86
+ const result = CLOSE_RESPONSE_SCHEMA.safeParse(options.responseKeyFormat === "provider" ? parsed : fromClose(parsed));
85
87
  if (!response.ok || !result.success) {
86
88
  throw new CloseApiError(response.status, result.success ? result.data : { response: text });
87
89
  }
@@ -83,11 +83,17 @@ export type GitHubCheckRunNeutralEvent = GitHubCheckRunCompletedEvent & {
83
83
  conclusion: "neutral";
84
84
  };
85
85
  };
86
- export type GitHubCheckRunPendingEvent = GitHubCheckRunCompletedEvent & {
86
+ export type GitHubCheckRunPendingEvent = (GitHubCheckRunCreatedEvent & {
87
+ check_run: GitHubCheckRunCreatedEvent["check_run"] & {
88
+ conclusion: null;
89
+ status: "pending";
90
+ };
91
+ }) | (GitHubCheckRunCompletedEvent & {
87
92
  check_run: GitHubCheckRunCompletedEvent["check_run"] & {
88
93
  conclusion: "pending";
94
+ status: "completed";
89
95
  };
90
- };
96
+ });
91
97
  export type GitHubCheckRunSkippedEvent = GitHubCheckRunCompletedEvent & {
92
98
  check_run: GitHubCheckRunCompletedEvent["check_run"] & {
93
99
  conclusion: "skipped";
@@ -98,11 +104,17 @@ export type GitHubCheckRunStaleEvent = GitHubCheckRunCompletedEvent & {
98
104
  conclusion: "stale";
99
105
  };
100
106
  };
101
- export type GitHubCheckRunWaitingEvent = GitHubCheckRunCompletedEvent & {
107
+ export type GitHubCheckRunWaitingEvent = (GitHubCheckRunCreatedEvent & {
108
+ check_run: GitHubCheckRunCreatedEvent["check_run"] & {
109
+ conclusion: null;
110
+ status: "waiting";
111
+ };
112
+ }) | (GitHubCheckRunCompletedEvent & {
102
113
  check_run: GitHubCheckRunCompletedEvent["check_run"] & {
103
114
  conclusion: "waiting";
115
+ status: "completed";
104
116
  };
105
- };
117
+ });
106
118
  /** Official GitHub check-suite webhook payload union. */
107
119
  export type GitHubCheckSuiteEvent = GitHubWebhookPayload<Extract<GitHubWebhookOperation, `check-suite-${string}`>>;
108
120
  export type GitHubCheckSuiteCompletedEvent = GitHubWebhookPayload<"check-suite-completed">;
@@ -50,10 +50,20 @@ export const GITHUB_CHECK_RUN_STARTUP_FAILED_EVENT_SCHEMA = githubSemanticEventS
50
50
  export const GITHUB_CHECK_RUN_ACTION_REQUIRED_EVENT_SCHEMA = githubSemanticEventSchema(GITHUB_CHECK_RUN_EVENT_SCHEMA, (event) => event.action === "completed" &&
51
51
  event.check_run.conclusion === "action_required");
52
52
  export const GITHUB_CHECK_RUN_NEUTRAL_EVENT_SCHEMA = githubSemanticEventSchema(GITHUB_CHECK_RUN_EVENT_SCHEMA, (event) => event.action === "completed" && event.check_run.conclusion === "neutral");
53
- export const GITHUB_CHECK_RUN_PENDING_EVENT_SCHEMA = githubSemanticEventSchema(GITHUB_CHECK_RUN_EVENT_SCHEMA, (event) => event.action === "completed" && event.check_run.conclusion === "pending");
53
+ export const GITHUB_CHECK_RUN_PENDING_EVENT_SCHEMA = githubSemanticEventSchema(GITHUB_CHECK_RUN_EVENT_SCHEMA, (event) => (event.action === "created" &&
54
+ event.check_run.status === "pending" &&
55
+ event.check_run.conclusion === null) ||
56
+ (event.action === "completed" &&
57
+ event.check_run.status === "completed" &&
58
+ event.check_run.conclusion === "pending"));
54
59
  export const GITHUB_CHECK_RUN_SKIPPED_EVENT_SCHEMA = githubSemanticEventSchema(GITHUB_CHECK_RUN_EVENT_SCHEMA, (event) => event.action === "completed" && event.check_run.conclusion === "skipped");
55
60
  export const GITHUB_CHECK_RUN_STALE_EVENT_SCHEMA = githubSemanticEventSchema(GITHUB_CHECK_RUN_EVENT_SCHEMA, (event) => event.action === "completed" && event.check_run.conclusion === "stale");
56
- export const GITHUB_CHECK_RUN_WAITING_EVENT_SCHEMA = githubSemanticEventSchema(GITHUB_CHECK_RUN_EVENT_SCHEMA, (event) => event.action === "completed" && event.check_run.conclusion === "waiting");
61
+ export const GITHUB_CHECK_RUN_WAITING_EVENT_SCHEMA = githubSemanticEventSchema(GITHUB_CHECK_RUN_EVENT_SCHEMA, (event) => (event.action === "created" &&
62
+ event.check_run.status === "waiting" &&
63
+ event.check_run.conclusion === null) ||
64
+ (event.action === "completed" &&
65
+ event.check_run.status === "completed" &&
66
+ event.check_run.conclusion === "waiting"));
57
67
  export const GITHUB_CHECK_SUITE_EVENT_SCHEMA = githubWebhookEventSchema("check_suite");
58
68
  export const GITHUB_CHECK_SUITE_COMPLETED_EVENT_SCHEMA = githubSemanticEventSchema(GITHUB_CHECK_SUITE_EVENT_SCHEMA, (event) => event.action === "completed");
59
69
  export const GITHUB_CHECK_SUITE_REQUESTED_EVENT_SCHEMA = githubSemanticEventSchema(GITHUB_CHECK_SUITE_EVENT_SCHEMA, (event) => event.action === "requested");
@@ -609,7 +609,7 @@ export type components = {
609
609
  * @example queued
610
610
  * @enum {string}
611
611
  */
612
- status: "queued" | "in_progress" | "completed" | "pending";
612
+ status: "queued" | "in_progress" | "completed" | "pending" | "requested" | "waiting";
613
613
  /** @example https://api.github.com/repos/github/hello-world/check-runs/4 */
614
614
  url: string;
615
615
  };