@useairfoil/producer-github 0.0.1 → 0.0.3

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 (60) hide show
  1. package/LICENSE.txt +201 -0
  2. package/README.md +116 -0
  3. package/dist/index.d.mts +1939 -0
  4. package/dist/index.mjs +3 -0
  5. package/dist/main.d.mts +1 -0
  6. package/dist/main.mjs +700 -0
  7. package/dist/main.mjs.map +1 -0
  8. package/dist/manifest.d.mts +56 -0
  9. package/dist/manifest.mjs +137 -0
  10. package/dist/manifest.mjs.map +1 -0
  11. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  12. package/dist/src-DKDUc00e.mjs +1563 -0
  13. package/dist/src-DKDUc00e.mjs.map +1 -0
  14. package/package.json +46 -8
  15. package/src/client/auth.ts +113 -0
  16. package/src/client/client.ts +192 -0
  17. package/src/client/constants.ts +4 -0
  18. package/src/connector.ts +97 -0
  19. package/src/create-table.ts +10 -0
  20. package/src/demo/changes.ts +420 -0
  21. package/src/demo/index.ts +59 -0
  22. package/src/demo/setup.ts +34 -0
  23. package/src/demo/shared.ts +101 -0
  24. package/src/index.ts +13 -0
  25. package/src/main.ts +28 -0
  26. package/src/manifest.ts +45 -0
  27. package/src/resources/check-runs.ts +72 -0
  28. package/src/resources/commit-statuses.ts +84 -0
  29. package/src/resources/commits.ts +101 -0
  30. package/src/resources/issue-comments.ts +75 -0
  31. package/src/resources/issues.ts +78 -0
  32. package/src/resources/pull-request-commits.ts +91 -0
  33. package/src/resources/pull-request-review-comments.ts +78 -0
  34. package/src/resources/pull-request-reviews.ts +76 -0
  35. package/src/resources/pull-requests.ts +79 -0
  36. package/src/resources/releases.ts +74 -0
  37. package/src/resources/repositories.ts +101 -0
  38. package/src/resources/shared.ts +480 -0
  39. package/src/resources/workflow-jobs.ts +73 -0
  40. package/src/resources/workflow-runs.ts +70 -0
  41. package/src/sandbox.ts +35 -0
  42. package/src/schemas/check-runs.ts +72 -0
  43. package/src/schemas/commit-statuses.ts +51 -0
  44. package/src/schemas/commits.ts +80 -0
  45. package/src/schemas/events.ts +139 -0
  46. package/src/schemas/issue-comments.ts +48 -0
  47. package/src/schemas/issues.ts +76 -0
  48. package/src/schemas/pull-request-commits.ts +42 -0
  49. package/src/schemas/pull-request-review-comments.ts +85 -0
  50. package/src/schemas/pull-request-reviews.ts +53 -0
  51. package/src/schemas/pull-requests.ts +95 -0
  52. package/src/schemas/releases.ts +70 -0
  53. package/src/schemas/repositories.ts +73 -0
  54. package/src/schemas/shared.ts +76 -0
  55. package/src/schemas/workflow-jobs.ts +78 -0
  56. package/src/schemas/workflow-runs.ts +72 -0
  57. package/src/start.ts +47 -0
  58. package/src/tables.ts +31 -0
  59. package/src/webhook/route.ts +46 -0
  60. package/src/webhook/signature.ts +20 -0
@@ -0,0 +1,72 @@
1
+ import { Iceberg } from "@useairfoil/connector-kit";
2
+ import { Schema, Struct } from "effect";
3
+
4
+ import { Long, Timestamp, readVersion } from "./shared";
5
+
6
+ export const CheckRunSchema = Schema.Struct({
7
+ id: Long.pipe(Schema.annotateKey({ description: "Unique check run ID." })),
8
+ version: readVersion("check run"),
9
+ node_id: Schema.String.pipe(
10
+ Schema.annotateKey({ description: "GraphQL node ID of the check run." }),
11
+ ),
12
+ repository_id: Long.pipe(
13
+ Schema.annotateKey({ description: "ID of the repository the check run belongs to." }),
14
+ ),
15
+ head_sha: Schema.String.pipe(
16
+ Schema.annotateKey({ description: "SHA of the commit the check ran on." }),
17
+ ),
18
+ name: Schema.String.pipe(Schema.annotateKey({ description: "Check name." })),
19
+ status: Schema.String.pipe(
20
+ Schema.annotateKey({ description: "Status, such as queued, in_progress, or completed." }),
21
+ ),
22
+ conclusion: Schema.NullOr(Schema.String).pipe(
23
+ Schema.annotateKey({ description: "Result of a completed check, such as success or failure." }),
24
+ ),
25
+ started_at: Schema.NullOr(Timestamp).pipe(
26
+ Schema.annotateKey({ description: "Time the check started." }),
27
+ ),
28
+ completed_at: Schema.NullOr(Timestamp).pipe(
29
+ Schema.annotateKey({ description: "Time the check completed." }),
30
+ ),
31
+ app: Schema.NullOr(
32
+ Schema.Struct({
33
+ id: Long.pipe(Schema.annotateKey({ description: "GitHub App ID." })),
34
+ name: Schema.String.pipe(Schema.annotateKey({ description: "GitHub App name." })),
35
+ }),
36
+ ).pipe(
37
+ Schema.annotateKey({
38
+ description: "GitHub App that created the check, such as GitHub Actions.",
39
+ }),
40
+ ),
41
+ check_suite: Schema.NullOr(
42
+ Schema.Struct({ id: Long.pipe(Schema.annotateKey({ description: "Check suite ID." })) }),
43
+ ).pipe(Schema.annotateKey({ description: "Check suite the check run belongs to." })),
44
+ output: Schema.Struct({
45
+ title: Schema.NullOr(Schema.String).pipe(Schema.annotateKey({ description: "Output title." })),
46
+ summary: Schema.NullOr(Schema.String).pipe(
47
+ Schema.annotateKey({ description: "Output summary in Markdown." }),
48
+ ),
49
+ }).pipe(Schema.annotateKey({ description: "Output the check reported." })),
50
+ external_id: Schema.NullOr(Schema.String).pipe(
51
+ Schema.annotateKey({ description: "ID the app gave the check." }),
52
+ ),
53
+ details_url: Schema.NullOr(Schema.String).pipe(
54
+ Schema.annotateKey({ description: "Details page from the app." }),
55
+ ),
56
+ html_url: Schema.NullOr(Schema.String).pipe(
57
+ Schema.annotateKey({ description: "Check run page on GitHub." }),
58
+ ),
59
+ })
60
+ .annotate({
61
+ description:
62
+ "Check runs, such as GitHub Actions jobs. Polled for default-branch commits; webhooks cover all branches.",
63
+ })
64
+ .pipe(Iceberg.identifier("id"));
65
+
66
+ export type CheckRun = Schema.Schema.Type<typeof CheckRunSchema>;
67
+
68
+ export const CheckRunObjectSchema = CheckRunSchema.mapFields((fields) =>
69
+ Struct.omit(fields, ["version", "repository_id"]),
70
+ );
71
+
72
+ export type CheckRunObject = Schema.Schema.Type<typeof CheckRunObjectSchema>;
@@ -0,0 +1,51 @@
1
+ import { Iceberg } from "@useairfoil/connector-kit";
2
+ import { Schema, Struct } from "effect";
3
+
4
+ import { Long, Text, Timestamp, user, version } from "./shared";
5
+
6
+ export const CommitStatusSchema = Schema.Struct({
7
+ id: Long.pipe(
8
+ Schema.annotateKey({
9
+ description: "Unique status ID. Each new status of a context gets a new ID.",
10
+ }),
11
+ ),
12
+ version: version("status"),
13
+ node_id: Schema.String.pipe(
14
+ Schema.annotateKey({ description: "GraphQL node ID of the status." }),
15
+ ),
16
+ repository_id: Long.pipe(
17
+ Schema.annotateKey({ description: "ID of the repository the status belongs to." }),
18
+ ),
19
+ sha: Schema.String.pipe(
20
+ Schema.annotateKey({ description: "SHA of the commit the status is on." }),
21
+ ),
22
+ state: Schema.String.pipe(
23
+ Schema.annotateKey({ description: "State: error, failure, pending, or success." }),
24
+ ),
25
+ context: Schema.String.pipe(
26
+ Schema.annotateKey({ description: "Label that tells the status apart, such as ci/build." }),
27
+ ),
28
+ description: Text.pipe(
29
+ Schema.annotateKey({ description: "Short description. Empty when not set." }),
30
+ ),
31
+ target_url: Schema.NullOr(Schema.String).pipe(
32
+ Schema.annotateKey({ description: "Link the status points to." }),
33
+ ),
34
+ creator: Schema.NullOr(user).pipe(
35
+ Schema.annotateKey({ description: "Account that created the status." }),
36
+ ),
37
+ created_at: Timestamp.pipe(Schema.annotateKey({ description: "Time the status was created." })),
38
+ })
39
+ .annotate({
40
+ description: "Commit statuses. Polled for default-branch commits; webhooks cover all branches.",
41
+ })
42
+ .pipe(Iceberg.identifier("id"));
43
+
44
+ export type CommitStatus = Schema.Schema.Type<typeof CommitStatusSchema>;
45
+
46
+ export const CommitStatusObjectSchema = CommitStatusSchema.mapFields((fields) => ({
47
+ ...Struct.omit(fields, ["version", "repository_id", "sha"]),
48
+ updated_at: Timestamp,
49
+ }));
50
+
51
+ export type CommitStatusObject = Schema.Schema.Type<typeof CommitStatusObjectSchema>;
@@ -0,0 +1,80 @@
1
+ import { Iceberg } from "@useairfoil/connector-kit";
2
+ import { Schema, SchemaTransformation } from "effect";
3
+
4
+ import { Long, Timestamp, user } from "./shared";
5
+
6
+ export const gitActor = Schema.Struct({
7
+ name: Schema.String.pipe(Schema.annotateKey({ description: "Name in the commit." })),
8
+ date: Timestamp.pipe(Schema.annotateKey({ description: "Time in the commit." })),
9
+ });
10
+
11
+ /**
12
+ * The GitHub account of a commit's author or committer. GitHub sends `null` or
13
+ * `{}` when the email matches no account, and both become `null`.
14
+ */
15
+ export const account = Schema.NullOr(Schema.Union([user, Schema.Struct({})])).pipe(
16
+ Schema.decodeTo(
17
+ Schema.NullOr(Schema.toType(user)),
18
+ SchemaTransformation.transform({
19
+ decode: (value) => (value !== null && "id" in value ? value : null),
20
+ encode: (value) => value,
21
+ }),
22
+ ),
23
+ );
24
+
25
+ export const CommitSchema = Schema.Struct({
26
+ key: Schema.String.pipe(
27
+ Schema.annotateKey({ description: "Repository ID and SHA, such as `1406396726:9eb3a7d`." }),
28
+ ),
29
+ version: Schema.Date.pipe(
30
+ Schema.annotateKey({ description: "Commit time. A commit never changes." }),
31
+ ),
32
+ repository_id: Long.pipe(
33
+ Schema.annotateKey({ description: "ID of the repository the commit is in." }),
34
+ ),
35
+ sha: Schema.String.pipe(Schema.annotateKey({ description: "Commit SHA." })),
36
+ node_id: Schema.String.pipe(
37
+ Schema.annotateKey({ description: "GraphQL node ID of the commit." }),
38
+ ),
39
+ message: Schema.String.pipe(Schema.annotateKey({ description: "Commit message." })),
40
+ author: gitActor.pipe(
41
+ Schema.annotateKey({ description: "Author name and time from the commit." }),
42
+ ),
43
+ committer: gitActor.pipe(
44
+ Schema.annotateKey({ description: "Committer name and time from the commit." }),
45
+ ),
46
+ author_user: account.pipe(Schema.annotateKey({ description: "GitHub account of the author." })),
47
+ committer_user: account.pipe(
48
+ Schema.annotateKey({ description: "GitHub account of the committer." }),
49
+ ),
50
+ parents: Schema.Array(Schema.String).pipe(
51
+ Schema.annotateKey({ description: "SHAs of the parent commits." }),
52
+ ),
53
+ verified: Schema.Boolean.pipe(
54
+ Schema.annotateKey({ description: "Whether GitHub verified the commit signature." }),
55
+ ),
56
+ html_url: Schema.String.pipe(Schema.annotateKey({ description: "Commit page on GitHub." })),
57
+ })
58
+ .annotate({
59
+ description: "Commits on the default branch of the installation's repositories.",
60
+ })
61
+ .pipe(Iceberg.identifier("key"));
62
+
63
+ export type Commit = Schema.Schema.Type<typeof CommitSchema>;
64
+
65
+ export const CommitObjectSchema = Schema.Struct({
66
+ sha: Schema.String,
67
+ node_id: Schema.String,
68
+ commit: Schema.Struct({
69
+ author: gitActor,
70
+ committer: gitActor,
71
+ message: Schema.String,
72
+ verification: Schema.optionalKey(Schema.Struct({ verified: Schema.Boolean })),
73
+ }),
74
+ author: account,
75
+ committer: account,
76
+ parents: Schema.Array(Schema.Struct({ sha: Schema.String })),
77
+ html_url: Schema.String,
78
+ });
79
+
80
+ export type CommitObject = Schema.Schema.Type<typeof CommitObjectSchema>;
@@ -0,0 +1,139 @@
1
+ import { Schema, Struct } from "effect";
2
+
3
+ import { IssueCommentObjectSchema } from "./issue-comments";
4
+ import { IssueObjectSchema } from "./issues";
5
+ import { PullRequestReviewCommentObjectSchema } from "./pull-request-review-comments";
6
+ import { PullRequestObjectSchema } from "./pull-requests";
7
+ import { ReleaseObjectSchema } from "./releases";
8
+ import { RepositoryObjectSchema } from "./repositories";
9
+ import { Long, ObjectRefSchema, Timestamp } from "./shared";
10
+ import { WorkflowRunObjectSchema } from "./workflow-runs";
11
+
12
+ /**
13
+ * The webhook route passes the payload on as it is. GitHub puts the event name
14
+ * in a header, so each resource decodes its own event.
15
+ */
16
+ export const WebhookPayloadSchema = Schema.Record(Schema.String, Schema.Unknown);
17
+
18
+ export type WebhookPayload = Schema.Schema.Type<typeof WebhookPayloadSchema>;
19
+
20
+ export const InstallationEventSchema = Schema.Struct({
21
+ installation: Schema.optional(Schema.Struct({ id: Schema.Number })),
22
+ });
23
+
24
+ /** For handlers that read the API again. */
25
+ const RepositoryNameSchema = Schema.Struct({ id: Long, full_name: Schema.String });
26
+
27
+ /** A transferred issue no longer exists in its old repository. */
28
+ export const IssueRemovedEventSchema = Schema.Struct({
29
+ action: Schema.Literals(["deleted", "transferred"]),
30
+ issue: ObjectRefSchema,
31
+ });
32
+
33
+ export const IssuesEventSchema = Schema.Union([
34
+ IssueRemovedEventSchema,
35
+ Schema.Struct({
36
+ action: Schema.String,
37
+ repository: RepositoryNameSchema,
38
+ issue: IssueObjectSchema,
39
+ }),
40
+ ]);
41
+
42
+ export const IssueCommentDeletedEventSchema = Schema.Struct({
43
+ action: Schema.Literal("deleted"),
44
+ comment: ObjectRefSchema,
45
+ });
46
+
47
+ export const IssueCommentEventSchema = Schema.Union([
48
+ IssueCommentDeletedEventSchema,
49
+ Schema.Struct({
50
+ action: Schema.String,
51
+ repository: ObjectRefSchema,
52
+ comment: IssueCommentObjectSchema,
53
+ }),
54
+ ]);
55
+
56
+ export const PullRequestReviewCommentDeletedEventSchema = Schema.Struct({
57
+ action: Schema.Literal("deleted"),
58
+ comment: ObjectRefSchema,
59
+ });
60
+
61
+ export const PullRequestReviewCommentEventSchema = Schema.Union([
62
+ PullRequestReviewCommentDeletedEventSchema,
63
+ Schema.Struct({
64
+ action: Schema.String,
65
+ repository: ObjectRefSchema,
66
+ comment: PullRequestReviewCommentObjectSchema,
67
+ }),
68
+ ]);
69
+
70
+ export const PullRequestEventSchema = Schema.Struct({
71
+ repository: RepositoryNameSchema,
72
+ pull_request: PullRequestObjectSchema,
73
+ });
74
+
75
+ export const RepositoryDeletedEventSchema = Schema.Struct({
76
+ action: Schema.Literal("deleted"),
77
+ repository: ObjectRefSchema,
78
+ });
79
+
80
+ export const RepositoryEventSchema = Schema.Union([
81
+ RepositoryDeletedEventSchema,
82
+ Schema.Struct({ action: Schema.String, repository: RepositoryObjectSchema }),
83
+ ]);
84
+
85
+ export const ReleaseDeletedEventSchema = Schema.Struct({
86
+ action: Schema.Literal("deleted"),
87
+ release: ObjectRefSchema,
88
+ });
89
+
90
+ export const ReleaseEventSchema = Schema.Union([
91
+ ReleaseDeletedEventSchema,
92
+ Schema.Struct({
93
+ action: Schema.String,
94
+ repository: ObjectRefSchema,
95
+ release: ReleaseObjectSchema,
96
+ }),
97
+ ]);
98
+
99
+ export const WorkflowRunEventSchema = Schema.Struct({
100
+ repository: ObjectRefSchema,
101
+ workflow_run: WorkflowRunObjectSchema,
102
+ });
103
+
104
+ export const PushEventSchema = Schema.Struct({
105
+ ref: Schema.String,
106
+ before: Schema.String,
107
+ after: Schema.String,
108
+ repository: RepositoryNameSchema.mapFields(Struct.assign({ default_branch: Schema.String })),
109
+ });
110
+
111
+ export const PullRequestReviewEventSchema = Schema.Struct({
112
+ repository: RepositoryNameSchema,
113
+ pull_request: Schema.Struct({ number: Long }),
114
+ review: ObjectRefSchema,
115
+ });
116
+
117
+ export const PullRequestCommitsEventSchema = Schema.Struct({
118
+ action: Schema.String,
119
+ changes: Schema.optionalKey(Schema.Struct({ base: Schema.optionalKey(Schema.Unknown) })),
120
+ repository: RepositoryNameSchema,
121
+ pull_request: Schema.Struct({ number: Long, updated_at: Timestamp }),
122
+ });
123
+
124
+ export const CheckRunEventSchema = Schema.Struct({
125
+ repository: RepositoryNameSchema,
126
+ check_run: ObjectRefSchema,
127
+ });
128
+
129
+ export const WorkflowJobEventSchema = Schema.Struct({
130
+ repository: RepositoryNameSchema,
131
+ workflow_job: ObjectRefSchema,
132
+ });
133
+
134
+ /** The status payload is flat. */
135
+ export const StatusEventSchema = Schema.Struct({
136
+ id: Long,
137
+ sha: Schema.String,
138
+ repository: RepositoryNameSchema,
139
+ });
@@ -0,0 +1,48 @@
1
+ import { Iceberg } from "@useairfoil/connector-kit";
2
+ import { Schema, Struct } from "effect";
3
+
4
+ import { Long, Text, Timestamp, deleted, user, version } from "./shared";
5
+
6
+ export const IssueCommentSchema = Schema.Struct({
7
+ id: Long.pipe(Schema.annotateKey({ description: "Unique comment ID." })),
8
+ version: version("comment"),
9
+ node_id: Schema.String.pipe(
10
+ Schema.annotateKey({ description: "GraphQL node ID of the comment." }),
11
+ ),
12
+ repository_id: Long.pipe(
13
+ Schema.annotateKey({ description: "ID of the repository the comment belongs to." }),
14
+ ),
15
+ issue_number: Long.pipe(
16
+ Schema.annotateKey({
17
+ description: "Number of the issue or pull request the comment is on, in its repository.",
18
+ }),
19
+ ),
20
+ user: Schema.NullOr(user).pipe(
21
+ Schema.annotateKey({ description: "Account that wrote the comment." }),
22
+ ),
23
+ author_association: Schema.String.pipe(
24
+ Schema.annotateKey({
25
+ description: "Author's relation to the repository, such as OWNER or CONTRIBUTOR.",
26
+ }),
27
+ ),
28
+ body: Text.pipe(Schema.annotateKey({ description: "Comment in Markdown. Empty when not set." })),
29
+ created_at: Timestamp.pipe(Schema.annotateKey({ description: "Time the comment was written." })),
30
+ html_url: Schema.String.pipe(Schema.annotateKey({ description: "Comment on GitHub." })),
31
+ _deleted: deleted("comment"),
32
+ })
33
+ .annotate({
34
+ description:
35
+ "Comments on issues and pull requests. Pull request review comments are not included.",
36
+ })
37
+ .pipe(Iceberg.identifier("id"));
38
+
39
+ export type IssueComment = Schema.Schema.Type<typeof IssueCommentSchema>;
40
+
41
+ export const IssueCommentObjectSchema = IssueCommentSchema.mapFields((fields) => ({
42
+ ...Struct.omit(fields, ["version", "repository_id", "issue_number", "_deleted"]),
43
+ updated_at: Timestamp,
44
+ // The list has no issue number, only this URL, which ends in it.
45
+ issue_url: Schema.String.check(Schema.isPattern(/\/issues\/\d+$/)),
46
+ }));
47
+
48
+ export type IssueCommentObject = Schema.Schema.Type<typeof IssueCommentObjectSchema>;
@@ -0,0 +1,76 @@
1
+ import { Iceberg } from "@useairfoil/connector-kit";
2
+ import { Schema, Struct } from "effect";
3
+
4
+ import {
5
+ Long,
6
+ Text,
7
+ Timestamp,
8
+ deleted,
9
+ label,
10
+ milestone,
11
+ optionalList,
12
+ user,
13
+ version,
14
+ } from "./shared";
15
+
16
+ export const IssueSchema = Schema.Struct({
17
+ id: Long.pipe(Schema.annotateKey({ description: "Unique issue ID." })),
18
+ version: version("issue"),
19
+ node_id: Schema.String.pipe(Schema.annotateKey({ description: "GraphQL node ID of the issue." })),
20
+ repository_id: Long.pipe(
21
+ Schema.annotateKey({ description: "ID of the repository the issue belongs to." }),
22
+ ),
23
+ number: Long.pipe(Schema.annotateKey({ description: "Issue number in the repository." })),
24
+ title: Schema.String.pipe(Schema.annotateKey({ description: "Issue title." })),
25
+ body: Text.pipe(
26
+ Schema.annotateKey({ description: "Issue description in Markdown. Empty when not set." }),
27
+ ),
28
+ state: Schema.String.pipe(Schema.annotateKey({ description: "State: open or closed." })),
29
+ state_reason: Schema.NullOr(Schema.String).pipe(
30
+ Schema.annotateKey({
31
+ description: "Why the issue was closed or reopened, such as completed or not_planned.",
32
+ }),
33
+ ),
34
+ locked: Schema.Boolean.pipe(
35
+ Schema.annotateKey({ description: "Whether the conversation is locked." }),
36
+ ),
37
+ user: Schema.NullOr(user).pipe(
38
+ Schema.annotateKey({ description: "Account that opened the issue." }),
39
+ ),
40
+ author_association: Schema.String.pipe(
41
+ Schema.annotateKey({
42
+ description: "Author's relation to the repository, such as OWNER or CONTRIBUTOR.",
43
+ }),
44
+ ),
45
+ labels: Schema.Array(label).pipe(Schema.annotateKey({ description: "Labels on the issue." })),
46
+ assignees: Schema.Array(user).pipe(
47
+ Schema.annotateKey({ description: "Accounts assigned to the issue." }),
48
+ ),
49
+ milestone: Schema.NullOr(milestone).pipe(
50
+ Schema.annotateKey({ description: "Milestone of the issue." }),
51
+ ),
52
+ comments: Long.pipe(Schema.annotateKey({ description: "Number of comments." })),
53
+ created_at: Timestamp.pipe(Schema.annotateKey({ description: "Time the issue was opened." })),
54
+ closed_at: Schema.NullOr(Timestamp).pipe(
55
+ Schema.annotateKey({ description: "Time the issue was closed. Null while it is open." }),
56
+ ),
57
+ html_url: Schema.String.pipe(Schema.annotateKey({ description: "Issue page on GitHub." })),
58
+ _deleted: deleted("issue"),
59
+ })
60
+ .annotate({
61
+ description: "Issues in the installation's repositories. Pull requests are not included.",
62
+ })
63
+ .pipe(Iceberg.identifier("id"));
64
+
65
+ export type Issue = Schema.Schema.Type<typeof IssueSchema>;
66
+
67
+ export const IssueObjectSchema = IssueSchema.mapFields((fields) => ({
68
+ ...Struct.omit(fields, ["version", "repository_id", "labels", "assignees", "_deleted"]),
69
+ updated_at: Timestamp,
70
+ labels: optionalList(label),
71
+ assignees: optionalList(user),
72
+ // Set on pull requests, which the issues list also returns.
73
+ pull_request: Schema.optionalKey(Schema.Unknown),
74
+ }));
75
+
76
+ export type IssueObject = Schema.Schema.Type<typeof IssueObjectSchema>;
@@ -0,0 +1,42 @@
1
+ import { Iceberg } from "@useairfoil/connector-kit";
2
+ import { Schema } from "effect";
3
+
4
+ import { account, gitActor } from "./commits";
5
+ import { Long } from "./shared";
6
+
7
+ export const PullRequestCommitSchema = Schema.Struct({
8
+ key: Schema.String.pipe(
9
+ Schema.annotateKey({
10
+ description: "Repository ID, pull request number, and SHA, such as `1406396726:3:9eb3a7d`.",
11
+ }),
12
+ ),
13
+ version: Schema.Date.pipe(
14
+ Schema.annotateKey({ description: "Time GitHub last updated the pull request." }),
15
+ ),
16
+ repository_id: Long.pipe(
17
+ Schema.annotateKey({ description: "ID of the repository the pull request belongs to." }),
18
+ ),
19
+ pull_request_number: Long.pipe(
20
+ Schema.annotateKey({ description: "Pull request number in the repository." }),
21
+ ),
22
+ sha: Schema.String.pipe(Schema.annotateKey({ description: "Commit SHA." })),
23
+ message: Schema.String.pipe(Schema.annotateKey({ description: "Commit message." })),
24
+ author: gitActor.pipe(
25
+ Schema.annotateKey({ description: "Author name and time from the commit." }),
26
+ ),
27
+ committer: gitActor.pipe(
28
+ Schema.annotateKey({ description: "Committer name and time from the commit." }),
29
+ ),
30
+ author_user: account.pipe(Schema.annotateKey({ description: "GitHub account of the author." })),
31
+ committer_user: account.pipe(
32
+ Schema.annotateKey({ description: "GitHub account of the committer." }),
33
+ ),
34
+ html_url: Schema.String.pipe(Schema.annotateKey({ description: "Commit page on GitHub." })),
35
+ })
36
+ .annotate({
37
+ description:
38
+ "Commits in pull requests, up to 250 per pull request. Commits removed by a force push stay.",
39
+ })
40
+ .pipe(Iceberg.identifier("key"));
41
+
42
+ export type PullRequestCommit = Schema.Schema.Type<typeof PullRequestCommitSchema>;
@@ -0,0 +1,85 @@
1
+ import { Iceberg } from "@useairfoil/connector-kit";
2
+ import { Schema, Struct } from "effect";
3
+
4
+ import { Long, Timestamp, deleted, user, version } from "./shared";
5
+
6
+ export const PullRequestReviewCommentSchema = Schema.Struct({
7
+ id: Long.pipe(Schema.annotateKey({ description: "Unique review comment ID." })),
8
+ version: version("review comment"),
9
+ node_id: Schema.String.pipe(
10
+ Schema.annotateKey({ description: "GraphQL node ID of the review comment." }),
11
+ ),
12
+ repository_id: Long.pipe(
13
+ Schema.annotateKey({ description: "ID of the repository the comment belongs to." }),
14
+ ),
15
+ pull_request_number: Long.pipe(
16
+ Schema.annotateKey({
17
+ description: "Number of the pull request the comment is on, in its repository.",
18
+ }),
19
+ ),
20
+ pull_request_review_id: Schema.NullOr(Long).pipe(
21
+ Schema.annotateKey({ description: "ID of the review the comment belongs to." }),
22
+ ),
23
+ in_reply_to_id: Schema.optionalKey(Long).pipe(
24
+ Schema.annotateKey({ description: "ID of the comment this one replies to." }),
25
+ ),
26
+ user: Schema.NullOr(user).pipe(
27
+ Schema.annotateKey({ description: "Account that wrote the comment." }),
28
+ ),
29
+ author_association: Schema.String.pipe(
30
+ Schema.annotateKey({
31
+ description: "Author's relation to the repository, such as OWNER or CONTRIBUTOR.",
32
+ }),
33
+ ),
34
+ body: Schema.String.pipe(Schema.annotateKey({ description: "Comment in Markdown." })),
35
+ path: Schema.String.pipe(
36
+ Schema.annotateKey({ description: "Path of the file the comment is on." }),
37
+ ),
38
+ commit_id: Schema.String.pipe(
39
+ Schema.annotateKey({ description: "SHA of the commit the comment is on now." }),
40
+ ),
41
+ original_commit_id: Schema.String.pipe(
42
+ Schema.annotateKey({ description: "SHA of the commit the comment was written on." }),
43
+ ),
44
+ diff_hunk: Schema.String.pipe(
45
+ Schema.annotateKey({ description: "Part of the diff the comment is on." }),
46
+ ),
47
+ // GitHub sends null for a comment on a line that is no longer in the diff.
48
+ line: Schema.optionalKey(Schema.NullOr(Long)).pipe(
49
+ Schema.annotateKey({ description: "Last line of the commented range in the current diff." }),
50
+ ),
51
+ original_line: Schema.optionalKey(Schema.NullOr(Long)).pipe(
52
+ Schema.annotateKey({ description: "Last line of the commented range in the original diff." }),
53
+ ),
54
+ start_line: Schema.optionalKey(Schema.NullOr(Long)).pipe(
55
+ Schema.annotateKey({ description: "First line of a multi-line comment." }),
56
+ ),
57
+ side: Schema.optionalKey(Schema.NullOr(Schema.String)).pipe(
58
+ Schema.annotateKey({ description: "Side of the diff: LEFT or RIGHT." }),
59
+ ),
60
+ subject_type: Schema.optionalKey(Schema.String).pipe(
61
+ Schema.annotateKey({ description: "What the comment is on: line or file." }),
62
+ ),
63
+ created_at: Timestamp.pipe(Schema.annotateKey({ description: "Time the comment was written." })),
64
+ html_url: Schema.String.pipe(Schema.annotateKey({ description: "Comment on GitHub." })),
65
+ _deleted: deleted("review comment"),
66
+ })
67
+ .annotate({
68
+ description: "Review comments on pull request diffs.",
69
+ })
70
+ .pipe(Iceberg.identifier("id"));
71
+
72
+ export type PullRequestReviewComment = Schema.Schema.Type<typeof PullRequestReviewCommentSchema>;
73
+
74
+ export const PullRequestReviewCommentObjectSchema = PullRequestReviewCommentSchema.mapFields(
75
+ (fields) => ({
76
+ ...Struct.omit(fields, ["version", "repository_id", "pull_request_number", "_deleted"]),
77
+ updated_at: Timestamp,
78
+ // The list has no pull request number, only this URL, which ends in it.
79
+ pull_request_url: Schema.String.check(Schema.isPattern(/\/pulls\/\d+$/)),
80
+ }),
81
+ );
82
+
83
+ export type PullRequestReviewCommentObject = Schema.Schema.Type<
84
+ typeof PullRequestReviewCommentObjectSchema
85
+ >;
@@ -0,0 +1,53 @@
1
+ import { Iceberg } from "@useairfoil/connector-kit";
2
+ import { Schema, Struct } from "effect";
3
+
4
+ import { Long, Timestamp, readVersion, user } from "./shared";
5
+
6
+ export const PullRequestReviewSchema = Schema.Struct({
7
+ id: Long.pipe(Schema.annotateKey({ description: "Unique review ID." })),
8
+ version: readVersion("review"),
9
+ node_id: Schema.String.pipe(
10
+ Schema.annotateKey({ description: "GraphQL node ID of the review." }),
11
+ ),
12
+ repository_id: Long.pipe(
13
+ Schema.annotateKey({ description: "ID of the repository the review belongs to." }),
14
+ ),
15
+ pull_request_number: Long.pipe(
16
+ Schema.annotateKey({
17
+ description: "Number of the pull request the review is on, in its repository.",
18
+ }),
19
+ ),
20
+ user: Schema.NullOr(user).pipe(
21
+ Schema.annotateKey({ description: "Account that wrote the review." }),
22
+ ),
23
+ author_association: Schema.String.pipe(
24
+ Schema.annotateKey({
25
+ description: "Author's relation to the repository, such as OWNER or CONTRIBUTOR.",
26
+ }),
27
+ ),
28
+ state: Schema.String.pipe(
29
+ Schema.annotateKey({
30
+ description: "State, such as APPROVED, CHANGES_REQUESTED, COMMENTED, or DISMISSED.",
31
+ }),
32
+ ),
33
+ body: Schema.String.pipe(Schema.annotateKey({ description: "Review summary in Markdown." })),
34
+ commit_id: Schema.NullOr(Schema.String).pipe(
35
+ Schema.annotateKey({ description: "SHA of the commit the review is on." }),
36
+ ),
37
+ submitted_at: Schema.optionalKey(Timestamp).pipe(
38
+ Schema.annotateKey({ description: "Time the review was submitted." }),
39
+ ),
40
+ html_url: Schema.String.pipe(Schema.annotateKey({ description: "Review on GitHub." })),
41
+ })
42
+ .annotate({
43
+ description: "Reviews on pull requests. Pending reviews are only visible to their author.",
44
+ })
45
+ .pipe(Iceberg.identifier("id"));
46
+
47
+ export type PullRequestReview = Schema.Schema.Type<typeof PullRequestReviewSchema>;
48
+
49
+ export const PullRequestReviewObjectSchema = PullRequestReviewSchema.mapFields((fields) =>
50
+ Struct.omit(fields, ["version", "repository_id", "pull_request_number"]),
51
+ );
52
+
53
+ export type PullRequestReviewObject = Schema.Schema.Type<typeof PullRequestReviewObjectSchema>;