@effected/github 0.27.0 → 0.29.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/ArtifactMetadata.js +1 -1
- package/Attestation.js +1 -1
- package/AuthenticatedApp.js +2 -2
- package/CheckRun.js +2 -2
- package/CodeScanning.js +1 -1
- package/DeploymentEnvironment.js +1 -1
- package/GitBranch.js +1 -1
- package/GitCommit.js +74 -40
- package/GitHubApp.js +4 -4
- package/GitHubClient.js +2 -2
- package/GitHubCommit.js +1 -1
- package/GitHubContent.js +1 -1
- package/GitHubIssue.js +3 -3
- package/GitHubRelease.js +2 -2
- package/GitHubRepository.js +2 -2
- package/GitTag.js +1 -1
- package/PullRequest.js +2 -2
- package/PullRequestComment.js +2 -2
- package/RepositorySecret.js +2 -2
- package/RepositorySecurity.js +1 -1
- package/RepositoryVariable.js +1 -1
- package/Ruleset.js +1 -1
- package/WorkflowDispatch.js +2 -2
- package/index.d.ts +47 -0
- package/index.js +10 -10
- package/internal/octokit.js +2 -2
- package/package.json +6 -6
- package/tsdoc-metadata.json +1 -1
package/ArtifactMetadata.js
CHANGED
package/Attestation.js
CHANGED
package/AuthenticatedApp.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { GitHubError } from "./GitHubError.js";
|
|
2
|
-
import { unstubbed } from "./internal/unstubbed.js";
|
|
3
1
|
import { GitHubClient } from "./GitHubClient.js";
|
|
2
|
+
import { GitHubError } from "./GitHubError.js";
|
|
4
3
|
import { numericId } from "./internal/ids.js";
|
|
4
|
+
import { unstubbed } from "./internal/unstubbed.js";
|
|
5
5
|
import { Context, Effect, Layer, Schema, Stream } from "effect";
|
|
6
6
|
|
|
7
7
|
// src/AuthenticatedApp.ts
|
package/CheckRun.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { GitHubClient } from "./GitHubClient.js";
|
|
1
2
|
import { GitHubError } from "./GitHubError.js";
|
|
3
|
+
import { numericId } from "./internal/ids.js";
|
|
2
4
|
import { unstubbed } from "./internal/unstubbed.js";
|
|
3
|
-
import { GitHubClient } from "./GitHubClient.js";
|
|
4
5
|
import { Repo } from "./Repo.js";
|
|
5
|
-
import { numericId } from "./internal/ids.js";
|
|
6
6
|
import { Cause, Context, DateTime, Effect, Exit, Layer, Option, Ref, Schema } from "effect";
|
|
7
7
|
|
|
8
8
|
// src/CheckRun.ts
|
package/CodeScanning.js
CHANGED
package/DeploymentEnvironment.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { GitHubClient } from "./GitHubClient.js";
|
|
1
2
|
import { ENVIRONMENT_PUT_ROUTE_PARAMS, reservedBodyKey } from "./internal/requestOptions.js";
|
|
2
3
|
import { unstubbed } from "./internal/unstubbed.js";
|
|
3
|
-
import { GitHubClient } from "./GitHubClient.js";
|
|
4
4
|
import { Repo } from "./Repo.js";
|
|
5
5
|
import { Context, Effect, Layer } from "effect";
|
|
6
6
|
|
package/GitBranch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { GitHubClient } from "./GitHubClient.js";
|
|
1
2
|
import { GitHubError } from "./GitHubError.js";
|
|
2
3
|
import { GraphQLDocument } from "./GraphQL.js";
|
|
3
4
|
import { unstubbed } from "./internal/unstubbed.js";
|
|
4
|
-
import { GitHubClient } from "./GitHubClient.js";
|
|
5
5
|
import { Repo } from "./Repo.js";
|
|
6
6
|
import { Context, Effect, Layer, Option, Schema } from "effect";
|
|
7
7
|
|
package/GitCommit.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { unstubbed } from "./internal/unstubbed.js";
|
|
2
1
|
import { GitHubClient } from "./GitHubClient.js";
|
|
2
|
+
import { GitHubError } from "./GitHubError.js";
|
|
3
|
+
import { unstubbed } from "./internal/unstubbed.js";
|
|
3
4
|
import { Repo } from "./Repo.js";
|
|
4
5
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
5
6
|
|
|
@@ -59,6 +60,22 @@ var CommitRef = class extends Schema.Class("CommitRef")({
|
|
|
59
60
|
parents: Schema.Array(Schema.String)
|
|
60
61
|
}) {};
|
|
61
62
|
/**
|
|
63
|
+
* A commit just created through the Git Database API: its sha and the URL
|
|
64
|
+
* GitHub reports for viewing it.
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* `htmlUrl` is the `html_url` of the creation reply, so it carries the right
|
|
68
|
+
* host on GitHub Enterprise Server with no host arithmetic.
|
|
69
|
+
*
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
72
|
+
var CreatedCommit = class extends Schema.Class("CreatedCommit")({
|
|
73
|
+
/** The new commit's sha. */
|
|
74
|
+
sha: Schema.String,
|
|
75
|
+
/** The commit's web URL, as GitHub reported it. */
|
|
76
|
+
htmlUrl: Schema.String
|
|
77
|
+
}) {};
|
|
78
|
+
/**
|
|
62
79
|
* Read commits and build trees and commits through GitHub's Git Database API,
|
|
63
80
|
* including a one-call "commit these files onto a branch".
|
|
64
81
|
*
|
|
@@ -92,7 +109,9 @@ var GitCommit = class GitCommit extends Context.Service()("@effected/github/GitC
|
|
|
92
109
|
get: overrides.get ?? (() => dies("get")),
|
|
93
110
|
createTree: overrides.createTree ?? (() => dies("createTree")),
|
|
94
111
|
createCommit: overrides.createCommit ?? (() => dies("createCommit")),
|
|
95
|
-
|
|
112
|
+
createCommitWithUrl: overrides.createCommitWithUrl ?? (() => dies("createCommitWithUrl")),
|
|
113
|
+
commitFiles: overrides.commitFiles ?? (() => dies("commitFiles")),
|
|
114
|
+
commitFilesWithUrl: overrides.commitFilesWithUrl ?? (() => dies("commitFilesWithUrl"))
|
|
96
115
|
});
|
|
97
116
|
/** {@link GitCommit.makeTest} behind a `Layer`. */
|
|
98
117
|
static layerTest = (overrides = {}) => Layer.succeed(GitCommit, GitCommit.makeTest(overrides));
|
|
@@ -143,59 +162,74 @@ const make = (client) => {
|
|
|
143
162
|
...options.baseTree !== void 0 ? { base_tree: options.baseTree } : {}
|
|
144
163
|
})).sha;
|
|
145
164
|
});
|
|
146
|
-
const
|
|
165
|
+
const createRaw = Effect.fn("GitCommit.createCommit")(function* (options) {
|
|
147
166
|
const { owner, repo } = yield* Repo;
|
|
148
167
|
yield* Effect.annotateCurrentSpan({
|
|
149
168
|
owner,
|
|
150
169
|
repo,
|
|
151
170
|
tree: options.tree
|
|
152
171
|
});
|
|
153
|
-
|
|
172
|
+
const commit = yield* client.request("POST /repos/{owner}/{repo}/git/commits", {
|
|
154
173
|
owner,
|
|
155
174
|
repo,
|
|
156
175
|
message: options.message,
|
|
157
176
|
tree: options.tree,
|
|
158
177
|
parents: [...options.parents]
|
|
159
|
-
})
|
|
178
|
+
});
|
|
179
|
+
return {
|
|
180
|
+
sha: commit.sha,
|
|
181
|
+
htmlUrl: commit.html_url
|
|
182
|
+
};
|
|
183
|
+
});
|
|
184
|
+
const commitFilesRaw = Effect.fn("GitCommit.commitFiles")(function* (options) {
|
|
185
|
+
const { owner, repo } = yield* Repo;
|
|
186
|
+
const short = options.branch.replace(/^refs\/heads\//, "").replace(/^heads\//, "");
|
|
187
|
+
yield* Effect.annotateCurrentSpan({
|
|
188
|
+
owner,
|
|
189
|
+
repo,
|
|
190
|
+
branch: short,
|
|
191
|
+
changes: options.changes.length
|
|
192
|
+
});
|
|
193
|
+
const ref = yield* client.request("GET /repos/{owner}/{repo}/git/ref/{ref}", {
|
|
194
|
+
owner,
|
|
195
|
+
repo,
|
|
196
|
+
ref: `heads/${short}`
|
|
197
|
+
});
|
|
198
|
+
const head = yield* get(ref.object.sha);
|
|
199
|
+
const tree = yield* createTree({
|
|
200
|
+
changes: options.changes,
|
|
201
|
+
baseTree: head.treeSha
|
|
202
|
+
});
|
|
203
|
+
const commit = yield* createRaw({
|
|
204
|
+
message: options.message,
|
|
205
|
+
tree,
|
|
206
|
+
parents: [head.sha]
|
|
207
|
+
});
|
|
208
|
+
yield* client.request("PATCH /repos/{owner}/{repo}/git/refs/{ref}", {
|
|
209
|
+
owner,
|
|
210
|
+
repo,
|
|
211
|
+
ref: `heads/${short}`,
|
|
212
|
+
sha: commit.sha,
|
|
213
|
+
force: false
|
|
214
|
+
});
|
|
215
|
+
return commit;
|
|
160
216
|
});
|
|
217
|
+
/**
|
|
218
|
+
* The URL check, run after the work (and for `commitFiles`, the ref move) is
|
|
219
|
+
* done: a reply without `html_url` leaves a real commit, so the failure names it.
|
|
220
|
+
*/
|
|
221
|
+
const withUrl = (operation, created) => typeof created.htmlUrl === "string" ? Effect.succeed(CreatedCommit.make({
|
|
222
|
+
sha: created.sha,
|
|
223
|
+
htmlUrl: created.htmlUrl
|
|
224
|
+
})) : Effect.fail(GitHubError.decode(operation, `the commit ${created.sha} was created, but GitHub's reply carried no html_url`));
|
|
161
225
|
return {
|
|
162
226
|
get,
|
|
163
227
|
createTree,
|
|
164
|
-
createCommit,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
yield* Effect.annotateCurrentSpan({
|
|
169
|
-
owner,
|
|
170
|
-
repo,
|
|
171
|
-
branch: short,
|
|
172
|
-
changes: options.changes.length
|
|
173
|
-
});
|
|
174
|
-
const ref = yield* client.request("GET /repos/{owner}/{repo}/git/ref/{ref}", {
|
|
175
|
-
owner,
|
|
176
|
-
repo,
|
|
177
|
-
ref: `heads/${short}`
|
|
178
|
-
});
|
|
179
|
-
const head = yield* get(ref.object.sha);
|
|
180
|
-
const tree = yield* createTree({
|
|
181
|
-
changes: options.changes,
|
|
182
|
-
baseTree: head.treeSha
|
|
183
|
-
});
|
|
184
|
-
const commit = yield* createCommit({
|
|
185
|
-
message: options.message,
|
|
186
|
-
tree,
|
|
187
|
-
parents: [head.sha]
|
|
188
|
-
});
|
|
189
|
-
yield* client.request("PATCH /repos/{owner}/{repo}/git/refs/{ref}", {
|
|
190
|
-
owner,
|
|
191
|
-
repo,
|
|
192
|
-
ref: `heads/${short}`,
|
|
193
|
-
sha: commit,
|
|
194
|
-
force: false
|
|
195
|
-
});
|
|
196
|
-
return commit;
|
|
197
|
-
})
|
|
228
|
+
createCommit: (options) => Effect.map(createRaw(options), (commit) => commit.sha),
|
|
229
|
+
createCommitWithUrl: (options) => Effect.flatMap(createRaw(options), (commit) => withUrl("GitCommit.createCommitWithUrl", commit)),
|
|
230
|
+
commitFiles: (options) => Effect.map(commitFilesRaw(options), (commit) => commit.sha),
|
|
231
|
+
commitFilesWithUrl: (options) => Effect.flatMap(commitFilesRaw(options), (commit) => withUrl("GitCommit.commitFilesWithUrl", commit))
|
|
198
232
|
};
|
|
199
233
|
};
|
|
200
234
|
|
|
201
|
-
export { CommitRef, FileChange, FileContent, FileDeletion, FileMode, GitCommit };
|
|
235
|
+
export { CommitRef, CreatedCommit, FileChange, FileContent, FileDeletion, FileMode, GitCommit };
|
package/GitHubApp.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { GitHubClient, makeClientShape, resolveApiVersion } from "./GitHubClient.js";
|
|
1
2
|
import { GitHubError } from "./GitHubError.js";
|
|
2
3
|
import { GitHubGraphQLError } from "./GraphQL.js";
|
|
3
|
-
import { uploadChannelOf, withUploadChannel } from "./internal/uploads.js";
|
|
4
|
-
import { unstubbed } from "./internal/unstubbed.js";
|
|
5
|
-
import { GitHubClient, makeClientShape, resolveApiVersion } from "./GitHubClient.js";
|
|
6
|
-
import { numericId } from "./internal/ids.js";
|
|
7
4
|
import { InstallationTokenStore } from "./InstallationTokenStore.js";
|
|
5
|
+
import { numericId } from "./internal/ids.js";
|
|
6
|
+
import { unstubbed } from "./internal/unstubbed.js";
|
|
7
|
+
import { uploadChannelOf, withUploadChannel } from "./internal/uploads.js";
|
|
8
8
|
import { Cause, Clock, Context, DateTime, Deferred, Duration, Effect, Layer, Option, Redacted, Ref, Schema, Semaphore, Stream } from "effect";
|
|
9
9
|
import { Jwt, JwtKey } from "@effected/jwt";
|
|
10
10
|
import { Signature } from "effect/crypto";
|
package/GitHubClient.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { GitHubError } from "./GitHubError.js";
|
|
2
2
|
import { GitHubGraphQLError } from "./GraphQL.js";
|
|
3
|
-
import { DOTCOM_API_BASE_URL, originOf, uploadsBaseUrlFor, withUploadChannel } from "./internal/uploads.js";
|
|
4
3
|
import { rawRequestRefusal, refusedRequest } from "./internal/confinement.js";
|
|
5
|
-
import { RetryPolicy } from "./Resilience.js";
|
|
6
4
|
import { DEFAULT_API_VERSION, expandOnDotcom, makeTransport } from "./internal/octokit.js";
|
|
7
5
|
import { fromArray, paginate } from "./internal/paginate.js";
|
|
8
6
|
import { unstubbed } from "./internal/unstubbed.js";
|
|
7
|
+
import { DOTCOM_API_BASE_URL, originOf, uploadsBaseUrlFor, withUploadChannel } from "./internal/uploads.js";
|
|
8
|
+
import { RetryPolicy } from "./Resilience.js";
|
|
9
9
|
import { Clock, Config, Context, Effect, Layer, Option, Schema, Stream } from "effect";
|
|
10
10
|
|
|
11
11
|
// src/GitHubClient.ts
|
package/GitHubCommit.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { GitHubClient } from "./GitHubClient.js";
|
|
1
2
|
import { paginate } from "./internal/paginate.js";
|
|
2
3
|
import { unstubbed } from "./internal/unstubbed.js";
|
|
3
|
-
import { GitHubClient } from "./GitHubClient.js";
|
|
4
4
|
import { Repo } from "./Repo.js";
|
|
5
5
|
import { Context, Effect, Layer, Option, Schema, Stream } from "effect";
|
|
6
6
|
|
package/GitHubContent.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { GitHubClient } from "./GitHubClient.js";
|
|
1
2
|
import { GitHubError } from "./GitHubError.js";
|
|
2
3
|
import { unstubbed } from "./internal/unstubbed.js";
|
|
3
|
-
import { GitHubClient } from "./GitHubClient.js";
|
|
4
4
|
import { Repo } from "./Repo.js";
|
|
5
5
|
import { Context, Effect, Layer, Option, Result } from "effect";
|
|
6
6
|
import * as Base64 from "effect/encoding/Base64";
|
package/GitHubIssue.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { GraphQLDocument } from "./GraphQL.js";
|
|
2
|
-
import { unstubbed } from "./internal/unstubbed.js";
|
|
3
1
|
import { GitHubClient } from "./GitHubClient.js";
|
|
4
|
-
import {
|
|
2
|
+
import { GraphQLDocument } from "./GraphQL.js";
|
|
5
3
|
import { numericId } from "./internal/ids.js";
|
|
4
|
+
import { unstubbed } from "./internal/unstubbed.js";
|
|
6
5
|
import { CommentRecord } from "./PullRequestComment.js";
|
|
6
|
+
import { Repo } from "./Repo.js";
|
|
7
7
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
8
8
|
|
|
9
9
|
// src/GitHubIssue.ts
|
package/GitHubRelease.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { GitHubClient } from "./GitHubClient.js";
|
|
1
2
|
import { GitHubError } from "./GitHubError.js";
|
|
2
|
-
import { originOf, uploadChannelOf, uploadsBaseUrlFor } from "./internal/uploads.js";
|
|
3
3
|
import { unstubbed } from "./internal/unstubbed.js";
|
|
4
|
-
import {
|
|
4
|
+
import { originOf, uploadChannelOf, uploadsBaseUrlFor } from "./internal/uploads.js";
|
|
5
5
|
import { Repo } from "./Repo.js";
|
|
6
6
|
import { Context, Effect, Layer, Option, Schema } from "effect";
|
|
7
7
|
|
package/GitHubRepository.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { GitHubClient } from "./GitHubClient.js";
|
|
1
2
|
import { GraphQLDocument } from "./GraphQL.js";
|
|
3
|
+
import { REMOVED_BY_PINNED_VERSION, REPOSITORY_REST_SETTING_KEYS } from "./internal/repositoryRestSettingKeys.js";
|
|
2
4
|
import { reservedSettingKey } from "./internal/requestOptions.js";
|
|
3
5
|
import { unstubbed, unstubbedRead } from "./internal/unstubbed.js";
|
|
4
|
-
import { GitHubClient } from "./GitHubClient.js";
|
|
5
6
|
import { Repo } from "./Repo.js";
|
|
6
|
-
import { REMOVED_BY_PINNED_VERSION, REPOSITORY_REST_SETTING_KEYS } from "./internal/repositoryRestSettingKeys.js";
|
|
7
7
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
8
8
|
|
|
9
9
|
// src/GitHubRepository.ts
|
package/GitTag.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { GitHubClient } from "./GitHubClient.js";
|
|
1
2
|
import { GitHubError } from "./GitHubError.js";
|
|
2
3
|
import { unstubbed } from "./internal/unstubbed.js";
|
|
3
|
-
import { GitHubClient } from "./GitHubClient.js";
|
|
4
4
|
import { Repo } from "./Repo.js";
|
|
5
5
|
import { Context, Effect, Layer, Option, Result, Schema, Stream } from "effect";
|
|
6
6
|
import { SemVer } from "@effected/semver";
|
package/PullRequest.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { GitHubClient } from "./GitHubClient.js";
|
|
2
|
+
import { fileOf } from "./GitHubCommit.js";
|
|
1
3
|
import { GitHubError } from "./GitHubError.js";
|
|
2
4
|
import { GitHubGraphQLError, GraphQLDocument } from "./GraphQL.js";
|
|
3
5
|
import { unstubbed } from "./internal/unstubbed.js";
|
|
4
|
-
import { GitHubClient } from "./GitHubClient.js";
|
|
5
6
|
import { Repo } from "./Repo.js";
|
|
6
|
-
import { fileOf } from "./GitHubCommit.js";
|
|
7
7
|
import { PageOptions } from "./Rest.js";
|
|
8
8
|
import { Context, DateTime, Effect, Layer, Option, Schema } from "effect";
|
|
9
9
|
|
package/PullRequestComment.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { unstubbed } from "./internal/unstubbed.js";
|
|
2
1
|
import { GitHubClient } from "./GitHubClient.js";
|
|
3
|
-
import { Repo } from "./Repo.js";
|
|
4
2
|
import { numericId } from "./internal/ids.js";
|
|
3
|
+
import { unstubbed } from "./internal/unstubbed.js";
|
|
4
|
+
import { Repo } from "./Repo.js";
|
|
5
5
|
import { Context, Effect, Layer, Option, Schema } from "effect";
|
|
6
6
|
|
|
7
7
|
// src/PullRequestComment.ts
|
package/RepositorySecret.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { GitHubClient } from "./GitHubClient.js";
|
|
1
2
|
import { GitHubError } from "./GitHubError.js";
|
|
3
|
+
import { encryptSecret } from "./internal/crypto.js";
|
|
2
4
|
import { unstubbed } from "./internal/unstubbed.js";
|
|
3
|
-
import { GitHubClient } from "./GitHubClient.js";
|
|
4
5
|
import { Repo } from "./Repo.js";
|
|
5
|
-
import { encryptSecret } from "./internal/crypto.js";
|
|
6
6
|
import { Context, Effect, Layer, Redacted, Result } from "effect";
|
|
7
7
|
|
|
8
8
|
// src/RepositorySecret.ts
|
package/RepositorySecurity.js
CHANGED
package/RepositoryVariable.js
CHANGED
package/Ruleset.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { GitHubClient } from "./GitHubClient.js";
|
|
1
2
|
import { GitHubError } from "./GitHubError.js";
|
|
2
3
|
import { unstubbed } from "./internal/unstubbed.js";
|
|
3
|
-
import { GitHubClient } from "./GitHubClient.js";
|
|
4
4
|
import { Repo } from "./Repo.js";
|
|
5
5
|
import { Context, Effect, Layer } from "effect";
|
|
6
6
|
|
package/WorkflowDispatch.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { GitHubClient } from "./GitHubClient.js";
|
|
1
2
|
import { GitHubError } from "./GitHubError.js";
|
|
3
|
+
import { numericId } from "./internal/ids.js";
|
|
2
4
|
import { unstubbed, unstubbedRead } from "./internal/unstubbed.js";
|
|
3
|
-
import { GitHubClient } from "./GitHubClient.js";
|
|
4
5
|
import { Repo } from "./Repo.js";
|
|
5
|
-
import { numericId } from "./internal/ids.js";
|
|
6
6
|
import { PageOptions } from "./Rest.js";
|
|
7
7
|
import { Context, DateTime, Duration, Effect, Layer, Option, Schedule, Schema } from "effect";
|
|
8
8
|
|
package/index.d.ts
CHANGED
|
@@ -805,6 +805,12 @@ interface GitHubClientShape {
|
|
|
805
805
|
* route that resolves to another origin, fails `kind: "rejected"` with no
|
|
806
806
|
* status and nothing sent.
|
|
807
807
|
*
|
|
808
|
+
* **Interrupting aborts the fetch.** The fiber's `AbortSignal` reaches the
|
|
809
|
+
* fetch, so an interrupt (an `Effect.timeout`, a cancelled caller) cancels the
|
|
810
|
+
* in-flight HTTP request, a body read included, and the attempt is not
|
|
811
|
+
* retried. A `fetch` option that ignores its signal still releases the caller
|
|
812
|
+
* at once, while that request runs on.
|
|
813
|
+
*
|
|
808
814
|
* @example
|
|
809
815
|
* ```ts
|
|
810
816
|
* import { GitHubClient } from "@effected/github";
|
|
@@ -852,6 +858,12 @@ interface GitHubClientShape {
|
|
|
852
858
|
* header whose next page names another origin fails the walk
|
|
853
859
|
* `kind: "rejected"` before that page is requested, rather than sending the
|
|
854
860
|
* token there or ending the walk early as if the collection were complete.
|
|
861
|
+
*
|
|
862
|
+
* **Interrupting aborts the fetch.** The fiber's `AbortSignal` reaches the
|
|
863
|
+
* fetch, so an interrupt (an `Effect.timeout`, a cancelled caller) cancels the
|
|
864
|
+
* in-flight HTTP request, a body read included, and the attempt is not
|
|
865
|
+
* retried. A `fetch` option that ignores its signal still releases the caller
|
|
866
|
+
* at once, while that request runs on.
|
|
855
867
|
*/
|
|
856
868
|
readonly paginate: <R extends PaginatingRoute>(route: R, params: Params<R>, options?: PageOptions) => Effect.Effect<ReadonlyArray<Item<R>>, GitHubError>;
|
|
857
869
|
/**
|
|
@@ -861,6 +873,12 @@ interface GitHubClientShape {
|
|
|
861
873
|
* Lazy in requests: a downstream `Stream.take` stops the walk rather than
|
|
862
874
|
* filtering pages that were already fetched. Confined to the configured
|
|
863
875
|
* host exactly as {@link GitHubClientShape.paginate} is.
|
|
876
|
+
*
|
|
877
|
+
* **Interrupting aborts the fetch.** The fiber's `AbortSignal` reaches the
|
|
878
|
+
* fetch, so an interrupt (an `Effect.timeout`, a cancelled caller) cancels the
|
|
879
|
+
* in-flight HTTP request, a body read included, and the attempt is not
|
|
880
|
+
* retried. A `fetch` option that ignores its signal still releases the caller
|
|
881
|
+
* at once, while that request runs on.
|
|
864
882
|
*/
|
|
865
883
|
readonly paginateStream: <R extends PaginatingRoute>(route: R, params: Params<R>, options?: PageOptions) => Stream.Stream<Item<R>, GitHubError>;
|
|
866
884
|
/** Run an owned GraphQL document and decode its answer. */
|
|
@@ -2381,6 +2399,23 @@ declare const CommitRef_base: Schema.Class<CommitRef, Schema.Struct<{
|
|
|
2381
2399
|
* @public
|
|
2382
2400
|
*/
|
|
2383
2401
|
export declare class CommitRef extends CommitRef_base {}
|
|
2402
|
+
declare const CreatedCommit_base: Schema.Class<CreatedCommit, Schema.Struct<{
|
|
2403
|
+
/** The new commit's sha. */
|
|
2404
|
+
readonly sha: Schema.String;
|
|
2405
|
+
/** The commit's web URL, as GitHub reported it. */
|
|
2406
|
+
readonly htmlUrl: Schema.String;
|
|
2407
|
+
}>, {}>;
|
|
2408
|
+
/**
|
|
2409
|
+
* A commit just created through the Git Database API: its sha and the URL
|
|
2410
|
+
* GitHub reports for viewing it.
|
|
2411
|
+
*
|
|
2412
|
+
* @remarks
|
|
2413
|
+
* `htmlUrl` is the `html_url` of the creation reply, so it carries the right
|
|
2414
|
+
* host on GitHub Enterprise Server with no host arithmetic.
|
|
2415
|
+
*
|
|
2416
|
+
* @public
|
|
2417
|
+
*/
|
|
2418
|
+
export declare class CreatedCommit extends CreatedCommit_base {}
|
|
2384
2419
|
/**
|
|
2385
2420
|
* Commits and trees in GitHub's Git Database API.
|
|
2386
2421
|
*
|
|
@@ -2400,6 +2435,12 @@ interface GitCommitShape {
|
|
|
2400
2435
|
readonly tree: string;
|
|
2401
2436
|
readonly parents: ReadonlyArray<string>;
|
|
2402
2437
|
}) => Effect.Effect<string, GitHubError, Repo>;
|
|
2438
|
+
/** {@link GitCommitShape.createCommit}, also returning the commit's `html_url`. */
|
|
2439
|
+
readonly createCommitWithUrl: (options: {
|
|
2440
|
+
readonly message: string;
|
|
2441
|
+
readonly tree: string;
|
|
2442
|
+
readonly parents: ReadonlyArray<string>;
|
|
2443
|
+
}) => Effect.Effect<CreatedCommit, GitHubError, Repo>;
|
|
2403
2444
|
/**
|
|
2404
2445
|
* Write `changes` onto `branch` as one commit, returning its sha.
|
|
2405
2446
|
*
|
|
@@ -2425,6 +2466,12 @@ interface GitCommitShape {
|
|
|
2425
2466
|
readonly message: string;
|
|
2426
2467
|
readonly changes: ReadonlyArray<FileChange>;
|
|
2427
2468
|
}) => Effect.Effect<string, GitHubError, Repo>;
|
|
2469
|
+
/** {@link GitCommitShape.commitFiles}, also returning the commit's `html_url`. */
|
|
2470
|
+
readonly commitFilesWithUrl: (options: {
|
|
2471
|
+
readonly branch: string;
|
|
2472
|
+
readonly message: string;
|
|
2473
|
+
readonly changes: ReadonlyArray<FileChange>;
|
|
2474
|
+
}) => Effect.Effect<CreatedCommit, GitHubError, Repo>;
|
|
2428
2475
|
}
|
|
2429
2476
|
declare const GitCommit_base: Context.ServiceClass<GitCommit, "@effected/github/GitCommit", GitCommitShape>;
|
|
2430
2477
|
/**
|
package/index.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { ActionsOidc, ActionsOidcClaims, ActionsOidcClaimsFromWire } from "./ActionsOidc.js";
|
|
2
|
-
import { GitHubError, GitHubErrorKind, GitHubValidationCode, GitHubValidationEntry } from "./GitHubError.js";
|
|
3
|
-
import { GitHubGraphQLError, GraphQLDocument, GraphQLErrorEntry } from "./GraphQL.js";
|
|
4
|
-
import { RateLimitSnapshot, RetryPolicy } from "./Resilience.js";
|
|
5
|
-
import { GitHubClient, GitHubFixtures, RawFailure } from "./GitHubClient.js";
|
|
6
|
-
import { InvalidRepoRefError, Repo, RepoRef } from "./Repo.js";
|
|
7
2
|
import { ArtifactMetadata, StorageRecordInput } from "./ArtifactMetadata.js";
|
|
8
3
|
import { Attestation, AttestationListEntry, AttestationRecord } from "./Attestation.js";
|
|
9
4
|
import { AppInfo, AuthenticatedApp, DeliveryAttempt } from "./AuthenticatedApp.js";
|
|
@@ -11,24 +6,29 @@ import { Annotation, AnnotationLevel, CheckConclusion, CheckRun, CheckRunOutput,
|
|
|
11
6
|
import { CodeScanning } from "./CodeScanning.js";
|
|
12
7
|
import { DeploymentEnvironment } from "./DeploymentEnvironment.js";
|
|
13
8
|
import { GitBranch } from "./GitBranch.js";
|
|
14
|
-
import { CommitRef, FileChange, FileContent, FileDeletion, FileMode, GitCommit } from "./GitCommit.js";
|
|
15
|
-
import { InstallationTokenStore } from "./InstallationTokenStore.js";
|
|
9
|
+
import { CommitRef, CreatedCommit, FileChange, FileContent, FileDeletion, FileMode, GitCommit } from "./GitCommit.js";
|
|
16
10
|
import { AppIdentity, BotIdentity, BotUser, GitHubApp, GitHubAppError, Installation, InstallationToken } from "./GitHubApp.js";
|
|
11
|
+
import { GitHubClient, GitHubFixtures, RawFailure } from "./GitHubClient.js";
|
|
17
12
|
import { CommitComparison, CommitFile, CommitSummary, FileStatus, GitHubCommit } from "./GitHubCommit.js";
|
|
18
13
|
import { GitHubContent } from "./GitHubContent.js";
|
|
19
|
-
import {
|
|
14
|
+
import { GitHubError, GitHubErrorKind, GitHubValidationCode, GitHubValidationEntry } from "./GitHubError.js";
|
|
20
15
|
import { CommentOnceResult, GitHubIssue, IssueInfo, LinkedIssue } from "./GitHubIssue.js";
|
|
21
16
|
import { GitHubRelease, ReleaseAsset, ReleaseInfo } from "./GitHubRelease.js";
|
|
22
17
|
import { GRAPHQL_ONLY_SETTINGS, GitHubRepository, SECURITY_ANALYSIS_STATUS_FIELDS, repositoryPatch, transformSecurityAndAnalysis } from "./GitHubRepository.js";
|
|
23
18
|
import { GitTag, SemverTag, TagRef, versionFromTag } from "./GitTag.js";
|
|
24
|
-
import {
|
|
19
|
+
import { GitHubGraphQLError, GraphQLDocument, GraphQLErrorEntry } from "./GraphQL.js";
|
|
20
|
+
import { InstallationTokenStore } from "./InstallationTokenStore.js";
|
|
25
21
|
import { MergeMethod, PullRequest, PullRequestInfo } from "./PullRequest.js";
|
|
22
|
+
import { CommentMarker, CommentRecord, PullRequestComment } from "./PullRequestComment.js";
|
|
23
|
+
import { InvalidRepoRefError, Repo, RepoRef } from "./Repo.js";
|
|
26
24
|
import { RepositorySecret } from "./RepositorySecret.js";
|
|
27
25
|
import { RepositorySecurity } from "./RepositorySecurity.js";
|
|
28
26
|
import { RepositoryVariable } from "./RepositoryVariable.js";
|
|
27
|
+
import { RateLimitSnapshot, RetryPolicy } from "./Resilience.js";
|
|
28
|
+
import { PageOptions } from "./Rest.js";
|
|
29
29
|
import { Ruleset } from "./Ruleset.js";
|
|
30
30
|
import { ExtraPermission, PermissionGap, PermissionLevel, PermissionResult, TokenPermissionError, TokenPermissions } from "./TokenPermissions.js";
|
|
31
31
|
import { DispatchedRun, WorkflowDispatch, WorkflowRunStatus } from "./WorkflowDispatch.js";
|
|
32
32
|
import { CLOSING_KEYWORDS, harvestIssueReferences, parseBareLineReference } from "@effected/github-references";
|
|
33
33
|
|
|
34
|
-
export { ActionsOidc, ActionsOidcClaims, ActionsOidcClaimsFromWire, Annotation, AnnotationLevel, AppIdentity, AppInfo, ArtifactMetadata, Attestation, AttestationListEntry, AttestationRecord, AuthenticatedApp, BotIdentity, BotUser, CLOSING_KEYWORDS, CheckConclusion, CheckRun, CheckRunOutput, CheckRunRef, CheckRunStatus, CodeScanning, CommentMarker, CommentOnceResult, CommentRecord, CommitComparison, CommitFile, CommitRef, CommitSummary, DeliveryAttempt, DeploymentEnvironment, DispatchedRun, ExtraPermission, FileChange, FileContent, FileDeletion, FileMode, FileStatus, GRAPHQL_ONLY_SETTINGS, GitBranch, GitCommit, GitHubApp, GitHubAppError, GitHubClient, GitHubCommit, GitHubContent, GitHubError, GitHubErrorKind, GitHubFixtures, GitHubGraphQLError, GitHubIssue, GitHubRelease, GitHubRepository, GitHubValidationCode, GitHubValidationEntry, GitTag, GraphQLDocument, GraphQLErrorEntry, Installation, InstallationToken, InstallationTokenStore, InvalidRepoRefError, IssueInfo, LinkedIssue, MergeMethod, PageOptions, PermissionGap, PermissionLevel, PermissionResult, PullRequest, PullRequestComment, PullRequestInfo, RateLimitSnapshot, RawFailure, ReleaseAsset, ReleaseInfo, Repo, RepoRef, ReportedCheckConclusion, ReportedCheckRunOutput, RepositorySecret, RepositorySecurity, RepositoryVariable, RetryPolicy, Ruleset, SECURITY_ANALYSIS_STATUS_FIELDS, SemverTag, StorageRecordInput, TagRef, TokenPermissionError, TokenPermissions, WorkflowDispatch, WorkflowRunStatus, harvestIssueReferences, parseBareLineReference, repositoryPatch, transformSecurityAndAnalysis, versionFromTag };
|
|
34
|
+
export { ActionsOidc, ActionsOidcClaims, ActionsOidcClaimsFromWire, Annotation, AnnotationLevel, AppIdentity, AppInfo, ArtifactMetadata, Attestation, AttestationListEntry, AttestationRecord, AuthenticatedApp, BotIdentity, BotUser, CLOSING_KEYWORDS, CheckConclusion, CheckRun, CheckRunOutput, CheckRunRef, CheckRunStatus, CodeScanning, CommentMarker, CommentOnceResult, CommentRecord, CommitComparison, CommitFile, CommitRef, CommitSummary, CreatedCommit, DeliveryAttempt, DeploymentEnvironment, DispatchedRun, ExtraPermission, FileChange, FileContent, FileDeletion, FileMode, FileStatus, GRAPHQL_ONLY_SETTINGS, GitBranch, GitCommit, GitHubApp, GitHubAppError, GitHubClient, GitHubCommit, GitHubContent, GitHubError, GitHubErrorKind, GitHubFixtures, GitHubGraphQLError, GitHubIssue, GitHubRelease, GitHubRepository, GitHubValidationCode, GitHubValidationEntry, GitTag, GraphQLDocument, GraphQLErrorEntry, Installation, InstallationToken, InstallationTokenStore, InvalidRepoRefError, IssueInfo, LinkedIssue, MergeMethod, PageOptions, PermissionGap, PermissionLevel, PermissionResult, PullRequest, PullRequestComment, PullRequestInfo, RateLimitSnapshot, RawFailure, ReleaseAsset, ReleaseInfo, Repo, RepoRef, ReportedCheckConclusion, ReportedCheckRunOutput, RepositorySecret, RepositorySecurity, RepositoryVariable, RetryPolicy, Ruleset, SECURITY_ANALYSIS_STATUS_FIELDS, SemverTag, StorageRecordInput, TagRef, TokenPermissionError, TokenPermissions, WorkflowDispatch, WorkflowRunStatus, harvestIssueReferences, parseBareLineReference, repositoryPatch, transformSecurityAndAnalysis, versionFromTag };
|
package/internal/octokit.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { GitHubError, readRateLimitHeaders } from "../GitHubError.js";
|
|
2
2
|
import { GitHubGraphQLError } from "../GraphQL.js";
|
|
3
|
-
import { DOTCOM_API_BASE_URL, originOf } from "./uploads.js";
|
|
4
|
-
import { rawRequestRefusal, refusedRequest, reservedParamReason, routeReason } from "./confinement.js";
|
|
5
3
|
import { RateLimitSnapshot } from "../Resilience.js";
|
|
4
|
+
import { rawRequestRefusal, refusedRequest, reservedParamReason, routeReason } from "./confinement.js";
|
|
5
|
+
import { DOTCOM_API_BASE_URL, originOf } from "./uploads.js";
|
|
6
6
|
import { Clock, Effect, Option, Redacted, Ref } from "effect";
|
|
7
7
|
import { Octokit } from "@octokit/core";
|
|
8
8
|
import { composePaginateRest } from "@octokit/plugin-paginate-rest";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effected/github",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Typed GitHub REST and GraphQL services over the octokit core request surface, with app auth and resource helpers.",
|
|
6
6
|
"keywords": [
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"./package.json": "./package.json"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@effected/crypto": "^0.
|
|
42
|
-
"@effected/github-references": "^0.
|
|
43
|
-
"@effected/jwt": "^0.
|
|
44
|
-
"@effected/oidc": "^0.
|
|
45
|
-
"@effected/semver": "^0.
|
|
41
|
+
"@effected/crypto": "^0.5.0",
|
|
42
|
+
"@effected/github-references": "^0.14.0",
|
|
43
|
+
"@effected/jwt": "^0.9.0",
|
|
44
|
+
"@effected/oidc": "^0.4.0",
|
|
45
|
+
"@effected/semver": "^0.22.0",
|
|
46
46
|
"@octokit/core": "^7.0.6",
|
|
47
47
|
"@octokit/plugin-paginate-rest": "^16.0.0",
|
|
48
48
|
"@octokit/types": "^18.0.0",
|