@webiny/api-record-locking 0.0.0-unstable.c27f4d8a31 → 0.0.0-unstable.d0f34a8194

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 (187) hide show
  1. package/RecordLockingAppFeature.d.ts +11 -0
  2. package/RecordLockingAppFeature.js +20 -0
  3. package/RecordLockingAppFeature.js.map +1 -0
  4. package/domain/LockRecord.js +63 -70
  5. package/domain/LockRecord.js.map +1 -1
  6. package/domain/RecordLockingModel.js +27 -23
  7. package/domain/RecordLockingModel.js.map +1 -1
  8. package/domain/abstractions.d.ts +9 -3
  9. package/domain/abstractions.js +3 -7
  10. package/domain/abstractions.js.map +1 -1
  11. package/domain/calculateExpiresOn.js +5 -6
  12. package/domain/calculateExpiresOn.js.map +1 -1
  13. package/domain/errors.js +71 -81
  14. package/domain/errors.js.map +1 -1
  15. package/domain/index.js +0 -2
  16. package/domain/types.js +6 -9
  17. package/domain/types.js.map +1 -1
  18. package/features/GetLockRecord/GetLockRecordRepository.d.ts +4 -3
  19. package/features/GetLockRecord/GetLockRecordRepository.js +33 -25
  20. package/features/GetLockRecord/GetLockRecordRepository.js.map +1 -1
  21. package/features/GetLockRecord/GetLockRecordUseCase.js +13 -10
  22. package/features/GetLockRecord/GetLockRecordUseCase.js.map +1 -1
  23. package/features/GetLockRecord/abstractions.js +3 -14
  24. package/features/GetLockRecord/abstractions.js.map +1 -1
  25. package/features/GetLockRecord/feature.d.ts +4 -1
  26. package/features/GetLockRecord/feature.js +7 -6
  27. package/features/GetLockRecord/feature.js.map +1 -1
  28. package/features/GetLockRecord/index.js +0 -2
  29. package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.d.ts +1 -1
  30. package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js +20 -29
  31. package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js.map +1 -1
  32. package/features/GetLockedEntryLockRecord/abstractions.js +2 -10
  33. package/features/GetLockedEntryLockRecord/abstractions.js.map +1 -1
  34. package/features/GetLockedEntryLockRecord/feature.d.ts +4 -1
  35. package/features/GetLockedEntryLockRecord/feature.js +6 -5
  36. package/features/GetLockedEntryLockRecord/feature.js.map +1 -1
  37. package/features/GetLockedEntryLockRecord/index.js +0 -2
  38. package/features/IsEntryLocked/IsEntryLockedUseCase.d.ts +1 -1
  39. package/features/IsEntryLocked/IsEntryLockedUseCase.js +23 -29
  40. package/features/IsEntryLocked/IsEntryLockedUseCase.js.map +1 -1
  41. package/features/IsEntryLocked/abstractions.js +2 -9
  42. package/features/IsEntryLocked/abstractions.js.map +1 -1
  43. package/features/IsEntryLocked/feature.d.ts +4 -1
  44. package/features/IsEntryLocked/feature.js +6 -5
  45. package/features/IsEntryLocked/feature.js.map +1 -1
  46. package/features/IsEntryLocked/index.js +0 -2
  47. package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.d.ts +4 -4
  48. package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.js +28 -34
  49. package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.js.map +1 -1
  50. package/features/KickOutCurrentUser/abstractions.js +2 -6
  51. package/features/KickOutCurrentUser/abstractions.js.map +1 -1
  52. package/features/KickOutCurrentUser/feature.d.ts +4 -1
  53. package/features/KickOutCurrentUser/feature.js +6 -5
  54. package/features/KickOutCurrentUser/feature.js.map +1 -1
  55. package/features/KickOutCurrentUser/index.js +0 -2
  56. package/features/ListAllLockRecords/ListAllLockRecordsRepository.d.ts +5 -3
  57. package/features/ListAllLockRecords/ListAllLockRecordsRepository.js +39 -32
  58. package/features/ListAllLockRecords/ListAllLockRecordsRepository.js.map +1 -1
  59. package/features/ListAllLockRecords/ListAllLockRecordsUseCase.js +13 -10
  60. package/features/ListAllLockRecords/ListAllLockRecordsUseCase.js.map +1 -1
  61. package/features/ListAllLockRecords/abstractions.js +3 -14
  62. package/features/ListAllLockRecords/abstractions.js.map +1 -1
  63. package/features/ListAllLockRecords/feature.d.ts +4 -1
  64. package/features/ListAllLockRecords/feature.js +7 -6
  65. package/features/ListAllLockRecords/feature.js.map +1 -1
  66. package/features/ListAllLockRecords/index.js +0 -2
  67. package/features/ListLockRecords/ListLockRecordsRepository.d.ts +6 -3
  68. package/features/ListLockRecords/ListLockRecordsRepository.js +39 -32
  69. package/features/ListLockRecords/ListLockRecordsRepository.js.map +1 -1
  70. package/features/ListLockRecords/ListLockRecordsUseCase.d.ts +1 -1
  71. package/features/ListLockRecords/ListLockRecordsUseCase.js +27 -24
  72. package/features/ListLockRecords/ListLockRecordsUseCase.js.map +1 -1
  73. package/features/ListLockRecords/abstractions.js +3 -14
  74. package/features/ListLockRecords/abstractions.js.map +1 -1
  75. package/features/ListLockRecords/feature.d.ts +4 -1
  76. package/features/ListLockRecords/feature.js +7 -6
  77. package/features/ListLockRecords/feature.js.map +1 -1
  78. package/features/ListLockRecords/index.js +0 -2
  79. package/features/LockEntry/LockEntryEventsDecorator.d.ts +1 -1
  80. package/features/LockEntry/LockEntryEventsDecorator.js +32 -32
  81. package/features/LockEntry/LockEntryEventsDecorator.js.map +1 -1
  82. package/features/LockEntry/LockEntryRepository.d.ts +4 -3
  83. package/features/LockEntry/LockEntryRepository.js +35 -31
  84. package/features/LockEntry/LockEntryRepository.js.map +1 -1
  85. package/features/LockEntry/LockEntryUseCase.js +21 -26
  86. package/features/LockEntry/LockEntryUseCase.js.map +1 -1
  87. package/features/LockEntry/abstractions.js +3 -14
  88. package/features/LockEntry/abstractions.js.map +1 -1
  89. package/features/LockEntry/events.d.ts +2 -2
  90. package/features/LockEntry/events.js +26 -34
  91. package/features/LockEntry/events.js.map +1 -1
  92. package/features/LockEntry/feature.d.ts +4 -1
  93. package/features/LockEntry/feature.js +8 -7
  94. package/features/LockEntry/feature.js.map +1 -1
  95. package/features/LockEntry/index.js +0 -2
  96. package/features/RecordLockingFeature.d.ts +4 -6
  97. package/features/RecordLockingFeature.js +21 -22
  98. package/features/RecordLockingFeature.js.map +1 -1
  99. package/features/RecordLockingModelProvider.d.ts +18 -0
  100. package/features/RecordLockingModelProvider.js +22 -0
  101. package/features/RecordLockingModelProvider.js.map +1 -0
  102. package/features/UnlockEntry/UnlockEntryEventsDecorator.d.ts +1 -1
  103. package/features/UnlockEntry/UnlockEntryEventsDecorator.js +33 -33
  104. package/features/UnlockEntry/UnlockEntryEventsDecorator.js.map +1 -1
  105. package/features/UnlockEntry/UnlockEntryRepository.d.ts +3 -3
  106. package/features/UnlockEntry/UnlockEntryRepository.js +31 -28
  107. package/features/UnlockEntry/UnlockEntryRepository.js.map +1 -1
  108. package/features/UnlockEntry/UnlockEntryUseCase.d.ts +1 -1
  109. package/features/UnlockEntry/UnlockEntryUseCase.js +54 -70
  110. package/features/UnlockEntry/UnlockEntryUseCase.js.map +1 -1
  111. package/features/UnlockEntry/abstractions.js +3 -14
  112. package/features/UnlockEntry/abstractions.js.map +1 -1
  113. package/features/UnlockEntry/events.d.ts +2 -2
  114. package/features/UnlockEntry/events.js +26 -34
  115. package/features/UnlockEntry/events.js.map +1 -1
  116. package/features/UnlockEntry/feature.d.ts +4 -1
  117. package/features/UnlockEntry/feature.js +8 -7
  118. package/features/UnlockEntry/feature.js.map +1 -1
  119. package/features/UnlockEntry/hasFullAccessPermission.d.ts +1 -1
  120. package/features/UnlockEntry/hasFullAccessPermission.js +6 -7
  121. package/features/UnlockEntry/hasFullAccessPermission.js.map +1 -1
  122. package/features/UnlockEntry/index.js +0 -2
  123. package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.d.ts +1 -1
  124. package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.js +32 -32
  125. package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.js.map +1 -1
  126. package/features/UnlockEntryRequest/UnlockEntryRequestRepository.d.ts +4 -4
  127. package/features/UnlockEntryRequest/UnlockEntryRequestRepository.js +34 -32
  128. package/features/UnlockEntryRequest/UnlockEntryRequestRepository.js.map +1 -1
  129. package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.d.ts +1 -1
  130. package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.js +63 -80
  131. package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.js.map +1 -1
  132. package/features/UnlockEntryRequest/abstractions.js +3 -14
  133. package/features/UnlockEntryRequest/abstractions.js.map +1 -1
  134. package/features/UnlockEntryRequest/events.d.ts +2 -2
  135. package/features/UnlockEntryRequest/events.js +26 -34
  136. package/features/UnlockEntryRequest/events.js.map +1 -1
  137. package/features/UnlockEntryRequest/feature.d.ts +4 -1
  138. package/features/UnlockEntryRequest/feature.js +8 -7
  139. package/features/UnlockEntryRequest/feature.js.map +1 -1
  140. package/features/UnlockEntryRequest/index.js +0 -2
  141. package/features/UpdateEntryLock/UpdateEntryLockRepository.d.ts +5 -4
  142. package/features/UpdateEntryLock/UpdateEntryLockRepository.js +48 -50
  143. package/features/UpdateEntryLock/UpdateEntryLockRepository.js.map +1 -1
  144. package/features/UpdateEntryLock/UpdateEntryLockUseCase.d.ts +1 -1
  145. package/features/UpdateEntryLock/UpdateEntryLockUseCase.js +41 -52
  146. package/features/UpdateEntryLock/UpdateEntryLockUseCase.js.map +1 -1
  147. package/features/UpdateEntryLock/abstractions.js +3 -14
  148. package/features/UpdateEntryLock/abstractions.js.map +1 -1
  149. package/features/UpdateEntryLock/feature.d.ts +4 -1
  150. package/features/UpdateEntryLock/feature.js +7 -6
  151. package/features/UpdateEntryLock/feature.js.map +1 -1
  152. package/features/UpdateEntryLock/index.js +0 -2
  153. package/graphql/RecordLockingGraphQLSchema.d.ts +25 -0
  154. package/graphql/RecordLockingGraphQLSchema.js +390 -0
  155. package/graphql/RecordLockingGraphQLSchema.js.map +1 -0
  156. package/graphql/checkPermissions.d.ts +3 -3
  157. package/graphql/checkPermissions.js +4 -10
  158. package/graphql/checkPermissions.js.map +1 -1
  159. package/graphql/resolve.d.ts +1 -1
  160. package/graphql/resolve.js +16 -18
  161. package/graphql/resolve.js.map +1 -1
  162. package/index.d.ts +2 -9
  163. package/index.js +1 -62
  164. package/package.json +27 -22
  165. package/types.js +6 -9
  166. package/types.js.map +1 -1
  167. package/utils/convertWhereCondition.js +20 -32
  168. package/utils/convertWhereCondition.js.map +1 -1
  169. package/utils/getTimeout.js +8 -15
  170. package/utils/getTimeout.js.map +1 -1
  171. package/utils/lockRecordDatabaseId.js +6 -11
  172. package/utils/lockRecordDatabaseId.js.map +1 -1
  173. package/domain/index.js.map +0 -1
  174. package/features/GetLockRecord/index.js.map +0 -1
  175. package/features/GetLockedEntryLockRecord/index.js.map +0 -1
  176. package/features/IsEntryLocked/index.js.map +0 -1
  177. package/features/KickOutCurrentUser/index.js.map +0 -1
  178. package/features/ListAllLockRecords/index.js.map +0 -1
  179. package/features/ListLockRecords/index.js.map +0 -1
  180. package/features/LockEntry/index.js.map +0 -1
  181. package/features/UnlockEntry/index.js.map +0 -1
  182. package/features/UnlockEntryRequest/index.js.map +0 -1
  183. package/features/UpdateEntryLock/index.js.map +0 -1
  184. package/graphql/schema.d.ts +0 -11
  185. package/graphql/schema.js +0 -318
  186. package/graphql/schema.js.map +0 -1
  187. package/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["Result","UnlockEntryRequestUseCase","UseCaseAbstraction","UnlockEntryRequestRepository","GetLockRecordUseCase","IdentityContext","EntryNotLockedError","UnlockRequestAlreadySentError","LockRecordNotFoundError","LockRecordPersistenceError","RecordLockingLockRecordActionType","UnlockEntryRequestUseCaseImpl","constructor","getLockRecord","repository","identityContext","execute","input","recordResult","isFail","error","id","type","fail","record","value","isExpired","unlockRequested","getUnlockRequested","currentIdentity","getIdentity","createdBy","identityId","approved","getUnlockApproved","denied","getUnlockDenied","ok","identity","addAction","requested","createdOn","Date","updateResult","update","createImplementation","implementation","dependencies"],"sources":["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/IdentityContext\";\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"],"mappings":"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","ignoreList":[]}
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
- // Input type
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,"names":["createAbstraction","UnlockEntryRequestUseCase","UnlockEntryRequestRepository"],"sources":["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"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAWvD;;AAMA;AACA;AACA;;AAcA,OAAO,MAAMC,yBAAyB,GAAGD,iBAAiB,CACtD,2BACJ,CAAC;;AAOD;AACA;AACA;;AAYA,OAAO,MAAME,4BAA4B,GAAGF,iBAAiB,CACzD,8BACJ,CAAC","ignoreList":[]}
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,5 +1,5 @@
1
- import { DomainEvent } from "@webiny/api-core/features/EventPublisher";
2
- import type { IEventHandler } from "@webiny/api-core/features/EventPublisher";
1
+ import { DomainEvent } from "@webiny/api-core/features/eventPublisher/index.js";
2
+ import type { IEventHandler } from "@webiny/api-core/features/eventPublisher/index.js";
3
3
  import type { ILockRecord } from "../../domain/LockRecord.js";
4
4
  import type { LockRecordEntryType } from "../../domain/types.js";
5
5
  export interface EntryBeforeUnlockRequestPayload {
@@ -1,40 +1,32 @@
1
1
  import { createAbstraction } from "@webiny/feature/api";
2
- import { DomainEvent } from "@webiny/api-core/features/EventPublisher";
3
-
4
- // ============================================================================
5
- // EntryBeforeUnlockRequest Event
6
- // ============================================================================
7
-
8
- export class EntryBeforeUnlockRequestEvent extends DomainEvent {
9
- eventType = "RecordLocking/Entry/BeforeUnlockRequest";
10
- getHandlerAbstraction() {
11
- return EntryBeforeUnlockRequestEventHandler;
12
- }
2
+ import { DomainEvent } from "@webiny/api-core/features/eventPublisher/index.js";
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
- export const EntryBeforeUnlockRequestEventHandler = createAbstraction("EntryBeforeUnlockRequestEventHandler");
15
-
16
- // ============================================================================
17
- // EntryAfterUnlockRequest Event
18
- // ============================================================================
19
-
20
- export class EntryAfterUnlockRequestEvent extends DomainEvent {
21
- eventType = "RecordLocking/Entry/AfterUnlockRequest";
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
- export const EntryAfterUnlockRequestEventHandler = createAbstraction("EntryAfterUnlockRequestEventHandler");
27
-
28
- // ============================================================================
29
- // EntryUnlockRequestError Event
30
- // ============================================================================
31
-
32
- export class EntryUnlockRequestErrorEvent extends DomainEvent {
33
- eventType = "RecordLocking/Entry/UnlockRequestError";
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
- export const EntryUnlockRequestErrorEventHandler = createAbstraction("EntryUnlockRequestErrorEventHandler");
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,"names":["createAbstraction","DomainEvent","EntryBeforeUnlockRequestEvent","eventType","getHandlerAbstraction","EntryBeforeUnlockRequestEventHandler","EntryAfterUnlockRequestEvent","EntryAfterUnlockRequestEventHandler","EntryUnlockRequestErrorEvent","EntryUnlockRequestErrorEventHandler"],"sources":["events.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { DomainEvent } from \"@webiny/api-core/features/EventPublisher\";\nimport type { IEventHandler } from \"@webiny/api-core/features/EventPublisher\";\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"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,WAAW,QAAQ,0CAA0C;;AAKtE;AACA;AACA;;AAOA,OAAO,MAAMC,6BAA6B,SAASD,WAAW,CAAkC;EAC5FE,SAAS,GAAG,yCAAyC;EAErDC,qBAAqBA,CAAA,EAAG;IACpB,OAAOC,oCAAoC;EAC/C;AACJ;AAEA,OAAO,MAAMA,oCAAoC,GAAGL,iBAAiB,CAEnE,sCAAsC,CAAC;;AAOzC;AACA;AACA;;AAQA,OAAO,MAAMM,4BAA4B,SAASL,WAAW,CAAiC;EAC1FE,SAAS,GAAG,wCAAwC;EAEpDC,qBAAqBA,CAAA,EAAG;IACpB,OAAOG,mCAAmC;EAC9C;AACJ;AAEA,OAAO,MAAMA,mCAAmC,GAAGP,iBAAiB,CAElE,qCAAqC,CAAC;;AAOxC;AACA;AACA;;AAQA,OAAO,MAAMQ,4BAA4B,SAASP,WAAW,CAAiC;EAC1FE,SAAS,GAAG,wCAAwC;EAEpDC,qBAAqBA,CAAA,EAAG;IACpB,OAAOK,mCAAmC;EAC9C;AACJ;AAEA,OAAO,MAAMA,mCAAmC,GAAGT,iBAAiB,CAElE,qCAAqC,CAAC","ignoreList":[]}
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"}
@@ -1 +1,4 @@
1
- export declare const UnlockEntryRequestFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const UnlockEntryRequestFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -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
- export const UnlockEntryRequestFeature = createFeature({
6
- name: "UnlockEntryRequest",
7
- register(container) {
8
- container.register(UnlockEntryRequestUseCase);
9
- container.register(UnlockEntryRequestRepository).inSingletonScope();
10
- container.registerDecorator(UnlockEntryRequestEventsDecorator);
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,"names":["createFeature","UnlockEntryRequestUseCase","UnlockEntryRequestRepository","UnlockEntryRequestEventsDecorator","UnlockEntryRequestFeature","name","register","container","inSingletonScope","registerDecorator"],"sources":["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"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,yBAAyB;AAClC,SAASC,4BAA4B;AACrC,SAASC,iCAAiC;AAE1C,OAAO,MAAMC,yBAAyB,GAAGJ,aAAa,CAAC;EACnDK,IAAI,EAAE,oBAAoB;EAC1BC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACL,yBAAyB,CAAC;IAC7CM,SAAS,CAACD,QAAQ,CAACJ,4BAA4B,CAAC,CAACM,gBAAgB,CAAC,CAAC;IACnED,SAAS,CAACE,iBAAiB,CAACN,iCAAiC,CAAC;EAClE;AACJ,CAAC,CAAC","ignoreList":[]}
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"}
@@ -1,5 +1,3 @@
1
1
  export * from "./abstractions.js";
2
2
  export * from "./events.js";
3
3
  export * from "./feature.js";
4
-
5
- //# sourceMappingURL=index.js.map
@@ -1,17 +1,18 @@
1
- import { IdentityContext } from "@webiny/api-core/features/IdentityContext";
1
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
2
2
  import { UpdateEntryUseCase } from "@webiny/api-headless-cms/features/contentEntry/UpdateEntry";
3
3
  import { GetEntryByIdUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetEntryById";
4
4
  import { Result } from "@webiny/feature/api";
5
5
  import { UpdateEntryLockRepository as RepositoryAbstraction } from "./abstractions.js";
6
- import { RecordLockingConfig, RecordLockingModel } from "../../domain/abstractions.js";
6
+ import { RecordLockingConfig } from "../../domain/abstractions.js";
7
+ import { RecordLockingModelProvider } from "../../domain/abstractions.js";
7
8
  import type { ILockRecord } from "../../domain/LockRecord.js";
8
9
  declare class UpdateEntryLockRepositoryImpl implements RepositoryAbstraction.Interface {
9
- private model;
10
+ private modelProvider;
10
11
  private config;
11
12
  private identityContext;
12
13
  private updateEntry;
13
14
  private getEntryById;
14
- constructor(model: RecordLockingModel.Interface, config: RecordLockingConfig.Interface, identityContext: IdentityContext.Interface, updateEntry: UpdateEntryUseCase.Interface, getEntryById: GetEntryByIdUseCase.Interface);
15
+ constructor(modelProvider: RecordLockingModelProvider.Interface, config: RecordLockingConfig.Interface, identityContext: IdentityContext.Interface, updateEntry: UpdateEntryUseCase.Interface, getEntryById: GetEntryByIdUseCase.Interface);
15
16
  update(lockRecordId: string, updateOwner: boolean): Promise<Result<ILockRecord, RepositoryAbstraction.Error>>;
16
17
  }
17
18
  export declare const UpdateEntryLockRepository: typeof UpdateEntryLockRepositoryImpl & {
@@ -1,63 +1,61 @@
1
- import { IdentityContext } from "@webiny/api-core/features/IdentityContext";
1
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
2
2
  import { UpdateEntryUseCase } from "@webiny/api-headless-cms/features/contentEntry/UpdateEntry";
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 as RepositoryAbstraction } from "./abstractions.js";
7
- import { RecordLockingConfig, RecordLockingModel } from "../../domain/abstractions.js";
6
+ import { UpdateEntryLockRepository } from "./abstractions.js";
7
+ import { RecordLockingConfig, RecordLockingModelProvider } 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
- 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
-
29
- // Build update data
30
- const updateData = {
31
- savedOn: now
32
- };
33
-
34
- // If updating owner (expired lock), also update created fields
35
- if (updateOwner) {
36
- updateData.createdOn = now;
37
- updateData.createdBy = identity;
38
- updateData.savedBy = identity;
39
- }
40
- const result = await this.updateEntry.execute(this.model, id, updateData);
41
- if (result.isFail()) {
42
- return Result.fail(new LockRecordPersistenceError(result.error));
43
- }
44
-
45
- // Fetch the updated entry to return full lock record
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(modelProvider, config, identityContext, updateEntry, getEntryById){
13
+ this.modelProvider = modelProvider;
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 model = await this.modelProvider.get();
22
+ const entryId = createLockRecordDatabaseId(lockRecordId);
23
+ const id = createIdentifier({
24
+ id: entryId,
25
+ version: 1
26
+ });
27
+ const identity = this.identityContext.getIdentity();
28
+ const now = new Date().toISOString();
29
+ const updateData = {
30
+ savedOn: now
31
+ };
32
+ if (updateOwner) {
33
+ updateData.createdOn = now;
34
+ updateData.createdBy = identity;
35
+ updateData.savedBy = identity;
36
+ }
37
+ const result = await this.updateEntry.execute(model, id, updateData);
38
+ if (result.isFail()) return Result.fail(new LockRecordPersistenceError(result.error));
39
+ const getResult = await this.getEntryById.execute(model, id);
40
+ if (getResult.isFail()) return Result.fail(new LockRecordPersistenceError(getResult.error));
41
+ const entry = getResult.value;
42
+ const lockRecord = new LockRecord(entry, this.config.timeout);
43
+ return Result.ok(lockRecord);
44
+ } catch (error) {
45
+ return Result.fail(new LockRecordPersistenceError(error));
46
+ }
55
47
  }
56
- }
57
48
  }
58
- export const UpdateEntryLockRepository = RepositoryAbstraction.createImplementation({
59
- implementation: UpdateEntryLockRepositoryImpl,
60
- dependencies: [RecordLockingModel, RecordLockingConfig, IdentityContext, UpdateEntryUseCase, GetEntryByIdUseCase]
49
+ const UpdateEntryLockRepository_UpdateEntryLockRepository = UpdateEntryLockRepository.createImplementation({
50
+ implementation: UpdateEntryLockRepositoryImpl,
51
+ dependencies: [
52
+ RecordLockingModelProvider,
53
+ RecordLockingConfig,
54
+ IdentityContext,
55
+ UpdateEntryUseCase,
56
+ GetEntryByIdUseCase
57
+ ]
61
58
  });
59
+ export { UpdateEntryLockRepository_UpdateEntryLockRepository as UpdateEntryLockRepository };
62
60
 
63
61
  //# sourceMappingURL=UpdateEntryLockRepository.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["IdentityContext","UpdateEntryUseCase","GetEntryByIdUseCase","Result","createIdentifier","UpdateEntryLockRepository","RepositoryAbstraction","RecordLockingConfig","RecordLockingModel","LockRecord","LockRecordPersistenceError","createLockRecordDatabaseId","UpdateEntryLockRepositoryImpl","constructor","model","config","identityContext","updateEntry","getEntryById","update","lockRecordId","updateOwner","entryId","id","version","identity","getIdentity","now","Date","toISOString","updateData","savedOn","createdOn","createdBy","savedBy","result","execute","isFail","fail","error","getResult","entry","value","lockRecord","timeout","ok","createImplementation","implementation","dependencies"],"sources":["UpdateEntryLockRepository.ts"],"sourcesContent":["import { IdentityContext } from \"@webiny/api-core/features/IdentityContext\";\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"],"mappings":"AAAA,SAASA,eAAe,QAAQ,2CAA2C;AAC3E,SAASC,kBAAkB,QAAQ,4DAA4D;AAC/F,SAASC,mBAAmB,QAAQ,6DAA6D;AACjG,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,gBAAgB,QAAQ,eAAe;AAChD,SAASC,yBAAyB,IAAIC,qBAAqB;AAC3D,SAASC,mBAAmB,EAAEC,kBAAkB;AAEhD,SAASC,UAAU;AAEnB,SAASC,0BAA0B;AACnC,SAASC,0BAA0B;AAEnC,MAAMC,6BAA6B,CAA4C;EAC3EC,WAAWA,CACCC,KAAmC,EACnCC,MAAqC,EACrCC,eAA0C,EAC1CC,WAAyC,EACzCC,YAA2C,EACrD;IAAA,KALUJ,KAAmC,GAAnCA,KAAmC;IAAA,KACnCC,MAAqC,GAArCA,MAAqC;IAAA,KACrCC,eAA0C,GAA1CA,eAA0C;IAAA,KAC1CC,WAAyC,GAAzCA,WAAyC;IAAA,KACzCC,YAA2C,GAA3CA,YAA2C;EACpD;EAEH,MAAMC,MAAMA,CACRC,YAAoB,EACpBC,WAAoB,EACqC;IACzD,IAAI;MACA,MAAMC,OAAO,GAAGX,0BAA0B,CAACS,YAAY,CAAC;MACxD,MAAMG,EAAE,GAAGnB,gBAAgB,CAAC;QACxBmB,EAAE,EAAED,OAAO;QACXE,OAAO,EAAE;MACb,CAAC,CAAC;MAEF,MAAMC,QAAQ,GAAG,IAAI,CAACT,eAAe,CAACU,WAAW,CAAC,CAAC;MACnD,MAAMC,GAAG,GAAG,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;;MAEpC;MACA,MAAMC,UAAe,GAAG;QACpBC,OAAO,EAAEJ;MACb,CAAC;;MAED;MACA,IAAIN,WAAW,EAAE;QACbS,UAAU,CAACE,SAAS,GAAGL,GAAG;QAC1BG,UAAU,CAACG,SAAS,GAAGR,QAAQ;QAC/BK,UAAU,CAACI,OAAO,GAAGT,QAAQ;MACjC;MAEA,MAAMU,MAAM,GAAG,MAAM,IAAI,CAAClB,WAAW,CAACmB,OAAO,CAAC,IAAI,CAACtB,KAAK,EAAES,EAAE,EAAEO,UAAU,CAAC;MAEzE,IAAIK,MAAM,CAACE,MAAM,CAAC,CAAC,EAAE;QACjB,OAAOlC,MAAM,CAACmC,IAAI,CAAC,IAAI5B,0BAA0B,CAACyB,MAAM,CAACI,KAAK,CAAC,CAAC;MACpE;;MAEA;MACA,MAAMC,SAAS,GAAG,MAAM,IAAI,CAACtB,YAAY,CAACkB,OAAO,CAAmB,IAAI,CAACtB,KAAK,EAAES,EAAE,CAAC;MAEnF,IAAIiB,SAAS,CAACH,MAAM,CAAC,CAAC,EAAE;QACpB,OAAOlC,MAAM,CAACmC,IAAI,CAAC,IAAI5B,0BAA0B,CAAC8B,SAAS,CAACD,KAAK,CAAC,CAAC;MACvE;MAEA,MAAME,KAAK,GAAGD,SAAS,CAACE,KAAK;MAC7B,MAAMC,UAAU,GAAG,IAAIlC,UAAU,CAACgC,KAAK,EAAE,IAAI,CAAC1B,MAAM,CAAC6B,OAAO,CAAC;MAE7D,OAAOzC,MAAM,CAAC0C,EAAE,CAACF,UAAU,CAAC;IAChC,CAAC,CAAC,OAAOJ,KAAK,EAAE;MACZ,OAAOpC,MAAM,CAACmC,IAAI,CAAC,IAAI5B,0BAA0B,CAAC6B,KAAc,CAAC,CAAC;IACtE;EACJ;AACJ;AAEA,OAAO,MAAMlC,yBAAyB,GAAGC,qBAAqB,CAACwC,oBAAoB,CAAC;EAChFC,cAAc,EAAEnC,6BAA6B;EAC7CoC,YAAY,EAAE,CACVxC,kBAAkB,EAClBD,mBAAmB,EACnBP,eAAe,EACfC,kBAAkB,EAClBC,mBAAmB;AAE3B,CAAC,CAAC","ignoreList":[]}
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 } from \"~/domain/abstractions.js\";\nimport { RecordLockingModelProvider } 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 modelProvider: RecordLockingModelProvider.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 model = await this.modelProvider.get();\n\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(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>(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 RecordLockingModelProvider,\n RecordLockingConfig,\n IdentityContext,\n UpdateEntryUseCase,\n GetEntryByIdUseCase\n ]\n});\n"],"names":["UpdateEntryLockRepositoryImpl","modelProvider","config","identityContext","updateEntry","getEntryById","lockRecordId","updateOwner","model","entryId","createLockRecordDatabaseId","id","createIdentifier","identity","now","Date","updateData","result","Result","LockRecordPersistenceError","getResult","entry","lockRecord","LockRecord","error","UpdateEntryLockRepository","RepositoryAbstraction","RecordLockingModelProvider","RecordLockingConfig","IdentityContext","UpdateEntryUseCase","GetEntryByIdUseCase"],"mappings":";;;;;;;;;;AAcA,MAAMA;IACF,YACYC,aAAmD,EACnDC,MAAqC,EACrCC,eAA0C,EAC1CC,WAAyC,EACzCC,YAA2C,CACrD;aALUJ,aAAa,GAAbA;aACAC,MAAM,GAANA;aACAC,eAAe,GAAfA;aACAC,WAAW,GAAXA;aACAC,YAAY,GAAZA;IACT;IAEH,MAAM,OACFC,YAAoB,EACpBC,WAAoB,EACqC;QACzD,IAAI;YACA,MAAMC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG;YAE1C,MAAMC,UAAUC,2BAA2BJ;YAC3C,MAAMK,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,IAAIP,aAAa;gBACbS,WAAW,SAAS,GAAGF;gBACvBE,WAAW,SAAS,GAAGH;gBACvBG,WAAW,OAAO,GAAGH;YACzB;YAEA,MAAMI,SAAS,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAACT,OAAOG,IAAIK;YAEzD,IAAIC,OAAO,MAAM,IACb,OAAOC,OAAO,IAAI,CAAC,IAAIC,2BAA2BF,OAAO,KAAK;YAIlE,MAAMG,YAAY,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAmBZ,OAAOG;YAE3E,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,gBAAgB1B;IAChB,cAAc;QACV2B;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -2,7 +2,7 @@ import { Result } from "@webiny/feature/api";
2
2
  import { UpdateEntryLockUseCase as UseCaseAbstraction, UpdateEntryLockRepository, UpdateEntryLockInput } from "./abstractions.js";
3
3
  import { GetLockRecordUseCase } from "../GetLockRecord/abstractions.js";
4
4
  import { LockEntryUseCase } from "../LockEntry/abstractions.js";
5
- import { IdentityContext } from "@webiny/api-core/features/IdentityContext";
5
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
6
6
  import type { ILockRecord } from "../../domain/LockRecord.js";
7
7
  declare class UpdateEntryLockUseCaseImpl implements UseCaseAbstraction.Interface {
8
8
  private getLockRecord;
@@ -1,62 +1,51 @@
1
1
  import { Result } from "@webiny/feature/api";
2
- import { UpdateEntryLockUseCase as UseCaseAbstraction, UpdateEntryLockRepository } from "./abstractions.js";
2
+ import { UpdateEntryLockRepository, UpdateEntryLockUseCase } from "./abstractions.js";
3
3
  import { GetLockRecordUseCase } from "../GetLockRecord/abstractions.js";
4
4
  import { LockEntryUseCase } from "../LockEntry/abstractions.js";
5
- import { IdentityContext } from "@webiny/api-core/features/IdentityContext";
6
- import { LockRecordNotFoundError, IdentityMismatchError, UpdateEntryLockError } from "../../domain/errors.js";
5
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
6
+ import { IdentityMismatchError, LockRecordNotFoundError, UpdateEntryLockError } from "../../domain/errors.js";
7
7
  class UpdateEntryLockUseCaseImpl {
8
- constructor(getLockRecord, lockEntry, repository, identityContext) {
9
- this.getLockRecord = getLockRecord;
10
- this.lockEntry = lockEntry;
11
- this.repository = repository;
12
- this.identityContext = identityContext;
13
- }
14
- async execute(input) {
15
- // Try to get existing lock record
16
- const recordResult = await this.getLockRecord.execute(input);
17
-
18
- // If doesn't exist, create a new lock
19
- if (recordResult.isFail()) {
20
- if (recordResult.error instanceof LockRecordNotFoundError) {
21
- const lockResult = await this.lockEntry.execute(input);
22
- if (lockResult.isFail()) {
23
- return Result.fail(new UpdateEntryLockError(lockResult.error));
24
- }
25
- return Result.ok(lockResult.value);
26
- }
27
- return Result.fail(recordResult.error);
8
+ constructor(getLockRecord, lockEntry, repository, identityContext){
9
+ this.getLockRecord = getLockRecord;
10
+ this.lockEntry = lockEntry;
11
+ this.repository = repository;
12
+ this.identityContext = identityContext;
28
13
  }
29
- const record = recordResult.value;
30
-
31
- // If expired, update with current user as new owner
32
- if (record.isExpired()) {
33
- const updateResult = await this.repository.update(record.id, true);
34
- if (updateResult.isFail()) {
35
- return Result.fail(new UpdateEntryLockError(updateResult.error));
36
- }
37
- return Result.ok(updateResult.value);
38
- }
39
-
40
- // If not expired, validate same owner
41
- const identity = this.identityContext.getIdentity();
42
- if (record.lockedBy.id !== identity.id) {
43
- return Result.fail(new IdentityMismatchError({
44
- currentId: identity.id,
45
- targetId: record.lockedBy.id
46
- }));
47
- }
48
-
49
- // Update timestamp only
50
- const updateResult = await this.repository.update(record.id, false);
51
- if (updateResult.isFail()) {
52
- return Result.fail(new UpdateEntryLockError(updateResult.error));
14
+ async execute(input) {
15
+ const recordResult = await this.getLockRecord.execute(input);
16
+ if (recordResult.isFail()) {
17
+ if (recordResult.error instanceof LockRecordNotFoundError) {
18
+ const lockResult = await this.lockEntry.execute(input);
19
+ if (lockResult.isFail()) return Result.fail(new UpdateEntryLockError(lockResult.error));
20
+ return Result.ok(lockResult.value);
21
+ }
22
+ return Result.fail(recordResult.error);
23
+ }
24
+ const record = recordResult.value;
25
+ if (record.isExpired()) {
26
+ const updateResult = await this.repository.update(record.id, true);
27
+ if (updateResult.isFail()) return Result.fail(new UpdateEntryLockError(updateResult.error));
28
+ return Result.ok(updateResult.value);
29
+ }
30
+ const identity = this.identityContext.getIdentity();
31
+ if (record.lockedBy.id !== identity.id) return Result.fail(new IdentityMismatchError({
32
+ currentId: identity.id,
33
+ targetId: record.lockedBy.id
34
+ }));
35
+ const updateResult = await this.repository.update(record.id, false);
36
+ if (updateResult.isFail()) return Result.fail(new UpdateEntryLockError(updateResult.error));
37
+ return Result.ok(updateResult.value);
53
38
  }
54
- return Result.ok(updateResult.value);
55
- }
56
39
  }
57
- export const UpdateEntryLockUseCase = UseCaseAbstraction.createImplementation({
58
- implementation: UpdateEntryLockUseCaseImpl,
59
- dependencies: [GetLockRecordUseCase, LockEntryUseCase, UpdateEntryLockRepository, IdentityContext]
40
+ const UpdateEntryLockUseCase_UpdateEntryLockUseCase = UpdateEntryLockUseCase.createImplementation({
41
+ implementation: UpdateEntryLockUseCaseImpl,
42
+ dependencies: [
43
+ GetLockRecordUseCase,
44
+ LockEntryUseCase,
45
+ UpdateEntryLockRepository,
46
+ IdentityContext
47
+ ]
60
48
  });
49
+ export { UpdateEntryLockUseCase_UpdateEntryLockUseCase as UpdateEntryLockUseCase };
61
50
 
62
51
  //# sourceMappingURL=UpdateEntryLockUseCase.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Result","UpdateEntryLockUseCase","UseCaseAbstraction","UpdateEntryLockRepository","GetLockRecordUseCase","LockEntryUseCase","IdentityContext","LockRecordNotFoundError","IdentityMismatchError","UpdateEntryLockError","UpdateEntryLockUseCaseImpl","constructor","getLockRecord","lockEntry","repository","identityContext","execute","input","recordResult","isFail","error","lockResult","fail","ok","value","record","isExpired","updateResult","update","id","identity","getIdentity","lockedBy","currentId","targetId","createImplementation","implementation","dependencies"],"sources":["UpdateEntryLockUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n UpdateEntryLockUseCase as UseCaseAbstraction,\n UpdateEntryLockRepository,\n UpdateEntryLockInput\n} from \"./abstractions.js\";\nimport { GetLockRecordUseCase } from \"../GetLockRecord/abstractions.js\";\nimport { LockEntryUseCase } from \"../LockEntry/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/IdentityContext\";\nimport type { ILockRecord } from \"~/domain/LockRecord.js\";\nimport {\n LockRecordNotFoundError,\n IdentityMismatchError,\n UpdateEntryLockError\n} from \"~/domain/errors.js\";\n\nclass UpdateEntryLockUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private getLockRecord: GetLockRecordUseCase.Interface,\n private lockEntry: LockEntryUseCase.Interface,\n private repository: UpdateEntryLockRepository.Interface,\n private identityContext: IdentityContext.Interface\n ) {}\n\n async execute(\n input: UpdateEntryLockInput\n ): Promise<Result<ILockRecord, UseCaseAbstraction.Error>> {\n // Try to get existing lock record\n const recordResult = await this.getLockRecord.execute(input);\n\n // If doesn't exist, create a new lock\n if (recordResult.isFail()) {\n if (recordResult.error instanceof LockRecordNotFoundError) {\n const lockResult = await this.lockEntry.execute(input);\n if (lockResult.isFail()) {\n return Result.fail(new UpdateEntryLockError(lockResult.error));\n }\n return Result.ok(lockResult.value);\n }\n return Result.fail(recordResult.error);\n }\n\n const record = recordResult.value;\n\n // If expired, update with current user as new owner\n if (record.isExpired()) {\n const updateResult = await this.repository.update(record.id, true);\n if (updateResult.isFail()) {\n return Result.fail(new UpdateEntryLockError(updateResult.error));\n }\n return Result.ok(updateResult.value);\n }\n\n // If not expired, validate same owner\n const identity = this.identityContext.getIdentity();\n if (record.lockedBy.id !== identity.id) {\n return Result.fail(\n new IdentityMismatchError({\n currentId: identity.id,\n targetId: record.lockedBy.id\n })\n );\n }\n\n // Update timestamp only\n const updateResult = await this.repository.update(record.id, false);\n if (updateResult.isFail()) {\n return Result.fail(new UpdateEntryLockError(updateResult.error));\n }\n\n return Result.ok(updateResult.value);\n }\n}\n\nexport const UpdateEntryLockUseCase = UseCaseAbstraction.createImplementation({\n implementation: UpdateEntryLockUseCaseImpl,\n dependencies: [\n GetLockRecordUseCase,\n LockEntryUseCase,\n UpdateEntryLockRepository,\n IdentityContext\n ]\n});\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"features/UpdateEntryLock/UpdateEntryLockUseCase.js","sources":["../../../src/features/UpdateEntryLock/UpdateEntryLockUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n UpdateEntryLockUseCase as UseCaseAbstraction,\n UpdateEntryLockRepository,\n UpdateEntryLockInput\n} from \"./abstractions.js\";\nimport { GetLockRecordUseCase } from \"../GetLockRecord/abstractions.js\";\nimport { LockEntryUseCase } from \"../LockEntry/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport type { ILockRecord } from \"~/domain/LockRecord.js\";\nimport {\n LockRecordNotFoundError,\n IdentityMismatchError,\n UpdateEntryLockError\n} from \"~/domain/errors.js\";\n\nclass UpdateEntryLockUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private getLockRecord: GetLockRecordUseCase.Interface,\n private lockEntry: LockEntryUseCase.Interface,\n private repository: UpdateEntryLockRepository.Interface,\n private identityContext: IdentityContext.Interface\n ) {}\n\n async execute(\n input: UpdateEntryLockInput\n ): Promise<Result<ILockRecord, UseCaseAbstraction.Error>> {\n // Try to get existing lock record\n const recordResult = await this.getLockRecord.execute(input);\n\n // If doesn't exist, create a new lock\n if (recordResult.isFail()) {\n if (recordResult.error instanceof LockRecordNotFoundError) {\n const lockResult = await this.lockEntry.execute(input);\n if (lockResult.isFail()) {\n return Result.fail(new UpdateEntryLockError(lockResult.error));\n }\n return Result.ok(lockResult.value);\n }\n return Result.fail(recordResult.error);\n }\n\n const record = recordResult.value;\n\n // If expired, update with current user as new owner\n if (record.isExpired()) {\n const updateResult = await this.repository.update(record.id, true);\n if (updateResult.isFail()) {\n return Result.fail(new UpdateEntryLockError(updateResult.error));\n }\n return Result.ok(updateResult.value);\n }\n\n // If not expired, validate same owner\n const identity = this.identityContext.getIdentity();\n if (record.lockedBy.id !== identity.id) {\n return Result.fail(\n new IdentityMismatchError({\n currentId: identity.id,\n targetId: record.lockedBy.id\n })\n );\n }\n\n // Update timestamp only\n const updateResult = await this.repository.update(record.id, false);\n if (updateResult.isFail()) {\n return Result.fail(new UpdateEntryLockError(updateResult.error));\n }\n\n return Result.ok(updateResult.value);\n }\n}\n\nexport const UpdateEntryLockUseCase = UseCaseAbstraction.createImplementation({\n implementation: UpdateEntryLockUseCaseImpl,\n dependencies: [\n GetLockRecordUseCase,\n LockEntryUseCase,\n UpdateEntryLockRepository,\n IdentityContext\n ]\n});\n"],"names":["UpdateEntryLockUseCaseImpl","getLockRecord","lockEntry","repository","identityContext","input","recordResult","LockRecordNotFoundError","lockResult","Result","UpdateEntryLockError","record","updateResult","identity","IdentityMismatchError","UpdateEntryLockUseCase","UseCaseAbstraction","GetLockRecordUseCase","LockEntryUseCase","UpdateEntryLockRepository","IdentityContext"],"mappings":";;;;;;AAgBA,MAAMA;IACF,YACYC,aAA6C,EAC7CC,SAAqC,EACrCC,UAA+C,EAC/CC,eAA0C,CACpD;aAJUH,aAAa,GAAbA;aACAC,SAAS,GAATA;aACAC,UAAU,GAAVA;aACAC,eAAe,GAAfA;IACT;IAEH,MAAM,QACFC,KAA2B,EAC2B;QAEtD,MAAMC,eAAe,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAACD;QAGtD,IAAIC,aAAa,MAAM,IAAI;YACvB,IAAIA,aAAa,KAAK,YAAYC,yBAAyB;gBACvD,MAAMC,aAAa,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACH;gBAChD,IAAIG,WAAW,MAAM,IACjB,OAAOC,OAAO,IAAI,CAAC,IAAIC,qBAAqBF,WAAW,KAAK;gBAEhE,OAAOC,OAAO,EAAE,CAACD,WAAW,KAAK;YACrC;YACA,OAAOC,OAAO,IAAI,CAACH,aAAa,KAAK;QACzC;QAEA,MAAMK,SAASL,aAAa,KAAK;QAGjC,IAAIK,OAAO,SAAS,IAAI;YACpB,MAAMC,eAAe,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAACD,OAAO,EAAE,EAAE;YAC7D,IAAIC,aAAa,MAAM,IACnB,OAAOH,OAAO,IAAI,CAAC,IAAIC,qBAAqBE,aAAa,KAAK;YAElE,OAAOH,OAAO,EAAE,CAACG,aAAa,KAAK;QACvC;QAGA,MAAMC,WAAW,IAAI,CAAC,eAAe,CAAC,WAAW;QACjD,IAAIF,OAAO,QAAQ,CAAC,EAAE,KAAKE,SAAS,EAAE,EAClC,OAAOJ,OAAO,IAAI,CACd,IAAIK,sBAAsB;YACtB,WAAWD,SAAS,EAAE;YACtB,UAAUF,OAAO,QAAQ,CAAC,EAAE;QAChC;QAKR,MAAMC,eAAe,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAACD,OAAO,EAAE,EAAE;QAC7D,IAAIC,aAAa,MAAM,IACnB,OAAOH,OAAO,IAAI,CAAC,IAAIC,qBAAqBE,aAAa,KAAK;QAGlE,OAAOH,OAAO,EAAE,CAACG,aAAa,KAAK;IACvC;AACJ;AAEO,MAAMG,gDAAyBC,uBAAAA,oBAAuC,CAAC;IAC1E,gBAAgBhB;IAChB,cAAc;QACViB;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -1,17 +1,6 @@
1
1
  import { createAbstraction } from "@webiny/feature/api";
2
-
3
- // Input types
4
-
5
- /**
6
- * UpdateEntryLock Use Case - Updates lock timestamp to keep it alive
7
- */
8
-
9
- export const UpdateEntryLockUseCase = createAbstraction("UpdateEntryLockUseCase");
10
-
11
- /**
12
- * UpdateEntryLockRepository - Updates lock record in storage
13
- */
14
-
15
- export const UpdateEntryLockRepository = createAbstraction("UpdateEntryLockRepository");
2
+ const UpdateEntryLockUseCase = createAbstraction("UpdateEntryLockUseCase");
3
+ const UpdateEntryLockRepository = createAbstraction("UpdateEntryLockRepository");
4
+ export { UpdateEntryLockRepository, UpdateEntryLockUseCase };
16
5
 
17
6
  //# sourceMappingURL=abstractions.js.map