@shivaedev/github 0.8.6 → 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.
Files changed (115) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +142 -8
  3. package/dist/GitHub.d.ts +360 -18
  4. package/dist/GitHub.d.ts.map +1 -1
  5. package/dist/GitHub.js +19 -6
  6. package/dist/GitHub.js.map +1 -1
  7. package/dist/GitHubToken.d.ts +2 -2
  8. package/dist/GitHubToken.d.ts.map +1 -1
  9. package/dist/GitHubToken.js +1 -1
  10. package/dist/GitHubToken.js.map +1 -1
  11. package/dist/adapters/resolveApiUrl.d.ts +2 -0
  12. package/dist/adapters/resolveApiUrl.d.ts.map +1 -0
  13. package/dist/adapters/resolveApiUrl.js +6 -0
  14. package/dist/adapters/resolveApiUrl.js.map +1 -0
  15. package/dist/adapters/zipEntries.d.ts +17 -0
  16. package/dist/adapters/zipEntries.d.ts.map +1 -0
  17. package/dist/adapters/zipEntries.js +57 -0
  18. package/dist/adapters/zipEntries.js.map +1 -0
  19. package/dist/appTokens.d.ts +6 -0
  20. package/dist/appTokens.d.ts.map +1 -0
  21. package/dist/appTokens.js +65 -0
  22. package/dist/appTokens.js.map +1 -0
  23. package/dist/artifactErrors.d.ts +34 -0
  24. package/dist/artifactErrors.d.ts.map +1 -0
  25. package/dist/artifactErrors.js +27 -0
  26. package/dist/artifactErrors.js.map +1 -0
  27. package/dist/artifactExtraction.d.ts +12 -0
  28. package/dist/artifactExtraction.d.ts.map +1 -0
  29. package/dist/artifactExtraction.js +40 -0
  30. package/dist/artifactExtraction.js.map +1 -0
  31. package/dist/artifactPaths.d.ts +4 -0
  32. package/dist/artifactPaths.d.ts.map +1 -0
  33. package/dist/artifactPaths.js +35 -0
  34. package/dist/artifactPaths.js.map +1 -0
  35. package/dist/artifacts.d.ts +13 -8
  36. package/dist/artifacts.d.ts.map +1 -1
  37. package/dist/artifacts.js +15 -8
  38. package/dist/artifacts.js.map +1 -1
  39. package/dist/authenticatedRequest.d.ts +1 -1
  40. package/dist/authenticatedRequest.d.ts.map +1 -1
  41. package/dist/authenticatedRequest.js +3 -2
  42. package/dist/authenticatedRequest.js.map +1 -1
  43. package/dist/cache.d.ts +2 -0
  44. package/dist/cache.d.ts.map +1 -1
  45. package/dist/cache.js +3 -0
  46. package/dist/cache.js.map +1 -1
  47. package/dist/checkRuns.d.ts +116 -11
  48. package/dist/checkRuns.d.ts.map +1 -1
  49. package/dist/checkRuns.js +41 -18
  50. package/dist/checkRuns.js.map +1 -1
  51. package/dist/gitSchemas.d.ts +195 -0
  52. package/dist/gitSchemas.d.ts.map +1 -0
  53. package/dist/gitSchemas.js +45 -0
  54. package/dist/gitSchemas.js.map +1 -0
  55. package/dist/githubApp.d.ts +2 -4
  56. package/dist/githubApp.d.ts.map +1 -1
  57. package/dist/githubApp.js +5 -55
  58. package/dist/githubApp.js.map +1 -1
  59. package/dist/installationClients.d.ts +461 -0
  60. package/dist/installationClients.d.ts.map +1 -0
  61. package/dist/installationClients.js +37 -0
  62. package/dist/installationClients.js.map +1 -0
  63. package/dist/json.d.ts.map +1 -1
  64. package/dist/json.js +4 -0
  65. package/dist/json.js.map +1 -1
  66. package/dist/pagedLists.d.ts +15 -0
  67. package/dist/pagedLists.d.ts.map +1 -0
  68. package/dist/pagedLists.js +16 -0
  69. package/dist/pagedLists.js.map +1 -0
  70. package/dist/repositoryReads.d.ts +261 -0
  71. package/dist/repositoryReads.d.ts.map +1 -0
  72. package/dist/repositoryReads.js +30 -0
  73. package/dist/repositoryReads.js.map +1 -0
  74. package/dist/repositorySchemas.d.ts +73 -0
  75. package/dist/repositorySchemas.d.ts.map +1 -0
  76. package/dist/repositorySchemas.js +38 -0
  77. package/dist/repositorySchemas.js.map +1 -0
  78. package/dist/representations.d.ts +4 -4
  79. package/dist/representations.d.ts.map +1 -1
  80. package/dist/representations.js +3 -2
  81. package/dist/representations.js.map +1 -1
  82. package/dist/requests.d.ts +2 -2
  83. package/dist/requests.d.ts.map +1 -1
  84. package/dist/requests.js +11 -9
  85. package/dist/requests.js.map +1 -1
  86. package/dist/status.d.ts +1 -1
  87. package/dist/status.d.ts.map +1 -1
  88. package/dist/stickyComments.d.ts +1 -1
  89. package/dist/viewerRepositoryAccess.d.ts +46 -0
  90. package/dist/viewerRepositoryAccess.d.ts.map +1 -0
  91. package/dist/viewerRepositoryAccess.js +54 -0
  92. package/dist/viewerRepositoryAccess.js.map +1 -0
  93. package/package.json +14 -7
  94. package/src/GitHub.ts +32 -11
  95. package/src/GitHubToken.ts +4 -2
  96. package/src/adapters/resolveApiUrl.ts +5 -0
  97. package/src/adapters/zipEntries.ts +69 -0
  98. package/src/appTokens.ts +93 -0
  99. package/src/artifactErrors.ts +26 -0
  100. package/src/artifactExtraction.ts +62 -0
  101. package/src/artifactPaths.ts +36 -0
  102. package/src/artifacts.ts +36 -39
  103. package/src/authenticatedRequest.ts +3 -1
  104. package/src/cache.ts +5 -0
  105. package/src/checkRuns.ts +58 -18
  106. package/src/gitSchemas.ts +52 -0
  107. package/src/githubApp.ts +6 -80
  108. package/src/installationClients.ts +50 -0
  109. package/src/json.ts +4 -0
  110. package/src/pagedLists.ts +40 -0
  111. package/src/repositoryReads.ts +61 -0
  112. package/src/repositorySchemas.ts +43 -0
  113. package/src/representations.ts +5 -4
  114. package/src/requests.ts +11 -9
  115. package/src/viewerRepositoryAccess.ts +66 -0
package/dist/githubApp.js CHANGED
@@ -1,58 +1,8 @@
1
- import { Cache, Clock, Context, Effect, Exit, Layer, Option, Redacted, Schema } from "effect";
2
- import { HttpClient, HttpClientRequest } from "effect/http";
3
- import { readBoundedJson } from "@shivaedev/http/body.ts";
4
- import { filterStatus } from "@shivaedev/http/filterStatus.ts";
5
- import { appJwt } from "#appJwt.ts";
6
- import { GitHubAppError } from "#errors.ts";
7
- import { GitHubConfig } from "#GitHubConfig.ts";
8
- import { GitHubToken } from "#GitHubToken.ts";
9
- import { TokenRefresh } from "#TokenRefresh.ts";
10
- const Installation = Schema.Struct({ id: Schema.Number });
11
- const AccessToken = Schema.Struct({ expiresAt: Schema.DateFromString, token: Schema.RedactedFromValue(Schema.String) }).pipe(Schema.encodeKeys({ expiresAt: "expires_at" }));
1
+ import { Layer } from "effect";
2
+ import { appTokens } from "#appTokens.ts";
3
+ import { GitHubApp, GitHubAppCredentials } from "#installationClients.ts";
12
4
  export function githubApp(options) {
13
- return Layer.effectContext(Effect.gen(function* () {
14
- if (!("installationId" in options || "owner" in options)) {
15
- return Context.make(GitHubToken, Effect.map(appJwt(options), Option.some)).pipe(Context.add(TokenRefresh, undefined));
16
- }
17
- const client = yield* HttpClient.HttpClient;
18
- const { apiUrl } = yield* GitHubConfig;
19
- const clock = yield* Clock.Clock;
20
- let installationId = "installationId" in options ? options.installationId : undefined;
21
- const request = appRequests(client, apiUrl);
22
- const exchange = Effect.gen(function* () {
23
- const jwt = yield* appJwt(options);
24
- if (installationId === undefined && "owner" in options && options.owner !== undefined) {
25
- const path = `/repos/${encodeURIComponent(options.owner)}/${encodeURIComponent(options.repository)}/installation`;
26
- installationId = (yield* request("GET", path, jwt, Installation)).id;
27
- }
28
- return yield* request("POST", `/app/installations/${installationId}/access_tokens`, jwt, AccessToken, {
29
- permissions: options.scope?.permissions,
30
- repositories: options.scope?.repositories,
31
- "repository_ids": options.scope?.repositoryIds,
32
- });
33
- });
34
- const cache = yield* Cache.makeWith((_) => exchange, {
35
- capacity: 1,
36
- timeToLive: (exit) => (Exit.isSuccess(exit) ? Math.max(0, exit.value.expiresAt.getTime() - clock.currentTimeMillisUnsafe() - 300_000) : 0),
37
- });
38
- return Context.make(GitHubToken, Effect.map(Cache.get(cache, undefined), ({ token }) => Option.some(token))).pipe(Context.add(TokenRefresh, (rejected) => Cache.invalidateWhen(cache, undefined, ({ token }) => Option.isSome(rejected) && token === rejected.value)));
39
- }));
40
- }
41
- function appRequests(client, apiUrl) {
42
- const checked = filterStatus(client);
43
- return Effect.fnUntraced(function* (method, path, jwt, schema, body) {
44
- let input = HttpClientRequest.make(method)(new URL(path, apiUrl).href, {
45
- headers: { Accept: "application/vnd.github+json", Authorization: `Bearer ${Redacted.value(jwt)}`, "X-GitHub-Api-Version": "2022-11-28" },
46
- });
47
- if (body !== undefined) {
48
- input = yield* HttpClientRequest.bodyJson(input, body).pipe(Effect.mapError((cause) => new GitHubAppError({ reason: "encode" }, { cause })));
49
- }
50
- const response = yield* checked
51
- .execute(input)
52
- .pipe(Effect.mapError((cause) => cause._tag === "HttpClientError"
53
- ? new GitHubAppError({ reason: "transport" }, { cause })
54
- : new GitHubAppError({ reason: "status", status: cause.status })));
55
- return yield* readBoundedJson(response, 64 * 1024, schema).pipe(Effect.mapError((cause) => new GitHubAppError({ reason: cause._tag === "HttpClientError" ? "transport" : "response" }, { cause })));
56
- });
5
+ const authentication = appTokens(options);
6
+ return Layer.merge(authentication, GitHubApp.layer.pipe(Layer.provide(Layer.succeed(GitHubAppCredentials)({ credentials: options }))));
57
7
  }
58
8
  //# sourceMappingURL=githubApp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"githubApp.js","sourceRoot":"","sources":["../src/githubApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9F,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAuB,MAAM,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,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,cAAc,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACxI,CAAC"}
@@ -0,0 +1,461 @@
1
+ import { Context, Effect, Layer } from "effect";
2
+ import { HttpClient } from "effect/http";
3
+ import type { AppCredentials } from "#appJwt.ts";
4
+ export declare const GitHubAppCredentials: Context.Service<{
5
+ readonly credentials: AppCredentials;
6
+ }, {
7
+ readonly credentials: AppCredentials;
8
+ }>;
9
+ export declare const GitHubApp: Context.Service<"@shivaedev/github/GitHubApp", Readonly<{
10
+ readonly installation: (id: number) => Effect.Effect<Readonly<{
11
+ readonly downloadArtifactArchive: (options: import("./artifacts.ts").ArtifactArchiveOptions) => Effect.Effect<import("./artifactExtraction.ts").ArtifactFile[], import("./errors.ts").GitHubAppError | import("./artifactErrors.ts").GitHubArtifactCompressionRatio | import("./artifactErrors.ts").GitHubArtifactDuplicateEntry | import("./errors.ts").GitHubArtifactError | import("./artifactErrors.ts").GitHubArtifactExtractedTooLarge | import("./artifactErrors.ts").GitHubArtifactExtractionError | import("./artifactErrors.ts").GitHubArtifactPathTraversal | import("./artifactErrors.ts").GitHubArtifactSymlink | import("./errors.ts").GitHubArtifactTooLarge | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("@shivaedev/http/errors.ts").RemoteHttpError | import("@shivaedev/http/errors.ts").RemoteRateLimited | import("@shivaedev/http/errors.ts").RemoteUnauthorized | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge, never>;
12
+ readonly list: (path: string, beforeRequest?: ((resource: string) => Effect.Effect<void, import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable>) | undefined, byteLimit?: number | undefined) => Effect.Effect<import("effect/Stream").Stream<{
13
+ decode: <TSchema extends import("effect/Schema").Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], import("effect/Schema").SchemaError, TSchema["DecodingServices"]>;
14
+ hasNext: boolean;
15
+ }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable | import("@shivaedev/http/errors.ts").RemoteStatusError, never>, never, never>;
16
+ readonly read: (path: string, byteLimit?: number | undefined) => Effect.Effect<{
17
+ decode: <TSchema extends import("effect/Schema").Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], import("effect/Schema").SchemaError, TSchema["DecodingServices"]>;
18
+ }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
19
+ readonly write: (method: "DELETE" | "PATCH" | "POST" | "PUT", path: string, body?: unknown, byteLimit?: number | undefined) => Effect.Effect<{
20
+ decode: <TSchema extends import("effect/Schema").Constraint>(schema: TSchema) => Effect.Effect<TSchema["Type"], import("effect/Schema").SchemaError, TSchema["DecodingServices"]>;
21
+ }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("effect/http/HttpBody").HttpBodyError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
22
+ readonly createCheckRun: (owner: string, repo: string, input: {
23
+ readonly detailsUrl?: string | undefined;
24
+ readonly headSha: string;
25
+ readonly name: string;
26
+ readonly output?: {
27
+ readonly summary: string;
28
+ readonly text?: string | undefined;
29
+ readonly title: string;
30
+ } | undefined;
31
+ readonly conclusion?: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out" | undefined;
32
+ readonly status: "in_progress" | "queued";
33
+ } | {
34
+ readonly detailsUrl?: string | undefined;
35
+ readonly headSha: string;
36
+ readonly name: string;
37
+ readonly output?: {
38
+ readonly summary: string;
39
+ readonly text?: string | undefined;
40
+ readonly title: string;
41
+ } | undefined;
42
+ readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out";
43
+ readonly status: "completed";
44
+ }) => Effect.Effect<{
45
+ readonly app?: {
46
+ readonly id: number;
47
+ } | null | undefined;
48
+ readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out" | null;
49
+ readonly detailsUrl: string | null;
50
+ readonly headSha: string;
51
+ readonly id: number;
52
+ readonly name: string;
53
+ readonly output: {
54
+ readonly summary: string | null;
55
+ readonly text: string | null;
56
+ readonly title: string | null;
57
+ };
58
+ readonly status: "completed" | "in_progress" | "pending" | "queued" | "requested" | "waiting";
59
+ }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("effect/http/HttpBody").HttpBodyError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("effect/Schema").SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
60
+ readonly findLatestCheckRun: (owner: string, repo: string, input: {
61
+ readonly appId?: number | undefined;
62
+ readonly headSha: string;
63
+ readonly name: string;
64
+ } | {
65
+ readonly appId: number;
66
+ readonly headSha: string;
67
+ readonly name?: string | undefined;
68
+ }) => Effect.Effect<import("effect/Option").Option<{
69
+ readonly app?: {
70
+ readonly id: number;
71
+ } | null | undefined;
72
+ readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out" | null;
73
+ readonly detailsUrl: string | null;
74
+ readonly headSha: string;
75
+ readonly id: number;
76
+ readonly name: string;
77
+ readonly output: {
78
+ readonly summary: string | null;
79
+ readonly text: string | null;
80
+ readonly title: string | null;
81
+ };
82
+ readonly status: "completed" | "in_progress" | "pending" | "queued" | "requested" | "waiting";
83
+ }>, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("effect/Schema").SchemaError | import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
84
+ readonly updateCheckRun: (owner: string, repo: string, id: number, input: {
85
+ readonly detailsUrl?: string | undefined;
86
+ readonly output?: {
87
+ readonly summary: string;
88
+ readonly text?: string | undefined;
89
+ readonly title: string;
90
+ } | undefined;
91
+ readonly status: "in_progress" | "queued";
92
+ } | {
93
+ readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out";
94
+ readonly detailsUrl?: string | undefined;
95
+ readonly output?: {
96
+ readonly summary: string;
97
+ readonly text?: string | undefined;
98
+ readonly title: string;
99
+ } | undefined;
100
+ readonly status: "completed";
101
+ }) => Effect.Effect<{
102
+ readonly app?: {
103
+ readonly id: number;
104
+ } | null | undefined;
105
+ readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out" | null;
106
+ readonly detailsUrl: string | null;
107
+ readonly headSha: string;
108
+ readonly id: number;
109
+ readonly name: string;
110
+ readonly output: {
111
+ readonly summary: string | null;
112
+ readonly text: string | null;
113
+ readonly title: string | null;
114
+ };
115
+ readonly status: "completed" | "in_progress" | "pending" | "queued" | "requested" | "waiting";
116
+ }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("effect/http/HttpBody").HttpBodyError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("effect/Schema").SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
117
+ readonly upsertCheckRun: (owner: string, repo: string, input: {
118
+ readonly detailsUrl?: string | undefined;
119
+ readonly headSha: string;
120
+ readonly name: string;
121
+ readonly output?: {
122
+ readonly summary: string;
123
+ readonly text?: string | undefined;
124
+ readonly title: string;
125
+ } | undefined;
126
+ readonly conclusion?: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out" | undefined;
127
+ readonly status: "in_progress" | "queued";
128
+ } | {
129
+ readonly detailsUrl?: string | undefined;
130
+ readonly headSha: string;
131
+ readonly name: string;
132
+ readonly output?: {
133
+ readonly summary: string;
134
+ readonly text?: string | undefined;
135
+ readonly title: string;
136
+ } | undefined;
137
+ readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out";
138
+ readonly status: "completed";
139
+ }, appId?: number | undefined) => Effect.Effect<{
140
+ readonly app?: {
141
+ readonly id: number;
142
+ } | null | undefined;
143
+ readonly conclusion: "action_required" | "cancelled" | "failure" | "neutral" | "skipped" | "stale" | "success" | "timed_out" | null;
144
+ readonly detailsUrl: string | null;
145
+ readonly headSha: string;
146
+ readonly id: number;
147
+ readonly name: string;
148
+ readonly output: {
149
+ readonly summary: string | null;
150
+ readonly text: string | null;
151
+ readonly title: string | null;
152
+ };
153
+ readonly status: "completed" | "in_progress" | "pending" | "queued" | "requested" | "waiting";
154
+ }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("effect/http/HttpBody").HttpBodyError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("effect/Schema").SchemaError | import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
155
+ readonly compareCommits: (owner: string, repo: string, base: string, head: string, byteLimit?: number | undefined) => Effect.Effect<{
156
+ readonly aheadBy: number;
157
+ readonly behindBy: number;
158
+ readonly commits: readonly {
159
+ readonly author: {
160
+ readonly avatarUrl: string;
161
+ readonly htmlUrl: string;
162
+ readonly id: number;
163
+ readonly login: string;
164
+ readonly type: string;
165
+ } | null;
166
+ readonly commit: {
167
+ readonly author: {
168
+ readonly date: string;
169
+ readonly email: string;
170
+ readonly name: string;
171
+ } | null;
172
+ readonly committer: {
173
+ readonly date: string;
174
+ readonly email: string;
175
+ readonly name: string;
176
+ } | null;
177
+ readonly message: string;
178
+ readonly tree: {
179
+ readonly sha: string;
180
+ readonly url: string;
181
+ };
182
+ };
183
+ readonly committer: {
184
+ readonly avatarUrl: string;
185
+ readonly htmlUrl: string;
186
+ readonly id: number;
187
+ readonly login: string;
188
+ readonly type: string;
189
+ } | null;
190
+ readonly htmlUrl: string;
191
+ readonly parents: readonly {
192
+ readonly sha: string;
193
+ readonly url: string;
194
+ }[];
195
+ readonly sha: string;
196
+ }[];
197
+ readonly files?: readonly {
198
+ readonly additions: number;
199
+ readonly changes: number;
200
+ readonly deletions: number;
201
+ readonly filename: string;
202
+ readonly patch?: string | undefined;
203
+ readonly previousFilename?: string | undefined;
204
+ readonly sha: string;
205
+ readonly status: string;
206
+ }[] | undefined;
207
+ readonly status: "ahead" | "behind" | "diverged" | "identical";
208
+ readonly totalCommits: number;
209
+ }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("effect/Schema").SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
210
+ readonly getCollaboratorPermission: (owner: string, repo: string, username: string, byteLimit?: number | undefined) => Effect.Effect<{
211
+ readonly permission: string;
212
+ readonly roleName: string;
213
+ readonly user: {
214
+ readonly avatarUrl: string;
215
+ readonly htmlUrl: string;
216
+ readonly id: number;
217
+ readonly login: string;
218
+ readonly type: string;
219
+ };
220
+ }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("effect/Schema").SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
221
+ readonly getCommit: (owner: string, repo: string, ref: string, byteLimit?: number | undefined) => Effect.Effect<{
222
+ readonly author: {
223
+ readonly avatarUrl: string;
224
+ readonly htmlUrl: string;
225
+ readonly id: number;
226
+ readonly login: string;
227
+ readonly type: string;
228
+ } | null;
229
+ readonly commit: {
230
+ readonly author: {
231
+ readonly date: string;
232
+ readonly email: string;
233
+ readonly name: string;
234
+ } | null;
235
+ readonly committer: {
236
+ readonly date: string;
237
+ readonly email: string;
238
+ readonly name: string;
239
+ } | null;
240
+ readonly message: string;
241
+ readonly tree: {
242
+ readonly sha: string;
243
+ readonly url: string;
244
+ };
245
+ };
246
+ readonly committer: {
247
+ readonly avatarUrl: string;
248
+ readonly htmlUrl: string;
249
+ readonly id: number;
250
+ readonly login: string;
251
+ readonly type: string;
252
+ } | null;
253
+ readonly htmlUrl: string;
254
+ readonly parents: readonly {
255
+ readonly sha: string;
256
+ readonly url: string;
257
+ }[];
258
+ readonly sha: string;
259
+ readonly files?: readonly {
260
+ readonly additions: number;
261
+ readonly changes: number;
262
+ readonly deletions: number;
263
+ readonly filename: string;
264
+ readonly patch?: string | undefined;
265
+ readonly previousFilename?: string | undefined;
266
+ readonly sha: string;
267
+ readonly status: string;
268
+ }[] | undefined;
269
+ readonly stats: {
270
+ readonly additions: number;
271
+ readonly deletions: number;
272
+ readonly total: number;
273
+ };
274
+ }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("effect/Schema").SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
275
+ readonly getIssue: (owner: string, repo: string, number: number, byteLimit?: number | undefined) => Effect.Effect<{
276
+ readonly body: string | null;
277
+ readonly closedAt: string | null;
278
+ readonly createdAt: string;
279
+ readonly htmlUrl: string;
280
+ readonly id: number;
281
+ readonly labels: readonly (string | {
282
+ readonly name?: string | undefined;
283
+ })[];
284
+ readonly number: number;
285
+ readonly pullRequest?: {
286
+ readonly url: string;
287
+ } | undefined;
288
+ readonly state: "closed" | "open";
289
+ readonly title: string;
290
+ readonly updatedAt: string;
291
+ readonly user: {
292
+ readonly avatarUrl: string;
293
+ readonly htmlUrl: string;
294
+ readonly id: number;
295
+ readonly login: string;
296
+ readonly type: string;
297
+ } | null;
298
+ }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("effect/Schema").SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
299
+ readonly getTree: (owner: string, repo: string, sha: string, options?: {
300
+ readonly recursive?: boolean;
301
+ readonly responseByteLimit?: number | undefined;
302
+ } | undefined) => Effect.Effect<{
303
+ readonly sha: string;
304
+ readonly tree: readonly {
305
+ readonly mode: string;
306
+ readonly path: string;
307
+ readonly sha: string;
308
+ readonly size?: number | undefined;
309
+ readonly type: "blob" | "commit" | "tree";
310
+ readonly url?: string | undefined;
311
+ }[];
312
+ readonly truncated: boolean;
313
+ readonly url: string;
314
+ }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("effect/Schema").SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
315
+ readonly getUser: (username?: string | undefined, byteLimit?: number | undefined) => Effect.Effect<{
316
+ readonly avatarUrl: string;
317
+ readonly htmlUrl: string;
318
+ readonly id: number;
319
+ readonly login: string;
320
+ readonly type: string;
321
+ }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("effect/Schema").SchemaError | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
322
+ readonly listCommits: (owner: string, repo: string, options?: import("./repositoryReads.ts").RepositoryListOptions | undefined) => Effect.Effect<import("effect/Stream").Stream<{
323
+ hasNext: boolean;
324
+ items: {
325
+ readonly author: {
326
+ readonly avatarUrl: string;
327
+ readonly htmlUrl: string;
328
+ readonly id: number;
329
+ readonly login: string;
330
+ readonly type: string;
331
+ } | null;
332
+ readonly commit: {
333
+ readonly author: {
334
+ readonly date: string;
335
+ readonly email: string;
336
+ readonly name: string;
337
+ } | null;
338
+ readonly committer: {
339
+ readonly date: string;
340
+ readonly email: string;
341
+ readonly name: string;
342
+ } | null;
343
+ readonly message: string;
344
+ readonly tree: {
345
+ readonly sha: string;
346
+ readonly url: string;
347
+ };
348
+ };
349
+ readonly committer: {
350
+ readonly avatarUrl: string;
351
+ readonly htmlUrl: string;
352
+ readonly id: number;
353
+ readonly login: string;
354
+ readonly type: string;
355
+ } | null;
356
+ readonly htmlUrl: string;
357
+ readonly parents: readonly {
358
+ readonly sha: string;
359
+ readonly url: string;
360
+ }[];
361
+ readonly sha: string;
362
+ }[];
363
+ skipped: number;
364
+ }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("effect/Schema").SchemaError | import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable | import("@shivaedev/http/errors.ts").RemoteStatusError, never>, never, never>;
365
+ readonly listIssues: (owner: string, repo: string, options?: import("./repositoryReads.ts").RepositoryListOptions | undefined) => Effect.Effect<import("effect/Stream").Stream<{
366
+ hasNext: boolean;
367
+ items: {
368
+ readonly body: string | null;
369
+ readonly closedAt: string | null;
370
+ readonly createdAt: string;
371
+ readonly htmlUrl: string;
372
+ readonly id: number;
373
+ readonly labels: readonly (string | {
374
+ readonly name?: string | undefined;
375
+ })[];
376
+ readonly number: number;
377
+ readonly pullRequest?: {
378
+ readonly url: string;
379
+ } | undefined;
380
+ readonly state: "closed" | "open";
381
+ readonly title: string;
382
+ readonly updatedAt: string;
383
+ readonly user: {
384
+ readonly avatarUrl: string;
385
+ readonly htmlUrl: string;
386
+ readonly id: number;
387
+ readonly login: string;
388
+ readonly type: string;
389
+ } | null;
390
+ }[];
391
+ skipped: number;
392
+ }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("effect/Schema").SchemaError | import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable | import("@shivaedev/http/errors.ts").RemoteStatusError, never>, never, never>;
393
+ readonly listPullRequestFiles: (owner: string, repo: string, number: number, options?: import("./repositoryReads.ts").RepositoryListOptions | undefined) => Effect.Effect<import("effect/Stream").Stream<{
394
+ hasNext: boolean;
395
+ items: {
396
+ readonly additions: number;
397
+ readonly changes: number;
398
+ readonly deletions: number;
399
+ readonly filename: string;
400
+ readonly patch?: string | undefined;
401
+ readonly previousFilename?: string | undefined;
402
+ readonly sha: string;
403
+ readonly status: string;
404
+ }[];
405
+ skipped: number;
406
+ }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("effect/Schema").SchemaError | import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable | import("@shivaedev/http/errors.ts").RemoteStatusError, never>, never, never>;
407
+ readonly upsertStickyComment: (input: {
408
+ readonly appId?: number | undefined;
409
+ readonly author?: string | undefined;
410
+ readonly body: string;
411
+ readonly marker: string;
412
+ readonly number: number;
413
+ readonly owner: string;
414
+ readonly repo: string;
415
+ }) => Effect.Effect<{
416
+ readonly body: string;
417
+ readonly id: number;
418
+ readonly performedViaGithubApp?: {
419
+ readonly id: number;
420
+ } | null | undefined;
421
+ readonly user: {
422
+ readonly login: string;
423
+ readonly type?: string | undefined;
424
+ } | null;
425
+ }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("effect/http/HttpBody").HttpBodyError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("effect/Schema").SchemaError | import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
426
+ readonly bytes: (path: string, accept: string, limit: number) => Effect.Effect<Uint8Array<ArrayBufferLike>, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
427
+ readonly observations: () => Effect.Effect<import("./rateLimits.ts").RateLimitObservation[], never, never>;
428
+ readonly resource: (path: string) => Effect.Effect<string, never, never>;
429
+ readonly text: (path: string, accept: string, limit: number) => Effect.Effect<string, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
430
+ }>, never, never>;
431
+ readonly viewerRepositories: (account: string | number) => Effect.Effect<{
432
+ administrable: ({
433
+ readonly htmlUrl: string;
434
+ readonly id: number;
435
+ readonly name: string;
436
+ readonly owner: {
437
+ readonly login: string;
438
+ };
439
+ readonly private: boolean;
440
+ } & {
441
+ readonly installationId: number;
442
+ })[];
443
+ readable: ({
444
+ readonly htmlUrl: string;
445
+ readonly id: number;
446
+ readonly name: string;
447
+ readonly owner: {
448
+ readonly login: string;
449
+ };
450
+ readonly private: boolean;
451
+ } & {
452
+ readonly installationId: number;
453
+ })[];
454
+ }, import("./errors.ts").GitHubAppError | import("./errors.ts").GitHubConversationLocked | import("./errors.ts").GitHubPermissionDenied | import("./errors.ts").GitHubRateLimited | import("./errors.ts").GitHubTransportError | import("@shivaedev/http/errors.ts").InvalidBodyLimit | import("effect/Cause").NoSuchElementError | import("@shivaedev/http/errors.ts").PaginationLinkError | import("@shivaedev/http/errors.ts").ResponseBodyTooLarge | import("effect/Schema").SchemaError | import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable | import("@shivaedev/http/errors.ts").RemoteStatusError, never>;
455
+ }>> & {
456
+ readonly layer: Layer.Layer<"@shivaedev/github/GitHubApp", never, HttpClient.HttpClient | {
457
+ readonly credentials: AppCredentials;
458
+ }>;
459
+ };
460
+ export declare function withInstallation<A, E, R>(installationId: number, effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, "@shivaedev/github/GitHubApp" | Exclude<R, "@shivaedev/github/GitHub">>;
461
+ //# sourceMappingURL=installationClients.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installationClients.d.ts","sourceRoot":"","sources":["../src/installationClients.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAMjD,eAAO,MAAM,oBAAoB;0BAA2C,cAAc;;;EAAuC,CAAC;AAElI,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAFsD,cAAc;;CAkCxF,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,+FAI/F"}
@@ -0,0 +1,37 @@
1
+ import { Cache, Context, Effect, Layer } from "effect";
2
+ import { HttpClient } from "effect/http";
3
+ import { defineService } from "@shivaedev/service/defineService.ts";
4
+ import { appTokens } from "#appTokens.ts";
5
+ import { GitHub } from "#GitHub.ts";
6
+ import { GitHubConfig } from "#GitHubConfig.ts";
7
+ import { viewerRepositoryAccess } from "#viewerRepositoryAccess.ts";
8
+ export const GitHubAppCredentials = Context.Service("@shivaedev/github/AppCredentials");
9
+ export const GitHubApp = defineService({
10
+ id: "@shivaedev/github/GitHubApp",
11
+ initialize: Effect.gen(function* () {
12
+ const { credentials: supplied } = yield* GitHubAppCredentials;
13
+ const credentials = { appId: supplied.appId, privateKey: supplied.privateKey };
14
+ const http = yield* HttpClient.HttpClient;
15
+ const config = yield* GitHubConfig;
16
+ const environment = Layer.mergeAll(Layer.succeed(HttpClient.HttpClient)(http), Layer.succeed(GitHubConfig)(config));
17
+ const app = yield* Layer.build(GitHub.layer.pipe(Layer.provide(appTokens(credentials)), Layer.provide(environment))).pipe(Effect.scoped, Effect.map((context) => Context.get(context, GitHub)));
18
+ const clients = yield* Cache.make({
19
+ capacity: 100,
20
+ lookup: (installationId) => Layer.build(GitHub.layer.pipe(Layer.provide(appTokens({ ...credentials, installationId })), Layer.provide(environment))).pipe(Effect.scoped, Effect.map((context) => Context.get(context, GitHub))),
21
+ timeToLive: "30 minutes",
22
+ });
23
+ function installation(id) {
24
+ return Cache.get(clients, id).pipe(Effect.tap((client) => Cache.set(clients, id, client)));
25
+ }
26
+ return { installation, viewers: yield* viewerRepositoryAccess(app, installation) };
27
+ }),
28
+ methods: ({ installation, viewers }) => ({
29
+ installation,
30
+ viewerRepositories: (account) => Cache.get(viewers, typeof account === "number" ? `id:${account}` : `login:${account.toLowerCase()}`),
31
+ }),
32
+ requires: [GitHubAppCredentials, HttpClient.HttpClient, GitHubConfig],
33
+ });
34
+ export function withInstallation(installationId, effect) {
35
+ return Effect.flatMap(GitHubApp, (app) => Effect.flatMap(app.installation(installationId), (client) => Effect.provideService(effect, GitHub, client)));
36
+ }
37
+ //# sourceMappingURL=installationClients.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installationClients.js","sourceRoot":"","sources":["../src/installationClients.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,E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,EAAE,YAAY,CAAC;CACrE,CAAC,CAAC;AAEH,MAAM,UAAU,gBAAgB,CAAU,cAAsB,EAAE,MAA8B;IAC/F,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CACxC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAC3G,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,eAAO,MAAM,UAAU,GAAgC,OAAO,SAAS,MAAM,CAAC,UAAU,4HAQtF,CAAC;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc;IACxC,MAAM,GAAG,OAAO,SAAS,MAAM,CAAC,UAAU,UAAU,OAAO;EACpE"}
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,eAAO,MAAM,UAAU,GAAgC,OAAO,SAAS,MAAM,CAAC,UAAU,4HAWtF,CAAC;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc;IACxC,MAAM,GAAG,OAAO,SAAS,MAAM,CAAC,UAAU,UAAU,OAAO;EACpE"}
package/dist/json.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import { Effect, Schema } from "effect";
2
+ import * as HttpStatus from "effect/http/HttpStatus";
2
3
  export const decodeJson = Effect.fnUntraced(function* (entry, schema) {
4
+ if (entry.response.status === HttpStatus.fromLiteral("NoContent")) {
5
+ return yield* Schema.decodeUnknownEffect(schema)(undefined);
6
+ }
3
7
  const cached = entry.decoded.get(schema);
4
8
  if (entry.decoded.has(schema) && Schema.is(schema)(cached)) {
5
9
  return cached;
package/dist/json.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"json.js","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGxC,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAqC,KAAqB,EAAE,MAAe;IAC/H,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACzC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5D,OAAO,MAAM,CAAC;IACf,CAAC;IACD,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACtH,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACjC,OAAO,KAAK,CAAC;AACd,CAAC,CAAC,CAAC;AAEH,MAAM,UAAU,YAAY,CAAC,KAAqB;IACjD,OAAO,EAAE,MAAM,EAAE,CAAoC,MAAe,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;AACtG,CAAC"}
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAAA,OAAO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