@shivaedev/github 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +20 -2
  3. package/dist/GitHub.d.ts +51 -50
  4. package/dist/GitHub.d.ts.map +1 -1
  5. package/dist/GitHub.js +8 -6
  6. package/dist/GitHub.js.map +1 -1
  7. package/dist/adapters/manualRedirects.d.ts +4 -0
  8. package/dist/adapters/manualRedirects.d.ts.map +1 -0
  9. package/dist/adapters/manualRedirects.js +6 -0
  10. package/dist/adapters/manualRedirects.js.map +1 -0
  11. package/dist/adapters/mergeResponseHeaders.d.ts +3 -0
  12. package/dist/adapters/mergeResponseHeaders.d.ts.map +1 -0
  13. package/dist/adapters/mergeResponseHeaders.js +5 -0
  14. package/dist/adapters/mergeResponseHeaders.js.map +1 -0
  15. package/dist/adapters/signAppJwt.d.ts +5 -0
  16. package/dist/adapters/signAppJwt.d.ts.map +1 -0
  17. package/dist/adapters/signAppJwt.js +15 -0
  18. package/dist/adapters/signAppJwt.js.map +1 -0
  19. package/dist/adapters/verifySignature.d.ts +4 -0
  20. package/dist/adapters/verifySignature.d.ts.map +1 -0
  21. package/dist/adapters/verifySignature.js +13 -0
  22. package/dist/adapters/verifySignature.js.map +1 -0
  23. package/dist/appJwt.d.ts +2 -3
  24. package/dist/appJwt.d.ts.map +1 -1
  25. package/dist/appJwt.js +3 -12
  26. package/dist/appJwt.js.map +1 -1
  27. package/dist/artifacts.d.ts.map +1 -1
  28. package/dist/artifacts.js +3 -2
  29. package/dist/artifacts.js.map +1 -1
  30. package/dist/authenticatedRequest.d.ts +5 -5
  31. package/dist/authenticatedRequest.d.ts.map +1 -1
  32. package/dist/authenticatedRequest.js +6 -5
  33. package/dist/authenticatedRequest.js.map +1 -1
  34. package/dist/cache.d.ts.map +1 -1
  35. package/dist/cache.js +2 -1
  36. package/dist/cache.js.map +1 -1
  37. package/dist/checkRuns.d.ts +4 -4
  38. package/dist/errors.d.ts +8 -0
  39. package/dist/errors.d.ts.map +1 -1
  40. package/dist/errors.js +6 -0
  41. package/dist/errors.js.map +1 -1
  42. package/dist/installationClients.d.ts +44 -44
  43. package/dist/markdown.d.ts +1 -0
  44. package/dist/markdown.d.ts.map +1 -1
  45. package/dist/markdown.js +3 -0
  46. package/dist/markdown.js.map +1 -1
  47. package/dist/markdownRows.d.ts +8 -1
  48. package/dist/markdownRows.d.ts.map +1 -1
  49. package/dist/markdownRows.js +39 -8
  50. package/dist/markdownRows.js.map +1 -1
  51. package/dist/pagedLists.d.ts +4 -4
  52. package/dist/pagedLists.d.ts.map +1 -1
  53. package/dist/pagedLists.js.map +1 -1
  54. package/dist/repositoryAddress.d.ts +11 -0
  55. package/dist/repositoryAddress.d.ts.map +1 -0
  56. package/dist/repositoryAddress.js +23 -0
  57. package/dist/repositoryAddress.js.map +1 -0
  58. package/dist/repositoryReads.d.ts +14 -13
  59. package/dist/repositoryReads.d.ts.map +1 -1
  60. package/dist/repositoryReads.js.map +1 -1
  61. package/dist/representations.d.ts +5 -5
  62. package/dist/representations.d.ts.map +1 -1
  63. package/dist/representations.js.map +1 -1
  64. package/dist/requests.d.ts +10 -6
  65. package/dist/requests.d.ts.map +1 -1
  66. package/dist/requests.js +11 -6
  67. package/dist/requests.js.map +1 -1
  68. package/dist/status.d.ts +2 -2
  69. package/dist/status.d.ts.map +1 -1
  70. package/dist/status.js +2 -3
  71. package/dist/status.js.map +1 -1
  72. package/dist/stickyComments.d.ts +1 -1
  73. package/dist/verifyWebhook.d.ts +2 -2
  74. package/dist/verifyWebhook.d.ts.map +1 -1
  75. package/dist/verifyWebhook.js +3 -10
  76. package/dist/verifyWebhook.js.map +1 -1
  77. package/dist/viewerRepositoryAccess.d.ts +1 -1
  78. package/dist/viewerRepositoryAccess.d.ts.map +1 -1
  79. package/package.json +6 -6
  80. package/src/GitHub.ts +21 -9
  81. package/src/adapters/manualRedirects.ts +6 -0
  82. package/src/adapters/mergeResponseHeaders.ts +8 -0
  83. package/src/adapters/signAppJwt.ts +16 -0
  84. package/src/adapters/verifySignature.ts +13 -0
  85. package/src/appJwt.ts +3 -12
  86. package/src/artifacts.ts +3 -5
  87. package/src/authenticatedRequest.ts +8 -9
  88. package/src/cache.ts +2 -1
  89. package/src/errors.ts +6 -0
  90. package/src/markdown.ts +4 -0
  91. package/src/markdownRows.ts +54 -9
  92. package/src/pagedLists.ts +4 -4
  93. package/src/repositoryAddress.ts +32 -0
  94. package/src/repositoryReads.ts +6 -5
  95. package/src/representations.ts +3 -3
  96. package/src/requests.ts +12 -14
  97. package/src/status.ts +3 -3
  98. package/src/verifyWebhook.ts +4 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.0 - 2026-11-03
4
+
5
+ ### Added
6
+
7
+ - Add `details(summary, text)` to render raw text with escaped HTML and Markdown in both the summary and body.
8
+ - Add `renderSections` to share one UTF-8 byte budget across row lists, reserving headers and an `and N more` paragraph for each truncated section.
9
+ - Export `parseRepositoryAddress` from `repositoryAddress.ts`, returning an Effect `Result` with the address form, repository identity, a pull-request number when present, or a typed `GitHubAddressInvalid` failure.
10
+
11
+ ### Fixed
12
+
13
+ - Preserve each pagination pacing callback's failure type through raw, decoded, bounded and repository lists.
14
+ - Keep cached pagination links when GitHub omits them from a 304 response, so repeated reads return every page.
15
+
16
+ ### Breaking
17
+
18
+ - `renderRows` now returns `Result<string, MarkdownBudgetTooSmall>` instead of a string or a thrown `RangeError`. Match the native Effect `Result` with `Result.match`, or convert it with `Effect.fromResult`. Budget failures carry the requested `byteLimit`; import `MarkdownBudgetTooSmall` from `@shivaedev/github/errors.ts`.
19
+ - Initialize the low-level request cache with `yield* requests(rates)` instead of `requests(client, token, rates, refresh)`. Provide `HttpClient`, `GitHubToken` and, when needed, `TokenRefresh` through the Effect environment. The `GitHub` service API is unchanged.
20
+
3
21
  ## 0.10.0 - 2026-11-02
4
22
 
5
23
  ### Added
package/README.md CHANGED
@@ -16,6 +16,8 @@ const repository = read("/repos/acme/widgets", Repository);
16
16
 
17
17
  ## Using the client
18
18
 
19
+ `parseRepositoryAddress` from `@shivaedev/github/repositoryAddress.ts` parses repository shorthand (`owner/name` or `github:owner/name`), GitHub HTTP(S), Git, SCP-style SSH and `ssh://git@github.com/` remotes, including `git+` prefixes and `.git` suffixes. It trims surrounding whitespace and returns an Effect `Result` containing `{ kind, owner, name, repository, number }`. `kind` distinguishes `remote`, `shorthand` and `pull-request`, so a Git remote reader can reject shorthand that Git treats as a local path. `repository` is `owner/name`; `number` is undefined for repositories and a positive safe integer for canonical `https://github.com/owner/name/pull/number` addresses. Unsupported hosts, malformed addresses and invalid PR numbers return the string-tagged `GitHubAddressInvalid` error from `@shivaedev/github/errors.ts`. PR subpages, queries and fragments are rejected.
20
+
19
21
  `GitHub` is a native Context service declared with `defineService`. Its Layer owns the conditional response cache and resource observations. Provide an Effect `HttpClient` and a `GitHubToken` once, then use the Schema-aware `read`, `list` and `write` functions. Schema decoding services remain visible in their requirements.
20
22
 
21
23
  ```ts
@@ -351,6 +353,8 @@ const check = (headSha: string) =>
351
353
 
352
354
  Use the pure helpers from `markdown.ts` for test names and error messages. `plainText` encodes ASCII punctuation as HTML entities, including HTML delimiters and link syntax, and adds a zero-width separator after `@` and `#` to prevent mentions and issue references. `codeSpan` chooses a backtick fence longer than any run in the input and flattens line endings to spaces. `tableCell` flattens line endings and protects pipes; pass `"code"` for a code span inside a table cell. Emoji are preserved.
353
355
 
356
+ `details(summary, text)` wraps raw text in `<details>` and `<summary>`, escaping both inputs with `plainText`. Closing tags, HTML and Markdown in either input remain literal text. Pass raw text rather than rendered Markdown; body line endings and Unicode are preserved.
357
+
354
358
  ```ts
355
359
  import { tableCell } from "@shivaedev/github/markdown.ts";
356
360
  import { renderRows } from "@shivaedev/github/markdownRows.ts";
@@ -362,9 +366,23 @@ const summary = renderRows(rows, {
362
366
  });
363
367
  ```
364
368
 
365
- `renderRows` accepts already-rendered rows and a trusted Markdown header. It counts UTF-8 bytes, keeps a prefix of complete rows and, when rows are dropped, appends one `and N more` paragraph. The header and notice count toward the budget; rows, emoji and escapes are never sliced. The default budget is 60,000 bytes. A budget too small for the header and notice throws `RangeError`.
369
+ `renderRows` accepts already-rendered rows and a trusted Markdown header. It counts UTF-8 bytes, keeps a prefix of complete rows and, when rows are dropped, appends one `and N more` paragraph. The header and notice count toward the budget; rows, emoji and escapes are never sliced. The default budget is 60,000 bytes. It returns `Result<string, MarkdownBudgetTooSmall>`; a budget too small for the header and notice is a typed failure. `MarkdownBudgetTooSmall` is exported from `errors.ts` and carries the requested `byteLimit`.
370
+
371
+ For several lists in one comment, `renderSections` takes sections with `rows` and an optional trusted Markdown `header`, plus one `{ byteLimit }` option for the whole result. It joins sections with blank lines and counts those separators, headers and notices in the shared budget, defaulting to 60,000 bytes. Earlier sections receive spare space first while later sections retain room for their headers and either all their rows or an `and N more` paragraph. Each truncated section has its own omitted-row count. Empty sections without headers are omitted; header-only sections remain. If the total budget cannot fit the required headers and notices or complete shorter lists, it returns a `MarkdownBudgetTooSmall` failure carrying the total requested `byteLimit`.
372
+
373
+ ```ts
374
+ import { renderSections } from "@shivaedev/github/markdownRows.ts";
375
+
376
+ const report = renderSections(
377
+ [
378
+ { header: "## Failures", rows: failureRows },
379
+ { header: "## Warnings", rows: warningRows },
380
+ ],
381
+ { byteLimit: 8_000 },
382
+ );
383
+ ```
366
384
 
367
- Use the result as a sticky comment body or check-run summary. The budget covers the rendered body; account for any surrounding text, including the sticky comment marker, when choosing a lower total limit.
385
+ Both row helpers return native Effect `Result` values. Match them with `Result.match`, or convert them with `Effect.fromResult` to pass budget failures through the error channel. Use the successful string as a sticky comment body or check-run summary. The budget covers the rendered body; account for any surrounding text, including the sticky comment marker, when choosing a lower total limit.
368
386
 
369
387
  ### Rate limits and failures
370
388
 
package/dist/GitHub.d.ts CHANGED
@@ -1,19 +1,16 @@
1
1
  import { Effect, Schema, Stream } from "effect";
2
2
  import { HttpClient } from "effect/http";
3
+ import type { ServiceUnavailable } from "@shivaedev/errors/taxonomy.ts";
3
4
  import { GitHubToken } from "#GitHubToken.ts";
4
5
  import { type ListOptions } from "#pagedLists.ts";
5
6
  export declare const GitHub: import("effect/Context").Service<"@shivaedev/github/GitHub", Readonly<{
6
7
  readonly downloadArtifactArchive: (options: import("#artifacts.ts").ArtifactArchiveOptions) => Effect.Effect<import("./artifactExtraction.ts").ArtifactFile[], import("./errors.ts").GitHubAppError | import("./artifactErrors.ts").GitHubArtifactCompressionRatio | import("./artifactErrors.ts").GitHubArtifactDuplicateEntry | import("./errors.ts").GitHubArtifactError | import("./artifactErrors.ts").GitHubArtifactExtractedTooLarge | import("./artifactErrors.ts").GitHubArtifactExtractionError | import("./artifactErrors.ts").GitHubArtifactPathTraversal | import("./artifactErrors.ts").GitHubArtifactSymlink | 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").InvalidBodyLimit | 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>;
7
- readonly list: (path: string, beforeRequest?: ((resource: string) => Effect.Effect<void, import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable>) | undefined, byteLimit?: number | undefined) => Effect.Effect<Stream.Stream<{
8
- decode: <TSchema extends Schema.Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], Schema.SchemaError, TSchema["DecodingServices"]>;
9
- hasNext: boolean;
10
- }, 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").InvalidBodyLimit | 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>;
11
8
  readonly read: (path: string, byteLimit?: number | undefined) => Effect.Effect<{
12
9
  decode: <TSchema extends Schema.Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], Schema.SchemaError, TSchema["DecodingServices"]>;
13
- }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
10
+ }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge, never>;
14
11
  readonly write: (method: "DELETE" | "PATCH" | "POST" | "PUT", path: string, body?: unknown, byteLimit?: number | undefined) => Effect.Effect<{
15
12
  decode: <TSchema extends Schema.Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], Schema.SchemaError, TSchema["DecodingServices"]>;
16
- }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
13
+ }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge, never>;
17
14
  readonly createCheckRun: (owner: string, repo: string, input: {
18
15
  readonly detailsUrl?: string | undefined;
19
16
  readonly headSha: string;
@@ -51,7 +48,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
51
48
  readonly title: string | null;
52
49
  };
53
50
  readonly status: "completed" | "in_progress" | "pending" | "queued" | "requested" | "waiting";
54
- }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
51
+ }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError, never>;
55
52
  readonly findLatestCheckRun: (owner: string, repo: string, input: {
56
53
  readonly appId?: number | undefined;
57
54
  readonly headSha: string;
@@ -75,7 +72,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
75
72
  readonly title: string | null;
76
73
  };
77
74
  readonly status: "completed" | "in_progress" | "pending" | "queued" | "requested" | "waiting";
78
- }>, 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").InvalidBodyLimit | 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, never>;
75
+ }>, 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").InvalidBodyLimit | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | ServiceUnavailable, never>;
79
76
  readonly updateCheckRun: (owner: string, repo: string, id: number, input: {
80
77
  readonly detailsUrl?: string | undefined;
81
78
  readonly output?: {
@@ -108,7 +105,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
108
105
  readonly title: string | null;
109
106
  };
110
107
  readonly status: "completed" | "in_progress" | "pending" | "queued" | "requested" | "waiting";
111
- }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
108
+ }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError, never>;
112
109
  readonly upsertCheckRun: (owner: string, repo: string, input: {
113
110
  readonly detailsUrl?: string | undefined;
114
111
  readonly headSha: string;
@@ -146,7 +143,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
146
143
  readonly title: string | null;
147
144
  };
148
145
  readonly status: "completed" | "in_progress" | "pending" | "queued" | "requested" | "waiting";
149
- }, 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").InvalidBodyLimit | 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, never>;
146
+ }, 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").InvalidBodyLimit | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | ServiceUnavailable, never>;
150
147
  readonly compareCommits: (owner: string, repo: string, base: string, head: string, byteLimit?: number | undefined) => Effect.Effect<{
151
148
  readonly aheadBy: number;
152
149
  readonly behindBy: number;
@@ -201,7 +198,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
201
198
  }[] | undefined;
202
199
  readonly status: "ahead" | "behind" | "diverged" | "identical";
203
200
  readonly totalCommits: number;
204
- }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
201
+ }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError, never>;
205
202
  readonly getCollaboratorPermission: (owner: string, repo: string, username: string, byteLimit?: number | undefined) => Effect.Effect<{
206
203
  readonly permission: string;
207
204
  readonly roleName: string;
@@ -212,7 +209,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
212
209
  readonly login: string;
213
210
  readonly type: string;
214
211
  };
215
- }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
212
+ }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError, never>;
216
213
  readonly getCommit: (owner: string, repo: string, ref: string, byteLimit?: number | undefined) => Effect.Effect<{
217
214
  readonly author: {
218
215
  readonly avatarUrl: string;
@@ -266,7 +263,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
266
263
  readonly deletions: number;
267
264
  readonly total: number;
268
265
  };
269
- }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
266
+ }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError, never>;
270
267
  readonly getIssue: (owner: string, repo: string, number: number, byteLimit?: number | undefined) => Effect.Effect<{
271
268
  readonly body: string | null;
272
269
  readonly closedAt: string | null;
@@ -290,7 +287,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
290
287
  readonly login: string;
291
288
  readonly type: string;
292
289
  } | null;
293
- }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
290
+ }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError, never>;
294
291
  readonly getTree: (owner: string, repo: string, sha: string, options?: {
295
292
  readonly recursive?: boolean;
296
293
  readonly responseByteLimit?: number | undefined;
@@ -306,15 +303,39 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
306
303
  }[];
307
304
  readonly truncated: boolean;
308
305
  readonly url: string;
309
- }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
306
+ }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError, never>;
310
307
  readonly getUser: (username?: string | undefined, byteLimit?: number | undefined) => Effect.Effect<{
311
308
  readonly avatarUrl: string;
312
309
  readonly htmlUrl: string;
313
310
  readonly id: number;
314
311
  readonly login: string;
315
312
  readonly type: string;
316
- }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
317
- readonly listCommits: (owner: string, repo: string, options?: import("#repositoryReads.ts").RepositoryListOptions | undefined) => Effect.Effect<Stream.Stream<{
313
+ }, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError, never>;
314
+ readonly upsertStickyComment: (input: {
315
+ readonly appId?: number | undefined;
316
+ readonly author?: string | undefined;
317
+ readonly body: string;
318
+ readonly marker: string;
319
+ readonly number: number;
320
+ readonly owner: string;
321
+ readonly repo: string;
322
+ }) => Effect.Effect<{
323
+ readonly body: string;
324
+ readonly id: number;
325
+ readonly performedViaGithubApp?: {
326
+ readonly id: number;
327
+ } | null | undefined;
328
+ readonly user: {
329
+ readonly login: string;
330
+ readonly type?: string | undefined;
331
+ } | null;
332
+ }, 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").InvalidBodyLimit | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | ServiceUnavailable, never>;
333
+ readonly bytes: (path: string, accept: string, limit: number) => Effect.Effect<Uint8Array<ArrayBufferLike>, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge, never>;
334
+ readonly list: <E = ServiceUnavailable>(path: string, beforeRequest?: (resource: string) => Effect.Effect<void, E>, byteLimit?: number) => Effect.Effect<Stream.Stream<{
335
+ decode: <TSchema extends Schema.Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], Schema.SchemaError, TSchema["DecodingServices"]>;
336
+ hasNext: boolean;
337
+ }, E | 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").InvalidBodyLimit | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge, never>, never, never>;
338
+ readonly listCommits: <E = ServiceUnavailable>(owner: string, repo: string, options?: import("#repositoryReads.ts").RepositoryListOptions<E>) => Effect.Effect<Stream.Stream<{
318
339
  hasNext: boolean;
319
340
  items: {
320
341
  readonly author: {
@@ -356,8 +377,8 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
356
377
  readonly sha: string;
357
378
  }[];
358
379
  skipped: number;
359
- }, 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").InvalidBodyLimit | 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, never>, never, never>;
360
- readonly listIssues: (owner: string, repo: string, options?: import("#repositoryReads.ts").RepositoryListOptions | undefined) => Effect.Effect<Stream.Stream<{
380
+ }, E | 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").InvalidBodyLimit | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError, never>, never, never>;
381
+ readonly listIssues: <E = ServiceUnavailable>(owner: string, repo: string, options?: import("#repositoryReads.ts").RepositoryListOptions<E>) => Effect.Effect<Stream.Stream<{
361
382
  hasNext: boolean;
362
383
  items: {
363
384
  readonly body: string | null;
@@ -384,8 +405,8 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
384
405
  } | null;
385
406
  }[];
386
407
  skipped: number;
387
- }, 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").InvalidBodyLimit | 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, never>, never, never>;
388
- readonly listPullRequestFiles: (owner: string, repo: string, number: number, options?: import("#repositoryReads.ts").RepositoryListOptions | undefined) => Effect.Effect<Stream.Stream<{
408
+ }, E | 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").InvalidBodyLimit | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError, never>, never, never>;
409
+ readonly listPullRequestFiles: <E = ServiceUnavailable>(owner: string, repo: string, number: number, options?: import("#repositoryReads.ts").RepositoryListOptions<E>) => Effect.Effect<Stream.Stream<{
389
410
  hasNext: boolean;
390
411
  items: {
391
412
  readonly additions: number;
@@ -398,48 +419,28 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
398
419
  readonly status: string;
399
420
  }[];
400
421
  skipped: number;
401
- }, 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").InvalidBodyLimit | 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, never>, never, never>;
402
- readonly upsertStickyComment: (input: {
403
- readonly appId?: number | undefined;
404
- readonly author?: string | undefined;
405
- readonly body: string;
406
- readonly marker: string;
407
- readonly number: number;
408
- readonly owner: string;
409
- readonly repo: string;
410
- }) => Effect.Effect<{
411
- readonly body: string;
412
- readonly id: number;
413
- readonly performedViaGithubApp?: {
414
- readonly id: number;
415
- } | null | undefined;
416
- readonly user: {
417
- readonly login: string;
418
- readonly type?: string | undefined;
419
- } | null;
420
- }, 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").InvalidBodyLimit | 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, never>;
421
- readonly bytes: (path: string, accept: string, limit: number) => Effect.Effect<Uint8Array<ArrayBufferLike>, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
422
+ }, E | 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").InvalidBodyLimit | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError, never>, never, never>;
422
423
  readonly observations: () => Effect.Effect<import("#rateLimits.ts").RateLimitObservation[], never, never>;
423
424
  readonly resource: (path: string) => Effect.Effect<string, never, never>;
424
- readonly text: (path: string, accept: string, limit: number) => Effect.Effect<string, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
425
+ readonly text: (path: string, accept: string, limit: number) => Effect.Effect<string, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge, never>;
425
426
  }>> & {
426
427
  readonly layer: import("effect/Layer").Layer<"@shivaedev/github/GitHub", never, GitHubToken | HttpClient.HttpClient>;
427
428
  };
428
- 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, "@shivaedev/github/GitHub" | TSchema["DecodingServices"]>;
429
- export declare function listPages<TSchema extends Schema.Constraint>(path: string, schema: TSchema, options?: ListOptions | number): Stream.Stream<{
429
+ 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError, "@shivaedev/github/GitHub" | TSchema["DecodingServices"]>;
430
+ export declare function listPages<TSchema extends Schema.Constraint, E = ServiceUnavailable>(path: string, schema: TSchema, options?: ListOptions<E> | number): Stream.Stream<{
430
431
  hasNext: boolean;
431
432
  items: TSchema["Type"][];
432
433
  skipped: number;
433
- }, 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").InvalidBodyLimit | 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"]>;
434
- export declare function list<TSchema extends Schema.Constraint>(path: string, schema: TSchema, options?: ListOptions | 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("@shivaedev/http/errors.ts").InvalidBodyLimit | 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"]>;
435
- export declare function listBounded<TSchema extends Schema.Constraint>(path: string, schema: TSchema, pageCap: number, options?: ListOptions | number): Effect.Effect<{
434
+ }, E | 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").InvalidBodyLimit | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError, "@shivaedev/github/GitHub" | TSchema["DecodingServices"]>;
435
+ export declare function list<TSchema extends Schema.Constraint, E = ServiceUnavailable>(path: string, schema: TSchema, options?: ListOptions<E> | number): Stream.Stream<TSchema["Type"], E | 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").InvalidBodyLimit | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError, "@shivaedev/github/GitHub" | TSchema["DecodingServices"]>;
436
+ export declare function listBounded<TSchema extends Schema.Constraint, E = ServiceUnavailable>(path: string, schema: TSchema, pageCap: number, options?: ListOptions<E> | number): Effect.Effect<{
436
437
  items: TSchema["Type"][];
437
438
  skipped: number;
438
439
  truncated: boolean;
439
- }, 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").InvalidBodyLimit | 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"]>;
440
+ }, E | 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").InvalidBodyLimit | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError, "@shivaedev/github/GitHub" | TSchema["DecodingServices"]>;
440
441
  type WriteMethod = "POST" | "PATCH" | "PUT" | "DELETE";
441
442
  export declare function write<TSchema extends Schema.Constraint>(method: WriteMethod, path: string, body: unknown, schema: TSchema, responseByteLimit?: number): ReturnType<typeof writeDecoded<TSchema>>;
442
443
  export declare function write(method: WriteMethod, path: string, body?: unknown): ReturnType<typeof writeDecoded<typeof Schema.Void>>;
443
- declare function writeDecoded<TSchema extends Schema.Constraint>(method: WriteMethod, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, "@shivaedev/github/GitHub" | TSchema["DecodingServices"]>;
444
+ declare function writeDecoded<TSchema extends Schema.Constraint>(method: WriteMethod, 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").InvalidBodyLimit | import("@shivaedev/http/errors.ts").RemoteGone | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteNotFound | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError, "@shivaedev/github/GitHub" | TSchema["DecodingServices"]>;
444
445
  export {};
445
446
  //# sourceMappingURL=GitHub.d.ts.map
@@ -1 +1 @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,EAAE,CAAC,GAAG,kBAAkB,EACpF,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,MAAM;;;;wxBAWjC;AAED,KAAK,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEvD,wBAAgB,KAAK,CAAC,OAAO,SAAS,MAAM,CAAC,UAAU,EACtD,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,OAAO,EACf,iBAAiB,CAAC,EAAE,MAAM,GACxB,UAAU,CAAC,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;AAC5C,wBAAgB,KAAK,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAK9H,iBAAS,YAAY,CAAC,OAAO,SAAS,MAAM,CAAC,UAAU,EACtD,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,OAAO,EACf,iBAAiB,CAAC,EAAE,MAAM,4vBAK1B"}
package/dist/GitHub.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Effect, Schema, Stream } from "effect";
2
2
  import { HttpClient } from "effect/http";
3
3
  import { defineService } from "@shivaedev/service/defineService.ts";
4
+ import { genericMethod } from "@shivaedev/service/genericMethod.ts";
4
5
  import { artifacts } from "#artifacts.ts";
5
6
  import { checkRuns } from "#checkRuns.ts";
6
7
  import { GitHubConfig } from "#GitHubConfig.ts";
@@ -11,32 +12,33 @@ import { repositoryReads } from "#repositoryReads.ts";
11
12
  import { representations } from "#representations.ts";
12
13
  import { requests } from "#requests.ts";
13
14
  import { stickyComments } from "#stickyComments.ts";
14
- import { TokenRefresh } from "#TokenRefresh.ts";
15
15
  export const GitHub = defineService({
16
16
  id: "@shivaedev/github/GitHub",
17
17
  initialize: Effect.gen(function* () {
18
18
  const config = yield* GitHubConfig;
19
19
  const rates = rateLimits();
20
- const client = yield* HttpClient.HttpClient;
21
- const token = yield* GitHubToken;
22
- const refresh = yield* TokenRefresh;
23
20
  return {
24
21
  apiUrl: config.apiUrl,
25
22
  archive: yield* artifacts(config.apiUrl, rates),
26
23
  rates,
27
- request: requests(client, token, rates, refresh),
24
+ request: yield* requests(rates),
28
25
  responseByteLimit: config.responseByteLimit,
29
26
  };
30
27
  }),
31
28
  methods: ({ apiUrl, archive, rates, request, responseByteLimit }) => {
32
29
  const { get, ...client } = representations(apiUrl, request, rates.resource, responseByteLimit);
30
+ const reads = repositoryReads(client);
33
31
  return {
34
32
  bytes: (path, accept, limit) => Effect.map(request(get(path, accept), limit), (entry) => entry.bytes),
35
33
  ...client,
34
+ list: genericMethod(client.list),
36
35
  ...archive,
37
36
  ...stickyComments(client),
38
37
  ...checkRuns(client),
39
- ...repositoryReads(client),
38
+ ...reads,
39
+ listCommits: genericMethod(reads.listCommits),
40
+ listIssues: genericMethod(reads.listIssues),
41
+ listPullRequestFiles: genericMethod(reads.listPullRequestFiles),
40
42
  observations: () => Effect.sync(() => [...rates.observations.values()]),
41
43
  resource: (path) => Effect.sync(() => rates.resource(new URL(path, apiUrl).pathname)),
42
44
  text: (path, accept, limit) => Effect.map(request(get(path, accept), limit), (entry) => new TextDecoder().decode(entry.bytes)),
@@ -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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ACtB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;QAC1C,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/D,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,KAAK;KACzC,CAAC,CAAC,CACH,CAAC;AACH,CAAC;AAYD,MAAM,UAAU,KAAK,CAAC,MAAmB,EAAE,IAAY,EAAE,IAAc,EAAE,MAAM,GAAsB,MAAM,CAAC,IAAI,EAAE,iBAA0B;IAC3I,OAAO,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,YAAY,CACpB,MAAmB,EACnB,IAAY,EACZ,IAAa,EACb,MAAe,EACf,iBAA0B;IAE1B,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CACxC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAC1G,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Effect } from "effect";
2
+ import { FetchHttpClient } from "effect/http";
3
+ export declare function manualRedirects<A, E, R>(request: Effect.Effect<A, E, R>): Effect.Effect<A, E, Exclude<R, FetchHttpClient.RequestInit>>;
4
+ //# sourceMappingURL=manualRedirects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manualRedirects.d.ts","sourceRoot":"","sources":["../../src/adapters/manualRedirects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,gEAEvE"}
@@ -0,0 +1,6 @@
1
+ import { Effect } from "effect";
2
+ import { FetchHttpClient } from "effect/http";
3
+ export function manualRedirects(request) {
4
+ return request.pipe(Effect.provideService(FetchHttpClient.RequestInit, { credentials: "omit", redirect: "manual" }));
5
+ }
6
+ //# sourceMappingURL=manualRedirects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manualRedirects.js","sourceRoot":"","sources":["../../src/adapters/manualRedirects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,UAAU,eAAe,CAAU,OAA+B;IACvE,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,eAAe,CAAC,WAAW,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;AACtH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { HttpClientResponse } from "effect/http";
2
+ export declare function mergeResponseHeaders(cached: HttpClientResponse.HttpClientResponse, response: HttpClientResponse.HttpClientResponse): HttpClientResponse.HttpClientResponse;
3
+ //# sourceMappingURL=mergeResponseHeaders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeResponseHeaders.d.ts","sourceRoot":"","sources":["../../src/adapters/mergeResponseHeaders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,CAAC,kBAAkB,EAAE,QAAQ,EAAE,kBAAkB,CAAC,kBAAkB,yCAKlI"}
@@ -0,0 +1,5 @@
1
+ import { HttpClientResponse } from "effect/http";
2
+ export function mergeResponseHeaders(cached, response) {
3
+ return HttpClientResponse.fromWeb(response.request, new Response(null, { headers: { ...cached.headers, ...response.headers }, status: response.status }));
4
+ }
5
+ //# sourceMappingURL=mergeResponseHeaders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeResponseHeaders.js","sourceRoot":"","sources":["../../src/adapters/mergeResponseHeaders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,UAAU,oBAAoB,CAAC,MAA6C,EAAE,QAA+C;IAClI,OAAO,kBAAkB,CAAC,OAAO,CAChC,QAAQ,CAAC,OAAO,EAChB,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CACpG,CAAC;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Effect, Redacted } from "effect";
2
+ import type { AppCredentials } from "#appJwt.ts";
3
+ import { GitHubAppError } from "#errors.ts";
4
+ export declare function signAppJwt(options: AppCredentials, now: number): Effect.Effect<Redacted.Redacted<string>, GitHubAppError, never>;
5
+ //# sourceMappingURL=signAppJwt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signAppJwt.d.ts","sourceRoot":"","sources":["../../src/adapters/signAppJwt.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,wBAAgB,UAAU,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,mEAU9D"}
@@ -0,0 +1,15 @@
1
+ import { sign } from "node:crypto";
2
+ import { Effect, Redacted } from "effect";
3
+ import { GitHubAppError } from "#errors.ts";
4
+ export function signAppJwt(options, now) {
5
+ return Effect.try({
6
+ catch: (cause) => new GitHubAppError({ reason: "sign" }, { cause }),
7
+ try: () => {
8
+ const header = Buffer.from(JSON.stringify({ alg: "RS256", typ: "JWT" })).toString("base64url");
9
+ const payload = Buffer.from(JSON.stringify({ exp: now + 600, iat: now - 60, iss: options.appId })).toString("base64url");
10
+ const input = `${header}.${payload}`;
11
+ return Redacted.make(`${input}.${sign("RSA-SHA256", Buffer.from(input), Redacted.value(options.privateKey)).toString("base64url")}`);
12
+ },
13
+ });
14
+ }
15
+ //# sourceMappingURL=signAppJwt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signAppJwt.js","sourceRoot":"","sources":["../../src/adapters/signAppJwt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,UAAU,UAAU,CAAC,OAAuB,EAAE,GAAW;IAC9D,OAAO,MAAM,CAAC,GAAG,CAAC;QACjB,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,cAAc,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;QACnE,GAAG,EAAE,GAAG,EAAE;YACT,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;YAC/F,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;YACzH,MAAM,KAAK,GAAG,GAAG,MAAM,IAAI,OAAO,EAAE,CAAC;YACrC,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,IAAI,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACtI,CAAC;KACD,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Effect, Redacted } from "effect";
2
+ import { GitHubWebhookSignatureError } from "#errors.ts";
3
+ export declare const verifySignature: (body: Uint8Array<ArrayBufferLike>, signature: string | undefined, secret: Redacted.Redacted<string>) => Effect.Effect<undefined, GitHubWebhookSignatureError, never>;
4
+ //# sourceMappingURL=verifySignature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifySignature.d.ts","sourceRoot":"","sources":["../../src/adapters/verifySignature.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAEzD,eAAO,MAAM,eAAe,uKAQ1B,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { createHmac, timingSafeEqual } from "node:crypto";
2
+ import { Effect, Redacted } from "effect";
3
+ import { GitHubWebhookSignatureError } from "#errors.ts";
4
+ export const verifySignature = Effect.fnUntraced(function* (body, signature, secret) {
5
+ if (signature === undefined || !/^sha256=[0-9a-f]{64}$/u.test(signature)) {
6
+ return yield* new GitHubWebhookSignatureError();
7
+ }
8
+ const expected = createHmac("sha256", Redacted.value(secret)).update(body).digest();
9
+ if (!timingSafeEqual(expected, Buffer.from(signature.slice(7), "hex"))) {
10
+ return yield* new GitHubWebhookSignatureError();
11
+ }
12
+ });
13
+ //# sourceMappingURL=verifySignature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifySignature.js","sourceRoot":"","sources":["../../src/adapters/verifySignature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAEzD,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,IAAgB,EAAE,SAA6B,EAAE,MAAiC;IAC7I,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;AACF,CAAC,CAAC,CAAC"}
package/dist/appJwt.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- import { Effect, Redacted } from "effect";
2
- import { GitHubAppError } from "#errors.ts";
1
+ import { Effect, type Redacted } from "effect";
3
2
  export interface AppCredentials {
4
3
  readonly appId: string;
5
4
  readonly privateKey: Redacted.Redacted<string>;
6
5
  }
7
- export declare const appJwt: (options: AppCredentials) => Effect.Effect<Redacted.Redacted<string>, GitHubAppError, never>;
6
+ export declare const appJwt: (options: AppCredentials) => Effect.Effect<Redacted.Redacted<string>, import("./errors.ts").GitHubAppError, never>;
8
7
  //# sourceMappingURL=appJwt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"appJwt.d.ts","sourceRoot":"","sources":["../src/appJwt.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC/C;AAED,eAAO,MAAM,MAAM,8FAWjB,CAAC"}
1
+ {"version":3,"file":"appJwt.d.ts","sourceRoot":"","sources":["../src/appJwt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGtD,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC/C;AAED,eAAO,MAAM,MAAM,oHAGjB,CAAC"}
package/dist/appJwt.js CHANGED
@@ -1,16 +1,7 @@
1
- import { sign } from "node:crypto";
2
- import { Clock, Effect, Redacted } from "effect";
3
- import { GitHubAppError } from "#errors.ts";
1
+ import { Clock, Effect } from "effect";
2
+ import { signAppJwt } from "#adapters/signAppJwt.ts";
4
3
  export const appJwt = Effect.fnUntraced(function* (options) {
5
4
  const now = Math.floor((yield* Clock.currentTimeMillis) / 1000);
6
- return yield* Effect.try({
7
- catch: (cause) => new GitHubAppError({ reason: "sign" }, { cause }),
8
- try: () => {
9
- const header = Buffer.from(JSON.stringify({ alg: "RS256", typ: "JWT" })).toString("base64url");
10
- const payload = Buffer.from(JSON.stringify({ exp: now + 600, iat: now - 60, iss: options.appId })).toString("base64url");
11
- const input = `${header}.${payload}`;
12
- return Redacted.make(`${input}.${sign("RSA-SHA256", Buffer.from(input), Redacted.value(options.privateKey)).toString("base64url")}`);
13
- },
14
- });
5
+ return yield* signAppJwt(options, now);
15
6
  });
16
7
  //# sourceMappingURL=appJwt.js.map