@shivaedev/github 0.6.0 → 0.7.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/README.md +14 -3
- package/dist/GitHub.d.ts +10 -0
- package/dist/GitHub.d.ts.map +1 -1
- package/dist/GitHub.js +3 -0
- package/dist/GitHub.js.map +1 -1
- package/dist/checkRuns.d.ts +18 -3
- package/dist/checkRuns.d.ts.map +1 -1
- package/dist/checkRuns.js +15 -4
- package/dist/checkRuns.js.map +1 -1
- package/dist/representations.d.ts +1 -0
- package/dist/representations.d.ts.map +1 -1
- package/dist/representations.js +2 -1
- package/dist/representations.js.map +1 -1
- package/dist/verifyWebhook.d.ts +3 -2
- package/dist/verifyWebhook.d.ts.map +1 -1
- package/dist/verifyWebhook.js +8 -2
- package/dist/verifyWebhook.js.map +1 -1
- package/package.json +2 -2
- package/src/GitHub.ts +9 -0
- package/src/checkRuns.ts +16 -5
- package/src/representations.ts +2 -1
- package/src/verifyWebhook.ts +26 -3
package/README.md
CHANGED
|
@@ -76,7 +76,15 @@ const diff = Effect.gen(function* () {
|
|
|
76
76
|
});
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
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. 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.
|
|
79
|
+
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.
|
|
80
|
+
|
|
81
|
+
Use `listBounded(path, itemSchema, pageCap, byteLimit?)` to collect a prefix within a positive page cap. It returns `{ items, 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`.
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import { listBounded } from "@shivaedev/github/GitHub.ts";
|
|
85
|
+
|
|
86
|
+
const issues = listBounded("/repos/acme/widgets/issues", Issue, 2);
|
|
87
|
+
```
|
|
80
88
|
|
|
81
89
|
### Acting as a GitHub App
|
|
82
90
|
|
|
@@ -143,6 +151,8 @@ A missing (404) or expired (410) artifact fails with `GitHubArtifactError({ stag
|
|
|
143
151
|
|
|
144
152
|
### Verifying webhooks
|
|
145
153
|
|
|
154
|
+
Use [`@shivaedev/webhooks`](https://github.com/ShivaeDev/platform/tree/main/packages/webhooks#readme) to receive deliveries through the application host with receipts, deduplication and transactional job enqueueing. This package owns signature verification only.
|
|
155
|
+
|
|
146
156
|
Pass the raw request bytes and the `X-Hub-Signature-256` header to `verifyWebhook` before parsing the body. It checks HMAC SHA-256 with a constant-time comparison, then decodes JSON with your Schema. A missing header, tampered body or wrong secret fails with `GitHubWebhookSignatureError` before Schema decoding.
|
|
147
157
|
|
|
148
158
|
```ts
|
|
@@ -160,7 +170,7 @@ const receiveWorkflowRun = (
|
|
|
160
170
|
) => verifyWebhook(rawBody, signature, secret, WorkflowRun);
|
|
161
171
|
```
|
|
162
172
|
|
|
163
|
-
|
|
173
|
+
Omit the Schema argument to verify the signature only, without decoding the body. With a Schema, this decodes a signed `workflow_run` delivery with the fields the application needs. Keep the body bytes as received: parsing and reserializing JSON changes what was signed.
|
|
164
174
|
|
|
165
175
|
### Sticky comments and check runs
|
|
166
176
|
|
|
@@ -179,13 +189,14 @@ const report = Effect.gen(function* () {
|
|
|
179
189
|
});
|
|
180
190
|
```
|
|
181
191
|
|
|
182
|
-
`createCheckRun(owner, repo, input)` creates a check for `headSha` with a name and status. `updateCheckRun(owner, repo, id, input)` moves it to `in_progress` or `completed`; completion requires a conclusion. Output contains `title`, `summary` and optional `text`. Request and response Schemas are exported from `checkRuns.ts`.
|
|
192
|
+
`createCheckRun(owner, repo, input)` creates a check for `headSha` with a name and status. `updateCheckRun(owner, repo, id, input)` moves it to `in_progress` or `completed`; completion requires a conclusion. Output contains `title`, `summary` and optional `text`. An optional `detailsUrl` on creation and either update shape links to an external report; the returned `CheckRun.detailsUrl` is the GitHub URL or `null` when none exists. It is sent and decoded as `details_url`. Request and response Schemas are exported from `checkRuns.ts`.
|
|
183
193
|
|
|
184
194
|
```ts
|
|
185
195
|
const check = (headSha: string) => Effect.gen(function* () {
|
|
186
196
|
const github = yield* GitHub;
|
|
187
197
|
const created = yield* github.createCheckRun("acme", "widgets", {
|
|
188
198
|
headSha, name: "Coverage", status: "queued",
|
|
199
|
+
detailsUrl: "https://reports.example/coverage",
|
|
189
200
|
});
|
|
190
201
|
yield* github.updateCheckRun("acme", "widgets", created.id, {
|
|
191
202
|
status: "in_progress", output: { title: "Coverage", summary: "Measuring" },
|
package/dist/GitHub.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
|
|
|
5
5
|
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").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge, never>;
|
|
6
6
|
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
7
|
decode: <TSchema extends Schema.Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], Schema.SchemaError, TSchema["DecodingServices"]>;
|
|
8
|
+
hasNext: boolean;
|
|
8
9
|
}, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | 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>;
|
|
9
10
|
readonly read: (path: string, byteLimit?: number | undefined) => Effect.Effect<{
|
|
10
11
|
decode: <TSchema extends Schema.Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], Schema.SchemaError, TSchema["DecodingServices"]>;
|
|
@@ -14,6 +15,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
|
|
|
14
15
|
}, 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").ResponseBodyTooLarge | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
|
|
15
16
|
readonly createCheckRun: (owner: string, repo: string, input: {
|
|
16
17
|
readonly conclusion?: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out" | undefined;
|
|
18
|
+
readonly detailsUrl?: string | undefined;
|
|
17
19
|
readonly headSha: string;
|
|
18
20
|
readonly name: string;
|
|
19
21
|
readonly output?: {
|
|
@@ -24,6 +26,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
|
|
|
24
26
|
readonly status: "completed" | "in_progress" | "queued";
|
|
25
27
|
}) => Effect.Effect<{
|
|
26
28
|
readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out" | null;
|
|
29
|
+
readonly detailsUrl: string | null;
|
|
27
30
|
readonly headSha: string;
|
|
28
31
|
readonly id: number;
|
|
29
32
|
readonly name: string;
|
|
@@ -35,6 +38,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
|
|
|
35
38
|
readonly status: "completed" | "in_progress" | "queued";
|
|
36
39
|
}, 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").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
|
|
37
40
|
readonly updateCheckRun: (owner: string, repo: string, id: number, input: {
|
|
41
|
+
readonly detailsUrl?: string | undefined;
|
|
38
42
|
readonly output?: {
|
|
39
43
|
readonly summary: string;
|
|
40
44
|
readonly text?: string | undefined;
|
|
@@ -43,6 +47,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
|
|
|
43
47
|
readonly status: "in_progress" | "queued";
|
|
44
48
|
} | {
|
|
45
49
|
readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out";
|
|
50
|
+
readonly detailsUrl?: string | undefined;
|
|
46
51
|
readonly output?: {
|
|
47
52
|
readonly summary: string;
|
|
48
53
|
readonly text?: string | undefined;
|
|
@@ -51,6 +56,7 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
|
|
|
51
56
|
readonly status: "completed";
|
|
52
57
|
}) => Effect.Effect<{
|
|
53
58
|
readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out" | null;
|
|
59
|
+
readonly detailsUrl: string | null;
|
|
54
60
|
readonly headSha: string;
|
|
55
61
|
readonly id: number;
|
|
56
62
|
readonly name: string;
|
|
@@ -89,5 +95,9 @@ export declare const GitHub: import("effect/Context").Service<"@shivaedev/github
|
|
|
89
95
|
};
|
|
90
96
|
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").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, "@shivaedev/github/GitHub" | TSchema["DecodingServices"]>;
|
|
91
97
|
export declare function list<TSchema extends Schema.Constraint>(path: string, schema: TSchema, responseByteLimit?: 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("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"]>;
|
|
98
|
+
export declare function listBounded<TSchema extends Schema.Constraint>(path: string, schema: TSchema, pageCap: number, responseByteLimit?: number): Effect.Effect<{
|
|
99
|
+
items: TSchema["Type"][];
|
|
100
|
+
truncated: boolean;
|
|
101
|
+
}, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | 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"]>;
|
|
92
102
|
export declare function write<TSchema extends Schema.Constraint>(method: "POST" | "PATCH", path: string, body: unknown, schema: TSchema, responseByteLimit?: number): Effect.Effect<TSchema["Type"], import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("effect/http/HttpBody").HttpBodyError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, "@shivaedev/github/GitHub" | TSchema["DecodingServices"]>;
|
|
93
103
|
//# sourceMappingURL=GitHub.d.ts.map
|
package/dist/GitHub.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitHub.d.ts","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;AAKzC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAO9C,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"GitHub.d.ts","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;AAKzC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAO9C,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BjB,CAAC;AAEH,wBAAgB,IAAI,CAAC,OAAO,SAAS,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,CAAC,EAAE,MAAM,icAEhH;AAED,wBAAgB,IAAI,CAAC,OAAO,SAAS,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,CAAC,EAAE,MAAM,omBAKhH;AAED,wBAAgB,WAAW,CAAC,OAAO,SAAS,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM;;;qkBAOxI;AAED,wBAAgB,KAAK,CAAC,OAAO,SAAS,MAAM,CAAC,UAAU,EACtD,MAAM,EAAE,MAAM,GAAG,OAAO,EACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,OAAO,EACf,iBAAiB,CAAC,EAAE,MAAM,gfAK1B"}
|
package/dist/GitHub.js
CHANGED
|
@@ -47,6 +47,9 @@ export function read(path, schema, responseByteLimit) {
|
|
|
47
47
|
export function list(path, schema, responseByteLimit) {
|
|
48
48
|
return Stream.unwrap(Effect.flatMap(GitHub, (github) => github.list(path, undefined, responseByteLimit))).pipe(Stream.mapEffect((response) => response.decode(Schema.Array(schema))), Stream.flatMap(Stream.fromIterable));
|
|
49
49
|
}
|
|
50
|
+
export function listBounded(path, schema, pageCap, responseByteLimit) {
|
|
51
|
+
return Stream.unwrap(Effect.flatMap(GitHub, (github) => github.list(path, undefined, responseByteLimit))).pipe(Stream.take(pageCap), Stream.mapEffect((page) => Effect.map(page.decode(Schema.Array(schema)), (items) => ({ items, truncated: page.hasNext }))), Stream.runCollect, Effect.map((pages) => ({ items: pages.flatMap((page) => page.items), truncated: pages.at(-1)?.truncated ?? false })));
|
|
52
|
+
}
|
|
50
53
|
export function write(method, path, body, schema, responseByteLimit) {
|
|
51
54
|
return Effect.flatMap(GitHub, (github) => Effect.flatMap(github.write(method, path, body, responseByteLimit), (response) => response.decode(schema)));
|
|
52
55
|
}
|
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,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAC;IACnC,EAAE,EAAE,0BAA0B;IAC9B,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC/B,MAAM,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B,EACxB,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"}
|
package/dist/checkRuns.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
|
-
import type { Representations } from "
|
|
2
|
+
import type { Representations } from "#representations.ts";
|
|
3
3
|
export declare const CheckRunOutput: Schema.Struct<{
|
|
4
4
|
readonly summary: Schema.String;
|
|
5
5
|
readonly text: Schema.optional<Schema.String>;
|
|
@@ -9,6 +9,7 @@ export declare const CheckRunConclusion: Schema.Literals<readonly ["action_requi
|
|
|
9
9
|
export declare const CheckRunStatus: Schema.Literals<readonly ["queued", "in_progress", "completed"]>;
|
|
10
10
|
export declare const CreateCheckRun: Schema.encodeKeys<Schema.Struct<{
|
|
11
11
|
readonly conclusion: Schema.optional<Schema.Literals<readonly ["action_required", "cancelled", "failure", "neutral", "success", "skipped", "stale", "timed_out"]>>;
|
|
12
|
+
readonly detailsUrl: Schema.optional<Schema.String>;
|
|
12
13
|
readonly headSha: Schema.String;
|
|
13
14
|
readonly name: Schema.String;
|
|
14
15
|
readonly output: Schema.optional<Schema.Struct<{
|
|
@@ -18,26 +19,34 @@ export declare const CreateCheckRun: Schema.encodeKeys<Schema.Struct<{
|
|
|
18
19
|
}>>;
|
|
19
20
|
readonly status: Schema.Literals<readonly ["queued", "in_progress", "completed"]>;
|
|
20
21
|
}>, {
|
|
22
|
+
readonly detailsUrl: "details_url";
|
|
21
23
|
readonly headSha: "head_sha";
|
|
22
24
|
}>;
|
|
23
|
-
export declare const UpdateCheckRun: Schema.Union<readonly [Schema.Struct<{
|
|
25
|
+
export declare const UpdateCheckRun: Schema.Union<readonly [Schema.encodeKeys<Schema.Struct<{
|
|
26
|
+
readonly detailsUrl: Schema.optional<Schema.String>;
|
|
24
27
|
readonly output: Schema.optional<Schema.Struct<{
|
|
25
28
|
readonly summary: Schema.String;
|
|
26
29
|
readonly text: Schema.optional<Schema.String>;
|
|
27
30
|
readonly title: Schema.String;
|
|
28
31
|
}>>;
|
|
29
32
|
readonly status: Schema.Literals<readonly ["queued", "in_progress"]>;
|
|
30
|
-
}>,
|
|
33
|
+
}>, {
|
|
34
|
+
readonly detailsUrl: "details_url";
|
|
35
|
+
}>, Schema.encodeKeys<Schema.Struct<{
|
|
31
36
|
readonly conclusion: Schema.Literals<readonly ["action_required", "cancelled", "failure", "neutral", "success", "skipped", "stale", "timed_out"]>;
|
|
37
|
+
readonly detailsUrl: Schema.optional<Schema.String>;
|
|
32
38
|
readonly output: Schema.optional<Schema.Struct<{
|
|
33
39
|
readonly summary: Schema.String;
|
|
34
40
|
readonly text: Schema.optional<Schema.String>;
|
|
35
41
|
readonly title: Schema.String;
|
|
36
42
|
}>>;
|
|
37
43
|
readonly status: Schema.Literal<"completed">;
|
|
44
|
+
}>, {
|
|
45
|
+
readonly detailsUrl: "details_url";
|
|
38
46
|
}>]>;
|
|
39
47
|
export declare const CheckRun: Schema.encodeKeys<Schema.Struct<{
|
|
40
48
|
readonly conclusion: Schema.NullOr<Schema.Literals<readonly ["action_required", "cancelled", "failure", "neutral", "success", "skipped", "stale", "timed_out"]>>;
|
|
49
|
+
readonly detailsUrl: Schema.NullOr<Schema.String>;
|
|
41
50
|
readonly headSha: Schema.String;
|
|
42
51
|
readonly id: Schema.Number;
|
|
43
52
|
readonly name: Schema.String;
|
|
@@ -48,11 +57,13 @@ export declare const CheckRun: Schema.encodeKeys<Schema.Struct<{
|
|
|
48
57
|
}>;
|
|
49
58
|
readonly status: Schema.Literals<readonly ["queued", "in_progress", "completed"]>;
|
|
50
59
|
}>, {
|
|
60
|
+
readonly detailsUrl: "details_url";
|
|
51
61
|
readonly headSha: "head_sha";
|
|
52
62
|
}>;
|
|
53
63
|
export declare function checkRuns(client: Representations): {
|
|
54
64
|
createCheckRun: (owner: string, repo: string, input: {
|
|
55
65
|
readonly conclusion?: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out" | undefined;
|
|
66
|
+
readonly detailsUrl?: string | undefined;
|
|
56
67
|
readonly headSha: string;
|
|
57
68
|
readonly name: string;
|
|
58
69
|
readonly output?: {
|
|
@@ -63,6 +74,7 @@ export declare function checkRuns(client: Representations): {
|
|
|
63
74
|
readonly status: "completed" | "in_progress" | "queued";
|
|
64
75
|
}) => Effect.Effect<{
|
|
65
76
|
readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out" | null;
|
|
77
|
+
readonly detailsUrl: string | null;
|
|
66
78
|
readonly headSha: string;
|
|
67
79
|
readonly id: number;
|
|
68
80
|
readonly name: string;
|
|
@@ -74,6 +86,7 @@ export declare function checkRuns(client: Representations): {
|
|
|
74
86
|
readonly status: "completed" | "in_progress" | "queued";
|
|
75
87
|
}, 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").ResponseBodyTooLarge | Schema.SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
|
|
76
88
|
updateCheckRun: (owner: string, repo: string, id: number, input: {
|
|
89
|
+
readonly detailsUrl?: string | undefined;
|
|
77
90
|
readonly output?: {
|
|
78
91
|
readonly summary: string;
|
|
79
92
|
readonly text?: string | undefined;
|
|
@@ -82,6 +95,7 @@ export declare function checkRuns(client: Representations): {
|
|
|
82
95
|
readonly status: "in_progress" | "queued";
|
|
83
96
|
} | {
|
|
84
97
|
readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out";
|
|
98
|
+
readonly detailsUrl?: string | undefined;
|
|
85
99
|
readonly output?: {
|
|
86
100
|
readonly summary: string;
|
|
87
101
|
readonly text?: string | undefined;
|
|
@@ -90,6 +104,7 @@ export declare function checkRuns(client: Representations): {
|
|
|
90
104
|
readonly status: "completed";
|
|
91
105
|
}) => Effect.Effect<{
|
|
92
106
|
readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out" | null;
|
|
107
|
+
readonly detailsUrl: string | null;
|
|
93
108
|
readonly headSha: string;
|
|
94
109
|
readonly id: number;
|
|
95
110
|
readonly name: string;
|
package/dist/checkRuns.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkRuns.d.ts","sourceRoot":"","sources":["../src/checkRuns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"checkRuns.d.ts","sourceRoot":"","sources":["../src/checkRuns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,eAAO,MAAM,cAAc;;;;EAIzB,CAAC;AAEH,eAAO,MAAM,kBAAkB,8HAAsH,CAAC;AACtJ,eAAO,MAAM,cAAc,kEAA0D,CAAC;AAEtF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;EAOmD,CAAC;AAE/E,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;IAYzB,CAAC;AAEH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;EAQyD,CAAC;AAE/E,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe;IAE/C,cAAc;;;;;;;;;;;;;;;;;;;;;;;;IAKd,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMf"}
|
package/dist/checkRuns.js
CHANGED
|
@@ -8,23 +8,34 @@ export const CheckRunConclusion = Schema.Literals(["action_required", "cancelled
|
|
|
8
8
|
export const CheckRunStatus = Schema.Literals(["queued", "in_progress", "completed"]);
|
|
9
9
|
export const CreateCheckRun = Schema.Struct({
|
|
10
10
|
conclusion: Schema.optional(CheckRunConclusion),
|
|
11
|
+
detailsUrl: Schema.optional(Schema.String),
|
|
11
12
|
headSha: Schema.String,
|
|
12
13
|
name: Schema.String,
|
|
13
14
|
output: Schema.optional(CheckRunOutput),
|
|
14
15
|
status: CheckRunStatus,
|
|
15
|
-
}).pipe(Schema.encodeKeys({ headSha: "head_sha" }));
|
|
16
|
+
}).pipe(Schema.encodeKeys({ detailsUrl: "details_url", headSha: "head_sha" }));
|
|
16
17
|
export const UpdateCheckRun = Schema.Union([
|
|
17
|
-
Schema.Struct({
|
|
18
|
-
|
|
18
|
+
Schema.Struct({
|
|
19
|
+
detailsUrl: Schema.optional(Schema.String),
|
|
20
|
+
output: Schema.optional(CheckRunOutput),
|
|
21
|
+
status: Schema.Literals(["queued", "in_progress"]),
|
|
22
|
+
}).pipe(Schema.encodeKeys({ detailsUrl: "details_url" })),
|
|
23
|
+
Schema.Struct({
|
|
24
|
+
conclusion: CheckRunConclusion,
|
|
25
|
+
detailsUrl: Schema.optional(Schema.String),
|
|
26
|
+
output: Schema.optional(CheckRunOutput),
|
|
27
|
+
status: Schema.Literal("completed"),
|
|
28
|
+
}).pipe(Schema.encodeKeys({ detailsUrl: "details_url" })),
|
|
19
29
|
]);
|
|
20
30
|
export const CheckRun = Schema.Struct({
|
|
21
31
|
conclusion: Schema.NullOr(CheckRunConclusion),
|
|
32
|
+
detailsUrl: Schema.NullOr(Schema.String),
|
|
22
33
|
headSha: Schema.String,
|
|
23
34
|
id: Schema.Number,
|
|
24
35
|
name: Schema.String,
|
|
25
36
|
output: Schema.Struct({ summary: Schema.NullOr(Schema.String), text: Schema.NullOr(Schema.String), title: Schema.NullOr(Schema.String) }),
|
|
26
37
|
status: CheckRunStatus,
|
|
27
|
-
}).pipe(Schema.encodeKeys({ headSha: "head_sha" }));
|
|
38
|
+
}).pipe(Schema.encodeKeys({ detailsUrl: "details_url", headSha: "head_sha" }));
|
|
28
39
|
export function checkRuns(client) {
|
|
29
40
|
return {
|
|
30
41
|
createCheckRun: Effect.fn("GitHub.createCheckRun")(function* (owner, repo, input) {
|
package/dist/checkRuns.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkRuns.js","sourceRoot":"","sources":["../src/checkRuns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGxC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC,MAAM;CACpB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,iBAAiB,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;AACtJ,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC;AAEtF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3C,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC;IAC/C,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,IAAI,EA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,CAAC,CAAC;QACzC,CAAC,CAAC;KACF,CAAC;AACH,CAAC"}
|
|
@@ -6,6 +6,7 @@ export declare function representations(apiUrl: string, request: ReturnType<type
|
|
|
6
6
|
get: (path: string, accept?: string) => HttpClientRequest.HttpClientRequest;
|
|
7
7
|
list: (path: string, beforeRequest?: (resource: string) => Effect.Effect<void, ServiceUnavailable>, byteLimit?: number) => Effect.Effect<Stream.Stream<{
|
|
8
8
|
decode: <TSchema extends import("effect/Schema").Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], import("effect/Schema").SchemaError, TSchema["DecodingServices"]>;
|
|
9
|
+
hasNext: boolean;
|
|
9
10
|
}, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | ServiceUnavailable | import("@shivaedev/http/errors.ts").RemoteStatusError, never>, never, never>;
|
|
10
11
|
read: (path: string, byteLimit?: number) => Effect.Effect<{
|
|
11
12
|
decode: <TSchema extends import("effect/Schema").Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], import("effect/Schema").SchemaError, TSchema["DecodingServices"]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"representations.d.ts","sourceRoot":"","sources":["../src/representations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAc,iBAAiB,EAA2B,MAAM,aAAa,CAAC;AACrF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"representations.d.ts","sourceRoot":"","sources":["../src/representations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAc,iBAAiB,EAA2B,MAAM,aAAa,CAAC;AACrF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAKxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,wBAAgB,eAAe,CAC9B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,EACpC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EAClC,iBAAiB,SAAc;gBAEZ,MAAM;iBAOlB,MAAM,kBACI,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,kBAAkB,CAAC;;;;iBAL5C,MAAM;;;oBA6BH,MAAM,GAAG,OAAO,QAAQ,MAAM,QAAQ,OAAO;;;EAQlF;AAED,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,EAAE,KAAK,CAAC,CAAC"}
|
package/dist/representations.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Effect, Stream } from "effect";
|
|
2
2
|
import { HttpClient, HttpClientRequest } from "effect/http";
|
|
3
|
+
import { nextLink } from "@shivaedev/http/nextLink.ts";
|
|
3
4
|
import { paginate } from "@shivaedev/http/paginate.ts";
|
|
4
5
|
import { jsonResponse } from "#json.ts";
|
|
5
6
|
export function representations(apiUrl, request, resource, responseByteLimit = 1024 * 1024) {
|
|
@@ -18,7 +19,7 @@ export function representations(apiUrl, request, resource, responseByteLimit = 1
|
|
|
18
19
|
}));
|
|
19
20
|
}
|
|
20
21
|
const client = HttpClient.makeWith((effect) => Effect.flatMap(effect, fetchPage), Effect.succeed);
|
|
21
|
-
return Effect.succeed(paginate(client, get(path)).pipe(Stream.mapEffect((response) => Effect.fromNullishOr(entries.get(response))), Stream.map(jsonResponse)));
|
|
22
|
+
return Effect.succeed(paginate(client, get(path)).pipe(Stream.mapEffect((response) => Effect.fromNullishOr(entries.get(response))), Stream.map((entry) => ({ ...jsonResponse(entry), hasNext: nextLink(entry.response.headers.link) !== undefined }))));
|
|
22
23
|
}
|
|
23
24
|
function writeRepresentation(method, path, body, byteLimit = responseByteLimit) {
|
|
24
25
|
return HttpClientRequest.make(method)(new URL(path, apiUrl).href, { headers: { Accept: "application/vnd.github+json" } }).pipe(HttpClientRequest.bodyJson(body), Effect.flatMap((input) => request(input, byteLimit)), Effect.map(jsonResponse));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"representations.js","sourceRoot":"","sources":["../src/representations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAA2B,MAAM,aAAa,CAAC;AAErF,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,MAAM,UAAU,eAAe,CAC9B,MAAc,EACd,OAAoC,EACpC,QAAkC,EAClC,iBAAiB,GAAG,IAAI,GAAG,IAAI;IAE/B,SAAS,GAAG,CAAC,IAAY,EAAE,MAAM,GAAG,6BAA6B;QAChE,OAAO,iBAAiB,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IAC3F,CAAC;IACD,SAAS,kBAAkB,CAAC,IAAY,EAAE,SAAS,GAAG,iBAAiB;QACtE,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,EAAE,YAAY,CAAC,CAAC;IAChE,CAAC;IACD,SAAS,mBAAmB,CAC3B,IAAY,EACZ,aAA6E,EAC7E,SAAS,GAAG,iBAAiB;QAE7B,MAAM,OAA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ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Effect, Redacted, Schema } from "effect";
|
|
2
|
-
import { GitHubWebhookSignatureError } from "
|
|
3
|
-
export declare
|
|
2
|
+
import { GitHubWebhookSignatureError } from "#errors.ts";
|
|
3
|
+
export declare function verifyWebhook(body: Uint8Array, signature: string | undefined, secret: Redacted.Redacted<string>): Effect.Effect<void, GitHubWebhookSignatureError>;
|
|
4
|
+
export declare function verifyWebhook<TSchema extends Schema.Constraint>(body: Uint8Array, signature: string | undefined, secret: Redacted.Redacted<string>, schema: TSchema): Effect.Effect<TSchema["Type"], GitHubWebhookSignatureError | Schema.SchemaError, TSchema["DecodingServices"]>;
|
|
4
5
|
//# sourceMappingURL=verifyWebhook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyWebhook.d.ts","sourceRoot":"","sources":["../src/verifyWebhook.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,2BAA2B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"verifyWebhook.d.ts","sourceRoot":"","sources":["../src/verifyWebhook.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAqBzD,wBAAgB,aAAa,CAC5B,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,GAC/B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,2BAA2B,CAAC,CAAC;AACpD,wBAAgB,aAAa,CAAC,OAAO,SAAS,MAAM,CAAC,UAAU,EAC9D,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EACjC,MAAM,EAAE,OAAO,GACb,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,2BAA2B,GAAG,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC"}
|
package/dist/verifyWebhook.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
2
2
|
import { Effect, Redacted, Schema } from "effect";
|
|
3
|
-
import { GitHubWebhookSignatureError } from "
|
|
4
|
-
|
|
3
|
+
import { GitHubWebhookSignatureError } from "#errors.ts";
|
|
4
|
+
const verify = Effect.fnUntraced(function* (body, signature, secret, schema) {
|
|
5
5
|
if (signature === undefined || !/^sha256=[0-9a-f]{64}$/u.test(signature)) {
|
|
6
6
|
return yield* new GitHubWebhookSignatureError();
|
|
7
7
|
}
|
|
@@ -9,6 +9,12 @@ export const verifyWebhook = Effect.fnUntraced(function* (body, signature, secre
|
|
|
9
9
|
if (!timingSafeEqual(expected, Buffer.from(signature.slice(7), "hex"))) {
|
|
10
10
|
return yield* new GitHubWebhookSignatureError();
|
|
11
11
|
}
|
|
12
|
+
if (schema === undefined) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
12
15
|
return yield* Schema.decodeUnknownEffect(Schema.fromJsonString(schema))(new TextDecoder().decode(body));
|
|
13
16
|
});
|
|
17
|
+
export function verifyWebhook(body, signature, secret, schema) {
|
|
18
|
+
return verify(body, signature, secret, schema);
|
|
19
|
+
}
|
|
14
20
|
//# sourceMappingURL=verifyWebhook.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyWebhook.js","sourceRoot":"","sources":["../src/verifyWebhook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,Q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C,CAAC;AAaH,MAAM,UAAU,aAAa,CAC5B,IAAgB,EAChB,SAA6B,EAC7B,MAAiC,EACjC,MAAgB;IAEhB,OAAO,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAChD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/github",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Typed GitHub REST requests, conditional reads and resource budgets for Effect applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"effect"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@effect/vitest": "4.0.5",
|
|
53
53
|
"@shivaedev/quality": "0.42.0",
|
|
54
54
|
"@shivaedev/test": "0.10.0",
|
|
55
|
-
"@shivaedev/test-story": "0.21.
|
|
55
|
+
"@shivaedev/test-story": "0.21.1",
|
|
56
56
|
"@types/node": "24.19.2",
|
|
57
57
|
"effect": "4.0.5",
|
|
58
58
|
"typescript": "7.0.2",
|
package/src/GitHub.ts
CHANGED
|
@@ -55,6 +55,15 @@ export function list<TSchema extends Schema.Constraint>(path: string, schema: TS
|
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
export function listBounded<TSchema extends Schema.Constraint>(path: string, schema: TSchema, pageCap: number, responseByteLimit?: number) {
|
|
59
|
+
return Stream.unwrap(Effect.flatMap(GitHub, (github) => github.list(path, undefined, responseByteLimit))).pipe(
|
|
60
|
+
Stream.take(pageCap),
|
|
61
|
+
Stream.mapEffect((page) => Effect.map(page.decode(Schema.Array(schema)), (items) => ({ items, truncated: page.hasNext }))),
|
|
62
|
+
Stream.runCollect,
|
|
63
|
+
Effect.map((pages) => ({ items: pages.flatMap((page) => page.items), truncated: pages.at(-1)?.truncated ?? false })),
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
58
67
|
export function write<TSchema extends Schema.Constraint>(
|
|
59
68
|
method: "POST" | "PATCH",
|
|
60
69
|
path: string,
|
package/src/checkRuns.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
|
-
import type { Representations } from "
|
|
2
|
+
import type { Representations } from "#representations.ts";
|
|
3
3
|
|
|
4
4
|
export const CheckRunOutput = Schema.Struct({
|
|
5
5
|
summary: Schema.String,
|
|
@@ -12,25 +12,36 @@ export const CheckRunStatus = Schema.Literals(["queued", "in_progress", "complet
|
|
|
12
12
|
|
|
13
13
|
export const CreateCheckRun = Schema.Struct({
|
|
14
14
|
conclusion: Schema.optional(CheckRunConclusion),
|
|
15
|
+
detailsUrl: Schema.optional(Schema.String),
|
|
15
16
|
headSha: Schema.String,
|
|
16
17
|
name: Schema.String,
|
|
17
18
|
output: Schema.optional(CheckRunOutput),
|
|
18
19
|
status: CheckRunStatus,
|
|
19
|
-
}).pipe(Schema.encodeKeys({ headSha: "head_sha" }));
|
|
20
|
+
}).pipe(Schema.encodeKeys({ detailsUrl: "details_url", headSha: "head_sha" }));
|
|
20
21
|
|
|
21
22
|
export const UpdateCheckRun = Schema.Union([
|
|
22
|
-
Schema.Struct({
|
|
23
|
-
|
|
23
|
+
Schema.Struct({
|
|
24
|
+
detailsUrl: Schema.optional(Schema.String),
|
|
25
|
+
output: Schema.optional(CheckRunOutput),
|
|
26
|
+
status: Schema.Literals(["queued", "in_progress"]),
|
|
27
|
+
}).pipe(Schema.encodeKeys({ detailsUrl: "details_url" })),
|
|
28
|
+
Schema.Struct({
|
|
29
|
+
conclusion: CheckRunConclusion,
|
|
30
|
+
detailsUrl: Schema.optional(Schema.String),
|
|
31
|
+
output: Schema.optional(CheckRunOutput),
|
|
32
|
+
status: Schema.Literal("completed"),
|
|
33
|
+
}).pipe(Schema.encodeKeys({ detailsUrl: "details_url" })),
|
|
24
34
|
]);
|
|
25
35
|
|
|
26
36
|
export const CheckRun = Schema.Struct({
|
|
27
37
|
conclusion: Schema.NullOr(CheckRunConclusion),
|
|
38
|
+
detailsUrl: Schema.NullOr(Schema.String),
|
|
28
39
|
headSha: Schema.String,
|
|
29
40
|
id: Schema.Number,
|
|
30
41
|
name: Schema.String,
|
|
31
42
|
output: Schema.Struct({ summary: Schema.NullOr(Schema.String), text: Schema.NullOr(Schema.String), title: Schema.NullOr(Schema.String) }),
|
|
32
43
|
status: CheckRunStatus,
|
|
33
|
-
}).pipe(Schema.encodeKeys({ headSha: "head_sha" }));
|
|
44
|
+
}).pipe(Schema.encodeKeys({ detailsUrl: "details_url", headSha: "head_sha" }));
|
|
34
45
|
|
|
35
46
|
export function checkRuns(client: Representations) {
|
|
36
47
|
return {
|
package/src/representations.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Effect, Stream } from "effect";
|
|
2
2
|
import { HttpClient, HttpClientRequest, type HttpClientResponse } from "effect/http";
|
|
3
3
|
import type { ServiceUnavailable } from "@shivaedev/errors/taxonomy.ts";
|
|
4
|
+
import { nextLink } from "@shivaedev/http/nextLink.ts";
|
|
4
5
|
import { paginate } from "@shivaedev/http/paginate.ts";
|
|
5
6
|
import type { CachedResponse } from "#cache.ts";
|
|
6
7
|
import { jsonResponse } from "#json.ts";
|
|
@@ -40,7 +41,7 @@ export function representations(
|
|
|
40
41
|
return Effect.succeed(
|
|
41
42
|
paginate(client, get(path)).pipe(
|
|
42
43
|
Stream.mapEffect((response) => Effect.fromNullishOr(entries.get(response))),
|
|
43
|
-
Stream.map(jsonResponse),
|
|
44
|
+
Stream.map((entry) => ({ ...jsonResponse(entry), hasNext: nextLink(entry.response.headers.link) !== undefined })),
|
|
44
45
|
),
|
|
45
46
|
);
|
|
46
47
|
}
|
package/src/verifyWebhook.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
2
2
|
import { Effect, Redacted, Schema } from "effect";
|
|
3
|
-
import { GitHubWebhookSignatureError } from "
|
|
3
|
+
import { GitHubWebhookSignatureError } from "#errors.ts";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
const verify = Effect.fnUntraced(function* <TSchema extends Schema.Constraint>(
|
|
6
6
|
body: Uint8Array,
|
|
7
7
|
signature: string | undefined,
|
|
8
8
|
secret: Redacted.Redacted<string>,
|
|
9
|
-
schema
|
|
9
|
+
schema?: TSchema,
|
|
10
10
|
) {
|
|
11
11
|
if (signature === undefined || !/^sha256=[0-9a-f]{64}$/u.test(signature)) {
|
|
12
12
|
return yield* new GitHubWebhookSignatureError();
|
|
@@ -15,5 +15,28 @@ export const verifyWebhook = Effect.fnUntraced(function* <TSchema extends Schema
|
|
|
15
15
|
if (!timingSafeEqual(expected, Buffer.from(signature.slice(7), "hex"))) {
|
|
16
16
|
return yield* new GitHubWebhookSignatureError();
|
|
17
17
|
}
|
|
18
|
+
if (schema === undefined) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
18
21
|
return yield* Schema.decodeUnknownEffect(Schema.fromJsonString(schema))(new TextDecoder().decode(body));
|
|
19
22
|
});
|
|
23
|
+
|
|
24
|
+
export function verifyWebhook(
|
|
25
|
+
body: Uint8Array,
|
|
26
|
+
signature: string | undefined,
|
|
27
|
+
secret: Redacted.Redacted<string>,
|
|
28
|
+
): Effect.Effect<void, GitHubWebhookSignatureError>;
|
|
29
|
+
export function verifyWebhook<TSchema extends Schema.Constraint>(
|
|
30
|
+
body: Uint8Array,
|
|
31
|
+
signature: string | undefined,
|
|
32
|
+
secret: Redacted.Redacted<string>,
|
|
33
|
+
schema: TSchema,
|
|
34
|
+
): Effect.Effect<TSchema["Type"], GitHubWebhookSignatureError | Schema.SchemaError, TSchema["DecodingServices"]>;
|
|
35
|
+
export function verifyWebhook<TSchema extends Schema.Constraint>(
|
|
36
|
+
body: Uint8Array,
|
|
37
|
+
signature: string | undefined,
|
|
38
|
+
secret: Redacted.Redacted<string>,
|
|
39
|
+
schema?: TSchema,
|
|
40
|
+
) {
|
|
41
|
+
return verify(body, signature, secret, schema);
|
|
42
|
+
}
|