@webiny/api-record-locking 6.3.0 → 6.4.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/domain/LockRecord.js +63 -70
- package/domain/LockRecord.js.map +1 -1
- package/domain/RecordLockingModel.js +26 -23
- package/domain/RecordLockingModel.js.map +1 -1
- package/domain/abstractions.js +3 -7
- package/domain/abstractions.js.map +1 -1
- package/domain/calculateExpiresOn.js +5 -6
- package/domain/calculateExpiresOn.js.map +1 -1
- package/domain/errors.js +71 -81
- package/domain/errors.js.map +1 -1
- package/domain/index.js +0 -2
- package/domain/types.js +6 -9
- package/domain/types.js.map +1 -1
- package/features/GetLockRecord/GetLockRecordRepository.js +27 -24
- package/features/GetLockRecord/GetLockRecordRepository.js.map +1 -1
- package/features/GetLockRecord/GetLockRecordUseCase.js +13 -10
- package/features/GetLockRecord/GetLockRecordUseCase.js.map +1 -1
- package/features/GetLockRecord/abstractions.js +3 -14
- package/features/GetLockRecord/abstractions.js.map +1 -1
- package/features/GetLockRecord/feature.js +7 -6
- package/features/GetLockRecord/feature.js.map +1 -1
- package/features/GetLockRecord/index.js +0 -2
- package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js +19 -28
- package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js.map +1 -1
- package/features/GetLockedEntryLockRecord/abstractions.js +2 -10
- package/features/GetLockedEntryLockRecord/abstractions.js.map +1 -1
- package/features/GetLockedEntryLockRecord/feature.js +6 -5
- package/features/GetLockedEntryLockRecord/feature.js.map +1 -1
- package/features/GetLockedEntryLockRecord/index.js +0 -2
- package/features/IsEntryLocked/IsEntryLockedUseCase.js +22 -28
- package/features/IsEntryLocked/IsEntryLockedUseCase.js.map +1 -1
- package/features/IsEntryLocked/abstractions.js +2 -9
- package/features/IsEntryLocked/abstractions.js.map +1 -1
- package/features/IsEntryLocked/feature.js +6 -5
- package/features/IsEntryLocked/feature.js.map +1 -1
- package/features/IsEntryLocked/index.js +0 -2
- package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.js +32 -32
- package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.js.map +1 -1
- package/features/KickOutCurrentUser/abstractions.js +2 -6
- package/features/KickOutCurrentUser/abstractions.js.map +1 -1
- package/features/KickOutCurrentUser/feature.js +6 -5
- package/features/KickOutCurrentUser/feature.js.map +1 -1
- package/features/KickOutCurrentUser/index.js +0 -2
- package/features/ListAllLockRecords/ListAllLockRecordsRepository.js +31 -31
- package/features/ListAllLockRecords/ListAllLockRecordsRepository.js.map +1 -1
- package/features/ListAllLockRecords/ListAllLockRecordsUseCase.js +13 -10
- package/features/ListAllLockRecords/ListAllLockRecordsUseCase.js.map +1 -1
- package/features/ListAllLockRecords/abstractions.js +3 -14
- package/features/ListAllLockRecords/abstractions.js.map +1 -1
- package/features/ListAllLockRecords/feature.js +7 -6
- package/features/ListAllLockRecords/feature.js.map +1 -1
- package/features/ListAllLockRecords/index.js +0 -2
- package/features/ListLockRecords/ListLockRecordsRepository.js +31 -31
- package/features/ListLockRecords/ListLockRecordsRepository.js.map +1 -1
- package/features/ListLockRecords/ListLockRecordsUseCase.js +26 -23
- package/features/ListLockRecords/ListLockRecordsUseCase.js.map +1 -1
- package/features/ListLockRecords/abstractions.js +3 -14
- package/features/ListLockRecords/abstractions.js.map +1 -1
- package/features/ListLockRecords/feature.js +7 -6
- package/features/ListLockRecords/feature.js.map +1 -1
- package/features/ListLockRecords/index.js +0 -2
- package/features/LockEntry/LockEntryEventsDecorator.js +31 -31
- package/features/LockEntry/LockEntryEventsDecorator.js.map +1 -1
- package/features/LockEntry/LockEntryRepository.js +33 -30
- package/features/LockEntry/LockEntryRepository.js.map +1 -1
- package/features/LockEntry/LockEntryUseCase.js +21 -26
- package/features/LockEntry/LockEntryUseCase.js.map +1 -1
- package/features/LockEntry/abstractions.js +3 -14
- package/features/LockEntry/abstractions.js.map +1 -1
- package/features/LockEntry/events.js +25 -33
- package/features/LockEntry/events.js.map +1 -1
- package/features/LockEntry/feature.js +8 -7
- package/features/LockEntry/feature.js.map +1 -1
- package/features/LockEntry/index.js +0 -2
- package/features/RecordLockingFeature.js +19 -21
- package/features/RecordLockingFeature.js.map +1 -1
- package/features/UnlockEntry/UnlockEntryEventsDecorator.js +32 -32
- package/features/UnlockEntry/UnlockEntryEventsDecorator.js.map +1 -1
- package/features/UnlockEntry/UnlockEntryRepository.js +29 -27
- package/features/UnlockEntry/UnlockEntryRepository.js.map +1 -1
- package/features/UnlockEntry/UnlockEntryUseCase.js +53 -69
- package/features/UnlockEntry/UnlockEntryUseCase.js.map +1 -1
- package/features/UnlockEntry/abstractions.js +3 -14
- package/features/UnlockEntry/abstractions.js.map +1 -1
- package/features/UnlockEntry/events.js +25 -33
- package/features/UnlockEntry/events.js.map +1 -1
- package/features/UnlockEntry/feature.js +8 -7
- package/features/UnlockEntry/feature.js.map +1 -1
- package/features/UnlockEntry/hasFullAccessPermission.js +6 -7
- package/features/UnlockEntry/hasFullAccessPermission.js.map +1 -1
- package/features/UnlockEntry/index.js +0 -2
- package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.js +31 -31
- package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.js.map +1 -1
- package/features/UnlockEntryRequest/UnlockEntryRequestRepository.js +31 -30
- package/features/UnlockEntryRequest/UnlockEntryRequestRepository.js.map +1 -1
- package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.js +62 -79
- package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.js.map +1 -1
- package/features/UnlockEntryRequest/abstractions.js +3 -14
- package/features/UnlockEntryRequest/abstractions.js.map +1 -1
- package/features/UnlockEntryRequest/events.js +25 -33
- package/features/UnlockEntryRequest/events.js.map +1 -1
- package/features/UnlockEntryRequest/feature.js +8 -7
- package/features/UnlockEntryRequest/feature.js.map +1 -1
- package/features/UnlockEntryRequest/index.js +0 -2
- package/features/UpdateEntryLock/UpdateEntryLockRepository.js +45 -48
- package/features/UpdateEntryLock/UpdateEntryLockRepository.js.map +1 -1
- package/features/UpdateEntryLock/UpdateEntryLockUseCase.js +40 -51
- package/features/UpdateEntryLock/UpdateEntryLockUseCase.js.map +1 -1
- package/features/UpdateEntryLock/abstractions.js +3 -14
- package/features/UpdateEntryLock/abstractions.js.map +1 -1
- package/features/UpdateEntryLock/feature.js +7 -6
- package/features/UpdateEntryLock/feature.js.map +1 -1
- package/features/UpdateEntryLock/index.js +0 -2
- package/graphql/checkPermissions.js +5 -9
- package/graphql/checkPermissions.js.map +1 -1
- package/graphql/resolve.js +15 -17
- package/graphql/resolve.js.map +1 -1
- package/graphql/schema.js +147 -165
- package/graphql/schema.js.map +1 -1
- package/index.js +40 -49
- package/index.js.map +1 -1
- package/package.json +17 -17
- package/types.js +6 -9
- package/types.js.map +1 -1
- package/utils/convertWhereCondition.js +20 -32
- package/utils/convertWhereCondition.js.map +1 -1
- package/utils/getTimeout.js +8 -15
- package/utils/getTimeout.js.map +1 -1
- package/utils/lockRecordDatabaseId.js +6 -11
- package/utils/lockRecordDatabaseId.js.map +1 -1
- package/domain/index.js.map +0 -1
- package/features/GetLockRecord/index.js.map +0 -1
- package/features/GetLockedEntryLockRecord/index.js.map +0 -1
- package/features/IsEntryLocked/index.js.map +0 -1
- package/features/KickOutCurrentUser/index.js.map +0 -1
- package/features/ListAllLockRecords/index.js.map +0 -1
- package/features/ListLockRecords/index.js.map +0 -1
- package/features/LockEntry/index.js.map +0 -1
- package/features/UnlockEntry/index.js.map +0 -1
- package/features/UnlockEntryRequest/index.js.map +0 -1
- package/features/UpdateEntryLock/index.js.map +0 -1
|
@@ -1,92 +1,75 @@
|
|
|
1
1
|
import { Result } from "@webiny/feature/api";
|
|
2
|
-
import {
|
|
2
|
+
import { UnlockEntryRequestRepository, UnlockEntryRequestUseCase } from "./abstractions.js";
|
|
3
3
|
import { GetLockRecordUseCase } from "../GetLockRecord/abstractions.js";
|
|
4
4
|
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
|
|
5
|
-
import { EntryNotLockedError,
|
|
5
|
+
import { EntryNotLockedError, LockRecordNotFoundError, LockRecordPersistenceError, UnlockRequestAlreadySentError } from "../../domain/errors.js";
|
|
6
6
|
import { RecordLockingLockRecordActionType } from "../../domain/types.js";
|
|
7
7
|
class UnlockEntryRequestUseCaseImpl {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
async execute(input) {
|
|
14
|
-
// Get the lock record
|
|
15
|
-
const recordResult = await this.getLockRecord.execute(input);
|
|
16
|
-
|
|
17
|
-
// If not found, it means entry is not locked
|
|
18
|
-
if (recordResult.isFail()) {
|
|
19
|
-
if (recordResult.error instanceof LockRecordNotFoundError) {
|
|
20
|
-
const error = new EntryNotLockedError({
|
|
21
|
-
id: input.id,
|
|
22
|
-
type: input.type
|
|
23
|
-
});
|
|
24
|
-
return Result.fail(error);
|
|
25
|
-
}
|
|
26
|
-
// Other errors
|
|
27
|
-
return Result.fail(new LockRecordPersistenceError(recordResult.error));
|
|
28
|
-
}
|
|
29
|
-
const record = recordResult.value;
|
|
30
|
-
|
|
31
|
-
// If expired, entry is not locked
|
|
32
|
-
if (record.isExpired()) {
|
|
33
|
-
const error = new EntryNotLockedError({
|
|
34
|
-
id: input.id,
|
|
35
|
-
type: input.type
|
|
36
|
-
});
|
|
37
|
-
return Result.fail(error);
|
|
8
|
+
constructor(getLockRecord, repository, identityContext){
|
|
9
|
+
this.getLockRecord = getLockRecord;
|
|
10
|
+
this.repository = repository;
|
|
11
|
+
this.identityContext = identityContext;
|
|
38
12
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
13
|
+
async execute(input) {
|
|
14
|
+
const recordResult = await this.getLockRecord.execute(input);
|
|
15
|
+
if (recordResult.isFail()) {
|
|
16
|
+
if (recordResult.error instanceof LockRecordNotFoundError) {
|
|
17
|
+
const error = new EntryNotLockedError({
|
|
18
|
+
id: input.id,
|
|
19
|
+
type: input.type
|
|
20
|
+
});
|
|
21
|
+
return Result.fail(error);
|
|
22
|
+
}
|
|
23
|
+
return Result.fail(new LockRecordPersistenceError(recordResult.error));
|
|
24
|
+
}
|
|
25
|
+
const record = recordResult.value;
|
|
26
|
+
if (record.isExpired()) {
|
|
27
|
+
const error = new EntryNotLockedError({
|
|
28
|
+
id: input.id,
|
|
29
|
+
type: input.type
|
|
30
|
+
});
|
|
31
|
+
return Result.fail(error);
|
|
32
|
+
}
|
|
33
|
+
const unlockRequested = record.getUnlockRequested();
|
|
34
|
+
if (unlockRequested) {
|
|
35
|
+
const currentIdentity = this.identityContext.getIdentity();
|
|
36
|
+
if (unlockRequested.createdBy.id !== currentIdentity.id) {
|
|
37
|
+
const error = new UnlockRequestAlreadySentError({
|
|
38
|
+
id: input.id,
|
|
39
|
+
type: input.type,
|
|
40
|
+
identityId: unlockRequested.createdBy.id
|
|
41
|
+
});
|
|
42
|
+
return Result.fail(error);
|
|
43
|
+
}
|
|
44
|
+
const approved = record.getUnlockApproved();
|
|
45
|
+
const denied = record.getUnlockDenied();
|
|
46
|
+
if (approved || denied) return Result.ok(record);
|
|
47
|
+
const error = new UnlockRequestAlreadySentError({
|
|
48
|
+
id: input.id,
|
|
49
|
+
type: input.type,
|
|
50
|
+
identityId: unlockRequested.createdBy.id
|
|
51
|
+
});
|
|
52
|
+
return Result.fail(error);
|
|
53
|
+
}
|
|
54
|
+
const identity = this.identityContext.getIdentity();
|
|
55
|
+
record.addAction({
|
|
56
|
+
type: RecordLockingLockRecordActionType.requested,
|
|
57
|
+
createdOn: new Date(),
|
|
58
|
+
createdBy: identity
|
|
51
59
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
// If same user but already approved or denied, return the record
|
|
56
|
-
const approved = record.getUnlockApproved();
|
|
57
|
-
const denied = record.getUnlockDenied();
|
|
58
|
-
if (approved || denied) {
|
|
60
|
+
const updateResult = await this.repository.update(record);
|
|
61
|
+
if (updateResult.isFail()) return Result.fail(updateResult.error);
|
|
59
62
|
return Result.ok(record);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// If same user and pending, treat as duplicate
|
|
63
|
-
const error = new UnlockRequestAlreadySentError({
|
|
64
|
-
id: input.id,
|
|
65
|
-
type: input.type,
|
|
66
|
-
identityId: unlockRequested.createdBy.id
|
|
67
|
-
});
|
|
68
|
-
return Result.fail(error);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Add unlock request action
|
|
72
|
-
const identity = this.identityContext.getIdentity();
|
|
73
|
-
record.addAction({
|
|
74
|
-
type: RecordLockingLockRecordActionType.requested,
|
|
75
|
-
createdOn: new Date(),
|
|
76
|
-
createdBy: identity
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
// Update the record
|
|
80
|
-
const updateResult = await this.repository.update(record);
|
|
81
|
-
if (updateResult.isFail()) {
|
|
82
|
-
return Result.fail(updateResult.error);
|
|
83
63
|
}
|
|
84
|
-
return Result.ok(record);
|
|
85
|
-
}
|
|
86
64
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
65
|
+
const UnlockEntryRequestUseCase_UnlockEntryRequestUseCase = UnlockEntryRequestUseCase.createImplementation({
|
|
66
|
+
implementation: UnlockEntryRequestUseCaseImpl,
|
|
67
|
+
dependencies: [
|
|
68
|
+
GetLockRecordUseCase,
|
|
69
|
+
UnlockEntryRequestRepository,
|
|
70
|
+
IdentityContext
|
|
71
|
+
]
|
|
90
72
|
});
|
|
73
|
+
export { UnlockEntryRequestUseCase_UnlockEntryRequestUseCase as UnlockEntryRequestUseCase };
|
|
91
74
|
|
|
92
75
|
//# sourceMappingURL=UnlockEntryRequestUseCase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/UnlockEntryRequest/UnlockEntryRequestUseCase.js","sources":["../../../src/features/UnlockEntryRequest/UnlockEntryRequestUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n UnlockEntryRequestUseCase as UseCaseAbstraction,\n UnlockEntryRequestRepository,\n UnlockEntryRequestInput\n} from \"./abstractions.js\";\nimport { GetLockRecordUseCase } from \"../GetLockRecord/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport type { ILockRecord } from \"~/domain/LockRecord.js\";\nimport {\n EntryNotLockedError,\n UnlockRequestAlreadySentError,\n LockRecordNotFoundError,\n LockRecordPersistenceError\n} from \"~/domain/errors.js\";\nimport { RecordLockingLockRecordActionType } from \"~/domain/types.js\";\n\nclass UnlockEntryRequestUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private getLockRecord: GetLockRecordUseCase.Interface,\n private repository: UnlockEntryRequestRepository.Interface,\n private identityContext: IdentityContext.Interface\n ) {}\n\n async execute(\n input: UnlockEntryRequestInput\n ): Promise<Result<ILockRecord, UseCaseAbstraction.Error>> {\n // Get the lock record\n const recordResult = await this.getLockRecord.execute(input);\n\n // If not found, it means entry is not locked\n if (recordResult.isFail()) {\n if (recordResult.error instanceof LockRecordNotFoundError) {\n const error = new EntryNotLockedError({ id: input.id, type: input.type });\n return Result.fail(error);\n }\n // Other errors\n return Result.fail(new LockRecordPersistenceError(recordResult.error));\n }\n\n const record = recordResult.value;\n\n // If expired, entry is not locked\n if (record.isExpired()) {\n const error = new EntryNotLockedError({ id: input.id, type: input.type });\n return Result.fail(error);\n }\n\n // Check if unlock request already exists\n const unlockRequested = record.getUnlockRequested();\n if (unlockRequested) {\n const currentIdentity = this.identityContext.getIdentity();\n\n // If a different user already requested unlock, deny\n if (unlockRequested.createdBy.id !== currentIdentity.id) {\n const error = new UnlockRequestAlreadySentError({\n id: input.id,\n type: input.type,\n identityId: unlockRequested.createdBy.id\n });\n return Result.fail(error);\n }\n\n // If same user but already approved or denied, return the record\n const approved = record.getUnlockApproved();\n const denied = record.getUnlockDenied();\n if (approved || denied) {\n return Result.ok(record);\n }\n\n // If same user and pending, treat as duplicate\n const error = new UnlockRequestAlreadySentError({\n id: input.id,\n type: input.type,\n identityId: unlockRequested.createdBy.id\n });\n return Result.fail(error);\n }\n\n // Add unlock request action\n const identity = this.identityContext.getIdentity();\n record.addAction({\n type: RecordLockingLockRecordActionType.requested,\n createdOn: new Date(),\n createdBy: identity\n });\n\n // Update the record\n const updateResult = await this.repository.update(record);\n\n if (updateResult.isFail()) {\n return Result.fail(updateResult.error);\n }\n\n return Result.ok(record);\n }\n}\n\nexport const UnlockEntryRequestUseCase = UseCaseAbstraction.createImplementation({\n implementation: UnlockEntryRequestUseCaseImpl,\n dependencies: [GetLockRecordUseCase, UnlockEntryRequestRepository, IdentityContext]\n});\n"],"names":["UnlockEntryRequestUseCaseImpl","getLockRecord","repository","identityContext","input","recordResult","LockRecordNotFoundError","error","EntryNotLockedError","Result","LockRecordPersistenceError","record","unlockRequested","currentIdentity","UnlockRequestAlreadySentError","approved","denied","identity","RecordLockingLockRecordActionType","Date","updateResult","UnlockEntryRequestUseCase","UseCaseAbstraction","GetLockRecordUseCase","UnlockEntryRequestRepository","IdentityContext"],"mappings":";;;;;;AAiBA,MAAMA;IACF,YACYC,aAA6C,EAC7CC,UAAkD,EAClDC,eAA0C,CACpD;aAHUF,aAAa,GAAbA;aACAC,UAAU,GAAVA;aACAC,eAAe,GAAfA;IACT;IAEH,MAAM,QACFC,KAA8B,EACwB;QAEtD,MAAMC,eAAe,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAACD;QAGtD,IAAIC,aAAa,MAAM,IAAI;YACvB,IAAIA,aAAa,KAAK,YAAYC,yBAAyB;gBACvD,MAAMC,QAAQ,IAAIC,oBAAoB;oBAAE,IAAIJ,MAAM,EAAE;oBAAE,MAAMA,MAAM,IAAI;gBAAC;gBACvE,OAAOK,OAAO,IAAI,CAACF;YACvB;YAEA,OAAOE,OAAO,IAAI,CAAC,IAAIC,2BAA2BL,aAAa,KAAK;QACxE;QAEA,MAAMM,SAASN,aAAa,KAAK;QAGjC,IAAIM,OAAO,SAAS,IAAI;YACpB,MAAMJ,QAAQ,IAAIC,oBAAoB;gBAAE,IAAIJ,MAAM,EAAE;gBAAE,MAAMA,MAAM,IAAI;YAAC;YACvE,OAAOK,OAAO,IAAI,CAACF;QACvB;QAGA,MAAMK,kBAAkBD,OAAO,kBAAkB;QACjD,IAAIC,iBAAiB;YACjB,MAAMC,kBAAkB,IAAI,CAAC,eAAe,CAAC,WAAW;YAGxD,IAAID,gBAAgB,SAAS,CAAC,EAAE,KAAKC,gBAAgB,EAAE,EAAE;gBACrD,MAAMN,QAAQ,IAAIO,8BAA8B;oBAC5C,IAAIV,MAAM,EAAE;oBACZ,MAAMA,MAAM,IAAI;oBAChB,YAAYQ,gBAAgB,SAAS,CAAC,EAAE;gBAC5C;gBACA,OAAOH,OAAO,IAAI,CAACF;YACvB;YAGA,MAAMQ,WAAWJ,OAAO,iBAAiB;YACzC,MAAMK,SAASL,OAAO,eAAe;YACrC,IAAII,YAAYC,QACZ,OAAOP,OAAO,EAAE,CAACE;YAIrB,MAAMJ,QAAQ,IAAIO,8BAA8B;gBAC5C,IAAIV,MAAM,EAAE;gBACZ,MAAMA,MAAM,IAAI;gBAChB,YAAYQ,gBAAgB,SAAS,CAAC,EAAE;YAC5C;YACA,OAAOH,OAAO,IAAI,CAACF;QACvB;QAGA,MAAMU,WAAW,IAAI,CAAC,eAAe,CAAC,WAAW;QACjDN,OAAO,SAAS,CAAC;YACb,MAAMO,kCAAkC,SAAS;YACjD,WAAW,IAAIC;YACf,WAAWF;QACf;QAGA,MAAMG,eAAe,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAACT;QAElD,IAAIS,aAAa,MAAM,IACnB,OAAOX,OAAO,IAAI,CAACW,aAAa,KAAK;QAGzC,OAAOX,OAAO,EAAE,CAACE;IACrB;AACJ;AAEO,MAAMU,sDAA4BC,0BAAAA,oBAAuC,CAAC;IAC7E,gBAAgBtB;IAChB,cAAc;QAACuB;QAAsBC;QAA8BC;KAAgB;AACvF"}
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* UnlockEntryRequest Use Case - Adds unlock request to lock record
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export const UnlockEntryRequestUseCase = createAbstraction("UnlockEntryRequestUseCase");
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* UnlockEntryRequestRepository - Updates lock record with unlock request
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
export const UnlockEntryRequestRepository = createAbstraction("UnlockEntryRequestRepository");
|
|
2
|
+
const UnlockEntryRequestUseCase = createAbstraction("UnlockEntryRequestUseCase");
|
|
3
|
+
const UnlockEntryRequestRepository = createAbstraction("UnlockEntryRequestRepository");
|
|
4
|
+
export { UnlockEntryRequestRepository, UnlockEntryRequestUseCase };
|
|
16
5
|
|
|
17
6
|
//# sourceMappingURL=abstractions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/UnlockEntryRequest/abstractions.js","sources":["../../../src/features/UnlockEntryRequest/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport type { ILockRecord } from \"~/domain/LockRecord.js\";\nimport type { LockRecordEntryType } from \"~/domain/types.js\";\nimport type {\n EntryNotLockedError,\n UnlockRequestAlreadySentError,\n UnlockEntryRequestError,\n LockRecordPersistenceError\n} from \"~/domain/errors.js\";\n\n// Input type\nexport interface UnlockEntryRequestInput {\n id: string;\n type: LockRecordEntryType;\n}\n\n/**\n * UnlockEntryRequest Use Case - Adds unlock request to lock record\n */\nexport interface IUnlockEntryRequestUseCase {\n execute(input: UnlockEntryRequestInput): Promise<Result<ILockRecord, UseCaseError>>;\n}\n\nexport interface IUnlockEntryRequestUseCaseErrors {\n notLocked: EntryNotLockedError;\n alreadySent: UnlockRequestAlreadySentError;\n persistence: LockRecordPersistenceError;\n requestError: UnlockEntryRequestError;\n}\n\ntype UseCaseError = IUnlockEntryRequestUseCaseErrors[keyof IUnlockEntryRequestUseCaseErrors];\n\nexport const UnlockEntryRequestUseCase = createAbstraction<IUnlockEntryRequestUseCase>(\n \"UnlockEntryRequestUseCase\"\n);\n\nexport namespace UnlockEntryRequestUseCase {\n export type Interface = IUnlockEntryRequestUseCase;\n export type Error = UseCaseError;\n}\n\n/**\n * UnlockEntryRequestRepository - Updates lock record with unlock request\n */\nexport interface IUnlockEntryRequestRepository {\n update(record: ILockRecord): Promise<Result<ILockRecord, RepositoryError>>;\n}\n\nexport interface IUnlockEntryRequestRepositoryErrors {\n persistence: UnlockEntryRequestError;\n}\n\ntype RepositoryError =\n IUnlockEntryRequestRepositoryErrors[keyof IUnlockEntryRequestRepositoryErrors];\n\nexport const UnlockEntryRequestRepository = createAbstraction<IUnlockEntryRequestRepository>(\n \"UnlockEntryRequestRepository\"\n);\n\nexport namespace UnlockEntryRequestRepository {\n export type Interface = IUnlockEntryRequestRepository;\n export type Error = RepositoryError;\n}\n"],"names":["UnlockEntryRequestUseCase","createAbstraction","UnlockEntryRequestRepository"],"mappings":";AAiCO,MAAMA,4BAA4BC,kBACrC;AAsBG,MAAMC,+BAA+BD,kBACxC"}
|
|
@@ -1,40 +1,32 @@
|
|
|
1
1
|
import { createAbstraction } from "@webiny/feature/api";
|
|
2
2
|
import { DomainEvent } from "@webiny/api-core/features/eventPublisher/index.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
getHandlerAbstraction() {
|
|
11
|
-
return EntryBeforeUnlockRequestEventHandler;
|
|
12
|
-
}
|
|
3
|
+
class EntryBeforeUnlockRequestEvent extends DomainEvent {
|
|
4
|
+
getHandlerAbstraction() {
|
|
5
|
+
return EntryBeforeUnlockRequestEventHandler;
|
|
6
|
+
}
|
|
7
|
+
constructor(...args){
|
|
8
|
+
super(...args), this.eventType = "RecordLocking/Entry/BeforeUnlockRequest";
|
|
9
|
+
}
|
|
13
10
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
getHandlerAbstraction() {
|
|
23
|
-
return EntryAfterUnlockRequestEventHandler;
|
|
24
|
-
}
|
|
11
|
+
const EntryBeforeUnlockRequestEventHandler = createAbstraction("EntryBeforeUnlockRequestEventHandler");
|
|
12
|
+
class EntryAfterUnlockRequestEvent extends DomainEvent {
|
|
13
|
+
getHandlerAbstraction() {
|
|
14
|
+
return EntryAfterUnlockRequestEventHandler;
|
|
15
|
+
}
|
|
16
|
+
constructor(...args){
|
|
17
|
+
super(...args), this.eventType = "RecordLocking/Entry/AfterUnlockRequest";
|
|
18
|
+
}
|
|
25
19
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
getHandlerAbstraction() {
|
|
35
|
-
return EntryUnlockRequestErrorEventHandler;
|
|
36
|
-
}
|
|
20
|
+
const EntryAfterUnlockRequestEventHandler = createAbstraction("EntryAfterUnlockRequestEventHandler");
|
|
21
|
+
class EntryUnlockRequestErrorEvent extends DomainEvent {
|
|
22
|
+
getHandlerAbstraction() {
|
|
23
|
+
return EntryUnlockRequestErrorEventHandler;
|
|
24
|
+
}
|
|
25
|
+
constructor(...args){
|
|
26
|
+
super(...args), this.eventType = "RecordLocking/Entry/UnlockRequestError";
|
|
27
|
+
}
|
|
37
28
|
}
|
|
38
|
-
|
|
29
|
+
const EntryUnlockRequestErrorEventHandler = createAbstraction("EntryUnlockRequestErrorEventHandler");
|
|
30
|
+
export { EntryAfterUnlockRequestEvent, EntryAfterUnlockRequestEventHandler, EntryBeforeUnlockRequestEvent, EntryBeforeUnlockRequestEventHandler, EntryUnlockRequestErrorEvent, EntryUnlockRequestErrorEventHandler };
|
|
39
31
|
|
|
40
32
|
//# sourceMappingURL=events.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/UnlockEntryRequest/events.js","sources":["../../../src/features/UnlockEntryRequest/events.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { DomainEvent } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { IEventHandler } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { ILockRecord } from \"~/domain/LockRecord.js\";\nimport type { LockRecordEntryType } from \"~/domain/types.js\";\n\n// ============================================================================\n// EntryBeforeUnlockRequest Event\n// ============================================================================\n\nexport interface EntryBeforeUnlockRequestPayload {\n id: string;\n type: LockRecordEntryType;\n}\n\nexport class EntryBeforeUnlockRequestEvent extends DomainEvent<EntryBeforeUnlockRequestPayload> {\n eventType = \"RecordLocking/Entry/BeforeUnlockRequest\" as const;\n\n getHandlerAbstraction() {\n return EntryBeforeUnlockRequestEventHandler;\n }\n}\n\nexport const EntryBeforeUnlockRequestEventHandler = createAbstraction<\n IEventHandler<EntryBeforeUnlockRequestEvent>\n>(\"EntryBeforeUnlockRequestEventHandler\");\n\nexport namespace EntryBeforeUnlockRequestEventHandler {\n export type Interface = IEventHandler<EntryBeforeUnlockRequestEvent>;\n export type Event = EntryBeforeUnlockRequestEvent;\n}\n\n// ============================================================================\n// EntryAfterUnlockRequest Event\n// ============================================================================\n\nexport interface EntryAfterUnlockRequestPayload {\n id: string;\n type: LockRecordEntryType;\n record: ILockRecord;\n}\n\nexport class EntryAfterUnlockRequestEvent extends DomainEvent<EntryAfterUnlockRequestPayload> {\n eventType = \"RecordLocking/Entry/AfterUnlockRequest\" as const;\n\n getHandlerAbstraction() {\n return EntryAfterUnlockRequestEventHandler;\n }\n}\n\nexport const EntryAfterUnlockRequestEventHandler = createAbstraction<\n IEventHandler<EntryAfterUnlockRequestEvent>\n>(\"EntryAfterUnlockRequestEventHandler\");\n\nexport namespace EntryAfterUnlockRequestEventHandler {\n export type Interface = IEventHandler<EntryAfterUnlockRequestEvent>;\n export type Event = EntryAfterUnlockRequestEvent;\n}\n\n// ============================================================================\n// EntryUnlockRequestError Event\n// ============================================================================\n\nexport interface EntryUnlockRequestErrorPayload {\n id: string;\n type: LockRecordEntryType;\n error: Error;\n}\n\nexport class EntryUnlockRequestErrorEvent extends DomainEvent<EntryUnlockRequestErrorPayload> {\n eventType = \"RecordLocking/Entry/UnlockRequestError\" as const;\n\n getHandlerAbstraction() {\n return EntryUnlockRequestErrorEventHandler;\n }\n}\n\nexport const EntryUnlockRequestErrorEventHandler = createAbstraction<\n IEventHandler<EntryUnlockRequestErrorEvent>\n>(\"EntryUnlockRequestErrorEventHandler\");\n\nexport namespace EntryUnlockRequestErrorEventHandler {\n export type Interface = IEventHandler<EntryUnlockRequestErrorEvent>;\n export type Event = EntryUnlockRequestErrorEvent;\n}\n"],"names":["EntryBeforeUnlockRequestEvent","DomainEvent","EntryBeforeUnlockRequestEventHandler","createAbstraction","EntryAfterUnlockRequestEvent","EntryAfterUnlockRequestEventHandler","EntryUnlockRequestErrorEvent","EntryUnlockRequestErrorEventHandler"],"mappings":";;AAeO,MAAMA,sCAAsCC;IAG/C,wBAAwB;QACpB,OAAOC;IACX;;QALG,qBACH,SAAS,GAAG;;AAKhB;AAEO,MAAMA,uCAAuCC,kBAElD;AAiBK,MAAMC,qCAAqCH;IAG9C,wBAAwB;QACpB,OAAOI;IACX;;QALG,qBACH,SAAS,GAAG;;AAKhB;AAEO,MAAMA,sCAAsCF,kBAEjD;AAiBK,MAAMG,qCAAqCL;IAG9C,wBAAwB;QACpB,OAAOM;IACX;;QALG,qBACH,SAAS,GAAG;;AAKhB;AAEO,MAAMA,sCAAsCJ,kBAEjD"}
|
|
@@ -2,13 +2,14 @@ import { createFeature } from "@webiny/feature/api";
|
|
|
2
2
|
import { UnlockEntryRequestUseCase } from "./UnlockEntryRequestUseCase.js";
|
|
3
3
|
import { UnlockEntryRequestRepository } from "./UnlockEntryRequestRepository.js";
|
|
4
4
|
import { UnlockEntryRequestEventsDecorator } from "./UnlockEntryRequestEventsDecorator.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
const UnlockEntryRequestFeature = createFeature({
|
|
6
|
+
name: "UnlockEntryRequest",
|
|
7
|
+
register (container) {
|
|
8
|
+
container.register(UnlockEntryRequestUseCase);
|
|
9
|
+
container.register(UnlockEntryRequestRepository).inSingletonScope();
|
|
10
|
+
container.registerDecorator(UnlockEntryRequestEventsDecorator);
|
|
11
|
+
}
|
|
12
12
|
});
|
|
13
|
+
export { UnlockEntryRequestFeature };
|
|
13
14
|
|
|
14
15
|
//# sourceMappingURL=feature.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/UnlockEntryRequest/feature.js","sources":["../../../src/features/UnlockEntryRequest/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { UnlockEntryRequestUseCase } from \"./UnlockEntryRequestUseCase.js\";\nimport { UnlockEntryRequestRepository } from \"./UnlockEntryRequestRepository.js\";\nimport { UnlockEntryRequestEventsDecorator } from \"./UnlockEntryRequestEventsDecorator.js\";\n\nexport const UnlockEntryRequestFeature = createFeature({\n name: \"UnlockEntryRequest\",\n register(container) {\n container.register(UnlockEntryRequestUseCase);\n container.register(UnlockEntryRequestRepository).inSingletonScope();\n container.registerDecorator(UnlockEntryRequestEventsDecorator);\n }\n});\n"],"names":["UnlockEntryRequestFeature","createFeature","container","UnlockEntryRequestUseCase","UnlockEntryRequestRepository","UnlockEntryRequestEventsDecorator"],"mappings":";;;;AAKO,MAAMA,4BAA4BC,cAAc;IACnD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE,8BAA8B,gBAAgB;QACjEF,UAAU,iBAAiB,CAACG;IAChC;AACJ"}
|
|
@@ -3,61 +3,58 @@ import { UpdateEntryUseCase } from "@webiny/api-headless-cms/features/contentEnt
|
|
|
3
3
|
import { GetEntryByIdUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetEntryById";
|
|
4
4
|
import { Result } from "@webiny/feature/api";
|
|
5
5
|
import { createIdentifier } from "@webiny/utils";
|
|
6
|
-
import { UpdateEntryLockRepository
|
|
6
|
+
import { UpdateEntryLockRepository } from "./abstractions.js";
|
|
7
7
|
import { RecordLockingConfig, RecordLockingModel } from "../../domain/abstractions.js";
|
|
8
8
|
import { LockRecord } from "../../domain/LockRecord.js";
|
|
9
9
|
import { LockRecordPersistenceError } from "../../domain/errors.js";
|
|
10
10
|
import { createLockRecordDatabaseId } from "../../utils/lockRecordDatabaseId.js";
|
|
11
11
|
class UpdateEntryLockRepositoryImpl {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const getResult = await this.getEntryById.execute(this.model, id);
|
|
47
|
-
if (getResult.isFail()) {
|
|
48
|
-
return Result.fail(new LockRecordPersistenceError(getResult.error));
|
|
49
|
-
}
|
|
50
|
-
const entry = getResult.value;
|
|
51
|
-
const lockRecord = new LockRecord(entry, this.config.timeout);
|
|
52
|
-
return Result.ok(lockRecord);
|
|
53
|
-
} catch (error) {
|
|
54
|
-
return Result.fail(new LockRecordPersistenceError(error));
|
|
12
|
+
constructor(model, config, identityContext, updateEntry, getEntryById){
|
|
13
|
+
this.model = model;
|
|
14
|
+
this.config = config;
|
|
15
|
+
this.identityContext = identityContext;
|
|
16
|
+
this.updateEntry = updateEntry;
|
|
17
|
+
this.getEntryById = getEntryById;
|
|
18
|
+
}
|
|
19
|
+
async update(lockRecordId, updateOwner) {
|
|
20
|
+
try {
|
|
21
|
+
const entryId = createLockRecordDatabaseId(lockRecordId);
|
|
22
|
+
const id = createIdentifier({
|
|
23
|
+
id: entryId,
|
|
24
|
+
version: 1
|
|
25
|
+
});
|
|
26
|
+
const identity = this.identityContext.getIdentity();
|
|
27
|
+
const now = new Date().toISOString();
|
|
28
|
+
const updateData = {
|
|
29
|
+
savedOn: now
|
|
30
|
+
};
|
|
31
|
+
if (updateOwner) {
|
|
32
|
+
updateData.createdOn = now;
|
|
33
|
+
updateData.createdBy = identity;
|
|
34
|
+
updateData.savedBy = identity;
|
|
35
|
+
}
|
|
36
|
+
const result = await this.updateEntry.execute(this.model, id, updateData);
|
|
37
|
+
if (result.isFail()) return Result.fail(new LockRecordPersistenceError(result.error));
|
|
38
|
+
const getResult = await this.getEntryById.execute(this.model, id);
|
|
39
|
+
if (getResult.isFail()) return Result.fail(new LockRecordPersistenceError(getResult.error));
|
|
40
|
+
const entry = getResult.value;
|
|
41
|
+
const lockRecord = new LockRecord(entry, this.config.timeout);
|
|
42
|
+
return Result.ok(lockRecord);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
return Result.fail(new LockRecordPersistenceError(error));
|
|
45
|
+
}
|
|
55
46
|
}
|
|
56
|
-
}
|
|
57
47
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
const UpdateEntryLockRepository_UpdateEntryLockRepository = UpdateEntryLockRepository.createImplementation({
|
|
49
|
+
implementation: UpdateEntryLockRepositoryImpl,
|
|
50
|
+
dependencies: [
|
|
51
|
+
RecordLockingModel,
|
|
52
|
+
RecordLockingConfig,
|
|
53
|
+
IdentityContext,
|
|
54
|
+
UpdateEntryUseCase,
|
|
55
|
+
GetEntryByIdUseCase
|
|
56
|
+
]
|
|
61
57
|
});
|
|
58
|
+
export { UpdateEntryLockRepository_UpdateEntryLockRepository as UpdateEntryLockRepository };
|
|
62
59
|
|
|
63
60
|
//# sourceMappingURL=UpdateEntryLockRepository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/UpdateEntryLock/UpdateEntryLockRepository.js","sources":["../../../src/features/UpdateEntryLock/UpdateEntryLockRepository.ts"],"sourcesContent":["import { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { UpdateEntryUseCase } from \"@webiny/api-headless-cms/features/contentEntry/UpdateEntry\";\nimport { GetEntryByIdUseCase } from \"@webiny/api-headless-cms/features/contentEntry/GetEntryById\";\nimport { Result } from \"@webiny/feature/api\";\nimport { createIdentifier } from \"@webiny/utils\";\nimport { UpdateEntryLockRepository as RepositoryAbstraction } from \"./abstractions.js\";\nimport { RecordLockingConfig, RecordLockingModel } from \"~/domain/abstractions.js\";\nimport type { ILockRecord } from \"~/domain/LockRecord.js\";\nimport { LockRecord } from \"~/domain/LockRecord.js\";\nimport type { LockRecordValues } from \"~/domain/types.js\";\nimport { LockRecordPersistenceError } from \"~/domain/errors.js\";\nimport { createLockRecordDatabaseId } from \"~/utils/lockRecordDatabaseId.js\";\n\nclass UpdateEntryLockRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private model: RecordLockingModel.Interface,\n private config: RecordLockingConfig.Interface,\n private identityContext: IdentityContext.Interface,\n private updateEntry: UpdateEntryUseCase.Interface,\n private getEntryById: GetEntryByIdUseCase.Interface\n ) {}\n\n async update(\n lockRecordId: string,\n updateOwner: boolean\n ): Promise<Result<ILockRecord, RepositoryAbstraction.Error>> {\n try {\n const entryId = createLockRecordDatabaseId(lockRecordId);\n const id = createIdentifier({\n id: entryId,\n version: 1\n });\n\n const identity = this.identityContext.getIdentity();\n const now = new Date().toISOString();\n\n // Build update data\n const updateData: any = {\n savedOn: now\n };\n\n // If updating owner (expired lock), also update created fields\n if (updateOwner) {\n updateData.createdOn = now;\n updateData.createdBy = identity;\n updateData.savedBy = identity;\n }\n\n const result = await this.updateEntry.execute(this.model, id, updateData);\n\n if (result.isFail()) {\n return Result.fail(new LockRecordPersistenceError(result.error));\n }\n\n // Fetch the updated entry to return full lock record\n const getResult = await this.getEntryById.execute<LockRecordValues>(this.model, id);\n\n if (getResult.isFail()) {\n return Result.fail(new LockRecordPersistenceError(getResult.error));\n }\n\n const entry = getResult.value;\n const lockRecord = new LockRecord(entry, this.config.timeout);\n\n return Result.ok(lockRecord);\n } catch (error) {\n return Result.fail(new LockRecordPersistenceError(error as Error));\n }\n }\n}\n\nexport const UpdateEntryLockRepository = RepositoryAbstraction.createImplementation({\n implementation: UpdateEntryLockRepositoryImpl,\n dependencies: [\n RecordLockingModel,\n RecordLockingConfig,\n IdentityContext,\n UpdateEntryUseCase,\n GetEntryByIdUseCase\n ]\n});\n"],"names":["UpdateEntryLockRepositoryImpl","model","config","identityContext","updateEntry","getEntryById","lockRecordId","updateOwner","entryId","createLockRecordDatabaseId","id","createIdentifier","identity","now","Date","updateData","result","Result","LockRecordPersistenceError","getResult","entry","lockRecord","LockRecord","error","UpdateEntryLockRepository","RepositoryAbstraction","RecordLockingModel","RecordLockingConfig","IdentityContext","UpdateEntryUseCase","GetEntryByIdUseCase"],"mappings":";;;;;;;;;;AAaA,MAAMA;IACF,YACYC,KAAmC,EACnCC,MAAqC,EACrCC,eAA0C,EAC1CC,WAAyC,EACzCC,YAA2C,CACrD;aALUJ,KAAK,GAALA;aACAC,MAAM,GAANA;aACAC,eAAe,GAAfA;aACAC,WAAW,GAAXA;aACAC,YAAY,GAAZA;IACT;IAEH,MAAM,OACFC,YAAoB,EACpBC,WAAoB,EACqC;QACzD,IAAI;YACA,MAAMC,UAAUC,2BAA2BH;YAC3C,MAAMI,KAAKC,iBAAiB;gBACxB,IAAIH;gBACJ,SAAS;YACb;YAEA,MAAMI,WAAW,IAAI,CAAC,eAAe,CAAC,WAAW;YACjD,MAAMC,MAAM,IAAIC,OAAO,WAAW;YAGlC,MAAMC,aAAkB;gBACpB,SAASF;YACb;YAGA,IAAIN,aAAa;gBACbQ,WAAW,SAAS,GAAGF;gBACvBE,WAAW,SAAS,GAAGH;gBACvBG,WAAW,OAAO,GAAGH;YACzB;YAEA,MAAMI,SAAS,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAEN,IAAIK;YAE9D,IAAIC,OAAO,MAAM,IACb,OAAOC,OAAO,IAAI,CAAC,IAAIC,2BAA2BF,OAAO,KAAK;YAIlE,MAAMG,YAAY,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAmB,IAAI,CAAC,KAAK,EAAET;YAEhF,IAAIS,UAAU,MAAM,IAChB,OAAOF,OAAO,IAAI,CAAC,IAAIC,2BAA2BC,UAAU,KAAK;YAGrE,MAAMC,QAAQD,UAAU,KAAK;YAC7B,MAAME,aAAa,IAAIC,WAAWF,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO;YAE5D,OAAOH,OAAO,EAAE,CAACI;QACrB,EAAE,OAAOE,OAAO;YACZ,OAAON,OAAO,IAAI,CAAC,IAAIC,2BAA2BK;QACtD;IACJ;AACJ;AAEO,MAAMC,sDAA4BC,0BAAAA,oBAA0C,CAAC;IAChF,gBAAgBzB;IAChB,cAAc;QACV0B;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|