@shivaedev/github 0.9.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 (152) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +115 -7
  3. package/dist/GitHub.d.ts +279 -19
  4. package/dist/GitHub.d.ts.map +1 -1
  5. package/dist/GitHub.js +22 -10
  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/resolveApiUrl.d.ts +2 -0
  16. package/dist/adapters/resolveApiUrl.d.ts.map +1 -0
  17. package/dist/adapters/resolveApiUrl.js +6 -0
  18. package/dist/adapters/resolveApiUrl.js.map +1 -0
  19. package/dist/adapters/signAppJwt.d.ts +5 -0
  20. package/dist/adapters/signAppJwt.d.ts.map +1 -0
  21. package/dist/adapters/signAppJwt.js +15 -0
  22. package/dist/adapters/signAppJwt.js.map +1 -0
  23. package/dist/adapters/verifySignature.d.ts +4 -0
  24. package/dist/adapters/verifySignature.d.ts.map +1 -0
  25. package/dist/adapters/verifySignature.js +13 -0
  26. package/dist/adapters/verifySignature.js.map +1 -0
  27. package/dist/adapters/zipEntries.d.ts +17 -0
  28. package/dist/adapters/zipEntries.d.ts.map +1 -0
  29. package/dist/adapters/zipEntries.js +57 -0
  30. package/dist/adapters/zipEntries.js.map +1 -0
  31. package/dist/appJwt.d.ts +2 -3
  32. package/dist/appJwt.d.ts.map +1 -1
  33. package/dist/appJwt.js +3 -12
  34. package/dist/appJwt.js.map +1 -1
  35. package/dist/appTokens.d.ts.map +1 -1
  36. package/dist/appTokens.js +2 -1
  37. package/dist/appTokens.js.map +1 -1
  38. package/dist/artifactErrors.d.ts +34 -0
  39. package/dist/artifactErrors.d.ts.map +1 -0
  40. package/dist/artifactErrors.js +27 -0
  41. package/dist/artifactErrors.js.map +1 -0
  42. package/dist/artifactExtraction.d.ts +12 -0
  43. package/dist/artifactExtraction.d.ts.map +1 -0
  44. package/dist/artifactExtraction.js +40 -0
  45. package/dist/artifactExtraction.js.map +1 -0
  46. package/dist/artifactPaths.d.ts +4 -0
  47. package/dist/artifactPaths.d.ts.map +1 -0
  48. package/dist/artifactPaths.js +35 -0
  49. package/dist/artifactPaths.js.map +1 -0
  50. package/dist/artifacts.d.ts +13 -8
  51. package/dist/artifacts.d.ts.map +1 -1
  52. package/dist/artifacts.js +18 -10
  53. package/dist/artifacts.js.map +1 -1
  54. package/dist/authenticatedRequest.d.ts +5 -5
  55. package/dist/authenticatedRequest.d.ts.map +1 -1
  56. package/dist/authenticatedRequest.js +6 -5
  57. package/dist/authenticatedRequest.js.map +1 -1
  58. package/dist/cache.d.ts.map +1 -1
  59. package/dist/cache.js +2 -1
  60. package/dist/cache.js.map +1 -1
  61. package/dist/checkRuns.d.ts +4 -4
  62. package/dist/checkRuns.d.ts.map +1 -1
  63. package/dist/checkRuns.js +5 -3
  64. package/dist/checkRuns.js.map +1 -1
  65. package/dist/errors.d.ts +8 -0
  66. package/dist/errors.d.ts.map +1 -1
  67. package/dist/errors.js +6 -0
  68. package/dist/errors.js.map +1 -1
  69. package/dist/gitSchemas.d.ts +195 -0
  70. package/dist/gitSchemas.d.ts.map +1 -0
  71. package/dist/gitSchemas.js +45 -0
  72. package/dist/gitSchemas.js.map +1 -0
  73. package/dist/installationClients.d.ts +291 -15
  74. package/dist/installationClients.d.ts.map +1 -1
  75. package/dist/installationClients.js +14 -5
  76. package/dist/installationClients.js.map +1 -1
  77. package/dist/markdown.d.ts +1 -0
  78. package/dist/markdown.d.ts.map +1 -1
  79. package/dist/markdown.js +3 -0
  80. package/dist/markdown.js.map +1 -1
  81. package/dist/markdownRows.d.ts +8 -1
  82. package/dist/markdownRows.d.ts.map +1 -1
  83. package/dist/markdownRows.js +39 -8
  84. package/dist/markdownRows.js.map +1 -1
  85. package/dist/pagedLists.d.ts +15 -0
  86. package/dist/pagedLists.d.ts.map +1 -0
  87. package/dist/pagedLists.js +16 -0
  88. package/dist/pagedLists.js.map +1 -0
  89. package/dist/repositoryAddress.d.ts +11 -0
  90. package/dist/repositoryAddress.d.ts.map +1 -0
  91. package/dist/repositoryAddress.js +23 -0
  92. package/dist/repositoryAddress.js.map +1 -0
  93. package/dist/repositoryReads.d.ts +262 -0
  94. package/dist/repositoryReads.d.ts.map +1 -0
  95. package/dist/repositoryReads.js +30 -0
  96. package/dist/repositoryReads.js.map +1 -0
  97. package/dist/repositorySchemas.d.ts +73 -0
  98. package/dist/repositorySchemas.d.ts.map +1 -0
  99. package/dist/repositorySchemas.js +38 -0
  100. package/dist/repositorySchemas.js.map +1 -0
  101. package/dist/representations.d.ts +5 -5
  102. package/dist/representations.d.ts.map +1 -1
  103. package/dist/representations.js +3 -2
  104. package/dist/representations.js.map +1 -1
  105. package/dist/requests.d.ts +10 -6
  106. package/dist/requests.d.ts.map +1 -1
  107. package/dist/requests.js +11 -6
  108. package/dist/requests.js.map +1 -1
  109. package/dist/status.d.ts +2 -2
  110. package/dist/status.d.ts.map +1 -1
  111. package/dist/status.js +2 -3
  112. package/dist/status.js.map +1 -1
  113. package/dist/stickyComments.d.ts +1 -1
  114. package/dist/verifyWebhook.d.ts +2 -2
  115. package/dist/verifyWebhook.d.ts.map +1 -1
  116. package/dist/verifyWebhook.js +3 -10
  117. package/dist/verifyWebhook.js.map +1 -1
  118. package/dist/viewerRepositoryAccess.d.ts +46 -0
  119. package/dist/viewerRepositoryAccess.d.ts.map +1 -0
  120. package/dist/viewerRepositoryAccess.js +54 -0
  121. package/dist/viewerRepositoryAccess.js.map +1 -0
  122. package/package.json +13 -6
  123. package/src/GitHub.ts +34 -15
  124. package/src/adapters/manualRedirects.ts +6 -0
  125. package/src/adapters/mergeResponseHeaders.ts +8 -0
  126. package/src/adapters/resolveApiUrl.ts +5 -0
  127. package/src/adapters/signAppJwt.ts +16 -0
  128. package/src/adapters/verifySignature.ts +13 -0
  129. package/src/adapters/zipEntries.ts +69 -0
  130. package/src/appJwt.ts +3 -12
  131. package/src/appTokens.ts +2 -1
  132. package/src/artifactErrors.ts +26 -0
  133. package/src/artifactExtraction.ts +62 -0
  134. package/src/artifactPaths.ts +36 -0
  135. package/src/artifacts.ts +35 -40
  136. package/src/authenticatedRequest.ts +8 -9
  137. package/src/cache.ts +2 -1
  138. package/src/checkRuns.ts +5 -5
  139. package/src/errors.ts +6 -0
  140. package/src/gitSchemas.ts +52 -0
  141. package/src/installationClients.ts +18 -12
  142. package/src/markdown.ts +4 -0
  143. package/src/markdownRows.ts +54 -9
  144. package/src/pagedLists.ts +40 -0
  145. package/src/repositoryAddress.ts +32 -0
  146. package/src/repositoryReads.ts +62 -0
  147. package/src/repositorySchemas.ts +43 -0
  148. package/src/representations.ts +6 -5
  149. package/src/requests.ts +12 -14
  150. package/src/status.ts +3 -3
  151. package/src/verifyWebhook.ts +4 -10
  152. package/src/viewerRepositoryAccess.ts +66 -0
@@ -7,18 +7,14 @@ export declare const GitHubAppCredentials: Context.Service<{
7
7
  readonly credentials: AppCredentials;
8
8
  }>;
9
9
  export declare const GitHubApp: Context.Service<"@shivaedev/github/GitHubApp", Readonly<{
10
- readonly installation: (installationId: number) => Effect.Effect<Readonly<{
11
- 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").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>;
12
- readonly list: (path: string, beforeRequest?: ((resource: string) => Effect.Effect<void, import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable>) | undefined, byteLimit?: number | undefined) => Effect.Effect<import("effect/Stream").Stream<{
13
- decode: <TSchema extends import("effect/Schema").Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], import("effect/Schema").SchemaError, TSchema["DecodingServices"]>;
14
- hasNext: boolean;
15
- }, 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>;
10
+ readonly installation: (id: number) => Effect.Effect<Readonly<{
11
+ 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>;
16
12
  readonly read: (path: string, byteLimit?: number | undefined) => Effect.Effect<{
17
13
  decode: <TSchema extends import("effect/Schema").Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], import("effect/Schema").SchemaError, TSchema["DecodingServices"]>;
18
- }, 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>;
14
+ }, 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>;
19
15
  readonly write: (method: "DELETE" | "PATCH" | "POST" | "PUT", path: string, body?: unknown, byteLimit?: number | undefined) => Effect.Effect<{
20
16
  decode: <TSchema extends import("effect/Schema").Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], import("effect/Schema").SchemaError, TSchema["DecodingServices"]>;
21
- }, 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>;
17
+ }, 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>;
22
18
  readonly createCheckRun: (owner: string, repo: string, input: {
23
19
  readonly detailsUrl?: string | undefined;
24
20
  readonly headSha: string;
@@ -56,7 +52,7 @@ export declare const GitHubApp: Context.Service<"@shivaedev/github/GitHubApp", R
56
52
  readonly title: string | null;
57
53
  };
58
54
  readonly status: "completed" | "in_progress" | "pending" | "queued" | "requested" | "waiting";
59
- }, 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("effect/Schema").SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
55
+ }, 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 | import("effect/Schema").SchemaError, never>;
60
56
  readonly findLatestCheckRun: (owner: string, repo: string, input: {
61
57
  readonly appId?: number | undefined;
62
58
  readonly headSha: string;
@@ -80,7 +76,7 @@ export declare const GitHubApp: Context.Service<"@shivaedev/github/GitHubApp", R
80
76
  readonly title: string | null;
81
77
  };
82
78
  readonly status: "completed" | "in_progress" | "pending" | "queued" | "requested" | "waiting";
83
- }>, 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("effect/Schema").SchemaError | import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
79
+ }>, 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 | import("effect/Schema").SchemaError | import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable, never>;
84
80
  readonly updateCheckRun: (owner: string, repo: string, id: number, input: {
85
81
  readonly detailsUrl?: string | undefined;
86
82
  readonly output?: {
@@ -113,7 +109,7 @@ export declare const GitHubApp: Context.Service<"@shivaedev/github/GitHubApp", R
113
109
  readonly title: string | null;
114
110
  };
115
111
  readonly status: "completed" | "in_progress" | "pending" | "queued" | "requested" | "waiting";
116
- }, 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("effect/Schema").SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
112
+ }, 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 | import("effect/Schema").SchemaError, never>;
117
113
  readonly upsertCheckRun: (owner: string, repo: string, input: {
118
114
  readonly detailsUrl?: string | undefined;
119
115
  readonly headSha: string;
@@ -151,7 +147,174 @@ export declare const GitHubApp: Context.Service<"@shivaedev/github/GitHubApp", R
151
147
  readonly title: string | null;
152
148
  };
153
149
  readonly status: "completed" | "in_progress" | "pending" | "queued" | "requested" | "waiting";
154
- }, 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 | import("effect/Schema").SchemaError | import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
150
+ }, 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 | import("effect/Schema").SchemaError | import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable, never>;
151
+ readonly compareCommits: (owner: string, repo: string, base: string, head: string, byteLimit?: number | undefined) => Effect.Effect<{
152
+ readonly aheadBy: number;
153
+ readonly behindBy: number;
154
+ readonly commits: readonly {
155
+ readonly author: {
156
+ readonly avatarUrl: string;
157
+ readonly htmlUrl: string;
158
+ readonly id: number;
159
+ readonly login: string;
160
+ readonly type: string;
161
+ } | null;
162
+ readonly commit: {
163
+ readonly author: {
164
+ readonly date: string;
165
+ readonly email: string;
166
+ readonly name: string;
167
+ } | null;
168
+ readonly committer: {
169
+ readonly date: string;
170
+ readonly email: string;
171
+ readonly name: string;
172
+ } | null;
173
+ readonly message: string;
174
+ readonly tree: {
175
+ readonly sha: string;
176
+ readonly url: string;
177
+ };
178
+ };
179
+ readonly committer: {
180
+ readonly avatarUrl: string;
181
+ readonly htmlUrl: string;
182
+ readonly id: number;
183
+ readonly login: string;
184
+ readonly type: string;
185
+ } | null;
186
+ readonly htmlUrl: string;
187
+ readonly parents: readonly {
188
+ readonly sha: string;
189
+ readonly url: string;
190
+ }[];
191
+ readonly sha: string;
192
+ }[];
193
+ readonly files?: readonly {
194
+ readonly additions: number;
195
+ readonly changes: number;
196
+ readonly deletions: number;
197
+ readonly filename: string;
198
+ readonly patch?: string | undefined;
199
+ readonly previousFilename?: string | undefined;
200
+ readonly sha: string;
201
+ readonly status: string;
202
+ }[] | undefined;
203
+ readonly status: "ahead" | "behind" | "diverged" | "identical";
204
+ readonly totalCommits: number;
205
+ }, 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 | import("effect/Schema").SchemaError, never>;
206
+ readonly getCollaboratorPermission: (owner: string, repo: string, username: string, byteLimit?: number | undefined) => Effect.Effect<{
207
+ readonly permission: string;
208
+ readonly roleName: string;
209
+ readonly user: {
210
+ readonly avatarUrl: string;
211
+ readonly htmlUrl: string;
212
+ readonly id: number;
213
+ readonly login: string;
214
+ readonly type: string;
215
+ };
216
+ }, 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 | import("effect/Schema").SchemaError, never>;
217
+ readonly getCommit: (owner: string, repo: string, ref: string, byteLimit?: number | undefined) => Effect.Effect<{
218
+ readonly author: {
219
+ readonly avatarUrl: string;
220
+ readonly htmlUrl: string;
221
+ readonly id: number;
222
+ readonly login: string;
223
+ readonly type: string;
224
+ } | null;
225
+ readonly commit: {
226
+ readonly author: {
227
+ readonly date: string;
228
+ readonly email: string;
229
+ readonly name: string;
230
+ } | null;
231
+ readonly committer: {
232
+ readonly date: string;
233
+ readonly email: string;
234
+ readonly name: string;
235
+ } | null;
236
+ readonly message: string;
237
+ readonly tree: {
238
+ readonly sha: string;
239
+ readonly url: string;
240
+ };
241
+ };
242
+ readonly committer: {
243
+ readonly avatarUrl: string;
244
+ readonly htmlUrl: string;
245
+ readonly id: number;
246
+ readonly login: string;
247
+ readonly type: string;
248
+ } | null;
249
+ readonly htmlUrl: string;
250
+ readonly parents: readonly {
251
+ readonly sha: string;
252
+ readonly url: string;
253
+ }[];
254
+ readonly sha: string;
255
+ readonly files?: readonly {
256
+ readonly additions: number;
257
+ readonly changes: number;
258
+ readonly deletions: number;
259
+ readonly filename: string;
260
+ readonly patch?: string | undefined;
261
+ readonly previousFilename?: string | undefined;
262
+ readonly sha: string;
263
+ readonly status: string;
264
+ }[] | undefined;
265
+ readonly stats: {
266
+ readonly additions: number;
267
+ readonly deletions: number;
268
+ readonly total: number;
269
+ };
270
+ }, 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 | import("effect/Schema").SchemaError, never>;
271
+ readonly getIssue: (owner: string, repo: string, number: number, byteLimit?: number | undefined) => Effect.Effect<{
272
+ readonly body: string | null;
273
+ readonly closedAt: string | null;
274
+ readonly createdAt: string;
275
+ readonly htmlUrl: string;
276
+ readonly id: number;
277
+ readonly labels: readonly (string | {
278
+ readonly name?: string | undefined;
279
+ })[];
280
+ readonly number: number;
281
+ readonly pullRequest?: {
282
+ readonly url: string;
283
+ } | undefined;
284
+ readonly state: "closed" | "open";
285
+ readonly title: string;
286
+ readonly updatedAt: string;
287
+ readonly user: {
288
+ readonly avatarUrl: string;
289
+ readonly htmlUrl: string;
290
+ readonly id: number;
291
+ readonly login: string;
292
+ readonly type: string;
293
+ } | null;
294
+ }, 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 | import("effect/Schema").SchemaError, never>;
295
+ readonly getTree: (owner: string, repo: string, sha: string, options?: {
296
+ readonly recursive?: boolean;
297
+ readonly responseByteLimit?: number | undefined;
298
+ } | undefined) => Effect.Effect<{
299
+ readonly sha: string;
300
+ readonly tree: readonly {
301
+ readonly mode: string;
302
+ readonly path: string;
303
+ readonly sha: string;
304
+ readonly size?: number | undefined;
305
+ readonly type: "blob" | "commit" | "tree";
306
+ readonly url?: string | undefined;
307
+ }[];
308
+ readonly truncated: boolean;
309
+ readonly url: string;
310
+ }, 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 | import("effect/Schema").SchemaError, never>;
311
+ readonly getUser: (username?: string | undefined, byteLimit?: number | undefined) => Effect.Effect<{
312
+ readonly avatarUrl: string;
313
+ readonly htmlUrl: string;
314
+ readonly id: number;
315
+ readonly login: string;
316
+ readonly type: string;
317
+ }, 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 | import("effect/Schema").SchemaError, never>;
155
318
  readonly upsertStickyComment: (input: {
156
319
  readonly appId?: number | undefined;
157
320
  readonly author?: string | undefined;
@@ -170,12 +333,125 @@ export declare const GitHubApp: Context.Service<"@shivaedev/github/GitHubApp", R
170
333
  readonly login: string;
171
334
  readonly type?: string | undefined;
172
335
  } | null;
173
- }, 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 | import("effect/Schema").SchemaError | import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
174
- 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>;
336
+ }, 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 | import("effect/Schema").SchemaError | import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable, never>;
337
+ 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>;
338
+ readonly list: <E = import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable>(path: string, beforeRequest?: (resource: string) => Effect.Effect<void, E>, byteLimit?: number) => Effect.Effect<import("effect/Stream").Stream<{
339
+ decode: <TSchema extends import("effect/Schema").Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], import("effect/Schema").SchemaError, TSchema["DecodingServices"]>;
340
+ hasNext: boolean;
341
+ }, 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>;
342
+ readonly listCommits: <E = import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable>(owner: string, repo: string, options?: import("./repositoryReads.ts").RepositoryListOptions<E>) => Effect.Effect<import("effect/Stream").Stream<{
343
+ hasNext: boolean;
344
+ items: {
345
+ readonly author: {
346
+ readonly avatarUrl: string;
347
+ readonly htmlUrl: string;
348
+ readonly id: number;
349
+ readonly login: string;
350
+ readonly type: string;
351
+ } | null;
352
+ readonly commit: {
353
+ readonly author: {
354
+ readonly date: string;
355
+ readonly email: string;
356
+ readonly name: string;
357
+ } | null;
358
+ readonly committer: {
359
+ readonly date: string;
360
+ readonly email: string;
361
+ readonly name: string;
362
+ } | null;
363
+ readonly message: string;
364
+ readonly tree: {
365
+ readonly sha: string;
366
+ readonly url: string;
367
+ };
368
+ };
369
+ readonly committer: {
370
+ readonly avatarUrl: string;
371
+ readonly htmlUrl: string;
372
+ readonly id: number;
373
+ readonly login: string;
374
+ readonly type: string;
375
+ } | null;
376
+ readonly htmlUrl: string;
377
+ readonly parents: readonly {
378
+ readonly sha: string;
379
+ readonly url: string;
380
+ }[];
381
+ readonly sha: string;
382
+ }[];
383
+ skipped: number;
384
+ }, 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 | import("effect/Schema").SchemaError, never>, never, never>;
385
+ readonly listIssues: <E = import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable>(owner: string, repo: string, options?: import("./repositoryReads.ts").RepositoryListOptions<E>) => Effect.Effect<import("effect/Stream").Stream<{
386
+ hasNext: boolean;
387
+ items: {
388
+ readonly body: string | null;
389
+ readonly closedAt: string | null;
390
+ readonly createdAt: string;
391
+ readonly htmlUrl: string;
392
+ readonly id: number;
393
+ readonly labels: readonly (string | {
394
+ readonly name?: string | undefined;
395
+ })[];
396
+ readonly number: number;
397
+ readonly pullRequest?: {
398
+ readonly url: string;
399
+ } | undefined;
400
+ readonly state: "closed" | "open";
401
+ readonly title: string;
402
+ readonly updatedAt: string;
403
+ readonly user: {
404
+ readonly avatarUrl: string;
405
+ readonly htmlUrl: string;
406
+ readonly id: number;
407
+ readonly login: string;
408
+ readonly type: string;
409
+ } | null;
410
+ }[];
411
+ skipped: number;
412
+ }, 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 | import("effect/Schema").SchemaError, never>, never, never>;
413
+ readonly listPullRequestFiles: <E = import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable>(owner: string, repo: string, number: number, options?: import("./repositoryReads.ts").RepositoryListOptions<E>) => Effect.Effect<import("effect/Stream").Stream<{
414
+ hasNext: boolean;
415
+ items: {
416
+ readonly additions: number;
417
+ readonly changes: number;
418
+ readonly deletions: number;
419
+ readonly filename: string;
420
+ readonly patch?: string | undefined;
421
+ readonly previousFilename?: string | undefined;
422
+ readonly sha: string;
423
+ readonly status: string;
424
+ }[];
425
+ skipped: number;
426
+ }, 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 | import("effect/Schema").SchemaError, never>, never, never>;
175
427
  readonly observations: () => Effect.Effect<import("./rateLimits.ts").RateLimitObservation[], never, never>;
176
428
  readonly resource: (path: string) => Effect.Effect<string, never, never>;
177
- 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>;
429
+ 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>;
178
430
  }>, never, never>;
431
+ readonly viewerRepositories: (account: string | number) => Effect.Effect<{
432
+ administrable: ({
433
+ readonly htmlUrl: string;
434
+ readonly id: number;
435
+ readonly name: string;
436
+ readonly owner: {
437
+ readonly login: string;
438
+ };
439
+ readonly private: boolean;
440
+ } & {
441
+ readonly installationId: number;
442
+ })[];
443
+ readable: ({
444
+ readonly htmlUrl: string;
445
+ readonly id: number;
446
+ readonly name: string;
447
+ readonly owner: {
448
+ readonly login: string;
449
+ };
450
+ readonly private: boolean;
451
+ } & {
452
+ readonly installationId: number;
453
+ })[];
454
+ }, 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 | import("effect/Schema").SchemaError | import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable, never>;
179
455
  }>> & {
180
456
  readonly layer: Layer.Layer<"@shivaedev/github/GitHubApp", never, HttpClient.HttpClient | {
181
457
  readonly credentials: AppCredentials;
@@ -1 +1 @@
1
- {"version":3,"file":"installationClients.d.ts","sourceRoot":"","sources":["../src/installationClients.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAKjD,eAAO,MAAM,oBAAoB;0BAA2C,cAAc;;;EAAuC,CAAC;AAElI,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAFsD,cAAc;;CA6BxF,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,+FAI/F"}
1
+ {"version":3,"file":"installationClients.d.ts","sourceRoot":"","sources":["../src/installationClients.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAMjD,eAAO,MAAM,oBAAoB;0BAA2C,cAAc;;;EAAuC,CAAC;AAElI,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAFsD,cAAc;;CAkCxF,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,+FAI/F"}
@@ -4,21 +4,30 @@ import { defineService } from "@shivaedev/service/defineService.ts";
4
4
  import { appTokens } from "#appTokens.ts";
5
5
  import { GitHub } from "#GitHub.ts";
6
6
  import { GitHubConfig } from "#GitHubConfig.ts";
7
+ import { viewerRepositoryAccess } from "#viewerRepositoryAccess.ts";
7
8
  export const GitHubAppCredentials = Context.Service("@shivaedev/github/AppCredentials");
8
9
  export const GitHubApp = defineService({
9
10
  id: "@shivaedev/github/GitHubApp",
10
11
  initialize: Effect.gen(function* () {
11
- const { credentials } = yield* GitHubAppCredentials;
12
+ const { credentials: supplied } = yield* GitHubAppCredentials;
13
+ const credentials = { appId: supplied.appId, privateKey: supplied.privateKey };
12
14
  const http = yield* HttpClient.HttpClient;
13
15
  const config = yield* GitHubConfig;
14
- return yield* Cache.make({
16
+ const environment = Layer.mergeAll(Layer.succeed(HttpClient.HttpClient)(http), Layer.succeed(GitHubConfig)(config));
17
+ const app = yield* Layer.build(GitHub.layer.pipe(Layer.provide(appTokens(credentials)), Layer.provide(environment))).pipe(Effect.scoped, Effect.map((context) => Context.get(context, GitHub)));
18
+ const clients = yield* Cache.make({
15
19
  capacity: 100,
16
- lookup: (installationId) => Layer.build(GitHub.layer.pipe(Layer.provide(appTokens({ ...credentials, installationId })), Layer.provide(Layer.succeed(HttpClient.HttpClient)(http)), Layer.provide(Layer.succeed(GitHubConfig)(config)))).pipe(Effect.scoped, Effect.map((context) => Context.get(context, GitHub))),
20
+ lookup: (installationId) => Layer.build(GitHub.layer.pipe(Layer.provide(appTokens({ ...credentials, installationId })), Layer.provide(environment))).pipe(Effect.scoped, Effect.map((context) => Context.get(context, GitHub))),
17
21
  timeToLive: "30 minutes",
18
22
  });
23
+ function installation(id) {
24
+ return Cache.get(clients, id).pipe(Effect.tap((client) => Cache.set(clients, id, client)));
25
+ }
26
+ return { installation, viewers: yield* viewerRepositoryAccess(app, installation) };
19
27
  }),
20
- methods: (clients) => ({
21
- installation: (installationId) => Cache.get(clients, installationId).pipe(Effect.tap((client) => Cache.set(clients, installationId, client))),
28
+ methods: ({ installation, viewers }) => ({
29
+ installation,
30
+ viewerRepositories: (account) => Cache.get(viewers, typeof account === "number" ? `id:${account}` : `login:${account.toLowerCase()}`),
22
31
  }),
23
32
  requires: [GitHubAppCredentials, HttpClient.HttpClient, GitHubConfig],
24
33
  });
@@ -1 +1 @@
1
- {"version":3,"file":"installationClients.js","sourceRoot":"","sources":["../src/installationClients.ts"],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G,CAAC;IACF,QAAQ,EAAE,CAAC,oBAAoB,EAAE,UAAU,CAAC,UAAU,EAAE,YAAY,CAAC;CACrE,CAAC,CAAC;AAEH,MAAM,UAAU,gBAAgB,CAAU,cAAsB,EAAE,MAA8B;IAC/F,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CACxC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAC3G,CAAC;AACH,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export declare function plainText(text: string): string;
2
2
  export declare function codeSpan(text: string): string;
3
3
  export declare function tableCell(text: string, format?: "text" | "code"): string;
4
+ export declare function details(summary: string, text: string): string;
4
5
  //# sourceMappingURL=markdown.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK9C;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAY7C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,MAAe,GAAG,MAAM,CAGhF"}
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK9C;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAY7C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,MAAe,GAAG,MAAM,CAGhF;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7D"}
package/dist/markdown.js CHANGED
@@ -21,4 +21,7 @@ export function tableCell(text, format = "text") {
21
21
  const content = text.replace(/\r\n|[\r\n\u2028\u2029]/gu, " ");
22
22
  return format === "code" ? codeSpan(content.replaceAll("|", "\\|")) : plainText(content);
23
23
  }
24
+ export function details(summary, text) {
25
+ return `<details>\n<summary>${plainText(summary)}</summary>\n\n${plainText(text)}\n\n</details>`;
26
+ }
24
27
  //# sourceMappingURL=markdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.js","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,SAAS,CAAC,IAAY;IACrC,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC,SAAS,EAAE,EAAE;QACrD,MAAM,SAAS,GAAG,SAAS,KAAK,GAAG,IAAI,SAAS,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1E,OAAO,KAAK,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC;IACpD,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,IAAY;IACpC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;IAClD,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;QACpB,OAAO,EAAE,CAAC;IACX,CAAC;IACD,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,KAAK,MAAM,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9C,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IACD,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,GA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import { MarkdownBudgetTooSmall } from "./errors.ts";
1
3
  export interface MarkdownRowsOptions {
2
4
  readonly byteLimit?: number;
3
5
  readonly header?: string;
4
6
  }
5
- export declare function renderRows(rows: readonly string[], { byteLimit, header }?: MarkdownRowsOptions): string;
7
+ export interface MarkdownRowsSection {
8
+ readonly header?: string;
9
+ readonly rows: readonly string[];
10
+ }
11
+ export declare function renderRows(rows: readonly string[], { byteLimit, header }?: MarkdownRowsOptions): Result.Result<string, MarkdownBudgetTooSmall>;
12
+ export declare function renderSections(sections: readonly MarkdownRowsSection[], { byteLimit }?: Pick<MarkdownRowsOptions, "byteLimit">): Result.Result<string, MarkdownBudgetTooSmall>;
6
13
  //# sourceMappingURL=markdownRows.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdownRows.d.ts","sourceRoot":"","sources":["../src/markdownRows.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,SAAkB,EAAE,MAAW,EAAE,GAAE,mBAAwB,GAAG,MAAM,CAwBzH"}
1
+ {"version":3,"file":"markdownRows.d.ts","sourceRoot":"","sources":["../src/markdownRows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CACjC;AAED,wBAAgB,UAAU,CACzB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,EAAE,SAAkB,EAAE,MAAW,EAAE,GAAE,mBAAwB,GAC3D,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAE/C;AAED,wBAAgB,cAAc,CAC7B,QAAQ,EAAE,SAAS,mBAAmB,EAAE,EACxC,EAAE,SAAkB,EAAE,GAAE,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAM,GACjE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAgB/C"}
@@ -1,4 +1,26 @@
1
+ import { Result } from "effect";
2
+ import { MarkdownBudgetTooSmall } from "./errors.js";
1
3
  export function renderRows(rows, { byteLimit = 60_000, header = "" } = {}) {
4
+ return prepareRows({ header, rows }).render(byteLimit);
5
+ }
6
+ export function renderSections(sections, { byteLimit = 60_000 } = {}) {
7
+ const prepared = sections.filter(({ rows, header = "" }) => rows.length > 0 || header !== "").map(prepareRows);
8
+ let reserved = prepared.reduce((total, section) => total + section.minimumBytes, 0) + Math.max(0, prepared.length - 1) * 2;
9
+ let remaining = byteLimit;
10
+ const bodies = [];
11
+ for (const section of prepared) {
12
+ reserved -= section.minimumBytes;
13
+ const body = section.render(remaining - reserved);
14
+ if (Result.isFailure(body)) {
15
+ return Result.fail(new MarkdownBudgetTooSmall({ byteLimit }));
16
+ }
17
+ bodies.push(body.success);
18
+ remaining -= new TextEncoder().encode(body.success).byteLength + 2;
19
+ reserved -= 2;
20
+ }
21
+ return Result.succeed(bodies.join("\n\n"));
22
+ }
23
+ function prepareRows({ rows, header = "" }) {
2
24
  const encoder = new TextEncoder();
3
25
  const sizes = [0];
4
26
  for (const row of rows) {
@@ -11,16 +33,25 @@ export function renderRows(rows, { byteLimit = 60_000, header = "" } = {}) {
11
33
  function body(kept) {
12
34
  return [...(header === "" ? [] : [header]), ...rows.slice(0, kept)].join("\n");
13
35
  }
14
- if (bodySize(rows.length) <= byteLimit) {
15
- return body(rows.length);
16
- }
17
- for (let kept = rows.length - 1; kept >= 0; kept -= 1) {
36
+ function omitted(kept) {
18
37
  const notice = `and ${rows.length - kept} more`;
19
38
  const separator = kept > 0 || header !== "" ? "\n\n" : "";
20
- if (bodySize(kept) + separator.length + encoder.encode(notice).byteLength <= byteLimit) {
21
- return body(kept) + separator + notice;
22
- }
39
+ return { bytes: bodySize(kept) + separator.length + encoder.encode(notice).byteLength, notice, separator };
23
40
  }
24
- throw new RangeError("The byte limit must fit the header and omitted-row notice");
41
+ return {
42
+ minimumBytes: rows.length === 0 ? headerBytes : Math.min(bodySize(rows.length), omitted(0).bytes),
43
+ render(byteLimit) {
44
+ if (bodySize(rows.length) <= byteLimit) {
45
+ return Result.succeed(body(rows.length));
46
+ }
47
+ for (let kept = rows.length - 1; kept >= 0; kept -= 1) {
48
+ const { notice, separator, bytes } = omitted(kept);
49
+ if (bytes <= byteLimit) {
50
+ return Result.succeed(body(kept) + separator + notice);
51
+ }
52
+ }
53
+ return Result.fail(new MarkdownBudgetTooSmall({ byteLimit }));
54
+ },
55
+ };
25
56
  }
26
57
  //# sourceMappingURL=markdownRows.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdownRows.js","sourceRoot":"","sources":["../src/markdownRows.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,UAAU,CAAC,IAAuB,EAAE,EAAE,SAAS,GAAG,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,GAAwB,EAAE;IAChH,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;IAClB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,GAAG,CAA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,MAAM,GAAG,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC;gBACvD,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;gBACnD,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC;oBACxB,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,SAAS,GAAG,MAAM,CAAC,CAAC;gBACxD,CAAC;YACF,CAAC;YACD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,sBAAsB,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;QAC/D,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { Effect, Schema, Stream } from "effect";
2
+ import type { ServiceUnavailable } from "@shivaedev/errors/taxonomy.ts";
3
+ import type { Representations } from "#representations.ts";
4
+ export interface ListOptions<E = ServiceUnavailable> {
5
+ readonly arrayKey?: string | undefined;
6
+ readonly beforeRequest?: (resource: string) => Effect.Effect<void, E>;
7
+ readonly onDecodeError?: "fail" | "skip" | undefined;
8
+ readonly responseByteLimit?: number | undefined;
9
+ }
10
+ export declare function decodedPages<TSchema extends Schema.Constraint, E = ServiceUnavailable>(client: Representations, path: string, schema: TSchema, options?: ListOptions<E> | number): Stream.Stream<{
11
+ hasNext: boolean;
12
+ items: TSchema["Type"][];
13
+ skipped: number;
14
+ }, 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, TSchema["DecodingServices"]>;
15
+ //# sourceMappingURL=pagedLists.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagedLists.d.ts","sourceRoot":"","sources":["../src/pagedLists.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,kBAAkB;IAClD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACtE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACrD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChD;AAED,wBAAgB,YAAY,CAAC,OAAO,SAAS,MAAM,CAAC,UAAU,EAAE,CAAC,GAAG,kBAAkB,EACrF,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,OAAO,EACf,OAAO,GAAE,WAAW,CAAC,CAAC,CAAC,GAAG,MAAW;;;;2vBAwBrC"}