@shivaedev/github 0.6.0 → 0.7.1

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/README.md CHANGED
@@ -24,19 +24,13 @@ import { FetchHttpClient } from "effect/http";
24
24
  import { GitHub, list, read, write } from "@shivaedev/github/GitHub.ts";
25
25
  import { GitHubToken } from "@shivaedev/github/GitHubToken.ts";
26
26
 
27
- const github = GitHub.layer.pipe(
28
- Layer.provide(FetchHttpClient.layer),
29
- Layer.provide(GitHubToken.fromEnv),
30
- );
27
+ const github = GitHub.layer.pipe(Layer.provide(FetchHttpClient.layer), Layer.provide(GitHubToken.fromEnv));
31
28
  const Issue = Schema.Struct({ number: Schema.Number, title: Schema.String });
32
29
  const program = Effect.gen(function* () {
33
- const issue = yield* read("/repos/acme/widgets/issues/1", Issue);
34
- const first = yield* list("/repos/acme/widgets/issues", Issue).pipe(
35
- Stream.take(1),
36
- Stream.runCollect,
37
- );
38
- const created = yield* write("POST", "/repos/acme/widgets/issues", { title: "A new issue" }, Issue);
39
- return { issue, first, created };
30
+ const issue = yield* read("/repos/acme/widgets/issues/1", Issue);
31
+ const first = yield* list("/repos/acme/widgets/issues", Issue).pipe(Stream.take(1), Stream.runCollect);
32
+ const created = yield* write("POST", "/repos/acme/widgets/issues", { title: "A new issue" }, Issue);
33
+ return { issue, first, created };
40
34
  });
41
35
 
42
36
  await Effect.runPromise(program.pipe(Effect.provide(github)));
@@ -54,12 +48,14 @@ For large comparisons and listings, allow up to 16 MiB through the same bounded,
54
48
  import { GitHubConfig } from "@shivaedev/github/GitHubConfig.ts";
55
49
 
56
50
  const largeGithub = GitHub.layer.pipe(
57
- Layer.provide(FetchHttpClient.layer),
58
- Layer.provide(GitHubToken.fromEnv),
59
- Layer.provide(Layer.succeed(GitHubConfig)({
60
- apiUrl: "https://api.github.com",
61
- responseByteLimit: 16 * 1024 * 1024,
62
- })),
51
+ Layer.provide(FetchHttpClient.layer),
52
+ Layer.provide(GitHubToken.fromEnv),
53
+ Layer.provide(
54
+ Layer.succeed(GitHubConfig)({
55
+ apiUrl: "https://api.github.com",
56
+ responseByteLimit: 16 * 1024 * 1024,
57
+ }),
58
+ ),
63
59
  );
64
60
  const Comparison = Schema.Struct({ total_commits: Schema.Number });
65
61
  const comparison = read("/repos/acme/widgets/compare/main...feature", Comparison, 16 * 1024 * 1024);
@@ -71,12 +67,20 @@ For diff text and other raw bodies, obtain the service and call `text(path, acce
71
67
 
72
68
  ```ts
73
69
  const diff = Effect.gen(function* () {
74
- const github = yield* GitHub;
75
- return yield* github.text("/repos/acme/widgets/pulls/1", "application/vnd.github.diff", 256 * 1024);
70
+ const github = yield* GitHub;
71
+ return yield* github.text("/repos/acme/widgets/pulls/1", "application/vnd.github.diff", 256 * 1024);
76
72
  });
77
73
  ```
78
74
 
79
- The service's `read(path)` and `write(method, path, body)` return a representation with a generic `decode(schema)` method. Its `list(path)` returns an Effect containing a Stream of page representations. These methods accept the same trailing byte limit: `read(path, byteLimit)`, `write(method, path, body, byteLimit)` and `list(path, beforeRequest, byteLimit)`; pass `undefined` for `beforeRequest` when no pacing callback is needed. Prefer the exported functions for Schema-decoded items. A caller with a pacing policy can pass `github.list(path, beforeRequest)`: the callback receives the resource name before each page request, and its typed failure stops the stream. `github.resource(path)` returns the observed resource for that path, defaulting to core or search before the first response.
75
+ The service's `read(path)` and `write(method, path, body)` return a representation with a generic `decode(schema)` method. Its `list(path)` returns an Effect containing a Stream of page representations. These methods accept the same trailing byte limit: `read(path, byteLimit)`, `write(method, path, body, byteLimit)` and `list(path, beforeRequest, byteLimit)`; pass `undefined` for `beforeRequest` when no pacing callback is needed. Prefer the exported functions for Schema-decoded items. Each page representation exposes `hasNext`, which reports whether its Link header names a next page without fetching it. A caller with a pacing policy can pass `github.list(path, beforeRequest)`: the callback receives the resource name before each page request, and its typed failure stops the stream. `github.resource(path)` returns the observed resource for that path, defaulting to core or search before the first response.
76
+
77
+ Use `listBounded(path, itemSchema, pageCap, byteLimit?)` to collect a prefix within a positive page cap. It returns `{ items, truncated }`; `truncated` is true exactly when the last fetched page names a next page. It never requests or decodes a page beyond the cap, and uses the same pagination and per-page byte limits as `list`.
78
+
79
+ ```ts
80
+ import { listBounded } from "@shivaedev/github/GitHub.ts";
81
+
82
+ const issues = listBounded("/repos/acme/widgets/issues", Issue, 2);
83
+ ```
80
84
 
81
85
  ### Acting as a GitHub App
82
86
 
@@ -89,19 +93,19 @@ import { GitHub, list, read } from "@shivaedev/github/GitHub.ts";
89
93
  import { githubApp } from "@shivaedev/github/githubApp.ts";
90
94
 
91
95
  const clients = (privateKey: Redacted.Redacted<string>) => {
92
- const credentials = { appId: "123456", privateKey };
93
- const client = (auth: ReturnType<typeof githubApp>) => GitHub.layer.pipe(
94
- Layer.provide(auth),
95
- Layer.provide(FetchHttpClient.layer),
96
- );
97
- return {
98
- app: client(githubApp(credentials)),
99
- background: client(githubApp({ ...credentials, installationId: 7 })),
100
- accessCheck: client(githubApp({
101
- ...credentials, installationId: 7,
102
- scope: { repositoryIds: [42], permissions: { metadata: "read" } },
103
- })),
104
- };
96
+ const credentials = { appId: "123456", privateKey };
97
+ const client = (auth: ReturnType<typeof githubApp>) => GitHub.layer.pipe(Layer.provide(auth), Layer.provide(FetchHttpClient.layer));
98
+ return {
99
+ app: client(githubApp(credentials)),
100
+ background: client(githubApp({ ...credentials, installationId: 7 })),
101
+ accessCheck: client(
102
+ githubApp({
103
+ ...credentials,
104
+ installationId: 7,
105
+ scope: { repositoryIds: [42], permissions: { metadata: "read" } },
106
+ }),
107
+ ),
108
+ };
105
109
  };
106
110
  const appInfo = read("/app", Schema.Struct({ id: Schema.Number, slug: Schema.String }));
107
111
  const installations = list("/app/installations", Schema.Struct({ id: Schema.Number })).pipe(Stream.runCollect);
@@ -129,20 +133,24 @@ import { Effect } from "effect";
129
133
  import { GitHub } from "@shivaedev/github/GitHub.ts";
130
134
 
131
135
  const archive = Effect.gen(function* () {
132
- const github = yield* GitHub;
133
- return yield* github.downloadArtifactArchive({
134
- owner: "acme", repo: "widgets", artifactId: 7,
135
- byteLimit: 10 * 1024 * 1024,
136
- });
136
+ const github = yield* GitHub;
137
+ return yield* github.downloadArtifactArchive({
138
+ owner: "acme",
139
+ repo: "widgets",
140
+ artifactId: 7,
141
+ byteLimit: 10 * 1024 * 1024,
142
+ });
137
143
  });
138
144
  ```
139
145
 
140
- Provide the same `appClient(privateKey)` Layer shown above. The result is a `Uint8Array` of archive bytes. The package counts bytes while streaming, independently of transport limits, and stops on overflow with `GitHubArtifactTooLarge({ limit })` from `errors.ts`. This replaces application-owned redirect handling and archive body limits. It does not extract the ZIP.
146
+ Provide an installation client such as `clients(privateKey).background` from the GitHub App example above. The result is a `Uint8Array` of archive bytes. The package counts bytes while streaming, independently of transport limits, and stops on overflow with `GitHubArtifactTooLarge({ limit })` from `errors.ts`. This replaces application-owned redirect handling and archive body limits. It does not extract the ZIP.
141
147
 
142
148
  A missing (404) or expired (410) artifact fails with `GitHubArtifactError({ stage: "redirect", status })`. A storage HTTP failure uses the same error with `stage: "download"`. Transport and GitHub rate-limit failures retain their usual typed errors.
143
149
 
144
150
  ### Verifying webhooks
145
151
 
152
+ Use [`@shivaedev/webhooks`](https://github.com/ShivaeDev/platform/tree/main/packages/webhooks#readme) to receive deliveries through the application host with receipts, deduplication and transactional job enqueueing. This package owns signature verification only.
153
+
146
154
  Pass the raw request bytes and the `X-Hub-Signature-256` header to `verifyWebhook` before parsing the body. It checks HMAC SHA-256 with a constant-time comparison, then decodes JSON with your Schema. A missing header, tampered body or wrong secret fails with `GitHubWebhookSignatureError` before Schema decoding.
147
155
 
148
156
  ```ts
@@ -150,17 +158,14 @@ import { Redacted, Schema } from "effect";
150
158
  import { verifyWebhook } from "@shivaedev/github/verifyWebhook.ts";
151
159
 
152
160
  const WorkflowRun = Schema.Struct({
153
- action: Schema.String,
154
- workflowRun: Schema.Struct({ id: Schema.Number, conclusion: Schema.String }),
161
+ action: Schema.String,
162
+ workflowRun: Schema.Struct({ id: Schema.Number, conclusion: Schema.String }),
155
163
  }).pipe(Schema.encodeKeys({ workflowRun: "workflow_run" }));
156
- const receiveWorkflowRun = (
157
- rawBody: Uint8Array,
158
- signature: string | undefined,
159
- secret: Redacted.Redacted<string>,
160
- ) => verifyWebhook(rawBody, signature, secret, WorkflowRun);
164
+ const receiveWorkflowRun = (rawBody: Uint8Array, signature: string | undefined, secret: Redacted.Redacted<string>) =>
165
+ verifyWebhook(rawBody, signature, secret, WorkflowRun);
161
166
  ```
162
167
 
163
- This decodes a signed `workflow_run` delivery with the fields the application needs. Keep the body bytes as received: parsing and reserializing JSON changes what was signed.
168
+ Omit the Schema argument to verify the signature only, without decoding the body. With a Schema, this decodes a signed `workflow_run` delivery with the fields the application needs. Keep the body bytes as received: parsing and reserializing JSON changes what was signed.
164
169
 
165
170
  ### Sticky comments and check runs
166
171
 
@@ -170,31 +175,40 @@ For a GitHub App, pass its numeric `appId`. Matching then requires the body to s
170
175
 
171
176
  ```ts
172
177
  const report = Effect.gen(function* () {
173
- const github = yield* GitHub;
174
- return yield* github.upsertStickyComment({
175
- owner: "acme", repo: "widgets", number: 1,
176
- marker: "coverage", appId: 123456,
177
- body: "Coverage: 90%",
178
- });
178
+ const github = yield* GitHub;
179
+ return yield* github.upsertStickyComment({
180
+ owner: "acme",
181
+ repo: "widgets",
182
+ number: 1,
183
+ marker: "coverage",
184
+ appId: 123456,
185
+ body: "Coverage: 90%",
186
+ });
179
187
  });
180
188
  ```
181
189
 
182
- `createCheckRun(owner, repo, input)` creates a check for `headSha` with a name and status. `updateCheckRun(owner, repo, id, input)` moves it to `in_progress` or `completed`; completion requires a conclusion. Output contains `title`, `summary` and optional `text`. Request and response Schemas are exported from `checkRuns.ts`.
190
+ `createCheckRun(owner, repo, input)` creates a check for `headSha` with a name and status. `updateCheckRun(owner, repo, id, input)` moves it to `in_progress` or `completed`; completion requires a conclusion. Output contains `title`, `summary` and optional `text`. An optional `detailsUrl` on creation and either update shape links to an external report; the returned `CheckRun.detailsUrl` is the GitHub URL or `null` when none exists. It is sent and decoded as `details_url`. Request and response Schemas are exported from `checkRuns.ts`.
183
191
 
184
192
  ```ts
185
- const check = (headSha: string) => Effect.gen(function* () {
186
- const github = yield* GitHub;
187
- const created = yield* github.createCheckRun("acme", "widgets", {
188
- headSha, name: "Coverage", status: "queued",
189
- });
190
- yield* github.updateCheckRun("acme", "widgets", created.id, {
191
- status: "in_progress", output: { title: "Coverage", summary: "Measuring" },
192
- });
193
- return yield* github.updateCheckRun("acme", "widgets", created.id, {
194
- status: "completed", conclusion: "success",
195
- output: { title: "Coverage", summary: "90% covered", text: "All targets measured" },
196
- });
197
- });
193
+ const check = (headSha: string) =>
194
+ Effect.gen(function* () {
195
+ const github = yield* GitHub;
196
+ const created = yield* github.createCheckRun("acme", "widgets", {
197
+ headSha,
198
+ name: "Coverage",
199
+ status: "queued",
200
+ detailsUrl: "https://reports.example/coverage",
201
+ });
202
+ yield* github.updateCheckRun("acme", "widgets", created.id, {
203
+ status: "in_progress",
204
+ output: { title: "Coverage", summary: "Measuring" },
205
+ });
206
+ return yield* github.updateCheckRun("acme", "widgets", created.id, {
207
+ status: "completed",
208
+ conclusion: "success",
209
+ output: { title: "Coverage", summary: "90% covered", text: "All targets measured" },
210
+ });
211
+ });
198
212
  ```
199
213
 
200
214
  ### Rendering untrusted text
@@ -205,12 +219,10 @@ Use the pure helpers from `markdown.ts` for test names and error messages. `plai
205
219
  import { tableCell } from "@shivaedev/github/markdown.ts";
206
220
  import { renderRows } from "@shivaedev/github/markdownRows.ts";
207
221
 
208
- const rows = failures.map(({ name, error }) =>
209
- `| ${tableCell(name)} | ${tableCell(error, "code")} |`,
210
- );
222
+ const rows = failures.map(({ name, error }) => `| ${tableCell(name)} | ${tableCell(error, "code")} |`);
211
223
  const summary = renderRows(rows, {
212
- header: "| Test | Error |\n| --- | --- |",
213
- byteLimit: 8_000,
224
+ header: "| Test | Error |\n| --- | --- |",
225
+ byteLimit: 8_000,
214
226
  });
215
227
  ```
216
228
 
@@ -226,15 +238,17 @@ A 403 with `"Resource not accessible by integration"` fails with `GitHubPermissi
226
238
 
227
239
  ```ts
228
240
  const publishReport = report.pipe(
229
- Effect.catchTag("GitHubPermissionDenied", ({ path }) =>
230
- Effect.succeed({ published: false, reason: "permissions", path }),
231
- ),
232
- Effect.catchTag("GitHubConversationLocked", ({ path }) =>
233
- Effect.succeed({ published: false, reason: "locked", path }),
234
- ),
241
+ Effect.catchTag("GitHubPermissionDenied", ({ path }) => Effect.succeed({ published: false, reason: "permissions", path })),
242
+ Effect.catchTag("GitHubConversationLocked", ({ path }) => Effect.succeed({ published: false, reason: "locked", path })),
235
243
  );
236
244
  ```
237
245
 
238
246
  Other HTTP status failures use the typed `RemoteNotFound`, `RemoteUnauthorized` and other errors from `@shivaedev/http/errors.ts`. An oversized body fails with `ResponseBodyTooLarge`; invalid response data fails with `Schema.SchemaError`. Transport failures use `GitHubTransportError`, which contains only the request path.
239
247
 
240
- Install with `pnpm add @shivaedev/github effect`. Choose and provide an Effect HTTP client appropriate to your runtime. Scheduling, retries beyond the single installation-token refresh, and application policy stay with the caller.
248
+ ### Install and limits
249
+
250
+ ```sh
251
+ pnpm add @shivaedev/github effect
252
+ ```
253
+
254
+ `effect` is a peer dependency, and the package needs Node.js 24 or later. Choose and provide an Effect HTTP client appropriate to your runtime. Scheduling, retries beyond the single installation-token refresh, and application policy stay with the caller.
package/dist/GitHub.d.ts CHANGED
@@ -5,6 +5,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
5
5
  readonly downloadArtifactArchive: (options: import("#artifacts.ts").ArtifactArchiveOptions) => Effect.Effect<Uint8Array<ArrayBuffer>, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubArtifactError | import("./errors.ts").GitHubArtifactTooLarge | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge, never>;
6
6
  readonly list: (path: string, beforeRequest?: ((resource: string) => Effect.Effect<void, import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable>) | undefined, byteLimit?: number | undefined) => Effect.Effect<Stream.Stream<{
7
7
  decode: <TSchema extends Schema.Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], Schema.SchemaError, TSchema["DecodingServices"]>;
8
+ hasNext: boolean;
8
9
  }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable | import("@shivaedev/http/errors.ts").RemoteStatusError, never>, never, never>;
9
10
  readonly read: (path: string, byteLimit?: number | undefined) => Effect.Effect<{
10
11
  decode: <TSchema extends Schema.Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], Schema.SchemaError, TSchema["DecodingServices"]>;
@@ -14,6 +15,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
14
15
  }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("effect/http/HttpBody").HttpBodyError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
15
16
  readonly createCheckRun: (owner: string, repo: string, input: {
16
17
  readonly conclusion?: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out" | undefined;
18
+ readonly detailsUrl?: string | undefined;
17
19
  readonly headSha: string;
18
20
  readonly name: string;
19
21
  readonly output?: {
@@ -24,6 +26,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
24
26
  readonly status: "completed" | "in_progress" | "queued";
25
27
  }) => Effect.Effect<{
26
28
  readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out" | null;
29
+ readonly detailsUrl: string | null;
27
30
  readonly headSha: string;
28
31
  readonly id: number;
29
32
  readonly name: string;
@@ -35,6 +38,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
35
38
  readonly status: "completed" | "in_progress" | "queued";
36
39
  }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("effect/http/HttpBody").HttpBodyError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
37
40
  readonly updateCheckRun: (owner: string, repo: string, id: number, input: {
41
+ readonly detailsUrl?: string | undefined;
38
42
  readonly output?: {
39
43
  readonly summary: string;
40
44
  readonly text?: string | undefined;
@@ -43,6 +47,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
43
47
  readonly status: "in_progress" | "queued";
44
48
  } | {
45
49
  readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out";
50
+ readonly detailsUrl?: string | undefined;
46
51
  readonly output?: {
47
52
  readonly summary: string;
48
53
  readonly text?: string | undefined;
@@ -51,6 +56,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
51
56
  readonly status: "completed";
52
57
  }) => Effect.Effect<{
53
58
  readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out" | null;
59
+ readonly detailsUrl: string | null;
54
60
  readonly headSha: string;
55
61
  readonly id: number;
56
62
  readonly name: string;
@@ -89,5 +95,9 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
89
95
  };
90
96
  export declare function read<TSchema extends Schema.Constraint>(path: string, schema: TSchema, responseByteLimit?: number): Effect.Effect<TSchema["Type"], import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, "@shivaedev/github/GitHub" | TSchema["DecodingServices"]>;
91
97
  export declare function list<TSchema extends Schema.Constraint>(path: string, schema: TSchema, responseByteLimit?: number): Stream.Stream<TSchema["Type"], import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable | import("@shivaedev/http/errors.ts").RemoteStatusError, "@shivaedev/github/GitHub" | TSchema["DecodingServices"]>;
98
+ export declare function listBounded<TSchema extends Schema.Constraint>(path: string, schema: TSchema, pageCap: number, responseByteLimit?: number): Effect.Effect<{
99
+ items: TSchema["Type"][];
100
+ truncated: boolean;
101
+ }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable | import("@shivaedev/http/errors.ts").RemoteStatusError, "@shivaedev/github/GitHub" | TSchema["DecodingServices"]>;
92
102
  export declare function write<TSchema extends Schema.Constraint>(method: "POST" | "PATCH", path: string, body: unknown, schema: TSchema, responseByteLimit?: number): Effect.Effect<TSchema["Type"], import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("effect/http/HttpBody").HttpBodyError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, "@shivaedev/github/GitHub" | TSchema["DecodingServices"]>;
93
103
  //# sourceMappingURL=GitHub.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GitHub.d.ts","sourceRoot":"","sources":["../src/GitHub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKzC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAO9C,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BjB,CAAC;AAEH,wBAAgB,IAAI,CAAC,OAAO,SAAS,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,CAAC,EAAE,MAAM,icAEhH;AAED,wBAAgB,IAAI,CAAC,OAAO,SAAS,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,CAAC,EAAE,MAAM,omBAKhH;AAED,wBAAgB,KAAK,CAAC,OAAO,SAAS,MAAM,CAAC,UAAU,EACtD,MAAM,EAAE,MAAM,GAAG,OAAO,EACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,OAAO,EACf,iBAAiB,CAAC,EAAE,MAAM,gfAK1B"}
1
+ {"version":3,"file":"GitHub.d.ts","sourceRoot":"","sources":["../src/GitHub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKzC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAO9C,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BjB,CAAC;AAEH,wBAAgB,IAAI,CAAC,OAAO,SAAS,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,CAAC,EAAE,MAAM,icAEhH;AAED,wBAAgB,IAAI,CAAC,OAAO,SAAS,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,CAAC,EAAE,MAAM,omBAKhH;AAED,wBAAgB,WAAW,CAAC,OAAO,SAAS,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM;;;qkBAOxI;AAED,wBAAgB,KAAK,CAAC,OAAO,SAAS,MAAM,CAAC,UAAU,EACtD,MAAM,EAAE,MAAM,GAAG,OAAO,EACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,OAAO,EACf,iBAAiB,CAAC,EAAE,MAAM,gfAK1B"}
package/dist/GitHub.js CHANGED
@@ -47,6 +47,9 @@ export function read(path, schema, responseByteLimit) {
47
47
  export function list(path, schema, responseByteLimit) {
48
48
  return Stream.unwrap(Effect.flatMap(GitHub, (github) => github.list(path, undefined, responseByteLimit))).pipe(Stream.mapEffect((response) => response.decode(Schema.Array(schema))), Stream.flatMap(Stream.fromIterable));
49
49
  }
50
+ export function listBounded(path, schema, pageCap, responseByteLimit) {
51
+ return Stream.unwrap(Effect.flatMap(GitHub, (github) => github.list(path, undefined, responseByteLimit))).pipe(Stream.take(pageCap), Stream.mapEffect((page) => Effect.map(page.decode(Schema.Array(schema)), (items) => ({ items, truncated: page.hasNext }))), Stream.runCollect, Effect.map((pages) => ({ items: pages.flatMap((page) => page.items), truncated: pages.at(-1)?.truncated ?? false })));
52
+ }
50
53
  export function write(method, path, body, schema, responseByteLimit) {
51
54
  return Effect.flatMap(GitHub, (github) => Effect.flatMap(github.write(method, path, body, responseByteLimit), (response) => response.decode(schema)));
52
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"GitHub.js","sourceRoot":"","sources":["../src/GitHub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAC;IACnC,EA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YAAY,CAAC,OAAmB;IAK/C,uBAAuB,YAAY,sBAAsB;EA8B1D"}
1
+ {"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../src/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAmB,UAAU,EAAqB,MAAM,aAAa,CAAC;AAI7E,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAChG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,SAAS,CACxB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,UAAU,CAAC,UAAU,EAC7B,KAAK,EAAE,WAAW,CAAC,SAAS,CAAC,EAC7B,KAAK,EAAE,UAAU,EACjB,OAAO,GAAE,OAAO,YAAY,CAAC,OAAmB;IAK/C,uBAAuB,YAAY,sBAAsB;EA8B1D"}
package/dist/artifacts.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Effect } from "effect";
2
2
  import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http";
3
+ import * as HttpStatus from "effect/http/HttpStatus";
3
4
  import { readBoundedBody } from "@shivaedev/http/body.ts";
4
5
  import { authenticatedRequest } from "./authenticatedRequest.js";
5
6
  import { GitHubArtifactError, GitHubArtifactTooLarge, GitHubTransportError } from "./errors.js";
@@ -14,11 +15,11 @@ export function artifacts(apiUrl, client, token, rates, refresh = undefined) {
14
15
  RemoteNotFound: (error) => Effect.fail(new GitHubArtifactError({ stage: "redirect", status: error.status })),
15
16
  }));
16
17
  const location = redirect.headers.location;
17
- if (redirect.status !== 302 || location === undefined) {
18
+ if (redirect.status !== HttpStatus.fromLiteral("Found") || location === undefined) {
18
19
  return yield* new GitHubArtifactError({ stage: "redirect", status: redirect.status });
19
20
  }
20
21
  const response = yield* download.get(location).pipe(Effect.provideService(FetchHttpClient.RequestInit, { credentials: "omit", redirect: "manual" }), Effect.mapError(() => new GitHubTransportError({ path })));
21
- if (response.status < 200 || response.status >= 300) {
22
+ if (response.status < HttpStatus.fromLiteral("OK") || response.status >= HttpStatus.fromLiteral("MultipleChoices")) {
22
23
  return yield* new GitHubArtifactError({ stage: "download", status: response.status });
23
24
  }
24
25
  return yield* readBoundedBody(response, options.byteLimit).pipe(Effect.catchTags({
@@ -1 +1 @@
1
- {"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../src/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAYhG,MAAM,UAAU,SAAS,CACxB,MAAc,EACd,MAA6B,EAC7B,KAA6B,EAC7B,KAAiB,EACjB,OAAO,GAAgC,SAAS;IAEhD,MAAM,IAAI,GAAG,oBAAoB,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACvF,MAAM,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,CAA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,IAAI,EAAE,CAAC,CAAC;gBACtE,oBAAoB,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,sBAAsB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;aACvF,CAAC,CACF,CAAC;QACH,CAAC,CAAC,CACF;KACF,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"authenticatedRequest.d.ts","sourceRoot":"","sources":["../src/authenticatedRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAoB,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAmB,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACxG,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,wBAAgB,oBAAoB,CAAC,CAAC,EACrC,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE,CAAC,CAAC,EACtE,KAAK,EAAE,WAAW,CAAC,SAAS,CAAC,EAC7B,KAAK,EAAE,UAAU,EACjB,OAAO,GAAE,OAAO,YAAY,CAAC,OAAmB,ueAqChD"}
1
+ {"version":3,"file":"authenticatedRequest.d.ts","sourceRoot":"","sources":["../src/authenticatedRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAoB,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAmB,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAExG,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,wBAAgB,oBAAoB,CAAC,CAAC,EACrC,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE,CAAC,CAAC,EACtE,KAAK,EAAE,WAAW,CAAC,SAAS,CAAC,EAC7B,KAAK,EAAE,UAAU,EACjB,OAAO,GAAE,OAAO,YAAY,CAAC,OAAmB,ueAqChD"}
@@ -1,5 +1,6 @@
1
1
  import { DateTime, Effect, Option, Redacted } from "effect";
2
2
  import { FetchHttpClient, HttpClientRequest } from "effect/http";
3
+ import * as HttpStatus from "effect/http/HttpStatus";
3
4
  import { GitHubTransportError } from "./errors.js";
4
5
  import { failRateLimited } from "./rateLimits.js";
5
6
  import { checkStatus, isUnauthorized, isUnchanged } from "./status.js";
@@ -23,7 +24,7 @@ export function authenticatedRequest(client, token, rates, refresh = undefined)
23
24
  response = yield* send(yield* accessToken);
24
25
  }
25
26
  const observedResource = rates.observe(response);
26
- if (!((mode === "revalidate" && isUnchanged(response)) || (mode === "manual" && response.status === 302))) {
27
+ if (!((mode === "revalidate" && isUnchanged(response)) || (mode === "manual" && response.status === HttpStatus.fromLiteral("Found")))) {
27
28
  yield* checkStatus(response, observedResource, rates.failures.get(observedResource) ?? 0).pipe(Effect.catchTag("HttpClientError", () => Effect.fail(new GitHubTransportError({ path }))), Effect.catchTag("GitHubRateLimited", (error) => {
28
29
  rates.blocked.set(error.resource, error);
29
30
  rates.failures.set(error.resource, (rates.failures.get(error.resource) ?? 0) + 1);
@@ -1 +1 @@
1
- {"version":3,"file":"authenticatedRequest.js","sourceRoot":"","sources":["../src/authenticatedRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,QAA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- import type { Representations } from "./representations.ts";
2
+ import type { Representations } from "#representations.ts";
3
3
  export declare const CheckRunOutput: Schema.Struct<{
4
4
  readonly summary: Schema.String;
5
5
  readonly text: Schema.optional<Schema.String>;
@@ -9,6 +9,7 @@ export declare const CheckRunConclusion: Schema.Literals<readonly ["action_requi
9
9
  export declare const CheckRunStatus: Schema.Literals<readonly ["queued", "in_progress", "completed"]>;
10
10
  export declare const CreateCheckRun: Schema.encodeKeys<Schema.Struct<{
11
11
  readonly conclusion: Schema.optional<Schema.Literals<readonly ["action_required", "cancelled", "failure", "neutral", "success", "skipped", "stale", "timed_out"]>>;
12
+ readonly detailsUrl: Schema.optional<Schema.String>;
12
13
  readonly headSha: Schema.String;
13
14
  readonly name: Schema.String;
14
15
  readonly output: Schema.optional<Schema.Struct<{
@@ -18,26 +19,34 @@ export declare const CreateCheckRun: Schema.encodeKeys<Schema.Struct<{
18
19
  }>>;
19
20
  readonly status: Schema.Literals<readonly ["queued", "in_progress", "completed"]>;
20
21
  }>, {
22
+ readonly detailsUrl: "details_url";
21
23
  readonly headSha: "head_sha";
22
24
  }>;
23
- export declare const UpdateCheckRun: Schema.Union<readonly [Schema.Struct<{
25
+ export declare const UpdateCheckRun: Schema.Union<readonly [Schema.encodeKeys<Schema.Struct<{
26
+ readonly detailsUrl: Schema.optional<Schema.String>;
24
27
  readonly output: Schema.optional<Schema.Struct<{
25
28
  readonly summary: Schema.String;
26
29
  readonly text: Schema.optional<Schema.String>;
27
30
  readonly title: Schema.String;
28
31
  }>>;
29
32
  readonly status: Schema.Literals<readonly ["queued", "in_progress"]>;
30
- }>, Schema.Struct<{
33
+ }>, {
34
+ readonly detailsUrl: "details_url";
35
+ }>, Schema.encodeKeys<Schema.Struct<{
31
36
  readonly conclusion: Schema.Literals<readonly ["action_required", "cancelled", "failure", "neutral", "success", "skipped", "stale", "timed_out"]>;
37
+ readonly detailsUrl: Schema.optional<Schema.String>;
32
38
  readonly output: Schema.optional<Schema.Struct<{
33
39
  readonly summary: Schema.String;
34
40
  readonly text: Schema.optional<Schema.String>;
35
41
  readonly title: Schema.String;
36
42
  }>>;
37
43
  readonly status: Schema.Literal<"completed">;
44
+ }>, {
45
+ readonly detailsUrl: "details_url";
38
46
  }>]>;
39
47
  export declare const CheckRun: Schema.encodeKeys<Schema.Struct<{
40
48
  readonly conclusion: Schema.NullOr<Schema.Literals<readonly ["action_required", "cancelled", "failure", "neutral", "success", "skipped", "stale", "timed_out"]>>;
49
+ readonly detailsUrl: Schema.NullOr<Schema.String>;
41
50
  readonly headSha: Schema.String;
42
51
  readonly id: Schema.Number;
43
52
  readonly name: Schema.String;
@@ -48,11 +57,13 @@ export declare const CheckRun: Schema.encodeKeys<Schema.Struct<{
48
57
  }>;
49
58
  readonly status: Schema.Literals<readonly ["queued", "in_progress", "completed"]>;
50
59
  }>, {
60
+ readonly detailsUrl: "details_url";
51
61
  readonly headSha: "head_sha";
52
62
  }>;
53
63
  export declare function checkRuns(client: Representations): {
54
64
  createCheckRun: (owner: string, repo: string, input: {
55
65
  readonly conclusion?: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out" | undefined;
66
+ readonly detailsUrl?: string | undefined;
56
67
  readonly headSha: string;
57
68
  readonly name: string;
58
69
  readonly output?: {
@@ -63,6 +74,7 @@ export declare function checkRuns(client: Representations): {
63
74
  readonly status: "completed" | "in_progress" | "queued";
64
75
  }) => Effect.Effect<{
65
76
  readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out" | null;
77
+ readonly detailsUrl: string | null;
66
78
  readonly headSha: string;
67
79
  readonly id: number;
68
80
  readonly name: string;
@@ -74,6 +86,7 @@ export declare function checkRuns(client: Representations): {
74
86
  readonly status: "completed" | "in_progress" | "queued";
75
87
  }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("effect/http/HttpBody").HttpBodyError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
76
88
  updateCheckRun: (owner: string, repo: string, id: number, input: {
89
+ readonly detailsUrl?: string | undefined;
77
90
  readonly output?: {
78
91
  readonly summary: string;
79
92
  readonly text?: string | undefined;
@@ -82,6 +95,7 @@ export declare function checkRuns(client: Representations): {
82
95
  readonly status: "in_progress" | "queued";
83
96
  } | {
84
97
  readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out";
98
+ readonly detailsUrl?: string | undefined;
85
99
  readonly output?: {
86
100
  readonly summary: string;
87
101
  readonly text?: string | undefined;
@@ -90,6 +104,7 @@ export declare function checkRuns(client: Representations): {
90
104
  readonly status: "completed";
91
105
  }) => Effect.Effect<{
92
106
  readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out" | null;
107
+ readonly detailsUrl: string | null;
93
108
  readonly headSha: string;
94
109
  readonly id: number;
95
110
  readonly name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"checkRuns.d.ts","sourceRoot":"","sources":["../src/checkRuns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,eAAO,MAAM,cAAc;;;;EAIzB,CAAC;AAEH,eAAO,MAAM,kBAAkB,8HAAsH,CAAC;AACtJ,eAAO,MAAM,cAAc,kEAA0D,CAAC;AAEtF,eAAO,MAAM,cAAc;;;;;;;;;;;;EAMwB,CAAC;AAEpD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;IAGzB,CAAC;AAEH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;EAO8B,CAAC;AAEpD,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe;IAE/C,cAAc;;;;;;;;;;;;;;;;;;;;;;IAKd,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMf"}
1
+ {"version":3,"file":"checkRuns.d.ts","sourceRoot":"","sources":["../src/checkRuns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,eAAO,MAAM,cAAc;;;;EAIzB,CAAC;AAEH,eAAO,MAAM,kBAAkB,8HAAsH,CAAC;AACtJ,eAAO,MAAM,cAAc,kEAA0D,CAAC;AAEtF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;EAOmD,CAAC;AAE/E,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;IAYzB,CAAC;AAEH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;EAQyD,CAAC;AAE/E,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe;IAE/C,cAAc;;;;;;;;;;;;;;;;;;;;;;;;IAKd,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMf"}
package/dist/checkRuns.js CHANGED
@@ -8,23 +8,34 @@ export const CheckRunConclusion = Schema.Literals(["action_required", "cancelled
8
8
  export const CheckRunStatus = Schema.Literals(["queued", "in_progress", "completed"]);
9
9
  export const CreateCheckRun = Schema.Struct({
10
10
  conclusion: Schema.optional(CheckRunConclusion),
11
+ detailsUrl: Schema.optional(Schema.String),
11
12
  headSha: Schema.String,
12
13
  name: Schema.String,
13
14
  output: Schema.optional(CheckRunOutput),
14
15
  status: CheckRunStatus,
15
- }).pipe(Schema.encodeKeys({ headSha: "head_sha" }));
16
+ }).pipe(Schema.encodeKeys({ detailsUrl: "details_url", headSha: "head_sha" }));
16
17
  export const UpdateCheckRun = Schema.Union([
17
- Schema.Struct({ output: Schema.optional(CheckRunOutput), status: Schema.Literals(["queued", "in_progress"]) }),
18
- Schema.Struct({ conclusion: CheckRunConclusion, output: Schema.optional(CheckRunOutput), status: Schema.Literal("completed") }),
18
+ Schema.Struct({
19
+ detailsUrl: Schema.optional(Schema.String),
20
+ output: Schema.optional(CheckRunOutput),
21
+ status: Schema.Literals(["queued", "in_progress"]),
22
+ }).pipe(Schema.encodeKeys({ detailsUrl: "details_url" })),
23
+ Schema.Struct({
24
+ conclusion: CheckRunConclusion,
25
+ detailsUrl: Schema.optional(Schema.String),
26
+ output: Schema.optional(CheckRunOutput),
27
+ status: Schema.Literal("completed"),
28
+ }).pipe(Schema.encodeKeys({ detailsUrl: "details_url" })),
19
29
  ]);
20
30
  export const CheckRun = Schema.Struct({
21
31
  conclusion: Schema.NullOr(CheckRunConclusion),
32
+ detailsUrl: Schema.NullOr(Schema.String),
22
33
  headSha: Schema.String,
23
34
  id: Schema.Number,
24
35
  name: Schema.String,
25
36
  output: Schema.Struct({ summary: Schema.NullOr(Schema.String), text: Schema.NullOr(Schema.String), title: Schema.NullOr(Schema.String) }),
26
37
  status: CheckRunStatus,
27
- }).pipe(Schema.encodeKeys({ headSha: "head_sha" }));
38
+ }).pipe(Schema.encodeKeys({ detailsUrl: "details_url", headSha: "head_sha" }));
28
39
  export function checkRuns(client) {
29
40
  return {
30
41
  createCheckRun: Effect.fn("GitHub.createCheckRun")(function* (owner, repo, input) {
@@ -1 +1 @@
1
- {"version":3,"file":"checkRuns.js","sourceRoot":"","sources":["../src/checkRuns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGxC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC,MAAM;CACpB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,QAAQ,C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App.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,EAA4B,MAAM,QAAQ,CAAC;AAC9F,OAAO,EAAE,UAAU,EAAqB,MAAM,aAAa,CAAC;AAG5D,OAAO,EAAE,KAAK,cAAc,EAAU,MAAM,YAAY,CAAC;AAGzD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAC5E,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C;AAED,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAC5C,CACG;IAAE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,iBAAiB,CAAA;CAAE,GACvE;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,iBAAiB,CAAA;CAAE,GAC3F;IAAE,QAAQ,CAAC,cAAc,CAAC,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAClH,CAAC;AAOH,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,0DAqClD"}
package/dist/githubApp.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Cache, Clock, Context, Effect, Exit, Layer, Option, Redacted, Schema } from "effect";
2
2
  import { HttpClient, HttpClientRequest } from "effect/http";
3
+ import * as HttpStatus from "effect/http/HttpStatus";
3
4
  import { readBoundedJson } from "@shivaedev/http/body.ts";
4
5
  import { appJwt } from "#appJwt.ts";
5
6
  import { GitHubAppError } from "#errors.ts";
@@ -46,7 +47,7 @@ function appRequests(client, apiUrl) {
46
47
  input = yield* HttpClientRequest.bodyJson(input, body).pipe(Effect.mapError(() => new GitHubAppError({ stage: "exchange" })));
47
48
  }
48
49
  const response = yield* client.execute(input).pipe(Effect.mapError(() => new GitHubAppError({ stage: "exchange" })));
49
- if (response.status < 200 || response.status >= 300) {
50
+ if (response.status < HttpStatus.fromLiteral("OK") || response.status >= HttpStatus.fromLiteral("MultipleChoices")) {
50
51
  return yield* new GitHubAppError({ stage: "exchange", status: response.status });
51
52
  }
52
53
  return yield* readBoundedJson(response, 64 * 1024, schema).pipe(Effect.mapError(() => new GitHubAppError({ stage: "exchange" })));
@@ -1 +1 @@
1
- {"version":3,"file":"githubApp.js","sourceRoot":"","sources":["../src/githubApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9F,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAuB,MAAM,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAehD,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC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,CAAC,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;QACrH,IAAI,QAAQ,CAAC,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,MAAM,IAAI,UAAU,CAAC,WAAW,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACpH,OAAO,KAAK,CAAC,CAAC,IAAI,cAAc,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QAClF,CAAC;QACD,OAAO,KAAK,CAAC,CAAC,eAAe,CAAC,QAAQ,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;IACnI,CAAC,CAAC,CAAC;AACJ,CAAC"}
@@ -6,6 +6,7 @@ export declare function representations(apiUrl: string, request: ReturnType<type
6
6
  get: (path: string, accept?: string) => HttpClientRequest.HttpClientRequest;
7
7
  list: (path: string, beforeRequest?: (resource: string) => Effect.Effect<void, ServiceUnavailable>, byteLimit?: number) => Effect.Effect<Stream.Stream<{
8
8
  decode: <TSchema extends import("effect/Schema").Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], import("effect/Schema").SchemaError, TSchema["DecodingServices"]>;
9
+ hasNext: boolean;
9
10
  }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | ServiceUnavailable | import("@shivaedev/http/errors.ts").RemoteStatusError, never>, never, never>;
10
11
  read: (path: string, byteLimit?: number) => Effect.Effect<{
11
12
  decode: <TSchema extends import("effect/Schema").Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], import("effect/Schema").SchemaError, TSchema["DecodingServices"]>;
@@ -1 +1 @@
1
- {"version":3,"file":"representations.d.ts","sourceRoot":"","sources":["../src/representations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAc,iBAAiB,EAA2B,MAAM,aAAa,CAAC;AACrF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAIxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,wBAAgB,eAAe,CAC9B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,EACpC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EAClC,iBAAiB,SAAc;gBAEZ,MAAM;iBAOlB,MAAM,kBACI,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,kBAAkB,CAAC;;;iBAL5C,MAAM;;;oBA6BH,MAAM,GAAG,OAAO,QAAQ,MAAM,QAAQ,OAAO;;;EAQlF;AAED,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,EAAE,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"representations.d.ts","sourceRoot":"","sources":["../src/representations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAc,iBAAiB,EAA2B,MAAM,aAAa,CAAC;AACrF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAKxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,wBAAgB,eAAe,CAC9B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,EACpC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EAClC,iBAAiB,SAAc;gBAEZ,MAAM;iBAOlB,MAAM,kBACI,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,kBAAkB,CAAC;;;;iBAL5C,MAAM;;;oBA6BH,MAAM,GAAG,OAAO,QAAQ,MAAM,QAAQ,OAAO;;;EAQlF;AAED,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,EAAE,KAAK,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { Effect, Stream } from "effect";
2
2
  import { HttpClient, HttpClientRequest } from "effect/http";
3
+ import { nextLink } from "@shivaedev/http/nextLink.ts";
3
4
  import { paginate } from "@shivaedev/http/paginate.ts";
4
5
  import { jsonResponse } from "#json.ts";
5
6
  export function representations(apiUrl, request, resource, responseByteLimit = 1024 * 1024) {
@@ -18,7 +19,7 @@ export function representations(apiUrl, request, resource, responseByteLimit = 1
18
19
  }));
19
20
  }
20
21
  const client = HttpClient.makeWith((effect) => Effect.flatMap(effect, fetchPage), Effect.succeed);
21
- return Effect.succeed(paginate(client, get(path)).pipe(Stream.mapEffect((response) => Effect.fromNullishOr(entries.get(response))), Stream.map(jsonResponse)));
22
+ return Effect.succeed(paginate(client, get(path)).pipe(Stream.mapEffect((response) => Effect.fromNullishOr(entries.get(response))), Stream.map((entry) => ({ ...jsonResponse(entry), hasNext: nextLink(entry.response.headers.link) !== undefined }))));
22
23
  }
23
24
  function writeRepresentation(method, path, body, byteLimit = responseByteLimit) {
24
25
  return HttpClientRequest.make(method)(new URL(path, apiUrl).href, { headers: { Accept: "application/vnd.github+json" } }).pipe(HttpClientRequest.bodyJson(body), Effect.flatMap((input) => request(input, byteLimit)), Effect.map(jsonResponse));
@@ -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ChC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,EACpD,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CACxB,CAAC;IACH,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC;AACjG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAc,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAIlE,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEjG,wBAAgB,cAAc,CAAC,QAAQ,EAAE,kBAAkB,CAAC,kBAAkB,WAE7E;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,kBAAkB,CAAC,kBAAkB,WAE1E;AAED,eAAO,MAAM,WAAW,sYAetB,CAAC"}
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAc,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAKlE,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEjG,wBAAgB,cAAc,CAAC,QAAQ,EAAE,kBAAkB,CAAC,kBAAkB,WAE7E;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,kBAAkB,CAAC,kBAAkB,WAE1E;AAED,eAAO,MAAM,WAAW,sYAgBtB,CAAC"}
package/dist/status.js CHANGED
@@ -1,20 +1,21 @@
1
1
  import { DateTime, Effect, Option, Schema } from "effect";
2
2
  import { HttpClient } from "effect/http";
3
+ import * as HttpStatus from "effect/http/HttpStatus";
3
4
  import { readBoundedText } from "@shivaedev/http/body.ts";
4
5
  import { filterStatus } from "@shivaedev/http/filterStatus.ts";
5
6
  import { parseRetryAfter } from "@shivaedev/http/parseRetryAfter.ts";
6
7
  import { GitHubConversationLocked, GitHubPermissionDenied, GitHubRateLimited } from "#errors.ts";
7
8
  export function isUnauthorized(response) {
8
- return response.status === 401;
9
+ return response.status === HttpStatus.fromLiteral("Unauthorized");
9
10
  }
10
11
  export function isUnchanged(response) {
11
- return response.status === 304;
12
+ return response.status === HttpStatus.fromLiteral("NotModified");
12
13
  }
13
14
  export const checkStatus = Effect.fnUntraced(function* (response, resource, failures = 0) {
14
15
  const { status, headers } = response;
15
- if (status === 403 || status === 429) {
16
- const limitedByHeaders = status === 429 || headers["x-ratelimit-remaining"] === "0" || headers["retry-after"] !== undefined;
17
- const message = !limitedByHeaders && status === 403 ? yield* responseMessage(response) : undefined;
16
+ if (status === HttpStatus.fromLiteral("Forbidden") || status === HttpStatus.fromLiteral("TooManyRequests")) {
17
+ const limitedByHeaders = status === HttpStatus.fromLiteral("TooManyRequests") || headers["x-ratelimit-remaining"] === "0" || headers["retry-after"] !== undefined;
18
+ const message = !limitedByHeaders && status === HttpStatus.fromLiteral("Forbidden") ? yield* responseMessage(response) : undefined;
18
19
  const limitedByMessage = message !== undefined && /rate limit/iu.test(message);
19
20
  if (limitedByHeaders || limitedByMessage) {
20
21
  return yield* refuseRateLimit(response, resource, failures);
@@ -1 +1 @@
1
- {"version":3,"file":"status.js","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,UAAU,EAA2B,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAA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AAC,CAAC;AAC5D,CAAC,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { Effect, Redacted, Schema } from "effect";
2
- import { GitHubWebhookSignatureError } from "./errors.ts";
3
- export declare const verifyWebhook: <TSchema extends Schema.Constraint>(body: Uint8Array<ArrayBufferLike>, signature: string | undefined, secret: Redacted.Redacted<string>, schema: TSchema) => Effect.Effect<TSchema["Type"], GitHubWebhookSignatureError | Schema.SchemaError, TSchema["DecodingServices"]>;
2
+ import { GitHubWebhookSignatureError } from "#errors.ts";
3
+ export declare function verifyWebhook(body: Uint8Array, signature: string | undefined, secret: Redacted.Redacted<string>): Effect.Effect<void, GitHubWebhookSignatureError>;
4
+ export declare function verifyWebhook<TSchema extends Schema.Constraint>(body: Uint8Array, signature: string | undefined, secret: Redacted.Redacted<string>, schema: TSchema): Effect.Effect<TSchema["Type"], GitHubWebhookSignatureError | Schema.SchemaError, TSchema["DecodingServices"]>;
4
5
  //# sourceMappingURL=verifyWebhook.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"verifyWebhook.d.ts","sourceRoot":"","sources":["../src/verifyWebhook.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAE1D,eAAO,MAAM,aAAa,GAAgC,OAAO,SAAS,MAAM,CAAC,UAAU,wOAczF,CAAC"}
1
+ {"version":3,"file":"verifyWebhook.d.ts","sourceRoot":"","sources":["../src/verifyWebhook.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAqBzD,wBAAgB,aAAa,CAC5B,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,GAC/B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,2BAA2B,CAAC,CAAC;AACpD,wBAAgB,aAAa,CAAC,OAAO,SAAS,MAAM,CAAC,UAAU,EAC9D,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EACjC,MAAM,EAAE,OAAO,GACb,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,2BAA2B,GAAG,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { createHmac, timingSafeEqual } from "node:crypto";
2
2
  import { Effect, Redacted, Schema } from "effect";
3
- import { GitHubWebhookSignatureError } from "./errors.js";
4
- export const verifyWebhook = Effect.fnUntraced(function* (body, signature, secret, schema) {
3
+ import { GitHubWebhookSignatureError } from "#errors.ts";
4
+ const verify = Effect.fnUntraced(function* (body, signature, secret, schema) {
5
5
  if (signature === undefined || !/^sha256=[0-9a-f]{64}$/u.test(signature)) {
6
6
  return yield* new GitHubWebhookSignatureError();
7
7
  }
@@ -9,6 +9,12 @@ export const verifyWebhook = Effect.fnUntraced(function* (body, signature, secre
9
9
  if (!timingSafeEqual(expected, Buffer.from(signature.slice(7), "hex"))) {
10
10
  return yield* new GitHubWebhookSignatureError();
11
11
  }
12
+ if (schema === undefined) {
13
+ return;
14
+ }
12
15
  return yield* Schema.decodeUnknownEffect(Schema.fromJsonString(schema))(new TextDecoder().decode(body));
13
16
  });
17
+ export function verifyWebhook(body, signature, secret, schema) {
18
+ return verify(body, signature, secret, schema);
19
+ }
14
20
  //# sourceMappingURL=verifyWebhook.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"verifyWebhook.js","sourceRoot":"","sources":["../src/verifyWebhook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,E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B,EAAE,MAAM,YAAY,CAAC;AAEzD,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EACzC,IAAgB,EAChB,SAA6B,EAC7B,MAAiC,EACjC,MAAgB;IAEhB,IAAI,SAAS,KAAK,SAAS,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QAC1E,OAAO,KAAK,CAAC,CAAC,IAAI,2BAA2B,EAAE,CAAC;IACjD,CAAC;IACD,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IACpF,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;QACxE,OAAO,KAAK,CAAC,CAAC,IAAI,2BAA2B,EAAE,CAAC;IACjD,CAAC;IACD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO;IACR,CAAC;IACD,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AACzG,CAAC,CAAC,CAAC;AAaH,MAAM,UAAU,aAAa,CAC5B,IAAgB,EAChB,SAA6B,EAC7B,MAAiC,EACjC,MAAgB;IAEhB,OAAO,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAChD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shivaedev/github",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "description": "Typed GitHub REST requests, conditional reads and resource budgets for Effect applications",
5
5
  "keywords": [
6
6
  "effect"
@@ -43,16 +43,16 @@
43
43
  ],
44
44
  "dependencies": {
45
45
  "@shivaedev/errors": "0.1.0",
46
- "@shivaedev/http": "0.1.0",
46
+ "@shivaedev/http": "0.1.1",
47
47
  "@shivaedev/service": "0.5.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@effect/platform-node": "4.0.5",
51
51
  "@effect/platform-node-shared": "4.0.5",
52
52
  "@effect/vitest": "4.0.5",
53
- "@shivaedev/quality": "0.42.0",
53
+ "@shivaedev/quality": "0.44.0",
54
54
  "@shivaedev/test": "0.10.0",
55
- "@shivaedev/test-story": "0.21.0",
55
+ "@shivaedev/test-story": "0.22.0",
56
56
  "@types/node": "24.19.2",
57
57
  "effect": "4.0.5",
58
58
  "typescript": "7.0.2",
package/src/GitHub.ts CHANGED
@@ -55,6 +55,15 @@ export function list<TSchema extends Schema.Constraint>(path: string, schema: TS
55
55
  );
56
56
  }
57
57
 
58
+ export function listBounded<TSchema extends Schema.Constraint>(path: string, schema: TSchema, pageCap: number, responseByteLimit?: number) {
59
+ return Stream.unwrap(Effect.flatMap(GitHub, (github) => github.list(path, undefined, responseByteLimit))).pipe(
60
+ Stream.take(pageCap),
61
+ Stream.mapEffect((page) => Effect.map(page.decode(Schema.Array(schema)), (items) => ({ items, truncated: page.hasNext }))),
62
+ Stream.runCollect,
63
+ Effect.map((pages) => ({ items: pages.flatMap((page) => page.items), truncated: pages.at(-1)?.truncated ?? false })),
64
+ );
65
+ }
66
+
58
67
  export function write<TSchema extends Schema.Constraint>(
59
68
  method: "POST" | "PATCH",
60
69
  path: string,
package/src/artifacts.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Effect } from "effect";
2
2
  import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http";
3
+ import * as HttpStatus from "effect/http/HttpStatus";
3
4
  import { readBoundedBody } from "@shivaedev/http/body.ts";
4
5
  import { authenticatedRequest } from "./authenticatedRequest.ts";
5
6
  import { GitHubArtifactError, GitHubArtifactTooLarge, GitHubTransportError } from "./errors.ts";
@@ -35,14 +36,14 @@ export function artifacts(
35
36
  }),
36
37
  );
37
38
  const location = redirect.headers.location;
38
- if (redirect.status !== 302 || location === undefined) {
39
+ if (redirect.status !== HttpStatus.fromLiteral("Found") || location === undefined) {
39
40
  return yield* new GitHubArtifactError({ stage: "redirect", status: redirect.status });
40
41
  }
41
42
  const response = yield* download.get(location).pipe(
42
43
  Effect.provideService(FetchHttpClient.RequestInit, { credentials: "omit", redirect: "manual" }),
43
44
  Effect.mapError(() => new GitHubTransportError({ path })),
44
45
  );
45
- if (response.status < 200 || response.status >= 300) {
46
+ if (response.status < HttpStatus.fromLiteral("OK") || response.status >= HttpStatus.fromLiteral("MultipleChoices")) {
46
47
  return yield* new GitHubArtifactError({ stage: "download", status: response.status });
47
48
  }
48
49
  return yield* readBoundedBody(response, options.byteLimit).pipe(
@@ -1,5 +1,6 @@
1
1
  import { DateTime, Effect, Option, Redacted } from "effect";
2
2
  import { FetchHttpClient, type HttpClient, type HttpClientError, HttpClientRequest } from "effect/http";
3
+ import * as HttpStatus from "effect/http/HttpStatus";
3
4
  import { GitHubTransportError } from "./errors.ts";
4
5
  import type { GitHubToken } from "./GitHubToken.ts";
5
6
  import { failRateLimited, type RateLimits } from "./rateLimits.ts";
@@ -33,7 +34,7 @@ export function authenticatedRequest<R>(
33
34
  response = yield* send(yield* accessToken);
34
35
  }
35
36
  const observedResource = rates.observe(response);
36
- if (!((mode === "revalidate" && isUnchanged(response)) || (mode === "manual" && response.status === 302))) {
37
+ if (!((mode === "revalidate" && isUnchanged(response)) || (mode === "manual" && response.status === HttpStatus.fromLiteral("Found")))) {
37
38
  yield* checkStatus(response, observedResource, rates.failures.get(observedResource) ?? 0).pipe(
38
39
  Effect.catchTag("HttpClientError", () => Effect.fail(new GitHubTransportError({ path }))),
39
40
  Effect.catchTag("GitHubRateLimited", (error) => {
package/src/checkRuns.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Effect, Schema } from "effect";
2
- import type { Representations } from "./representations.ts";
2
+ import type { Representations } from "#representations.ts";
3
3
 
4
4
  export const CheckRunOutput = Schema.Struct({
5
5
  summary: Schema.String,
@@ -12,25 +12,36 @@ export const CheckRunStatus = Schema.Literals(["queued", "in_progress", "complet
12
12
 
13
13
  export const CreateCheckRun = Schema.Struct({
14
14
  conclusion: Schema.optional(CheckRunConclusion),
15
+ detailsUrl: Schema.optional(Schema.String),
15
16
  headSha: Schema.String,
16
17
  name: Schema.String,
17
18
  output: Schema.optional(CheckRunOutput),
18
19
  status: CheckRunStatus,
19
- }).pipe(Schema.encodeKeys({ headSha: "head_sha" }));
20
+ }).pipe(Schema.encodeKeys({ detailsUrl: "details_url", headSha: "head_sha" }));
20
21
 
21
22
  export const UpdateCheckRun = Schema.Union([
22
- Schema.Struct({ output: Schema.optional(CheckRunOutput), status: Schema.Literals(["queued", "in_progress"]) }),
23
- Schema.Struct({ conclusion: CheckRunConclusion, output: Schema.optional(CheckRunOutput), status: Schema.Literal("completed") }),
23
+ Schema.Struct({
24
+ detailsUrl: Schema.optional(Schema.String),
25
+ output: Schema.optional(CheckRunOutput),
26
+ status: Schema.Literals(["queued", "in_progress"]),
27
+ }).pipe(Schema.encodeKeys({ detailsUrl: "details_url" })),
28
+ Schema.Struct({
29
+ conclusion: CheckRunConclusion,
30
+ detailsUrl: Schema.optional(Schema.String),
31
+ output: Schema.optional(CheckRunOutput),
32
+ status: Schema.Literal("completed"),
33
+ }).pipe(Schema.encodeKeys({ detailsUrl: "details_url" })),
24
34
  ]);
25
35
 
26
36
  export const CheckRun = Schema.Struct({
27
37
  conclusion: Schema.NullOr(CheckRunConclusion),
38
+ detailsUrl: Schema.NullOr(Schema.String),
28
39
  headSha: Schema.String,
29
40
  id: Schema.Number,
30
41
  name: Schema.String,
31
42
  output: Schema.Struct({ summary: Schema.NullOr(Schema.String), text: Schema.NullOr(Schema.String), title: Schema.NullOr(Schema.String) }),
32
43
  status: CheckRunStatus,
33
- }).pipe(Schema.encodeKeys({ headSha: "head_sha" }));
44
+ }).pipe(Schema.encodeKeys({ detailsUrl: "details_url", headSha: "head_sha" }));
34
45
 
35
46
  export function checkRuns(client: Representations) {
36
47
  return {
package/src/githubApp.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Cache, Clock, Context, Effect, Exit, Layer, Option, Redacted, Schema } from "effect";
2
2
  import { HttpClient, HttpClientRequest } from "effect/http";
3
+ import * as HttpStatus from "effect/http/HttpStatus";
3
4
  import { readBoundedJson } from "@shivaedev/http/body.ts";
4
5
  import { type AppCredentials, appJwt } from "#appJwt.ts";
5
6
  import { GitHubAppError } from "#errors.ts";
@@ -79,7 +80,7 @@ function appRequests(client: HttpClient.HttpClient, apiUrl: string) {
79
80
  input = yield* HttpClientRequest.bodyJson(input, body).pipe(Effect.mapError(() => new GitHubAppError({ stage: "exchange" })));
80
81
  }
81
82
  const response = yield* client.execute(input).pipe(Effect.mapError(() => new GitHubAppError({ stage: "exchange" })));
82
- if (response.status < 200 || response.status >= 300) {
83
+ if (response.status < HttpStatus.fromLiteral("OK") || response.status >= HttpStatus.fromLiteral("MultipleChoices")) {
83
84
  return yield* new GitHubAppError({ stage: "exchange", status: response.status });
84
85
  }
85
86
  return yield* readBoundedJson(response, 64 * 1024, schema).pipe(Effect.mapError(() => new GitHubAppError({ stage: "exchange" })));
@@ -1,6 +1,7 @@
1
1
  import { Effect, Stream } from "effect";
2
2
  import { HttpClient, HttpClientRequest, type HttpClientResponse } from "effect/http";
3
3
  import type { ServiceUnavailable } from "@shivaedev/errors/taxonomy.ts";
4
+ import { nextLink } from "@shivaedev/http/nextLink.ts";
4
5
  import { paginate } from "@shivaedev/http/paginate.ts";
5
6
  import type { CachedResponse } from "#cache.ts";
6
7
  import { jsonResponse } from "#json.ts";
@@ -40,7 +41,7 @@ export function representations(
40
41
  return Effect.succeed(
41
42
  paginate(client, get(path)).pipe(
42
43
  Stream.mapEffect((response) => Effect.fromNullishOr(entries.get(response))),
43
- Stream.map(jsonResponse),
44
+ Stream.map((entry) => ({ ...jsonResponse(entry), hasNext: nextLink(entry.response.headers.link) !== undefined })),
44
45
  ),
45
46
  );
46
47
  }
package/src/status.ts CHANGED
@@ -1,23 +1,25 @@
1
1
  import { DateTime, Effect, Option, Schema } from "effect";
2
2
  import { HttpClient, type HttpClientResponse } from "effect/http";
3
+ import * as HttpStatus from "effect/http/HttpStatus";
3
4
  import { readBoundedText } from "@shivaedev/http/body.ts";
4
5
  import { filterStatus } from "@shivaedev/http/filterStatus.ts";
5
6
  import { parseRetryAfter } from "@shivaedev/http/parseRetryAfter.ts";
6
7
  import { GitHubConversationLocked, GitHubPermissionDenied, GitHubRateLimited } from "#errors.ts";
7
8
 
8
9
  export function isUnauthorized(response: HttpClientResponse.HttpClientResponse) {
9
- return response.status === 401;
10
+ return response.status === HttpStatus.fromLiteral("Unauthorized");
10
11
  }
11
12
 
12
13
  export function isUnchanged(response: HttpClientResponse.HttpClientResponse) {
13
- return response.status === 304;
14
+ return response.status === HttpStatus.fromLiteral("NotModified");
14
15
  }
15
16
 
16
17
  export const checkStatus = Effect.fnUntraced(function* (response: HttpClientResponse.HttpClientResponse, resource: string, failures = 0) {
17
18
  const { status, headers } = response;
18
- if (status === 403 || status === 429) {
19
- const limitedByHeaders = status === 429 || headers["x-ratelimit-remaining"] === "0" || headers["retry-after"] !== undefined;
20
- const message = !limitedByHeaders && status === 403 ? yield* responseMessage(response) : undefined;
19
+ if (status === HttpStatus.fromLiteral("Forbidden") || status === HttpStatus.fromLiteral("TooManyRequests")) {
20
+ const limitedByHeaders =
21
+ status === HttpStatus.fromLiteral("TooManyRequests") || headers["x-ratelimit-remaining"] === "0" || headers["retry-after"] !== undefined;
22
+ const message = !limitedByHeaders && status === HttpStatus.fromLiteral("Forbidden") ? yield* responseMessage(response) : undefined;
21
23
  const limitedByMessage = message !== undefined && /rate limit/iu.test(message);
22
24
  if (limitedByHeaders || limitedByMessage) {
23
25
  return yield* refuseRateLimit(response, resource, failures);
@@ -1,12 +1,12 @@
1
1
  import { createHmac, timingSafeEqual } from "node:crypto";
2
2
  import { Effect, Redacted, Schema } from "effect";
3
- import { GitHubWebhookSignatureError } from "./errors.ts";
3
+ import { GitHubWebhookSignatureError } from "#errors.ts";
4
4
 
5
- export const verifyWebhook = Effect.fnUntraced(function* <TSchema extends Schema.Constraint>(
5
+ const verify = Effect.fnUntraced(function* <TSchema extends Schema.Constraint>(
6
6
  body: Uint8Array,
7
7
  signature: string | undefined,
8
8
  secret: Redacted.Redacted<string>,
9
- schema: TSchema,
9
+ schema?: TSchema,
10
10
  ) {
11
11
  if (signature === undefined || !/^sha256=[0-9a-f]{64}$/u.test(signature)) {
12
12
  return yield* new GitHubWebhookSignatureError();
@@ -15,5 +15,28 @@ export const verifyWebhook = Effect.fnUntraced(function* <TSchema extends Schema
15
15
  if (!timingSafeEqual(expected, Buffer.from(signature.slice(7), "hex"))) {
16
16
  return yield* new GitHubWebhookSignatureError();
17
17
  }
18
+ if (schema === undefined) {
19
+ return;
20
+ }
18
21
  return yield* Schema.decodeUnknownEffect(Schema.fromJsonString(schema))(new TextDecoder().decode(body));
19
22
  });
23
+
24
+ export function verifyWebhook(
25
+ body: Uint8Array,
26
+ signature: string | undefined,
27
+ secret: Redacted.Redacted<string>,
28
+ ): Effect.Effect<void, GitHubWebhookSignatureError>;
29
+ export function verifyWebhook<TSchema extends Schema.Constraint>(
30
+ body: Uint8Array,
31
+ signature: string | undefined,
32
+ secret: Redacted.Redacted<string>,
33
+ schema: TSchema,
34
+ ): Effect.Effect<TSchema["Type"], GitHubWebhookSignatureError | Schema.SchemaError, TSchema["DecodingServices"]>;
35
+ export function verifyWebhook<TSchema extends Schema.Constraint>(
36
+ body: Uint8Array,
37
+ signature: string | undefined,
38
+ secret: Redacted.Redacted<string>,
39
+ schema?: TSchema,
40
+ ) {
41
+ return verify(body, signature, secret, schema);
42
+ }