@knpkv/codecommit-core 0.14.0 → 0.15.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/dist/CacheService/Database.d.ts +1 -1
- package/dist/CacheService/Database.d.ts.map +1 -1
- package/dist/CacheService/Database.js +10 -2
- package/dist/CacheService/Database.js.map +1 -1
- package/dist/CacheService/diff.d.ts +5 -2
- package/dist/CacheService/diff.d.ts.map +1 -1
- package/dist/CacheService/diff.js +31 -13
- package/dist/CacheService/diff.js.map +1 -1
- package/dist/CacheService/migrations/0017_sandbox_region.d.ts +5 -0
- package/dist/CacheService/migrations/0017_sandbox_region.d.ts.map +1 -0
- package/dist/CacheService/migrations/0017_sandbox_region.js +4 -0
- package/dist/CacheService/migrations/0017_sandbox_region.js.map +1 -0
- package/dist/CacheService/migrations/0018_pull_request_coordinates.d.ts +6 -0
- package/dist/CacheService/migrations/0018_pull_request_coordinates.d.ts.map +1 -0
- package/dist/CacheService/migrations/0018_pull_request_coordinates.js +82 -0
- package/dist/CacheService/migrations/0018_pull_request_coordinates.js.map +1 -0
- package/dist/CacheService/migrations/0019_dependent_pr_coordinates.d.ts +6 -0
- package/dist/CacheService/migrations/0019_dependent_pr_coordinates.d.ts.map +1 -0
- package/dist/CacheService/migrations/0019_dependent_pr_coordinates.js +57 -0
- package/dist/CacheService/migrations/0019_dependent_pr_coordinates.js.map +1 -0
- package/dist/CacheService/migrations/0020_notification_coordinates.d.ts +6 -0
- package/dist/CacheService/migrations/0020_notification_coordinates.d.ts.map +1 -0
- package/dist/CacheService/migrations/0020_notification_coordinates.js +22 -0
- package/dist/CacheService/migrations/0020_notification_coordinates.js.map +1 -0
- package/dist/CacheService/repos/CommentRepo.d.ts +6 -2
- package/dist/CacheService/repos/CommentRepo.d.ts.map +1 -1
- package/dist/CacheService/repos/CommentRepo.js +46 -7
- package/dist/CacheService/repos/CommentRepo.js.map +1 -1
- package/dist/CacheService/repos/NotificationRepo.d.ts +2 -0
- package/dist/CacheService/repos/NotificationRepo.d.ts.map +1 -1
- package/dist/CacheService/repos/NotificationRepo.js +10 -3
- package/dist/CacheService/repos/NotificationRepo.js.map +1 -1
- package/dist/CacheService/repos/PullRequestRepo/index.d.ts +42 -7
- package/dist/CacheService/repos/PullRequestRepo/index.d.ts.map +1 -1
- package/dist/CacheService/repos/PullRequestRepo/index.js +2 -0
- package/dist/CacheService/repos/PullRequestRepo/index.js.map +1 -1
- package/dist/CacheService/repos/PullRequestRepo/mutations.d.ts +9 -5
- package/dist/CacheService/repos/PullRequestRepo/mutations.d.ts.map +1 -1
- package/dist/CacheService/repos/PullRequestRepo/mutations.js +61 -17
- package/dist/CacheService/repos/PullRequestRepo/mutations.js.map +1 -1
- package/dist/CacheService/repos/PullRequestRepo/queries.d.ts +48 -4
- package/dist/CacheService/repos/PullRequestRepo/queries.d.ts.map +1 -1
- package/dist/CacheService/repos/PullRequestRepo/queries.js +40 -5
- package/dist/CacheService/repos/PullRequestRepo/queries.js.map +1 -1
- package/dist/CacheService/repos/SandboxRepo.d.ts +45 -1
- package/dist/CacheService/repos/SandboxRepo.d.ts.map +1 -1
- package/dist/CacheService/repos/SandboxRepo.js +53 -8
- package/dist/CacheService/repos/SandboxRepo.js.map +1 -1
- package/dist/CacheService/repos/StatsRepo/index.d.ts +3 -0
- package/dist/CacheService/repos/StatsRepo/index.d.ts.map +1 -1
- package/dist/CacheService/repos/StatsRepo/internal.d.ts +6 -0
- package/dist/CacheService/repos/StatsRepo/internal.d.ts.map +1 -1
- package/dist/CacheService/repos/StatsRepo/internal.js +5 -5
- package/dist/CacheService/repos/StatsRepo/internal.js.map +1 -1
- package/dist/CacheService/repos/StatsRepo/queries.d.ts +1 -0
- package/dist/CacheService/repos/StatsRepo/queries.d.ts.map +1 -1
- package/dist/CacheService/repos/StatsRepo/queries.js +5 -4
- package/dist/CacheService/repos/StatsRepo/queries.js.map +1 -1
- package/dist/CacheService/repos/StatsRepo/reviewerData.d.ts +2 -0
- package/dist/CacheService/repos/StatsRepo/reviewerData.d.ts.map +1 -1
- package/dist/CacheService/repos/StatsRepo/reviewerData.js +38 -15
- package/dist/CacheService/repos/StatsRepo/reviewerData.js.map +1 -1
- package/dist/CacheService/repos/SubscriptionRepo.d.ts +11 -5
- package/dist/CacheService/repos/SubscriptionRepo.d.ts.map +1 -1
- package/dist/CacheService/repos/SubscriptionRepo.js +106 -12
- package/dist/CacheService/repos/SubscriptionRepo.js.map +1 -1
- package/dist/ChildEnv.d.ts.map +1 -1
- package/dist/ChildEnv.js +1 -0
- package/dist/ChildEnv.js.map +1 -1
- package/dist/Domain.d.ts +1 -0
- package/dist/Domain.d.ts.map +1 -1
- package/dist/Domain.js +1 -0
- package/dist/Domain.js.map +1 -1
- package/dist/PRService/index.d.ts +15 -8
- package/dist/PRService/index.d.ts.map +1 -1
- package/dist/PRService/index.js +5 -5
- package/dist/PRService/index.js.map +1 -1
- package/dist/PRService/refreshDiffs.d.ts.map +1 -1
- package/dist/PRService/refreshDiffs.js +12 -3
- package/dist/PRService/refreshDiffs.js.map +1 -1
- package/dist/PRService/refreshEnrich.d.ts.map +1 -1
- package/dist/PRService/refreshEnrich.js +28 -11
- package/dist/PRService/refreshEnrich.js.map +1 -1
- package/dist/PRService/refreshFetch.d.ts.map +1 -1
- package/dist/PRService/refreshFetch.js +25 -13
- package/dist/PRService/refreshFetch.js.map +1 -1
- package/dist/PRService/refreshHistory.d.ts +1 -1
- package/dist/PRService/refreshHistory.d.ts.map +1 -1
- package/dist/PRService/refreshHistory.js +6 -4
- package/dist/PRService/refreshHistory.js.map +1 -1
- package/dist/PRService/refreshResolve.d.ts +4 -1
- package/dist/PRService/refreshResolve.d.ts.map +1 -1
- package/dist/PRService/refreshResolve.js +19 -6
- package/dist/PRService/refreshResolve.js.map +1 -1
- package/dist/PRService/refreshScore.d.ts.map +1 -1
- package/dist/PRService/refreshScore.js +4 -1
- package/dist/PRService/refreshScore.js.map +1 -1
- package/dist/PRService/refreshSinglePR.d.ts +9 -2
- package/dist/PRService/refreshSinglePR.d.ts.map +1 -1
- package/dist/PRService/refreshSinglePR.js +99 -33
- package/dist/PRService/refreshSinglePR.js.map +1 -1
- package/dist/SandboxService/DockerService.d.ts +2 -0
- package/dist/SandboxService/DockerService.d.ts.map +1 -1
- package/dist/SandboxService/DockerService.js +47 -16
- package/dist/SandboxService/DockerService.js.map +1 -1
- package/dist/SandboxService/SandboxService.d.ts +4 -0
- package/dist/SandboxService/SandboxService.d.ts.map +1 -1
- package/dist/SandboxService/SandboxService.js +112 -25
- package/dist/SandboxService/SandboxService.js.map +1 -1
- package/dist/StatsService/WeeklyStats.d.ts +7 -0
- package/dist/StatsService/WeeklyStats.d.ts.map +1 -1
- package/dist/StatsService/WeeklyStats.js +3 -0
- package/dist/StatsService/WeeklyStats.js.map +1 -1
- package/package.json +1 -1
|
@@ -12,6 +12,8 @@ const NotificationRow = Schema.Struct({
|
|
|
12
12
|
message: Schema.String,
|
|
13
13
|
title: Schema.String,
|
|
14
14
|
profile: Schema.String,
|
|
15
|
+
repositoryName: Schema.String,
|
|
16
|
+
accountRegion: Schema.String,
|
|
15
17
|
createdAt: Schema.String,
|
|
16
18
|
read: Schema.Number
|
|
17
19
|
});
|
|
@@ -77,8 +79,13 @@ const makeNotificationRepo = Effect.gen(function* () {
|
|
|
77
79
|
return sql `SELECT * FROM notifications WHERE id < ${req.cursor} ORDER BY id DESC LIMIT ${req.limit}`;
|
|
78
80
|
}
|
|
79
81
|
});
|
|
80
|
-
const add_ = (n) => Clock.currentTimeMillis.pipe(Effect.flatMap((nowMs) => sql `INSERT INTO notifications (
|
|
81
|
-
|
|
82
|
+
const add_ = (n) => Clock.currentTimeMillis.pipe(Effect.flatMap((nowMs) => sql `INSERT INTO notifications (
|
|
83
|
+
pull_request_id, aws_account_id, type, message, title, profile,
|
|
84
|
+
repository_name, account_region, created_at
|
|
85
|
+
) VALUES (
|
|
86
|
+
${n.pullRequestId}, ${n.awsAccountId}, ${n.type}, ${n.message}, ${n.title ?? ""}, ${n.profile ?? ""},
|
|
87
|
+
${n.repositoryName ?? ""}, ${n.accountRegion ?? ""}, ${new Date(nowMs).toISOString()}
|
|
88
|
+
)`), Effect.asVoid);
|
|
82
89
|
const markRead_ = (id) => sql `UPDATE notifications SET read = 1 WHERE id = ${id}`.pipe(Effect.asVoid);
|
|
83
90
|
const markUnread_ = (id) => sql `UPDATE notifications SET read = 0 WHERE id = ${id}`.pipe(Effect.asVoid);
|
|
84
91
|
const markAllRead_ = () => sql `UPDATE notifications SET read = 1 WHERE read = 0`.pipe(Effect.asVoid);
|
|
@@ -105,7 +112,7 @@ const makeNotificationRepo = Effect.gen(function* () {
|
|
|
105
112
|
title: n.title,
|
|
106
113
|
profile: n.profile ?? ""
|
|
107
114
|
}).pipe(Effect.tap(() => publish));
|
|
108
|
-
if (
|
|
115
|
+
if (n.deduplicate !== true) {
|
|
109
116
|
return insert.pipe(cacheError("addSystem"));
|
|
110
117
|
}
|
|
111
118
|
// Skip if an unread system notification with same profile+type already exists
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationRepo.js","sourceRoot":"","sources":["../../../src/CacheService/repos/NotificationRepo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEpF,OAAO,KAAK,SAAS,MAAM,+BAA+B,CAAA;AAC1D,OAAO,KAAK,SAAS,MAAM,+BAA+B,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEvD,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC;IACpC,EAAE,EAAE,MAAM,CAAC,MAAM;IACjB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AG,EAAE,CAChB,GAAG,CAAmB,4DAA4D,CAAC,IAAI,CACrF,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,EACzC,UAAU,CAAC,aAAa,CAAC,CAC1B;KACJ,CAAA;IACD,OAAO,OAAO,CAAA;AAChB,CAAC,CAAC,CAAA;AAIF,MAAM,OAAO,gBAAiB,SAAQ,OAAO,CAAC,OAAO,EAGlD,CAAC,kBAAkB,CAAC;IACrB,MAAM,CAAU,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAC,IAAI,CACjF,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,CAC/D,CAAA;CACF"}
|
|
@@ -11,18 +11,20 @@ import { Context, Effect, Layer } from "effect";
|
|
|
11
11
|
import type { Success } from "effect/Effect";
|
|
12
12
|
import * as SqlClient from "effect/unstable/sql/SqlClient";
|
|
13
13
|
import { EventsHub } from "../../EventsHub.js";
|
|
14
|
+
import * as Q from "./queries.js";
|
|
14
15
|
export { CachedPullRequest, type SearchResult, UpsertInput } from "./internal.js";
|
|
15
16
|
export type { CachedPullRequest as CachedPullRequestType } from "./internal.js";
|
|
17
|
+
export { PullRequestAmbiguityError } from "./queries.js";
|
|
16
18
|
declare const makePullRequestRepo: Effect.Effect<{
|
|
17
19
|
upsert: (input: import("./internal.js").UpsertInput) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
18
20
|
upsertMany: (prs: ReadonlyArray<import("./internal.js").UpsertInput>) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
19
21
|
deleteStale: (olderThan: string) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
20
22
|
deleteStaleOpen: (olderThan: string) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
21
|
-
deleteOne: (awsAccountId: string, id: string) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
22
|
-
updateDiffStats: (awsAccountId: string, id: string, filesAdded: number, filesModified: number, filesDeleted: number) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
23
|
-
updateStatusAndClosedAt: (awsAccountId: string, id: string, status: string, closedAt: string, mergedBy?: string, approvedBy?: ReadonlyArray<string
|
|
24
|
-
updateCommentCount: (awsAccountId: string, id: string, count: number | null) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
25
|
-
updateHealthScore: (awsAccountId: string, id: string, score: number) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
23
|
+
deleteOne: (awsAccountId: string, id: string, coordinates?: import("./mutations.js").PullRequestCoordinates) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
24
|
+
updateDiffStats: (awsAccountId: string, id: string, filesAdded: number, filesModified: number, filesDeleted: number, coordinates?: import("./mutations.js").PullRequestCoordinates) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
25
|
+
updateStatusAndClosedAt: (awsAccountId: string, id: string, status: string, closedAt: string, mergedBy?: string, approvedBy?: ReadonlyArray<string>, coordinates?: import("./mutations.js").PullRequestCoordinates) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
26
|
+
updateCommentCount: (awsAccountId: string, id: string, count: number | null, coordinates?: import("./mutations.js").PullRequestCoordinates) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
27
|
+
updateHealthScore: (awsAccountId: string, id: string, score: number, coordinates?: import("./mutations.js").PullRequestCoordinates) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
26
28
|
refreshCommentedBy: () => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
27
29
|
propagateRepoAccountId: () => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
28
30
|
findAll: () => Effect.Effect<{
|
|
@@ -87,7 +89,7 @@ declare const makePullRequestRepo: Effect.Effect<{
|
|
|
87
89
|
readonly commentedBy: readonly string[];
|
|
88
90
|
readonly approvalRules: readonly import("../../../Domain.ts").ApprovalRule[];
|
|
89
91
|
}[], import("../../CacheError.ts").CacheError, never>;
|
|
90
|
-
findByAccountAndId: (awsAccountId: string, id: string) => Effect.Effect<{
|
|
92
|
+
findByAccountAndId: (awsAccountId: string, id: string) => Effect.Effect<import("effect/Option").Option<{
|
|
91
93
|
readonly id: string & import("effect/Brand").Brand<"PullRequestId">;
|
|
92
94
|
readonly awsAccountId: string;
|
|
93
95
|
readonly repoAccountId: string | null;
|
|
@@ -117,7 +119,38 @@ declare const makePullRequestRepo: Effect.Effect<{
|
|
|
117
119
|
readonly approvedByArns: readonly string[];
|
|
118
120
|
readonly commentedBy: readonly string[];
|
|
119
121
|
readonly approvalRules: readonly import("../../../Domain.ts").ApprovalRule[];
|
|
120
|
-
}
|
|
122
|
+
}>, import("../../CacheError.ts").CacheError | Q.PullRequestAmbiguityError, never>;
|
|
123
|
+
findByCoordinates: (awsAccountId: string, id: string, repositoryName: string, accountRegion: string) => Effect.Effect<import("effect/Option").Option<{
|
|
124
|
+
readonly id: string & import("effect/Brand").Brand<"PullRequestId">;
|
|
125
|
+
readonly awsAccountId: string;
|
|
126
|
+
readonly repoAccountId: string | null;
|
|
127
|
+
readonly accountProfile: string;
|
|
128
|
+
readonly accountRegion: string;
|
|
129
|
+
readonly title: string;
|
|
130
|
+
readonly description: string | null;
|
|
131
|
+
readonly author: string;
|
|
132
|
+
readonly repositoryName: string & import("effect/Brand").Brand<"RepositoryName">;
|
|
133
|
+
readonly creationDate: Date;
|
|
134
|
+
readonly lastModifiedDate: Date;
|
|
135
|
+
readonly status: "CLOSED" | "MERGED" | "OPEN";
|
|
136
|
+
readonly sourceBranch: string;
|
|
137
|
+
readonly destinationBranch: string;
|
|
138
|
+
readonly isMergeable: boolean;
|
|
139
|
+
readonly isApproved: boolean;
|
|
140
|
+
readonly commentCount: number | null;
|
|
141
|
+
readonly healthScore: number | null;
|
|
142
|
+
readonly link: string;
|
|
143
|
+
readonly fetchedAt: string;
|
|
144
|
+
readonly filesAdded: number | null;
|
|
145
|
+
readonly filesModified: number | null;
|
|
146
|
+
readonly filesDeleted: number | null;
|
|
147
|
+
readonly closedAt: string | null;
|
|
148
|
+
readonly mergedBy: string | null;
|
|
149
|
+
readonly approvedBy: readonly string[];
|
|
150
|
+
readonly approvedByArns: readonly string[];
|
|
151
|
+
readonly commentedBy: readonly string[];
|
|
152
|
+
readonly approvalRules: readonly import("../../../Domain.ts").ApprovalRule[];
|
|
153
|
+
}>, import("../../CacheError.ts").CacheError, never>;
|
|
121
154
|
search: (query: string, opts?: {
|
|
122
155
|
readonly limit?: number;
|
|
123
156
|
readonly offset?: number;
|
|
@@ -125,12 +158,14 @@ declare const makePullRequestRepo: Effect.Effect<{
|
|
|
125
158
|
findStaleOpen: (olderThan: string) => Effect.Effect<{
|
|
126
159
|
readonly id: string;
|
|
127
160
|
readonly awsAccountId: string;
|
|
161
|
+
readonly repositoryName: string;
|
|
128
162
|
readonly accountProfile: string & import("effect/Brand").Brand<"AwsProfileName">;
|
|
129
163
|
readonly accountRegion: string & import("effect/Brand").Brand<"AwsRegion">;
|
|
130
164
|
}[], import("../../CacheError.ts").CacheError, never>;
|
|
131
165
|
findOpenInRange: (weekStart: string, weekEnd: string) => Effect.Effect<{
|
|
132
166
|
readonly id: string;
|
|
133
167
|
readonly awsAccountId: string;
|
|
168
|
+
readonly repositoryName: string;
|
|
134
169
|
readonly accountProfile: string & import("effect/Brand").Brand<"AwsProfileName">;
|
|
135
170
|
readonly accountRegion: string & import("effect/Brand").Brand<"AwsRegion">;
|
|
136
171
|
}[], import("../../CacheError.ts").CacheError, never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/CacheService/repos/PullRequestRepo/index.ts"],"names":[],"mappings":"AAAA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7 @@ import { EventsHub, RepoChange } from "../../EventsHub.js";
|
|
|
14
14
|
import { mutations } from "./mutations.js";
|
|
15
15
|
import * as Q from "./queries.js";
|
|
16
16
|
export { CachedPullRequest, UpsertInput } from "./internal.js";
|
|
17
|
+
export { PullRequestAmbiguityError } from "./queries.js";
|
|
17
18
|
const makePullRequestRepo = Effect.gen(function* () {
|
|
18
19
|
const sql = yield* SqlClient.SqlClient;
|
|
19
20
|
const hub = yield* EventsHub;
|
|
@@ -22,6 +23,7 @@ const makePullRequestRepo = Effect.gen(function* () {
|
|
|
22
23
|
findAll: Q.findAll(sql),
|
|
23
24
|
findMissingDiffStats: Q.findMissingDiffStats(sql),
|
|
24
25
|
findByAccountAndId: Q.findByAccountAndId(sql),
|
|
26
|
+
findByCoordinates: Q.findByCoordinates(sql),
|
|
25
27
|
search: Q.search(sql),
|
|
26
28
|
findStaleOpen: Q.findStaleOpen(sql),
|
|
27
29
|
findOpenInRange: Q.findOpenInRange(sql),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/CacheService/repos/PullRequestRepo/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAE/C,OAAO,KAAK,SAAS,MAAM,+BAA+B,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAEjC,OAAO,EAAE,iBAAiB,EAAqB,WAAW,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/CacheService/repos/PullRequestRepo/index.ts"],"names":[],"mappings":"AAAA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A;AAChB,CAAC,CAAC,CAAA;AAIF,MAAM,OAAO,eAAgB,SAAQ,OAAO,CAAC,OAAO,EAGjD,CAAC,iBAAiB,CAAC;IACpB,MAAM,CAAU,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC,IAAI,CAC/E,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,CAC/D,CAAA;CACF"}
|
|
@@ -18,16 +18,20 @@
|
|
|
18
18
|
import { Effect } from "effect";
|
|
19
19
|
import type * as SqlClient from "effect/unstable/sql/SqlClient";
|
|
20
20
|
import { UpsertInput } from "./internal.js";
|
|
21
|
+
export interface PullRequestCoordinates {
|
|
22
|
+
readonly repositoryName: string;
|
|
23
|
+
readonly accountRegion: string;
|
|
24
|
+
}
|
|
21
25
|
export declare const mutations: (sql: SqlClient.SqlClient, publish: Effect.Effect<void>) => {
|
|
22
26
|
upsert: (input: UpsertInput) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
23
27
|
upsertMany: (prs: ReadonlyArray<UpsertInput>) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
24
28
|
deleteStale: (olderThan: string) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
25
29
|
deleteStaleOpen: (olderThan: string) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
26
|
-
deleteOne: (awsAccountId: string, id: string) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
27
|
-
updateDiffStats: (awsAccountId: string, id: string, filesAdded: number, filesModified: number, filesDeleted: number) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
28
|
-
updateStatusAndClosedAt: (awsAccountId: string, id: string, status: string, closedAt: string, mergedBy?: string, approvedBy?: ReadonlyArray<string
|
|
29
|
-
updateCommentCount: (awsAccountId: string, id: string, count: number | null) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
30
|
-
updateHealthScore: (awsAccountId: string, id: string, score: number) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
30
|
+
deleteOne: (awsAccountId: string, id: string, coordinates?: PullRequestCoordinates) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
31
|
+
updateDiffStats: (awsAccountId: string, id: string, filesAdded: number, filesModified: number, filesDeleted: number, coordinates?: PullRequestCoordinates) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
32
|
+
updateStatusAndClosedAt: (awsAccountId: string, id: string, status: string, closedAt: string, mergedBy?: string, approvedBy?: ReadonlyArray<string>, coordinates?: PullRequestCoordinates) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
33
|
+
updateCommentCount: (awsAccountId: string, id: string, count: number | null, coordinates?: PullRequestCoordinates) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
34
|
+
updateHealthScore: (awsAccountId: string, id: string, score: number, coordinates?: PullRequestCoordinates) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
31
35
|
refreshCommentedBy: () => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
32
36
|
propagateRepoAccountId: () => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
33
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../../src/CacheService/repos/PullRequestRepo/mutations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAA;AACvC,OAAO,KAAK,KAAK,SAAS,MAAM,+BAA+B,CAAA;AAG/D,OAAO,EAA8B,WAAW,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../../src/CacheService/repos/PullRequestRepo/mutations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAA;AACvC,OAAO,KAAK,KAAK,SAAS,MAAM,+BAA+B,CAAA;AAG/D,OAAO,EAA8B,WAAW,EAAE,MAAM,eAAe,CAAA;AAGvE,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAC/B;AAED,eAAO,MAAM,SAAS,QAAS,SAAS,CAAC,SAAS,WAAW,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;oBAqF5D,WAAW;sBAET,aAAa,CAAC,WAAW,CAAC;6BAMnB,MAAM;iCAGF,MAAM;8BAGT,MAAM,MAAM,MAAM,gBAAgB,sBAAsB;oCASlE,MAAM,MAChB,MAAM,cACE,MAAM,iBACH,MAAM,gBACP,MAAM,gBACN,sBAAsB;4CAatB,MAAM,MAChB,MAAM,UACF,MAAM,YACJ,MAAM,aACL,MAAM,eACJ,aAAa,CAAC,MAAM,CAAC,gBACpB,sBAAsB;uCAiBtB,MAAM,MAChB,MAAM,SACH,MAAM,GAAG,IAAI,gBACN,sBAAsB;sCAYJ,MAAM,MAAM,MAAM,SAAS,MAAM,gBAAgB,sBAAsB;;;CAuF5G,CAAA"}
|
|
@@ -19,13 +19,30 @@ import { Effect, Schema } from "effect";
|
|
|
19
19
|
import * as SqlSchema from "effect/unstable/sql/SqlSchema";
|
|
20
20
|
import { decodeCommentLocationJson } from "../commentLocations.js";
|
|
21
21
|
import { cacheError, joinApprovedBy, UpsertInput } from "./internal.js";
|
|
22
|
+
import { PullRequestAmbiguityError } from "./queries.js";
|
|
22
23
|
export const mutations = (sql, publish) => {
|
|
24
|
+
const countByLegacyIdentity_ = SqlSchema.findOne({
|
|
25
|
+
Result: Schema.Struct({ count: Schema.Number }),
|
|
26
|
+
Request: Schema.Struct({ awsAccountId: Schema.String, id: Schema.String }),
|
|
27
|
+
execute: (req) => sql `SELECT count(*) AS count FROM pull_requests
|
|
28
|
+
WHERE aws_account_id = ${req.awsAccountId} AND id = ${req.id}`
|
|
29
|
+
});
|
|
30
|
+
const ensureUnambiguous = (awsAccountId, id, coordinates) => coordinates !== undefined
|
|
31
|
+
? Effect.void
|
|
32
|
+
: countByLegacyIdentity_({ awsAccountId, id }).pipe(Effect.flatMap(({ count }) => count > 1
|
|
33
|
+
? Effect.fail(new PullRequestAmbiguityError({ awsAccountId, pullRequestId: id, matches: count }))
|
|
34
|
+
: Effect.void));
|
|
35
|
+
const pullRequestWhere = (awsAccountId, id, coordinates) => coordinates === undefined
|
|
36
|
+
? sql `aws_account_id = ${awsAccountId} AND id = ${id}`
|
|
37
|
+
: sql `aws_account_id = ${awsAccountId} AND id = ${id}
|
|
38
|
+
AND repository_name = ${coordinates.repositoryName}
|
|
39
|
+
AND account_region = ${coordinates.accountRegion}`;
|
|
23
40
|
const upsert_ = SqlSchema.void({
|
|
24
41
|
Request: UpsertInput,
|
|
25
42
|
execute: (req) => {
|
|
26
43
|
const approvedByStr = joinApprovedBy(req.approvedBy);
|
|
27
44
|
const approvedByArnsStr = joinApprovedBy(req.approvedByArns);
|
|
28
|
-
const approvalRulesJson = req.approvalRules && req.approvalRules.length > 0
|
|
45
|
+
const approvalRulesJson = req.approvalRules !== undefined && req.approvalRules.length > 0
|
|
29
46
|
? JSON.stringify(req.approvalRules)
|
|
30
47
|
: "[]";
|
|
31
48
|
return sql `INSERT INTO pull_requests
|
|
@@ -38,7 +55,7 @@ export const mutations = (sql, publish) => {
|
|
|
38
55
|
${req.creationDate}, ${req.lastModifiedDate}, ${req.status},
|
|
39
56
|
${req.sourceBranch}, ${req.destinationBranch}, ${req.isMergeable}, ${req.isApproved},
|
|
40
57
|
${req.commentCount}, ${req.link}, ${approvedByStr}, ${approvedByArnsStr}, ${approvalRulesJson}, strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))
|
|
41
|
-
ON CONFLICT (aws_account_id, id) DO UPDATE SET
|
|
58
|
+
ON CONFLICT (aws_account_id, id, repository_name, account_region) DO UPDATE SET
|
|
42
59
|
account_profile = excluded.account_profile,
|
|
43
60
|
account_region = excluded.account_region,
|
|
44
61
|
title = excluded.title,
|
|
@@ -53,7 +70,7 @@ export const mutations = (sql, publish) => {
|
|
|
53
70
|
is_mergeable = excluded.is_mergeable,
|
|
54
71
|
is_approved = excluded.is_approved,
|
|
55
72
|
comment_count = COALESCE(excluded.comment_count, pull_requests.comment_count),
|
|
56
|
-
health_score =
|
|
73
|
+
health_score = pull_requests.health_score,
|
|
57
74
|
link = excluded.link,
|
|
58
75
|
approved_by = COALESCE(excluded.approved_by, pull_requests.approved_by),
|
|
59
76
|
approved_by_arns = COALESCE(excluded.approved_by_arns, pull_requests.approved_by_arns),
|
|
@@ -76,25 +93,47 @@ export const mutations = (sql, publish) => {
|
|
|
76
93
|
upsertMany: (prs) => sql.withTransaction(Effect.forEach(prs, (pr) => upsert_(pr), { discard: true })).pipe(Effect.tap(() => publish), cacheError("upsertMany")),
|
|
77
94
|
deleteStale: (olderThan) => deleteStale_({ olderThan }).pipe(Effect.tap(() => publish), cacheError("deleteStale")),
|
|
78
95
|
deleteStaleOpen: (olderThan) => deleteStaleOpen_({ olderThan }).pipe(Effect.tap(() => publish), cacheError("deleteStaleOpen")),
|
|
79
|
-
deleteOne: (awsAccountId, id) => sql `DELETE FROM pull_requests WHERE
|
|
80
|
-
updateDiffStats: (awsAccountId, id, filesAdded, filesModified, filesDeleted) => sql `UPDATE pull_requests SET files_added = ${filesAdded}, files_modified = ${filesModified}, files_deleted = ${filesDeleted}
|
|
81
|
-
WHERE
|
|
82
|
-
updateStatusAndClosedAt: (awsAccountId, id, status, closedAt, mergedBy, approvedBy) => {
|
|
83
|
-
const approvedByStr = approvedBy ? joinApprovedBy([...approvedBy]) : null;
|
|
84
|
-
return sql `UPDATE pull_requests SET status = ${status}, closed_at = ${closedAt}, merged_by = ${mergedBy ?? null},
|
|
96
|
+
deleteOne: (awsAccountId, id, coordinates) => ensureUnambiguous(awsAccountId, id, coordinates).pipe(Effect.andThen(sql `DELETE FROM pull_requests WHERE ${pullRequestWhere(awsAccountId, id, coordinates)}`), Effect.asVoid, Effect.tap(() => publish), cacheError("deleteOne")),
|
|
97
|
+
updateDiffStats: (awsAccountId, id, filesAdded, filesModified, filesDeleted, coordinates) => ensureUnambiguous(awsAccountId, id, coordinates).pipe(Effect.andThen(sql `UPDATE pull_requests SET files_added = ${filesAdded}, files_modified = ${filesModified}, files_deleted = ${filesDeleted}
|
|
98
|
+
WHERE ${pullRequestWhere(awsAccountId, id, coordinates)}`), Effect.asVoid, Effect.tap(() => publish), cacheError("updateDiffStats")),
|
|
99
|
+
updateStatusAndClosedAt: (awsAccountId, id, status, closedAt, mergedBy, approvedBy, coordinates) => {
|
|
100
|
+
const approvedByStr = approvedBy !== undefined ? joinApprovedBy([...approvedBy]) : null;
|
|
101
|
+
return ensureUnambiguous(awsAccountId, id, coordinates).pipe(Effect.andThen(sql `UPDATE pull_requests SET status = ${status}, closed_at = ${closedAt}, merged_by = ${mergedBy ?? null},
|
|
85
102
|
approved_by = COALESCE(${approvedByStr}, approved_by),
|
|
86
103
|
last_modified_date = ${closedAt}
|
|
87
|
-
WHERE
|
|
104
|
+
WHERE ${pullRequestWhere(awsAccountId, id, coordinates)}`), Effect.asVoid, Effect.tap(() => publish), cacheError("updateStatusAndClosedAt"));
|
|
88
105
|
},
|
|
89
|
-
updateCommentCount: (awsAccountId, id, count) => sql `UPDATE pull_requests SET comment_count = ${count}
|
|
90
|
-
WHERE
|
|
91
|
-
updateHealthScore: (awsAccountId, id, score) => sql `UPDATE pull_requests SET health_score = ${score}
|
|
92
|
-
WHERE
|
|
106
|
+
updateCommentCount: (awsAccountId, id, count, coordinates) => ensureUnambiguous(awsAccountId, id, coordinates).pipe(Effect.andThen(sql `UPDATE pull_requests SET comment_count = ${count}
|
|
107
|
+
WHERE ${pullRequestWhere(awsAccountId, id, coordinates)}`), Effect.asVoid, Effect.tap(() => publish), cacheError("updateCommentCount")),
|
|
108
|
+
updateHealthScore: (awsAccountId, id, score, coordinates) => ensureUnambiguous(awsAccountId, id, coordinates).pipe(Effect.andThen(sql `UPDATE pull_requests SET health_score = ${score}
|
|
109
|
+
WHERE ${pullRequestWhere(awsAccountId, id, coordinates)}`), Effect.asVoid, Effect.tap(() => publish), cacheError("updateHealthScore")),
|
|
93
110
|
refreshCommentedBy: () => sql.withTransaction(Effect.gen(function* () {
|
|
94
111
|
const rows = yield* sql `
|
|
95
|
-
SELECT c.aws_account_id, c.pull_request_id
|
|
112
|
+
SELECT c.aws_account_id AS awsAccountId, c.pull_request_id AS pullRequestId,
|
|
113
|
+
p.repository_name AS repositoryName, p.account_region AS accountRegion,
|
|
114
|
+
p.author AS author, c.locations_json AS locationsJson
|
|
96
115
|
FROM pr_comments c
|
|
97
|
-
INNER JOIN pull_requests p
|
|
116
|
+
INNER JOIN pull_requests p
|
|
117
|
+
ON p.id = c.pull_request_id
|
|
118
|
+
AND p.aws_account_id = c.aws_account_id
|
|
119
|
+
AND (
|
|
120
|
+
(p.repository_name = c.repository_name AND p.account_region = c.account_region)
|
|
121
|
+
OR (
|
|
122
|
+
c.repository_name = ''
|
|
123
|
+
AND c.account_region = ''
|
|
124
|
+
AND (
|
|
125
|
+
SELECT count(*) FROM pull_requests p2
|
|
126
|
+
WHERE p2.aws_account_id = c.aws_account_id AND p2.id = c.pull_request_id
|
|
127
|
+
) = 1
|
|
128
|
+
AND NOT EXISTS (
|
|
129
|
+
SELECT 1 FROM pr_comments c2
|
|
130
|
+
WHERE c2.aws_account_id = c.aws_account_id
|
|
131
|
+
AND c2.pull_request_id = c.pull_request_id
|
|
132
|
+
AND c2.repository_name = p.repository_name
|
|
133
|
+
AND c2.account_region = p.account_region
|
|
134
|
+
)
|
|
135
|
+
)
|
|
136
|
+
)
|
|
98
137
|
`;
|
|
99
138
|
for (const row of rows) {
|
|
100
139
|
const parsed = yield* decodeCommentLocationJson(row.locationsJson);
|
|
@@ -110,14 +149,19 @@ export const mutations = (sql, publish) => {
|
|
|
110
149
|
walk(loc.comments);
|
|
111
150
|
const commentedBy = commenters.size > 0 ? [...commenters].join(",") : null;
|
|
112
151
|
yield* sql `UPDATE pull_requests SET commented_by = ${commentedBy}
|
|
113
|
-
WHERE id = ${row.pullRequestId}
|
|
152
|
+
WHERE id = ${row.pullRequestId}
|
|
153
|
+
AND aws_account_id = ${row.awsAccountId}
|
|
154
|
+
AND repository_name = ${row.repositoryName}
|
|
155
|
+
AND account_region = ${row.accountRegion}`;
|
|
114
156
|
}
|
|
115
157
|
})).pipe(Effect.asVoid, cacheError("refreshCommentedBy")),
|
|
116
158
|
propagateRepoAccountId: () => sql `UPDATE pull_requests
|
|
117
159
|
SET repo_account_id = (
|
|
118
160
|
SELECT p2.repo_account_id FROM pull_requests p2
|
|
119
161
|
WHERE p2.repo_account_id IS NOT NULL
|
|
162
|
+
AND p2.aws_account_id = pull_requests.aws_account_id
|
|
120
163
|
AND p2.repository_name = pull_requests.repository_name
|
|
164
|
+
AND p2.account_region = pull_requests.account_region
|
|
121
165
|
LIMIT 1
|
|
122
166
|
)
|
|
123
167
|
WHERE repo_account_id IS NULL`.pipe(Effect.asVoid, cacheError("propagateRepoAccountId"))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../../src/CacheService/repos/PullRequestRepo/mutations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEvC,OAAO,KAAK,SAAS,MAAM,+BAA+B,CAAA;AAC1D,OAAO,EAA0B,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAC1F,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../../src/Cache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AAG,CAAC,YAAY;kDACf,GAAG,CAAC,cAAc;iDACnB,GAAG,CAAC,aAAa,EAAE,CAAA;YAC1D,CAAC;QACH,CAAC,CAAC,CACH,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,oBAAoB,CAAC,CAAC;QAEzD,sBAAsB,EAAE,GAAG,EAAE,CAC3B,GAAG,CAAA;;;;;;;;;wCAS+B,CAAC,IAAI,CACrC,MAAM,CAAC,MAAM,EACb,UAAU,CAAC,wBAAwB,CAAC,CACrC;KACJ,CAAA;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
|
|
@@ -6,10 +6,20 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @category CacheService
|
|
8
8
|
*/
|
|
9
|
-
import { Effect } from "effect";
|
|
9
|
+
import { Effect, Option } from "effect";
|
|
10
10
|
import type * as SqlClient from "effect/unstable/sql/SqlClient";
|
|
11
|
-
import
|
|
11
|
+
import { CacheError } from "../../CacheError.js";
|
|
12
12
|
import { type SearchResult } from "./internal.js";
|
|
13
|
+
declare const PullRequestAmbiguityError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
14
|
+
readonly _tag: "PullRequestAmbiguityError";
|
|
15
|
+
} & Readonly<A>;
|
|
16
|
+
/** Coordinate-free lookup is unsafe once one account can contain duplicate PR IDs. */
|
|
17
|
+
export declare class PullRequestAmbiguityError extends PullRequestAmbiguityError_base<{
|
|
18
|
+
readonly awsAccountId: string;
|
|
19
|
+
readonly pullRequestId: string;
|
|
20
|
+
readonly matches: number;
|
|
21
|
+
}> {
|
|
22
|
+
}
|
|
13
23
|
export declare const findAll: (sql: SqlClient.SqlClient) => () => Effect.Effect<{
|
|
14
24
|
readonly id: string & import("effect/Brand").Brand<"PullRequestId">;
|
|
15
25
|
readonly awsAccountId: string;
|
|
@@ -72,7 +82,38 @@ export declare const findMissingDiffStats: (sql: SqlClient.SqlClient) => () => E
|
|
|
72
82
|
readonly commentedBy: readonly string[];
|
|
73
83
|
readonly approvalRules: readonly import("../../../Domain.js").ApprovalRule[];
|
|
74
84
|
}[], CacheError, never>;
|
|
75
|
-
export declare const findByAccountAndId: (sql: SqlClient.SqlClient) => (awsAccountId: string, id: string) => Effect.Effect<{
|
|
85
|
+
export declare const findByAccountAndId: (sql: SqlClient.SqlClient) => (awsAccountId: string, id: string) => Effect.Effect<Option.Option<{
|
|
86
|
+
readonly id: string & import("effect/Brand").Brand<"PullRequestId">;
|
|
87
|
+
readonly awsAccountId: string;
|
|
88
|
+
readonly repoAccountId: string | null;
|
|
89
|
+
readonly accountProfile: string;
|
|
90
|
+
readonly accountRegion: string;
|
|
91
|
+
readonly title: string;
|
|
92
|
+
readonly description: string | null;
|
|
93
|
+
readonly author: string;
|
|
94
|
+
readonly repositoryName: string & import("effect/Brand").Brand<"RepositoryName">;
|
|
95
|
+
readonly creationDate: Date;
|
|
96
|
+
readonly lastModifiedDate: Date;
|
|
97
|
+
readonly status: "CLOSED" | "MERGED" | "OPEN";
|
|
98
|
+
readonly sourceBranch: string;
|
|
99
|
+
readonly destinationBranch: string;
|
|
100
|
+
readonly isMergeable: boolean;
|
|
101
|
+
readonly isApproved: boolean;
|
|
102
|
+
readonly commentCount: number | null;
|
|
103
|
+
readonly healthScore: number | null;
|
|
104
|
+
readonly link: string;
|
|
105
|
+
readonly fetchedAt: string;
|
|
106
|
+
readonly filesAdded: number | null;
|
|
107
|
+
readonly filesModified: number | null;
|
|
108
|
+
readonly filesDeleted: number | null;
|
|
109
|
+
readonly closedAt: string | null;
|
|
110
|
+
readonly mergedBy: string | null;
|
|
111
|
+
readonly approvedBy: readonly string[];
|
|
112
|
+
readonly approvedByArns: readonly string[];
|
|
113
|
+
readonly commentedBy: readonly string[];
|
|
114
|
+
readonly approvalRules: readonly import("../../../Domain.js").ApprovalRule[];
|
|
115
|
+
}>, CacheError | PullRequestAmbiguityError, never>;
|
|
116
|
+
export declare const findByCoordinates: (sql: SqlClient.SqlClient) => (awsAccountId: string, id: string, repositoryName: string, accountRegion: string) => Effect.Effect<Option.Option<{
|
|
76
117
|
readonly id: string & import("effect/Brand").Brand<"PullRequestId">;
|
|
77
118
|
readonly awsAccountId: string;
|
|
78
119
|
readonly repoAccountId: string | null;
|
|
@@ -102,7 +143,7 @@ export declare const findByAccountAndId: (sql: SqlClient.SqlClient) => (awsAccou
|
|
|
102
143
|
readonly approvedByArns: readonly string[];
|
|
103
144
|
readonly commentedBy: readonly string[];
|
|
104
145
|
readonly approvalRules: readonly import("../../../Domain.js").ApprovalRule[];
|
|
105
|
-
}
|
|
146
|
+
}>, CacheError, never>;
|
|
106
147
|
export declare const search: (sql: SqlClient.SqlClient) => (query: string, opts?: {
|
|
107
148
|
readonly limit?: number;
|
|
108
149
|
readonly offset?: number;
|
|
@@ -110,13 +151,16 @@ export declare const search: (sql: SqlClient.SqlClient) => (query: string, opts?
|
|
|
110
151
|
export declare const findStaleOpen: (sql: SqlClient.SqlClient) => (olderThan: string) => Effect.Effect<{
|
|
111
152
|
readonly id: string;
|
|
112
153
|
readonly awsAccountId: string;
|
|
154
|
+
readonly repositoryName: string;
|
|
113
155
|
readonly accountProfile: string & import("effect/Brand").Brand<"AwsProfileName">;
|
|
114
156
|
readonly accountRegion: string & import("effect/Brand").Brand<"AwsRegion">;
|
|
115
157
|
}[], CacheError, never>;
|
|
116
158
|
export declare const findOpenInRange: (sql: SqlClient.SqlClient) => (weekStart: string, weekEnd: string) => Effect.Effect<{
|
|
117
159
|
readonly id: string;
|
|
118
160
|
readonly awsAccountId: string;
|
|
161
|
+
readonly repositoryName: string;
|
|
119
162
|
readonly accountProfile: string & import("effect/Brand").Brand<"AwsProfileName">;
|
|
120
163
|
readonly accountRegion: string & import("effect/Brand").Brand<"AwsRegion">;
|
|
121
164
|
}[], CacheError, never>;
|
|
165
|
+
export {};
|
|
122
166
|
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../../src/CacheService/repos/PullRequestRepo/queries.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../../src/CacheService/repos/PullRequestRepo/queries.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAQ,MAAM,EAAE,MAAM,EAAqB,MAAM,QAAQ,CAAA;AAChE,OAAO,KAAK,KAAK,SAAS,MAAM,+BAA+B,CAAA;AAG/D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAA4D,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;;;;AAE3G,sFAAsF;AACtF,qBAAa,yBAA0B,SAAQ,+BAA8C;IAC3F,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,CAAC;CAAG;AAUL,eAAO,MAAM,OAAO,QAAS,SAAS,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAQ/C,CAAA;AAED,eAAO,MAAM,oBAAoB,QAAS,SAAS,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAQ5D,CAAA;AAED,eAAO,MAAM,kBAAkB,QAAS,SAAS,CAAC,SAAS,oBAQnC,MAAM,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDA0BzC,CAAA;AAED,eAAO,MAAM,iBAAiB,QAAS,SAAS,CAAC,SAAS,oBAgBlC,MAAM,MAAM,MAAM,kBAAkB,MAAM,iBAAiB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAExF,CAAA;AAED,eAAO,MAAM,MAAM,QAAS,SAAS,CAAC,SAAS,aAsBpC,MAAM,SACN;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,KAC3D,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,UAAU,EAAE,KAAK,CAqBjD,CAAA;AAED,eAAO,MAAM,aAAa,QAAS,SAAS,CAAC,SAAS,iBASjC,MAAM;;;;;;uBAC1B,CAAA;AAED,eAAO,MAAM,eAAe,QAAS,SAAS,CAAC,SAAS,iBAanC,MAAM,WAAW,MAAM;;;;;;uBAC3C,CAAA"}
|
|
@@ -6,13 +6,18 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @category CacheService
|
|
8
8
|
*/
|
|
9
|
-
import { Effect, Schema } from "effect";
|
|
9
|
+
import { Data, Effect, Option, Predicate, Schema } from "effect";
|
|
10
10
|
import * as SqlSchema from "effect/unstable/sql/SqlSchema";
|
|
11
11
|
import { AwsProfileName, AwsRegion } from "../../../Domain.js";
|
|
12
|
+
import { CacheError } from "../../CacheError.js";
|
|
12
13
|
import { CachedPullRequest as CachedPullRequestSchema, cacheError } from "./internal.js";
|
|
14
|
+
/** Coordinate-free lookup is unsafe once one account can contain duplicate PR IDs. */
|
|
15
|
+
export class PullRequestAmbiguityError extends Data.TaggedError("PullRequestAmbiguityError") {
|
|
16
|
+
}
|
|
13
17
|
const StaleOpenRow = Schema.Struct({
|
|
14
18
|
id: Schema.String,
|
|
15
19
|
awsAccountId: Schema.String,
|
|
20
|
+
repositoryName: Schema.String,
|
|
16
21
|
accountProfile: AwsProfileName,
|
|
17
22
|
accountRegion: AwsRegion
|
|
18
23
|
});
|
|
@@ -35,13 +40,43 @@ export const findMissingDiffStats = (sql) => {
|
|
|
35
40
|
return () => run(voidRequest).pipe(cacheError("findMissingDiffStats"));
|
|
36
41
|
};
|
|
37
42
|
export const findByAccountAndId = (sql) => {
|
|
38
|
-
const run = SqlSchema.
|
|
43
|
+
const run = SqlSchema.findAll({
|
|
39
44
|
Result: CachedPullRequestSchema,
|
|
40
45
|
Request: Schema.Struct({ awsAccountId: Schema.String, id: Schema.String }),
|
|
41
46
|
execute: (req) => sql `SELECT * FROM pull_requests
|
|
42
47
|
WHERE aws_account_id = ${req.awsAccountId} AND id = ${req.id}`
|
|
43
48
|
});
|
|
44
|
-
return (awsAccountId, id) => run({ awsAccountId, id }).pipe(
|
|
49
|
+
return (awsAccountId, id) => run({ awsAccountId, id }).pipe(Effect.flatMap((rows) => {
|
|
50
|
+
const [first, ...duplicates] = rows;
|
|
51
|
+
return duplicates.length > 0
|
|
52
|
+
? Effect.fail(new PullRequestAmbiguityError({
|
|
53
|
+
awsAccountId,
|
|
54
|
+
pullRequestId: id,
|
|
55
|
+
matches: rows.length
|
|
56
|
+
}))
|
|
57
|
+
: Effect.succeed(first === undefined ? undefined : first);
|
|
58
|
+
}), Effect.map((row) => row === undefined
|
|
59
|
+
? Option.none()
|
|
60
|
+
: Option.some(row)), Effect.mapError((cause) => Predicate.isTagged(cause, "PullRequestAmbiguityError")
|
|
61
|
+
? cause
|
|
62
|
+
: new CacheError({ operation: "PullRequestRepo.findByAccountAndId", cause })), Effect.withSpan("PullRequestRepo.findByAccountAndId"));
|
|
63
|
+
};
|
|
64
|
+
export const findByCoordinates = (sql) => {
|
|
65
|
+
const run = SqlSchema.findOneOption({
|
|
66
|
+
Result: CachedPullRequestSchema,
|
|
67
|
+
Request: Schema.Struct({
|
|
68
|
+
awsAccountId: Schema.String,
|
|
69
|
+
id: Schema.String,
|
|
70
|
+
repositoryName: Schema.String,
|
|
71
|
+
accountRegion: Schema.String
|
|
72
|
+
}),
|
|
73
|
+
execute: (req) => sql `SELECT * FROM pull_requests
|
|
74
|
+
WHERE aws_account_id = ${req.awsAccountId}
|
|
75
|
+
AND id = ${req.id}
|
|
76
|
+
AND repository_name = ${req.repositoryName}
|
|
77
|
+
AND account_region = ${req.accountRegion}`
|
|
78
|
+
});
|
|
79
|
+
return (awsAccountId, id, repositoryName, accountRegion) => run({ awsAccountId, id, repositoryName, accountRegion }).pipe(cacheError("findByCoordinates"));
|
|
45
80
|
};
|
|
46
81
|
export const search = (sql) => {
|
|
47
82
|
const search_ = SqlSchema.findAll({
|
|
@@ -77,7 +112,7 @@ export const findStaleOpen = (sql) => {
|
|
|
77
112
|
const run = SqlSchema.findAll({
|
|
78
113
|
Result: StaleOpenRow,
|
|
79
114
|
Request: Schema.Struct({ olderThan: Schema.String }),
|
|
80
|
-
execute: (req) => sql `SELECT id, aws_account_id, account_profile, account_region
|
|
115
|
+
execute: (req) => sql `SELECT id, aws_account_id, repository_name, account_profile, account_region
|
|
81
116
|
FROM pull_requests
|
|
82
117
|
WHERE status = 'OPEN' AND fetched_at < ${req.olderThan}`
|
|
83
118
|
});
|
|
@@ -87,7 +122,7 @@ export const findOpenInRange = (sql) => {
|
|
|
87
122
|
const run = SqlSchema.findAll({
|
|
88
123
|
Result: StaleOpenRow,
|
|
89
124
|
Request: Schema.Struct({ weekStart: Schema.String, weekEnd: Schema.String }),
|
|
90
|
-
execute: (req) => sql `SELECT id, aws_account_id, account_profile, account_region
|
|
125
|
+
execute: (req) => sql `SELECT id, aws_account_id, repository_name, account_profile, account_region
|
|
91
126
|
FROM pull_requests
|
|
92
127
|
WHERE status = 'OPEN'
|
|
93
128
|
AND (
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../../src/CacheService/repos/PullRequestRepo/queries.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../../src/CacheService/repos/PullRequestRepo/queries.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA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