@effected/github 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CheckRun.js +2 -1
- package/GitHubApp.js +3 -2
- package/GitHubIssue.js +6 -4
- package/PullRequestComment.js +2 -1
- package/internal/ids.js +17 -0
- package/package.json +3 -3
package/CheckRun.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GitHubClient } from "./GitHubClient.js";
|
|
2
2
|
import { Repo } from "./Repo.js";
|
|
3
|
+
import { numericId } from "./internal/ids.js";
|
|
3
4
|
import { Cause, Context, Effect, Exit, Layer, Ref, Schema } from "effect";
|
|
4
5
|
|
|
5
6
|
//#region src/CheckRun.ts
|
|
@@ -197,7 +198,7 @@ const concludeFor = (name, id, exit, recorded, complete) => {
|
|
|
197
198
|
return Exit.isSuccess(exit) ? write : Effect.ignore(write);
|
|
198
199
|
};
|
|
199
200
|
const refOf = (raw) => CheckRunRef.make({
|
|
200
|
-
id: raw.id,
|
|
201
|
+
id: numericId(raw.id),
|
|
201
202
|
name: raw.name,
|
|
202
203
|
url: raw.html_url ?? "",
|
|
203
204
|
status: raw.status
|
package/GitHubApp.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GitHubError } from "./GitHubError.js";
|
|
2
2
|
import { GitHubGraphQLError } from "./GraphQL.js";
|
|
3
3
|
import { GitHubClient, makeClientShape } from "./GitHubClient.js";
|
|
4
|
+
import { numericId } from "./internal/ids.js";
|
|
4
5
|
import { Clock, Context, DateTime, Duration, Effect, Layer, Option, Redacted, Ref, Schema, Stream } from "effect";
|
|
5
6
|
import githubAppJwt from "universal-github-app-jwt";
|
|
6
7
|
|
|
@@ -261,7 +262,7 @@ function makeApp(options) {
|
|
|
261
262
|
return Effect.sync(() => {
|
|
262
263
|
const installations = Effect.fn("GitHubApp.installations")(function* (credentials) {
|
|
263
264
|
return (yield* (yield* asApp(credentials, options)).paginate("GET /app/installations", {}).pipe(Effect.catch(appFailure("installation")))).map((entry) => Installation.make({
|
|
264
|
-
id: entry.id,
|
|
265
|
+
id: numericId(entry.id),
|
|
265
266
|
...entry.account !== null && entry.account !== void 0 && "login" in entry.account ? { account: entry.account.login } : {}
|
|
266
267
|
}));
|
|
267
268
|
});
|
|
@@ -304,7 +305,7 @@ function makeApp(options) {
|
|
|
304
305
|
return AppIdentity.make({
|
|
305
306
|
slug,
|
|
306
307
|
name,
|
|
307
|
-
...Option.isSome(user) ? { userId: user.value.id } : {}
|
|
308
|
+
...Option.isSome(user) ? { userId: numericId(user.value.id) } : {}
|
|
308
309
|
});
|
|
309
310
|
}),
|
|
310
311
|
installations
|
package/GitHubIssue.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GraphQLDocument } from "./GraphQL.js";
|
|
2
2
|
import { GitHubClient } from "./GitHubClient.js";
|
|
3
3
|
import { Repo } from "./Repo.js";
|
|
4
|
+
import { numericId } from "./internal/ids.js";
|
|
4
5
|
import { CommentRecord } from "./PullRequestComment.js";
|
|
5
6
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
6
7
|
|
|
@@ -212,13 +213,14 @@ const make = (client) => ({
|
|
|
212
213
|
repo,
|
|
213
214
|
number
|
|
214
215
|
});
|
|
215
|
-
|
|
216
|
+
const created = yield* client.request("POST /repos/{owner}/{repo}/issues/{issue_number}/comments", {
|
|
216
217
|
owner,
|
|
217
218
|
repo,
|
|
218
219
|
issue_number: number,
|
|
219
220
|
body,
|
|
220
221
|
headers: API_VERSION_HEADERS
|
|
221
|
-
})
|
|
222
|
+
});
|
|
223
|
+
return numericId(created.id);
|
|
222
224
|
}),
|
|
223
225
|
commentOnce: Effect.fn("GitHubIssue.commentOnce")(function* (issueNumber, marker, body) {
|
|
224
226
|
const { owner, repo } = yield* Repo;
|
|
@@ -237,7 +239,7 @@ const make = (client) => ({
|
|
|
237
239
|
if (existing !== void 0) return CommentOnceResult.make({
|
|
238
240
|
wrote: false,
|
|
239
241
|
comment: CommentRecord.make({
|
|
240
|
-
id: existing.id,
|
|
242
|
+
id: numericId(existing.id),
|
|
241
243
|
body: existing.body ?? "",
|
|
242
244
|
url: existing.html_url
|
|
243
245
|
})
|
|
@@ -252,7 +254,7 @@ const make = (client) => ({
|
|
|
252
254
|
return CommentOnceResult.make({
|
|
253
255
|
wrote: true,
|
|
254
256
|
comment: CommentRecord.make({
|
|
255
|
-
id: created.id,
|
|
257
|
+
id: numericId(created.id),
|
|
256
258
|
body: created.body ?? "",
|
|
257
259
|
url: created.html_url
|
|
258
260
|
})
|
package/PullRequestComment.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GitHubClient } from "./GitHubClient.js";
|
|
2
2
|
import { Repo } from "./Repo.js";
|
|
3
|
+
import { numericId } from "./internal/ids.js";
|
|
3
4
|
import { Context, Effect, Layer, Option, Schema } from "effect";
|
|
4
5
|
|
|
5
6
|
//#region src/PullRequestComment.ts
|
|
@@ -61,7 +62,7 @@ const unstubbed = (member) => {
|
|
|
61
62
|
throw new Error(`PullRequestComment.makeTest: ${member}() was called but not stubbed — pass an override.`);
|
|
62
63
|
};
|
|
63
64
|
const recordOf = (raw) => CommentRecord.make({
|
|
64
|
-
id: raw.id,
|
|
65
|
+
id: numericId(raw.id),
|
|
65
66
|
body: raw.body ?? "",
|
|
66
67
|
url: raw.html_url
|
|
67
68
|
});
|
package/internal/ids.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/internal/ids.ts
|
|
2
|
+
/**
|
|
3
|
+
* Narrows the `number | bigint` resource ids `@octokit/types` v17 declares
|
|
4
|
+
* back to `number`.
|
|
5
|
+
*
|
|
6
|
+
* GitHub's REST payloads arrive through `JSON.parse`, which never produces a
|
|
7
|
+
* bigint, so at runtime the value is always a number today — the union is
|
|
8
|
+
* upstream future-proofing for ids beyond 2^53. If GitHub ever crosses that
|
|
9
|
+
* line, the `id: number` fields on this package's public records have to be
|
|
10
|
+
* redesigned; a runtime coercion here could not paper over it.
|
|
11
|
+
*
|
|
12
|
+
* Leaf module: imports nothing.
|
|
13
|
+
*/
|
|
14
|
+
const numericId = (id) => Number(id);
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { numericId };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effected/github",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
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": [
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@effected/semver": "^0.5.0",
|
|
42
42
|
"@octokit/core": "^7.0.6",
|
|
43
|
-
"@octokit/plugin-paginate-rest": "^
|
|
44
|
-
"@octokit/types": "^
|
|
43
|
+
"@octokit/plugin-paginate-rest": "^15.0.0",
|
|
44
|
+
"@octokit/types": "^17.0.0",
|
|
45
45
|
"blakejs": "1.2.1",
|
|
46
46
|
"tweetnacl": "1.0.3",
|
|
47
47
|
"universal-github-app-jwt": "^2.2.2"
|