@ogcio/building-blocks-sdk 0.2.98 → 0.2.100

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/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +14 -0
  3. package/dist/client/clients/journey/index.d.ts +36 -9
  4. package/dist/client/clients/journey/index.d.ts.map +1 -1
  5. package/dist/client/clients/journey/schema.d.ts +31 -8
  6. package/dist/client/clients/journey/schema.d.ts.map +1 -1
  7. package/dist/client/clients/messaging-public-api/citizen/index.d.ts +602 -0
  8. package/dist/client/clients/messaging-public-api/citizen/index.d.ts.map +1 -0
  9. package/dist/client/clients/messaging-public-api/citizen/index.js +34 -0
  10. package/dist/client/clients/messaging-public-api/citizen/index.js.map +1 -0
  11. package/dist/client/clients/messaging-public-api/index.d.ts +18 -0
  12. package/dist/client/clients/messaging-public-api/index.d.ts.map +1 -0
  13. package/dist/client/clients/messaging-public-api/index.js +15 -0
  14. package/dist/client/clients/messaging-public-api/index.js.map +1 -0
  15. package/dist/client/clients/messaging-public-api/organisation/index.d.ts +621 -0
  16. package/dist/client/clients/messaging-public-api/organisation/index.d.ts.map +1 -0
  17. package/dist/client/clients/messaging-public-api/organisation/index.js +49 -0
  18. package/dist/client/clients/messaging-public-api/organisation/index.js.map +1 -0
  19. package/dist/client/clients/messaging-public-api/schema.d.ts +2464 -0
  20. package/dist/client/clients/messaging-public-api/schema.d.ts.map +1 -0
  21. package/dist/client/clients/messaging-public-api/schema.js +2 -0
  22. package/dist/client/clients/messaging-public-api/schema.js.map +1 -0
  23. package/dist/clients-configurations/clients-configuration.json +17 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +2 -0
  26. package/dist/index.js.map +1 -1
  27. package/dist/types/index.d.ts +9 -3
  28. package/dist/types/index.d.ts.map +1 -1
  29. package/dist/types/index.js +2 -1
  30. package/dist/types/index.js.map +1 -1
  31. package/package.json +1 -1
  32. package/src/client/clients/journey/open-api-definition.json +221 -33
  33. package/src/client/clients/journey/schema.ts +31 -8
  34. package/src/client/clients/messaging-public-api/citizen/index.ts +57 -0
  35. package/src/client/clients/messaging-public-api/index.ts +35 -0
  36. package/src/client/clients/messaging-public-api/open-api-definition.json +4539 -0
  37. package/src/client/clients/messaging-public-api/organisation/index.ts +79 -0
  38. package/src/client/clients/messaging-public-api/schema.ts +2463 -0
  39. package/src/clients-configurations/clients-configuration.json +17 -1
  40. package/src/index.ts +7 -0
  41. package/src/types/index.ts +9 -0
@@ -0,0 +1,621 @@
1
+ import type createClient from "openapi-fetch";
2
+ import type { Logger } from "../../../../types/index.js";
3
+ import type { paths } from "../schema.js";
4
+ type SendMessageBody = paths["/api/v1/organisations/messages/"]["post"]["requestBody"]["content"]["multipart/form-data"];
5
+ export declare class MessagingPublicApiOrganisation {
6
+ private readonly client;
7
+ private readonly serviceName;
8
+ private readonly logger;
9
+ constructor(client: ReturnType<typeof createClient<paths>>, serviceName: string, logger: Logger | undefined);
10
+ send(message: Omit<SendMessageBody, "attachments">, attachments?: File[]): Promise<import("../../../utils/client-utils.js").DataResponseValue<{
11
+ parameters: {
12
+ query?: never;
13
+ header?: never;
14
+ path?: never;
15
+ cookie?: never;
16
+ };
17
+ requestBody: {
18
+ content: {
19
+ "multipart/form-data": {
20
+ subject: string;
21
+ plainTextBody: string;
22
+ htmlBody?: string;
23
+ securityLevel: "public" | "confidential";
24
+ language: "en" | "ga";
25
+ scheduledAt: string;
26
+ recipient: {
27
+ type: "email";
28
+ firstName: string;
29
+ lastName: string;
30
+ email: string;
31
+ ppsn?: string;
32
+ dateOfBirth?: string;
33
+ } | {
34
+ type: "identity";
35
+ ppsn: string;
36
+ dateOfBirth: string;
37
+ } | {
38
+ type: "profileId";
39
+ profileId: string;
40
+ };
41
+ metadata?: {
42
+ journey?: {
43
+ journeyId?: string;
44
+ submissionId: string;
45
+ };
46
+ };
47
+ attachments?: unknown;
48
+ };
49
+ };
50
+ };
51
+ responses: {
52
+ 201: {
53
+ headers: {
54
+ [name: string]: unknown;
55
+ };
56
+ content: {
57
+ "application/json": {
58
+ data: {
59
+ messageId: string;
60
+ recipientId: string;
61
+ attachmentIds: string[];
62
+ warning?: {
63
+ code: "MESSAGE_METADATA_NOT_STORED";
64
+ detail: string;
65
+ };
66
+ };
67
+ metadata?: {
68
+ links?: {
69
+ self: {
70
+ href?: string;
71
+ };
72
+ next?: {
73
+ href?: string;
74
+ };
75
+ prev?: {
76
+ href?: string;
77
+ };
78
+ first: {
79
+ href?: string;
80
+ };
81
+ last: {
82
+ href?: string;
83
+ };
84
+ pages: {
85
+ [key: string]: {
86
+ href?: string;
87
+ };
88
+ };
89
+ };
90
+ totalCount?: number;
91
+ };
92
+ };
93
+ };
94
+ };
95
+ 400: {
96
+ headers: {
97
+ [name: string]: unknown;
98
+ };
99
+ content: {
100
+ "application/json": {
101
+ code: string;
102
+ detail: string;
103
+ requestId: string;
104
+ name: string;
105
+ validation?: {
106
+ fieldName: string;
107
+ message: string;
108
+ }[];
109
+ validationContext?: string;
110
+ statusCode: number;
111
+ };
112
+ };
113
+ };
114
+ 401: {
115
+ headers: {
116
+ [name: string]: unknown;
117
+ };
118
+ content: {
119
+ "application/json": {
120
+ code: string;
121
+ detail: string;
122
+ requestId: string;
123
+ name: string;
124
+ validation?: {
125
+ fieldName: string;
126
+ message: string;
127
+ }[];
128
+ validationContext?: string;
129
+ statusCode: number;
130
+ };
131
+ };
132
+ };
133
+ 403: {
134
+ headers: {
135
+ [name: string]: unknown;
136
+ };
137
+ content: {
138
+ "application/json": {
139
+ code: string;
140
+ detail: string;
141
+ requestId: string;
142
+ name: string;
143
+ validation?: {
144
+ fieldName: string;
145
+ message: string;
146
+ }[];
147
+ validationContext?: string;
148
+ statusCode: number;
149
+ };
150
+ };
151
+ };
152
+ 404: {
153
+ headers: {
154
+ [name: string]: unknown;
155
+ };
156
+ content: {
157
+ "application/json": {
158
+ code: string;
159
+ detail: string;
160
+ requestId: string;
161
+ name: string;
162
+ validation?: {
163
+ fieldName: string;
164
+ message: string;
165
+ }[];
166
+ validationContext?: string;
167
+ statusCode: number;
168
+ };
169
+ };
170
+ };
171
+ 409: {
172
+ headers: {
173
+ [name: string]: unknown;
174
+ };
175
+ content: {
176
+ "application/json": {
177
+ code: string;
178
+ detail: string;
179
+ requestId: string;
180
+ name: string;
181
+ validation?: {
182
+ fieldName: string;
183
+ message: string;
184
+ }[];
185
+ validationContext?: string;
186
+ statusCode: number;
187
+ };
188
+ };
189
+ };
190
+ 413: {
191
+ headers: {
192
+ [name: string]: unknown;
193
+ };
194
+ content: {
195
+ "application/json": {
196
+ code: string;
197
+ detail: string;
198
+ requestId: string;
199
+ name: string;
200
+ validation?: {
201
+ fieldName: string;
202
+ message: string;
203
+ }[];
204
+ validationContext?: string;
205
+ statusCode: number;
206
+ };
207
+ };
208
+ };
209
+ 500: {
210
+ headers: {
211
+ [name: string]: unknown;
212
+ };
213
+ content: {
214
+ "application/json": {
215
+ code: string;
216
+ detail: string;
217
+ requestId: string;
218
+ name: string;
219
+ validation?: {
220
+ fieldName: string;
221
+ message: string;
222
+ }[];
223
+ validationContext?: string;
224
+ statusCode: number;
225
+ };
226
+ };
227
+ };
228
+ 502: {
229
+ headers: {
230
+ [name: string]: unknown;
231
+ };
232
+ content: {
233
+ "application/json": {
234
+ code: string;
235
+ detail: string;
236
+ requestId: string;
237
+ name: string;
238
+ validation?: {
239
+ fieldName: string;
240
+ message: string;
241
+ }[];
242
+ validationContext?: string;
243
+ statusCode: number;
244
+ };
245
+ };
246
+ };
247
+ 503: {
248
+ headers: {
249
+ [name: string]: unknown;
250
+ };
251
+ content: {
252
+ "application/json": {
253
+ code: string;
254
+ detail: string;
255
+ requestId: string;
256
+ name: string;
257
+ validation?: {
258
+ fieldName: string;
259
+ message: string;
260
+ }[];
261
+ validationContext?: string;
262
+ statusCode: number;
263
+ };
264
+ };
265
+ };
266
+ 504: {
267
+ headers: {
268
+ [name: string]: unknown;
269
+ };
270
+ content: {
271
+ "application/json": {
272
+ code: string;
273
+ detail: string;
274
+ requestId: string;
275
+ name: string;
276
+ validation?: {
277
+ fieldName: string;
278
+ message: string;
279
+ }[];
280
+ validationContext?: string;
281
+ statusCode: number;
282
+ };
283
+ };
284
+ };
285
+ };
286
+ }, {
287
+ body: {
288
+ attachments: File[] | undefined;
289
+ metadata?: {
290
+ journey?: {
291
+ journeyId?: string;
292
+ submissionId: string;
293
+ };
294
+ } | undefined;
295
+ language: "en" | "ga";
296
+ subject: string;
297
+ plainTextBody: string;
298
+ htmlBody?: string | undefined;
299
+ securityLevel: "public" | "confidential";
300
+ scheduledAt: string;
301
+ recipient: {
302
+ type: "email";
303
+ firstName: string;
304
+ lastName: string;
305
+ email: string;
306
+ ppsn?: string;
307
+ dateOfBirth?: string;
308
+ } | {
309
+ type: "identity";
310
+ ppsn: string;
311
+ dateOfBirth: string;
312
+ } | {
313
+ type: "profileId";
314
+ profileId: string;
315
+ };
316
+ };
317
+ bodySerializer: (body: unknown) => FormData;
318
+ }>>;
319
+ getMessageEvents(messageId: paths["/api/v1/organisations/messages/{messageId}/events"]["get"]["parameters"]["path"]["messageId"]): Promise<import("../../../utils/client-utils.js").DataResponseValue<{
320
+ parameters: {
321
+ query?: never;
322
+ header?: never;
323
+ path: {
324
+ messageId: string;
325
+ };
326
+ cookie?: never;
327
+ };
328
+ requestBody?: never;
329
+ responses: {
330
+ 200: {
331
+ headers: {
332
+ [name: string]: unknown;
333
+ };
334
+ content: {
335
+ "application/json": {
336
+ data: {
337
+ messageId: string;
338
+ eventType: string;
339
+ eventStatus: string;
340
+ data: {
341
+ messageId: string;
342
+ receiverFullName: string;
343
+ receiverPPSN: string;
344
+ receiverUserId: string;
345
+ subject: string;
346
+ language: string;
347
+ excerpt?: string;
348
+ richText?: string;
349
+ plainText: string;
350
+ threadName?: string;
351
+ transports: string[];
352
+ scheduledAt: string;
353
+ senderUserId?: string;
354
+ senderFullName?: string;
355
+ senderPPSN?: string;
356
+ senderApplicationId?: string;
357
+ organisationName: string;
358
+ security: "public" | "confidential";
359
+ } | {
360
+ messageId: string;
361
+ jobId: string;
362
+ } | {
363
+ messageId: string;
364
+ };
365
+ createdAt: string;
366
+ }[];
367
+ metadata?: {
368
+ links?: {
369
+ self: {
370
+ href?: string;
371
+ };
372
+ next?: {
373
+ href?: string;
374
+ };
375
+ prev?: {
376
+ href?: string;
377
+ };
378
+ first: {
379
+ href?: string;
380
+ };
381
+ last: {
382
+ href?: string;
383
+ };
384
+ pages: {
385
+ [key: string]: {
386
+ href?: string;
387
+ };
388
+ };
389
+ };
390
+ totalCount?: number;
391
+ };
392
+ };
393
+ };
394
+ };
395
+ 401: {
396
+ headers: {
397
+ [name: string]: unknown;
398
+ };
399
+ content: {
400
+ "application/json": {
401
+ code: string;
402
+ detail: string;
403
+ requestId: string;
404
+ name: string;
405
+ validation?: {
406
+ fieldName: string;
407
+ message: string;
408
+ }[];
409
+ validationContext?: string;
410
+ statusCode: number;
411
+ };
412
+ };
413
+ };
414
+ 403: {
415
+ headers: {
416
+ [name: string]: unknown;
417
+ };
418
+ content: {
419
+ "application/json": {
420
+ code: string;
421
+ detail: string;
422
+ requestId: string;
423
+ name: string;
424
+ validation?: {
425
+ fieldName: string;
426
+ message: string;
427
+ }[];
428
+ validationContext?: string;
429
+ statusCode: number;
430
+ };
431
+ };
432
+ };
433
+ 404: {
434
+ headers: {
435
+ [name: string]: unknown;
436
+ };
437
+ content: {
438
+ "application/json": {
439
+ code: string;
440
+ detail: string;
441
+ requestId: string;
442
+ name: string;
443
+ validation?: {
444
+ fieldName: string;
445
+ message: string;
446
+ }[];
447
+ validationContext?: string;
448
+ statusCode: number;
449
+ };
450
+ };
451
+ };
452
+ 500: {
453
+ headers: {
454
+ [name: string]: unknown;
455
+ };
456
+ content: {
457
+ "application/json": {
458
+ code: string;
459
+ detail: string;
460
+ requestId: string;
461
+ name: string;
462
+ validation?: {
463
+ fieldName: string;
464
+ message: string;
465
+ }[];
466
+ validationContext?: string;
467
+ statusCode: number;
468
+ };
469
+ };
470
+ };
471
+ };
472
+ }, {
473
+ params: {
474
+ path: {
475
+ messageId: string;
476
+ };
477
+ };
478
+ }>>;
479
+ getLatestEvents(filter: paths["/api/v1/organisations/messages/events"]["post"]["requestBody"]["content"]["application/json"], query?: paths["/api/v1/organisations/messages/events"]["post"]["parameters"]["query"]): Promise<import("../../../utils/client-utils.js").DataResponseValue<{
480
+ parameters: {
481
+ query?: {
482
+ offset?: string;
483
+ limit?: string;
484
+ };
485
+ header?: never;
486
+ path?: never;
487
+ cookie?: never;
488
+ };
489
+ requestBody: {
490
+ content: {
491
+ "application/json": {
492
+ recipientEmail?: string;
493
+ recipientId?: string;
494
+ subjectContains?: string;
495
+ dateFrom?: string;
496
+ dateTo?: string;
497
+ status?: "delivered" | "scheduled" | "opened" | "failed";
498
+ };
499
+ };
500
+ };
501
+ responses: {
502
+ 200: {
503
+ headers: {
504
+ [name: string]: unknown;
505
+ };
506
+ content: {
507
+ "application/json": {
508
+ data: {
509
+ id: string;
510
+ messageId: string;
511
+ subject: string;
512
+ receiverFullName: string;
513
+ eventType: string;
514
+ eventStatus: string;
515
+ scheduledAt: string;
516
+ }[];
517
+ metadata?: {
518
+ links?: {
519
+ self: {
520
+ href?: string;
521
+ };
522
+ next?: {
523
+ href?: string;
524
+ };
525
+ prev?: {
526
+ href?: string;
527
+ };
528
+ first: {
529
+ href?: string;
530
+ };
531
+ last: {
532
+ href?: string;
533
+ };
534
+ pages: {
535
+ [key: string]: {
536
+ href?: string;
537
+ };
538
+ };
539
+ };
540
+ totalCount?: number;
541
+ };
542
+ };
543
+ };
544
+ };
545
+ 401: {
546
+ headers: {
547
+ [name: string]: unknown;
548
+ };
549
+ content: {
550
+ "application/json": {
551
+ code: string;
552
+ detail: string;
553
+ requestId: string;
554
+ name: string;
555
+ validation?: {
556
+ fieldName: string;
557
+ message: string;
558
+ }[];
559
+ validationContext?: string;
560
+ statusCode: number;
561
+ };
562
+ };
563
+ };
564
+ 403: {
565
+ headers: {
566
+ [name: string]: unknown;
567
+ };
568
+ content: {
569
+ "application/json": {
570
+ code: string;
571
+ detail: string;
572
+ requestId: string;
573
+ name: string;
574
+ validation?: {
575
+ fieldName: string;
576
+ message: string;
577
+ }[];
578
+ validationContext?: string;
579
+ statusCode: number;
580
+ };
581
+ };
582
+ };
583
+ 500: {
584
+ headers: {
585
+ [name: string]: unknown;
586
+ };
587
+ content: {
588
+ "application/json": {
589
+ code: string;
590
+ detail: string;
591
+ requestId: string;
592
+ name: string;
593
+ validation?: {
594
+ fieldName: string;
595
+ message: string;
596
+ }[];
597
+ validationContext?: string;
598
+ statusCode: number;
599
+ };
600
+ };
601
+ };
602
+ };
603
+ }, {
604
+ params: {
605
+ query: {
606
+ offset?: string;
607
+ limit?: string;
608
+ } | undefined;
609
+ };
610
+ body: {
611
+ recipientEmail?: string;
612
+ recipientId?: string;
613
+ subjectContains?: string;
614
+ dateFrom?: string;
615
+ dateTo?: string;
616
+ status?: "delivered" | "scheduled" | "opened" | "failed";
617
+ };
618
+ }>>;
619
+ }
620
+ export {};
621
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/client/clients/messaging-public-api/organisation/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAMzD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1C,KAAK,eAAe,GAClB,KAAK,CAAC,iCAAiC,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC,CAAC;AAEpG,qBAAa,8BAA8B;IAEvC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAF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C;;wCAAkjB,CAAC;;oCAAgd,CAAC;wCAAsO,CAAC;;oCAA+c,CAAC;wCAA0O,CAAC;;;wCAA8nB,CAAC;;;wCAA8nB,CAAC;;;;4CAA67B,CAAC;;;;sCAAyY,CAAC;;;;;;;;;;;;;;;kCAAy+B,CAAC;;;;yCAAsL,CAAC;;;;;;;;;;;;;;;kCAA0/B,CAAC;;;;yCAAsL,CAAC;;;;;;;;;;;;;;;kCAA0/B,CAAC;;;;yCAAsL,CAAC;;;;;;;;;;;;;;;;;;;;;;CADt05F"}
@@ -0,0 +1,49 @@
1
+ import { formatError, formatResponse, throwIfEmpty, } from "../../../utils/client-utils.js";
2
+ export class MessagingPublicApiOrganisation {
3
+ client;
4
+ serviceName;
5
+ logger;
6
+ constructor(client, serviceName, logger) {
7
+ this.client = client;
8
+ this.serviceName = serviceName;
9
+ this.logger = logger;
10
+ }
11
+ async send(message, attachments) {
12
+ return this.client
13
+ .POST("/api/v1/organisations/messages/", {
14
+ body: { ...message, attachments },
15
+ bodySerializer: (body) => {
16
+ const parsed = (body ?? {});
17
+ const formData = new FormData();
18
+ for (const [key, value] of Object.entries(parsed)) {
19
+ if (key === "attachments" || value === undefined) {
20
+ continue;
21
+ }
22
+ formData.set(key, typeof value === "object" ? JSON.stringify(value) : String(value));
23
+ }
24
+ for (const attachment of attachments ?? []) {
25
+ formData.append("attachments", attachment);
26
+ }
27
+ return formData;
28
+ },
29
+ })
30
+ .then((response) => formatResponse(response, this.serviceName, this.logger), (reason) => formatError(reason, this.serviceName, this.logger));
31
+ }
32
+ async getMessageEvents(messageId) {
33
+ throwIfEmpty(messageId);
34
+ return this.client
35
+ .GET("/api/v1/organisations/messages/{messageId}/events", {
36
+ params: { path: { messageId } },
37
+ })
38
+ .then((response) => formatResponse(response, this.serviceName, this.logger), (reason) => formatError(reason, this.serviceName, this.logger));
39
+ }
40
+ async getLatestEvents(filter, query) {
41
+ return this.client
42
+ .POST("/api/v1/organisations/messages/events", {
43
+ params: { query },
44
+ body: filter,
45
+ })
46
+ .then((response) => formatResponse(response, this.serviceName, this.logger), (reason) => formatError(reason, this.serviceName, this.logger));
47
+ }
48
+ }
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/client/clients/messaging-public-api/organisation/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,cAAc,EACd,YAAY,GACb,MAAM,gCAAgC,CAAC;AAMxC,MAAM,OAAO,8BAA8B;IAEtB;IACA;IACA;IAHnB,YACmB,MAA8C,EAC9C,WAAmB,EACnB,MAA0B;QAF1B,WAAM,GAAN,MAAM,CAAwC;QAC9C,gBAAW,GAAX,WAAW,CAAQ;QACnB,WAAM,GAAN,MAAM,CAAoB;IAC1C,CAAC;IAEJ,KAAK,CAAC,IAAI,CACR,OAA6C,EAC7C,WAAoB;QAEpB,OAAO,IAAI,CAAC,MAAM;aACf,IAAI,CAAC,iCAAiC,EAAE;YACvC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE;YACjC,cAAc,EAAE,CAAC,IAAa,EAAE,EAAE;gBAChC,MAAM,MAAM,GAAG,CAAC,IAAI,IAAI,EAAE,CAA4B,CAAC;gBACvD,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;gBAChC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;oBAClD,IAAI,GAAG,KAAK,aAAa,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;wBACjD,SAAS;oBACX,CAAC;oBACD,QAAQ,CAAC,GAAG,CACV,GAAG,EACH,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAClE,CAAC;gBACJ,CAAC;gBACD,KAAK,MAAM,UAAU,I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