@knpkv/codecommit-core 0.3.0 → 0.4.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 +66 -0
- package/dist/AwsClient/createPullRequest.d.ts +1 -6
- package/dist/AwsClient/createPullRequest.d.ts.map +1 -1
- package/dist/AwsClient/createPullRequest.js +3 -11
- package/dist/AwsClient/createPullRequest.js.map +1 -1
- package/dist/AwsClient/getCallerIdentity.d.ts +5 -6
- package/dist/AwsClient/getCallerIdentity.d.ts.map +1 -1
- package/dist/AwsClient/getCallerIdentity.js +7 -12
- package/dist/AwsClient/getCallerIdentity.js.map +1 -1
- package/dist/AwsClient/getCommentsForPullRequest.d.ts +1 -6
- package/dist/AwsClient/getCommentsForPullRequest.d.ts.map +1 -1
- package/dist/AwsClient/getCommentsForPullRequest.js +9 -16
- package/dist/AwsClient/getCommentsForPullRequest.js.map +1 -1
- package/dist/AwsClient/getPullRequest.d.ts +2 -7
- package/dist/AwsClient/getPullRequest.d.ts.map +1 -1
- package/dist/AwsClient/getPullRequest.js +13 -26
- package/dist/AwsClient/getPullRequest.js.map +1 -1
- package/dist/AwsClient/getPullRequests.d.ts.map +1 -1
- package/dist/AwsClient/getPullRequests.js +16 -13
- package/dist/AwsClient/getPullRequests.js.map +1 -1
- package/dist/AwsClient/index.d.ts +3 -2
- package/dist/AwsClient/index.d.ts.map +1 -1
- package/dist/AwsClient/index.js.map +1 -1
- package/dist/AwsClient/internal.d.ts +47 -11
- package/dist/AwsClient/internal.d.ts.map +1 -1
- package/dist/AwsClient/internal.js +38 -9
- package/dist/AwsClient/internal.js.map +1 -1
- package/dist/AwsClient/listBranches.d.ts +1 -6
- package/dist/AwsClient/listBranches.d.ts.map +1 -1
- package/dist/AwsClient/listBranches.js +3 -11
- package/dist/AwsClient/listBranches.js.map +1 -1
- package/dist/AwsClient/updatePullRequestDescription.d.ts +1 -6
- package/dist/AwsClient/updatePullRequestDescription.d.ts.map +1 -1
- package/dist/AwsClient/updatePullRequestDescription.js +3 -11
- package/dist/AwsClient/updatePullRequestDescription.js.map +1 -1
- package/dist/AwsClient/updatePullRequestTitle.d.ts +1 -6
- package/dist/AwsClient/updatePullRequestTitle.d.ts.map +1 -1
- package/dist/AwsClient/updatePullRequestTitle.js +3 -11
- package/dist/AwsClient/updatePullRequestTitle.js.map +1 -1
- package/dist/CacheService/CacheError.d.ts +21 -0
- package/dist/CacheService/CacheError.d.ts.map +1 -0
- package/dist/CacheService/CacheError.js +17 -0
- package/dist/CacheService/CacheError.js.map +1 -0
- package/dist/CacheService/Database.d.ts +13 -0
- package/dist/CacheService/Database.d.ts.map +1 -0
- package/dist/CacheService/Database.js +34 -0
- package/dist/CacheService/Database.js.map +1 -0
- package/dist/CacheService/EventsHub.d.ts +163 -0
- package/dist/CacheService/EventsHub.d.ts.map +1 -0
- package/dist/CacheService/EventsHub.js +22 -0
- package/dist/CacheService/EventsHub.js.map +1 -0
- package/dist/CacheService/diff.d.ts +28 -0
- package/dist/CacheService/diff.d.ts.map +1 -0
- package/dist/CacheService/diff.js +102 -0
- package/dist/CacheService/diff.js.map +1 -0
- package/dist/CacheService/index.d.ts +17 -0
- package/dist/CacheService/index.d.ts.map +1 -0
- package/dist/CacheService/index.js +15 -0
- package/dist/CacheService/index.js.map +1 -0
- package/dist/CacheService/migrations/0001_initial.d.ts +5 -0
- package/dist/CacheService/migrations/0001_initial.d.ts.map +1 -0
- package/dist/CacheService/migrations/0001_initial.js +72 -0
- package/dist/CacheService/migrations/0001_initial.js.map +1 -0
- package/dist/CacheService/migrations/0002_indexes.d.ts +5 -0
- package/dist/CacheService/migrations/0002_indexes.d.ts.map +1 -0
- package/dist/CacheService/migrations/0002_indexes.js +7 -0
- package/dist/CacheService/migrations/0002_indexes.js.map +1 -0
- package/dist/CacheService/migrations/0003_add_health_score.d.ts +5 -0
- package/dist/CacheService/migrations/0003_add_health_score.d.ts.map +1 -0
- package/dist/CacheService/migrations/0003_add_health_score.js +4 -0
- package/dist/CacheService/migrations/0003_add_health_score.js.map +1 -0
- package/dist/CacheService/migrations/0004_unify_notifications.d.ts +5 -0
- package/dist/CacheService/migrations/0004_unify_notifications.d.ts.map +1 -0
- package/dist/CacheService/migrations/0004_unify_notifications.js +7 -0
- package/dist/CacheService/migrations/0004_unify_notifications.js.map +1 -0
- package/dist/CacheService/repos/CommentRepo.d.ts +16 -0
- package/dist/CacheService/repos/CommentRepo.d.ts.map +1 -0
- package/dist/CacheService/repos/CommentRepo.js +42 -0
- package/dist/CacheService/repos/CommentRepo.js.map +1 -0
- package/dist/CacheService/repos/NotificationRepo.d.ts +48 -0
- package/dist/CacheService/repos/NotificationRepo.d.ts.map +1 -0
- package/dist/CacheService/repos/NotificationRepo.js +128 -0
- package/dist/CacheService/repos/NotificationRepo.js.map +1 -0
- package/dist/CacheService/repos/PullRequestRepo.d.ts +112 -0
- package/dist/CacheService/repos/PullRequestRepo.d.ts.map +1 -0
- package/dist/CacheService/repos/PullRequestRepo.js +146 -0
- package/dist/CacheService/repos/PullRequestRepo.js.map +1 -0
- package/dist/CacheService/repos/SubscriptionRepo.d.ts +20 -0
- package/dist/CacheService/repos/SubscriptionRepo.d.ts.map +1 -0
- package/dist/CacheService/repos/SubscriptionRepo.js +49 -0
- package/dist/CacheService/repos/SubscriptionRepo.js.map +1 -0
- package/dist/CacheService/repos/SyncMetadataRepo.d.ts +14 -0
- package/dist/CacheService/repos/SyncMetadataRepo.d.ts.map +1 -0
- package/dist/CacheService/repos/SyncMetadataRepo.js +36 -0
- package/dist/CacheService/repos/SyncMetadataRepo.js.map +1 -0
- package/dist/ConfigService/backup.d.ts +1 -1
- package/dist/ConfigService/detectProfiles.d.ts +1 -1
- package/dist/ConfigService/index.d.ts +2 -1
- package/dist/ConfigService/index.d.ts.map +1 -1
- package/dist/ConfigService/index.js +3 -1
- package/dist/ConfigService/index.js.map +1 -1
- package/dist/ConfigService/internal.d.ts +6 -0
- package/dist/ConfigService/internal.d.ts.map +1 -1
- package/dist/ConfigService/internal.js +3 -1
- package/dist/ConfigService/internal.js.map +1 -1
- package/dist/ConfigService/load.d.ts +3 -1
- package/dist/ConfigService/load.d.ts.map +1 -1
- package/dist/ConfigService/load.js +4 -2
- package/dist/ConfigService/load.js.map +1 -1
- package/dist/ConfigService/reset.d.ts.map +1 -1
- package/dist/ConfigService/reset.js +3 -1
- package/dist/ConfigService/reset.js.map +1 -1
- package/dist/ConfigService/save.d.ts +1 -1
- package/dist/ConfigService/validate.d.ts +1 -1
- package/dist/DateUtils.d.ts +1 -1
- package/dist/DateUtils.d.ts.map +1 -1
- package/dist/DateUtils.js +2 -2
- package/dist/DateUtils.js.map +1 -1
- package/dist/Domain.d.ts +179 -10
- package/dist/Domain.d.ts.map +1 -1
- package/dist/Domain.js +23 -5
- package/dist/Domain.js.map +1 -1
- package/dist/HealthScore.d.ts.map +1 -1
- package/dist/HealthScore.js +1 -3
- package/dist/HealthScore.js.map +1 -1
- package/dist/PRService/index.d.ts +46 -18
- package/dist/PRService/index.d.ts.map +1 -1
- package/dist/PRService/index.js +58 -27
- package/dist/PRService/index.js.map +1 -1
- package/dist/PRService/internal.d.ts +86 -1
- package/dist/PRService/internal.d.ts.map +1 -1
- package/dist/PRService/internal.js +106 -1
- package/dist/PRService/internal.js.map +1 -1
- package/dist/PRService/refresh.d.ts +10 -4
- package/dist/PRService/refresh.d.ts.map +1 -1
- package/dist/PRService/refresh.js +30 -89
- package/dist/PRService/refresh.js.map +1 -1
- package/dist/PRService/refreshEnrich.d.ts +15 -0
- package/dist/PRService/refreshEnrich.d.ts.map +1 -0
- package/dist/PRService/refreshEnrich.js +72 -0
- package/dist/PRService/refreshEnrich.js.map +1 -0
- package/dist/PRService/refreshFetch.d.ts +20 -0
- package/dist/PRService/refreshFetch.d.ts.map +1 -0
- package/dist/PRService/refreshFetch.js +78 -0
- package/dist/PRService/refreshFetch.js.map +1 -0
- package/dist/PRService/refreshResolve.d.ts +29 -0
- package/dist/PRService/refreshResolve.d.ts.map +1 -0
- package/dist/PRService/refreshResolve.js +84 -0
- package/dist/PRService/refreshResolve.js.map +1 -0
- package/dist/PRService/refreshScore.d.ts +9 -0
- package/dist/PRService/refreshScore.d.ts.map +1 -0
- package/dist/PRService/refreshScore.js +24 -0
- package/dist/PRService/refreshScore.js.map +1 -0
- package/dist/PRService/refreshSinglePR.d.ts +13 -0
- package/dist/PRService/refreshSinglePR.d.ts.map +1 -0
- package/dist/PRService/refreshSinglePR.js +102 -0
- package/dist/PRService/refreshSinglePR.js.map +1 -0
- package/dist/PRService/setAllAccounts.d.ts +1 -3
- package/dist/PRService/setAllAccounts.d.ts.map +1 -1
- package/dist/PRService/setAllAccounts.js +2 -2
- package/dist/PRService/setAllAccounts.js.map +1 -1
- package/dist/PRService/toggleAccount.d.ts +1 -3
- package/dist/PRService/toggleAccount.d.ts.map +1 -1
- package/dist/PRService/toggleAccount.js +2 -2
- package/dist/PRService/toggleAccount.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
- package/dist/NotificationsService.d.ts +0 -46
- package/dist/NotificationsService.d.ts.map +0 -1
- package/dist/NotificationsService.js +0 -57
- package/dist/NotificationsService.js.map +0 -1
package/dist/HealthScore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HealthScore.js","sourceRoot":"","sources":["../src/HealthScore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AA0BtC,MAAM,UAAU,GAAG,UAAU,CAAA;AAE7B,MAAM,MAAM,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAA;AAE7D,MAAM,KAAK,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,KAAa,EAAU,EAAE,CAAC,IAAI,CAAC,GA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EjG,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAmB,EAAE,CAC7D,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CACrB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,OAAgB,CAAC,EACjD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,QAAiB,CAAC,EAClD,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,KAAc,CAAC,CACnC,CAAA"}
|
|
@@ -4,25 +4,53 @@
|
|
|
4
4
|
* @category Service
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
import { Effect, Layer, Option, SubscriptionRef } from "effect";
|
|
8
|
+
import { AwsClient } from "../AwsClient/index.js";
|
|
9
|
+
import { EventsHub } from "../CacheService/EventsHub.js";
|
|
10
|
+
import { CommentRepo } from "../CacheService/repos/CommentRepo.js";
|
|
11
|
+
import { NotificationRepo } from "../CacheService/repos/NotificationRepo.js";
|
|
12
|
+
import type { PaginatedNotifications } from "../CacheService/repos/NotificationRepo.js";
|
|
13
|
+
import type { SearchResult } from "../CacheService/repos/PullRequestRepo.js";
|
|
14
|
+
import { PullRequestRepo } from "../CacheService/repos/PullRequestRepo.js";
|
|
15
|
+
import { SubscriptionRepo } from "../CacheService/repos/SubscriptionRepo.js";
|
|
16
|
+
import { SyncMetadataRepo } from "../CacheService/repos/SyncMetadataRepo.js";
|
|
17
|
+
import { ConfigService } from "../ConfigService/index.js";
|
|
18
|
+
import type { AppState, AwsProfileName, PRCommentLocation, PullRequestId } from "../Domain.js";
|
|
19
|
+
export type { SearchResult } from "../CacheService/repos/PullRequestRepo.js";
|
|
20
|
+
export { CachedPRToPullRequest, decodeCachedPR, PullRequestToUpsertInput } from "./internal.js";
|
|
21
|
+
declare const PRService_base: Effect.Service.Class<PRService, "@knpkv/codecommit-core/PRService", {
|
|
22
|
+
readonly effect: Effect.Effect<{
|
|
23
|
+
state: SubscriptionRef.SubscriptionRef<AppState>;
|
|
24
|
+
refresh: Effect.Effect<void, never, never>;
|
|
25
|
+
toggleAccount: (profile: AwsProfileName) => Effect.Effect<void, never, never>;
|
|
26
|
+
setAllAccounts: (enabled: boolean, profiles?: Array<AwsProfileName>) => Effect.Effect<void, never, never>;
|
|
27
|
+
searchPullRequests: (query: string, opts?: {
|
|
28
|
+
readonly limit?: number;
|
|
29
|
+
readonly offset?: number;
|
|
30
|
+
}) => Effect.Effect<SearchResult, never, never>;
|
|
31
|
+
subscribe: (awsAccountId: string, prId: PullRequestId) => Effect.Effect<void, never, never>;
|
|
32
|
+
unsubscribe: (awsAccountId: string, prId: PullRequestId) => Effect.Effect<void, never, never>;
|
|
33
|
+
getSubscriptions: () => Effect.Effect<readonly {
|
|
34
|
+
readonly awsAccountId: string;
|
|
35
|
+
readonly pullRequestId: string;
|
|
36
|
+
}[] | readonly {
|
|
37
|
+
awsAccountId: string;
|
|
38
|
+
pullRequestId: string;
|
|
39
|
+
}[], never, never>;
|
|
40
|
+
isSubscribed: (awsAccountId: string, prId: PullRequestId) => Effect.Effect<boolean, never, never>;
|
|
41
|
+
getPersistentNotifications: (opts?: {
|
|
42
|
+
readonly unreadOnly?: boolean;
|
|
43
|
+
readonly limit?: number;
|
|
44
|
+
readonly cursor?: number;
|
|
45
|
+
}) => Effect.Effect<PaginatedNotifications, never, never>;
|
|
46
|
+
markNotificationRead: (id: number) => Effect.Effect<void, never, never>;
|
|
47
|
+
markAllNotificationsRead: () => Effect.Effect<void, never, never>;
|
|
48
|
+
getUnreadNotificationCount: () => Effect.Effect<number, never, never>;
|
|
49
|
+
getCachedComments: (awsAccountId: string, prId: PullRequestId) => Effect.Effect<Option.Option<readonly PRCommentLocation[]>, never, never>;
|
|
50
|
+
refreshSinglePR: (awsAccountId: string, prId: PullRequestId) => Effect.Effect<void, never, never>;
|
|
51
|
+
}, never, AwsClient | EventsHub | CommentRepo | NotificationRepo | PullRequestRepo | SubscriptionRepo | SyncMetadataRepo | ConfigService>;
|
|
23
52
|
}>;
|
|
24
53
|
export declare class PRService extends PRService_base {
|
|
25
54
|
}
|
|
26
|
-
export declare const PRServiceLive: Layer.Layer<PRService, never,
|
|
27
|
-
export {};
|
|
55
|
+
export declare const PRServiceLive: Layer.Layer<PRService, never, AwsClient | EventsHub | CommentRepo | NotificationRepo | PullRequestRepo | SubscriptionRepo | SyncMetadataRepo | ConfigService>;
|
|
28
56
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PRService/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PRService/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAA;AAC5E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAA;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAA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from "effect";
|
|
8
|
+
import { AwsClient } from "../AwsClient/index.js";
|
|
9
|
+
import { EventsHub } from "../CacheService/EventsHub.js";
|
|
10
|
+
import { CommentRepo } from "../CacheService/repos/CommentRepo.js";
|
|
11
|
+
import { NotificationRepo } from "../CacheService/repos/NotificationRepo.js";
|
|
12
|
+
import { PullRequestRepo } from "../CacheService/repos/PullRequestRepo.js";
|
|
13
|
+
import { SubscriptionRepo } from "../CacheService/repos/SubscriptionRepo.js";
|
|
14
|
+
import { SyncMetadataRepo } from "../CacheService/repos/SyncMetadataRepo.js";
|
|
15
|
+
import { ConfigService } from "../ConfigService/index.js";
|
|
16
|
+
import { decodeCachedPR } from "./internal.js";
|
|
9
17
|
import { makeRefresh } from "./refresh.js";
|
|
18
|
+
import { makeRefreshSinglePR } from "./refreshSinglePR.js";
|
|
10
19
|
import { makeSetAllAccounts } from "./setAllAccounts.js";
|
|
11
20
|
import { makeToggleAccount } from "./toggleAccount.js";
|
|
21
|
+
export { CachedPRToPullRequest, decodeCachedPR, PullRequestToUpsertInput } from "./internal.js";
|
|
12
22
|
// ---------------------------------------------------------------------------
|
|
13
23
|
// Service Definition
|
|
14
24
|
// ---------------------------------------------------------------------------
|
|
15
|
-
export class PRService extends
|
|
25
|
+
export class PRService extends Effect.Service()("@knpkv/codecommit-core/PRService", {
|
|
26
|
+
effect: Effect.gen(function* () {
|
|
27
|
+
const configService = yield* ConfigService;
|
|
28
|
+
const awsClient = yield* AwsClient;
|
|
29
|
+
const prRepo = yield* PullRequestRepo;
|
|
30
|
+
const commentRepo = yield* CommentRepo;
|
|
31
|
+
const notificationRepo = yield* NotificationRepo;
|
|
32
|
+
const subscriptionRepo = yield* SubscriptionRepo;
|
|
33
|
+
const syncMetadataRepo = yield* SyncMetadataRepo;
|
|
34
|
+
const eventsHub = yield* EventsHub;
|
|
35
|
+
const depsLayer = Layer.mergeAll(Layer.succeed(ConfigService, configService), Layer.succeed(AwsClient, awsClient), Layer.succeed(PullRequestRepo, prRepo), Layer.succeed(CommentRepo, commentRepo), Layer.succeed(NotificationRepo, notificationRepo), Layer.succeed(SubscriptionRepo, subscriptionRepo), Layer.succeed(SyncMetadataRepo, syncMetadataRepo), Layer.succeed(EventsHub, eventsHub));
|
|
36
|
+
const provide = (effect) => Effect.provide(effect, depsLayer);
|
|
37
|
+
// Load cached PRs to show immediately
|
|
38
|
+
const cachedPRs = yield* prRepo.findAll().pipe(Effect.catchAll(() => Effect.succeed([])));
|
|
39
|
+
const state = yield* SubscriptionRef.make({
|
|
40
|
+
pullRequests: cachedPRs.map(decodeCachedPR),
|
|
41
|
+
accounts: [],
|
|
42
|
+
status: "idle"
|
|
43
|
+
});
|
|
44
|
+
const refreshSem = yield* Effect.makeSemaphore(1);
|
|
45
|
+
const refresh = refreshSem.withPermits(1)(provide(makeRefresh(state)));
|
|
46
|
+
const toggleAccount = makeToggleAccount(refresh);
|
|
47
|
+
const setAllAccounts = makeSetAllAccounts(refresh);
|
|
48
|
+
const refreshSinglePR = makeRefreshSinglePR(state);
|
|
49
|
+
return {
|
|
50
|
+
state,
|
|
51
|
+
refresh,
|
|
52
|
+
toggleAccount: (profile) => provide(toggleAccount(profile)),
|
|
53
|
+
setAllAccounts: (enabled, profiles) => provide(setAllAccounts(enabled, profiles)),
|
|
54
|
+
// Cache delegates – absorb CacheError at the PRService boundary
|
|
55
|
+
searchPullRequests: (query, opts) => prRepo.search(query, opts).pipe(Effect.tapError((e) => Effect.logWarning("PRService.searchPullRequests", e)), Effect.catchAll(() => Effect.succeed({ items: [], total: 0, hasMore: false }))),
|
|
56
|
+
subscribe: (awsAccountId, prId) => subscriptionRepo.subscribe(awsAccountId, prId).pipe(Effect.catchAll(() => Effect.void)),
|
|
57
|
+
unsubscribe: (awsAccountId, prId) => subscriptionRepo.unsubscribe(awsAccountId, prId).pipe(Effect.catchAll(() => Effect.void)),
|
|
58
|
+
getSubscriptions: () => subscriptionRepo.findAll().pipe(Effect.catchAll(() => Effect.succeed([]))),
|
|
59
|
+
isSubscribed: (awsAccountId, prId) => subscriptionRepo.isSubscribed(awsAccountId, prId).pipe(Effect.catchAll(() => Effect.succeed(false))),
|
|
60
|
+
getPersistentNotifications: (opts) => notificationRepo.findAll(opts).pipe(Effect.catchAll(() => Effect.succeed({ items: [] }))),
|
|
61
|
+
markNotificationRead: (id) => notificationRepo.markRead(id).pipe(Effect.catchAll(() => Effect.void)),
|
|
62
|
+
markAllNotificationsRead: () => notificationRepo.markAllRead().pipe(Effect.catchAll(() => Effect.void)),
|
|
63
|
+
getUnreadNotificationCount: () => notificationRepo.unreadCount().pipe(Effect.catchAll(() => Effect.succeed(0))),
|
|
64
|
+
getCachedComments: (awsAccountId, prId) => commentRepo.find(awsAccountId, prId).pipe(Effect.catchAll(() => Effect.succeed(Option.none()))),
|
|
65
|
+
refreshSinglePR: (awsAccountId, prId) => provide(refreshSinglePR(awsAccountId, prId))
|
|
66
|
+
};
|
|
67
|
+
})
|
|
68
|
+
}) {
|
|
16
69
|
}
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
// ---------------------------------------------------------------------------
|
|
20
|
-
export const PRServiceLive = Layer.effect(PRService, Effect.gen(function* () {
|
|
21
|
-
const notificationsService = yield* NotificationsService;
|
|
22
|
-
const ctx = yield* Effect.context();
|
|
23
|
-
const state = yield* SubscriptionRef.make({
|
|
24
|
-
pullRequests: [],
|
|
25
|
-
accounts: [],
|
|
26
|
-
status: "idle"
|
|
27
|
-
});
|
|
28
|
-
const provide = (effect) => Effect.provide(effect, ctx);
|
|
29
|
-
const refresh = provide(makeRefresh(state));
|
|
30
|
-
const toggleAccount = makeToggleAccount(state, refresh);
|
|
31
|
-
const setAllAccounts = makeSetAllAccounts(state, refresh);
|
|
32
|
-
return {
|
|
33
|
-
state,
|
|
34
|
-
refresh,
|
|
35
|
-
toggleAccount: (p) => provide(toggleAccount(p)),
|
|
36
|
-
setAllAccounts: (e, ps) => provide(setAllAccounts(e, ps)),
|
|
37
|
-
clearNotifications: notificationsService.clear,
|
|
38
|
-
addNotification: notificationsService.add
|
|
39
|
-
};
|
|
40
|
-
}));
|
|
70
|
+
// Module-level alias for namespace consumers (barrel uses `export * as PRService`)
|
|
71
|
+
export const PRServiceLive = PRService.Default;
|
|
41
72
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/PRService/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/PRService/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAA;AAG5E,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAA;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAA;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAA;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEzD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAoB,MAAM,cAAc,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAGtD,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAA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AC,CAAC,CAC7E;YACH,oBAAoB,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC5G,wBAAwB,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACvG,0BAA0B,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/G,iBAAiB,EAAE,CAAC,YAAoB,EAAE,IAAmB,EAAE,EAAE,CAC/D,WAAW,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,IAAI,CACvC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAoC,CAAC,CAAC,CACvF;YACH,eAAe,EAAE,CAAC,YAAoB,EAAE,IAAmB,EAAE,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;SAC7G,CAAA;IACH,CAAC,CAAC;CACH,CAAC;CAAG;AAEL,mFAAmF;AACnF,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC,OAAO,CAAA"}
|
|
@@ -1,7 +1,92 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @internal
|
|
3
3
|
*/
|
|
4
|
+
import { Schema } from "effect";
|
|
4
5
|
import type { SubscriptionRef } from "effect";
|
|
5
|
-
import
|
|
6
|
+
import { UpsertInput } from "../CacheService/repos/PullRequestRepo.js";
|
|
7
|
+
import { type AppState, type PRCommentLocation, PullRequest } from "../Domain.js";
|
|
6
8
|
export type PRState = SubscriptionRef.SubscriptionRef<AppState>;
|
|
9
|
+
export declare const CachedPRToPullRequest: Schema.transform<Schema.SchemaClass<{
|
|
10
|
+
readonly link: string;
|
|
11
|
+
readonly awsAccountId: string;
|
|
12
|
+
readonly id: string & import("effect/Brand").Brand<"PullRequestId">;
|
|
13
|
+
readonly title: string;
|
|
14
|
+
readonly author: string;
|
|
15
|
+
readonly repositoryName: string & import("effect/Brand").Brand<"RepositoryName">;
|
|
16
|
+
readonly creationDate: Date;
|
|
17
|
+
readonly lastModifiedDate: Date;
|
|
18
|
+
readonly status: "OPEN" | "CLOSED" | "MERGED";
|
|
19
|
+
readonly sourceBranch: string;
|
|
20
|
+
readonly destinationBranch: string;
|
|
21
|
+
readonly isMergeable: boolean;
|
|
22
|
+
readonly isApproved: boolean;
|
|
23
|
+
readonly description: string | null;
|
|
24
|
+
readonly commentCount: number | null;
|
|
25
|
+
readonly healthScore: number | null;
|
|
26
|
+
readonly fetchedAt: string;
|
|
27
|
+
readonly accountProfile: string & import("effect/Brand").Brand<"AwsProfileName">;
|
|
28
|
+
readonly accountRegion: string & import("effect/Brand").Brand<"AwsRegion">;
|
|
29
|
+
}, {
|
|
30
|
+
readonly link: string;
|
|
31
|
+
readonly awsAccountId: string;
|
|
32
|
+
readonly id: string & import("effect/Brand").Brand<"PullRequestId">;
|
|
33
|
+
readonly title: string;
|
|
34
|
+
readonly author: string;
|
|
35
|
+
readonly repositoryName: string & import("effect/Brand").Brand<"RepositoryName">;
|
|
36
|
+
readonly creationDate: Date;
|
|
37
|
+
readonly lastModifiedDate: Date;
|
|
38
|
+
readonly status: "OPEN" | "CLOSED" | "MERGED";
|
|
39
|
+
readonly sourceBranch: string;
|
|
40
|
+
readonly destinationBranch: string;
|
|
41
|
+
readonly isMergeable: boolean;
|
|
42
|
+
readonly isApproved: boolean;
|
|
43
|
+
readonly description: string | null;
|
|
44
|
+
readonly commentCount: number | null;
|
|
45
|
+
readonly healthScore: number | null;
|
|
46
|
+
readonly fetchedAt: string;
|
|
47
|
+
readonly accountProfile: string & import("effect/Brand").Brand<"AwsProfileName">;
|
|
48
|
+
readonly accountRegion: string & import("effect/Brand").Brand<"AwsRegion">;
|
|
49
|
+
}, never>, typeof PullRequest>;
|
|
50
|
+
export declare const decodeCachedPR: (i: {
|
|
51
|
+
readonly link: string;
|
|
52
|
+
readonly awsAccountId: string;
|
|
53
|
+
readonly id: string & import("effect/Brand").Brand<"PullRequestId">;
|
|
54
|
+
readonly title: string;
|
|
55
|
+
readonly author: string;
|
|
56
|
+
readonly repositoryName: string & import("effect/Brand").Brand<"RepositoryName">;
|
|
57
|
+
readonly creationDate: Date;
|
|
58
|
+
readonly lastModifiedDate: Date;
|
|
59
|
+
readonly status: "OPEN" | "CLOSED" | "MERGED";
|
|
60
|
+
readonly sourceBranch: string;
|
|
61
|
+
readonly destinationBranch: string;
|
|
62
|
+
readonly isMergeable: boolean;
|
|
63
|
+
readonly isApproved: boolean;
|
|
64
|
+
readonly description: string | null;
|
|
65
|
+
readonly commentCount: number | null;
|
|
66
|
+
readonly healthScore: number | null;
|
|
67
|
+
readonly fetchedAt: string;
|
|
68
|
+
readonly accountProfile: string & import("effect/Brand").Brand<"AwsProfileName">;
|
|
69
|
+
readonly accountRegion: string & import("effect/Brand").Brand<"AwsRegion">;
|
|
70
|
+
}, overrideOptions?: import("effect/SchemaAST").ParseOptions) => PullRequest;
|
|
71
|
+
export declare const PullRequestToUpsertInput: Schema.transform<Schema.Struct<{
|
|
72
|
+
id: typeof Schema.String;
|
|
73
|
+
awsAccountId: typeof Schema.String;
|
|
74
|
+
accountProfile: typeof Schema.String;
|
|
75
|
+
accountRegion: typeof Schema.String;
|
|
76
|
+
title: typeof Schema.String;
|
|
77
|
+
description: Schema.NullOr<typeof Schema.String>;
|
|
78
|
+
author: typeof Schema.String;
|
|
79
|
+
repositoryName: typeof Schema.String;
|
|
80
|
+
creationDate: typeof Schema.String;
|
|
81
|
+
lastModifiedDate: typeof Schema.String;
|
|
82
|
+
status: typeof Schema.String;
|
|
83
|
+
sourceBranch: typeof Schema.String;
|
|
84
|
+
destinationBranch: typeof Schema.String;
|
|
85
|
+
isMergeable: typeof Schema.Number;
|
|
86
|
+
isApproved: typeof Schema.Number;
|
|
87
|
+
commentCount: Schema.NullOr<typeof Schema.Number>;
|
|
88
|
+
link: typeof Schema.String;
|
|
89
|
+
}>, typeof PullRequest>;
|
|
90
|
+
export declare const prToUpsertInput: (pr: PullRequest, awsAccountId: string) => UpsertInput;
|
|
91
|
+
export declare const countAllComments: (locations: ReadonlyArray<PRCommentLocation>) => number;
|
|
7
92
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/PRService/internal.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/PRService/internal.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAqB,WAAW,EAAE,MAAM,0CAA0C,CAAA;AACzF,OAAO,EAAE,KAAK,QAAQ,EAAsB,KAAK,iBAAiB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAErG,MAAM,MAAM,OAAO,GAAG,eAAe,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAA;AAE/D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAkDjC,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;4EAA2C,CAAA;AAEtE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;uBAgDpC,CAAA;AAID,eAAO,MAAM,eAAe,GAAI,IAAI,WAAW,EAAE,cAAc,MAAM,KAAG,WAGtE,CAAA;AAKF,eAAO,MAAM,gBAAgB,GAAI,WAAW,aAAa,CAAC,iBAAiB,CAAC,KAAG,MAI5E,CAAA"}
|
|
@@ -1,2 +1,107 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
import { Schema } from "effect";
|
|
5
|
+
import { CachedPullRequest, UpsertInput } from "../CacheService/repos/PullRequestRepo.js";
|
|
6
|
+
import { PullRequest } from "../Domain.js";
|
|
7
|
+
export const CachedPRToPullRequest = Schema.transform(Schema.typeSchema(CachedPullRequest), PullRequest, {
|
|
8
|
+
strict: true,
|
|
9
|
+
decode: (row) => ({
|
|
10
|
+
id: row.id,
|
|
11
|
+
title: row.title,
|
|
12
|
+
description: row.description ?? undefined,
|
|
13
|
+
author: row.author,
|
|
14
|
+
repositoryName: row.repositoryName,
|
|
15
|
+
creationDate: row.creationDate,
|
|
16
|
+
lastModifiedDate: row.lastModifiedDate,
|
|
17
|
+
link: row.link,
|
|
18
|
+
account: {
|
|
19
|
+
profile: row.accountProfile,
|
|
20
|
+
region: row.accountRegion,
|
|
21
|
+
awsAccountId: row.awsAccountId
|
|
22
|
+
},
|
|
23
|
+
status: row.status,
|
|
24
|
+
sourceBranch: row.sourceBranch,
|
|
25
|
+
destinationBranch: row.destinationBranch,
|
|
26
|
+
isMergeable: row.isMergeable,
|
|
27
|
+
isApproved: row.isApproved,
|
|
28
|
+
commentCount: row.commentCount ?? undefined,
|
|
29
|
+
healthScore: row.healthScore ?? undefined,
|
|
30
|
+
fetchedAt: row.fetchedAt ? new Date(row.fetchedAt) : undefined
|
|
31
|
+
}),
|
|
32
|
+
encode: (_encoded, pr) => ({
|
|
33
|
+
id: pr.id,
|
|
34
|
+
awsAccountId: pr.account.awsAccountId ?? "",
|
|
35
|
+
accountProfile: pr.account.profile,
|
|
36
|
+
accountRegion: pr.account.region,
|
|
37
|
+
title: pr.title,
|
|
38
|
+
description: pr.description ?? null,
|
|
39
|
+
author: pr.author,
|
|
40
|
+
repositoryName: pr.repositoryName,
|
|
41
|
+
creationDate: pr.creationDate,
|
|
42
|
+
lastModifiedDate: pr.lastModifiedDate,
|
|
43
|
+
status: pr.status,
|
|
44
|
+
sourceBranch: pr.sourceBranch,
|
|
45
|
+
destinationBranch: pr.destinationBranch,
|
|
46
|
+
isMergeable: pr.isMergeable,
|
|
47
|
+
isApproved: pr.isApproved,
|
|
48
|
+
commentCount: pr.commentCount ?? null,
|
|
49
|
+
healthScore: pr.healthScore ?? null,
|
|
50
|
+
link: pr.link,
|
|
51
|
+
fetchedAt: pr.fetchedAt?.toISOString() ?? ""
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
export const decodeCachedPR = Schema.decodeSync(CachedPRToPullRequest);
|
|
55
|
+
export const PullRequestToUpsertInput = Schema.transform(UpsertInput, PullRequest, {
|
|
56
|
+
strict: false,
|
|
57
|
+
decode: (row) => ({
|
|
58
|
+
id: row.id,
|
|
59
|
+
title: row.title,
|
|
60
|
+
description: row.description ?? undefined,
|
|
61
|
+
author: row.author,
|
|
62
|
+
repositoryName: row.repositoryName,
|
|
63
|
+
creationDate: new Date(row.creationDate),
|
|
64
|
+
lastModifiedDate: new Date(row.lastModifiedDate),
|
|
65
|
+
link: row.link,
|
|
66
|
+
account: {
|
|
67
|
+
profile: row.accountProfile,
|
|
68
|
+
region: row.accountRegion,
|
|
69
|
+
awsAccountId: row.awsAccountId
|
|
70
|
+
},
|
|
71
|
+
status: row.status,
|
|
72
|
+
sourceBranch: row.sourceBranch,
|
|
73
|
+
destinationBranch: row.destinationBranch,
|
|
74
|
+
isMergeable: row.isMergeable === 1,
|
|
75
|
+
isApproved: row.isApproved === 1,
|
|
76
|
+
commentCount: row.commentCount ?? undefined,
|
|
77
|
+
healthScore: undefined,
|
|
78
|
+
fetchedAt: undefined
|
|
79
|
+
}),
|
|
80
|
+
encode: (_encoded, pr) => ({
|
|
81
|
+
id: pr.id,
|
|
82
|
+
awsAccountId: pr.account.awsAccountId ?? "",
|
|
83
|
+
accountProfile: pr.account.profile,
|
|
84
|
+
accountRegion: pr.account.region,
|
|
85
|
+
title: pr.title,
|
|
86
|
+
description: pr.description ?? null,
|
|
87
|
+
author: pr.author,
|
|
88
|
+
repositoryName: pr.repositoryName,
|
|
89
|
+
creationDate: pr.creationDate.toISOString(),
|
|
90
|
+
lastModifiedDate: pr.lastModifiedDate.toISOString(),
|
|
91
|
+
status: pr.status,
|
|
92
|
+
sourceBranch: pr.sourceBranch,
|
|
93
|
+
destinationBranch: pr.destinationBranch,
|
|
94
|
+
isMergeable: pr.isMergeable ? 1 : 0,
|
|
95
|
+
isApproved: pr.isApproved ? 1 : 0,
|
|
96
|
+
commentCount: pr.commentCount ?? null,
|
|
97
|
+
link: pr.link
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
const encodePRToUpsert = Schema.encodeSync(PullRequestToUpsertInput);
|
|
101
|
+
export const prToUpsertInput = (pr, awsAccountId) => ({
|
|
102
|
+
...encodePRToUpsert(pr),
|
|
103
|
+
awsAccountId
|
|
104
|
+
});
|
|
105
|
+
const countThreadComments = (thread) => 1 + thread.replies.reduce((sum, r) => sum + countThreadComments(r), 0);
|
|
106
|
+
export const countAllComments = (locations) => locations.reduce((sum, loc) => sum + loc.comments.reduce((s, t) => s + countThreadComments(t), 0), 0);
|
|
2
107
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/PRService/internal.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/PRService/internal.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,EAAE,iBAAiB,EA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sClient } from "../AwsClient/index.js";
|
|
6
|
+
import { EventsHub } from "../CacheService/EventsHub.js";
|
|
7
|
+
import type { CommentRepo } from "../CacheService/repos/CommentRepo.js";
|
|
8
|
+
import type { NotificationRepo } from "../CacheService/repos/NotificationRepo.js";
|
|
9
|
+
import type { PullRequestRepo } from "../CacheService/repos/PullRequestRepo.js";
|
|
10
|
+
import type { SubscriptionRepo } from "../CacheService/repos/SubscriptionRepo.js";
|
|
11
|
+
import { SyncMetadataRepo } from "../CacheService/repos/SyncMetadataRepo.js";
|
|
12
|
+
import type { ConfigService } from "../ConfigService/index.js";
|
|
8
13
|
import type { PRState } from "./internal.js";
|
|
9
|
-
export
|
|
14
|
+
export type RefreshDeps = ConfigService | AwsClient | PullRequestRepo | CommentRepo | NotificationRepo | SubscriptionRepo | SyncMetadataRepo | EventsHub;
|
|
15
|
+
export declare const makeRefresh: (state: PRState) => Effect.Effect<void, never, AwsClient | EventsHub | CommentRepo | NotificationRepo | PullRequestRepo | SubscriptionRepo | SyncMetadataRepo | ConfigService>;
|
|
10
16
|
//# sourceMappingURL=refresh.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../src/PRService/refresh.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAA0B,MAAM,
|
|
1
|
+
{"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../src/PRService/refresh.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAA0B,MAAM,EAAmB,MAAM,QAAQ,CAAA;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAA;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAA;AAC/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAA;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAA;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAM5C,MAAM,MAAM,WAAW,GACnB,aAAa,GACb,SAAS,GACT,eAAe,GACf,WAAW,GACX,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,SAAS,CAAA;AAEb,eAAO,MAAM,WAAW,gLAmDvB,CAAA"}
|
|
@@ -1,101 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @internal
|
|
3
3
|
*/
|
|
4
|
-
import { Cause, Clock, DateTime, Effect,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export const makeRefresh =
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
...s,
|
|
17
|
-
pullRequests: [],
|
|
18
|
-
status: "loading",
|
|
19
|
-
error: undefined
|
|
20
|
-
}));
|
|
21
|
-
yield* notificationsService.clear;
|
|
22
|
-
const config = yield* configService.load.pipe(Effect.catchAll((e) => Effect.fail(new Error(`Config load failed: ${e.message}`))));
|
|
23
|
-
const detected = yield* configService.detectProfiles.pipe(Effect.catchAll(() => Effect.succeed([])));
|
|
24
|
-
const accountsState = detected.map((d) => {
|
|
25
|
-
const configured = config.accounts.find((a) => a.profile === d.name);
|
|
26
|
-
return {
|
|
27
|
-
profile: d.name,
|
|
28
|
-
region: configured?.regions?.[0] ?? d.region ?? "",
|
|
29
|
-
enabled: configured?.enabled ?? false
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
yield* SubscriptionRef.update(state, (s) => ({ ...s, accounts: accountsState }));
|
|
33
|
-
const enabledAccounts = config.accounts.filter((a) => a.enabled);
|
|
34
|
-
if (enabledAccounts.length === 0) {
|
|
35
|
-
const now = yield* Clock.currentTimeMillis;
|
|
36
|
-
yield* SubscriptionRef.update(state, (s) => ({ ...s, status: "idle", lastUpdated: DateTime.toDate(DateTime.unsafeMake(now)) }));
|
|
4
|
+
import { Cause, Clock, DateTime, Effect, SubscriptionRef } from "effect";
|
|
5
|
+
import { EventsHub } from "../CacheService/EventsHub.js";
|
|
6
|
+
import { SyncMetadataRepo } from "../CacheService/repos/SyncMetadataRepo.js";
|
|
7
|
+
import { enrichComments } from "./refreshEnrich.js";
|
|
8
|
+
import { fetchAndUpsertPRs } from "./refreshFetch.js";
|
|
9
|
+
import { resolveAccounts } from "./refreshResolve.js";
|
|
10
|
+
import { calculateHealthScores } from "./refreshScore.js";
|
|
11
|
+
export const makeRefresh = Effect.fn("PRService.refresh")(function* (state) {
|
|
12
|
+
const hub = yield* EventsHub;
|
|
13
|
+
const syncMetadataRepo = yield* SyncMetadataRepo;
|
|
14
|
+
const resolved = yield* resolveAccounts(state);
|
|
15
|
+
if (!resolved)
|
|
37
16
|
return;
|
|
38
|
-
}
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
yield*
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
statusDetail: accountLabels.join(", ")
|
|
46
|
-
}));
|
|
47
|
-
const streams = enabledAccounts.flatMap((account) => (account.regions ?? []).map((region) => {
|
|
48
|
-
const label = `${account.profile} (${region})`;
|
|
49
|
-
return awsClient.getPullRequests({ profile: account.profile, region }).pipe(Stream.map((pr) => ({ pr, label })), Stream.catchAllCause((cause) => {
|
|
50
|
-
const errorStr = Cause.pretty(cause).split("\n")[0] ?? "Unknown error";
|
|
51
|
-
return Stream.fromEffect(notificationsService.add({
|
|
52
|
-
type: "error",
|
|
53
|
-
title: label,
|
|
54
|
-
message: errorStr,
|
|
55
|
-
profile: account.profile
|
|
56
|
-
})).pipe(Stream.flatMap(() => Stream.empty));
|
|
57
|
-
}));
|
|
17
|
+
const { accountIdMap, currentUser, enabledAccounts, subscribedRef } = resolved;
|
|
18
|
+
const staleNow = yield* Clock.currentTimeMillis;
|
|
19
|
+
const staleThreshold = DateTime.toDate(DateTime.unsafeMake(staleNow)).toISOString().slice(0, 19) + "Z";
|
|
20
|
+
yield* hub.batch(Effect.gen(function* () {
|
|
21
|
+
yield* fetchAndUpsertPRs({ state, enabledAccounts, accountIdMap, subscribedRef, currentUser, staleThreshold });
|
|
22
|
+
yield* enrichComments({ state, subscribedRef });
|
|
23
|
+
yield* calculateHealthScores(state);
|
|
58
24
|
}));
|
|
59
|
-
|
|
60
|
-
const prs = s.pullRequests;
|
|
61
|
-
const insertIdx = prs.findIndex((p) => p.creationDate.getTime() < pr.creationDate.getTime());
|
|
62
|
-
const newPrs = insertIdx === -1 ? [...prs, pr] : [...prs.slice(0, insertIdx), pr, ...prs.slice(insertIdx)];
|
|
63
|
-
return {
|
|
64
|
-
...s,
|
|
65
|
-
pullRequests: newPrs,
|
|
66
|
-
statusDetail: `${label} #${pr.id} ${pr.repositoryName}`
|
|
67
|
-
};
|
|
68
|
-
})));
|
|
25
|
+
// Set idle
|
|
69
26
|
const now = yield* Clock.currentTimeMillis;
|
|
70
|
-
yield* SubscriptionRef.update(state, (s) => ({
|
|
27
|
+
yield* SubscriptionRef.update(state, ({ statusDetail: _, ...s }) => ({
|
|
71
28
|
...s,
|
|
72
29
|
status: "idle",
|
|
73
|
-
statusDetail: undefined,
|
|
74
30
|
lastUpdated: DateTime.toDate(DateTime.unsafeMake(now))
|
|
75
31
|
}));
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
if (r !== undefined)
|
|
85
|
-
counts.set(`${r.accountId}:${r.id}`, r.commentCount);
|
|
86
|
-
}
|
|
87
|
-
if (counts.size > 0) {
|
|
88
|
-
yield* SubscriptionRef.update(state, (s) => ({
|
|
89
|
-
...s,
|
|
90
|
-
pullRequests: s.pullRequests.map((p) => {
|
|
91
|
-
const key = `${p.account.id}:${p.id}`;
|
|
92
|
-
const cc = counts.get(key);
|
|
93
|
-
return cc !== undefined ? new PullRequest({ ...p, commentCount: cc }) : p;
|
|
94
|
-
})
|
|
95
|
-
}));
|
|
96
|
-
}
|
|
97
|
-
}).pipe(Effect.withSpan("PRService.refresh"), Effect.timeout("120 seconds"), Effect.catchAllCause((cause) => {
|
|
98
|
-
const errorStr = Cause.pretty(cause).split("\n")[0] ?? "Unknown error";
|
|
32
|
+
// Sync metadata
|
|
33
|
+
yield* Effect.forEach(enabledAccounts, (account) => {
|
|
34
|
+
const awsAccountId = accountIdMap.get(account.profile) ?? account.profile;
|
|
35
|
+
return Effect.forEach(account.regions ?? [], (region) => syncMetadataRepo.update(awsAccountId, region), { discard: true });
|
|
36
|
+
}, { discard: true }).pipe(Effect.catchAll(() => Effect.void));
|
|
37
|
+
}, (effect, state) => effect.pipe(Effect.timeout("120 seconds"), Effect.catchAllCause((cause) => {
|
|
38
|
+
const squashed = Cause.squash(cause);
|
|
39
|
+
const errorStr = (squashed instanceof Error ? squashed.message : String(squashed)) || "Unknown error";
|
|
99
40
|
return SubscriptionRef.update(state, (s) => ({ ...s, status: "error", error: errorStr }));
|
|
100
|
-
}));
|
|
41
|
+
})));
|
|
101
42
|
//# sourceMappingURL=refresh.js.map
|