github-issue-tower-defence-management 2.188.0 → 2.188.2

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.
Files changed (21) hide show
  1. package/README.md +1 -1
  2. package/bin/adapter/entry-points/console/consoleOperationApi.js +2 -1
  3. package/bin/adapter/entry-points/console/consoleOperationApi.js.map +1 -1
  4. package/bin/adapter/entry-points/console/readOnlyTokenRotator.js +1 -0
  5. package/bin/adapter/entry-points/console/readOnlyTokenRotator.js.map +1 -1
  6. package/bin/adapter/entry-points/console/ui-dist/assets/index-D4Idl2ow.js +102 -0
  7. package/bin/adapter/entry-points/console/ui-dist/index.html +1 -1
  8. package/bin/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.js +75 -0
  9. package/bin/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.js.map +1 -1
  10. package/bin/domain/usecases/NotifyFinishedIssuePreparationUseCase.js +14 -1
  11. package/bin/domain/usecases/NotifyFinishedIssuePreparationUseCase.js.map +1 -1
  12. package/package.json +1 -1
  13. package/types/adapter/entry-points/console/consoleOperationApi.d.ts.map +1 -1
  14. package/types/adapter/entry-points/console/readOnlyTokenRotator.d.ts.map +1 -1
  15. package/types/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.d.ts +1 -0
  16. package/types/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.d.ts.map +1 -1
  17. package/types/domain/usecases/NotifyFinishedIssuePreparationUseCase.d.ts +2 -1
  18. package/types/domain/usecases/NotifyFinishedIssuePreparationUseCase.d.ts.map +1 -1
  19. package/types/domain/usecases/adapter-interfaces/IssueRepository.d.ts +1 -0
  20. package/types/domain/usecases/adapter-interfaces/IssueRepository.d.ts.map +1 -1
  21. package/bin/adapter/entry-points/console/ui-dist/assets/index-COn_jk4P.js +0 -102
@@ -6,7 +6,7 @@
6
6
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
7
  <link rel="manifest" href="/manifest.webmanifest" />
8
8
  <title>TDPM Console</title>
9
- <script type="module" crossorigin src="/assets/index-COn_jk4P.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-D4Idl2ow.js"></script>
10
10
  <link rel="stylesheet" crossorigin href="/assets/index-CV1jZcpP.css">
11
11
  </head>
12
12
  <body>
@@ -182,6 +182,30 @@ function isIssueLatestReopenedTimelineItemResponse(value) {
182
182
  Array.isArray(nodes) &&
183
183
  nodes.every((node) => isRecord(node) && typeof node.createdAt === 'string'));
184
184
  }
185
+ function isIssueUserContentEditsResponse(value) {
186
+ if (!isRecord(value))
187
+ return false;
188
+ const data = value.data;
189
+ if (!isRecord(data))
190
+ return false;
191
+ const repository = data.repository;
192
+ if (!isRecord(repository))
193
+ return false;
194
+ const issue = repository.issue;
195
+ if (!isRecord(issue))
196
+ return false;
197
+ const userContentEdits = issue.userContentEdits;
198
+ if (!isRecord(userContentEdits))
199
+ return false;
200
+ const pageInfo = userContentEdits.pageInfo;
201
+ if (!isRecord(pageInfo))
202
+ return false;
203
+ const nodes = userContentEdits.nodes;
204
+ return (typeof pageInfo.hasNextPage === 'boolean' &&
205
+ (typeof pageInfo.endCursor === 'string' || pageInfo.endCursor === null) &&
206
+ Array.isArray(nodes) &&
207
+ nodes.every((node) => isRecord(node) && (typeof node.diff === 'string' || node.diff === null)));
208
+ }
185
209
  function isRepositoryIssueEventFeedResponseItem(value) {
186
210
  if (!isRecord(value))
187
211
  return false;
@@ -2314,6 +2338,57 @@ class ApiV3CheerioRestIssueRepository extends BaseGitHubRepository_1.BaseGitHubR
2314
2338
  await this.throwGitHubError(`Failed to reopen issue ${issueUrl}`, response);
2315
2339
  }
2316
2340
  };
2341
+ this.getIssueBodyEditHistory = async (issueUrl) => {
2342
+ const { owner, repo, issueNumber } = this.parseIssueUrl(issueUrl);
2343
+ const query = `
2344
+ query IssueBodyEditHistory($owner: String!, $repo: String!, $issueNumber: Int!, $after: String) {
2345
+ repository(owner: $owner, name: $repo) {
2346
+ issue(number: $issueNumber) {
2347
+ userContentEdits(first: 100, after: $after) {
2348
+ pageInfo {
2349
+ hasNextPage
2350
+ endCursor
2351
+ }
2352
+ nodes {
2353
+ diff
2354
+ }
2355
+ }
2356
+ }
2357
+ }
2358
+ }
2359
+ `;
2360
+ const bodies = [];
2361
+ let after = null;
2362
+ let hasNextPage = true;
2363
+ while (hasNextPage) {
2364
+ const response = await this.fetchWithRateLimitRetry(() => (0, githubGraphqlClient_1.fetchGithubGraphql)({
2365
+ ghToken: this.ghToken,
2366
+ query,
2367
+ variables: { owner, repo, issueNumber, after },
2368
+ }));
2369
+ if (!response.ok) {
2370
+ await this.throwGitHubError(`Failed to fetch body edit history of issue ${issueUrl} from GitHub GraphQL API`, response);
2371
+ }
2372
+ const responseBody = await response.json();
2373
+ const graphqlErrors = listGraphqlResponseErrors(responseBody);
2374
+ if (graphqlErrors.length > 0) {
2375
+ throw new Error(`GitHub GraphQL API returned errors for the body edit history of issue ${issueUrl}: ${JSON.stringify(graphqlErrors)}`);
2376
+ }
2377
+ if (!isIssueUserContentEditsResponse(responseBody)) {
2378
+ throw new Error(`GitHub GraphQL API returned no body edit history for issue ${issueUrl}`);
2379
+ }
2380
+ const { pageInfo, nodes } = responseBody.data.repository.issue.userContentEdits;
2381
+ for (const node of nodes) {
2382
+ bodies.push(node.diff ?? '');
2383
+ }
2384
+ if (pageInfo.hasNextPage && pageInfo.endCursor === null) {
2385
+ throw new Error(`GitHub GraphQL API returned a next page without a cursor for the body edit history of issue ${issueUrl}`);
2386
+ }
2387
+ hasNextPage = pageInfo.hasNextPage;
2388
+ after = pageInfo.endCursor;
2389
+ }
2390
+ return bodies;
2391
+ };
2317
2392
  this.getLatestReopenedEventAt = async (issue) => {
2318
2393
  const issueEventListingScan = await this.scanIssueEventListingForLatestReopenedEventAt(issue);
2319
2394
  if (issueEventListingScan.listingOutcome === 'listedEveryEvent') {