@shivaedev/github 0.9.0 → 0.10.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.
- package/CHANGELOG.md +18 -0
- package/README.md +95 -5
- package/dist/GitHub.d.ts +262 -3
- package/dist/GitHub.d.ts.map +1 -1
- package/dist/GitHub.js +15 -5
- package/dist/GitHub.js.map +1 -1
- package/dist/adapters/resolveApiUrl.d.ts +2 -0
- package/dist/adapters/resolveApiUrl.d.ts.map +1 -0
- package/dist/adapters/resolveApiUrl.js +6 -0
- package/dist/adapters/resolveApiUrl.js.map +1 -0
- package/dist/adapters/zipEntries.d.ts +17 -0
- package/dist/adapters/zipEntries.d.ts.map +1 -0
- package/dist/adapters/zipEntries.js +57 -0
- package/dist/adapters/zipEntries.js.map +1 -0
- package/dist/appTokens.d.ts.map +1 -1
- package/dist/appTokens.js +2 -1
- package/dist/appTokens.js.map +1 -1
- package/dist/artifactErrors.d.ts +34 -0
- package/dist/artifactErrors.d.ts.map +1 -0
- package/dist/artifactErrors.js +27 -0
- package/dist/artifactErrors.js.map +1 -0
- package/dist/artifactExtraction.d.ts +12 -0
- package/dist/artifactExtraction.d.ts.map +1 -0
- package/dist/artifactExtraction.js +40 -0
- package/dist/artifactExtraction.js.map +1 -0
- package/dist/artifactPaths.d.ts +4 -0
- package/dist/artifactPaths.d.ts.map +1 -0
- package/dist/artifactPaths.js +35 -0
- package/dist/artifactPaths.js.map +1 -0
- package/dist/artifacts.d.ts +13 -8
- package/dist/artifacts.d.ts.map +1 -1
- package/dist/artifacts.js +15 -8
- package/dist/artifacts.js.map +1 -1
- package/dist/checkRuns.d.ts.map +1 -1
- package/dist/checkRuns.js +5 -3
- package/dist/checkRuns.js.map +1 -1
- package/dist/gitSchemas.d.ts +195 -0
- package/dist/gitSchemas.d.ts.map +1 -0
- package/dist/gitSchemas.js +45 -0
- package/dist/gitSchemas.js.map +1 -0
- package/dist/installationClients.d.ts +278 -2
- package/dist/installationClients.d.ts.map +1 -1
- package/dist/installationClients.js +14 -5
- package/dist/installationClients.js.map +1 -1
- package/dist/pagedLists.d.ts +15 -0
- package/dist/pagedLists.d.ts.map +1 -0
- package/dist/pagedLists.js +16 -0
- package/dist/pagedLists.js.map +1 -0
- package/dist/repositoryReads.d.ts +261 -0
- package/dist/repositoryReads.d.ts.map +1 -0
- package/dist/repositoryReads.js +30 -0
- package/dist/repositoryReads.js.map +1 -0
- package/dist/repositorySchemas.d.ts +73 -0
- package/dist/repositorySchemas.d.ts.map +1 -0
- package/dist/repositorySchemas.js +38 -0
- package/dist/repositorySchemas.js.map +1 -0
- package/dist/representations.d.ts.map +1 -1
- package/dist/representations.js +3 -2
- package/dist/representations.js.map +1 -1
- package/dist/viewerRepositoryAccess.d.ts +46 -0
- package/dist/viewerRepositoryAccess.d.ts.map +1 -0
- package/dist/viewerRepositoryAccess.js +54 -0
- package/dist/viewerRepositoryAccess.js.map +1 -0
- package/package.json +11 -4
- package/src/GitHub.ts +17 -10
- package/src/adapters/resolveApiUrl.ts +5 -0
- package/src/adapters/zipEntries.ts +69 -0
- package/src/appTokens.ts +2 -1
- package/src/artifactErrors.ts +26 -0
- package/src/artifactExtraction.ts +62 -0
- package/src/artifactPaths.ts +36 -0
- package/src/artifacts.ts +36 -39
- package/src/checkRuns.ts +5 -5
- package/src/gitSchemas.ts +52 -0
- package/src/installationClients.ts +18 -12
- package/src/pagedLists.ts +40 -0
- package/src/repositoryReads.ts +61 -0
- package/src/repositorySchemas.ts +43 -0
- package/src/representations.ts +3 -2
- package/src/viewerRepositoryAccess.ts +66 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.0 - 2026-11-02
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Add typed, byte-capped issue, user, collaborator-permission, commit, comparison and tree reads, plus paged issue, pull-request-file and commit lists on the GitHub service.
|
|
8
|
+
- Let Schema-aware lists select arrays inside envelopes, pace each request and opt into skipping undecodable items. `listPages` reports decoded items and skipped counts for each page; `listBounded` includes the total `skipped` count alongside `items` and `truncated`. Existing numeric byte-limit arguments remain supported, and decoding still fails by default.
|
|
9
|
+
- `GitHubApp.viewerRepositories(account)` accepts a GitHub account ID or login and returns readable and administrable installed repositories, with access results cached for 60 seconds across at most 100 accounts.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Preserve configured GitHub API path prefixes in representation reads, lists and writes, App installation discovery and token exchange, and artifact API requests. API origins without a path keep their existing behavior.
|
|
14
|
+
- Keep shared App clients independent of a single-installation Layer's repository and permission scope.
|
|
15
|
+
|
|
16
|
+
### Breaking
|
|
17
|
+
|
|
18
|
+
- `downloadArtifactArchive` now returns an array of `{ path, bytes }` files instead of raw ZIP bytes. Install the optional `@zip.js/zip.js` peer and consume these validated files instead of passing the result to an application ZIP reader. Extraction refuses unsafe paths, symlinks, duplicate paths and file/directory conflicts, with distinct typed errors. The default caps are 100 MiB of extracted contents and a per-entry compression ratio of 100:1; set `totalSizeLimit` and `compressionRatioLimit` to change them. The existing `byteLimit` still caps the downloaded ZIP.
|
|
19
|
+
- The low-level `artifacts` constructor now takes `(apiUrl, rates)` and returns an Effect. Yield it with `HttpClient`, `GitHubToken` and `TokenRefresh` provided instead of passing those services as arguments.
|
|
20
|
+
|
|
3
21
|
## 0.9.0 - 2026-11-02
|
|
4
22
|
|
|
5
23
|
### Added
|
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ const diff = Effect.gen(function* () {
|
|
|
76
76
|
|
|
77
77
|
The service's `read(path)` and `write(method, path, body)` return a representation with a generic `decode(schema)` method. Its `list(path)` returns an Effect containing a Stream of page representations. These methods accept the same trailing byte limit: `read(path, byteLimit)`, `write(method, path, body, byteLimit)` and `list(path, beforeRequest, byteLimit)`; pass `undefined` for `beforeRequest` when no pacing callback is needed. Prefer the exported functions for Schema-decoded items. Each page representation exposes `hasNext`, which reports whether its Link header names a next page without fetching it. A caller with a pacing policy can pass `github.list(path, beforeRequest)`: the callback receives the resource name before each page request, and its typed failure stops the stream. `github.resource(path)` returns the observed resource for that path, defaulting to core or search before the first response.
|
|
78
78
|
|
|
79
|
-
Use `listBounded(path, itemSchema, pageCap,
|
|
79
|
+
Use `listBounded(path, itemSchema, pageCap, options?)` to collect a prefix within a positive page cap. It returns `{ items, skipped, truncated }`; `truncated` is true exactly when the last fetched page names a next page. It never requests or decodes a page beyond the cap, and uses the same pagination and per-page byte limits as `list`.
|
|
80
80
|
|
|
81
81
|
```ts
|
|
82
82
|
import { listBounded } from "@shivaedev/github/GitHub.ts";
|
|
@@ -84,6 +84,55 @@ import { listBounded } from "@shivaedev/github/GitHub.ts";
|
|
|
84
84
|
const issues = listBounded("/repos/acme/widgets/issues", Issue, 2);
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
+
### Enveloped lists and partial decoding
|
|
88
|
+
|
|
89
|
+
`list`, `listPages` and `listBounded` accept either the existing numeric byte cap or a `ListOptions` object (from `@shivaedev/github/pagedLists.ts`) as their last argument. Set `arrayKey` to read an array inside an envelope, such as `check_runs` or `artifacts`. The options also accept `responseByteLimit` and the service's `beforeRequest` pacing callback. Item Schemas retain their decoding service requirements.
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
const checks = listBounded("/repos/acme/widgets/commits/main/check-runs", CheckRun, 2, {
|
|
93
|
+
arrayKey: "check_runs",
|
|
94
|
+
onDecodeError: "skip",
|
|
95
|
+
responseByteLimit: 2 * 1024 * 1024,
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Import `CheckRun` from `@shivaedev/github/checkRuns.ts`. Decoding fails at the first invalid item by default. With `onDecodeError: "skip"`, valid items keep their order and `skipped` counts rejected items across the fetched pages. Invalid JSON, a missing envelope key, a non-array value, HTTP failures and byte-limit failures still fail the read. A page containing only rejected items still follows its next Link. The page cap counts fetched pages, including empty pages, and never counts pages beyond the cap.
|
|
100
|
+
|
|
101
|
+
`listPages(path, itemSchema, options?)` returns a Stream of `{ items, skipped, hasNext }` pages for consumers that need streaming counts. `list` flattens those pages into items. Both fetch only while consumed.
|
|
102
|
+
|
|
103
|
+
### Daily repository reads
|
|
104
|
+
|
|
105
|
+
The `GitHub` service includes Schema-decoded reads for common repository work:
|
|
106
|
+
|
|
107
|
+
| Method | Result |
|
|
108
|
+
| -------------------------------------------------------------- | ------------------------------------------------------------------ |
|
|
109
|
+
| `getIssue(owner, repo, number, byteLimit?)` | `Issue` |
|
|
110
|
+
| `getUser(username, byteLimit?)` | `User` |
|
|
111
|
+
| `getCollaboratorPermission(owner, repo, username, byteLimit?)` | `CollaboratorPermission` |
|
|
112
|
+
| `getCommit(owner, repo, ref, byteLimit?)` | `CommitDetail`, including stats and optional files |
|
|
113
|
+
| `compareCommits(owner, repo, base, head, byteLimit?)` | `Comparison`, including commits, optional files and `totalCommits` |
|
|
114
|
+
| `getTree(owner, repo, ref, options?)` | `GitTree`, including GitHub's `truncated` flag |
|
|
115
|
+
| `listIssues(owner, repo, options?)` | Effect containing a Stream of decoded issue pages |
|
|
116
|
+
| `listPullRequestFiles(owner, repo, number, options?)` | Effect containing a Stream of decoded file pages |
|
|
117
|
+
| `listCommits(owner, repo, options?)` | Effect containing a Stream of decoded commit pages |
|
|
118
|
+
|
|
119
|
+
The Schemas live in `@shivaedev/github/repositorySchemas.ts` and `@shivaedev/github/gitSchemas.ts`. Results use camelCase field names. Commit authors can be null, file patches can be absent for binary files, and renamed files expose `previousFilename`.
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
const review = Effect.gen(function* () {
|
|
123
|
+
const github = yield* GitHub;
|
|
124
|
+
const issue = yield* github.getIssue("acme", "widgets", 3);
|
|
125
|
+
const pages = yield* github.listPullRequestFiles("acme", "widgets", 3, { responseByteLimit: 2 * 1024 * 1024 });
|
|
126
|
+
const files = yield* pages.pipe(
|
|
127
|
+
Stream.flatMap((page) => Stream.fromIterable(page.items)),
|
|
128
|
+
Stream.runCollect,
|
|
129
|
+
);
|
|
130
|
+
return { issue, files };
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
These reads share the client's authentication, conditional representations and body caps. List options accept `query` for GitHub filters such as issue `state` or commit `sha`, along with the decoding and pacing options above. Lists request `per_page=100` unless overridden in `query`. Tree options accept `recursive` and `responseByteLimit`. Refs containing slashes are encoded as path segments. Compare and single-commit reads return one GitHub response; use `totalCommits` and GitHub's endpoint limits when choosing whether the response is sufficient for your application.
|
|
135
|
+
|
|
87
136
|
### Acting as a GitHub App
|
|
88
137
|
|
|
89
138
|
Provide `githubApp` as the `GitHubToken` Layer. With just the App ID and a PEM private key wrapped in `Redacted`, the client signs App JWTs for App-level requests. Add an installation ID for installation requests. Both use the same Schema-aware `read` and paginated `list` functions.
|
|
@@ -135,6 +184,24 @@ Provide `app(privateKey)` once around `bothInstallations` or the application. Ea
|
|
|
135
184
|
|
|
136
185
|
The shared cache holds at most 100 installation clients and evicts the least recently used client when full. Selecting a client renews its 30-minute idle lifetime; a client idle for that interval is replaced on its next selection. Expiry is lazy, with no background timer. Eviction discards the client's token and request state, and its next request exchanges a new token. Keep operations inside `withInstallation` so each selection uses the cache's current client.
|
|
137
186
|
|
|
187
|
+
### Repositories visible to an account
|
|
188
|
+
|
|
189
|
+
Pass the GitHub account from your application's session to `GitHubApp.viewerRepositories(account)`. A number is a GitHub account ID; a string is a login. Provide the same `githubApp(credentials)` Layer as above. The package has no dependency on your session or identity service.
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
import { Effect } from "effect";
|
|
193
|
+
import { GitHubApp } from "@shivaedev/github/installationClients.ts";
|
|
194
|
+
|
|
195
|
+
const access = Effect.gen(function* () {
|
|
196
|
+
const app = yield* GitHubApp;
|
|
197
|
+
return yield* app.viewerRepositories(12345);
|
|
198
|
+
});
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
The result contains `readable` and `administrable` arrays. Each entry has `id`, `name`, `owner.login`, `htmlUrl`, `private` and `installationId`. Only repositories installed for this App are included, across all installation and repository pages. Public repositories are readable even without a collaborator grant. Private repositories require GitHub's `read`, `triage`, `write`, `maintain` or `admin` permission; only `admin` grants administration. A permission lookup returning 404 means no collaborator grant. Other lookup failures fail the operation instead of returning partial access. The App needs repository Metadata read permission for these lookups.
|
|
202
|
+
|
|
203
|
+
Successful results are cached for 60 seconds, across at most 100 account keys, evicting the least recently used key when full. Login casing shares a key. Reads do not extend the lifetime. After expiry, the next call revalidates installation lists, repository lists and permissions, so revoked access, changed roles and removed repositories remain cached for at most that interval. Failed lookups are immediately eligible for another attempt. These are cached observations of GitHub access; the application chooses its authorization policy.
|
|
204
|
+
|
|
138
205
|
`scope` accepts `repositoryIds` or `repositories` (repository names), and a `permissions` record of GitHub permission names to `"read"`, `"write"` or `"admin"`. Omit `scope` for the installation's full access. Explicit `{ permissions: { metadata: "read" } }` requests a metadata-only token for access checks. GitHub decides whether the requested scope is allowed.
|
|
139
206
|
|
|
140
207
|
Alternatively, pass `{ appId, privateKey, owner: "acme", repository: "widgets", scope? }`. The Layer resolves the installation through `GET /repos/{owner}/{repo}/installation` before exchanging the App JWT for an installation token. Signing uses Node's built-in crypto. The RS256 JWT carries the App ID as `iss`, `iat` 60 seconds before the current time, and `exp` ten minutes ahead.
|
|
@@ -147,26 +214,49 @@ Installation lookups and token exchanges follow the same primary and secondary r
|
|
|
147
214
|
|
|
148
215
|
Other App authentication failures use `GitHubAppError` from `errors.ts`. Its string `reason` distinguishes `"sign"` (JWT signing), `"encode"` (request body encoding), `"transport"` (sending or reading the response), `"status"` (an HTTP refusal) and `"response"` (invalid or oversized response data). A refused exchange or installation lookup with HTTP 401 has `{ reason: "status", status: 401 }`. Caught failures remain available as a non-enumerable `cause`, excluded from JSON serialization; causes can contain credentials from the underlying HTTP request, so keep them in trusted diagnostics. The serialized errors, logs and spans exclude the private key, App JWT and installation token.
|
|
149
216
|
|
|
150
|
-
### Downloading workflow
|
|
217
|
+
### Downloading and extracting workflow artifacts
|
|
218
|
+
|
|
219
|
+
Install the optional ZIP reader to extract artifacts:
|
|
220
|
+
|
|
221
|
+
```sh
|
|
222
|
+
pnpm add @zip.js/zip.js
|
|
223
|
+
```
|
|
151
224
|
|
|
152
|
-
Call `downloadArtifactArchive` with the artifact ID and a byte cap. It requests GitHub's ZIP endpoint with the current installation token, reads the 302 Location explicitly, and issues a fresh request to storage without the GitHub Authorization or API-version headers. Fetch requests use manual redirects and omit ambient credentials; provide an HTTP client without automatic redirect middleware.
|
|
225
|
+
Call `downloadArtifactArchive` with the artifact ID and a download byte cap. It requests GitHub's ZIP endpoint with the current installation token, reads the 302 Location explicitly, and issues a fresh request to storage without the GitHub Authorization or API-version headers. Fetch requests use manual redirects and omit ambient credentials; provide an HTTP client without automatic redirect middleware.
|
|
153
226
|
|
|
154
227
|
```ts
|
|
155
228
|
import { Effect } from "effect";
|
|
156
229
|
import { GitHub } from "@shivaedev/github/GitHub.ts";
|
|
157
230
|
|
|
158
|
-
const
|
|
231
|
+
const files = Effect.gen(function* () {
|
|
159
232
|
const github = yield* GitHub;
|
|
160
233
|
return yield* github.downloadArtifactArchive({
|
|
161
234
|
owner: "acme",
|
|
162
235
|
repo: "widgets",
|
|
163
236
|
artifactId: 7,
|
|
164
237
|
byteLimit: 10 * 1024 * 1024,
|
|
238
|
+
totalSizeLimit: 100 * 1024 * 1024,
|
|
239
|
+
compressionRatioLimit: 100,
|
|
165
240
|
});
|
|
166
241
|
});
|
|
167
242
|
```
|
|
168
243
|
|
|
169
|
-
Provide an installation client such as `clients(privateKey).background` from the GitHub App example above. The result is
|
|
244
|
+
Provide an installation client such as `clients(privateKey).background` from the GitHub App example above. The result is an array of `{ path, bytes }` files (`ArtifactFile` from `artifactExtraction.ts`), with relative POSIX paths and `Uint8Array` contents. Directory entries are validated and omitted from the result. Extraction happens in memory and writes no files. The ZIP reader loads on demand; other GitHub operations do not need it.
|
|
245
|
+
|
|
246
|
+
`byteLimit` caps the downloaded ZIP while streaming and fails with `GitHubArtifactTooLarge({ limit })` from `errors.ts`. Extraction defaults to a `totalSizeLimit` of 100 MiB across all entries and a per-entry `compressionRatioLimit` of 100:1. Both caps are inclusive. The total limit must be a non-negative safe integer; the ratio must be finite and positive. Limits check declared sizes before decompression and emitted bytes before retaining them. No partial file list is returned after a refusal.
|
|
247
|
+
|
|
248
|
+
Extraction failures come from `artifactErrors.ts`:
|
|
249
|
+
|
|
250
|
+
| Error | Refusal |
|
|
251
|
+
| ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
252
|
+
| `GitHubArtifactPathTraversal({ path })` | Absolute paths, drive paths, backslashes, colons, NUL, empty or dot path components, and parent traversal |
|
|
253
|
+
| `GitHubArtifactSymlink({ path })` | Symbolic links |
|
|
254
|
+
| `GitHubArtifactDuplicateEntry({ path })` | Duplicate paths and file/directory conflicts |
|
|
255
|
+
| `GitHubArtifactCompressionRatio({ path, limit })` | An entry exceeds the ratio cap |
|
|
256
|
+
| `GitHubArtifactExtractedTooLarge({ limit })` | Combined extracted contents exceed the total cap |
|
|
257
|
+
| `GitHubArtifactExtractionError({ reason })` | Missing reader (`"reader-unavailable"`), malformed ZIP (`"invalid-archive"`) or invalid caps (`"invalid-limits"`) |
|
|
258
|
+
|
|
259
|
+
Paths remain case-sensitive.
|
|
170
260
|
|
|
171
261
|
A missing (404) or expired (410) artifact fails with `GitHubArtifactError({ stage: "redirect", status })`. A storage HTTP failure uses the same error with `stage: "download"`. Transport and GitHub rate-limit failures retain their usual typed errors.
|
|
172
262
|
|
package/dist/GitHub.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Effect, Schema, Stream } from "effect";
|
|
2
2
|
import { HttpClient } from "effect/http";
|
|
3
3
|
import { GitHubToken } from "#GitHubToken.ts";
|
|
4
|
+
import { type ListOptions } from "#pagedLists.ts";
|
|
4
5
|
export declare const GitHub: import("effect/Context").Service<"@shivaedev/github/GitHub", Readonly<{
|
|
5
|
-
readonly downloadArtifactArchive: (options: import("#artifacts.ts").ArtifactArchiveOptions) => Effect.Effect<
|
|
6
|
+
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>;
|
|
6
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<{
|
|
7
8
|
decode: <TSchema extends Schema.Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], Schema.SchemaError, TSchema["DecodingServices"]>;
|
|
8
9
|
hasNext: boolean;
|
|
@@ -146,6 +147,258 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
|
|
|
146
147
|
};
|
|
147
148
|
readonly status: "completed" | "in_progress" | "pending" | "queued" | "requested" | "waiting";
|
|
148
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>;
|
|
150
|
+
readonly compareCommits: (owner: string, repo: string, base: string, head: string, byteLimit?: number | undefined) => Effect.Effect<{
|
|
151
|
+
readonly aheadBy: number;
|
|
152
|
+
readonly behindBy: number;
|
|
153
|
+
readonly commits: readonly {
|
|
154
|
+
readonly author: {
|
|
155
|
+
readonly avatarUrl: string;
|
|
156
|
+
readonly htmlUrl: string;
|
|
157
|
+
readonly id: number;
|
|
158
|
+
readonly login: string;
|
|
159
|
+
readonly type: string;
|
|
160
|
+
} | null;
|
|
161
|
+
readonly commit: {
|
|
162
|
+
readonly author: {
|
|
163
|
+
readonly date: string;
|
|
164
|
+
readonly email: string;
|
|
165
|
+
readonly name: string;
|
|
166
|
+
} | null;
|
|
167
|
+
readonly committer: {
|
|
168
|
+
readonly date: string;
|
|
169
|
+
readonly email: string;
|
|
170
|
+
readonly name: string;
|
|
171
|
+
} | null;
|
|
172
|
+
readonly message: string;
|
|
173
|
+
readonly tree: {
|
|
174
|
+
readonly sha: string;
|
|
175
|
+
readonly url: string;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
readonly committer: {
|
|
179
|
+
readonly avatarUrl: string;
|
|
180
|
+
readonly htmlUrl: string;
|
|
181
|
+
readonly id: number;
|
|
182
|
+
readonly login: string;
|
|
183
|
+
readonly type: string;
|
|
184
|
+
} | null;
|
|
185
|
+
readonly htmlUrl: string;
|
|
186
|
+
readonly parents: readonly {
|
|
187
|
+
readonly sha: string;
|
|
188
|
+
readonly url: string;
|
|
189
|
+
}[];
|
|
190
|
+
readonly sha: string;
|
|
191
|
+
}[];
|
|
192
|
+
readonly files?: readonly {
|
|
193
|
+
readonly additions: number;
|
|
194
|
+
readonly changes: number;
|
|
195
|
+
readonly deletions: number;
|
|
196
|
+
readonly filename: string;
|
|
197
|
+
readonly patch?: string | undefined;
|
|
198
|
+
readonly previousFilename?: string | undefined;
|
|
199
|
+
readonly sha: string;
|
|
200
|
+
readonly status: string;
|
|
201
|
+
}[] | undefined;
|
|
202
|
+
readonly status: "ahead" | "behind" | "diverged" | "identical";
|
|
203
|
+
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>;
|
|
205
|
+
readonly getCollaboratorPermission: (owner: string, repo: string, username: string, byteLimit?: number | undefined) => Effect.Effect<{
|
|
206
|
+
readonly permission: string;
|
|
207
|
+
readonly roleName: string;
|
|
208
|
+
readonly user: {
|
|
209
|
+
readonly avatarUrl: string;
|
|
210
|
+
readonly htmlUrl: string;
|
|
211
|
+
readonly id: number;
|
|
212
|
+
readonly login: string;
|
|
213
|
+
readonly type: string;
|
|
214
|
+
};
|
|
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>;
|
|
216
|
+
readonly getCommit: (owner: string, repo: string, ref: string, byteLimit?: number | undefined) => Effect.Effect<{
|
|
217
|
+
readonly author: {
|
|
218
|
+
readonly avatarUrl: string;
|
|
219
|
+
readonly htmlUrl: string;
|
|
220
|
+
readonly id: number;
|
|
221
|
+
readonly login: string;
|
|
222
|
+
readonly type: string;
|
|
223
|
+
} | null;
|
|
224
|
+
readonly commit: {
|
|
225
|
+
readonly author: {
|
|
226
|
+
readonly date: string;
|
|
227
|
+
readonly email: string;
|
|
228
|
+
readonly name: string;
|
|
229
|
+
} | null;
|
|
230
|
+
readonly committer: {
|
|
231
|
+
readonly date: string;
|
|
232
|
+
readonly email: string;
|
|
233
|
+
readonly name: string;
|
|
234
|
+
} | null;
|
|
235
|
+
readonly message: string;
|
|
236
|
+
readonly tree: {
|
|
237
|
+
readonly sha: string;
|
|
238
|
+
readonly url: string;
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
readonly committer: {
|
|
242
|
+
readonly avatarUrl: string;
|
|
243
|
+
readonly htmlUrl: string;
|
|
244
|
+
readonly id: number;
|
|
245
|
+
readonly login: string;
|
|
246
|
+
readonly type: string;
|
|
247
|
+
} | null;
|
|
248
|
+
readonly htmlUrl: string;
|
|
249
|
+
readonly parents: readonly {
|
|
250
|
+
readonly sha: string;
|
|
251
|
+
readonly url: string;
|
|
252
|
+
}[];
|
|
253
|
+
readonly sha: string;
|
|
254
|
+
readonly files?: readonly {
|
|
255
|
+
readonly additions: number;
|
|
256
|
+
readonly changes: number;
|
|
257
|
+
readonly deletions: number;
|
|
258
|
+
readonly filename: string;
|
|
259
|
+
readonly patch?: string | undefined;
|
|
260
|
+
readonly previousFilename?: string | undefined;
|
|
261
|
+
readonly sha: string;
|
|
262
|
+
readonly status: string;
|
|
263
|
+
}[] | undefined;
|
|
264
|
+
readonly stats: {
|
|
265
|
+
readonly additions: number;
|
|
266
|
+
readonly deletions: number;
|
|
267
|
+
readonly total: number;
|
|
268
|
+
};
|
|
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>;
|
|
270
|
+
readonly getIssue: (owner: string, repo: string, number: number, byteLimit?: number | undefined) => Effect.Effect<{
|
|
271
|
+
readonly body: string | null;
|
|
272
|
+
readonly closedAt: string | null;
|
|
273
|
+
readonly createdAt: string;
|
|
274
|
+
readonly htmlUrl: string;
|
|
275
|
+
readonly id: number;
|
|
276
|
+
readonly labels: readonly (string | {
|
|
277
|
+
readonly name?: string | undefined;
|
|
278
|
+
})[];
|
|
279
|
+
readonly number: number;
|
|
280
|
+
readonly pullRequest?: {
|
|
281
|
+
readonly url: string;
|
|
282
|
+
} | undefined;
|
|
283
|
+
readonly state: "closed" | "open";
|
|
284
|
+
readonly title: string;
|
|
285
|
+
readonly updatedAt: string;
|
|
286
|
+
readonly user: {
|
|
287
|
+
readonly avatarUrl: string;
|
|
288
|
+
readonly htmlUrl: string;
|
|
289
|
+
readonly id: number;
|
|
290
|
+
readonly login: string;
|
|
291
|
+
readonly type: string;
|
|
292
|
+
} | 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>;
|
|
294
|
+
readonly getTree: (owner: string, repo: string, sha: string, options?: {
|
|
295
|
+
readonly recursive?: boolean;
|
|
296
|
+
readonly responseByteLimit?: number | undefined;
|
|
297
|
+
} | undefined) => Effect.Effect<{
|
|
298
|
+
readonly sha: string;
|
|
299
|
+
readonly tree: readonly {
|
|
300
|
+
readonly mode: string;
|
|
301
|
+
readonly path: string;
|
|
302
|
+
readonly sha: string;
|
|
303
|
+
readonly size?: number | undefined;
|
|
304
|
+
readonly type: "blob" | "commit" | "tree";
|
|
305
|
+
readonly url?: string | undefined;
|
|
306
|
+
}[];
|
|
307
|
+
readonly truncated: boolean;
|
|
308
|
+
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>;
|
|
310
|
+
readonly getUser: (username?: string | undefined, byteLimit?: number | undefined) => Effect.Effect<{
|
|
311
|
+
readonly avatarUrl: string;
|
|
312
|
+
readonly htmlUrl: string;
|
|
313
|
+
readonly id: number;
|
|
314
|
+
readonly login: string;
|
|
315
|
+
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<{
|
|
318
|
+
hasNext: boolean;
|
|
319
|
+
items: {
|
|
320
|
+
readonly author: {
|
|
321
|
+
readonly avatarUrl: string;
|
|
322
|
+
readonly htmlUrl: string;
|
|
323
|
+
readonly id: number;
|
|
324
|
+
readonly login: string;
|
|
325
|
+
readonly type: string;
|
|
326
|
+
} | null;
|
|
327
|
+
readonly commit: {
|
|
328
|
+
readonly author: {
|
|
329
|
+
readonly date: string;
|
|
330
|
+
readonly email: string;
|
|
331
|
+
readonly name: string;
|
|
332
|
+
} | null;
|
|
333
|
+
readonly committer: {
|
|
334
|
+
readonly date: string;
|
|
335
|
+
readonly email: string;
|
|
336
|
+
readonly name: string;
|
|
337
|
+
} | null;
|
|
338
|
+
readonly message: string;
|
|
339
|
+
readonly tree: {
|
|
340
|
+
readonly sha: string;
|
|
341
|
+
readonly url: string;
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
readonly committer: {
|
|
345
|
+
readonly avatarUrl: string;
|
|
346
|
+
readonly htmlUrl: string;
|
|
347
|
+
readonly id: number;
|
|
348
|
+
readonly login: string;
|
|
349
|
+
readonly type: string;
|
|
350
|
+
} | null;
|
|
351
|
+
readonly htmlUrl: string;
|
|
352
|
+
readonly parents: readonly {
|
|
353
|
+
readonly sha: string;
|
|
354
|
+
readonly url: string;
|
|
355
|
+
}[];
|
|
356
|
+
readonly sha: string;
|
|
357
|
+
}[];
|
|
358
|
+
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<{
|
|
361
|
+
hasNext: boolean;
|
|
362
|
+
items: {
|
|
363
|
+
readonly body: string | null;
|
|
364
|
+
readonly closedAt: string | null;
|
|
365
|
+
readonly createdAt: string;
|
|
366
|
+
readonly htmlUrl: string;
|
|
367
|
+
readonly id: number;
|
|
368
|
+
readonly labels: readonly (string | {
|
|
369
|
+
readonly name?: string | undefined;
|
|
370
|
+
})[];
|
|
371
|
+
readonly number: number;
|
|
372
|
+
readonly pullRequest?: {
|
|
373
|
+
readonly url: string;
|
|
374
|
+
} | undefined;
|
|
375
|
+
readonly state: "closed" | "open";
|
|
376
|
+
readonly title: string;
|
|
377
|
+
readonly updatedAt: string;
|
|
378
|
+
readonly user: {
|
|
379
|
+
readonly avatarUrl: string;
|
|
380
|
+
readonly htmlUrl: string;
|
|
381
|
+
readonly id: number;
|
|
382
|
+
readonly login: string;
|
|
383
|
+
readonly type: string;
|
|
384
|
+
} | null;
|
|
385
|
+
}[];
|
|
386
|
+
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<{
|
|
389
|
+
hasNext: boolean;
|
|
390
|
+
items: {
|
|
391
|
+
readonly additions: number;
|
|
392
|
+
readonly changes: number;
|
|
393
|
+
readonly deletions: number;
|
|
394
|
+
readonly filename: string;
|
|
395
|
+
readonly patch?: string | undefined;
|
|
396
|
+
readonly previousFilename?: string | undefined;
|
|
397
|
+
readonly sha: string;
|
|
398
|
+
readonly status: string;
|
|
399
|
+
}[];
|
|
400
|
+
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>;
|
|
149
402
|
readonly upsertStickyComment: (input: {
|
|
150
403
|
readonly appId?: number | undefined;
|
|
151
404
|
readonly author?: string | undefined;
|
|
@@ -173,9 +426,15 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
|
|
|
173
426
|
readonly layer: import("effect/Layer").Layer<"@shivaedev/github/GitHub", never, GitHubToken | HttpClient.HttpClient>;
|
|
174
427
|
};
|
|
175
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"]>;
|
|
176
|
-
export declare function
|
|
177
|
-
|
|
429
|
+
export declare function listPages<TSchema extends Schema.Constraint>(path: string, schema: TSchema, options?: ListOptions | number): Stream.Stream<{
|
|
430
|
+
hasNext: boolean;
|
|
431
|
+
items: TSchema["Type"][];
|
|
432
|
+
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<{
|
|
178
436
|
items: TSchema["Type"][];
|
|
437
|
+
skipped: number;
|
|
179
438
|
truncated: boolean;
|
|
180
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"]>;
|
|
181
440
|
type WriteMethod = "POST" | "PATCH" | "PUT" | "DELETE";
|
package/dist/GitHub.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitHub.d.ts","sourceRoot":"","sources":["../src/GitHub.ts"],"names":[],"mapp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checkRuns.ts";
|
|
6
6
|
import { GitHubConfig } from "#GitHubConfig.ts";
|
|
7
7
|
import { GitHubToken } from "#GitHubToken.ts";
|
|
8
|
+
import { decodedPages } from "#pagedLists.ts";
|
|
8
9
|
import { rateLimits } from "#rateLimits.ts";
|
|
10
|
+
import { repositoryReads } from "#repositoryReads.ts";
|
|
9
11
|
import { representations } from "#representations.ts";
|
|
10
12
|
import { requests } from "#requests.ts";
|
|
11
13
|
import { stickyComments } from "#stickyComments.ts";
|
|
@@ -20,7 +22,7 @@ export const GitHub = defineService({
|
|
|
20
22
|
const refresh = yield* TokenRefresh;
|
|
21
23
|
return {
|
|
22
24
|
apiUrl: config.apiUrl,
|
|
23
|
-
archive: artifacts(config.apiUrl,
|
|
25
|
+
archive: yield* artifacts(config.apiUrl, rates),
|
|
24
26
|
rates,
|
|
25
27
|
request: requests(client, token, rates, refresh),
|
|
26
28
|
responseByteLimit: config.responseByteLimit,
|
|
@@ -34,6 +36,7 @@ export const GitHub = defineService({
|
|
|
34
36
|
...archive,
|
|
35
37
|
...stickyComments(client),
|
|
36
38
|
...checkRuns(client),
|
|
39
|
+
...repositoryReads(client),
|
|
37
40
|
observations: () => Effect.sync(() => [...rates.observations.values()]),
|
|
38
41
|
resource: (path) => Effect.sync(() => rates.resource(new URL(path, apiUrl).pathname)),
|
|
39
42
|
text: (path, accept, limit) => Effect.map(request(get(path, accept), limit), (entry) => new TextDecoder().decode(entry.bytes)),
|
|
@@ -44,11 +47,18 @@ export const GitHub = defineService({
|
|
|
44
47
|
export function read(path, schema, responseByteLimit) {
|
|
45
48
|
return Effect.flatMap(GitHub, (github) => Effect.flatMap(github.read(path, responseByteLimit), (response) => response.decode(schema)));
|
|
46
49
|
}
|
|
47
|
-
export function
|
|
48
|
-
return Stream.unwrap(Effect.
|
|
50
|
+
export function listPages(path, schema, options) {
|
|
51
|
+
return Stream.unwrap(Effect.map(GitHub, (github) => decodedPages(github, path, schema, options)));
|
|
49
52
|
}
|
|
50
|
-
export function
|
|
51
|
-
return
|
|
53
|
+
export function list(path, schema, options) {
|
|
54
|
+
return listPages(path, schema, options).pipe(Stream.flatMap((page) => Stream.fromIterable(page.items)));
|
|
55
|
+
}
|
|
56
|
+
export function listBounded(path, schema, pageCap, options) {
|
|
57
|
+
return listPages(path, schema, options).pipe(Stream.take(pageCap), Stream.runCollect, Effect.map((pages) => ({
|
|
58
|
+
items: pages.flatMap((page) => page.items),
|
|
59
|
+
skipped: pages.reduce((count, page) => count + page.skipped, 0),
|
|
60
|
+
truncated: pages.at(-1)?.hasNext ?? false,
|
|
61
|
+
})));
|
|
52
62
|
}
|
|
53
63
|
export function write(method, path, body, schema = Schema.Void, responseByteLimit) {
|
|
54
64
|
return writeDecoded(method, path, body, schema, responseByteLimit);
|
package/dist/GitHub.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitHub.js","sourceRoot":"","sources":["../src/GitHub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAA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AE,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 @@
|
|
|
1
|
+
{"version":3,"file":"resolveApiUrl.d.ts","sourceRoot":"","sources":["../../src/adapters/resolveApiUrl.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAIzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveApiUrl.js","sourceRoot":"","sources":["../../src/adapters/resolveApiUrl.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAAC,MAAc,EAAE,IAAY;IACzD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,IAAI,CAAC,QAAQ,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC;IACxD,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Effect, Stream } from "effect";
|
|
2
|
+
import { GitHubArtifactCompressionRatio, GitHubArtifactExtractedTooLarge, GitHubArtifactExtractionError } from "#artifactErrors.ts";
|
|
3
|
+
interface ReadLimits {
|
|
4
|
+
readonly compressionRatioLimit: number;
|
|
5
|
+
readonly remaining: number;
|
|
6
|
+
readonly totalSizeLimit: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const zipEntries: (bytes: Uint8Array<ArrayBufferLike>) => Effect.Effect<Stream.Stream<{
|
|
9
|
+
compressedSize: number;
|
|
10
|
+
directory: boolean;
|
|
11
|
+
path: string;
|
|
12
|
+
read: (limits: ReadLimits) => Effect.Effect<Uint8Array<ArrayBuffer>, GitHubArtifactCompressionRatio | GitHubArtifactExtractedTooLarge | GitHubArtifactExtractionError, never>;
|
|
13
|
+
symlink: boolean;
|
|
14
|
+
uncompressedSize: number;
|
|
15
|
+
}, GitHubArtifactExtractionError, never>, GitHubArtifactExtractionError, never>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=zipEntries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zipEntries.d.ts","sourceRoot":"","sources":["../../src/adapters/zipEntries.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAEpI,UAAU,UAAU;IACnB,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CAChC;AAuCD,eAAO,MAAM,UAAU;;;;mBAgBL,UAAU;;;+EAK1B,CAAC"}
|