github-issue-tower-defence-management 1.87.0 → 1.88.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.
@@ -0,0 +1,182 @@
1
+ import { Issue } from '../../entities/Issue';
2
+ import { FieldOption, Project } from '../../entities/Project';
3
+
4
+ export type InTmuxByHumanUrlEntry = {
5
+ url: string;
6
+ title: string;
7
+ };
8
+
9
+ export type InTmuxByHumanGroupV1 = {
10
+ story: string;
11
+ urls: string[];
12
+ };
13
+
14
+ export type InTmuxByHumanGroupV2 = {
15
+ story: string;
16
+ urls: InTmuxByHumanUrlEntry[];
17
+ };
18
+
19
+ export type InTmuxByHumanSession = {
20
+ name: string;
21
+ description: string;
22
+ };
23
+
24
+ export type InTmuxByHumanGroupV4 = {
25
+ story: string;
26
+ sessions: InTmuxByHumanSession[];
27
+ };
28
+
29
+ export type InTmuxByHumanV3 = {
30
+ version: 3;
31
+ overviewUrl: string;
32
+ tdpmConsoleUrl: string;
33
+ groups: InTmuxByHumanGroupV2[];
34
+ };
35
+
36
+ export type InTmuxByHumanV4 = {
37
+ version: 4;
38
+ overviewUrl: string;
39
+ tdpmConsoleUrl: string;
40
+ newIssueUrl: string;
41
+ groups: InTmuxByHumanGroupV4[];
42
+ };
43
+
44
+ export type InTmuxByHumanData = {
45
+ v1: InTmuxByHumanGroupV1[];
46
+ v2: InTmuxByHumanGroupV2[];
47
+ v3: InTmuxByHumanV3 | null;
48
+ v4: InTmuxByHumanV4 | null;
49
+ };
50
+
51
+ export type GenerateInTmuxByHumanDataInput = {
52
+ project: Project;
53
+ issues: Issue[];
54
+ pjcode: string;
55
+ assigneeLogin: string;
56
+ org: string;
57
+ repo: string;
58
+ consoleBaseUrl: string | null;
59
+ consoleToken: string | null;
60
+ };
61
+
62
+ type InTmuxByHumanStoryGroup = {
63
+ story: string;
64
+ issues: Issue[];
65
+ };
66
+
67
+ const IN_TMUX_BY_HUMAN_STATUS_NAME = 'In Tmux by human';
68
+ const UNKNOWN_STORY_SORT_INDEX = 999999;
69
+
70
+ export class GenerateInTmuxByHumanDataUseCase {
71
+ run = (input: GenerateInTmuxByHumanDataInput): InTmuxByHumanData => {
72
+ const {
73
+ project,
74
+ issues,
75
+ pjcode,
76
+ assigneeLogin,
77
+ org,
78
+ repo,
79
+ consoleBaseUrl,
80
+ consoleToken,
81
+ } = input;
82
+
83
+ const storyOrder = project.story
84
+ ? project.story.stories.map((option: FieldOption) => option.name)
85
+ : [];
86
+
87
+ const selectedIssues = issues.filter((issue) =>
88
+ this.isInTmuxByHuman(issue, assigneeLogin),
89
+ );
90
+
91
+ const groups = this.groupByStoryOrder(selectedIssues, storyOrder);
92
+
93
+ const v2: InTmuxByHumanGroupV2[] = groups.map((group) => ({
94
+ story: group.story,
95
+ urls: group.issues.map((issue) => ({
96
+ url: issue.url,
97
+ title: issue.title,
98
+ })),
99
+ }));
100
+
101
+ const v1: InTmuxByHumanGroupV1[] = groups.map((group) => ({
102
+ story: group.story,
103
+ urls: group.issues.map((issue) => issue.url),
104
+ }));
105
+
106
+ const v4Groups: InTmuxByHumanGroupV4[] = groups.map((group) => ({
107
+ story: group.story,
108
+ sessions: group.issues.map((issue) => ({
109
+ name: issue.url,
110
+ description: issue.title,
111
+ })),
112
+ }));
113
+
114
+ const overviewUrl = project.url;
115
+ const tdpmConsoleUrl = consoleBaseUrl
116
+ ? `${consoleBaseUrl}/projects/${pjcode}/prs`
117
+ : null;
118
+
119
+ const v3: InTmuxByHumanV3 | null = tdpmConsoleUrl
120
+ ? {
121
+ version: 3,
122
+ overviewUrl,
123
+ tdpmConsoleUrl,
124
+ groups: v2,
125
+ }
126
+ : null;
127
+
128
+ const v4: InTmuxByHumanV4 | null =
129
+ tdpmConsoleUrl && consoleToken
130
+ ? {
131
+ version: 4,
132
+ overviewUrl,
133
+ tdpmConsoleUrl: `${tdpmConsoleUrl}?k=${consoleToken}`,
134
+ newIssueUrl: `https://github.com/${org}/${repo}/issues/new?assignees=${assigneeLogin}`,
135
+ groups: v4Groups,
136
+ }
137
+ : null;
138
+
139
+ return { v1, v2, v3, v4 };
140
+ };
141
+
142
+ private isInTmuxByHuman = (issue: Issue, assigneeLogin: string): boolean =>
143
+ issue.status === IN_TMUX_BY_HUMAN_STATUS_NAME &&
144
+ issue.isClosed === false &&
145
+ issue.assignees.includes(assigneeLogin);
146
+
147
+ private groupByStoryOrder = (
148
+ issues: Issue[],
149
+ storyOrder: string[],
150
+ ): InTmuxByHumanStoryGroup[] => {
151
+ const indexByStory = new Map(
152
+ storyOrder.map((name, index) => [name, index]),
153
+ );
154
+ const issuesByStory = new Map<string, Issue[]>();
155
+ for (const issue of issues) {
156
+ const story = issue.story ?? '';
157
+ const existing = issuesByStory.get(story);
158
+ if (existing) {
159
+ existing.push(issue);
160
+ } else {
161
+ issuesByStory.set(story, [issue]);
162
+ }
163
+ }
164
+ return [...issuesByStory.entries()]
165
+ .map(([story, groupedIssues]) => ({
166
+ story,
167
+ issues: groupedIssues,
168
+ sortIndex: indexByStory.get(story) ?? UNKNOWN_STORY_SORT_INDEX,
169
+ }))
170
+ .sort((left, right) =>
171
+ left.sortIndex !== right.sortIndex
172
+ ? left.sortIndex - right.sortIndex
173
+ : left.story < right.story
174
+ ? -1
175
+ : 1,
176
+ )
177
+ .map(({ story, issues: groupedIssues }) => ({
178
+ story,
179
+ issues: groupedIssues,
180
+ }));
181
+ };
182
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"HandleScheduledEventUseCaseHandler.d.ts","sourceRoot":"","sources":["../../../../src/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AA8B3D,qBAAa,kCAAkC;IAC7C,MAAM,GACJ,gBAAgB,MAAM,EACtB,UAAU,OAAO,KAChB,OAAO,CAAC;QACT,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,KAAK,EAAE,CAAC;QAChB,SAAS,EAAE,OAAO,CAAC;QACnB,eAAe,EAAE,IAAI,EAAE,CAAC;KACzB,GAAG,IAAI,CAAC,CAmUP;CACH"}
1
+ {"version":3,"file":"HandleScheduledEventUseCaseHandler.d.ts","sourceRoot":"","sources":["../../../../src/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AA8B3D,qBAAa,kCAAkC;IAC7C,MAAM,GACJ,gBAAgB,MAAM,EACtB,UAAU,OAAO,KAChB,OAAO,CAAC;QACT,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,KAAK,EAAE,CAAC;QAChB,SAAS,EAAE,OAAO,CAAC;QACnB,eAAe,EAAE,IAAI,EAAE,CAAC;KACzB,GAAG,IAAI,CAAC,CA4VP;CACH"}
@@ -0,0 +1,16 @@
1
+ import type { Issue } from '../../../domain/entities/Issue';
2
+ import type { Project } from '../../../domain/entities/Project';
3
+ export type InTmuxByHumanDataWriterParams = {
4
+ inTmuxDataOutputDir: string | null | undefined;
5
+ inTmuxConsoleBaseUrl: string | null | undefined;
6
+ inTmuxConsoleToken: string | null | undefined;
7
+ inTmuxProjectOrder: string[] | null | undefined;
8
+ pjcode: string | null | undefined;
9
+ assigneeLogin: string | null | undefined;
10
+ org: string;
11
+ repo: string;
12
+ project: Project;
13
+ issues: Issue[];
14
+ };
15
+ export declare const writeInTmuxByHumanData: (params: InTmuxByHumanDataWriterParams) => void;
16
+ //# sourceMappingURL=inTmuxByHumanDataWriter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inTmuxByHumanDataWriter.d.ts","sourceRoot":"","sources":["../../../../src/adapter/entry-points/handlers/inTmuxByHumanDataWriter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAMhE,MAAM,MAAM,6BAA6B,GAAG;IAC1C,mBAAmB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/C,oBAAoB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAChD,kBAAkB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC9C,kBAAkB,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;IAChD,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAClC,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB,CAAC;AAUF,eAAO,MAAM,sBAAsB,GACjC,QAAQ,6BAA6B,KACpC,IAsEF,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { Issue } from '../../entities/Issue';
2
+ import { Project } from '../../entities/Project';
3
+ export type InTmuxByHumanUrlEntry = {
4
+ url: string;
5
+ title: string;
6
+ };
7
+ export type InTmuxByHumanGroupV1 = {
8
+ story: string;
9
+ urls: string[];
10
+ };
11
+ export type InTmuxByHumanGroupV2 = {
12
+ story: string;
13
+ urls: InTmuxByHumanUrlEntry[];
14
+ };
15
+ export type InTmuxByHumanSession = {
16
+ name: string;
17
+ description: string;
18
+ };
19
+ export type InTmuxByHumanGroupV4 = {
20
+ story: string;
21
+ sessions: InTmuxByHumanSession[];
22
+ };
23
+ export type InTmuxByHumanV3 = {
24
+ version: 3;
25
+ overviewUrl: string;
26
+ tdpmConsoleUrl: string;
27
+ groups: InTmuxByHumanGroupV2[];
28
+ };
29
+ export type InTmuxByHumanV4 = {
30
+ version: 4;
31
+ overviewUrl: string;
32
+ tdpmConsoleUrl: string;
33
+ newIssueUrl: string;
34
+ groups: InTmuxByHumanGroupV4[];
35
+ };
36
+ export type InTmuxByHumanData = {
37
+ v1: InTmuxByHumanGroupV1[];
38
+ v2: InTmuxByHumanGroupV2[];
39
+ v3: InTmuxByHumanV3 | null;
40
+ v4: InTmuxByHumanV4 | null;
41
+ };
42
+ export type GenerateInTmuxByHumanDataInput = {
43
+ project: Project;
44
+ issues: Issue[];
45
+ pjcode: string;
46
+ assigneeLogin: string;
47
+ org: string;
48
+ repo: string;
49
+ consoleBaseUrl: string | null;
50
+ consoleToken: string | null;
51
+ };
52
+ export declare class GenerateInTmuxByHumanDataUseCase {
53
+ run: (input: GenerateInTmuxByHumanDataInput) => InTmuxByHumanData;
54
+ private isInTmuxByHuman;
55
+ private groupByStoryOrder;
56
+ }
57
+ //# sourceMappingURL=GenerateInTmuxByHumanDataUseCase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenerateInTmuxByHumanDataUseCase.d.ts","sourceRoot":"","sources":["../../../../src/domain/usecases/intmux/GenerateInTmuxByHumanDataUseCase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAe,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,MAAM,qBAAqB,GAAG;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,qBAAqB,EAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,CA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