@knpkv/codecommit-core 0.19.0 → 0.20.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/AwsClient/AwsClientGated.d.ts.map +1 -1
- package/dist/AwsClient/AwsClientGated.js +0 -2
- package/dist/AwsClient/AwsClientGated.js.map +1 -1
- package/dist/AwsClient/approvalRuleContent.d.ts +2 -1
- package/dist/AwsClient/approvalRuleContent.d.ts.map +1 -1
- package/dist/AwsClient/approvalRuleContent.js +25 -18
- package/dist/AwsClient/approvalRuleContent.js.map +1 -1
- package/dist/AwsClient/getPullRequest.d.ts.map +1 -1
- package/dist/AwsClient/getPullRequest.js +19 -10
- package/dist/AwsClient/getPullRequest.js.map +1 -1
- package/dist/AwsClient/getPullRequests.d.ts +30 -23
- package/dist/AwsClient/getPullRequests.d.ts.map +1 -1
- package/dist/AwsClient/getPullRequests.js +47 -32
- package/dist/AwsClient/getPullRequests.js.map +1 -1
- package/dist/AwsClient/index.d.ts +1 -10
- package/dist/AwsClient/index.d.ts.map +1 -1
- package/dist/AwsClient/index.js +0 -1
- package/dist/AwsClient/index.js.map +1 -1
- package/dist/AwsClient/internal.d.ts +11 -1
- package/dist/AwsClient/internal.d.ts.map +1 -1
- package/dist/AwsClient/internal.js +7 -0
- package/dist/AwsClient/internal.js.map +1 -1
- package/dist/CacheService/Database.d.ts +1 -1
- package/dist/CacheService/Database.d.ts.map +1 -1
- package/dist/CacheService/Database.js +6 -2
- package/dist/CacheService/Database.js.map +1 -1
- package/dist/CacheService/diff.d.ts +10 -0
- package/dist/CacheService/diff.d.ts.map +1 -1
- package/dist/CacheService/diff.js +12 -1
- package/dist/CacheService/diff.js.map +1 -1
- package/dist/CacheService/migrations/0022_pull_request_approval_unknown.d.ts +9 -0
- package/dist/CacheService/migrations/0022_pull_request_approval_unknown.d.ts.map +1 -0
- package/dist/CacheService/migrations/0022_pull_request_approval_unknown.js +8 -0
- package/dist/CacheService/migrations/0022_pull_request_approval_unknown.js.map +1 -0
- package/dist/CacheService/migrations/0023_pull_request_row_versions.d.ts +17 -0
- package/dist/CacheService/migrations/0023_pull_request_row_versions.d.ts.map +1 -0
- package/dist/CacheService/migrations/0023_pull_request_row_versions.js +37 -0
- package/dist/CacheService/migrations/0023_pull_request_row_versions.js.map +1 -0
- package/dist/CacheService/repos/PullRequestRepo/index.d.ts +34 -8
- package/dist/CacheService/repos/PullRequestRepo/index.d.ts.map +1 -1
- package/dist/CacheService/repos/PullRequestRepo/index.js +1 -1
- package/dist/CacheService/repos/PullRequestRepo/index.js.map +1 -1
- package/dist/CacheService/repos/PullRequestRepo/internal.d.ts +69 -2
- package/dist/CacheService/repos/PullRequestRepo/internal.d.ts.map +1 -1
- package/dist/CacheService/repos/PullRequestRepo/internal.js +73 -2
- package/dist/CacheService/repos/PullRequestRepo/internal.js.map +1 -1
- package/dist/CacheService/repos/PullRequestRepo/mutations.d.ts +39 -16
- package/dist/CacheService/repos/PullRequestRepo/mutations.d.ts.map +1 -1
- package/dist/CacheService/repos/PullRequestRepo/mutations.js +61 -92
- package/dist/CacheService/repos/PullRequestRepo/mutations.js.map +1 -1
- package/dist/CacheService/repos/PullRequestRepo/queries.d.ts +24 -0
- package/dist/CacheService/repos/PullRequestRepo/queries.d.ts.map +1 -1
- package/dist/CacheService/repos/PullRequestRepo/queries.js +10 -3
- package/dist/CacheService/repos/PullRequestRepo/queries.js.map +1 -1
- package/dist/CacheService/repos/PullRequestRepo/rowWrites.d.ts +131 -0
- package/dist/CacheService/repos/PullRequestRepo/rowWrites.d.ts.map +1 -0
- package/dist/CacheService/repos/PullRequestRepo/rowWrites.js +214 -0
- package/dist/CacheService/repos/PullRequestRepo/rowWrites.js.map +1 -0
- package/dist/CacheService/repos/StatsRepo/internal.d.ts +0 -1
- package/dist/CacheService/repos/StatsRepo/internal.d.ts.map +1 -1
- package/dist/CacheService/repos/StatsRepo/internal.js.map +1 -1
- package/dist/CacheService/repos/StatsRepo/queries.d.ts.map +1 -1
- package/dist/CacheService/repos/StatsRepo/queries.js +2 -1
- package/dist/CacheService/repos/StatsRepo/queries.js.map +1 -1
- package/dist/CacheService/repos/StatsRepo/reviewerData.d.ts.map +1 -1
- package/dist/CacheService/repos/StatsRepo/reviewerData.js +1 -2
- package/dist/CacheService/repos/StatsRepo/reviewerData.js.map +1 -1
- package/dist/Domain.d.ts +70 -0
- package/dist/Domain.d.ts.map +1 -1
- package/dist/Domain.js +55 -1
- package/dist/Domain.js.map +1 -1
- package/dist/HealthScore.d.ts +1 -1
- package/dist/HealthScore.d.ts.map +1 -1
- package/dist/HealthScore.js +20 -5
- package/dist/HealthScore.js.map +1 -1
- package/dist/PRService/internal.d.ts +17 -1
- package/dist/PRService/internal.d.ts.map +1 -1
- package/dist/PRService/internal.js +8 -0
- package/dist/PRService/internal.js.map +1 -1
- package/dist/PRService/refreshDiffs.d.ts.map +1 -1
- package/dist/PRService/refreshDiffs.js +8 -5
- package/dist/PRService/refreshDiffs.js.map +1 -1
- package/dist/PRService/refreshEnrich.d.ts.map +1 -1
- package/dist/PRService/refreshEnrich.js +26 -45
- package/dist/PRService/refreshEnrich.js.map +1 -1
- package/dist/PRService/refreshFetch.d.ts +1 -1
- package/dist/PRService/refreshFetch.d.ts.map +1 -1
- package/dist/PRService/refreshFetch.js +89 -74
- package/dist/PRService/refreshFetch.js.map +1 -1
- package/dist/PRService/refreshHistory.d.ts.map +1 -1
- package/dist/PRService/refreshHistory.js +17 -10
- package/dist/PRService/refreshHistory.js.map +1 -1
- package/dist/PRService/refreshScore.d.ts.map +1 -1
- package/dist/PRService/refreshScore.js +4 -2
- package/dist/PRService/refreshScore.js.map +1 -1
- package/dist/PRService/refreshSinglePR.d.ts.map +1 -1
- package/dist/PRService/refreshSinglePR.js +44 -25
- package/dist/PRService/refreshSinglePR.js.map +1 -1
- package/package.json +1 -1
|
@@ -12,10 +12,15 @@
|
|
|
12
12
|
* @category CacheService
|
|
13
13
|
*/
|
|
14
14
|
import { Effect, Schema } from "effect";
|
|
15
|
-
import { ApprovalRule } from "../../../Domain.js";
|
|
15
|
+
import { ApprovalRule, type ApprovalUnknownReason } from "../../../Domain.js";
|
|
16
16
|
import { CacheError } from "../../CacheError.js";
|
|
17
|
+
import type { ApprovalGroup, RowGroup, RowVersions } from "./rowWrites.js";
|
|
17
18
|
/** DB column `TEXT` (comma-separated) <-> `readonly string[]` */
|
|
18
19
|
export declare const CommaSeparatedArray: Schema.decodeTo<Schema.$Array<Schema.String>, Schema.NullOr<Schema.String>, never, never>;
|
|
20
|
+
/**
|
|
21
|
+
* The `approval_unknown_reason` column: the reason's tag, or NULL when the last evaluation succeeded.
|
|
22
|
+
*/
|
|
23
|
+
export declare const ApprovalUnknownColumn: Schema.NullOr<Schema.Literals<readonly ["NotPermitted", "Throttled", "ProviderFailed"]>>;
|
|
19
24
|
export declare const CachedPullRequest: Schema.Struct<{
|
|
20
25
|
readonly id: Schema.brand<Schema.String, "PullRequestId">;
|
|
21
26
|
readonly awsAccountId: Schema.String;
|
|
@@ -28,11 +33,17 @@ export declare const CachedPullRequest: Schema.Struct<{
|
|
|
28
33
|
readonly repositoryName: Schema.brand<Schema.String, "RepositoryName">;
|
|
29
34
|
readonly creationDate: Schema.DateFromString;
|
|
30
35
|
readonly lastModifiedDate: Schema.DateFromString;
|
|
36
|
+
/** With `lastModifiedDate`, the row group's version: the observation that last wrote it. */
|
|
37
|
+
readonly observationSeq: Schema.Number;
|
|
38
|
+
/** The approval group's version: the provider last activity and observation that last wrote it. */
|
|
39
|
+
readonly approvalVersion: Schema.DateFromString;
|
|
40
|
+
readonly approvalObservationSeq: Schema.Number;
|
|
31
41
|
readonly status: Schema.Literals<readonly ["OPEN", "CLOSED", "MERGED"]>;
|
|
32
42
|
readonly sourceBranch: Schema.String;
|
|
33
43
|
readonly destinationBranch: Schema.String;
|
|
34
44
|
readonly isMergeable: Schema.decodeTo<Schema.Boolean, Schema.Number, never, never>;
|
|
35
45
|
readonly isApproved: Schema.decodeTo<Schema.Boolean, Schema.Number, never, never>;
|
|
46
|
+
readonly approvalUnknownReason: Schema.NullOr<Schema.Literals<readonly ["NotPermitted", "Throttled", "ProviderFailed"]>>;
|
|
36
47
|
readonly commentCount: Schema.NullOr<Schema.Number>;
|
|
37
48
|
readonly healthScore: Schema.NullOr<Schema.Number>;
|
|
38
49
|
readonly link: Schema.String;
|
|
@@ -70,13 +81,69 @@ export declare const UpsertInput: Schema.Struct<{
|
|
|
70
81
|
readonly destinationBranch: Schema.String;
|
|
71
82
|
readonly isMergeable: Schema.Number;
|
|
72
83
|
readonly isApproved: Schema.Number;
|
|
84
|
+
readonly approvalUnknownReason: Schema.NullOr<Schema.Literals<readonly ["NotPermitted", "Throttled", "ProviderFailed"]>>;
|
|
73
85
|
readonly commentCount: Schema.NullOr<Schema.Number>;
|
|
74
86
|
readonly link: Schema.String;
|
|
75
87
|
readonly approvedBy: Schema.$Array<Schema.String>;
|
|
76
88
|
readonly approvedByArns: Schema.$Array<Schema.String>;
|
|
77
|
-
readonly approvalRules: Schema.withDecodingDefaultTypeKey<Schema.$Array<
|
|
89
|
+
readonly approvalRules: Schema.withDecodingDefaultTypeKey<Schema.$Array<Schema.Struct<{
|
|
90
|
+
readonly ruleName: Schema.String;
|
|
91
|
+
readonly requiredApprovals: Schema.Number;
|
|
92
|
+
readonly poolMembers: Schema.$Array<Schema.String>;
|
|
93
|
+
readonly poolMemberArns: Schema.withDecodingDefaultTypeKey<Schema.$Array<Schema.String>, never>;
|
|
94
|
+
readonly satisfied: Schema.Boolean;
|
|
95
|
+
readonly fromTemplate: Schema.optional<Schema.String>;
|
|
96
|
+
}>>, never>;
|
|
78
97
|
}>;
|
|
79
98
|
export type UpsertInput = typeof UpsertInput.Type;
|
|
99
|
+
/**
|
|
100
|
+
* A provider read's approval, as `recordApprovalEvaluation` and `approvalColumnsOf` take it: the
|
|
101
|
+
* evaluated value and its complete rules, or the reason evaluation failed. A `PullRequestDetail` is one.
|
|
102
|
+
*/
|
|
103
|
+
export interface ApprovalRead {
|
|
104
|
+
readonly isApproved: boolean;
|
|
105
|
+
readonly approvalRules: UpsertInput["approvalRules"];
|
|
106
|
+
readonly approvalUnknown?: ApprovalUnknownReason | undefined;
|
|
107
|
+
}
|
|
108
|
+
/** Both groups' versions as a read of the row saw them: what a recomputed write must still find. */
|
|
109
|
+
export declare const versionsOf: (row: {
|
|
110
|
+
readonly lastModifiedDate: Date;
|
|
111
|
+
readonly observationSeq: number;
|
|
112
|
+
readonly approvalVersion: Date;
|
|
113
|
+
readonly approvalObservationSeq: number;
|
|
114
|
+
}) => RowVersions;
|
|
115
|
+
/**
|
|
116
|
+
* A listed pull request's row group, complete. The listing reads open pull requests, so no merger and
|
|
117
|
+
* no closing time are authoritative values, not gaps.
|
|
118
|
+
*/
|
|
119
|
+
export declare const rowGroupOfListing: (input: UpsertInput) => RowGroup;
|
|
120
|
+
/** A listed pull request's approval group, complete. */
|
|
121
|
+
export declare const approvalGroupOfListing: (input: UpsertInput) => ApprovalGroup;
|
|
122
|
+
/** A provider re-read's row group, complete: a closed or merged read also carries when and by whom. */
|
|
123
|
+
export declare const rowGroupOfRead: (read: {
|
|
124
|
+
readonly title: string;
|
|
125
|
+
readonly description?: string | undefined;
|
|
126
|
+
readonly author: string;
|
|
127
|
+
readonly status: string;
|
|
128
|
+
readonly creationDate: Date;
|
|
129
|
+
readonly lastActivityDate: Date;
|
|
130
|
+
readonly sourceBranch: string;
|
|
131
|
+
readonly destinationBranch: string;
|
|
132
|
+
readonly isMergeable: boolean;
|
|
133
|
+
readonly approvedBy: ReadonlyArray<string>;
|
|
134
|
+
readonly approvedByArns: ReadonlyArray<string>;
|
|
135
|
+
readonly mergedBy?: string | undefined;
|
|
136
|
+
}) => RowGroup;
|
|
137
|
+
/** A provider read's approval group, complete. */
|
|
138
|
+
export declare const approvalGroupOfRead: (read: ApprovalRead) => ApprovalGroup;
|
|
139
|
+
/**
|
|
140
|
+
* The approval columns an upsert input carries for a provider read. While approval is unknown,
|
|
141
|
+
* `isApproved` is a placeholder: the write keeps an existing row's last known value.
|
|
142
|
+
*/
|
|
143
|
+
export declare const approvalColumnsOf: (read: ApprovalRead) => {
|
|
144
|
+
isApproved: number;
|
|
145
|
+
approvalUnknownReason: "NotPermitted" | "ProviderFailed" | "Throttled" | null;
|
|
146
|
+
};
|
|
80
147
|
/** Wrap an Effect with CacheError mapping and a span. */
|
|
81
148
|
export declare const cacheError: (op: string) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, CacheError, Exclude<R, import("effect/Tracer").ParentSpan>>;
|
|
82
149
|
/** Join a string array for the approved_by TEXT column. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../src/CacheService/repos/PullRequestRepo/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAgB,MAAM,QAAQ,CAAA;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../src/CacheService/repos/PullRequestRepo/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAgB,MAAM,QAAQ,CAAA;AACrD,OAAO,EACL,YAAY,EACZ,KAAK,qBAAqB,EAK3B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE1E,iEAAiE;AACjE,eAAO,MAAM,mBAAmB,2FAK/B,CAAA;AAwBD;;GAEG;AACH,eAAO,MAAM,qBAAqB,0FAAoC,CAAA;AAEtE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;IAY5B,4FAA4F;;IAE5F,mGAAmG;;;;;;;;;;;;;;;;;;;;;;EAsBnG,CAAA;AAEF,MAAM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C,YAAY,EAAE,IAAI,CAAA;IAC3B,QAAQ,CAAC,gBAAgB,EAAE,IAAI,CAAA;IAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;IAClC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC1C,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC9C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACvC,KAAG,QAaF,CAAA;AAEF,kDAAkD;AAClD,eAAO,MAAM,mBAAmB,SAAU,YAAY,KAAG,aAIvD,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,SAAU,YAAY;;;CAGlD,CAAA;AAEF,yDAAyD;AACzD,eAAO,MAAM,UAAU,OAAQ,MAAM,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,iFAI/E,CAAA;AAEH,2DAA2D;AAC3D,eAAO,MAAM,cAAc,QAAS,aAAa,CAAC,MAAM,CAAC,kBAA4C,CAAA"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* @category CacheService
|
|
13
13
|
*/
|
|
14
14
|
import { Effect, Schema, SchemaGetter } from "effect";
|
|
15
|
-
import { ApprovalRule, PullRequestId, PullRequestStatus, RepositoryName } from "../../../Domain.js";
|
|
15
|
+
import { ApprovalRule, ApprovalUnknownTag, PullRequestId, PullRequestStatus, RepositoryName } from "../../../Domain.js";
|
|
16
16
|
import { CacheError } from "../../CacheError.js";
|
|
17
17
|
/** DB column `TEXT` (comma-separated) <-> `readonly string[]` */
|
|
18
18
|
export const CommaSeparatedArray = Schema.NullOr(Schema.String).pipe(Schema.decodeTo(Schema.Array(Schema.String), {
|
|
@@ -37,6 +37,10 @@ const ApprovalRulesFromJson = Schema.NullOr(Schema.String).pipe(Schema.decodeTo(
|
|
|
37
37
|
}),
|
|
38
38
|
encode: SchemaGetter.transform((arr) => (arr.length > 0 ? JSON.stringify(arr) : null))
|
|
39
39
|
}));
|
|
40
|
+
/**
|
|
41
|
+
* The `approval_unknown_reason` column: the reason's tag, or NULL when the last evaluation succeeded.
|
|
42
|
+
*/
|
|
43
|
+
export const ApprovalUnknownColumn = Schema.NullOr(ApprovalUnknownTag);
|
|
40
44
|
export const CachedPullRequest = Schema.Struct({
|
|
41
45
|
id: PullRequestId,
|
|
42
46
|
awsAccountId: Schema.String,
|
|
@@ -49,11 +53,17 @@ export const CachedPullRequest = Schema.Struct({
|
|
|
49
53
|
repositoryName: RepositoryName,
|
|
50
54
|
creationDate: Schema.DateFromString,
|
|
51
55
|
lastModifiedDate: Schema.DateFromString,
|
|
56
|
+
/** With `lastModifiedDate`, the row group's version: the observation that last wrote it. */
|
|
57
|
+
observationSeq: Schema.Number,
|
|
58
|
+
/** The approval group's version: the provider last activity and observation that last wrote it. */
|
|
59
|
+
approvalVersion: Schema.DateFromString,
|
|
60
|
+
approvalObservationSeq: Schema.Number,
|
|
52
61
|
status: PullRequestStatus,
|
|
53
62
|
sourceBranch: Schema.String,
|
|
54
63
|
destinationBranch: Schema.String,
|
|
55
64
|
isMergeable: BooleanFromNumber,
|
|
56
65
|
isApproved: BooleanFromNumber,
|
|
66
|
+
approvalUnknownReason: ApprovalUnknownColumn,
|
|
57
67
|
commentCount: Schema.NullOr(Schema.Number),
|
|
58
68
|
healthScore: Schema.NullOr(Schema.Number),
|
|
59
69
|
link: Schema.String,
|
|
@@ -85,11 +95,72 @@ export const UpsertInput = Schema.Struct({
|
|
|
85
95
|
destinationBranch: Schema.String,
|
|
86
96
|
isMergeable: Schema.Number,
|
|
87
97
|
isApproved: Schema.Number,
|
|
98
|
+
approvalUnknownReason: ApprovalUnknownColumn,
|
|
88
99
|
commentCount: Schema.NullOr(Schema.Number),
|
|
89
100
|
link: Schema.String,
|
|
90
101
|
approvedBy: Schema.Array(Schema.String),
|
|
91
102
|
approvedByArns: Schema.Array(Schema.String),
|
|
92
|
-
|
|
103
|
+
// The rule's plain shape, not the class: callers pass the provider's rules as plain objects, and the
|
|
104
|
+
// cache stores them as JSON either way.
|
|
105
|
+
approvalRules: Schema.Array(Schema.Struct(ApprovalRule.fields)).pipe(Schema.withDecodingDefaultTypeKey(Effect.succeed([])))
|
|
106
|
+
});
|
|
107
|
+
/** Both groups' versions as a read of the row saw them: what a recomputed write must still find. */
|
|
108
|
+
export const versionsOf = (row) => ({
|
|
109
|
+
row: { lastActivity: row.lastModifiedDate, observation: row.observationSeq },
|
|
110
|
+
approval: { lastActivity: row.approvalVersion, observation: row.approvalObservationSeq }
|
|
111
|
+
});
|
|
112
|
+
/**
|
|
113
|
+
* A listed pull request's row group, complete. The listing reads open pull requests, so no merger and
|
|
114
|
+
* no closing time are authoritative values, not gaps.
|
|
115
|
+
*/
|
|
116
|
+
export const rowGroupOfListing = (input) => ({
|
|
117
|
+
title: input.title,
|
|
118
|
+
description: input.description,
|
|
119
|
+
author: input.author,
|
|
120
|
+
status: input.status,
|
|
121
|
+
creationDate: input.creationDate,
|
|
122
|
+
sourceBranch: input.sourceBranch,
|
|
123
|
+
destinationBranch: input.destinationBranch,
|
|
124
|
+
isMergeable: input.isMergeable === 1,
|
|
125
|
+
approvedBy: input.approvedBy,
|
|
126
|
+
approvedByArns: input.approvedByArns,
|
|
127
|
+
mergedBy: null,
|
|
128
|
+
closedAt: null
|
|
129
|
+
});
|
|
130
|
+
/** A listed pull request's approval group, complete. */
|
|
131
|
+
export const approvalGroupOfListing = (input) => ({
|
|
132
|
+
isApproved: input.isApproved === 1,
|
|
133
|
+
approvalRules: input.approvalRules,
|
|
134
|
+
unknownReason: input.approvalUnknownReason
|
|
135
|
+
});
|
|
136
|
+
/** A provider re-read's row group, complete: a closed or merged read also carries when and by whom. */
|
|
137
|
+
export const rowGroupOfRead = (read) => ({
|
|
138
|
+
title: read.title,
|
|
139
|
+
description: read.description ?? null,
|
|
140
|
+
author: read.author,
|
|
141
|
+
status: read.status,
|
|
142
|
+
creationDate: read.creationDate.toISOString(),
|
|
143
|
+
sourceBranch: read.sourceBranch,
|
|
144
|
+
destinationBranch: read.destinationBranch,
|
|
145
|
+
isMergeable: read.isMergeable,
|
|
146
|
+
approvedBy: read.approvedBy,
|
|
147
|
+
approvedByArns: read.approvedByArns,
|
|
148
|
+
mergedBy: read.mergedBy ?? null,
|
|
149
|
+
closedAt: read.status === "OPEN" ? null : read.lastActivityDate.toISOString()
|
|
150
|
+
});
|
|
151
|
+
/** A provider read's approval group, complete. */
|
|
152
|
+
export const approvalGroupOfRead = (read) => ({
|
|
153
|
+
isApproved: read.isApproved,
|
|
154
|
+
approvalRules: read.approvalRules,
|
|
155
|
+
unknownReason: read.approvalUnknown?._tag ?? null
|
|
156
|
+
});
|
|
157
|
+
/**
|
|
158
|
+
* The approval columns an upsert input carries for a provider read. While approval is unknown,
|
|
159
|
+
* `isApproved` is a placeholder: the write keeps an existing row's last known value.
|
|
160
|
+
*/
|
|
161
|
+
export const approvalColumnsOf = (read) => ({
|
|
162
|
+
isApproved: read.approvalUnknown === undefined && read.isApproved ? 1 : 0,
|
|
163
|
+
approvalUnknownReason: read.approvalUnknown?._tag ?? null
|
|
93
164
|
});
|
|
94
165
|
/** Wrap an Effect with CacheError mapping and a span. */
|
|
95
166
|
export const cacheError = (op) => (effect) => effect.pipe(Effect.mapError((cause) => new CacheError({ operation: `PullRequestRepo.${op}`, cause })), Effect.withSpan(`PullRequestRepo.${op}`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../../src/CacheService/repos/PullRequestRepo/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,QAAQ,C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,IAAI,UAAU,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,EACzF,MAAM,CAAC,QAAQ,CAAC,mBAAmB,EAAE,EAAE,CAAC,CACzC,CAAA;AAEH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAA0B,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -4,34 +4,57 @@
|
|
|
4
4
|
* SQL write operations for the pull_requests table. Each function takes `sql`
|
|
5
5
|
* and `publish` (change event) and returns the mutation implementations.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* **Gotchas**
|
|
12
|
-
*
|
|
13
|
-
* - approval_rules uses `= excluded` (no COALESCE) — always fresh from API
|
|
14
|
-
* - repo_account_id uses COALESCE — preserves across partial updates
|
|
7
|
+
* Every write goes through `rowWrites`: provider reads write whole column groups under their versions
|
|
8
|
+
* (`upsert` for a listing, `writeRead` for a re-read), recomputed values go through `writeDerived`,
|
|
9
|
+
* which applies only to the row as it was read, and a not-found read deletes through `deleteOne`.
|
|
15
10
|
*
|
|
16
11
|
* @category CacheService
|
|
17
12
|
*/
|
|
13
|
+
import type { Option } from "effect";
|
|
18
14
|
import { Effect } from "effect";
|
|
19
15
|
import type * as SqlClient from "effect/sql/SqlClient";
|
|
20
|
-
import { UpsertInput } from "./internal.js";
|
|
16
|
+
import { type ApprovalRead, CachedPullRequest, rowGroupOfRead, UpsertInput } from "./internal.js";
|
|
17
|
+
import { type DerivedColumns, type GroupsWritten, type RowVersions } from "./rowWrites.js";
|
|
18
|
+
/** What an upsert wrote, and the row it replaced (none for a pull request seen for the first time). */
|
|
19
|
+
export interface UpsertResult extends GroupsWritten {
|
|
20
|
+
readonly replaced: Option.Option<CachedPullRequest>;
|
|
21
|
+
}
|
|
21
22
|
export interface PullRequestCoordinates {
|
|
22
23
|
readonly repositoryName: string;
|
|
23
24
|
readonly accountRegion: string;
|
|
24
25
|
}
|
|
25
26
|
export declare const mutations: (sql: SqlClient.SqlClient, publish: Effect.Effect<void>) => {
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
/** The next observation number: take it before the provider read whose results a write carries. */
|
|
28
|
+
observe: () => Effect.Effect<number, import("../../CacheError.ts").CacheError, never>;
|
|
29
|
+
/**
|
|
30
|
+
* Write a listed pull request observed by `observation`: its row and approval groups, each unless
|
|
31
|
+
* that group is newer. The result says which were written; a group not written means a newer read
|
|
32
|
+
* already reached it.
|
|
33
|
+
*/
|
|
34
|
+
upsert: (input: UpsertInput, observation: number) => Effect.Effect<UpsertResult, import("../../CacheError.ts").CacheError, never>;
|
|
35
|
+
/**
|
|
36
|
+
* Write a pull request read in full (a single-PR refresh): like `upsert`, but both groups come
|
|
37
|
+
* from `read`, so a merged or closed read carries its merger and closing time.
|
|
38
|
+
*/
|
|
39
|
+
upsertRead: (input: UpsertInput, read: Parameters<typeof rowGroupOfRead>[0] & ApprovalRead, observation: number) => Effect.Effect<UpsertResult, import("../../CacheError.ts").CacheError, never>;
|
|
40
|
+
upsertMany: (prs: ReadonlyArray<UpsertInput>, observation: number) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
41
|
+
/**
|
|
42
|
+
* Write a provider re-read of a cached pull request, observed by `observation`: its whole row group
|
|
43
|
+
* (including a closed or merged status) and approval group, each unless that group is newer.
|
|
44
|
+
*/
|
|
45
|
+
writeRead: (awsAccountId: string, id: string, read: Parameters<typeof rowGroupOfRead>[0] & ApprovalRead, observation: number, coordinates?: PullRequestCoordinates) => Effect.Effect<GroupsWritten, import("../../CacheError.ts").CacheError, never>;
|
|
46
|
+
/**
|
|
47
|
+
* Write values recomputed from a cached row (diff stats, comment count, health score), only while
|
|
48
|
+
* the row still holds `observed`, the versions it was read at. True when written.
|
|
49
|
+
*/
|
|
50
|
+
writeDerived: (awsAccountId: string, id: string, observed: RowVersions, columns: DerivedColumns, coordinates?: PullRequestCoordinates) => Effect.Effect<boolean, import("../../CacheError.ts").CacheError, never>;
|
|
28
51
|
deleteStale: (olderThan: string) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
29
52
|
deleteStaleOpen: (olderThan: string) => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Delete a row the provider answered "does not exist" for, in a read begun at `observation`,
|
|
55
|
+
* unless a read that began later has written it since. True when the row was deleted.
|
|
56
|
+
*/
|
|
57
|
+
deleteOne: (awsAccountId: string, id: string, observation: number, coordinates?: PullRequestCoordinates) => Effect.Effect<boolean, import("../../CacheError.ts").CacheError, never>;
|
|
35
58
|
refreshCommentedBy: () => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
36
59
|
propagateRepoAccountId: () => Effect.Effect<void, import("../../CacheError.ts").CacheError, never>;
|
|
37
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../../src/CacheService/repos/PullRequestRepo/mutations.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../../src/CacheService/repos/PullRequestRepo/mutations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAA;AACvC,OAAO,KAAK,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAGtD,OAAO,EAGL,KAAK,YAAY,EACjB,iBAAiB,EAGjB,cAAc,EACd,WAAW,EACZ,MAAM,eAAe,CAAA;AAEtB,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,KAAK,WAAW,EAEjB,MAAM,gBAAgB,CAAA;AAEvB,uGAAuG;AACvG,MAAM,WAAW,YAAa,SAAQ,aAAa;IACjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAA;CACpD;AAED,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;IAkE5E,mGAAmG;;IAGnG;;;;OAIG;oBACa,WAAW,eAAe,MAAM;IAMhD;;;OAGG;wBAEM,WAAW,QACZ,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,eAC5C,MAAM;sBAOH,aAAa,CAAC,WAAW,CAAC,eAAe,MAAM;IAMjE;;;OAGG;8BAEa,MAAM,MAChB,MAAM,QACJ,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,eAC5C,MAAM,gBACL,sBAAsB;IAetC;;;OAGG;iCAEa,MAAM,MAChB,MAAM,YACA,WAAW,WACZ,cAAc,gBACT,sBAAsB;6BAQb,MAAM;iCAGF,MAAM;IAGnC;;;OAGG;8BACuB,MAAM,MAAM,MAAM,eAAe,MAAM,gBAAgB,sBAAsB;;;CAuF1G,CAAA"}
|
|
@@ -1,26 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module PullRequestRepo/mutations
|
|
3
|
-
*
|
|
4
|
-
* SQL write operations for the pull_requests table. Each function takes `sql`
|
|
5
|
-
* and `publish` (change event) and returns the mutation implementations.
|
|
6
|
-
*
|
|
7
|
-
* Provides upsert (INSERT ON CONFLICT UPDATE with column-specific merge
|
|
8
|
-
* strategy), stale cleanup, diff stats updates, status transitions,
|
|
9
|
-
* comment count updates, health score updates, and commented-by refresh.
|
|
10
|
-
*
|
|
11
|
-
* **Gotchas**
|
|
12
|
-
*
|
|
13
|
-
* - approval_rules uses `= excluded` (no COALESCE) — always fresh from API
|
|
14
|
-
* - repo_account_id uses COALESCE — preserves across partial updates
|
|
15
|
-
*
|
|
16
|
-
* @category CacheService
|
|
17
|
-
*/
|
|
18
1
|
import { Effect, Schema } from "effect";
|
|
19
2
|
import * as SqlSchema from "effect/sql/SqlSchema";
|
|
20
3
|
import { decodeCommentLocationJson } from "../commentLocations.js";
|
|
21
|
-
import { cacheError,
|
|
4
|
+
import { approvalGroupOfListing, approvalGroupOfRead, CachedPullRequest, cacheError, rowGroupOfListing, rowGroupOfRead, UpsertInput } from "./internal.js";
|
|
22
5
|
import { PullRequestAmbiguityError } from "./queries.js";
|
|
6
|
+
import { rowWrites } from "./rowWrites.js";
|
|
23
7
|
export const mutations = (sql, publish) => {
|
|
8
|
+
const writes = rowWrites(sql);
|
|
24
9
|
const countByLegacyIdentity_ = SqlSchema.findOne({
|
|
25
10
|
Result: Schema.Struct({ count: Schema.Number }),
|
|
26
11
|
Request: Schema.Struct({ awsAccountId: Schema.String, id: Schema.String }),
|
|
@@ -37,80 +22,70 @@ export const mutations = (sql, publish) => {
|
|
|
37
22
|
: sql `aws_account_id = ${awsAccountId} AND id = ${id}
|
|
38
23
|
AND repository_name = ${coordinates.repositoryName}
|
|
39
24
|
AND account_region = ${coordinates.accountRegion}`;
|
|
40
|
-
const
|
|
25
|
+
const encodeUpsert = Schema.encodeEffect(UpsertInput);
|
|
26
|
+
const findReplaced = SqlSchema.findOneOption({
|
|
27
|
+
Result: CachedPullRequest,
|
|
41
28
|
Request: UpsertInput,
|
|
42
|
-
execute: (req) => {
|
|
43
|
-
|
|
44
|
-
const approvedByArnsStr = joinApprovedBy(req.approvedByArns);
|
|
45
|
-
const approvalRulesJson = req.approvalRules !== undefined && req.approvalRules.length > 0
|
|
46
|
-
? JSON.stringify(req.approvalRules)
|
|
47
|
-
: "[]";
|
|
48
|
-
return sql `INSERT INTO pull_requests
|
|
49
|
-
(id, aws_account_id, repo_account_id, account_profile, account_region, title, description,
|
|
50
|
-
author, repository_name, creation_date, last_modified_date, status,
|
|
51
|
-
source_branch, destination_branch, is_mergeable, is_approved,
|
|
52
|
-
comment_count, link, approved_by, approved_by_arns, approval_rules, fetched_at)
|
|
53
|
-
VALUES (${req.id}, ${req.awsAccountId}, ${req.repoAccountId}, ${req.accountProfile}, ${req.accountRegion},
|
|
54
|
-
${req.title}, ${req.description}, ${req.author}, ${req.repositoryName},
|
|
55
|
-
${req.creationDate}, ${req.lastModifiedDate}, ${req.status},
|
|
56
|
-
${req.sourceBranch}, ${req.destinationBranch}, ${req.isMergeable}, ${req.isApproved},
|
|
57
|
-
${req.commentCount}, ${req.link}, ${approvedByStr}, ${approvedByArnsStr}, ${approvalRulesJson}, strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))
|
|
58
|
-
ON CONFLICT (aws_account_id, id, repository_name, account_region) DO UPDATE SET
|
|
59
|
-
account_profile = excluded.account_profile,
|
|
60
|
-
account_region = excluded.account_region,
|
|
61
|
-
title = excluded.title,
|
|
62
|
-
description = excluded.description,
|
|
63
|
-
author = excluded.author,
|
|
64
|
-
repository_name = excluded.repository_name,
|
|
65
|
-
creation_date = excluded.creation_date,
|
|
66
|
-
last_modified_date = excluded.last_modified_date,
|
|
67
|
-
status = excluded.status,
|
|
68
|
-
source_branch = excluded.source_branch,
|
|
69
|
-
destination_branch = excluded.destination_branch,
|
|
70
|
-
is_mergeable = excluded.is_mergeable,
|
|
71
|
-
is_approved = excluded.is_approved,
|
|
72
|
-
comment_count = COALESCE(excluded.comment_count, pull_requests.comment_count),
|
|
73
|
-
health_score = pull_requests.health_score,
|
|
74
|
-
link = excluded.link,
|
|
75
|
-
approved_by = COALESCE(excluded.approved_by, pull_requests.approved_by),
|
|
76
|
-
approved_by_arns = COALESCE(excluded.approved_by_arns, pull_requests.approved_by_arns),
|
|
77
|
-
-- Always overwrite: rules are fetched fresh on every sync, unlike approved_by which accumulates
|
|
78
|
-
approval_rules = excluded.approval_rules,
|
|
79
|
-
repo_account_id = COALESCE(excluded.repo_account_id, pull_requests.repo_account_id),
|
|
80
|
-
fetched_at = excluded.fetched_at`;
|
|
81
|
-
}
|
|
29
|
+
execute: (req) => sql `SELECT * FROM pull_requests WHERE aws_account_id = ${req.awsAccountId} AND id = ${req.id}
|
|
30
|
+
AND repository_name = ${req.repositoryName} AND account_region = ${req.accountRegion}`
|
|
82
31
|
});
|
|
32
|
+
/**
|
|
33
|
+
* Read the row and write it in one transaction, so the result carries the row this write replaced:
|
|
34
|
+
* what a notification diffs against, not a snapshot another write may have changed since.
|
|
35
|
+
*/
|
|
36
|
+
const upsertWith = (input, row, approval, observation) => sql.withTransaction(Effect.all({
|
|
37
|
+
replaced: findReplaced(input),
|
|
38
|
+
written: encodeUpsert(input).pipe(Effect.flatMap((req) => writes.upsert(req, row, approval, observation)))
|
|
39
|
+
})).pipe(Effect.map(({ replaced, written }) => ({ ...written, replaced })));
|
|
40
|
+
const upsert_ = (input, observation) => upsertWith(input, rowGroupOfListing(input), approvalGroupOfListing(input), observation);
|
|
41
|
+
/** Publish a change only when a write applied. */
|
|
42
|
+
const publishIfApplied = (applied) => applied ? publish : Effect.void;
|
|
83
43
|
const deleteStale_ = SqlSchema.void({
|
|
84
44
|
Request: Schema.Struct({ olderThan: Schema.String }),
|
|
85
|
-
execute: (req) =>
|
|
45
|
+
execute: (req) => writes.deleteFetchedBefore(req.olderThan, false)
|
|
86
46
|
});
|
|
87
47
|
const deleteStaleOpen_ = SqlSchema.void({
|
|
88
48
|
Request: Schema.Struct({ olderThan: Schema.String }),
|
|
89
|
-
execute: (req) =>
|
|
49
|
+
execute: (req) => writes.deleteFetchedBefore(req.olderThan, true)
|
|
90
50
|
});
|
|
91
51
|
const repo = {
|
|
92
|
-
|
|
93
|
-
|
|
52
|
+
/** The next observation number: take it before the provider read whose results a write carries. */
|
|
53
|
+
observe: () => writes.observe().pipe(cacheError("observe")),
|
|
54
|
+
/**
|
|
55
|
+
* Write a listed pull request observed by `observation`: its row and approval groups, each unless
|
|
56
|
+
* that group is newer. The result says which were written; a group not written means a newer read
|
|
57
|
+
* already reached it.
|
|
58
|
+
*/
|
|
59
|
+
upsert: (input, observation) => upsert_(input, observation).pipe(Effect.tap((written) => publishIfApplied(written.row || written.approval)), cacheError("upsert")),
|
|
60
|
+
/**
|
|
61
|
+
* Write a pull request read in full (a single-PR refresh): like `upsert`, but both groups come
|
|
62
|
+
* from `read`, so a merged or closed read carries its merger and closing time.
|
|
63
|
+
*/
|
|
64
|
+
upsertRead: (input, read, observation) => upsertWith(input, rowGroupOfRead(read), approvalGroupOfRead(read), observation).pipe(Effect.tap((written) => publishIfApplied(written.row || written.approval)), cacheError("upsertRead")),
|
|
65
|
+
upsertMany: (prs, observation) => sql.withTransaction(Effect.forEach(prs, (pr) => upsert_(pr, observation), { discard: true })).pipe(Effect.tap(() => publish), cacheError("upsertMany")),
|
|
66
|
+
/**
|
|
67
|
+
* Write a provider re-read of a cached pull request, observed by `observation`: its whole row group
|
|
68
|
+
* (including a closed or merged status) and approval group, each unless that group is newer.
|
|
69
|
+
*/
|
|
70
|
+
writeRead: (awsAccountId, id, read, observation, coordinates) => ensureUnambiguous(awsAccountId, id, coordinates).pipe(Effect.andThen(writes.writeRead(pullRequestWhere(awsAccountId, id, coordinates), { lastActivity: read.lastActivityDate, observation }, rowGroupOfRead(read), approvalGroupOfRead(read))), Effect.tap((written) => publishIfApplied(written.row || written.approval)), cacheError("writeRead")),
|
|
71
|
+
/**
|
|
72
|
+
* Write values recomputed from a cached row (diff stats, comment count, health score), only while
|
|
73
|
+
* the row still holds `observed`, the versions it was read at. True when written.
|
|
74
|
+
*/
|
|
75
|
+
writeDerived: (awsAccountId, id, observed, columns, coordinates) => ensureUnambiguous(awsAccountId, id, coordinates).pipe(Effect.andThen(writes.writeDerived(pullRequestWhere(awsAccountId, id, coordinates), observed, columns)), Effect.tap(publishIfApplied), cacheError("writeDerived")),
|
|
94
76
|
deleteStale: (olderThan) => deleteStale_({ olderThan }).pipe(Effect.tap(() => publish), cacheError("deleteStale")),
|
|
95
77
|
deleteStaleOpen: (olderThan) => deleteStaleOpen_({ olderThan }).pipe(Effect.tap(() => publish), cacheError("deleteStaleOpen")),
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return ensureUnambiguous(awsAccountId, id, coordinates).pipe(Effect.andThen(sql `UPDATE pull_requests SET status = ${status}, closed_at = ${closedAt}, merged_by = ${mergedBy ?? null},
|
|
102
|
-
approved_by = COALESCE(${approvedByStr}, approved_by),
|
|
103
|
-
last_modified_date = ${closedAt}
|
|
104
|
-
WHERE ${pullRequestWhere(awsAccountId, id, coordinates)}`), Effect.asVoid, Effect.tap(() => publish), cacheError("updateStatusAndClosedAt"));
|
|
105
|
-
},
|
|
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")),
|
|
78
|
+
/**
|
|
79
|
+
* Delete a row the provider answered "does not exist" for, in a read begun at `observation`,
|
|
80
|
+
* unless a read that began later has written it since. True when the row was deleted.
|
|
81
|
+
*/
|
|
82
|
+
deleteOne: (awsAccountId, id, observation, coordinates) => ensureUnambiguous(awsAccountId, id, coordinates).pipe(Effect.andThen(writes.deleteIfNotNewer(pullRequestWhere(awsAccountId, id, coordinates), observation)), Effect.tap(publishIfApplied), cacheError("deleteOne")),
|
|
110
83
|
refreshCommentedBy: () => sql.withTransaction(Effect.gen(function* () {
|
|
111
84
|
const rows = yield* sql `
|
|
112
85
|
SELECT c.aws_account_id AS awsAccountId, c.pull_request_id AS pullRequestId,
|
|
113
86
|
p.repository_name AS repositoryName, p.account_region AS accountRegion,
|
|
87
|
+
p.last_modified_date AS rowAt, p.observation_seq AS rowSeq,
|
|
88
|
+
p.approval_version AS approvalAt, p.approval_observation_seq AS approvalSeq,
|
|
114
89
|
p.author AS author, c.locations_json AS locationsJson
|
|
115
90
|
FROM pr_comments c
|
|
116
91
|
INNER JOIN pull_requests p
|
|
@@ -148,23 +123,17 @@ export const mutations = (sql, publish) => {
|
|
|
148
123
|
for (const loc of parsed)
|
|
149
124
|
walk(loc.comments);
|
|
150
125
|
const commentedBy = commenters.size > 0 ? [...commenters].join(",") : null;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
126
|
+
// Read and written in one transaction, so the versions it read still hold.
|
|
127
|
+
yield* writes.writeDerived(pullRequestWhere(row.awsAccountId, row.pullRequestId, {
|
|
128
|
+
repositoryName: row.repositoryName,
|
|
129
|
+
accountRegion: row.accountRegion
|
|
130
|
+
}), {
|
|
131
|
+
row: { lastActivity: new Date(row.rowAt), observation: row.rowSeq },
|
|
132
|
+
approval: { lastActivity: new Date(row.approvalAt), observation: row.approvalSeq }
|
|
133
|
+
}, { commentedBy });
|
|
156
134
|
}
|
|
157
135
|
})).pipe(Effect.asVoid, cacheError("refreshCommentedBy")),
|
|
158
|
-
propagateRepoAccountId: () =>
|
|
159
|
-
SET repo_account_id = (
|
|
160
|
-
SELECT p2.repo_account_id FROM pull_requests p2
|
|
161
|
-
WHERE p2.repo_account_id IS NOT NULL
|
|
162
|
-
AND p2.aws_account_id = pull_requests.aws_account_id
|
|
163
|
-
AND p2.repository_name = pull_requests.repository_name
|
|
164
|
-
AND p2.account_region = pull_requests.account_region
|
|
165
|
-
LIMIT 1
|
|
166
|
-
)
|
|
167
|
-
WHERE repo_account_id IS NULL`.pipe(Effect.asVoid, cacheError("propagateRepoAccountId"))
|
|
136
|
+
propagateRepoAccountId: () => writes.fillRepoAccountIds().pipe(Effect.asVoid, cacheError("propagateRepoAccountId"))
|
|
168
137
|
};
|
|
169
138
|
return repo;
|
|
170
139
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../../src/CacheService/repos/PullRequestRepo/mutations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../../src/CacheService/repos/PullRequestRepo/mutations.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEvC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAA0B,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAC1F,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EAEnB,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,WAAW,EACZ,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAML,SAAS,EACV,MAAM,gBAAgB,CAAA;AAYvB,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAwB,EAAE,OAA4B,EAAE,EAAE;IAClF,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,CAAA;IAC7B,MAAM,sBAAsB,GAAG,SAAS,CAAC,OAAO,CAAC;QAC/C,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;QAC/C,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,YAA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