@knpkv/codecommit-core 0.18.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/getCallerIdentity.d.ts +2 -0
- package/dist/AwsClient/getCallerIdentity.d.ts.map +1 -1
- package/dist/AwsClient/getCallerIdentity.js +8 -4
- package/dist/AwsClient/getCallerIdentity.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/AwsClientConfig/internal/ProfileCredentialProvider.d.ts +2 -17
- package/dist/AwsClientConfig/internal/ProfileCredentialProvider.d.ts.map +1 -1
- package/dist/AwsClientConfig/internal/ProfileCredentialProvider.js +2 -6
- package/dist/AwsClientConfig/internal/ProfileCredentialProvider.js.map +1 -1
- package/dist/AwsClientConfig.js +1 -1
- package/dist/AwsClientConfig.js.map +1 -1
- package/dist/AwsCredentialErrors.d.ts +8 -0
- package/dist/AwsCredentialErrors.d.ts.map +1 -0
- package/dist/AwsCredentialErrors.js +40 -0
- package/dist/AwsCredentialErrors.js.map +1 -0
- package/dist/AwsProfileCredentials.d.ts +23 -0
- package/dist/AwsProfileCredentials.d.ts.map +1 -0
- package/dist/AwsProfileCredentials.js +29 -0
- package/dist/AwsProfileCredentials.js.map +1 -0
- 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 +153 -7
- package/dist/Domain.d.ts.map +1 -1
- package/dist/Domain.js +107 -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/IdentityLifecycle.d.ts +288 -0
- package/dist/IdentityLifecycle.d.ts.map +1 -0
- package/dist/IdentityLifecycle.js +125 -0
- package/dist/IdentityLifecycle.js.map +1 -0
- 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/refresh.d.ts.map +1 -1
- package/dist/PRService/refresh.js +2 -1
- package/dist/PRService/refresh.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 +3 -1
- package/dist/PRService/refreshFetch.d.ts.map +1 -1
- package/dist/PRService/refreshFetch.js +108 -74
- package/dist/PRService/refreshFetch.js.map +1 -1
- package/dist/PRService/refreshHistory.d.ts.map +1 -1
- package/dist/PRService/refreshHistory.js +19 -11
- package/dist/PRService/refreshHistory.js.map +1 -1
- package/dist/PRService/refreshResolve.d.ts +10 -0
- package/dist/PRService/refreshResolve.d.ts.map +1 -1
- package/dist/PRService/refreshResolve.js +43 -28
- package/dist/PRService/refreshResolve.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
|
@@ -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,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;QAC1E,OAA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const findAll: (sql: SqlClient.SqlClient) => () => Effect.Effect<
|
|
|
32
32
|
readonly repositoryName: string & import("effect/Brand").Brand<"RepositoryName">;
|
|
33
33
|
readonly creationDate: Date;
|
|
34
34
|
readonly lastModifiedDate: Date;
|
|
35
|
+
readonly observationSeq: number;
|
|
36
|
+
readonly approvalVersion: Date;
|
|
37
|
+
readonly approvalObservationSeq: number;
|
|
35
38
|
readonly status: "CLOSED" | "MERGED" | "OPEN";
|
|
36
39
|
readonly sourceBranch: string;
|
|
37
40
|
readonly destinationBranch: string;
|
|
38
41
|
readonly isMergeable: boolean;
|
|
39
42
|
readonly isApproved: boolean;
|
|
43
|
+
readonly approvalUnknownReason: "NotPermitted" | "ProviderFailed" | "Throttled" | null;
|
|
40
44
|
readonly commentCount: number | null;
|
|
41
45
|
readonly healthScore: number | null;
|
|
42
46
|
readonly link: string;
|
|
@@ -63,11 +67,15 @@ export declare const findMissingDiffStats: (sql: SqlClient.SqlClient) => () => E
|
|
|
63
67
|
readonly repositoryName: string & import("effect/Brand").Brand<"RepositoryName">;
|
|
64
68
|
readonly creationDate: Date;
|
|
65
69
|
readonly lastModifiedDate: Date;
|
|
70
|
+
readonly observationSeq: number;
|
|
71
|
+
readonly approvalVersion: Date;
|
|
72
|
+
readonly approvalObservationSeq: number;
|
|
66
73
|
readonly status: "CLOSED" | "MERGED" | "OPEN";
|
|
67
74
|
readonly sourceBranch: string;
|
|
68
75
|
readonly destinationBranch: string;
|
|
69
76
|
readonly isMergeable: boolean;
|
|
70
77
|
readonly isApproved: boolean;
|
|
78
|
+
readonly approvalUnknownReason: "NotPermitted" | "ProviderFailed" | "Throttled" | null;
|
|
71
79
|
readonly commentCount: number | null;
|
|
72
80
|
readonly healthScore: number | null;
|
|
73
81
|
readonly link: string;
|
|
@@ -94,11 +102,15 @@ export declare const findByAccountAndId: (sql: SqlClient.SqlClient) => (awsAccou
|
|
|
94
102
|
readonly repositoryName: string & import("effect/Brand").Brand<"RepositoryName">;
|
|
95
103
|
readonly creationDate: Date;
|
|
96
104
|
readonly lastModifiedDate: Date;
|
|
105
|
+
readonly observationSeq: number;
|
|
106
|
+
readonly approvalVersion: Date;
|
|
107
|
+
readonly approvalObservationSeq: number;
|
|
97
108
|
readonly status: "CLOSED" | "MERGED" | "OPEN";
|
|
98
109
|
readonly sourceBranch: string;
|
|
99
110
|
readonly destinationBranch: string;
|
|
100
111
|
readonly isMergeable: boolean;
|
|
101
112
|
readonly isApproved: boolean;
|
|
113
|
+
readonly approvalUnknownReason: "NotPermitted" | "ProviderFailed" | "Throttled" | null;
|
|
102
114
|
readonly commentCount: number | null;
|
|
103
115
|
readonly healthScore: number | null;
|
|
104
116
|
readonly link: string;
|
|
@@ -125,11 +137,15 @@ export declare const findByCoordinates: (sql: SqlClient.SqlClient) => (awsAccoun
|
|
|
125
137
|
readonly repositoryName: string & import("effect/Brand").Brand<"RepositoryName">;
|
|
126
138
|
readonly creationDate: Date;
|
|
127
139
|
readonly lastModifiedDate: Date;
|
|
140
|
+
readonly observationSeq: number;
|
|
141
|
+
readonly approvalVersion: Date;
|
|
142
|
+
readonly approvalObservationSeq: number;
|
|
128
143
|
readonly status: "CLOSED" | "MERGED" | "OPEN";
|
|
129
144
|
readonly sourceBranch: string;
|
|
130
145
|
readonly destinationBranch: string;
|
|
131
146
|
readonly isMergeable: boolean;
|
|
132
147
|
readonly isApproved: boolean;
|
|
148
|
+
readonly approvalUnknownReason: "NotPermitted" | "ProviderFailed" | "Throttled" | null;
|
|
133
149
|
readonly commentCount: number | null;
|
|
134
150
|
readonly healthScore: number | null;
|
|
135
151
|
readonly link: string;
|
|
@@ -154,6 +170,10 @@ export declare const findStaleOpen: (sql: SqlClient.SqlClient) => (olderThan: st
|
|
|
154
170
|
readonly repositoryName: string;
|
|
155
171
|
readonly accountProfile: string & import("effect/Brand").Brand<"AwsProfileName">;
|
|
156
172
|
readonly accountRegion: string & import("effect/Brand").Brand<"AwsRegion">;
|
|
173
|
+
readonly lastModifiedDate: Date;
|
|
174
|
+
readonly observationSeq: number;
|
|
175
|
+
readonly approvalVersion: Date;
|
|
176
|
+
readonly approvalObservationSeq: number;
|
|
157
177
|
}[], CacheError, never>;
|
|
158
178
|
export declare const findOpenInRange: (sql: SqlClient.SqlClient) => (weekStart: string, weekEnd: string) => Effect.Effect<{
|
|
159
179
|
readonly id: string;
|
|
@@ -161,6 +181,10 @@ export declare const findOpenInRange: (sql: SqlClient.SqlClient) => (weekStart:
|
|
|
161
181
|
readonly repositoryName: string;
|
|
162
182
|
readonly accountProfile: string & import("effect/Brand").Brand<"AwsProfileName">;
|
|
163
183
|
readonly accountRegion: string & import("effect/Brand").Brand<"AwsRegion">;
|
|
184
|
+
readonly lastModifiedDate: Date;
|
|
185
|
+
readonly observationSeq: number;
|
|
186
|
+
readonly approvalVersion: Date;
|
|
187
|
+
readonly approvalObservationSeq: number;
|
|
164
188
|
}[], CacheError, never>;
|
|
165
189
|
export {};
|
|
166
190
|
//# 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,EAAQ,MAAM,EAAE,MAAM,EAAqB,MAAM,QAAQ,CAAA;AAChE,OAAO,KAAK,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAGtD,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;
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["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jD,CAAA;AAED,eAAO,MAAM,aAAa,QAAS,SAAS,CAAC,SAAS,iBAUjC,MAAM;;;;;;;;;;uBAC1B,CAAA;AAED,eAAO,MAAM,eAAe,QAAS,SAAS,CAAC,SAAS,iBAcnC,MAAM,WAAW,MAAM;;;;;;;;;;uBAC3C,CAAA"}
|
|
@@ -19,7 +19,12 @@ const StaleOpenRow = Schema.Struct({
|
|
|
19
19
|
awsAccountId: Schema.String,
|
|
20
20
|
repositoryName: Schema.String,
|
|
21
21
|
accountProfile: AwsProfileName,
|
|
22
|
-
accountRegion: AwsRegion
|
|
22
|
+
accountRegion: AwsRegion,
|
|
23
|
+
/** The row's version when read (with `observationSeq`); a write based on this read compares against it. */
|
|
24
|
+
lastModifiedDate: Schema.DateFromString,
|
|
25
|
+
observationSeq: Schema.Number,
|
|
26
|
+
approvalVersion: Schema.DateFromString,
|
|
27
|
+
approvalObservationSeq: Schema.Number
|
|
23
28
|
});
|
|
24
29
|
export const findAll = (sql) => {
|
|
25
30
|
const run = SqlSchema.findAll({
|
|
@@ -112,7 +117,8 @@ export const findStaleOpen = (sql) => {
|
|
|
112
117
|
const run = SqlSchema.findAll({
|
|
113
118
|
Result: StaleOpenRow,
|
|
114
119
|
Request: Schema.Struct({ olderThan: Schema.String }),
|
|
115
|
-
execute: (req) => sql `SELECT id, aws_account_id, repository_name, account_profile, account_region
|
|
120
|
+
execute: (req) => sql `SELECT id, aws_account_id, repository_name, account_profile, account_region, last_modified_date, observation_seq,
|
|
121
|
+
approval_version, approval_observation_seq
|
|
116
122
|
FROM pull_requests
|
|
117
123
|
WHERE status = 'OPEN' AND fetched_at < ${req.olderThan}`
|
|
118
124
|
});
|
|
@@ -122,7 +128,8 @@ export const findOpenInRange = (sql) => {
|
|
|
122
128
|
const run = SqlSchema.findAll({
|
|
123
129
|
Result: StaleOpenRow,
|
|
124
130
|
Request: Schema.Struct({ weekStart: Schema.String, weekEnd: Schema.String }),
|
|
125
|
-
execute: (req) => sql `SELECT id, aws_account_id, repository_name, account_profile, account_region
|
|
131
|
+
execute: (req) => sql `SELECT id, aws_account_id, repository_name, account_profile, account_region, last_modified_date, observation_seq,
|
|
132
|
+
approval_version, approval_observation_seq
|
|
126
133
|
FROM pull_requests
|
|
127
134
|
WHERE status = 'OPEN'
|
|
128
135
|
AND (
|
|
@@ -1 +1 @@
|
|
|
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;AAEhE,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,iBAAiB,IAAI,uBAAuB,EAAE,UAAU,EAAqB,MAAM,eAAe,CAAA;AAE3G,sFAAsF;AACtF,MAAM,OAAO,yBAA0B,SAAQ,IAAI,CAAC,WAAW,CAAC,2BAA2B,CAIzF;CAAG;AAEL,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;IACjC,EAAE,EAAE,MAAM,CAAC,MAAM;IACjB,YAAY,EAAE,MAAM,CAAC,MAAM;IAC3B,cAAc,EAAE,MAAM,CAAC,MAAM;IAC7B,cAAc,EAAE,cAAc;IAC9B,aAAa,EAAE,SAAS;
|
|
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;AAEhE,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AACjD,OA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,CAAC,SAAiB,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAA;AACpF,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAwB,EAAE,EAAE;IAC1D,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC;QAC5B,MAAM,EAAE,YAAY;QACpB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;QAC5E,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CACf,GAAG,CAAA;;;;;kCAKyB,GAAG,CAAC,SAAS,wBAAwB,GAAG,CAAC,OAAO;0CACxC,GAAG,CAAC,SAAS,6BAA6B,GAAG,CAAC,OAAO;cACjF;KACX,CAAC,CAAA;IACF,OAAO,CAAC,SAAiB,EAAE,OAAe,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAA;AAChH,CAAC,CAAA"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module PullRequestRepo/rowWrites
|
|
3
|
+
*
|
|
4
|
+
* The only writers of `pull_requests` rows. A row has two versioned column groups and some
|
|
5
|
+
* recomputed columns:
|
|
6
|
+
*
|
|
7
|
+
* - the row group (title, description, author, status, branches, mergeability, approvers, merge and
|
|
8
|
+
* close details), versioned by `last_modified_date`/`observation_seq`;
|
|
9
|
+
* - the approval group (`is_approved`, `approval_unknown_reason`, `approval_rules`), versioned by
|
|
10
|
+
* `approval_version`/`approval_observation_seq`;
|
|
11
|
+
* - recomputed columns (diff stats, comment count, health score, commenters), which carry no version.
|
|
12
|
+
*
|
|
13
|
+
* A version is (provider last activity, observation number), compared in that order. `observe` takes
|
|
14
|
+
* the observation from the database in one statement, before the provider call, so two reads of the
|
|
15
|
+
* same revision are ordered by when they began.
|
|
16
|
+
*
|
|
17
|
+
* Three rules close the class of "an older read overwrites a newer one":
|
|
18
|
+
*
|
|
19
|
+
* 1. A provider read writes whole groups only: `upsert` and `writeRead` take a complete `RowGroup`
|
|
20
|
+
* and `ApprovalGroup`, and each group is written unless its version is newer than the read's.
|
|
21
|
+
* 2. A recomputed write never moves a version: `writeDerived` applies only while both groups still
|
|
22
|
+
* hold exactly the versions it read, so a value computed from an older row is dropped.
|
|
23
|
+
* 3. A tombstone keeps the later of the two groups' versions, so a deletion forgets neither.
|
|
24
|
+
*
|
|
25
|
+
* Two set-based writes carry no version: filling a NULL `repo_account_id` (it never replaces a value),
|
|
26
|
+
* and deleting rows not fetched since a cutoff (cache expiry, not a provider observation).
|
|
27
|
+
* `ast-grep/rules/typescript/no-direct-pull-request-row-write.yml` keeps every other path out.
|
|
28
|
+
*
|
|
29
|
+
* @category CacheService
|
|
30
|
+
*/
|
|
31
|
+
import { Effect } from "effect";
|
|
32
|
+
import type * as SqlClient from "effect/sql/SqlClient";
|
|
33
|
+
import type * as Statement from "effect/sql/Statement";
|
|
34
|
+
import { type UpsertInput } from "./internal.js";
|
|
35
|
+
declare const ObservationSequenceMissing_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 & {
|
|
36
|
+
readonly _tag: "ObservationSequenceMissing";
|
|
37
|
+
} & Readonly<A>;
|
|
38
|
+
/**
|
|
39
|
+
* The `observation_sequence` row is missing, so no observation number can be taken. Without one, reads
|
|
40
|
+
* of the same revision can't be ordered; callers skip the read instead.
|
|
41
|
+
*/
|
|
42
|
+
export declare class ObservationSequenceMissing extends ObservationSequenceMissing_base<{}> {
|
|
43
|
+
}
|
|
44
|
+
/** A version: the provider last activity a read saw, and the observation it came from. */
|
|
45
|
+
export interface RowVersion {
|
|
46
|
+
readonly lastActivity: Date;
|
|
47
|
+
readonly observation: number;
|
|
48
|
+
}
|
|
49
|
+
/** Both groups' versions, as a read of the row saw them. */
|
|
50
|
+
export interface RowVersions {
|
|
51
|
+
readonly row: RowVersion;
|
|
52
|
+
readonly approval: RowVersion;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The row group, complete: a provider read has every column of it. `approvedBy` null keeps the
|
|
56
|
+
* approvers already stored (they accumulate across reads).
|
|
57
|
+
*/
|
|
58
|
+
export interface RowGroup {
|
|
59
|
+
readonly title: string;
|
|
60
|
+
readonly description: string | null;
|
|
61
|
+
readonly author: string;
|
|
62
|
+
readonly status: string;
|
|
63
|
+
readonly creationDate: string;
|
|
64
|
+
readonly sourceBranch: string;
|
|
65
|
+
readonly destinationBranch: string;
|
|
66
|
+
readonly isMergeable: boolean;
|
|
67
|
+
readonly approvedBy: ReadonlyArray<string>;
|
|
68
|
+
readonly approvedByArns: ReadonlyArray<string>;
|
|
69
|
+
readonly mergedBy: string | null;
|
|
70
|
+
readonly closedAt: string | null;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The approval group, complete. While `unknownReason` is set, the stored approval and rules are kept
|
|
74
|
+
* as the last known value and only the reason is written.
|
|
75
|
+
*/
|
|
76
|
+
export interface ApprovalGroup {
|
|
77
|
+
readonly isApproved: boolean;
|
|
78
|
+
readonly approvalRules: UpsertInput["approvalRules"];
|
|
79
|
+
readonly unknownReason: string | null;
|
|
80
|
+
}
|
|
81
|
+
/** Recomputed columns: any subset, written without a version. */
|
|
82
|
+
export interface DerivedColumns {
|
|
83
|
+
readonly filesAdded?: number;
|
|
84
|
+
readonly filesModified?: number;
|
|
85
|
+
readonly filesDeleted?: number;
|
|
86
|
+
readonly commentCount?: number | null;
|
|
87
|
+
readonly healthScore?: number | null;
|
|
88
|
+
readonly commentedBy?: string | null;
|
|
89
|
+
}
|
|
90
|
+
/** Which column groups a provider read wrote, and the versions the row now holds. */
|
|
91
|
+
export interface GroupsWritten {
|
|
92
|
+
readonly row: boolean;
|
|
93
|
+
readonly approval: boolean;
|
|
94
|
+
/** The row's versions after the write; absent when the row doesn't exist (a tombstone kept it out). */
|
|
95
|
+
readonly versions: RowVersions | undefined;
|
|
96
|
+
}
|
|
97
|
+
export declare const rowWrites: (sql: SqlClient.SqlClient) => {
|
|
98
|
+
/** The next observation number, taken before a provider read. Fails when the sequence row is missing. */
|
|
99
|
+
observe: () => Effect.Effect<number, ObservationSequenceMissing | import("effect/sql/SqlError").SqlError, never>;
|
|
100
|
+
/**
|
|
101
|
+
* Insert a listed pull request, or write each of its groups unless that group is newer. A deleted
|
|
102
|
+
* pull request comes back only from a read that began after the deletion, of a revision no older
|
|
103
|
+
* than the deleted row's. Recomputed columns are set only on insert; afterwards only
|
|
104
|
+
* `writeDerived` changes them.
|
|
105
|
+
*/
|
|
106
|
+
upsert: (req: typeof UpsertInput.Encoded, row: RowGroup, approval: ApprovalGroup, observation: number) => Effect.Effect<GroupsWritten, import("effect/sql/SqlError").SqlError, never>;
|
|
107
|
+
/** Write a provider re-read of an existing row: each group unless that group is newer. */
|
|
108
|
+
writeRead: (where: Statement.Fragment, version: RowVersion, row: RowGroup, approval: ApprovalGroup) => Effect.Effect<GroupsWritten, import("effect/sql/SqlError").SqlError, never>;
|
|
109
|
+
/**
|
|
110
|
+
* Write recomputed columns, only while both groups hold exactly the versions `observed` saw: a value
|
|
111
|
+
* computed from an older row is dropped. Moves no version. True when the row was written.
|
|
112
|
+
*/
|
|
113
|
+
writeDerived: (where: Statement.Fragment, observed: RowVersions, columns: DerivedColumns) => Effect.Effect<boolean, import("effect/sql/SqlError").SqlError, never>;
|
|
114
|
+
/**
|
|
115
|
+
* Delete the row matched by `where` for a not-found read begun at `observation`, unless a read that
|
|
116
|
+
* began later has written either group since. A not-found answer carries no revision, so only its
|
|
117
|
+
* observation orders it. The tombstone keeps the later of the two groups' versions and
|
|
118
|
+
* `observation`. True when the row was deleted.
|
|
119
|
+
*/
|
|
120
|
+
deleteIfNotNewer: (where: Statement.Fragment, observation: number) => Effect.Effect<boolean, import("effect/sql/SqlError").SqlError, never>;
|
|
121
|
+
/**
|
|
122
|
+
* Cache expiry: delete rows (only OPEN ones with `openOnly`) not fetched since `olderThan`, and
|
|
123
|
+
* tombstones of deletions made before it (both on the cache clock), which no read in flight can
|
|
124
|
+
* still be behind.
|
|
125
|
+
*/
|
|
126
|
+
deleteFetchedBefore: (olderThan: string, openOnly: boolean) => Effect.Effect<readonly import("effect/sql/SqlConnection").Row[], import("effect/sql/SqlError").SqlError, never>;
|
|
127
|
+
/** Fill a NULL `repo_account_id` from another row of the same repository; an existing value is kept. */
|
|
128
|
+
fillRepoAccountIds: () => Statement.Statement<import("effect/sql/SqlConnection").Row>;
|
|
129
|
+
};
|
|
130
|
+
export {};
|
|
131
|
+
//# sourceMappingURL=rowWrites.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rowWrites.d.ts","sourceRoot":"","sources":["../../../../src/CacheService/repos/PullRequestRepo/rowWrites.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAQ,MAAM,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,KAAK,SAAS,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,KAAK,SAAS,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;;;;AAEhE;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,gCAA+C,EAAE,CAAC;CAAG;AAErG,0FAA0F;AAC1F,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAA;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B;AAED,4DAA4D;AAC5D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,GAAG,EAAE,U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