@useairfoil/producer-github 0.0.2 → 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.
@@ -1,20 +1,40 @@
1
1
  import { Iceberg } from "@useairfoil/connector-kit";
2
2
  import { Schema, Struct } from "effect";
3
3
 
4
- import { Long, Text, Timestamp, field, user, version } from "./shared";
4
+ import { Long, Text, Timestamp, user, version } from "./shared";
5
5
 
6
6
  export const CommitStatusSchema = Schema.Struct({
7
- id: Long.pipe(field(1, "Unique status ID. Each new status of a context gets a new ID.")),
8
- version: version(2, "status"),
9
- node_id: Schema.String.pipe(field(3, "GraphQL node ID of the status.")),
10
- repository_id: Long.pipe(field(4, "ID of the repository the status belongs to.")),
11
- sha: Schema.String.pipe(field(5, "SHA of the commit the status is on.")),
12
- state: Schema.String.pipe(field(6, "State: error, failure, pending, or success.")),
13
- context: Schema.String.pipe(field(7, "Label that tells the status apart, such as ci/build.")),
14
- description: Text.pipe(field(8, "Short description. Empty when not set.")),
15
- target_url: Schema.NullOr(Schema.String).pipe(field(9, "Link the status points to.")),
16
- creator: Schema.NullOr(user(100)).pipe(field(10, "Account that created the status.")),
17
- created_at: Timestamp.pipe(field(11, "Time the status was created.")),
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." })),
18
38
  })
19
39
  .annotate({
20
40
  description: "Commit statuses. Polled for default-branch commits; webhooks cover all branches.",
@@ -1,43 +1,59 @@
1
1
  import { Iceberg } from "@useairfoil/connector-kit";
2
2
  import { Schema, SchemaTransformation } from "effect";
3
3
 
4
- import { Long, Timestamp, field, list, user } from "./shared";
4
+ import { Long, Timestamp, user } from "./shared";
5
5
 
6
- export const gitActor = (baseId: number) =>
7
- Schema.Struct({
8
- name: Schema.String.pipe(field(baseId, "Name in the commit.")),
9
- date: Timestamp.pipe(field(baseId + 1, "Time in the commit.")),
10
- });
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
+ });
11
10
 
12
11
  /**
13
12
  * The GitHub account of a commit's author or committer. GitHub sends `null` or
14
13
  * `{}` when the email matches no account, and both become `null`.
15
14
  */
16
- export const account = (baseId: number) =>
17
- Schema.NullOr(Schema.Union([user(baseId), Schema.Struct({})])).pipe(
18
- Schema.decodeTo(
19
- Schema.NullOr(Schema.toType(user(baseId))),
20
- SchemaTransformation.transform({
21
- decode: (value) => (value !== null && "id" in value ? value : null),
22
- encode: (value) => value,
23
- }),
24
- ),
25
- );
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
+ );
26
24
 
27
25
  export const CommitSchema = Schema.Struct({
28
- key: Schema.String.pipe(field(1, "Repository ID and SHA, such as `1406396726:9eb3a7d`.")),
29
- version: Schema.Date.pipe(field(2, "Commit time. A commit never changes.")),
30
- repository_id: Long.pipe(field(3, "ID of the repository the commit is in.")),
31
- sha: Schema.String.pipe(field(4, "Commit SHA.")),
32
- node_id: Schema.String.pipe(field(5, "GraphQL node ID of the commit.")),
33
- message: Schema.String.pipe(field(6, "Commit message.")),
34
- author: gitActor(100).pipe(field(7, "Author name and time from the commit.")),
35
- committer: gitActor(102).pipe(field(8, "Committer name and time from the commit.")),
36
- author_user: account(104).pipe(field(9, "GitHub account of the author.")),
37
- committer_user: account(107).pipe(field(10, "GitHub account of the committer.")),
38
- parents: list(110, Schema.String).pipe(field(11, "SHAs of the parent commits.")),
39
- verified: Schema.Boolean.pipe(field(12, "Whether GitHub verified the commit signature.")),
40
- html_url: Schema.String.pipe(field(13, "Commit page on GitHub.")),
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." })),
41
57
  })
42
58
  .annotate({
43
59
  description: "Commits on the default branch of the installation's repositories.",
@@ -50,13 +66,13 @@ export const CommitObjectSchema = Schema.Struct({
50
66
  sha: Schema.String,
51
67
  node_id: Schema.String,
52
68
  commit: Schema.Struct({
53
- author: gitActor(100),
54
- committer: gitActor(102),
69
+ author: gitActor,
70
+ committer: gitActor,
55
71
  message: Schema.String,
56
72
  verification: Schema.optionalKey(Schema.Struct({ verified: Schema.Boolean })),
57
73
  }),
58
- author: account(104),
59
- committer: account(107),
74
+ author: account,
75
+ committer: account,
60
76
  parents: Schema.Array(Schema.Struct({ sha: Schema.String })),
61
77
  html_url: Schema.String,
62
78
  });
@@ -1,24 +1,34 @@
1
1
  import { Iceberg } from "@useairfoil/connector-kit";
2
2
  import { Schema, Struct } from "effect";
3
3
 
4
- import { Long, Text, Timestamp, deleted, field, user, version } from "./shared";
4
+ import { Long, Text, Timestamp, deleted, user, version } from "./shared";
5
5
 
6
6
  export const IssueCommentSchema = Schema.Struct({
7
- id: Long.pipe(field(1, "Unique comment ID.")),
8
- version: version(2, "comment"),
9
- node_id: Schema.String.pipe(field(3, "GraphQL node ID of the comment.")),
10
- repository_id: Long.pipe(field(4, "ID of the repository the comment belongs to.")),
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
+ ),
11
15
  issue_number: Long.pipe(
12
- field(5, "Number of the issue or pull request the comment is on, in its repository."),
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." }),
13
22
  ),
14
- user: Schema.NullOr(user(100)).pipe(field(6, "Account that wrote the comment.")),
15
23
  author_association: Schema.String.pipe(
16
- field(7, "Author's relation to the repository, such as OWNER or CONTRIBUTOR."),
24
+ Schema.annotateKey({
25
+ description: "Author's relation to the repository, such as OWNER or CONTRIBUTOR.",
26
+ }),
17
27
  ),
18
- body: Text.pipe(field(8, "Comment in Markdown. Empty when not set.")),
19
- created_at: Timestamp.pipe(field(9, "Time the comment was written.")),
20
- html_url: Schema.String.pipe(field(10, "Comment on GitHub.")),
21
- _deleted: deleted(11, "comment"),
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"),
22
32
  })
23
33
  .annotate({
24
34
  description:
@@ -6,9 +6,7 @@ import {
6
6
  Text,
7
7
  Timestamp,
8
8
  deleted,
9
- field,
10
9
  label,
11
- list,
12
10
  milestone,
13
11
  optionalList,
14
12
  user,
@@ -16,32 +14,48 @@ import {
16
14
  } from "./shared";
17
15
 
18
16
  export const IssueSchema = Schema.Struct({
19
- id: Long.pipe(field(1, "Unique issue ID.")),
20
- version: version(2, "issue"),
21
- node_id: Schema.String.pipe(field(3, "GraphQL node ID of the issue.")),
22
- repository_id: Long.pipe(field(4, "ID of the repository the issue belongs to.")),
23
- number: Long.pipe(field(5, "Issue number in the repository.")),
24
- title: Schema.String.pipe(field(6, "Issue title.")),
25
- body: Text.pipe(field(7, "Issue description in Markdown. Empty when not set.")),
26
- state: Schema.String.pipe(field(8, "State: open or closed.")),
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." })),
27
29
  state_reason: Schema.NullOr(Schema.String).pipe(
28
- field(9, "Why the issue was closed or reopened, such as completed or not_planned."),
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." }),
29
39
  ),
30
- locked: Schema.Boolean.pipe(field(10, "Whether the conversation is locked.")),
31
- user: Schema.NullOr(user(100)).pipe(field(11, "Account that opened the issue.")),
32
40
  author_association: Schema.String.pipe(
33
- field(12, "Author's relation to the repository, such as OWNER or CONTRIBUTOR."),
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." }),
34
51
  ),
35
- labels: list(103, label(104)).pipe(field(13, "Labels on the issue.")),
36
- assignees: list(106, user(107)).pipe(field(14, "Accounts assigned to the issue.")),
37
- milestone: Schema.NullOr(milestone(110)).pipe(field(15, "Milestone of the issue.")),
38
- comments: Long.pipe(field(16, "Number of comments.")),
39
- created_at: Timestamp.pipe(field(17, "Time the issue was opened.")),
52
+ comments: Long.pipe(Schema.annotateKey({ description: "Number of comments." })),
53
+ created_at: Timestamp.pipe(Schema.annotateKey({ description: "Time the issue was opened." })),
40
54
  closed_at: Schema.NullOr(Timestamp).pipe(
41
- field(18, "Time the issue was closed. Null while it is open."),
55
+ Schema.annotateKey({ description: "Time the issue was closed. Null while it is open." }),
42
56
  ),
43
- html_url: Schema.String.pipe(field(19, "Issue page on GitHub.")),
44
- _deleted: deleted(20, "issue"),
57
+ html_url: Schema.String.pipe(Schema.annotateKey({ description: "Issue page on GitHub." })),
58
+ _deleted: deleted("issue"),
45
59
  })
46
60
  .annotate({
47
61
  description: "Issues in the installation's repositories. Pull requests are not included.",
@@ -53,8 +67,8 @@ export type Issue = Schema.Schema.Type<typeof IssueSchema>;
53
67
  export const IssueObjectSchema = IssueSchema.mapFields((fields) => ({
54
68
  ...Struct.omit(fields, ["version", "repository_id", "labels", "assignees", "_deleted"]),
55
69
  updated_at: Timestamp,
56
- labels: optionalList(label(104)),
57
- assignees: optionalList(user(107)),
70
+ labels: optionalList(label),
71
+ assignees: optionalList(user),
58
72
  // Set on pull requests, which the issues list also returns.
59
73
  pull_request: Schema.optionalKey(Schema.Unknown),
60
74
  }));
@@ -2,22 +2,36 @@ import { Iceberg } from "@useairfoil/connector-kit";
2
2
  import { Schema } from "effect";
3
3
 
4
4
  import { account, gitActor } from "./commits";
5
- import { Long, field } from "./shared";
5
+ import { Long } from "./shared";
6
6
 
7
7
  export const PullRequestCommitSchema = Schema.Struct({
8
8
  key: Schema.String.pipe(
9
- field(1, "Repository ID, pull request number, and SHA, such as `1406396726:3:9eb3a7d`."),
9
+ Schema.annotateKey({
10
+ description: "Repository ID, pull request number, and SHA, such as `1406396726:3:9eb3a7d`.",
11
+ }),
10
12
  ),
11
- version: Schema.Date.pipe(field(2, "Time GitHub last updated the pull request.")),
12
- repository_id: Long.pipe(field(3, "ID of the repository the pull request belongs to.")),
13
- pull_request_number: Long.pipe(field(4, "Pull request number in the repository.")),
14
- sha: Schema.String.pipe(field(5, "Commit SHA.")),
15
- message: Schema.String.pipe(field(6, "Commit message.")),
16
- author: gitActor(100).pipe(field(7, "Author name and time from the commit.")),
17
- committer: gitActor(102).pipe(field(8, "Committer name and time from the commit.")),
18
- author_user: account(104).pipe(field(9, "GitHub account of the author.")),
19
- committer_user: account(107).pipe(field(10, "GitHub account of the committer.")),
20
- html_url: Schema.String.pipe(field(11, "Commit page on GitHub.")),
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." })),
21
35
  })
22
36
  .annotate({
23
37
  description:
@@ -1,50 +1,68 @@
1
1
  import { Iceberg } from "@useairfoil/connector-kit";
2
2
  import { Schema, Struct } from "effect";
3
3
 
4
- import { Long, Timestamp, deleted, field, user, version } from "./shared";
4
+ import { Long, Timestamp, deleted, user, version } from "./shared";
5
5
 
6
6
  export const PullRequestReviewCommentSchema = Schema.Struct({
7
- id: Long.pipe(field(1, "Unique review comment ID.")),
8
- version: version(2, "review comment"),
9
- node_id: Schema.String.pipe(field(3, "GraphQL node ID of the review comment.")),
10
- repository_id: Long.pipe(field(4, "ID of the repository the comment belongs to.")),
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
+ ),
11
15
  pull_request_number: Long.pipe(
12
- field(5, "Number of the pull request the comment is on, in its repository."),
16
+ Schema.annotateKey({
17
+ description: "Number of the pull request the comment is on, in its repository.",
18
+ }),
13
19
  ),
14
20
  pull_request_review_id: Schema.NullOr(Long).pipe(
15
- field(6, "ID of the review the comment belongs to."),
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." }),
16
28
  ),
17
- in_reply_to_id: Schema.optionalKey(Long).pipe(field(7, "ID of the comment this one replies to.")),
18
- user: Schema.NullOr(user(100)).pipe(field(8, "Account that wrote the comment.")),
19
29
  author_association: Schema.String.pipe(
20
- field(9, "Author's relation to the repository, such as OWNER or CONTRIBUTOR."),
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." }),
21
40
  ),
22
- body: Schema.String.pipe(field(10, "Comment in Markdown.")),
23
- path: Schema.String.pipe(field(11, "Path of the file the comment is on.")),
24
- commit_id: Schema.String.pipe(field(12, "SHA of the commit the comment is on now.")),
25
41
  original_commit_id: Schema.String.pipe(
26
- field(13, "SHA of the commit the comment was written on."),
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." }),
27
46
  ),
28
- diff_hunk: Schema.String.pipe(field(14, "Part of the diff the comment is on.")),
29
47
  // GitHub sends null for a comment on a line that is no longer in the diff.
30
48
  line: Schema.optionalKey(Schema.NullOr(Long)).pipe(
31
- field(15, "Last line of the commented range in the current diff."),
49
+ Schema.annotateKey({ description: "Last line of the commented range in the current diff." }),
32
50
  ),
33
51
  original_line: Schema.optionalKey(Schema.NullOr(Long)).pipe(
34
- field(16, "Last line of the commented range in the original diff."),
52
+ Schema.annotateKey({ description: "Last line of the commented range in the original diff." }),
35
53
  ),
36
54
  start_line: Schema.optionalKey(Schema.NullOr(Long)).pipe(
37
- field(17, "First line of a multi-line comment."),
55
+ Schema.annotateKey({ description: "First line of a multi-line comment." }),
38
56
  ),
39
57
  side: Schema.optionalKey(Schema.NullOr(Schema.String)).pipe(
40
- field(18, "Side of the diff: LEFT or RIGHT."),
58
+ Schema.annotateKey({ description: "Side of the diff: LEFT or RIGHT." }),
41
59
  ),
42
60
  subject_type: Schema.optionalKey(Schema.String).pipe(
43
- field(19, "What the comment is on: line or file."),
61
+ Schema.annotateKey({ description: "What the comment is on: line or file." }),
44
62
  ),
45
- created_at: Timestamp.pipe(field(20, "Time the comment was written.")),
46
- html_url: Schema.String.pipe(field(21, "Comment on GitHub.")),
47
- _deleted: deleted(22, "review comment"),
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"),
48
66
  })
49
67
  .annotate({
50
68
  description: "Review comments on pull request diffs.",
@@ -1,27 +1,43 @@
1
1
  import { Iceberg } from "@useairfoil/connector-kit";
2
2
  import { Schema, Struct } from "effect";
3
3
 
4
- import { Long, Timestamp, field, readVersion, user } from "./shared";
4
+ import { Long, Timestamp, readVersion, user } from "./shared";
5
5
 
6
6
  export const PullRequestReviewSchema = Schema.Struct({
7
- id: Long.pipe(field(1, "Unique review ID.")),
8
- version: readVersion(2, "review"),
9
- node_id: Schema.String.pipe(field(3, "GraphQL node ID of the review.")),
10
- repository_id: Long.pipe(field(4, "ID of the repository the review belongs to.")),
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
+ ),
11
15
  pull_request_number: Long.pipe(
12
- field(5, "Number of the pull request the review is on, in its repository."),
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." }),
13
22
  ),
14
- user: Schema.NullOr(user(100)).pipe(field(6, "Account that wrote the review.")),
15
23
  author_association: Schema.String.pipe(
16
- field(7, "Author's relation to the repository, such as OWNER or CONTRIBUTOR."),
24
+ Schema.annotateKey({
25
+ description: "Author's relation to the repository, such as OWNER or CONTRIBUTOR.",
26
+ }),
17
27
  ),
18
28
  state: Schema.String.pipe(
19
- field(8, "State, such as APPROVED, CHANGES_REQUESTED, COMMENTED, or DISMISSED."),
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." }),
20
39
  ),
21
- body: Schema.String.pipe(field(9, "Review summary in Markdown.")),
22
- commit_id: Schema.NullOr(Schema.String).pipe(field(10, "SHA of the commit the review is on.")),
23
- submitted_at: Schema.optionalKey(Timestamp).pipe(field(11, "Time the review was submitted.")),
24
- html_url: Schema.String.pipe(field(12, "Review on GitHub.")),
40
+ html_url: Schema.String.pipe(Schema.annotateKey({ description: "Review on GitHub." })),
25
41
  })
26
42
  .annotate({
27
43
  description: "Reviews on pull requests. Pending reviews are only visible to their author.",
@@ -1,55 +1,75 @@
1
1
  import { Iceberg } from "@useairfoil/connector-kit";
2
2
  import { Schema, Struct } from "effect";
3
3
 
4
- import {
5
- Long,
6
- Text,
7
- Timestamp,
8
- field,
9
- label,
10
- list,
11
- milestone,
12
- optionalList,
13
- user,
14
- version,
15
- } from "./shared";
4
+ import { Long, Text, Timestamp, label, milestone, optionalList, user, version } from "./shared";
16
5
 
17
- const branch = (baseId: number) =>
18
- Schema.Struct({
19
- ref: Schema.String.pipe(field(baseId, "Branch name.")),
20
- sha: Schema.String.pipe(field(baseId + 1, "Commit SHA.")),
21
- label: Schema.String.pipe(field(baseId + 2, "Owner and branch, such as octocat:main.")),
22
- });
6
+ const branch = Schema.Struct({
7
+ ref: Schema.String.pipe(Schema.annotateKey({ description: "Branch name." })),
8
+ sha: Schema.String.pipe(Schema.annotateKey({ description: "Commit SHA." })),
9
+ label: Schema.String.pipe(
10
+ Schema.annotateKey({ description: "Owner and branch, such as octocat:main." }),
11
+ ),
12
+ });
23
13
 
24
14
  export const PullRequestSchema = Schema.Struct({
25
- id: Long.pipe(field(1, "Unique pull request ID. Not the ID of its issue.")),
26
- version: version(2, "pull request"),
27
- node_id: Schema.String.pipe(field(3, "GraphQL node ID of the pull request.")),
28
- repository_id: Long.pipe(field(4, "ID of the repository the pull request belongs to.")),
29
- number: Long.pipe(field(5, "Pull request number in the repository.")),
30
- title: Schema.String.pipe(field(6, "Pull request title.")),
31
- body: Text.pipe(field(7, "Pull request description in Markdown. Empty when not set.")),
32
- state: Schema.String.pipe(field(8, "State: open or closed. Merged pull requests are closed.")),
33
- draft: Schema.optionalKey(Schema.Boolean).pipe(field(9, "Whether the pull request is a draft.")),
34
- locked: Schema.Boolean.pipe(field(10, "Whether the conversation is locked.")),
35
- user: Schema.NullOr(user(100)).pipe(field(11, "Account that opened the pull request.")),
15
+ id: Long.pipe(
16
+ Schema.annotateKey({ description: "Unique pull request ID. Not the ID of its issue." }),
17
+ ),
18
+ version: version("pull request"),
19
+ node_id: Schema.String.pipe(
20
+ Schema.annotateKey({ description: "GraphQL node ID of the pull request." }),
21
+ ),
22
+ repository_id: Long.pipe(
23
+ Schema.annotateKey({ description: "ID of the repository the pull request belongs to." }),
24
+ ),
25
+ number: Long.pipe(Schema.annotateKey({ description: "Pull request number in the repository." })),
26
+ title: Schema.String.pipe(Schema.annotateKey({ description: "Pull request title." })),
27
+ body: Text.pipe(
28
+ Schema.annotateKey({
29
+ description: "Pull request description in Markdown. Empty when not set.",
30
+ }),
31
+ ),
32
+ state: Schema.String.pipe(
33
+ Schema.annotateKey({ description: "State: open or closed. Merged pull requests are closed." }),
34
+ ),
35
+ draft: Schema.optionalKey(Schema.Boolean).pipe(
36
+ Schema.annotateKey({ description: "Whether the pull request is a draft." }),
37
+ ),
38
+ locked: Schema.Boolean.pipe(
39
+ Schema.annotateKey({ description: "Whether the conversation is locked." }),
40
+ ),
41
+ user: Schema.NullOr(user).pipe(
42
+ Schema.annotateKey({ description: "Account that opened the pull request." }),
43
+ ),
36
44
  author_association: Schema.String.pipe(
37
- field(12, "Author's relation to the repository, such as OWNER or CONTRIBUTOR."),
45
+ Schema.annotateKey({
46
+ description: "Author's relation to the repository, such as OWNER or CONTRIBUTOR.",
47
+ }),
48
+ ),
49
+ labels: Schema.Array(label).pipe(
50
+ Schema.annotateKey({ description: "Labels on the pull request." }),
51
+ ),
52
+ assignees: Schema.Array(user).pipe(
53
+ Schema.annotateKey({ description: "Accounts assigned to the pull request." }),
38
54
  ),
39
- labels: list(103, label(104)).pipe(field(13, "Labels on the pull request.")),
40
- assignees: list(106, user(107)).pipe(field(14, "Accounts assigned to the pull request.")),
41
- requested_reviewers: list(110, user(111)).pipe(
42
- field(15, "Accounts asked to review that have not reviewed yet."),
55
+ requested_reviewers: Schema.Array(user).pipe(
56
+ Schema.annotateKey({ description: "Accounts asked to review that have not reviewed yet." }),
57
+ ),
58
+ milestone: Schema.NullOr(milestone).pipe(
59
+ Schema.annotateKey({ description: "Milestone of the pull request." }),
60
+ ),
61
+ head: branch.pipe(Schema.annotateKey({ description: "Branch the changes come from." })),
62
+ base: branch.pipe(Schema.annotateKey({ description: "Branch the changes merge into." })),
63
+ created_at: Timestamp.pipe(
64
+ Schema.annotateKey({ description: "Time the pull request was opened." }),
43
65
  ),
44
- milestone: Schema.NullOr(milestone(114)).pipe(field(16, "Milestone of the pull request.")),
45
- head: branch(117).pipe(field(17, "Branch the changes come from.")),
46
- base: branch(120).pipe(field(18, "Branch the changes merge into.")),
47
- created_at: Timestamp.pipe(field(19, "Time the pull request was opened.")),
48
66
  closed_at: Schema.NullOr(Timestamp).pipe(
49
- field(20, "Time the pull request was closed. Null while it is open."),
67
+ Schema.annotateKey({ description: "Time the pull request was closed. Null while it is open." }),
68
+ ),
69
+ merged_at: Schema.NullOr(Timestamp).pipe(
70
+ Schema.annotateKey({ description: "Time the pull request was merged." }),
50
71
  ),
51
- merged_at: Schema.NullOr(Timestamp).pipe(field(21, "Time the pull request was merged.")),
52
- html_url: Schema.String.pipe(field(22, "Pull request page on GitHub.")),
72
+ html_url: Schema.String.pipe(Schema.annotateKey({ description: "Pull request page on GitHub." })),
53
73
  })
54
74
  .annotate({
55
75
  description: "Pull requests in the installation's repositories.",
@@ -67,9 +87,9 @@ export const PullRequestObjectSchema = PullRequestSchema.mapFields((fields) => (
67
87
  "requested_reviewers",
68
88
  ]),
69
89
  updated_at: Timestamp,
70
- labels: optionalList(label(104)),
71
- assignees: optionalList(user(107)),
72
- requested_reviewers: optionalList(user(111)),
90
+ labels: optionalList(label),
91
+ assignees: optionalList(user),
92
+ requested_reviewers: optionalList(user),
73
93
  }));
74
94
 
75
95
  export type PullRequestObject = Schema.Schema.Type<typeof PullRequestObjectSchema>;