backport 5.6.6 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -39
- package/dist/entrypoint.cli.js +1 -1
- package/dist/entrypoint.module.d.ts +6 -5
- package/dist/entrypoint.module.js +8 -6
- package/dist/ink.d.ts +1 -0
- package/dist/ink.js +49 -0
- package/dist/main.d.ts +11 -6
- package/dist/main.js +40 -24
- package/dist/options/ConfigOptions.d.ts +13 -8
- package/dist/options/cliArgs.d.ts +11 -9
- package/dist/options/cliArgs.js +74 -36
- package/dist/options/cliArgs.test.js +33 -37
- package/dist/options/config/config.d.ts +17 -15
- package/dist/options/config/config.js +8 -8
- package/dist/options/config/config.test.js +3 -2
- package/dist/options/config/getOptionsFromGit.js +1 -1
- package/dist/options/config/globalConfig.d.ts +2 -51
- package/dist/options/config/globalConfig.js +8 -8
- package/dist/options/config/globalConfig.test.js +7 -3
- package/dist/options/config/projectConfig.d.ts +2 -51
- package/dist/options/config/projectConfig.js +2 -2
- package/dist/options/config/projectConfig.test.js +3 -3
- package/dist/options/config/readConfigFile.d.ts +2 -51
- package/dist/options/config/readConfigFile.js +2 -2
- package/dist/options/options.d.ts +19 -14
- package/dist/options/options.js +5 -6
- package/dist/options/options.test.js +48 -11
- package/dist/options/parseRequiredOptions.d.ts +18 -13
- package/dist/options/parseRequiredOptions.js +8 -12
- package/dist/options/parseRequiredOptions.test.js +25 -16
- package/dist/runSequentially.d.ts +20 -0
- package/dist/runSequentially.js +41 -0
- package/dist/runSequentially.test.d.ts +1 -0
- package/dist/runSequentially.test.js +235 -0
- package/dist/runWithOptions.js +7 -14
- package/dist/runWithOptions.test.js +138 -17
- package/dist/scripts/generate-gql.d.ts +1 -0
- package/dist/scripts/generate-gql.js +15 -0
- package/dist/scripts/postinstall.js +4 -4
- package/dist/scripts/postinstall.test.js +9 -2
- package/dist/scripts/runPostinstall.js +1 -1
- package/dist/services/HandledError.d.ts +11 -1
- package/dist/services/HandledError.js +2 -1
- package/dist/services/child-process-promisified.d.ts +1 -1
- package/dist/services/child-process-promisified.js +1 -1
- package/dist/services/env.js +5 -5
- package/dist/services/env.test.js +11 -4
- package/dist/services/fs-promisified.js +4 -4
- package/dist/services/getExpectedTarget.d.ts +9 -0
- package/dist/services/getExpectedTarget.js +77 -0
- package/dist/services/getExpectedTargetPullRequests.d.ts +9 -0
- package/dist/services/getExpectedTargetPullRequests.js +77 -0
- package/dist/services/git.d.ts +15 -4
- package/dist/services/git.integration.test.d.ts +1 -0
- package/dist/services/git.integration.test.js +168 -0
- package/dist/services/git.js +86 -61
- package/dist/services/git.test.js +61 -64
- package/dist/services/github/commitFormatters.d.ts +3 -7
- package/dist/services/github/commitFormatters.js +10 -19
- package/dist/services/github/commitFormatters.test.js +2 -24
- package/dist/services/github/v3/addAssigneesToPullRequest.d.ts +1 -1
- package/dist/services/github/v3/addAssigneesToPullRequest.js +2 -6
- package/dist/services/github/v3/addAssigneesToPullRequest.test.js +2 -3
- package/dist/services/github/v3/addLabelsToPullRequest.d.ts +1 -1
- package/dist/services/github/v3/addLabelsToPullRequest.js +2 -6
- package/dist/services/github/v3/addReviewersToPullRequest.d.ts +2 -0
- package/dist/services/github/v3/addReviewersToPullRequest.js +34 -0
- package/dist/services/github/v3/createPullRequest.d.ts +3 -2
- package/dist/services/github/v3/createPullRequest.js +32 -23
- package/dist/services/github/v3/createStatusComment.d.ts +11 -0
- package/dist/services/github/v3/createStatusComment.js +97 -0
- package/dist/services/github/v3/createStatusComment.test.d.ts +1 -0
- package/dist/services/github/v3/createStatusComment.test.js +209 -0
- package/dist/services/github/v4/FetchPullRequestId.js +1 -1
- package/dist/services/github/v4/apiRequestV4.d.ts +1 -1
- package/dist/services/github/v4/apiRequestV4.js +5 -7
- package/dist/services/github/v4/apiRequestV4.test.js +7 -7
- package/dist/services/github/v4/disablePullRequestAutoMerge.js +3 -4
- package/dist/services/github/v4/enablePullRequestAutoMerge.js +8 -7
- package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.js +94 -33
- package/dist/services/github/v4/fetchAuthorId.js +1 -1
- package/dist/services/github/v4/fetchAuthorId.private.test.js +3 -3
- package/dist/services/github/v4/fetchCommitByPullNumber.js +11 -9
- package/dist/services/github/v4/fetchCommitByPullNumber.private.test.js +4 -4
- package/dist/services/github/v4/fetchCommitBySha.js +14 -12
- package/dist/services/github/v4/fetchCommitBySha.private.test.js +4 -4
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +5 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +46 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +67 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.d.ts +5 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +36 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +55 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +16 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +90 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +130 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +127 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.d.ts +28 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.js +52 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +10 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +49 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +81 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.js +252 -0
- package/dist/services/github/v4/fetchCommitsByAuthor.d.ts +2 -1
- package/dist/services/github/v4/fetchCommitsByAuthor.js +81 -70
- package/dist/services/github/v4/fetchCommitsByAuthor.private.test.js +78 -5
- package/dist/services/github/v4/fetchCommitsByAuthor.test.js +29 -21
- package/dist/services/github/v4/fetchDefaultBranch.js +1 -1
- package/dist/services/github/v4/fetchExistingPullRequest.js +2 -3
- package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +3 -3
- package/dist/services/github/v4/fetchMergedPullRequests.d.ts +18 -19
- package/dist/services/github/v4/fetchMergedPullRequests.js +22 -69
- package/dist/services/github/v4/fetchMergedPullRequests.private.test.js +8 -9
- package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.js +2 -3
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.js +12 -10
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.js +3 -3
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.js +2 -2
- package/dist/services/github/v4/getExistingTargetPullRequests.d.ts +4 -58
- package/dist/services/github/v4/getExistingTargetPullRequests.js +3 -58
- package/dist/services/github/v4/getOptionsFromGithub/index.d.ts +16 -10
- package/dist/services/github/v4/getOptionsFromGithub/index.js +52 -22
- package/dist/services/github/v4/getOptionsFromGithub/index.private.test.js +25 -7
- package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +13 -16
- package/dist/services/github/v4/getOptionsFromGithub/query.js +13 -15
- package/dist/services/github/v4/getTargetBranchesFromLabels.d.ts +0 -7
- package/dist/services/github/v4/getTargetBranchesFromLabels.js +1 -26
- package/dist/services/github/v4/getTargetBranchesFromLabels.test.js +69 -32
- package/dist/services/github/v4/mocks/commitsByAuthorMock.d.ts +2 -2
- package/dist/services/github/v4/mocks/commitsByAuthorMock.js +39 -25
- package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.d.ts +1 -1
- package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.js +10 -0
- package/dist/services/github/v4/mocks/getCommitsByAuthorMock.d.ts +1 -1
- package/dist/services/github/v4/mocks/getCommitsByAuthorMock.js +2 -0
- package/dist/services/github/v4/mocks/getPullRequestNodeMock.d.ts +1 -1
- package/dist/services/github/v4/mocks/getPullRequestNodeMock.js +1 -0
- package/dist/services/github/v4/throwOnInvalidAccessToken.js +10 -15
- package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +7 -7
- package/dist/services/logger.d.ts +3 -3
- package/dist/services/logger.js +16 -15
- package/dist/services/prompt.test.d.ts +1 -0
- package/dist/services/prompt.test.js +87 -0
- package/dist/services/prompts.d.ts +10 -4
- package/dist/services/prompts.js +85 -22
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.d.ts +9 -0
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +92 -0
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.d.ts +1 -0
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +396 -0
- package/dist/services/sourceCommit/getMockSourceCommit.d.ts +21 -0
- package/dist/services/sourceCommit/getMockSourceCommit.js +67 -0
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.d.ts +5 -0
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.js +20 -0
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.d.ts +1 -0
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.js +201 -0
- package/dist/services/sourceCommit/parseSourceCommit.d.ts +78 -0
- package/dist/services/sourceCommit/parseSourceCommit.js +96 -0
- package/dist/services/sourceCommit/parseSourceCommit.test.d.ts +1 -0
- package/dist/services/sourceCommit/parseSourceCommit.test.js +114 -0
- package/dist/services/sourceCommit/sourceCommit.d.ts +78 -0
- package/dist/services/sourceCommit/sourceCommit.js +86 -0
- package/dist/services/sourceCommit/sourceCommit.test.d.ts +1 -0
- package/dist/services/sourceCommit/sourceCommit.test.js +287 -0
- package/dist/services/sourceCommit.d.ts +78 -0
- package/dist/services/sourceCommit.js +86 -0
- package/dist/services/sourceCommit.test.d.ts +1 -0
- package/dist/services/sourceCommit.test.js +280 -0
- package/dist/test/inquirer.private.test.js +22 -15
- package/dist/test/integration/createSpies.js +6 -6
- package/dist/test/integration/envConstants.js +5 -6
- package/dist/test/integration/helpers.js +1 -1
- package/dist/test/integration/integration.private.test.d.ts +1 -0
- package/dist/test/integration/integration.private.test.js +308 -0
- package/dist/test/integration/integration.test.js +28 -29
- package/dist/test/nockHelpers.js +3 -7
- package/dist/test/setupFiles/automatic-mocks.d.ts +0 -1
- package/dist/test/setupFiles/automatic-mocks.js +0 -22
- package/dist/types/Commit.d.ts +85 -0
- package/dist/types/Commit.js +139 -0
- package/dist/types/commitNode.d.ts +89 -0
- package/dist/types/commitNode.js +139 -0
- package/dist/types/commitNode.test.d.ts +1 -0
- package/dist/types/commitNode.test.js +255 -0
- package/dist/types/commitWithAssociatedPullRequests.d.ts +86 -0
- package/dist/types/commitWithAssociatedPullRequests.js +145 -0
- package/dist/ui/cherrypickAndCreatePullRequest.test.js +277 -59
- package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +11 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +131 -68
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.d.ts +1 -0
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +468 -0
- package/dist/ui/getCommits.d.ts +1 -1
- package/dist/ui/getCommits.js +55 -25
- package/dist/ui/getTargetBranches.d.ts +2 -2
- package/dist/ui/getTargetBranches.js +16 -17
- package/dist/ui/getTargetBranches.test.js +75 -99
- package/dist/ui/getTargetBranchesFromLabels.d.ts +6 -0
- package/dist/ui/getTargetBranchesFromLabels.js +40 -0
- package/dist/ui/getTargetBranchesFromLabels.test.d.ts +1 -0
- package/dist/ui/getTargetBranchesFromLabels.test.js +288 -0
- package/dist/ui/maybeSetupRepo.js +9 -9
- package/dist/ui/maybeSetupRepo.test.js +5 -1
- package/package.json +36 -51
- package/yarn.lock +2387 -2987
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchCommitsByAuthor = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const filterEmpty_1 = require("../../../../utils/filterEmpty");
|
|
6
|
+
const HandledError_1 = require("../../../HandledError");
|
|
7
|
+
const parseSourceCommit_1 = require("../../../sourceCommit/parseSourceCommit");
|
|
8
|
+
const apiRequestV4_1 = require("../apiRequestV4");
|
|
9
|
+
const fetchAuthorId_1 = require("../fetchAuthorId");
|
|
10
|
+
function fetchByCommitPath({ options, authorId, commitPath, }) {
|
|
11
|
+
const { accessToken, githubApiBaseUrlV4, maxNumber, repoName, repoOwner, sourceBranch, } = options;
|
|
12
|
+
const query = /* GraphQL */ `
|
|
13
|
+
query CommitsByAuthor(
|
|
14
|
+
$repoOwner: String!
|
|
15
|
+
$repoName: String!
|
|
16
|
+
$maxNumber: Int!
|
|
17
|
+
$sourceBranch: String!
|
|
18
|
+
$authorId: ID
|
|
19
|
+
$commitPath: String
|
|
20
|
+
) {
|
|
21
|
+
repository(owner: $repoOwner, name: $repoName) {
|
|
22
|
+
ref(qualifiedName: $sourceBranch) {
|
|
23
|
+
target {
|
|
24
|
+
... on Commit {
|
|
25
|
+
history(
|
|
26
|
+
first: $maxNumber
|
|
27
|
+
author: { id: $authorId }
|
|
28
|
+
path: $commitPath
|
|
29
|
+
) {
|
|
30
|
+
edges {
|
|
31
|
+
node {
|
|
32
|
+
...${parseSourceCommit_1.sourceCommitWithTargetPullRequestFragment.name}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
${parseSourceCommit_1.sourceCommitWithTargetPullRequestFragment.source}
|
|
43
|
+
`;
|
|
44
|
+
return (0, apiRequestV4_1.apiRequestV4)({
|
|
45
|
+
githubApiBaseUrlV4,
|
|
46
|
+
accessToken,
|
|
47
|
+
query,
|
|
48
|
+
variables: {
|
|
49
|
+
repoOwner,
|
|
50
|
+
repoName,
|
|
51
|
+
sourceBranch,
|
|
52
|
+
maxNumber,
|
|
53
|
+
authorId,
|
|
54
|
+
commitPath,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async function fetchCommitsByAuthor(options) {
|
|
59
|
+
const { sourceBranch, commitPaths } = options;
|
|
60
|
+
const authorId = await (0, fetchAuthorId_1.fetchAuthorId)(options);
|
|
61
|
+
const responses = await Promise.all((0, lodash_1.isEmpty)(commitPaths)
|
|
62
|
+
? [fetchByCommitPath({ options, authorId, commitPath: null })]
|
|
63
|
+
: commitPaths.map((commitPath) => fetchByCommitPath({ options, authorId, commitPath })));
|
|
64
|
+
// we only need to check if the first item is `null` (if the first is `null` they all are)
|
|
65
|
+
if (responses[0].repository.ref === null) {
|
|
66
|
+
throw new HandledError_1.HandledError(`The upstream branch "${sourceBranch}" does not exist. Try specifying a different branch with "--source-branch <your-branch>"`);
|
|
67
|
+
}
|
|
68
|
+
const commits = responses
|
|
69
|
+
.flatMap((res) => {
|
|
70
|
+
return res.repository.ref?.target.history.edges.map((edge) => {
|
|
71
|
+
const sourceCommit = edge.node;
|
|
72
|
+
return (0, parseSourceCommit_1.parseSourceCommit)({ options, sourceCommit });
|
|
73
|
+
});
|
|
74
|
+
})
|
|
75
|
+
.filter(filterEmpty_1.filterNil);
|
|
76
|
+
// terminate if not commits were found
|
|
77
|
+
if ((0, lodash_1.isEmpty)(commits)) {
|
|
78
|
+
const pathText = options.commitPaths.length > 0
|
|
79
|
+
? ` touching files in path: "${options.commitPaths}"`
|
|
80
|
+
: '';
|
|
81
|
+
const errorText = options.all
|
|
82
|
+
? `There are no commits in this repository${pathText}`
|
|
83
|
+
: `There are no commits by "${options.author}" in this repository${pathText}. Try with \`--all\` for commits by all users or \`--author=<username>\` for commits from a specific user`;
|
|
84
|
+
throw new HandledError_1.HandledError(errorText);
|
|
85
|
+
}
|
|
86
|
+
const commitsUnique = (0, lodash_1.uniqBy)(commits, 'sha');
|
|
87
|
+
const commitsSorted = (0, lodash_1.orderBy)(commitsUnique, 'committedDate', 'desc');
|
|
88
|
+
return commitsSorted;
|
|
89
|
+
}
|
|
90
|
+
exports.fetchCommitsByAuthor = fetchCommitsByAuthor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const getDevAccessToken_1 = require("../../../../test/private/getDevAccessToken");
|
|
4
|
+
const fetchCommitsByAuthor_1 = require("./fetchCommitsByAuthor");
|
|
5
|
+
describe('fetchCommitsByAuthor', () => {
|
|
6
|
+
let devAccessToken;
|
|
7
|
+
beforeAll(async () => {
|
|
8
|
+
devAccessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
|
|
9
|
+
});
|
|
10
|
+
describe('commitPaths', () => {
|
|
11
|
+
const getOptions = () => ({
|
|
12
|
+
repoOwner: 'backport-org',
|
|
13
|
+
repoName: 'repo-with-different-commit-paths',
|
|
14
|
+
sourceBranch: 'main',
|
|
15
|
+
accessToken: devAccessToken,
|
|
16
|
+
username: 'sqren',
|
|
17
|
+
author: 'sqren',
|
|
18
|
+
maxNumber: 10,
|
|
19
|
+
githubApiBaseUrlV4: 'https://api.github.com/graphql',
|
|
20
|
+
});
|
|
21
|
+
const getCommitMessages = (commits) => {
|
|
22
|
+
return commits.map((c) => c.originalMessage.replace(/(\r\n|\n|\r)/gm, ''));
|
|
23
|
+
};
|
|
24
|
+
it('returns all commits', async () => {
|
|
25
|
+
const commits = await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)({
|
|
26
|
+
...getOptions(),
|
|
27
|
+
commitPaths: [],
|
|
28
|
+
});
|
|
29
|
+
const commitMessages = getCommitMessages(commits);
|
|
30
|
+
expect(commitMessages).toEqual([
|
|
31
|
+
'Edit all lyrics',
|
|
32
|
+
'Update .backportrc.json',
|
|
33
|
+
'Edit "Take on me"',
|
|
34
|
+
'Add backportrc.json',
|
|
35
|
+
'Add "Bohemian Rhapsody""',
|
|
36
|
+
'Add "99 Luftballons"',
|
|
37
|
+
'Add "Take on me"',
|
|
38
|
+
]);
|
|
39
|
+
});
|
|
40
|
+
it('only returns commits related to "99-luftballons.txt"', async () => {
|
|
41
|
+
const commits = await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)({
|
|
42
|
+
...getOptions(),
|
|
43
|
+
commitPaths: ['lyrics/99-luftballons.txt'],
|
|
44
|
+
});
|
|
45
|
+
const commitMessages = getCommitMessages(commits);
|
|
46
|
+
expect(commitMessages).toEqual([
|
|
47
|
+
'Edit all lyrics',
|
|
48
|
+
'Add "99 Luftballons"',
|
|
49
|
+
]);
|
|
50
|
+
});
|
|
51
|
+
it('only returns commits related to "take-on-me.txt"', async () => {
|
|
52
|
+
const commits = await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)({
|
|
53
|
+
...getOptions(),
|
|
54
|
+
commitPaths: ['lyrics/take-on-me.txt'],
|
|
55
|
+
});
|
|
56
|
+
const commitMessages = getCommitMessages(commits);
|
|
57
|
+
expect(commitMessages).toEqual([
|
|
58
|
+
'Edit all lyrics',
|
|
59
|
+
'Edit "Take on me"',
|
|
60
|
+
'Add "Take on me"',
|
|
61
|
+
]);
|
|
62
|
+
});
|
|
63
|
+
it('removes duplicates and order by `committedDate`', async () => {
|
|
64
|
+
const commits = await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)({
|
|
65
|
+
...getOptions(),
|
|
66
|
+
commitPaths: [
|
|
67
|
+
'lyrics/99-luftballons.txt',
|
|
68
|
+
'lyrics/take-on-me.txt',
|
|
69
|
+
'lyrics/bohemian-rhapsody.txt',
|
|
70
|
+
],
|
|
71
|
+
});
|
|
72
|
+
const commitMessages = getCommitMessages(commits);
|
|
73
|
+
expect(commitMessages).toEqual([
|
|
74
|
+
'Edit all lyrics',
|
|
75
|
+
'Edit "Take on me"',
|
|
76
|
+
'Add "Bohemian Rhapsody""',
|
|
77
|
+
'Add "99 Luftballons"',
|
|
78
|
+
'Add "Take on me"',
|
|
79
|
+
]);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
describe('expectedTargetPullRequests', () => {
|
|
83
|
+
let res;
|
|
84
|
+
beforeEach(async () => {
|
|
85
|
+
res = await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)({
|
|
86
|
+
repoOwner: 'backport-org',
|
|
87
|
+
repoName: 'backport-e2e',
|
|
88
|
+
sourceBranch: 'master',
|
|
89
|
+
accessToken: devAccessToken,
|
|
90
|
+
username: 'sqren',
|
|
91
|
+
author: 'sqren',
|
|
92
|
+
maxNumber: 10,
|
|
93
|
+
githubApiBaseUrlV4: 'https://api.github.com/graphql',
|
|
94
|
+
commitPaths: [],
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
it('returns related OPEN PRs', async () => {
|
|
98
|
+
const commitWithOpenPR = res.find((commit) => commit.pullNumber === 9);
|
|
99
|
+
expect(commitWithOpenPR?.expectedTargetPullRequests).toEqual([
|
|
100
|
+
{
|
|
101
|
+
branch: '7.8',
|
|
102
|
+
state: 'OPEN',
|
|
103
|
+
number: 10,
|
|
104
|
+
url: 'https://github.com/backport-org/backport-e2e/pull/10',
|
|
105
|
+
},
|
|
106
|
+
]);
|
|
107
|
+
});
|
|
108
|
+
it('returns related MERGED PRs', async () => {
|
|
109
|
+
const commitWithMergedPRs = res.find((commit) => commit.pullNumber === 5);
|
|
110
|
+
expect(commitWithMergedPRs?.expectedTargetPullRequests).toEqual([
|
|
111
|
+
{
|
|
112
|
+
branch: '7.x',
|
|
113
|
+
state: 'MERGED',
|
|
114
|
+
number: 6,
|
|
115
|
+
url: 'https://github.com/backport-org/backport-e2e/pull/6',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
branch: '7.8',
|
|
119
|
+
state: 'MERGED',
|
|
120
|
+
number: 7,
|
|
121
|
+
url: 'https://github.com/backport-org/backport-e2e/pull/7',
|
|
122
|
+
},
|
|
123
|
+
]);
|
|
124
|
+
});
|
|
125
|
+
it('returns empty if there are no related PRs', async () => {
|
|
126
|
+
const commitWithoutPRs = res.find((commit) => commit.pullNumber === 8);
|
|
127
|
+
expect(commitWithoutPRs?.expectedTargetPullRequests).toEqual([]);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const nock_1 = __importDefault(require("nock"));
|
|
7
|
+
const nockHelpers_1 = require("../../../../test/nockHelpers");
|
|
8
|
+
const commitsByAuthorMock_1 = require("../mocks/commitsByAuthorMock");
|
|
9
|
+
const fetchCommitsByAuthor_1 = require("./fetchCommitsByAuthor");
|
|
10
|
+
const defaultOptions = {
|
|
11
|
+
repoOwner: 'elastic',
|
|
12
|
+
repoName: 'kibana',
|
|
13
|
+
sourceBranch: 'source-branch-from-options',
|
|
14
|
+
accessToken: 'myAccessToken',
|
|
15
|
+
username: 'sqren',
|
|
16
|
+
author: 'sqren',
|
|
17
|
+
maxNumber: 10,
|
|
18
|
+
githubApiBaseUrlV3: 'https://api.github.com',
|
|
19
|
+
githubApiBaseUrlV4: 'http://localhost/graphql',
|
|
20
|
+
commitPaths: [],
|
|
21
|
+
};
|
|
22
|
+
const authorIdMockData = { user: { id: 'myUserId' } };
|
|
23
|
+
describe('fetchCommitsByAuthor', () => {
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
jest.clearAllMocks();
|
|
26
|
+
});
|
|
27
|
+
afterEach(() => {
|
|
28
|
+
nock_1.default.cleanAll();
|
|
29
|
+
});
|
|
30
|
+
describe('when commit has an associated pull request', () => {
|
|
31
|
+
let res;
|
|
32
|
+
let authorIdCalls;
|
|
33
|
+
let commitsByAuthorCalls;
|
|
34
|
+
beforeEach(async () => {
|
|
35
|
+
authorIdCalls = (0, nockHelpers_1.mockGqlRequest)({
|
|
36
|
+
name: 'AuthorId',
|
|
37
|
+
statusCode: 200,
|
|
38
|
+
body: { data: authorIdMockData },
|
|
39
|
+
});
|
|
40
|
+
commitsByAuthorCalls = (0, nockHelpers_1.mockGqlRequest)({
|
|
41
|
+
name: 'CommitsByAuthor',
|
|
42
|
+
statusCode: 200,
|
|
43
|
+
body: { data: commitsByAuthorMock_1.commitsByAuthorMock },
|
|
44
|
+
});
|
|
45
|
+
res = await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)(defaultOptions);
|
|
46
|
+
});
|
|
47
|
+
it('should return a list of commits with pullNumber and existing backports', () => {
|
|
48
|
+
const expectedCommits = [
|
|
49
|
+
{
|
|
50
|
+
committedDate: '2021-12-24T00:00:00Z',
|
|
51
|
+
sha: '2e63475c483f7844b0f2833bc57fdee32095bacb',
|
|
52
|
+
originalMessage: 'Add 👻',
|
|
53
|
+
expectedTargetPullRequests: [],
|
|
54
|
+
sourceBranch: 'source-branch-from-options',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
committedDate: '2021-12-23T00:00:00Z',
|
|
58
|
+
sha: 'f3b618b9421fdecdb36862f907afbdd6344b361d',
|
|
59
|
+
originalMessage: 'Add witch (#85)',
|
|
60
|
+
pullNumber: 85,
|
|
61
|
+
pullUrl: 'https://github.com/elastic/kibana/pull/85',
|
|
62
|
+
expectedTargetPullRequests: [],
|
|
63
|
+
sourceBranch: 'master',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
committedDate: '2021-12-22T00:00:00Z',
|
|
67
|
+
sha: '79cf18453ec32a4677009dcbab1c9c8c73fc14fe',
|
|
68
|
+
originalMessage: 'Add SF mention (#80)\n\n* Add SF mention\r\n\r\n* Add several emojis!',
|
|
69
|
+
pullNumber: 80,
|
|
70
|
+
pullUrl: 'https://github.com/elastic/kibana/pull/80',
|
|
71
|
+
expectedTargetPullRequests: [
|
|
72
|
+
{
|
|
73
|
+
branch: '6.3',
|
|
74
|
+
state: 'MERGED',
|
|
75
|
+
number: 99,
|
|
76
|
+
url: 'https://github.com/elastic/kibana/pull/99',
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
sourceBranch: 'master',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
committedDate: '2021-12-21T00:00:00Z',
|
|
83
|
+
sha: '3827bbbaf39914eda4f02f6940189844375fd097',
|
|
84
|
+
originalMessage: 'Add backport config',
|
|
85
|
+
expectedTargetPullRequests: [],
|
|
86
|
+
sourceBranch: 'source-branch-from-options',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
committedDate: '2021-12-20T00:00:00Z',
|
|
90
|
+
sha: '5ea0da550ac191029459289d67f99ad7d310812b',
|
|
91
|
+
originalMessage: 'Initial commit',
|
|
92
|
+
expectedTargetPullRequests: [],
|
|
93
|
+
sourceBranch: 'source-branch-from-options',
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
expect(res).toEqual(expectedCommits);
|
|
97
|
+
});
|
|
98
|
+
it('should call with correct args to fetch author id', () => {
|
|
99
|
+
expect(authorIdCalls).toMatchSnapshot();
|
|
100
|
+
});
|
|
101
|
+
it('should call with correct args to fetch commits', () => {
|
|
102
|
+
expect(commitsByAuthorCalls).toMatchSnapshot();
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
describe('when a custom github api hostname is supplied', () => {
|
|
106
|
+
it('should be used in gql requests', async () => {
|
|
107
|
+
const authorIdCalls = (0, nockHelpers_1.mockGqlRequest)({
|
|
108
|
+
name: 'AuthorId',
|
|
109
|
+
statusCode: 200,
|
|
110
|
+
body: { data: authorIdMockData },
|
|
111
|
+
apiBaseUrl: 'http://localhost/my-custom-api',
|
|
112
|
+
});
|
|
113
|
+
const commitsByAuthorCalls = (0, nockHelpers_1.mockGqlRequest)({
|
|
114
|
+
name: 'CommitsByAuthor',
|
|
115
|
+
statusCode: 200,
|
|
116
|
+
body: { data: commitsByAuthorMock_1.commitsByAuthorMock },
|
|
117
|
+
apiBaseUrl: 'http://localhost/my-custom-api',
|
|
118
|
+
});
|
|
119
|
+
await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)({
|
|
120
|
+
...defaultOptions,
|
|
121
|
+
githubApiBaseUrlV4: 'http://localhost/my-custom-api',
|
|
122
|
+
});
|
|
123
|
+
expect(authorIdCalls.length).toBe(1);
|
|
124
|
+
expect(commitsByAuthorCalls.length).toBe(1);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ValidConfigOptions } from '../../../../options/options';
|
|
2
|
+
import { Commit, CommitNode } from '../../../../types/commitNode';
|
|
3
|
+
export declare function fetchCommitsInDateRange({ accessToken, branchLabelMapping, commitsCount, dateRange, githubApiBaseUrlV4, repoName, repoOwner, sourceBranch, }: {
|
|
4
|
+
accessToken: string;
|
|
5
|
+
branchLabelMapping: ValidConfigOptions['branchLabelMapping'];
|
|
6
|
+
commitsCount: number;
|
|
7
|
+
dateRange: {
|
|
8
|
+
since: string;
|
|
9
|
+
until: string;
|
|
10
|
+
};
|
|
11
|
+
githubApiBaseUrlV4: string;
|
|
12
|
+
repoName: string;
|
|
13
|
+
repoOwner: string;
|
|
14
|
+
sourceBranch: string;
|
|
15
|
+
}): Promise<Commit[] | undefined>;
|
|
16
|
+
export interface CommitsSinceDateResponse {
|
|
17
|
+
repository: {
|
|
18
|
+
ref: {
|
|
19
|
+
target: {
|
|
20
|
+
history: {
|
|
21
|
+
edges: Array<{
|
|
22
|
+
node: CommitNode;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
} | null;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchCommitsInDateRange = void 0;
|
|
4
|
+
const commitNode_1 = require("../../../../types/commitNode");
|
|
5
|
+
const apiRequestV4_1 = require("../apiRequestV4");
|
|
6
|
+
async function fetchCommitsInDateRange({ accessToken, branchLabelMapping, commitsCount, dateRange, githubApiBaseUrlV4, repoName, repoOwner, sourceBranch, }) {
|
|
7
|
+
const query = /* GraphQL */ `
|
|
8
|
+
query CommitsSinceDate($repoOwner: String!, $repoName: String!, $commitsCount: Int!, $sourceBranch: String!, $since: GitTimestamp!, $until: GitTimestamp!) {
|
|
9
|
+
repository(owner: $repoOwner, name: $repoName) {
|
|
10
|
+
id
|
|
11
|
+
ref(qualifiedName: $sourceBranch) {
|
|
12
|
+
target {
|
|
13
|
+
... on Commit {
|
|
14
|
+
history(first: $commitsCount, since: $since, until: $until) {
|
|
15
|
+
totalCount
|
|
16
|
+
edges {
|
|
17
|
+
node {
|
|
18
|
+
...${commitNode_1.commitNodeFragment.name}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
${commitNode_1.commitNodeFragment.source}
|
|
29
|
+
`;
|
|
30
|
+
const res = await (0, apiRequestV4_1.apiRequestV4)({
|
|
31
|
+
githubApiBaseUrlV4,
|
|
32
|
+
accessToken,
|
|
33
|
+
query,
|
|
34
|
+
variables: {
|
|
35
|
+
repoOwner,
|
|
36
|
+
repoName,
|
|
37
|
+
commitsCount,
|
|
38
|
+
sourceBranch,
|
|
39
|
+
since: dateRange.since,
|
|
40
|
+
until: dateRange.until,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
return res.repository.ref?.target.history.edges
|
|
44
|
+
.filter((commitEdge) => {
|
|
45
|
+
return commitEdge.node.associatedPullRequests.edges?.[0].node != null;
|
|
46
|
+
})
|
|
47
|
+
.map((commitEdge) => {
|
|
48
|
+
const commitNode = commitEdge.node;
|
|
49
|
+
return (0, commitNode_1.getCommit)({ sourceBranch, branchLabelMapping, commitNode });
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
exports.fetchCommitsInDateRange = fetchCommitsInDateRange;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ValidConfigOptions } from '../../../../options/options';
|
|
2
|
+
import { Commit, SourceCommitWithTargetPullRequest } from '../../../sourceCommit/parseSourceCommit';
|
|
3
|
+
export declare function fetchPullRequestBySearchQuery(options: ValidConfigOptions): Promise<Commit[]>;
|
|
4
|
+
export interface PullRequestBySearchQueryResponse {
|
|
5
|
+
search: {
|
|
6
|
+
nodes: Array<{
|
|
7
|
+
mergeCommit: SourceCommitWithTargetPullRequest;
|
|
8
|
+
}>;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchPullRequestBySearchQuery = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const HandledError_1 = require("../../../HandledError");
|
|
6
|
+
const parseSourceCommit_1 = require("../../../sourceCommit/parseSourceCommit");
|
|
7
|
+
const apiRequestV4_1 = require("../apiRequestV4");
|
|
8
|
+
async function fetchPullRequestBySearchQuery(options) {
|
|
9
|
+
const { accessToken, all, author, githubApiBaseUrlV4, maxNumber, prFilter, repoName, repoOwner, sourceBranch, } = options;
|
|
10
|
+
const query = /* GraphQL */ `
|
|
11
|
+
query PullRequestBySearchQuery($query: String!, $maxNumber: Int!) {
|
|
12
|
+
search(query: $query, type: ISSUE, first: $maxNumber) {
|
|
13
|
+
nodes {
|
|
14
|
+
... on PullRequest {
|
|
15
|
+
mergeCommit {
|
|
16
|
+
...${parseSourceCommit_1.sourceCommitWithTargetPullRequestFragment.name}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
${parseSourceCommit_1.sourceCommitWithTargetPullRequestFragment.source}
|
|
24
|
+
`;
|
|
25
|
+
const authorFilter = all ? '' : `author:${author}`;
|
|
26
|
+
const searchQuery = `type:pr is:merged sort:updated-desc repo:${repoOwner}/${repoName} ${authorFilter} ${prFilter} base:${sourceBranch}`;
|
|
27
|
+
const res = await (0, apiRequestV4_1.apiRequestV4)({
|
|
28
|
+
githubApiBaseUrlV4,
|
|
29
|
+
accessToken,
|
|
30
|
+
query,
|
|
31
|
+
variables: {
|
|
32
|
+
query: searchQuery,
|
|
33
|
+
maxNumber: maxNumber,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
const commits = res.search.nodes.map((pullRequestNode) => {
|
|
37
|
+
const sourceCommit = pullRequestNode.mergeCommit;
|
|
38
|
+
return (0, parseSourceCommit_1.parseSourceCommit)({ options, sourceCommit });
|
|
39
|
+
});
|
|
40
|
+
// terminate if not commits were found
|
|
41
|
+
if ((0, lodash_1.isEmpty)(commits)) {
|
|
42
|
+
const errorText = options.all
|
|
43
|
+
? `There are no pull requests matching the filter "${prFilter}"`
|
|
44
|
+
: `There are no commits by "${options.author}" matching the filter "${prFilter}". Try with \`--all\` for commits by all users or \`--author=<username>\` for commits from a specific user`;
|
|
45
|
+
throw new HandledError_1.HandledError(errorText);
|
|
46
|
+
}
|
|
47
|
+
return commits;
|
|
48
|
+
}
|
|
49
|
+
exports.fetchPullRequestBySearchQuery = fetchPullRequestBySearchQuery;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const getDevAccessToken_1 = require("../../../../test/private/getDevAccessToken");
|
|
4
|
+
const fetchPullRequestBySearchQuery_1 = require("./fetchPullRequestBySearchQuery");
|
|
5
|
+
describe('fetchPullRequestBySearchQuery', () => {
|
|
6
|
+
let devAccessToken;
|
|
7
|
+
beforeAll(async () => {
|
|
8
|
+
devAccessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
|
|
9
|
+
});
|
|
10
|
+
describe('when filter does not match any PRs', () => {
|
|
11
|
+
it('throws an error', async () => {
|
|
12
|
+
const options = {
|
|
13
|
+
accessToken: devAccessToken,
|
|
14
|
+
all: false,
|
|
15
|
+
author: 'sqren',
|
|
16
|
+
githubApiBaseUrlV4: 'https://api.github.com/graphql',
|
|
17
|
+
maxNumber: 10,
|
|
18
|
+
prFilter: 'label:non-existing',
|
|
19
|
+
repoName: 'backport-e2e',
|
|
20
|
+
repoOwner: 'backport-org',
|
|
21
|
+
sourceBranch: 'master',
|
|
22
|
+
};
|
|
23
|
+
await expect((0, fetchPullRequestBySearchQuery_1.fetchPullRequestBySearchQuery)(options)).rejects.toThrowError('There are no commits by "sqren" matching the filter "label:non-existing". Try with `--all` for commits by all users or `--author=<username>` for commits from a specific user');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
describe('when filter matches PRs', () => {
|
|
27
|
+
it('returns the merge commits for those PRs', async () => {
|
|
28
|
+
const options = {
|
|
29
|
+
accessToken: devAccessToken,
|
|
30
|
+
all: false,
|
|
31
|
+
author: 'sqren',
|
|
32
|
+
githubApiBaseUrlV4: 'https://api.github.com/graphql',
|
|
33
|
+
maxNumber: 10,
|
|
34
|
+
prFilter: 'label:v7.8.0',
|
|
35
|
+
repoName: 'backport-e2e',
|
|
36
|
+
repoOwner: 'backport-org',
|
|
37
|
+
sourceBranch: 'master',
|
|
38
|
+
};
|
|
39
|
+
expect(await (0, fetchPullRequestBySearchQuery_1.fetchPullRequestBySearchQuery)(options)).toEqual([
|
|
40
|
+
{
|
|
41
|
+
committedDate: '2020-08-16T21:44:28Z',
|
|
42
|
+
expectedTargetPullRequests: [
|
|
43
|
+
{
|
|
44
|
+
branch: '7.8',
|
|
45
|
+
state: 'OPEN',
|
|
46
|
+
number: 10,
|
|
47
|
+
url: 'https://github.com/backport-org/backport-e2e/pull/10',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
originalMessage: 'Add sheep emoji (#9)',
|
|
51
|
+
pullNumber: 9,
|
|
52
|
+
pullUrl: 'https://github.com/backport-org/backport-e2e/pull/9',
|
|
53
|
+
sha: 'eebf165c82a4b718d95c11b3877e365b1949ff28',
|
|
54
|
+
sourceBranch: 'master',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
committedDate: '2020-08-15T12:40:19Z',
|
|
58
|
+
expectedTargetPullRequests: [
|
|
59
|
+
{
|
|
60
|
+
branch: '7.x',
|
|
61
|
+
state: 'MERGED',
|
|
62
|
+
number: 6,
|
|
63
|
+
url: 'https://github.com/backport-org/backport-e2e/pull/6',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
branch: '7.8',
|
|
67
|
+
state: 'MERGED',
|
|
68
|
+
number: 7,
|
|
69
|
+
url: 'https://github.com/backport-org/backport-e2e/pull/7',
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
originalMessage: 'Add 🍏 emoji (#5)',
|
|
73
|
+
pullNumber: 5,
|
|
74
|
+
pullUrl: 'https://github.com/backport-org/backport-e2e/pull/5',
|
|
75
|
+
sha: 'ee8c492334cef1ca077a56addb79a26f79821d2f',
|
|
76
|
+
sourceBranch: 'master',
|
|
77
|
+
},
|
|
78
|
+
]);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|