@acorex/connectivity 21.0.0-next.74 → 21.0.0-next.76

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 (41) hide show
  1. package/fesm2022/{acorex-connectivity-mock-acorex-connectivity-mock-Btm13GJK.mjs → acorex-connectivity-mock-acorex-connectivity-mock-BUpepPMb.mjs} +4853 -2395
  2. package/fesm2022/acorex-connectivity-mock-acorex-connectivity-mock-BUpepPMb.mjs.map +1 -0
  3. package/fesm2022/{acorex-connectivity-mock-assign-to-manager.activity-CY_5d0KF.mjs → acorex-connectivity-mock-assign-to-manager.activity-ZdB4hvfp.mjs} +2 -2
  4. package/fesm2022/{acorex-connectivity-mock-assign-to-manager.activity-CY_5d0KF.mjs.map → acorex-connectivity-mock-assign-to-manager.activity-ZdB4hvfp.mjs.map} +1 -1
  5. package/fesm2022/acorex-connectivity-mock-category-metadata-inheritance.query-CIof4zTg.mjs.map +1 -1
  6. package/fesm2022/acorex-connectivity-mock-category-with-items.query-DAKUJIIt.mjs.map +1 -1
  7. package/fesm2022/{acorex-connectivity-mock-chat-generate-image.command-Hj-2bHyJ.mjs → acorex-connectivity-mock-chat-generate-image.command-Dk_PluzJ.mjs} +2 -2
  8. package/fesm2022/{acorex-connectivity-mock-chat-generate-image.command-Hj-2bHyJ.mjs.map → acorex-connectivity-mock-chat-generate-image.command-Dk_PluzJ.mjs.map} +1 -1
  9. package/fesm2022/{acorex-connectivity-mock-chat-synthesize-speech.command-0ZnevjmT.mjs → acorex-connectivity-mock-chat-synthesize-speech.command-Cl9Zu1y1.mjs} +2 -2
  10. package/fesm2022/{acorex-connectivity-mock-chat-synthesize-speech.command-0ZnevjmT.mjs.map → acorex-connectivity-mock-chat-synthesize-speech.command-Cl9Zu1y1.mjs.map} +1 -1
  11. package/fesm2022/{acorex-connectivity-mock-chat-transcribe-speech.command-D8sCgp69.mjs → acorex-connectivity-mock-chat-transcribe-speech.command-U1XcRyjN.mjs} +2 -2
  12. package/fesm2022/{acorex-connectivity-mock-chat-transcribe-speech.command-D8sCgp69.mjs.map → acorex-connectivity-mock-chat-transcribe-speech.command-U1XcRyjN.mjs.map} +1 -1
  13. package/fesm2022/{acorex-connectivity-mock-get-product-list.query-Bv1im5yj.mjs → acorex-connectivity-mock-get-product-list.query-o9TcY_RC.mjs} +2 -2
  14. package/fesm2022/acorex-connectivity-mock-get-product-list.query-o9TcY_RC.mjs.map +1 -0
  15. package/fesm2022/{acorex-connectivity-mock-get-product-pdf-data.query-Cp65_mpB.mjs → acorex-connectivity-mock-get-product-pdf-data.query-DUZvwsmY.mjs} +2 -2
  16. package/fesm2022/{acorex-connectivity-mock-get-product-pdf-data.query-Cp65_mpB.mjs.map → acorex-connectivity-mock-get-product-pdf-data.query-DUZvwsmY.mjs.map} +1 -1
  17. package/fesm2022/{acorex-connectivity-mock-get-subscriptions-chart-data.query-CkQnH-F_.mjs → acorex-connectivity-mock-get-subscriptions-chart-data.query-BXDzY2Sd.mjs} +2 -2
  18. package/fesm2022/{acorex-connectivity-mock-get-subscriptions-chart-data.query-CkQnH-F_.mjs.map → acorex-connectivity-mock-get-subscriptions-chart-data.query-BXDzY2Sd.mjs.map} +1 -1
  19. package/fesm2022/{acorex-connectivity-mock-get-subscriptions-timeline.query-C_ecGCyk.mjs → acorex-connectivity-mock-get-subscriptions-timeline.query-D_jVT-7a.mjs} +2 -2
  20. package/fesm2022/acorex-connectivity-mock-get-subscriptions-timeline.query-D_jVT-7a.mjs.map +1 -0
  21. package/fesm2022/{acorex-connectivity-mock-get-tenant-application-access.query-t4BHU8qk.mjs → acorex-connectivity-mock-get-tenant-application-access.query-BG6t0137.mjs} +2 -2
  22. package/fesm2022/acorex-connectivity-mock-get-tenant-application-access.query-BG6t0137.mjs.map +1 -0
  23. package/fesm2022/{acorex-connectivity-mock-get-tenant-user-distribution.query-jQAsUf_h.mjs → acorex-connectivity-mock-get-tenant-user-distribution.query-gqSqvIaa.mjs} +2 -2
  24. package/fesm2022/acorex-connectivity-mock-get-tenant-user-distribution.query-gqSqvIaa.mjs.map +1 -0
  25. package/fesm2022/acorex-connectivity-mock-jira-instance-sync.command-BKYjz6O5.mjs +466 -0
  26. package/fesm2022/acorex-connectivity-mock-jira-instance-sync.command-BKYjz6O5.mjs.map +1 -0
  27. package/fesm2022/{acorex-connectivity-mock-notification-management-email-send.command-DAQfIWoD.mjs → acorex-connectivity-mock-notification-management-email-send.command-Df6E-9-c.mjs} +2 -2
  28. package/fesm2022/acorex-connectivity-mock-notification-management-email-send.command-Df6E-9-c.mjs.map +1 -0
  29. package/fesm2022/{acorex-connectivity-mock-user-roles-for-list-column.query-D2QjJXu4.mjs → acorex-connectivity-mock-user-roles-for-list-column.query-ehilblWJ.mjs} +2 -2
  30. package/fesm2022/{acorex-connectivity-mock-user-roles-for-list-column.query-D2QjJXu4.mjs.map → acorex-connectivity-mock-user-roles-for-list-column.query-ehilblWJ.mjs.map} +1 -1
  31. package/fesm2022/acorex-connectivity-mock.mjs +1 -1
  32. package/package.json +2 -2
  33. package/types/acorex-connectivity-mock.d.ts +342 -88
  34. package/fesm2022/acorex-connectivity-mock-acorex-connectivity-mock-Btm13GJK.mjs.map +0 -1
  35. package/fesm2022/acorex-connectivity-mock-contact-core.module-5TLCGWOR.mjs +0 -968
  36. package/fesm2022/acorex-connectivity-mock-contact-core.module-5TLCGWOR.mjs.map +0 -1
  37. package/fesm2022/acorex-connectivity-mock-get-product-list.query-Bv1im5yj.mjs.map +0 -1
  38. package/fesm2022/acorex-connectivity-mock-get-subscriptions-timeline.query-C_ecGCyk.mjs.map +0 -1
  39. package/fesm2022/acorex-connectivity-mock-get-tenant-application-access.query-t4BHU8qk.mjs.map +0 -1
  40. package/fesm2022/acorex-connectivity-mock-get-tenant-user-distribution.query-jQAsUf_h.mjs.map +0 -1
  41. package/fesm2022/acorex-connectivity-mock-notification-management-email-send.command-DAQfIWoD.mjs.map +0 -1
@@ -0,0 +1,466 @@
1
+ import { AXLoadingDialogService } from '@acorex/components/loading-dialog';
2
+ import { AXTranslationService } from '@acorex/core/translation';
3
+ import { RootConfig } from '@acorex/modules/jira-management';
4
+ import * as i0 from '@angular/core';
5
+ import { inject, Injectable } from '@angular/core';
6
+ import { trim, defaultTo, isEmpty, get, isString } from 'lodash-es';
7
+ import { createMultiLanguageString } from '@acorex/platform/contracts';
8
+ import { AXPEntityStorageService } from '@acorex/platform/layout/entity';
9
+
10
+ //#region ---- Imports ----
11
+ class JiraApiError extends Error {
12
+ constructor(message, status, body) {
13
+ super(message);
14
+ this.status = status;
15
+ this.body = body;
16
+ this.name = 'JiraApiError';
17
+ }
18
+ }
19
+ //#endregion
20
+ //#region ---- Constants ----
21
+ const JIRA_DEV_PROXY_PREFIX = '/connectivity/mock/jira-proxy';
22
+ //#endregion
23
+ //#region ---- Helpers ----
24
+ function shouldUseDevJiraProxy() {
25
+ if (typeof window === 'undefined') {
26
+ return false;
27
+ }
28
+ return /^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?$/i.test(window.location.origin);
29
+ }
30
+ function buildApiRoot(baseUrl, apiVersion) {
31
+ const base = trim(baseUrl).replace(/\/+$/, '');
32
+ const directRoot = `${base}/rest/api/${apiVersion}`;
33
+ if (!shouldUseDevJiraProxy()) {
34
+ return directRoot;
35
+ }
36
+ try {
37
+ const { host } = new URL(base);
38
+ return `${JIRA_DEV_PROXY_PREFIX}/${host}/rest/api/${apiVersion}`;
39
+ }
40
+ catch {
41
+ return directRoot;
42
+ }
43
+ }
44
+ //#endregion
45
+ //#region ---- Client ----
46
+ class JiraApiClient {
47
+ constructor(options) {
48
+ const version = defaultTo(trim(defaultTo(options.apiVersion, '')), '2');
49
+ this.apiRoot = buildApiRoot(options.baseUrl, version);
50
+ this.token = trim(options.token);
51
+ }
52
+ async get(path, query) {
53
+ const url = new URL(`${this.apiRoot}${path.startsWith('/') ? path : `/${path}`}`, typeof window !== 'undefined' ? window.location.origin : 'http://localhost');
54
+ if (query) {
55
+ for (const [key, value] of Object.entries(query)) {
56
+ if (value !== undefined && value !== null && value !== '') {
57
+ url.searchParams.set(key, String(value));
58
+ }
59
+ }
60
+ }
61
+ const response = await fetch(url.toString(), {
62
+ method: 'GET',
63
+ headers: {
64
+ Accept: 'application/json',
65
+ Authorization: `Bearer ${this.token}`,
66
+ },
67
+ });
68
+ const bodyText = await response.text();
69
+ if (!response.ok) {
70
+ throw new JiraApiError(`Jira API request failed (${response.status} ${response.statusText})`, response.status, bodyText);
71
+ }
72
+ if (isEmpty(bodyText)) {
73
+ return {};
74
+ }
75
+ try {
76
+ return JSON.parse(bodyText);
77
+ }
78
+ catch {
79
+ throw new JiraApiError('Jira API returned invalid JSON', response.status, bodyText);
80
+ }
81
+ }
82
+ }
83
+ function readIssueField(issue, path) {
84
+ return get(issue.fields, path);
85
+ }
86
+ //#endregion
87
+
88
+ //#region ---- Imports ----
89
+ //#endregion
90
+ //#region ---- Service ----
91
+ class AXCJiraInstanceSyncService {
92
+ constructor() {
93
+ //#region ---- Services & Dependencies ----
94
+ this.storage = inject(AXPEntityStorageService);
95
+ this.instanceEntity = `${RootConfig.module.name}.${RootConfig.entities.jiraInstance.name}`;
96
+ this.projectEntity = `${RootConfig.module.name}.${RootConfig.entities.jiraProject.name}`;
97
+ this.issueTypeEntity = `${RootConfig.module.name}.${RootConfig.entities.jiraIssueType.name}`;
98
+ this.fieldEntity = `${RootConfig.module.name}.${RootConfig.entities.jiraField.name}`;
99
+ this.projectIssueTypeEntity = `${RootConfig.module.name}.${RootConfig.entities.jiraProjectIssueType.name}`;
100
+ this.projectIssueTypeFieldEntity = `${RootConfig.module.name}.${RootConfig.entities.jiraProjectIssueTypeField.name}`;
101
+ this.workflowStatusEntity = `${RootConfig.module.name}.${RootConfig.entities.jiraWorkflowStatus.name}`;
102
+ this.issueEntity = `${RootConfig.module.name}.${RootConfig.entities.jiraIssue.name}`;
103
+ this.worklogEntity = `${RootConfig.module.name}.${RootConfig.entities.jiraWorklog.name}`;
104
+ }
105
+ //#endregion
106
+ //#region ---- Public API ----
107
+ async sync(input) {
108
+ const instance = (await this.storage.getOne(this.instanceEntity, input.instanceId));
109
+ if (!instance) {
110
+ throw new Error('Jira instance not found.');
111
+ }
112
+ const token = this.resolveToken(instance);
113
+ const baseUrl = defaultTo(trim(defaultTo(instance.baseUrl, '')), trim(defaultTo(instance.siteUrl, '')));
114
+ if (!baseUrl) {
115
+ throw new Error('Configure base URL before syncing.');
116
+ }
117
+ const client = new JiraApiClient({
118
+ baseUrl,
119
+ token,
120
+ apiVersion: instance.apiVersion,
121
+ });
122
+ const [jiraProjects, jiraIssueTypes, jiraFields, existingProjects, existingIssueTypes, existingFields, existingProjectIssueTypes, existingProjectIssueTypeFields, existingWorkflowStatuses, existingIssues, existingWorklogs,] = await Promise.all([
123
+ client.get('/project'),
124
+ client.get('/issuetype'),
125
+ client.get('/field'),
126
+ this.loadAll(this.projectEntity),
127
+ this.loadAll(this.issueTypeEntity),
128
+ this.loadAll(this.fieldEntity),
129
+ this.loadAll(this.projectIssueTypeEntity),
130
+ this.loadAll(this.projectIssueTypeFieldEntity),
131
+ this.loadAll(this.workflowStatusEntity),
132
+ this.loadAll(this.issueEntity),
133
+ this.loadAll(this.worklogEntity),
134
+ ]);
135
+ const instanceTitle = instance.title;
136
+ const instanceName = instance.name;
137
+ let projectIssueTypes = 0;
138
+ let projectIssueTypeFields = 0;
139
+ let workflowStatuses = 0;
140
+ let issues = 0;
141
+ let worklogs = 0;
142
+ const issueTypeIdByJiraId = new Map();
143
+ for (const jiraIssueType of jiraIssueTypes) {
144
+ const id = await this.upsertRow(this.issueTypeEntity, existingIssueTypes, (row) => row['jiraInstanceId'] === instance.id && row['jiraIssueTypeId'] === jiraIssueType.id, {
145
+ jiraInstanceId: instance.id,
146
+ jiraInstance: { id: instance.id, title: instanceTitle },
147
+ jiraIssueTypeId: jiraIssueType.id,
148
+ name: jiraIssueType.name,
149
+ description: jiraIssueType.description ? createMultiLanguageString(jiraIssueType.description) : null,
150
+ subtask: jiraIssueType.subtask === true,
151
+ hierarchyLevel: defaultTo(jiraIssueType.hierarchyLevel, 0),
152
+ iconUrl: jiraIssueType.iconUrl ?? null,
153
+ });
154
+ issueTypeIdByJiraId.set(jiraIssueType.id, id);
155
+ }
156
+ const fieldIdByJiraFieldId = new Map();
157
+ for (const jiraField of jiraFields) {
158
+ const fieldId = await this.upsertRow(this.fieldEntity, existingFields, (row) => row['jiraInstanceId'] === instance.id && row['jiraFieldId'] === jiraField.id, {
159
+ jiraInstanceId: instance.id,
160
+ jiraInstance: { id: instance.id, name: instanceName },
161
+ jiraFieldId: jiraField.id,
162
+ name: jiraField.name,
163
+ custom: jiraField.custom === true,
164
+ fieldType: get(jiraField, 'schema.type') ?? null,
165
+ schema: get(jiraField, 'schema.custom') ?? null,
166
+ });
167
+ fieldIdByJiraFieldId.set(jiraField.id, fieldId);
168
+ }
169
+ const projectIdByJiraId = new Map();
170
+ for (const jiraProject of jiraProjects) {
171
+ const projectId = await this.upsertRow(this.projectEntity, existingProjects, (row) => row['jiraInstanceId'] === instance.id && row['jiraProjectId'] === jiraProject.id, {
172
+ jiraInstanceId: instance.id,
173
+ jiraInstance: { id: instance.id, title: instanceTitle, name: instanceName },
174
+ jiraProjectId: jiraProject.id,
175
+ key: jiraProject.key,
176
+ name: jiraProject.name,
177
+ projectTypeKey: jiraProject.projectTypeKey ?? null,
178
+ style: jiraProject.style ?? null,
179
+ simplified: jiraProject.simplified ?? null,
180
+ leadAccountId: jiraProject.lead?.accountId ?? null,
181
+ leadDisplayName: jiraProject.lead?.displayName ?? null,
182
+ avatarUrl: jiraProject.avatarUrls?.['48x48'] ?? null,
183
+ description: jiraProject.description ? createMultiLanguageString(jiraProject.description) : null,
184
+ projectStatusId: 'Active',
185
+ });
186
+ projectIdByJiraId.set(jiraProject.id, projectId);
187
+ const statusesByIssueType = await client.get(`/project/${jiraProject.key}/statuses`);
188
+ const linkedIssueTypeIds = new Set();
189
+ for (const issueTypeBlock of statusesByIssueType) {
190
+ const localIssueTypeId = issueTypeIdByJiraId.get(issueTypeBlock.id);
191
+ if (!localIssueTypeId) {
192
+ continue;
193
+ }
194
+ linkedIssueTypeIds.add(localIssueTypeId);
195
+ await this.upsertRow(this.projectIssueTypeEntity, existingProjectIssueTypes, (row) => row['projectId'] === projectId && row['issueTypeId'] === localIssueTypeId, {
196
+ projectId,
197
+ project: { id: projectId, key: jiraProject.key, name: jiraProject.name },
198
+ issueTypeId: localIssueTypeId,
199
+ issueType: { id: localIssueTypeId, name: issueTypeBlock.name },
200
+ });
201
+ projectIssueTypes += 1;
202
+ let order = 0;
203
+ for (const status of issueTypeBlock.statuses) {
204
+ order += 1;
205
+ await this.upsertRow(this.workflowStatusEntity, existingWorkflowStatuses, (row) => row['projectId'] === projectId &&
206
+ row['issueTypeId'] === localIssueTypeId &&
207
+ row['jiraStatusId'] === status.id, {
208
+ projectId,
209
+ project: { id: projectId, key: jiraProject.key, name: jiraProject.name },
210
+ issueTypeId: localIssueTypeId,
211
+ issueType: { id: localIssueTypeId, name: issueTypeBlock.name },
212
+ jiraStatusId: status.id,
213
+ name: status.name,
214
+ statusCategoryKey: this.mapStatusCategory(status.statusCategory?.key),
215
+ order,
216
+ });
217
+ workflowStatuses += 1;
218
+ }
219
+ }
220
+ const createMeta = await client.get('/issue/createmeta', {
221
+ projectKeys: jiraProject.key,
222
+ expand: 'projects.issuetypes.fields',
223
+ });
224
+ for (const projectMeta of createMeta.projects ?? []) {
225
+ for (const issueTypeMeta of projectMeta.issuetypes ?? []) {
226
+ const localIssueTypeId = issueTypeIdByJiraId.get(issueTypeMeta.id);
227
+ if (!localIssueTypeId || !linkedIssueTypeIds.has(localIssueTypeId)) {
228
+ continue;
229
+ }
230
+ let fieldOrder = 0;
231
+ for (const [jiraFieldKey, fieldMeta] of Object.entries(issueTypeMeta.fields ?? {})) {
232
+ const localFieldId = fieldIdByJiraFieldId.get(jiraFieldKey);
233
+ if (!localFieldId) {
234
+ continue;
235
+ }
236
+ fieldOrder += 1;
237
+ await this.upsertRow(this.projectIssueTypeFieldEntity, existingProjectIssueTypeFields, (row) => row['projectId'] === projectId &&
238
+ row['issueTypeId'] === localIssueTypeId &&
239
+ row['fieldId'] === localFieldId, {
240
+ projectId,
241
+ project: { id: projectId, key: jiraProject.key, name: jiraProject.name },
242
+ issueTypeId: localIssueTypeId,
243
+ issueType: { id: localIssueTypeId, name: issueTypeBlockName(issueTypeMeta.id, statusesByIssueType) },
244
+ fieldId: localFieldId,
245
+ field: { id: localFieldId, jiraFieldId: jiraFieldKey, name: jiraFieldKey },
246
+ required: fieldMeta.required === true,
247
+ hasDefaultValue: fieldMeta.hasDefaultValue === true,
248
+ defaultValue: fieldMeta.defaultValue != null ? JSON.stringify(fieldMeta.defaultValue) : null,
249
+ allowedValues: fieldMeta.allowedValues && fieldMeta.allowedValues.length > 0
250
+ ? JSON.stringify(fieldMeta.allowedValues)
251
+ : null,
252
+ order: fieldOrder,
253
+ });
254
+ projectIssueTypeFields += 1;
255
+ }
256
+ }
257
+ }
258
+ const search = await client.get('/search', {
259
+ jql: `project = ${jiraProject.key} ORDER BY updated DESC`,
260
+ maxResults: 50,
261
+ fields: 'summary,description,issuetype,status,assignee,reporter,priority,parent,resolution,labels,created,updated',
262
+ });
263
+ for (const jiraIssue of search.issues ?? []) {
264
+ const jiraIssueTypeId = readIssueField(jiraIssue, 'issuetype.id')?.id;
265
+ const jiraStatusId = readIssueField(jiraIssue, 'status.id')?.id;
266
+ const localIssueTypeId = jiraIssueTypeId ? issueTypeIdByJiraId.get(jiraIssueTypeId) : undefined;
267
+ const workflowStatus = existingWorkflowStatuses.find((row) => row['projectId'] === projectId &&
268
+ row['issueTypeId'] === localIssueTypeId &&
269
+ row['jiraStatusId'] === jiraStatusId);
270
+ const parentJiraId = readIssueField(jiraIssue, 'parent.id')?.id;
271
+ const parentIssue = parentJiraId
272
+ ? existingIssues.find((row) => row['jiraIssueId'] === parentJiraId)
273
+ : undefined;
274
+ const issueId = await this.upsertRow(this.issueEntity, existingIssues, (row) => row['jiraInstanceId'] === instance.id && row['jiraIssueId'] === jiraIssue.id, {
275
+ jiraInstanceId: instance.id,
276
+ jiraInstance: { id: instance.id, name: instanceName },
277
+ projectId,
278
+ project: { id: projectId, key: jiraProject.key, name: jiraProject.name },
279
+ issueTypeId: localIssueTypeId ?? '',
280
+ issueType: localIssueTypeId
281
+ ? { id: localIssueTypeId, name: readIssueField(jiraIssue, 'issuetype.name')?.name }
282
+ : undefined,
283
+ workflowStatusId: workflowStatus?.id ?? '',
284
+ workflowStatus: workflowStatus
285
+ ? {
286
+ id: workflowStatus.id,
287
+ name: workflowStatus['name'],
288
+ statusCategoryKey: workflowStatus['statusCategoryKey'],
289
+ }
290
+ : undefined,
291
+ jiraIssueId: jiraIssue.id,
292
+ jiraIssueKey: jiraIssue.key,
293
+ summary: defaultTo(readIssueField(jiraIssue, 'summary'), jiraIssue.key),
294
+ description: readIssueField(jiraIssue, 'description') ?? null,
295
+ assigneeAccountId: readIssueField(jiraIssue, 'assignee.accountId')?.accountId ?? null,
296
+ assigneeDisplayName: readIssueField(jiraIssue, 'assignee.displayName')?.displayName ?? null,
297
+ reporterAccountId: readIssueField(jiraIssue, 'reporter.accountId')?.accountId ?? null,
298
+ reporterDisplayName: readIssueField(jiraIssue, 'reporter.displayName')?.displayName ?? null,
299
+ priorityName: readIssueField(jiraIssue, 'priority.name')?.name ?? null,
300
+ parentIssueId: parentIssue?.id ?? null,
301
+ parentIssue: parentIssue
302
+ ? { id: parentIssue.id, jiraIssueKey: parentIssue['jiraIssueKey'] }
303
+ : undefined,
304
+ resolutionName: readIssueField(jiraIssue, 'resolution.name')?.name ?? null,
305
+ labels: JSON.stringify(readIssueField(jiraIssue, 'labels') ?? []),
306
+ jiraCreated: readIssueField(jiraIssue, 'created') ?? null,
307
+ jiraUpdated: readIssueField(jiraIssue, 'updated') ?? null,
308
+ });
309
+ issues += 1;
310
+ const worklogList = await client.get(`/issue/${jiraIssue.key}/worklog`);
311
+ for (const worklog of worklogList.worklogs ?? []) {
312
+ await this.upsertRow(this.worklogEntity, existingWorklogs, (row) => row['issueId'] === issueId && row['jiraWorklogId'] === worklog.id, {
313
+ issueId,
314
+ issue: { id: issueId, jiraIssueKey: jiraIssue.key, summary: readIssueField(jiraIssue, 'summary') },
315
+ jiraWorklogId: worklog.id,
316
+ authorAccountId: worklog.author?.accountId ?? null,
317
+ authorDisplayName: worklog.author?.displayName ?? null,
318
+ started: worklog.started,
319
+ timeSpentSeconds: worklog.timeSpentSeconds,
320
+ timeSpentDisplay: worklog.timeSpent ?? null,
321
+ comment: isString(worklog.comment) ? worklog.comment : null,
322
+ jiraCreated: worklog.created ?? null,
323
+ jiraUpdated: worklog.updated ?? null,
324
+ });
325
+ worklogs += 1;
326
+ }
327
+ }
328
+ }
329
+ await this.storage.updateOne(this.instanceEntity, instance.id, {
330
+ lastSyncAt: new Date().toISOString(),
331
+ });
332
+ return {
333
+ instanceId: instance.id,
334
+ projects: jiraProjects.length,
335
+ issueTypes: jiraIssueTypes.length,
336
+ fields: jiraFields.length,
337
+ workflowStatuses,
338
+ projectIssueTypes,
339
+ projectIssueTypeFields,
340
+ issues,
341
+ worklogs,
342
+ };
343
+ }
344
+ //#endregion
345
+ //#region ---- Utility Methods ----
346
+ resolveToken(instance) {
347
+ const adminToken = trim(defaultTo(instance.adminToken, ''));
348
+ if (adminToken) {
349
+ return adminToken;
350
+ }
351
+ const pat = trim(defaultTo(instance.personalAccessToken, ''));
352
+ if (pat) {
353
+ return pat;
354
+ }
355
+ throw new Error('Configure an admin token or personal access token before syncing.');
356
+ }
357
+ async loadAll(entityName) {
358
+ const result = await this.storage.query(entityName, { skip: 0, take: 50_000 });
359
+ return (result.items ?? []);
360
+ }
361
+ async upsertRow(entityName, cache, match, payload) {
362
+ const existing = cache.find(match);
363
+ if (existing) {
364
+ await this.storage.updateOne(entityName, existing.id, payload);
365
+ Object.assign(existing, payload);
366
+ return existing.id;
367
+ }
368
+ const id = crypto.randomUUID();
369
+ await this.storage.insertOne(entityName, { id, ...payload });
370
+ const created = { id, ...payload };
371
+ cache.push(created);
372
+ return id;
373
+ }
374
+ mapStatusCategory(key) {
375
+ if (key === 'done') {
376
+ return 'done';
377
+ }
378
+ if (key === 'indeterminate') {
379
+ return 'indeterminate';
380
+ }
381
+ return 'new';
382
+ }
383
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXCJiraInstanceSyncService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
384
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXCJiraInstanceSyncService, providedIn: 'root' }); }
385
+ }
386
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXCJiraInstanceSyncService, decorators: [{
387
+ type: Injectable,
388
+ args: [{ providedIn: 'root' }]
389
+ }] });
390
+ function issueTypeBlockName(issueTypeId, blocks) {
391
+ return blocks.find((block) => block.id === issueTypeId)?.name ?? issueTypeId;
392
+ }
393
+
394
+ //#region ---- Imports ----
395
+ const I18N = `${RootConfig.config.i18n}:instances.entities.instance`;
396
+ //#endregion
397
+ //#region ---- Command ----
398
+ class AXCJiraInstanceSyncCommand {
399
+ constructor() {
400
+ //#region ---- Services & Dependencies ----
401
+ this.syncService = inject(AXCJiraInstanceSyncService);
402
+ this.loadingDialog = inject(AXLoadingDialogService);
403
+ this.translation = inject(AXTranslationService);
404
+ }
405
+ //#endregion
406
+ //#region ---- Command Execution ----
407
+ async execute(input) {
408
+ const instanceId = defaultTo(get(input, 'instanceId'), '').trim();
409
+ if (!instanceId) {
410
+ return {
411
+ success: false,
412
+ message: {
413
+ text: await this.translation.translateAsync(`@${I18N}.actions.sync.messages.missing-instance`),
414
+ },
415
+ };
416
+ }
417
+ const [loadingTitle, loadingDescription] = await Promise.all([
418
+ this.translation.translateAsync(`@${I18N}.actions.sync.loading.title`),
419
+ this.translation.translateAsync(`@${I18N}.actions.sync.loading.description`),
420
+ ]);
421
+ const progressDialog = this.loadingDialog.show({
422
+ title: loadingTitle,
423
+ mode: 'indeterminate',
424
+ progressColor: 'primary',
425
+ text: loadingDescription,
426
+ });
427
+ try {
428
+ const data = await this.syncService.sync({ instanceId });
429
+ return {
430
+ success: true,
431
+ data,
432
+ message: {
433
+ text: await this.translation.translateAsync(`@${I18N}.actions.sync.messages.success`, {
434
+ params: {
435
+ projects: data.projects,
436
+ issues: data.issues,
437
+ },
438
+ }),
439
+ },
440
+ };
441
+ }
442
+ catch (error) {
443
+ const fallback = await this.translation.translateAsync(`@${I18N}.actions.sync.messages.failed`);
444
+ let text = error instanceof Error ? error.message : fallback;
445
+ if (error instanceof JiraApiError && error.status === 0) {
446
+ text = await this.translation.translateAsync(`@${I18N}.actions.sync.messages.network-error`);
447
+ }
448
+ return {
449
+ success: false,
450
+ message: { text },
451
+ };
452
+ }
453
+ finally {
454
+ progressDialog.close();
455
+ }
456
+ }
457
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXCJiraInstanceSyncCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
458
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXCJiraInstanceSyncCommand, providedIn: 'root' }); }
459
+ }
460
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXCJiraInstanceSyncCommand, decorators: [{
461
+ type: Injectable,
462
+ args: [{ providedIn: 'root' }]
463
+ }] });
464
+
465
+ export { AXCJiraInstanceSyncCommand };
466
+ //# sourceMappingURL=acorex-connectivity-mock-jira-instance-sync.command-BKYjz6O5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-connectivity-mock-jira-instance-sync.command-BKYjz6O5.mjs","sources":["../../../../libs/connectivity/mock/src/lib/jira-management/features/jira-instance-sync/jira-api.client.ts","../../../../libs/connectivity/mock/src/lib/jira-management/features/jira-instance-sync/jira-instance-sync.service.ts","../../../../libs/connectivity/mock/src/lib/jira-management/features/jira-instance-sync/jira-instance-sync.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { defaultTo, get, isEmpty, trim } from 'lodash-es';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface JiraApiClientOptions {\n baseUrl: string;\n token: string;\n apiVersion?: string | null;\n}\n\nexport class JiraApiError extends Error {\n constructor(\n message: string,\n readonly status?: number,\n readonly body?: string,\n ) {\n super(message);\n this.name = 'JiraApiError';\n }\n}\n\n//#endregion\n\n//#region ---- Constants ----\n\nconst JIRA_DEV_PROXY_PREFIX = '/connectivity/mock/jira-proxy';\n\n//#endregion\n\n//#region ---- Helpers ----\n\nfunction shouldUseDevJiraProxy(): boolean {\n if (typeof window === 'undefined') {\n return false;\n }\n return /^https?:\\/\\/(localhost|127\\.0\\.0\\.1)(:\\d+)?$/i.test(window.location.origin);\n}\n\nfunction buildApiRoot(baseUrl: string, apiVersion: string): string {\n const base = trim(baseUrl).replace(/\\/+$/, '');\n const directRoot = `${base}/rest/api/${apiVersion}`;\n\n if (!shouldUseDevJiraProxy()) {\n return directRoot;\n }\n\n try {\n const { host } = new URL(base);\n return `${JIRA_DEV_PROXY_PREFIX}/${host}/rest/api/${apiVersion}`;\n } catch {\n return directRoot;\n }\n}\n\n//#endregion\n\n//#region ---- Client ----\n\nexport class JiraApiClient {\n private readonly apiRoot: string;\n private readonly token: string;\n\n constructor(options: JiraApiClientOptions) {\n const version = defaultTo(trim(defaultTo(options.apiVersion, '')), '2');\n this.apiRoot = buildApiRoot(options.baseUrl, version);\n this.token = trim(options.token);\n }\n\n async get<T>(path: string, query?: Record<string, string | number | boolean | undefined>): Promise<T> {\n const url = new URL(\n `${this.apiRoot}${path.startsWith('/') ? path : `/${path}`}`,\n typeof window !== 'undefined' ? window.location.origin : 'http://localhost',\n );\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined && value !== null && value !== '') {\n url.searchParams.set(key, String(value));\n }\n }\n }\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: {\n Accept: 'application/json',\n Authorization: `Bearer ${this.token}`,\n },\n });\n\n const bodyText = await response.text();\n if (!response.ok) {\n throw new JiraApiError(\n `Jira API request failed (${response.status} ${response.statusText})`,\n response.status,\n bodyText,\n );\n }\n\n if (isEmpty(bodyText)) {\n return {} as T;\n }\n\n try {\n return JSON.parse(bodyText) as T;\n } catch {\n throw new JiraApiError('Jira API returned invalid JSON', response.status, bodyText);\n }\n }\n}\n\n//#endregion\n\n//#region ---- Response Shapes ----\n\nexport type JiraProjectDto = {\n id: string;\n key: string;\n name: string;\n projectTypeKey?: string;\n style?: string;\n simplified?: boolean;\n lead?: { accountId?: string; displayName?: string };\n avatarUrls?: Record<string, string>;\n description?: string;\n};\n\nexport type JiraIssueTypeDto = {\n id: string;\n name: string;\n description?: string;\n subtask?: boolean;\n hierarchyLevel?: number;\n iconUrl?: string;\n};\n\nexport type JiraFieldDto = {\n id: string;\n name: string;\n custom: boolean;\n schema?: { type?: string; custom?: string };\n};\n\nexport type JiraProjectStatusDto = {\n id: string;\n name: string;\n statuses: Array<{\n id: string;\n name: string;\n statusCategory?: { key?: string };\n }>;\n};\n\nexport type JiraSearchResultDto = {\n issues?: Array<{\n id: string;\n key: string;\n fields?: Record<string, unknown>;\n }>;\n};\n\nexport type JiraWorklogListDto = {\n worklogs?: Array<{\n id: string;\n author?: { accountId?: string; displayName?: string };\n started: string;\n timeSpentSeconds: number;\n timeSpent?: string;\n comment?: string;\n created?: string;\n updated?: string;\n }>;\n};\n\nexport type JiraCreateMetaDto = {\n projects?: Array<{\n issuetypes?: Array<{\n id: string;\n fields?: Record<\n string,\n {\n required?: boolean;\n hasDefaultValue?: boolean;\n defaultValue?: unknown;\n allowedValues?: unknown[];\n schema?: { type?: string };\n }\n >;\n }>;\n }>;\n};\n\nexport function readIssueField<T>(issue: { fields?: Record<string, unknown> }, path: string): T | undefined {\n return get(issue.fields, path) as T | undefined;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport {\n RootConfig,\n type AXMJiraManagementJiraInstanceEntityModel,\n} from '@acorex/modules/jira-management';\nimport { createMultiLanguageString } from '@acorex/platform/contracts';\nimport { AXPEntityStorageService } from '@acorex/platform/layout/entity';\nimport { inject, Injectable } from '@angular/core';\nimport { defaultTo, get, isString, trim } from 'lodash-es';\nimport {\n JiraApiClient,\n JiraApiError,\n readIssueField,\n type JiraCreateMetaDto,\n type JiraFieldDto,\n type JiraIssueTypeDto,\n type JiraProjectDto,\n type JiraProjectStatusDto,\n type JiraSearchResultDto,\n type JiraWorklogListDto,\n} from './jira-api.client';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface JiraInstanceSyncInput {\n instanceId: string;\n}\n\nexport interface JiraInstanceSyncResult {\n instanceId: string;\n projects: number;\n issueTypes: number;\n fields: number;\n workflowStatuses: number;\n projectIssueTypes: number;\n projectIssueTypeFields: number;\n issues: number;\n worklogs: number;\n}\n\ntype StoredRow = { id: string } & Record<string, unknown>;\n\n//#endregion\n\n//#region ---- Service ----\n\n@Injectable({ providedIn: 'root' })\nexport class AXCJiraInstanceSyncService {\n //#region ---- Services & Dependencies ----\n\n private readonly storage = inject(AXPEntityStorageService);\n\n private readonly instanceEntity = `${RootConfig.module.name}.${RootConfig.entities.jiraInstance.name}`;\n private readonly projectEntity = `${RootConfig.module.name}.${RootConfig.entities.jiraProject.name}`;\n private readonly issueTypeEntity = `${RootConfig.module.name}.${RootConfig.entities.jiraIssueType.name}`;\n private readonly fieldEntity = `${RootConfig.module.name}.${RootConfig.entities.jiraField.name}`;\n private readonly projectIssueTypeEntity = `${RootConfig.module.name}.${RootConfig.entities.jiraProjectIssueType.name}`;\n private readonly projectIssueTypeFieldEntity = `${RootConfig.module.name}.${RootConfig.entities.jiraProjectIssueTypeField.name}`;\n private readonly workflowStatusEntity = `${RootConfig.module.name}.${RootConfig.entities.jiraWorkflowStatus.name}`;\n private readonly issueEntity = `${RootConfig.module.name}.${RootConfig.entities.jiraIssue.name}`;\n private readonly worklogEntity = `${RootConfig.module.name}.${RootConfig.entities.jiraWorklog.name}`;\n\n //#endregion\n\n //#region ---- Public API ----\n\n async sync(input: JiraInstanceSyncInput): Promise<JiraInstanceSyncResult> {\n const instance = (await this.storage.getOne(this.instanceEntity, input.instanceId)) as\n | AXMJiraManagementJiraInstanceEntityModel\n | null;\n\n if (!instance) {\n throw new Error('Jira instance not found.');\n }\n\n const token = this.resolveToken(instance);\n const baseUrl = defaultTo(trim(defaultTo(instance.baseUrl, '')), trim(defaultTo(instance.siteUrl, '')));\n if (!baseUrl) {\n throw new Error('Configure base URL before syncing.');\n }\n\n const client = new JiraApiClient({\n baseUrl,\n token,\n apiVersion: instance.apiVersion,\n });\n\n const [\n jiraProjects,\n jiraIssueTypes,\n jiraFields,\n existingProjects,\n existingIssueTypes,\n existingFields,\n existingProjectIssueTypes,\n existingProjectIssueTypeFields,\n existingWorkflowStatuses,\n existingIssues,\n existingWorklogs,\n ] = await Promise.all([\n client.get<JiraProjectDto[]>('/project'),\n client.get<JiraIssueTypeDto[]>('/issuetype'),\n client.get<JiraFieldDto[]>('/field'),\n this.loadAll(this.projectEntity),\n this.loadAll(this.issueTypeEntity),\n this.loadAll(this.fieldEntity),\n this.loadAll(this.projectIssueTypeEntity),\n this.loadAll(this.projectIssueTypeFieldEntity),\n this.loadAll(this.workflowStatusEntity),\n this.loadAll(this.issueEntity),\n this.loadAll(this.worklogEntity),\n ]);\n\n const instanceTitle = instance.title;\n const instanceName = instance.name;\n let projectIssueTypes = 0;\n let projectIssueTypeFields = 0;\n let workflowStatuses = 0;\n let issues = 0;\n let worklogs = 0;\n\n const issueTypeIdByJiraId = new Map<string, string>();\n\n for (const jiraIssueType of jiraIssueTypes) {\n const id = await this.upsertRow(\n this.issueTypeEntity,\n existingIssueTypes,\n (row) => row['jiraInstanceId'] === instance.id && row['jiraIssueTypeId'] === jiraIssueType.id,\n {\n jiraInstanceId: instance.id,\n jiraInstance: { id: instance.id, title: instanceTitle },\n jiraIssueTypeId: jiraIssueType.id,\n name: jiraIssueType.name,\n description: jiraIssueType.description ? createMultiLanguageString(jiraIssueType.description) : null,\n subtask: jiraIssueType.subtask === true,\n hierarchyLevel: defaultTo(jiraIssueType.hierarchyLevel, 0),\n iconUrl: jiraIssueType.iconUrl ?? null,\n },\n );\n issueTypeIdByJiraId.set(jiraIssueType.id, id);\n }\n\n const fieldIdByJiraFieldId = new Map<string, string>();\n for (const jiraField of jiraFields) {\n const fieldId = await this.upsertRow(\n this.fieldEntity,\n existingFields,\n (row) => row['jiraInstanceId'] === instance.id && row['jiraFieldId'] === jiraField.id,\n {\n jiraInstanceId: instance.id,\n jiraInstance: { id: instance.id, name: instanceName },\n jiraFieldId: jiraField.id,\n name: jiraField.name,\n custom: jiraField.custom === true,\n fieldType: get(jiraField, 'schema.type') ?? null,\n schema: get(jiraField, 'schema.custom') ?? null,\n },\n );\n fieldIdByJiraFieldId.set(jiraField.id, fieldId);\n }\n\n const projectIdByJiraId = new Map<string, string>();\n for (const jiraProject of jiraProjects) {\n const projectId = await this.upsertRow(\n this.projectEntity,\n existingProjects,\n (row) => row['jiraInstanceId'] === instance.id && row['jiraProjectId'] === jiraProject.id,\n {\n jiraInstanceId: instance.id,\n jiraInstance: { id: instance.id, title: instanceTitle, name: instanceName },\n jiraProjectId: jiraProject.id,\n key: jiraProject.key,\n name: jiraProject.name,\n projectTypeKey: jiraProject.projectTypeKey ?? null,\n style: jiraProject.style ?? null,\n simplified: jiraProject.simplified ?? null,\n leadAccountId: jiraProject.lead?.accountId ?? null,\n leadDisplayName: jiraProject.lead?.displayName ?? null,\n avatarUrl: jiraProject.avatarUrls?.['48x48'] ?? null,\n description: jiraProject.description ? createMultiLanguageString(jiraProject.description) : null,\n projectStatusId: 'Active',\n },\n );\n projectIdByJiraId.set(jiraProject.id, projectId);\n\n const statusesByIssueType = await client.get<JiraProjectStatusDto[]>(`/project/${jiraProject.key}/statuses`);\n const linkedIssueTypeIds = new Set<string>();\n\n for (const issueTypeBlock of statusesByIssueType) {\n const localIssueTypeId = issueTypeIdByJiraId.get(issueTypeBlock.id);\n if (!localIssueTypeId) {\n continue;\n }\n\n linkedIssueTypeIds.add(localIssueTypeId);\n await this.upsertRow(\n this.projectIssueTypeEntity,\n existingProjectIssueTypes,\n (row) => row['projectId'] === projectId && row['issueTypeId'] === localIssueTypeId,\n {\n projectId,\n project: { id: projectId, key: jiraProject.key, name: jiraProject.name },\n issueTypeId: localIssueTypeId,\n issueType: { id: localIssueTypeId, name: issueTypeBlock.name },\n },\n );\n projectIssueTypes += 1;\n\n let order = 0;\n for (const status of issueTypeBlock.statuses) {\n order += 1;\n await this.upsertRow(\n this.workflowStatusEntity,\n existingWorkflowStatuses,\n (row) =>\n row['projectId'] === projectId &&\n row['issueTypeId'] === localIssueTypeId &&\n row['jiraStatusId'] === status.id,\n {\n projectId,\n project: { id: projectId, key: jiraProject.key, name: jiraProject.name },\n issueTypeId: localIssueTypeId,\n issueType: { id: localIssueTypeId, name: issueTypeBlock.name },\n jiraStatusId: status.id,\n name: status.name,\n statusCategoryKey: this.mapStatusCategory(status.statusCategory?.key),\n order,\n },\n );\n workflowStatuses += 1;\n }\n }\n\n const createMeta = await client.get<JiraCreateMetaDto>('/issue/createmeta', {\n projectKeys: jiraProject.key,\n expand: 'projects.issuetypes.fields',\n });\n\n for (const projectMeta of createMeta.projects ?? []) {\n for (const issueTypeMeta of projectMeta.issuetypes ?? []) {\n const localIssueTypeId = issueTypeIdByJiraId.get(issueTypeMeta.id);\n if (!localIssueTypeId || !linkedIssueTypeIds.has(localIssueTypeId)) {\n continue;\n }\n\n let fieldOrder = 0;\n for (const [jiraFieldKey, fieldMeta] of Object.entries(issueTypeMeta.fields ?? {})) {\n const localFieldId = fieldIdByJiraFieldId.get(jiraFieldKey);\n if (!localFieldId) {\n continue;\n }\n\n fieldOrder += 1;\n await this.upsertRow(\n this.projectIssueTypeFieldEntity,\n existingProjectIssueTypeFields,\n (row) =>\n row['projectId'] === projectId &&\n row['issueTypeId'] === localIssueTypeId &&\n row['fieldId'] === localFieldId,\n {\n projectId,\n project: { id: projectId, key: jiraProject.key, name: jiraProject.name },\n issueTypeId: localIssueTypeId,\n issueType: { id: localIssueTypeId, name: issueTypeBlockName(issueTypeMeta.id, statusesByIssueType) },\n fieldId: localFieldId,\n field: { id: localFieldId, jiraFieldId: jiraFieldKey, name: jiraFieldKey },\n required: fieldMeta.required === true,\n hasDefaultValue: fieldMeta.hasDefaultValue === true,\n defaultValue: fieldMeta.defaultValue != null ? JSON.stringify(fieldMeta.defaultValue) : null,\n allowedValues:\n fieldMeta.allowedValues && fieldMeta.allowedValues.length > 0\n ? JSON.stringify(fieldMeta.allowedValues)\n : null,\n order: fieldOrder,\n },\n );\n projectIssueTypeFields += 1;\n }\n }\n }\n\n const search = await client.get<JiraSearchResultDto>('/search', {\n jql: `project = ${jiraProject.key} ORDER BY updated DESC`,\n maxResults: 50,\n fields: 'summary,description,issuetype,status,assignee,reporter,priority,parent,resolution,labels,created,updated',\n });\n\n for (const jiraIssue of search.issues ?? []) {\n const jiraIssueTypeId = readIssueField<{ id?: string }>(jiraIssue, 'issuetype.id')?.id;\n const jiraStatusId = readIssueField<{ id?: string }>(jiraIssue, 'status.id')?.id;\n const localIssueTypeId = jiraIssueTypeId ? issueTypeIdByJiraId.get(jiraIssueTypeId) : undefined;\n\n const workflowStatus = existingWorkflowStatuses.find(\n (row) =>\n row['projectId'] === projectId &&\n row['issueTypeId'] === localIssueTypeId &&\n row['jiraStatusId'] === jiraStatusId,\n );\n\n const parentJiraId = readIssueField<{ id?: string }>(jiraIssue, 'parent.id')?.id;\n const parentIssue = parentJiraId\n ? existingIssues.find((row) => row['jiraIssueId'] === parentJiraId)\n : undefined;\n\n const issueId = await this.upsertRow(\n this.issueEntity,\n existingIssues,\n (row) => row['jiraInstanceId'] === instance.id && row['jiraIssueId'] === jiraIssue.id,\n {\n jiraInstanceId: instance.id,\n jiraInstance: { id: instance.id, name: instanceName },\n projectId,\n project: { id: projectId, key: jiraProject.key, name: jiraProject.name },\n issueTypeId: localIssueTypeId ?? '',\n issueType: localIssueTypeId\n ? { id: localIssueTypeId, name: readIssueField<{ name?: string }>(jiraIssue, 'issuetype.name')?.name }\n : undefined,\n workflowStatusId: workflowStatus?.id ?? '',\n workflowStatus: workflowStatus\n ? {\n id: workflowStatus.id,\n name: workflowStatus['name'] as string,\n statusCategoryKey: workflowStatus['statusCategoryKey'] as string,\n }\n : undefined,\n jiraIssueId: jiraIssue.id,\n jiraIssueKey: jiraIssue.key,\n summary: defaultTo(readIssueField<string>(jiraIssue, 'summary'), jiraIssue.key),\n description: readIssueField<string>(jiraIssue, 'description') ?? null,\n assigneeAccountId: readIssueField<{ accountId?: string }>(jiraIssue, 'assignee.accountId')?.accountId ?? null,\n assigneeDisplayName:\n readIssueField<{ displayName?: string }>(jiraIssue, 'assignee.displayName')?.displayName ?? null,\n reporterAccountId: readIssueField<{ accountId?: string }>(jiraIssue, 'reporter.accountId')?.accountId ?? null,\n reporterDisplayName:\n readIssueField<{ displayName?: string }>(jiraIssue, 'reporter.displayName')?.displayName ?? null,\n priorityName: readIssueField<{ name?: string }>(jiraIssue, 'priority.name')?.name ?? null,\n parentIssueId: parentIssue?.id ?? null,\n parentIssue: parentIssue\n ? { id: parentIssue.id, jiraIssueKey: parentIssue['jiraIssueKey'] as string }\n : undefined,\n resolutionName: readIssueField<{ name?: string }>(jiraIssue, 'resolution.name')?.name ?? null,\n labels: JSON.stringify(readIssueField<string[]>(jiraIssue, 'labels') ?? []),\n jiraCreated: readIssueField<string>(jiraIssue, 'created') ?? null,\n jiraUpdated: readIssueField<string>(jiraIssue, 'updated') ?? null,\n },\n );\n issues += 1;\n\n const worklogList = await client.get<JiraWorklogListDto>(`/issue/${jiraIssue.key}/worklog`);\n for (const worklog of worklogList.worklogs ?? []) {\n await this.upsertRow(\n this.worklogEntity,\n existingWorklogs,\n (row) => row['issueId'] === issueId && row['jiraWorklogId'] === worklog.id,\n {\n issueId,\n issue: { id: issueId, jiraIssueKey: jiraIssue.key, summary: readIssueField<string>(jiraIssue, 'summary') },\n jiraWorklogId: worklog.id,\n authorAccountId: worklog.author?.accountId ?? null,\n authorDisplayName: worklog.author?.displayName ?? null,\n started: worklog.started,\n timeSpentSeconds: worklog.timeSpentSeconds,\n timeSpentDisplay: worklog.timeSpent ?? null,\n comment: isString(worklog.comment) ? worklog.comment : null,\n jiraCreated: worklog.created ?? null,\n jiraUpdated: worklog.updated ?? null,\n },\n );\n worklogs += 1;\n }\n }\n }\n\n await this.storage.updateOne(this.instanceEntity, instance.id, {\n lastSyncAt: new Date().toISOString(),\n });\n\n return {\n instanceId: instance.id,\n projects: jiraProjects.length,\n issueTypes: jiraIssueTypes.length,\n fields: jiraFields.length,\n workflowStatuses,\n projectIssueTypes,\n projectIssueTypeFields,\n issues,\n worklogs,\n };\n }\n\n //#endregion\n\n //#region ---- Utility Methods ----\n\n private resolveToken(instance: AXMJiraManagementJiraInstanceEntityModel): string {\n const adminToken = trim(defaultTo(instance.adminToken, ''));\n if (adminToken) {\n return adminToken;\n }\n\n const pat = trim(defaultTo(instance.personalAccessToken, ''));\n if (pat) {\n return pat;\n }\n\n throw new Error('Configure an admin token or personal access token before syncing.');\n }\n\n private async loadAll(entityName: string): Promise<StoredRow[]> {\n const result = await this.storage.query(entityName, { skip: 0, take: 50_000 });\n return (result.items ?? []) as StoredRow[];\n }\n\n private async upsertRow(\n entityName: string,\n cache: StoredRow[],\n match: (row: StoredRow) => boolean,\n payload: Record<string, unknown>,\n ): Promise<string> {\n const existing = cache.find(match);\n if (existing) {\n await this.storage.updateOne(entityName, existing.id, payload);\n Object.assign(existing, payload);\n return existing.id;\n }\n\n const id = crypto.randomUUID();\n await this.storage.insertOne(entityName, { id, ...payload });\n const created = { id, ...payload };\n cache.push(created);\n return id;\n }\n\n private mapStatusCategory(key?: string): 'new' | 'indeterminate' | 'done' {\n if (key === 'done') {\n return 'done';\n }\n if (key === 'indeterminate') {\n return 'indeterminate';\n }\n return 'new';\n }\n\n //#endregion\n}\n\nfunction issueTypeBlockName(issueTypeId: string, blocks: JiraProjectStatusDto[]): string {\n return blocks.find((block) => block.id === issueTypeId)?.name ?? issueTypeId;\n}\n\nexport { JiraApiError };\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXLoadingDialogService } from '@acorex/components/loading-dialog';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { RootConfig } from '@acorex/modules/jira-management';\nimport { AXPExecuteCommandResult } from '@acorex/platform/core';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport { inject, Injectable } from '@angular/core';\nimport { defaultTo, get } from 'lodash-es';\nimport { AXCJiraInstanceSyncService, JiraApiError, type JiraInstanceSyncResult } from './jira-instance-sync.service';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface JiraInstanceSyncCommandInput {\n instanceId?: string;\n}\n\nconst I18N = `${RootConfig.config.i18n}:instances.entities.instance`;\n\n//#endregion\n\n//#region ---- Command ----\n\n@Injectable({ providedIn: 'root' })\nexport class AXCJiraInstanceSyncCommand implements AXPCommand<JiraInstanceSyncCommandInput, JiraInstanceSyncResult> {\n //#region ---- Services & Dependencies ----\n\n private readonly syncService = inject(AXCJiraInstanceSyncService);\n private readonly loadingDialog = inject(AXLoadingDialogService);\n private readonly translation = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Execution ----\n\n async execute(input?: JiraInstanceSyncCommandInput): Promise<AXPExecuteCommandResult<JiraInstanceSyncResult>> {\n const instanceId = defaultTo(get(input, 'instanceId'), '').trim();\n if (!instanceId) {\n return {\n success: false,\n message: {\n text: await this.translation.translateAsync(`@${I18N}.actions.sync.messages.missing-instance`),\n },\n };\n }\n\n const [loadingTitle, loadingDescription] = await Promise.all([\n this.translation.translateAsync(`@${I18N}.actions.sync.loading.title`),\n this.translation.translateAsync(`@${I18N}.actions.sync.loading.description`),\n ]);\n\n const progressDialog = this.loadingDialog.show({\n title: loadingTitle,\n mode: 'indeterminate',\n progressColor: 'primary',\n text: loadingDescription,\n });\n\n try {\n const data = await this.syncService.sync({ instanceId });\n return {\n success: true,\n data,\n message: {\n text: await this.translation.translateAsync(`@${I18N}.actions.sync.messages.success`, {\n params: {\n projects: data.projects,\n issues: data.issues,\n },\n }),\n },\n };\n } catch (error) {\n const fallback = await this.translation.translateAsync(`@${I18N}.actions.sync.messages.failed`);\n let text = error instanceof Error ? error.message : fallback;\n if (error instanceof JiraApiError && error.status === 0) {\n text = await this.translation.translateAsync(`@${I18N}.actions.sync.messages.network-error`);\n }\n return {\n success: false,\n message: { text },\n };\n } finally {\n progressDialog.close();\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;AAAA;AAcM,MAAO,YAAa,SAAQ,KAAK,CAAA;AACrC,IAAA,WAAA,CACE,OAAe,EACN,MAAe,EACf,IAAa,EAAA;QAEtB,KAAK,CAAC,OAAO,CAAC;QAHL,IAAA,CAAA,MAAM,GAAN,MAAM;QACN,IAAA,CAAA,IAAI,GAAJ,IAAI;AAGb,QAAA,IAAI,CAAC,IAAI,GAAG,cAAc;IAC5B;AACD;AAED;AAEA;AAEA,MAAM,qBAAqB,GAAG,+BAA+B;AAE7D;AAEA;AAEA,SAAS,qBAAqB,GAAA;AAC5B,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACjC,QAAA,OAAO,KAAK;IACd;IACA,OAAO,+CAA+C,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;AACrF;AAEA,SAAS,YAAY,CAAC,OAAe,EAAE,UAAkB,EAAA;AACvD,IAAA,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;AAC9C,IAAA,MAAM,UAAU,GAAG,CAAA,EAAG,IAAI,CAAA,UAAA,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C,WAAW,CAAC,cAAc,CAAC,CAAA,CAAA,EAAI,IAAI,CAAA,oCAAA,CAAsC,CAAC;YAC9F;YACA,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,EAAE,IAAI,EAAE;aAClB;QACH;gBAAU;YACR,cAAc,CAAC,KAAK,EAAE;QACxB;IACF;8GA7DW,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA1B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,0BAA0B,cADb,MAAM,EAAA,CAAA,CAAA;;2FACnB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBADtC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
@@ -1,4 +1,4 @@
1
- import { AXPDataGenerator } from '@acorex/platform/core';
1
+ import { AXPDataGenerator } from '@acorex/platform/contracts';
2
2
  import { AXToastService } from '@acorex/components/toast';
3
3
  import * as i0 from '@angular/core';
4
4
  import { inject, Injectable } from '@angular/core';
@@ -70,4 +70,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
70
70
  }] });
71
71
 
72
72
  export { NotificationManagementEmailSendMockCommand };
73
- //# sourceMappingURL=acorex-connectivity-mock-notification-management-email-send.command-DAQfIWoD.mjs.map
73
+ //# sourceMappingURL=acorex-connectivity-mock-notification-management-email-send.command-Df6E-9-c.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-connectivity-mock-notification-management-email-send.command-Df6E-9-c.mjs","sources":["../../../../libs/connectivity/mock/src/lib/notification-management/commands/notification-management-email-send.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPDataGenerator } from '@acorex/platform/contracts';\n\nimport { AXPExecuteCommandResult } from '@acorex/platform/core';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport type {\n NotificationManagementEmailSendInput,\n NotificationManagementEmailSendResult,\n} from '@acorex/modules/notification-management';\nimport { AXToastService } from '@acorex/components/toast';\nimport { inject, Injectable } from '@angular/core';\n\n//#endregion\n\n//#region ---- Input parsing ----\n\nfunction parseSendInput(\n raw: unknown,\n): { ok: true; value: NotificationManagementEmailSendInput } | { ok: false; error: string } {\n const obj =\n raw != null && typeof raw === 'object' && !Array.isArray(raw) ? (raw as Record<string, unknown>) : null;\n if (!obj) {\n return { ok: false, error: 'Invalid arguments: expected an object.' };\n }\n const to = typeof obj['to'] === 'string' ? obj['to'].trim() : '';\n const subject = typeof obj['subject'] === 'string' ? obj['subject'].trim() : '';\n const body = typeof obj['body'] === 'string' ? obj['body'].trim() : '';\n if (!to) {\n return { ok: false, error: 'Invalid arguments: \"to\" is required.' };\n }\n if (!subject) {\n return { ok: false, error: 'Invalid arguments: \"subject\" is required.' };\n }\n if (!body) {\n return { ok: false, error: 'Invalid arguments: \"body\" is required.' };\n }\n const cc = typeof obj['cc'] === 'string' ? obj['cc'].trim() : '';\n const bcc = typeof obj['bcc'] === 'string' ? obj['bcc'].trim() : '';\n const tid = typeof obj['textTemplateId'] === 'string' ? obj['textTemplateId'].trim() : '';\n return {\n ok: true,\n value: {\n to,\n subject,\n body,\n ...(cc ? { cc } : {}),\n ...(bcc ? { bcc } : {}),\n ...(tid ? { textTemplateId: tid } : {}),\n },\n };\n}\n\n//#endregion\n\n//#region ---- Mock send command ----\n\nconst MOCK_SEND_LATENCY_MS = 120;\n\n@Injectable()\nexport class NotificationManagementEmailSendMockCommand\n implements AXPCommand<NotificationManagementEmailSendInput, NotificationManagementEmailSendResult> {\n private readonly toastService = inject(AXToastService);\n\n async execute(\n input: NotificationManagementEmailSendInput,\n ): Promise<AXPExecuteCommandResult<NotificationManagementEmailSendResult>> {\n await new Promise<void>((resolve) => setTimeout(resolve, MOCK_SEND_LATENCY_MS));\n const parsed = parseSendInput(input);\n if (!parsed.ok) {\n return { success: false, message: { text: parsed.error } };\n }\n // Mock transport: surface as UI toast only; replace with HTTP when backend exists.\n this.toastService.show({\n color: 'warning',\n title: 'Email send (simulation)',\n content: `No email was delivered — mock only.\\n To: ${parsed.value.to}.\\n Subject: ${parsed.value.subject}.`,\n });\n return {\n success: true,\n data: { messageId: AXPDataGenerator.uuid() },\n };\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;AAAA;AAaA;AAEA;AAEA,SAAS,cAAc,CACrB,GAAY,EAAA;IAEZ,MAAM,GAAG,GACP,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAI,GAA+B,GAAG,IAAI;IACzG,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,wCAAwC,EAAE;IACvE;IACA,MAAM,EAAE,GAAG,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE;IAChE,MAAM,OAAO,GAAG,OAAO,GAAG,CAAC,SAAS,CAAC,KAAK,QAAQ,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE;IAC/E,MAAM,IAAI,GAAG,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE;IACtE,IAAI,CAAC,EAAE,EAAE;QACP,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,sCAAsC,EAAE;IACrE;IACA,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,2CAA2C,EAAE;IAC1E;IACA,IAA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EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE;QAC5D;;AAEA,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;AACrB,YAAA,KAAK,EAAE,SAAS;AAChB,YAAA,KAAK,EAAE,yBAAyB;AAChC,YAAA,OAAO,EAAE,CAAA,0CAAA,EAA6C,MAAM,CAAC,KAAK,CAAC,EAAE,CAAA,aAAA,EAAgB,MAAM,CAAC,KAAK,CAAC,OAAO,CAAA,CAAA,CAAG;AAC7G,SAAA,CAAC;QACF,OAAO;AACL,YAAA,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,EAAE,SAAS,EAAE,gBAAgB,CAAC,IAAI,EAAE,EAAE;SAC7C;IACH;8GAtBW,0CAA0C,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA1C,0CAA0C,EAAA,CAAA,CAAA;;2FAA1C,0CAA0C,EAAA,UAAA,EAAA,CAAA;kBADtD;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable } from '@angular/core';
3
- import { m as mockUsers } from './acorex-connectivity-mock-acorex-connectivity-mock-Btm13GJK.mjs';
3
+ import { m as mockUsers } from './acorex-connectivity-mock-acorex-connectivity-mock-BUpepPMb.mjs';
4
4
 
5
5
  //#endregion
6
6
  /**
@@ -27,4 +27,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
27
27
  }] });
28
28
 
29
29
  export { UserRolesForListColumnQuery };
30
- //# sourceMappingURL=acorex-connectivity-mock-user-roles-for-list-column.query-D2QjJXu4.mjs.map
30
+ //# sourceMappingURL=acorex-connectivity-mock-user-roles-for-list-column.query-ehilblWJ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-connectivity-mock-user-roles-for-list-column.query-D2QjJXu4.mjs","sources":["../../../../libs/connectivity/mock/src/lib/security-management/user/user-roles-for-list-column.query.ts"],"sourcesContent":["import { AXPQuery } from '@acorex/platform/runtime';\nimport { Injectable } from '@angular/core';\nimport { mockUsers } from './user.mock';\n\n//#region ---- Types ----\n\nexport interface UserRolesForListColumnQueryInput {\n userId?: string;\n}\n\nexport interface UserRolesForListColumnQueryResult {\n items: { id: string; title: unknown }[];\n}\n\n//#endregion\n\n/**\n * Resolves role rows for the user list lookup column when using {@link countOnly} column resolve.\n */\n@Injectable({ providedIn: 'root' })\nexport class UserRolesForListColumnQuery implements AXPQuery<UserRolesForListColumnQueryInput, UserRolesForListColumnQueryResult> {\n async fetch(input: UserRolesForListColumnQueryInput): Promise<UserRolesForListColumnQueryResult> {\n const userId = input?.userId?.trim();\n if (!userId) {\n return { items: [] };\n }\n const user = mockUsers.find((u) => u.id === userId);\n if (!user?.roles?.length) {\n return { items: [] };\n }\n return { items: user.roles };\n }\n}\n"],"names":[],"mappings":";;;;AAcA;AAEA;;AAEG;MAEU,2BAA2B,CAAA;IACtC,MAAM,KAAK,CAAC,KAAuC,EAAA;QACjD,MAAM,MAAM,GAAG,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE;QACpC,IAAI,CAAC,MAAM,EAAE;AACX,YAAA,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;QACtB;AACA,QAAA,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC;AACnD,QAAA,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;AACxB,YAAA,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;QACtB;AACA,QAAA,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;IAC9B;8GAXW,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA3B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,2BAA2B,cADd,MAAM,EAAA,CAAA,CAAA;;2FACnB,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBADvC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
1
+ {"version":3,"file":"acorex-connectivity-mock-user-roles-for-list-column.query-ehilblWJ.mjs","sources":["../../../../libs/connectivity/mock/src/lib/security-management/user/user-roles-for-list-column.query.ts"],"sourcesContent":["import { AXPQuery } from '@acorex/platform/runtime';\nimport { Injectable } from '@angular/core';\nimport { mockUsers } from './user.mock';\n\n//#region ---- Types ----\n\nexport interface UserRolesForListColumnQueryInput {\n userId?: string;\n}\n\nexport interface UserRolesForListColumnQueryResult {\n items: { id: string; title: unknown }[];\n}\n\n//#endregion\n\n/**\n * Resolves role rows for the user list lookup column when using {@link countOnly} column resolve.\n */\n@Injectable({ providedIn: 'root' })\nexport class UserRolesForListColumnQuery implements AXPQuery<UserRolesForListColumnQueryInput, UserRolesForListColumnQueryResult> {\n async fetch(input: UserRolesForListColumnQueryInput): Promise<UserRolesForListColumnQueryResult> {\n const userId = input?.userId?.trim();\n if (!userId) {\n return { items: [] };\n }\n const user = mockUsers.find((u) => u.id === userId);\n if (!user?.roles?.length) {\n return { items: [] };\n }\n return { items: user.roles };\n }\n}\n"],"names":[],"mappings":";;;;AAcA;AAEA;;AAEG;MAEU,2BAA2B,CAAA;IACtC,MAAM,KAAK,CAAC,KAAuC,EAAA;QACjD,MAAM,MAAM,GAAG,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE;QACpC,IAAI,CAAC,MAAM,EAAE;AACX,YAAA,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;QACtB;AACA,QAAA,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC;AACnD,QAAA,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;AACxB,YAAA,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;QACtB;AACA,QAAA,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;IAC9B;8GAXW,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA3B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,2BAA2B,cADd,MAAM,EAAA,CAAA,CAAA;;2FACnB,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBADvC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}