@webiny/api-record-locking 6.0.0-beta.0 → 6.0.0-rc.1

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 (296) hide show
  1. package/README.md +10 -9
  2. package/domain/LockRecord.d.ts +45 -0
  3. package/{utils/convertEntryToLockRecord.js → domain/LockRecord.js} +14 -22
  4. package/domain/LockRecord.js.map +1 -0
  5. package/domain/RecordLockingModel.d.ts +9 -0
  6. package/domain/RecordLockingModel.js +29 -0
  7. package/domain/RecordLockingModel.js.map +1 -0
  8. package/domain/abstractions.d.ts +18 -0
  9. package/domain/abstractions.js +10 -0
  10. package/domain/abstractions.js.map +1 -0
  11. package/domain/calculateExpiresOn.d.ts +1 -0
  12. package/domain/calculateExpiresOn.js +9 -0
  13. package/domain/calculateExpiresOn.js.map +1 -0
  14. package/domain/errors.d.ts +71 -0
  15. package/domain/errors.js +95 -0
  16. package/domain/errors.js.map +1 -0
  17. package/domain/index.d.ts +4 -0
  18. package/domain/index.js +6 -0
  19. package/domain/index.js.map +1 -0
  20. package/domain/types.d.ts +44 -0
  21. package/domain/types.js +12 -0
  22. package/domain/types.js.map +1 -0
  23. package/features/GetLockRecord/GetLockRecordRepository.d.ts +16 -0
  24. package/features/GetLockRecord/GetLockRecordRepository.js +37 -0
  25. package/features/GetLockRecord/GetLockRecordRepository.js.map +1 -0
  26. package/features/GetLockRecord/GetLockRecordUseCase.d.ts +12 -0
  27. package/features/GetLockRecord/GetLockRecordUseCase.js +15 -0
  28. package/features/GetLockRecord/GetLockRecordUseCase.js.map +1 -0
  29. package/features/GetLockRecord/abstractions.d.ts +41 -0
  30. package/features/GetLockRecord/abstractions.js +17 -0
  31. package/features/GetLockRecord/abstractions.js.map +1 -0
  32. package/features/GetLockRecord/feature.d.ts +1 -0
  33. package/features/GetLockRecord/feature.js +12 -0
  34. package/features/GetLockRecord/feature.js.map +1 -0
  35. package/features/GetLockRecord/index.d.ts +2 -0
  36. package/features/GetLockRecord/index.js +4 -0
  37. package/features/GetLockRecord/index.js.map +1 -0
  38. package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.d.ts +15 -0
  39. package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js +39 -0
  40. package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js.map +1 -0
  41. package/features/GetLockedEntryLockRecord/abstractions.d.ts +26 -0
  42. package/features/GetLockedEntryLockRecord/abstractions.js +13 -0
  43. package/features/GetLockedEntryLockRecord/abstractions.js.map +1 -0
  44. package/features/GetLockedEntryLockRecord/feature.d.ts +1 -0
  45. package/features/GetLockedEntryLockRecord/feature.js +10 -0
  46. package/features/GetLockedEntryLockRecord/feature.js.map +1 -0
  47. package/features/GetLockedEntryLockRecord/index.d.ts +2 -0
  48. package/features/GetLockedEntryLockRecord/index.js +4 -0
  49. package/features/GetLockedEntryLockRecord/index.js.map +1 -0
  50. package/features/IsEntryLocked/IsEntryLockedUseCase.d.ts +14 -0
  51. package/features/IsEntryLocked/IsEntryLockedUseCase.js +39 -0
  52. package/features/IsEntryLocked/IsEntryLockedUseCase.js.map +1 -0
  53. package/features/IsEntryLocked/abstractions.d.ts +24 -0
  54. package/features/IsEntryLocked/abstractions.js +12 -0
  55. package/features/IsEntryLocked/abstractions.js.map +1 -0
  56. package/features/IsEntryLocked/feature.d.ts +1 -0
  57. package/features/IsEntryLocked/feature.js +10 -0
  58. package/features/IsEntryLocked/feature.js.map +1 -0
  59. package/features/IsEntryLocked/index.d.ts +1 -0
  60. package/features/IsEntryLocked/index.js +3 -0
  61. package/features/IsEntryLocked/index.js.map +1 -0
  62. package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.d.ts +15 -0
  63. package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.js +42 -0
  64. package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.js.map +1 -0
  65. package/features/KickOutCurrentUser/abstractions.d.ts +17 -0
  66. package/features/KickOutCurrentUser/abstractions.js +9 -0
  67. package/features/KickOutCurrentUser/abstractions.js.map +1 -0
  68. package/features/KickOutCurrentUser/feature.d.ts +1 -0
  69. package/features/KickOutCurrentUser/feature.js +10 -0
  70. package/features/KickOutCurrentUser/feature.js.map +1 -0
  71. package/features/KickOutCurrentUser/index.d.ts +1 -0
  72. package/features/KickOutCurrentUser/index.js +3 -0
  73. package/features/KickOutCurrentUser/index.js.map +1 -0
  74. package/features/ListAllLockRecords/ListAllLockRecordsRepository.d.ts +16 -0
  75. package/features/ListAllLockRecords/ListAllLockRecordsRepository.js +43 -0
  76. package/features/ListAllLockRecords/ListAllLockRecordsRepository.js.map +1 -0
  77. package/features/ListAllLockRecords/ListAllLockRecordsUseCase.d.ts +11 -0
  78. package/features/ListAllLockRecords/ListAllLockRecordsUseCase.js +15 -0
  79. package/features/ListAllLockRecords/ListAllLockRecordsUseCase.js.map +1 -0
  80. package/features/ListAllLockRecords/abstractions.d.ts +40 -0
  81. package/features/ListAllLockRecords/abstractions.js +17 -0
  82. package/features/ListAllLockRecords/abstractions.js.map +1 -0
  83. package/features/ListAllLockRecords/feature.d.ts +1 -0
  84. package/features/ListAllLockRecords/feature.js +12 -0
  85. package/features/ListAllLockRecords/feature.js.map +1 -0
  86. package/features/ListAllLockRecords/index.d.ts +2 -0
  87. package/features/ListAllLockRecords/index.js +4 -0
  88. package/features/ListAllLockRecords/index.js.map +1 -0
  89. package/features/ListLockRecords/ListLockRecordsRepository.d.ts +15 -0
  90. package/features/ListLockRecords/ListLockRecordsRepository.js +43 -0
  91. package/features/ListLockRecords/ListLockRecordsRepository.js.map +1 -0
  92. package/features/ListLockRecords/ListLockRecordsUseCase.d.ts +15 -0
  93. package/features/ListLockRecords/ListLockRecordsUseCase.js +30 -0
  94. package/features/ListLockRecords/ListLockRecordsUseCase.js.map +1 -0
  95. package/features/ListLockRecords/abstractions.d.ts +45 -0
  96. package/features/ListLockRecords/abstractions.js +17 -0
  97. package/features/ListLockRecords/abstractions.js.map +1 -0
  98. package/features/ListLockRecords/feature.d.ts +1 -0
  99. package/features/ListLockRecords/feature.js +12 -0
  100. package/features/ListLockRecords/feature.js.map +1 -0
  101. package/features/ListLockRecords/index.d.ts +1 -0
  102. package/features/ListLockRecords/index.js +3 -0
  103. package/features/ListLockRecords/index.js.map +1 -0
  104. package/features/LockEntry/LockEntryEventsDecorator.d.ts +14 -0
  105. package/features/LockEntry/LockEntryEventsDecorator.js +40 -0
  106. package/features/LockEntry/LockEntryEventsDecorator.js.map +1 -0
  107. package/features/LockEntry/LockEntryRepository.d.ts +16 -0
  108. package/features/LockEntry/LockEntryRepository.js +42 -0
  109. package/features/LockEntry/LockEntryRepository.js.map +1 -0
  110. package/features/LockEntry/LockEntryUseCase.d.ts +14 -0
  111. package/features/LockEntry/LockEntryUseCase.js +36 -0
  112. package/features/LockEntry/LockEntryUseCase.js.map +1 -0
  113. package/features/LockEntry/abstractions.d.ts +41 -0
  114. package/features/LockEntry/abstractions.js +17 -0
  115. package/features/LockEntry/abstractions.js.map +1 -0
  116. package/features/LockEntry/events.d.ts +45 -0
  117. package/features/LockEntry/events.js +40 -0
  118. package/features/LockEntry/events.js.map +1 -0
  119. package/features/LockEntry/feature.d.ts +1 -0
  120. package/features/LockEntry/feature.js +14 -0
  121. package/features/LockEntry/feature.js.map +1 -0
  122. package/features/LockEntry/index.d.ts +1 -0
  123. package/features/LockEntry/index.js +3 -0
  124. package/features/LockEntry/index.js.map +1 -0
  125. package/features/RecordLockingFeature.d.ts +12 -0
  126. package/features/RecordLockingFeature.js +36 -0
  127. package/features/RecordLockingFeature.js.map +1 -0
  128. package/features/UnlockEntry/UnlockEntryEventsDecorator.d.ts +14 -0
  129. package/features/UnlockEntry/UnlockEntryEventsDecorator.js +41 -0
  130. package/features/UnlockEntry/UnlockEntryEventsDecorator.js.map +1 -0
  131. package/features/UnlockEntry/UnlockEntryRepository.d.ts +14 -0
  132. package/features/UnlockEntry/UnlockEntryRepository.js +40 -0
  133. package/features/UnlockEntry/UnlockEntryRepository.js.map +1 -0
  134. package/features/UnlockEntry/UnlockEntryUseCase.d.ts +18 -0
  135. package/features/UnlockEntry/UnlockEntryUseCase.js +81 -0
  136. package/features/UnlockEntry/UnlockEntryUseCase.js.map +1 -0
  137. package/features/UnlockEntry/abstractions.d.ts +44 -0
  138. package/features/UnlockEntry/abstractions.js +17 -0
  139. package/features/UnlockEntry/abstractions.js.map +1 -0
  140. package/features/UnlockEntry/events.d.ts +46 -0
  141. package/features/UnlockEntry/events.js +40 -0
  142. package/features/UnlockEntry/events.js.map +1 -0
  143. package/features/UnlockEntry/feature.d.ts +1 -0
  144. package/features/UnlockEntry/feature.js +14 -0
  145. package/features/UnlockEntry/feature.js.map +1 -0
  146. package/features/UnlockEntry/hasFullAccessPermission.d.ts +2 -0
  147. package/features/UnlockEntry/hasFullAccessPermission.js +10 -0
  148. package/features/UnlockEntry/hasFullAccessPermission.js.map +1 -0
  149. package/features/UnlockEntry/index.d.ts +1 -0
  150. package/features/UnlockEntry/index.js +3 -0
  151. package/features/UnlockEntry/index.js.map +1 -0
  152. package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.d.ts +14 -0
  153. package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.js +40 -0
  154. package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.js.map +1 -0
  155. package/features/UnlockEntryRequest/UnlockEntryRequestRepository.d.ts +17 -0
  156. package/features/UnlockEntryRequest/UnlockEntryRequestRepository.js +43 -0
  157. package/features/UnlockEntryRequest/UnlockEntryRequestRepository.js.map +1 -0
  158. package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.d.ts +16 -0
  159. package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.js +92 -0
  160. package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.js.map +1 -0
  161. package/features/UnlockEntryRequest/abstractions.d.ts +42 -0
  162. package/features/UnlockEntryRequest/abstractions.js +17 -0
  163. package/features/UnlockEntryRequest/abstractions.js.map +1 -0
  164. package/features/UnlockEntryRequest/events.d.ts +45 -0
  165. package/features/UnlockEntryRequest/events.js +40 -0
  166. package/features/UnlockEntryRequest/events.js.map +1 -0
  167. package/features/UnlockEntryRequest/feature.d.ts +1 -0
  168. package/features/UnlockEntryRequest/feature.js +14 -0
  169. package/features/UnlockEntryRequest/feature.js.map +1 -0
  170. package/features/UnlockEntryRequest/index.d.ts +3 -0
  171. package/features/UnlockEntryRequest/index.js +5 -0
  172. package/features/UnlockEntryRequest/index.js.map +1 -0
  173. package/features/UpdateEntryLock/UpdateEntryLockRepository.d.ts +20 -0
  174. package/features/UpdateEntryLock/UpdateEntryLockRepository.js +63 -0
  175. package/features/UpdateEntryLock/UpdateEntryLockRepository.js.map +1 -0
  176. package/features/UpdateEntryLock/UpdateEntryLockUseCase.d.ts +18 -0
  177. package/features/UpdateEntryLock/UpdateEntryLockUseCase.js +62 -0
  178. package/features/UpdateEntryLock/UpdateEntryLockUseCase.js.map +1 -0
  179. package/features/UpdateEntryLock/abstractions.d.ts +42 -0
  180. package/features/UpdateEntryLock/abstractions.js +17 -0
  181. package/features/UpdateEntryLock/abstractions.js.map +1 -0
  182. package/features/UpdateEntryLock/feature.d.ts +1 -0
  183. package/features/UpdateEntryLock/feature.js +12 -0
  184. package/features/UpdateEntryLock/feature.js.map +1 -0
  185. package/features/UpdateEntryLock/index.d.ts +1 -0
  186. package/features/UpdateEntryLock/index.js +3 -0
  187. package/features/UpdateEntryLock/index.js.map +1 -0
  188. package/graphql/checkPermissions.d.ts +5 -0
  189. package/graphql/checkPermissions.js +14 -0
  190. package/graphql/checkPermissions.js.map +1 -0
  191. package/{utils → graphql}/resolve.d.ts +2 -2
  192. package/graphql/resolve.js +22 -0
  193. package/graphql/resolve.js.map +1 -0
  194. package/graphql/schema.d.ts +8 -4
  195. package/graphql/schema.js +99 -61
  196. package/graphql/schema.js.map +1 -1
  197. package/index.d.ts +8 -2
  198. package/index.js +50 -26
  199. package/index.js.map +1 -1
  200. package/package.json +21 -43
  201. package/types.d.ts +14 -133
  202. package/types.js +6 -24
  203. package/types.js.map +1 -1
  204. package/utils/convertWhereCondition.d.ts +2 -2
  205. package/utils/convertWhereCondition.js +11 -14
  206. package/utils/convertWhereCondition.js.map +1 -1
  207. package/utils/getTimeout.d.ts +3 -2
  208. package/utils/getTimeout.js +11 -10
  209. package/utils/getTimeout.js.map +1 -1
  210. package/utils/lockRecordDatabaseId.js +4 -12
  211. package/utils/lockRecordDatabaseId.js.map +1 -1
  212. package/abstractions/IGetLockRecordUseCase.d.ts +0 -8
  213. package/abstractions/IGetLockRecordUseCase.js +0 -7
  214. package/abstractions/IGetLockRecordUseCase.js.map +0 -1
  215. package/abstractions/IGetLockedEntryLockRecordUseCase.d.ts +0 -8
  216. package/abstractions/IGetLockedEntryLockRecordUseCase.js +0 -7
  217. package/abstractions/IGetLockedEntryLockRecordUseCase.js.map +0 -1
  218. package/abstractions/IIsEntryLocked.d.ts +0 -8
  219. package/abstractions/IIsEntryLocked.js +0 -7
  220. package/abstractions/IIsEntryLocked.js.map +0 -1
  221. package/abstractions/IKickOutCurrentUserUseCase.d.ts +0 -5
  222. package/abstractions/IKickOutCurrentUserUseCase.js +0 -7
  223. package/abstractions/IKickOutCurrentUserUseCase.js.map +0 -1
  224. package/abstractions/IListAllLockRecordsUseCase.d.ts +0 -9
  225. package/abstractions/IListAllLockRecordsUseCase.js +0 -7
  226. package/abstractions/IListAllLockRecordsUseCase.js.map +0 -1
  227. package/abstractions/IListLockRecordsUseCase.d.ts +0 -10
  228. package/abstractions/IListLockRecordsUseCase.js +0 -7
  229. package/abstractions/IListLockRecordsUseCase.js.map +0 -1
  230. package/abstractions/ILockEntryUseCase.d.ts +0 -11
  231. package/abstractions/ILockEntryUseCase.js +0 -7
  232. package/abstractions/ILockEntryUseCase.js.map +0 -1
  233. package/abstractions/IUnlockEntryRequestUseCase.d.ts +0 -11
  234. package/abstractions/IUnlockEntryRequestUseCase.js +0 -7
  235. package/abstractions/IUnlockEntryRequestUseCase.js.map +0 -1
  236. package/abstractions/IUnlockEntryUseCase.d.ts +0 -12
  237. package/abstractions/IUnlockEntryUseCase.js +0 -7
  238. package/abstractions/IUnlockEntryUseCase.js.map +0 -1
  239. package/abstractions/IUpdateEntryLockUseCase.d.ts +0 -11
  240. package/abstractions/IUpdateEntryLockUseCase.js +0 -7
  241. package/abstractions/IUpdateEntryLockUseCase.js.map +0 -1
  242. package/crud/crud.d.ts +0 -6
  243. package/crud/crud.js +0 -188
  244. package/crud/crud.js.map +0 -1
  245. package/crud/model.d.ts +0 -2
  246. package/crud/model.js +0 -127
  247. package/crud/model.js.map +0 -1
  248. package/useCases/GetLockRecord/GetLockRecordUseCase.d.ts +0 -10
  249. package/useCases/GetLockRecord/GetLockRecordUseCase.js +0 -35
  250. package/useCases/GetLockRecord/GetLockRecordUseCase.js.map +0 -1
  251. package/useCases/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.d.ts +0 -16
  252. package/useCases/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js +0 -27
  253. package/useCases/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js.map +0 -1
  254. package/useCases/IsEntryLocked/IsEntryLockedUseCase.d.ts +0 -16
  255. package/useCases/IsEntryLocked/IsEntryLockedUseCase.js +0 -35
  256. package/useCases/IsEntryLocked/IsEntryLockedUseCase.js.map +0 -1
  257. package/useCases/KickOutCurrentUser/KickOutCurrentUserUseCase.d.ts +0 -12
  258. package/useCases/KickOutCurrentUser/KickOutCurrentUserUseCase.js +0 -46
  259. package/useCases/KickOutCurrentUser/KickOutCurrentUserUseCase.js.map +0 -1
  260. package/useCases/ListAllLockRecordsUseCase/ListAllLockRecordsUseCase.d.ts +0 -10
  261. package/useCases/ListAllLockRecordsUseCase/ListAllLockRecordsUseCase.js +0 -32
  262. package/useCases/ListAllLockRecordsUseCase/ListAllLockRecordsUseCase.js.map +0 -1
  263. package/useCases/ListLockRecordsUseCase/ListLockRecordsUseCase.d.ts +0 -14
  264. package/useCases/ListLockRecordsUseCase/ListLockRecordsUseCase.js +0 -27
  265. package/useCases/ListLockRecordsUseCase/ListLockRecordsUseCase.js.map +0 -1
  266. package/useCases/LockEntryUseCase/LockEntryUseCase.d.ts +0 -13
  267. package/useCases/LockEntryUseCase/LockEntryUseCase.js +0 -51
  268. package/useCases/LockEntryUseCase/LockEntryUseCase.js.map +0 -1
  269. package/useCases/UnlockEntryUseCase/UnlockEntryUseCase.d.ts +0 -20
  270. package/useCases/UnlockEntryUseCase/UnlockEntryUseCase.js +0 -67
  271. package/useCases/UnlockEntryUseCase/UnlockEntryUseCase.js.map +0 -1
  272. package/useCases/UnlockRequestUseCase/UnlockEntryRequestUseCase.d.ts +0 -15
  273. package/useCases/UnlockRequestUseCase/UnlockEntryRequestUseCase.js +0 -78
  274. package/useCases/UnlockRequestUseCase/UnlockEntryRequestUseCase.js.map +0 -1
  275. package/useCases/UpdateEntryLock/UpdateEntryLockUseCase.d.ts +0 -18
  276. package/useCases/UpdateEntryLock/UpdateEntryLockUseCase.js +0 -48
  277. package/useCases/UpdateEntryLock/UpdateEntryLockUseCase.js.map +0 -1
  278. package/useCases/index.d.ts +0 -28
  279. package/useCases/index.js +0 -83
  280. package/useCases/index.js.map +0 -1
  281. package/utils/calculateExpiresOn.d.ts +0 -2
  282. package/utils/calculateExpiresOn.js +0 -15
  283. package/utils/calculateExpiresOn.js.map +0 -1
  284. package/utils/checkPermissions.d.ts +0 -7
  285. package/utils/checkPermissions.js +0 -21
  286. package/utils/checkPermissions.js.map +0 -1
  287. package/utils/convertEntryToLockRecord.d.ts +0 -28
  288. package/utils/convertEntryToLockRecord.js.map +0 -1
  289. package/utils/isLockedFactory.d.ts +0 -5
  290. package/utils/isLockedFactory.js +0 -20
  291. package/utils/isLockedFactory.js.map +0 -1
  292. package/utils/resolve.js +0 -30
  293. package/utils/resolve.js.map +0 -1
  294. package/utils/validateSameIdentity.d.ts +0 -6
  295. package/utils/validateSameIdentity.js +0 -24
  296. package/utils/validateSameIdentity.js.map +0 -1
@@ -1,67 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.UnlockEntryUseCase = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _lockRecordDatabaseId = require("../../utils/lockRecordDatabaseId");
10
- var _validateSameIdentity = require("../../utils/validateSameIdentity");
11
- var _apiSecurity = require("@webiny/api-security");
12
- class UnlockEntryUseCase {
13
- constructor(params) {
14
- this.getLockRecordUseCase = params.getLockRecordUseCase;
15
- this.kickOutCurrentUserUseCase = params.kickOutCurrentUserUseCase;
16
- this.getManager = params.getManager;
17
- this.getIdentity = params.getIdentity;
18
- this.hasFullAccess = params.hasFullAccess;
19
- }
20
- async execute(params) {
21
- const record = await this.getLockRecordUseCase.execute(params);
22
- if (!record) {
23
- throw new _error.default("Lock Record not found.", "LOCK_RECORD_NOT_FOUND", {
24
- ...params
25
- });
26
- }
27
-
28
- /**
29
- * We need to validate that the user executing unlock is the same user that locked the entry.
30
- * In case it is not the same user, there is a possibility that it is a user which has full access,
31
- * and at that point, we allow unlocking, but we also need to message the user who locked the entry.
32
- *
33
- */
34
- let kickOutCurrentUser = false;
35
- try {
36
- (0, _validateSameIdentity.validateSameIdentity)({
37
- getIdentity: this.getIdentity,
38
- target: record.lockedBy
39
- });
40
- } catch (ex) {
41
- if (!params.force) {
42
- throw ex;
43
- }
44
- const hasFullAccess = await this.hasFullAccess();
45
- if (ex instanceof _apiSecurity.NotAuthorizedError === false || !hasFullAccess) {
46
- throw ex;
47
- }
48
- kickOutCurrentUser = true;
49
- }
50
- try {
51
- const manager = await this.getManager();
52
- await manager.delete((0, _lockRecordDatabaseId.createLockRecordDatabaseId)(params.id));
53
- if (!kickOutCurrentUser) {
54
- return record;
55
- }
56
- await this.kickOutCurrentUserUseCase.execute(record);
57
- return record;
58
- } catch (ex) {
59
- throw new _error.default(`Could not unlock entry: ${ex.message}`, ex.code || "UNLOCK_ENTRY_ERROR", {
60
- ...ex.data
61
- });
62
- }
63
- }
64
- }
65
- exports.UnlockEntryUseCase = UnlockEntryUseCase;
66
-
67
- //# sourceMappingURL=UnlockEntryUseCase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_lockRecordDatabaseId","_validateSameIdentity","_apiSecurity","UnlockEntryUseCase","constructor","params","getLockRecordUseCase","kickOutCurrentUserUseCase","getManager","getIdentity","hasFullAccess","execute","record","WebinyError","kickOutCurrentUser","validateSameIdentity","target","lockedBy","ex","force","NotAuthorizedError","manager","delete","createLockRecordDatabaseId","id","message","code","data","exports"],"sources":["UnlockEntryUseCase.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n IUnlockEntryUseCase,\n IUnlockEntryUseCaseExecuteParams\n} from \"~/abstractions/IUnlockEntryUseCase\";\nimport {\n IGetIdentity,\n IHasFullAccessCallable,\n IRecordLockingLockRecord,\n IRecordLockingModelManager\n} from \"~/types\";\nimport { createLockRecordDatabaseId } from \"~/utils/lockRecordDatabaseId\";\nimport { IGetLockRecordUseCase } from \"~/abstractions/IGetLockRecordUseCase\";\nimport { validateSameIdentity } from \"~/utils/validateSameIdentity\";\nimport { NotAuthorizedError } from \"@webiny/api-security\";\nimport { IKickOutCurrentUserUseCase } from \"~/abstractions/IKickOutCurrentUserUseCase\";\n\nexport interface IUnlockEntryUseCaseParams {\n readonly getLockRecordUseCase: IGetLockRecordUseCase;\n readonly kickOutCurrentUserUseCase: IKickOutCurrentUserUseCase;\n getManager(): Promise<IRecordLockingModelManager>;\n getIdentity: IGetIdentity;\n hasFullAccess: IHasFullAccessCallable;\n}\n\nexport class UnlockEntryUseCase implements IUnlockEntryUseCase {\n private readonly getLockRecordUseCase: IGetLockRecordUseCase;\n private readonly kickOutCurrentUserUseCase: IKickOutCurrentUserUseCase;\n private readonly getManager: () => Promise<IRecordLockingModelManager>;\n private readonly getIdentity: IGetIdentity;\n private readonly hasFullAccess: IHasFullAccessCallable;\n\n public constructor(params: IUnlockEntryUseCaseParams) {\n this.getLockRecordUseCase = params.getLockRecordUseCase;\n this.kickOutCurrentUserUseCase = params.kickOutCurrentUserUseCase;\n this.getManager = params.getManager;\n this.getIdentity = params.getIdentity;\n this.hasFullAccess = params.hasFullAccess;\n }\n\n public async execute(\n params: IUnlockEntryUseCaseExecuteParams\n ): Promise<IRecordLockingLockRecord> {\n const record = await this.getLockRecordUseCase.execute(params);\n if (!record) {\n throw new WebinyError(\"Lock Record not found.\", \"LOCK_RECORD_NOT_FOUND\", {\n ...params\n });\n }\n\n /**\n * We need to validate that the user executing unlock is the same user that locked the entry.\n * In case it is not the same user, there is a possibility that it is a user which has full access,\n * and at that point, we allow unlocking, but we also need to message the user who locked the entry.\n *\n */\n let kickOutCurrentUser = false;\n try {\n validateSameIdentity({\n getIdentity: this.getIdentity,\n target: record.lockedBy\n });\n } catch (ex) {\n if (!params.force) {\n throw ex;\n }\n const hasFullAccess = await this.hasFullAccess();\n if (ex instanceof NotAuthorizedError === false || !hasFullAccess) {\n throw ex;\n }\n\n kickOutCurrentUser = true;\n }\n\n try {\n const manager = await this.getManager();\n await manager.delete(createLockRecordDatabaseId(params.id));\n\n if (!kickOutCurrentUser) {\n return record;\n }\n await this.kickOutCurrentUserUseCase.execute(record);\n return record;\n } catch (ex) {\n throw new WebinyError(\n `Could not unlock entry: ${ex.message}`,\n ex.code || \"UNLOCK_ENTRY_ERROR\",\n {\n ...ex.data\n }\n );\n }\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAWA,IAAAC,qBAAA,GAAAD,OAAA;AAEA,IAAAE,qBAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAWO,MAAMI,kBAAkB,CAAgC;EAOpDC,WAAWA,CAACC,MAAiC,EAAE;IAClD,IAAI,CAACC,oBAAoB,GAAGD,MAAM,CAACC,oBAAoB;IACvD,IAAI,CAACC,yBAAyB,GAAGF,MAAM,CAACE,yBAAyB;IACjE,IAAI,CAACC,UAAU,GAAGH,MAAM,CAACG,UAAU;IACnC,IAAI,CAACC,WAAW,GAAGJ,MAAM,CAACI,WAAW;IACrC,IAAI,CAACC,aAAa,GAAGL,MAAM,CAACK,aAAa;EAC7C;EAEA,MAAaC,OAAOA,CAChBN,MAAwC,EACP;IACjC,MAAMO,MAAM,GAAG,MAAM,IAAI,CAACN,oBAAoB,CAACK,OAAO,CAACN,MAAM,CAAC;IAC9D,IAAI,CAACO,MAAM,EAAE;MACT,MAAM,IAAIC,cAAW,CAAC,wBAAwB,EAAE,uBAAuB,EAAE;QACrE,GAAGR;MACP,CAAC,CAAC;IACN;;IAEA;AACR;AACA;AACA;AACA;AACA;IACQ,IAAIS,kBAAkB,GAAG,KAAK;IAC9B,IAAI;MACA,IAAAC,0CAAoB,EAAC;QACjBN,WAAW,EAAE,IAAI,CAACA,WAAW;QAC7BO,MAAM,EAAEJ,MAAM,CAACK;MACnB,CAAC,CAAC;IACN,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,IAAI,CAACb,MAAM,CAACc,KAAK,EAAE;QACf,MAAMD,EAAE;MACZ;MACA,MAAMR,aAAa,GAAG,MAAM,IAAI,CAACA,aAAa,CAAC,CAAC;MAChD,IAAIQ,EAAE,YAAYE,+BAAkB,KAAK,KAAK,IAAI,CAACV,aAAa,EAAE;QAC9D,MAAMQ,EAAE;MACZ;MAEAJ,kBAAkB,GAAG,IAAI;IAC7B;IAEA,IAAI;MACA,MAAMO,OAAO,GAAG,MAAM,IAAI,CAACb,UAAU,CAAC,CAAC;MACvC,MAAMa,OAAO,CAACC,MAAM,CAAC,IAAAC,gDAA0B,EAAClB,MAAM,CAACmB,EAAE,CAAC,CAAC;MAE3D,IAAI,CAACV,kBAAkB,EAAE;QACrB,OAAOF,MAAM;MACjB;MACA,MAAM,IAAI,CAACL,yBAAyB,CAACI,OAAO,CAACC,MAAM,CAAC;MACpD,OAAOA,MAAM;IACjB,CAAC,CAAC,OAAOM,EAAE,EAAE;MACT,MAAM,IAAIL,cAAW,CAChB,2BAA0BK,EAAE,CAACO,OAAQ,EAAC,EACvCP,EAAE,CAACQ,IAAI,IAAI,oBAAoB,EAC/B;QACI,GAAGR,EAAE,CAACS;MACV,CACJ,CAAC;IACL;EACJ;AACJ;AAACC,OAAA,CAAAzB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -1,15 +0,0 @@
1
- import { IUnlockEntryRequestUseCase, IUnlockEntryRequestUseCaseExecuteParams } from "../../abstractions/IUnlockEntryRequestUseCase";
2
- import { IGetIdentity, IRecordLockingLockRecord, IRecordLockingModelManager } from "../../types";
3
- import { IGetLockRecordUseCase } from "../../abstractions/IGetLockRecordUseCase";
4
- export interface IUnlockEntryRequestUseCaseParams {
5
- getLockRecordUseCase: IGetLockRecordUseCase;
6
- getManager: () => Promise<IRecordLockingModelManager>;
7
- getIdentity: IGetIdentity;
8
- }
9
- export declare class UnlockEntryRequestUseCase implements IUnlockEntryRequestUseCase {
10
- private readonly getLockRecordUseCase;
11
- private readonly getManager;
12
- private readonly getIdentity;
13
- constructor(params: IUnlockEntryRequestUseCaseParams);
14
- execute(params: IUnlockEntryRequestUseCaseExecuteParams): Promise<IRecordLockingLockRecord>;
15
- }
@@ -1,78 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.UnlockEntryRequestUseCase = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _types = require("../../types");
10
- var _lockRecordDatabaseId = require("../../utils/lockRecordDatabaseId");
11
- var _utils = require("@webiny/utils");
12
- var _convertEntryToLockRecord = require("../../utils/convertEntryToLockRecord");
13
- class UnlockEntryRequestUseCase {
14
- constructor(params) {
15
- this.getLockRecordUseCase = params.getLockRecordUseCase;
16
- this.getManager = params.getManager;
17
- this.getIdentity = params.getIdentity;
18
- }
19
- async execute(params) {
20
- const record = await this.getLockRecordUseCase.execute(params);
21
- if (!record) {
22
- throw new _error.default("Entry is not locked.", "ENTRY_NOT_LOCKED", {
23
- ...params
24
- });
25
- }
26
- const unlockRequested = record.getUnlockRequested();
27
- if (unlockRequested) {
28
- const currentIdentity = this.getIdentity();
29
- /**
30
- * If a current identity did not request unlock, we will not allow that user to continue.
31
- */
32
- if (unlockRequested.createdBy.id !== currentIdentity.id) {
33
- throw new _error.default("Unlock request already sent.", "UNLOCK_REQUEST_ALREADY_SENT", {
34
- ...params,
35
- identity: unlockRequested.createdBy
36
- });
37
- }
38
- const approved = record.getUnlockApproved();
39
- const denied = record.getUnlockDenied();
40
- if (approved || denied) {
41
- return record;
42
- }
43
- throw new _error.default("Unlock request already sent.", "UNLOCK_REQUEST_ALREADY_SENT", {
44
- ...params,
45
- identity: unlockRequested.createdBy
46
- });
47
- }
48
- record.addAction({
49
- type: _types.IRecordLockingLockRecordActionType.requested,
50
- createdOn: new Date(),
51
- createdBy: this.getIdentity()
52
- });
53
- try {
54
- const manager = await this.getManager();
55
- const entryId = (0, _lockRecordDatabaseId.createLockRecordDatabaseId)(record.id);
56
- const id = (0, _utils.createIdentifier)({
57
- id: entryId,
58
- version: 1
59
- });
60
- const result = await manager.update(id, record.toObject());
61
- return (0, _convertEntryToLockRecord.convertEntryToLockRecord)(result);
62
- } catch (ex) {
63
- throw new _error.default("Could not update record with a unlock request.", "UNLOCK_REQUEST_ERROR", {
64
- ...ex.data,
65
- error: {
66
- message: ex.message,
67
- code: ex.code
68
- },
69
- id: params.id,
70
- type: params.type,
71
- recordId: record.id
72
- });
73
- }
74
- }
75
- }
76
- exports.UnlockEntryRequestUseCase = UnlockEntryRequestUseCase;
77
-
78
- //# sourceMappingURL=UnlockEntryRequestUseCase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_types","_lockRecordDatabaseId","_utils","_convertEntryToLockRecord","UnlockEntryRequestUseCase","constructor","params","getLockRecordUseCase","getManager","getIdentity","execute","record","WebinyError","unlockRequested","getUnlockRequested","currentIdentity","createdBy","id","identity","approved","getUnlockApproved","denied","getUnlockDenied","addAction","type","IRecordLockingLockRecordActionType","requested","createdOn","Date","manager","entryId","createLockRecordDatabaseId","createIdentifier","version","result","update","toObject","convertEntryToLockRecord","ex","data","error","message","code","recordId","exports"],"sources":["UnlockEntryRequestUseCase.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n IUnlockEntryRequestUseCase,\n IUnlockEntryRequestUseCaseExecuteParams\n} from \"~/abstractions/IUnlockEntryRequestUseCase\";\nimport {\n IGetIdentity,\n IRecordLockingLockRecord,\n IRecordLockingLockRecordActionType,\n IRecordLockingModelManager\n} from \"~/types\";\nimport { IGetLockRecordUseCase } from \"~/abstractions/IGetLockRecordUseCase\";\nimport { createLockRecordDatabaseId } from \"~/utils/lockRecordDatabaseId\";\nimport { createIdentifier } from \"@webiny/utils\";\nimport { convertEntryToLockRecord } from \"~/utils/convertEntryToLockRecord\";\n\nexport interface IUnlockEntryRequestUseCaseParams {\n getLockRecordUseCase: IGetLockRecordUseCase;\n getManager: () => Promise<IRecordLockingModelManager>;\n getIdentity: IGetIdentity;\n}\n\nexport class UnlockEntryRequestUseCase implements IUnlockEntryRequestUseCase {\n private readonly getLockRecordUseCase: IGetLockRecordUseCase;\n private readonly getManager: () => Promise<IRecordLockingModelManager>;\n private readonly getIdentity: IGetIdentity;\n\n public constructor(params: IUnlockEntryRequestUseCaseParams) {\n this.getLockRecordUseCase = params.getLockRecordUseCase;\n this.getManager = params.getManager;\n this.getIdentity = params.getIdentity;\n }\n\n public async execute(\n params: IUnlockEntryRequestUseCaseExecuteParams\n ): Promise<IRecordLockingLockRecord> {\n const record = await this.getLockRecordUseCase.execute(params);\n if (!record) {\n throw new WebinyError(\"Entry is not locked.\", \"ENTRY_NOT_LOCKED\", {\n ...params\n });\n }\n const unlockRequested = record.getUnlockRequested();\n if (unlockRequested) {\n const currentIdentity = this.getIdentity();\n /**\n * If a current identity did not request unlock, we will not allow that user to continue.\n */\n if (unlockRequested.createdBy.id !== currentIdentity.id) {\n throw new WebinyError(\n \"Unlock request already sent.\",\n \"UNLOCK_REQUEST_ALREADY_SENT\",\n {\n ...params,\n identity: unlockRequested.createdBy\n }\n );\n }\n const approved = record.getUnlockApproved();\n const denied = record.getUnlockDenied();\n if (approved || denied) {\n return record;\n }\n throw new WebinyError(\"Unlock request already sent.\", \"UNLOCK_REQUEST_ALREADY_SENT\", {\n ...params,\n identity: unlockRequested.createdBy\n });\n }\n\n record.addAction({\n type: IRecordLockingLockRecordActionType.requested,\n createdOn: new Date(),\n createdBy: this.getIdentity()\n });\n\n try {\n const manager = await this.getManager();\n\n const entryId = createLockRecordDatabaseId(record.id);\n const id = createIdentifier({\n id: entryId,\n version: 1\n });\n const result = await manager.update(id, record.toObject());\n return convertEntryToLockRecord(result);\n } catch (ex) {\n throw new WebinyError(\n \"Could not update record with a unlock request.\",\n \"UNLOCK_REQUEST_ERROR\",\n {\n ...ex.data,\n error: {\n message: ex.message,\n code: ex.code\n },\n id: params.id,\n type: params.type,\n recordId: record.id\n }\n );\n }\n }\n}\n"],"mappings":"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","ignoreList":[]}
@@ -1,18 +0,0 @@
1
- import { IUpdateEntryLockUseCase, IUpdateEntryLockUseCaseExecuteParams } from "../../abstractions/IUpdateEntryLockUseCase";
2
- import { IGetIdentity, IRecordLockingLockRecord, IRecordLockingModelManager } from "../../types";
3
- import { IGetLockRecordUseCase } from "../../abstractions/IGetLockRecordUseCase";
4
- import { ILockEntryUseCase } from "../../abstractions/ILockEntryUseCase";
5
- export interface IUpdateEntryLockUseCaseParams {
6
- readonly getLockRecordUseCase: IGetLockRecordUseCase;
7
- readonly lockEntryUseCase: ILockEntryUseCase;
8
- getManager(): Promise<IRecordLockingModelManager>;
9
- getIdentity: IGetIdentity;
10
- }
11
- export declare class UpdateEntryLockUseCase implements IUpdateEntryLockUseCase {
12
- private readonly getLockRecordUseCase;
13
- private readonly lockEntryUseCase;
14
- private readonly getManager;
15
- private readonly getIdentity;
16
- constructor(params: IUpdateEntryLockUseCaseParams);
17
- execute(params: IUpdateEntryLockUseCaseExecuteParams): Promise<IRecordLockingLockRecord>;
18
- }
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.UpdateEntryLockUseCase = void 0;
7
- var _error = require("@webiny/error");
8
- var _convertEntryToLockRecord = require("../../utils/convertEntryToLockRecord");
9
- var _lockRecordDatabaseId = require("../../utils/lockRecordDatabaseId");
10
- var _utils = require("@webiny/utils");
11
- var _validateSameIdentity = require("../../utils/validateSameIdentity");
12
- class UpdateEntryLockUseCase {
13
- constructor(params) {
14
- this.getLockRecordUseCase = params.getLockRecordUseCase;
15
- this.lockEntryUseCase = params.lockEntryUseCase;
16
- this.getManager = params.getManager;
17
- this.getIdentity = params.getIdentity;
18
- }
19
- async execute(params) {
20
- const record = await this.getLockRecordUseCase.execute(params);
21
- if (!record) {
22
- return this.lockEntryUseCase.execute(params);
23
- }
24
- (0, _validateSameIdentity.validateSameIdentity)({
25
- getIdentity: this.getIdentity,
26
- target: record.lockedBy
27
- });
28
- try {
29
- const manager = await this.getManager();
30
- const entryId = (0, _lockRecordDatabaseId.createLockRecordDatabaseId)(record.id);
31
- const id = (0, _utils.createIdentifier)({
32
- id: entryId,
33
- version: 1
34
- });
35
- const result = await manager.update(id, {
36
- savedOn: new Date().toISOString()
37
- });
38
- return (0, _convertEntryToLockRecord.convertEntryToLockRecord)(result);
39
- } catch (ex) {
40
- throw new _error.WebinyError(`Could not update lock entry: ${ex.message}`, ex.code || "UPDATE_LOCK_ENTRY_ERROR", {
41
- ...ex.data
42
- });
43
- }
44
- }
45
- }
46
- exports.UpdateEntryLockUseCase = UpdateEntryLockUseCase;
47
-
48
- //# sourceMappingURL=UpdateEntryLockUseCase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_error","require","_convertEntryToLockRecord","_lockRecordDatabaseId","_utils","_validateSameIdentity","UpdateEntryLockUseCase","constructor","params","getLockRecordUseCase","lockEntryUseCase","getManager","getIdentity","execute","record","validateSameIdentity","target","lockedBy","manager","entryId","createLockRecordDatabaseId","id","createIdentifier","version","result","update","savedOn","Date","toISOString","convertEntryToLockRecord","ex","WebinyError","message","code","data","exports"],"sources":["UpdateEntryLockUseCase.ts"],"sourcesContent":["import {\n IUpdateEntryLockUseCase,\n IUpdateEntryLockUseCaseExecuteParams\n} from \"~/abstractions/IUpdateEntryLockUseCase\";\nimport { IGetIdentity, IRecordLockingLockRecord, IRecordLockingModelManager } from \"~/types\";\nimport { IGetLockRecordUseCase } from \"~/abstractions/IGetLockRecordUseCase\";\nimport { WebinyError } from \"@webiny/error\";\nimport { convertEntryToLockRecord } from \"~/utils/convertEntryToLockRecord\";\nimport { createLockRecordDatabaseId } from \"~/utils/lockRecordDatabaseId\";\nimport { createIdentifier } from \"@webiny/utils\";\nimport { validateSameIdentity } from \"~/utils/validateSameIdentity\";\nimport { ILockEntryUseCase } from \"~/abstractions/ILockEntryUseCase\";\n\nexport interface IUpdateEntryLockUseCaseParams {\n readonly getLockRecordUseCase: IGetLockRecordUseCase;\n readonly lockEntryUseCase: ILockEntryUseCase;\n getManager(): Promise<IRecordLockingModelManager>;\n getIdentity: IGetIdentity;\n}\n\nexport class UpdateEntryLockUseCase implements IUpdateEntryLockUseCase {\n private readonly getLockRecordUseCase: IGetLockRecordUseCase;\n private readonly lockEntryUseCase: ILockEntryUseCase;\n private readonly getManager: () => Promise<IRecordLockingModelManager>;\n private readonly getIdentity: IGetIdentity;\n\n public constructor(params: IUpdateEntryLockUseCaseParams) {\n this.getLockRecordUseCase = params.getLockRecordUseCase;\n this.lockEntryUseCase = params.lockEntryUseCase;\n this.getManager = params.getManager;\n this.getIdentity = params.getIdentity;\n }\n\n public async execute(\n params: IUpdateEntryLockUseCaseExecuteParams\n ): Promise<IRecordLockingLockRecord> {\n const record = await this.getLockRecordUseCase.execute(params);\n if (!record) {\n return this.lockEntryUseCase.execute(params);\n }\n\n validateSameIdentity({\n getIdentity: this.getIdentity,\n target: record.lockedBy\n });\n\n try {\n const manager = await this.getManager();\n\n const entryId = createLockRecordDatabaseId(record.id);\n const id = createIdentifier({\n id: entryId,\n version: 1\n });\n const result = await manager.update(id, {\n savedOn: new Date().toISOString()\n });\n return convertEntryToLockRecord(result);\n } catch (ex) {\n throw new WebinyError(\n `Could not update lock entry: ${ex.message}`,\n ex.code || \"UPDATE_LOCK_ENTRY_ERROR\",\n {\n ...ex.data\n }\n );\n }\n }\n}\n"],"mappings":";;;;;;AAMA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,qBAAA,GAAAJ,OAAA;AAUO,MAAMK,sBAAsB,CAAoC;EAM5DC,WAAWA,CAACC,MAAqC,EAAE;IACtD,IAAI,CAACC,oBAAoB,GAAGD,MAAM,CAACC,oBAAoB;IACvD,IAAI,CAACC,gBAAgB,GAAGF,MAAM,CAACE,gBAAgB;IAC/C,IAAI,CAACC,UAAU,GAAGH,MAAM,CAACG,UAAU;IACnC,IAAI,CAACC,WAAW,GAAGJ,MAAM,CAACI,WAAW;EACzC;EAEA,MAAaC,OAAOA,CAChBL,MAA4C,EACX;IACjC,MAAMM,MAAM,GAAG,MAAM,IAAI,CAACL,oBAAoB,CAACI,OAAO,CAACL,MAAM,CAAC;IAC9D,IAAI,CAACM,MAAM,EAAE;MACT,OAAO,IAAI,CAACJ,gBAAgB,CAACG,OAAO,CAACL,MAAM,CAAC;IAChD;IAEA,IAAAO,0CAAoB,EAAC;MACjBH,WAAW,EAAE,IAAI,CAACA,WAAW;MAC7BI,MAAM,EAAEF,MAAM,CAACG;IACnB,CAAC,CAAC;IAEF,IAAI;MACA,MAAMC,OAAO,GAAG,MAAM,IAAI,CAACP,UAAU,CAAC,CAAC;MAEvC,MAAMQ,OAAO,GAAG,IAAAC,gDAA0B,EAACN,MAAM,CAACO,EAAE,CAAC;MACrD,MAAMA,EAAE,GAAG,IAAAC,uBAAgB,EAAC;QACxBD,EAAE,EAAEF,OAAO;QACXI,OAAO,EAAE;MACb,CAAC,CAAC;MACF,MAAMC,MAAM,GAAG,MAAMN,OAAO,CAACO,MAAM,CAACJ,EAAE,EAAE;QACpCK,OAAO,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC;MACpC,CAAC,CAAC;MACF,OAAO,IAAAC,kDAAwB,EAACL,MAAM,CAAC;IAC3C,CAAC,CAAC,OAAOM,EAAE,EAAE;MACT,MAAM,IAAIC,kBAAW,CAChB,gCAA+BD,EAAE,CAACE,OAAQ,EAAC,EAC5CF,EAAE,CAACG,IAAI,IAAI,yBAAyB,EACpC;QACI,GAAGH,EAAE,CAACI;MACV,CACJ,CAAC;IACL;EACJ;AACJ;AAACC,OAAA,CAAA7B,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -1,28 +0,0 @@
1
- import { IGetIdentity, IGetWebsocketsContextCallable, IHasFullAccessCallable, IRecordLockingModelManager } from "../types";
2
- import { IListAllLockRecordsUseCase } from "../abstractions/IListAllLockRecordsUseCase";
3
- import { IListLockRecordsUseCase } from "../abstractions/IListLockRecordsUseCase";
4
- import { IGetLockRecordUseCase } from "../abstractions/IGetLockRecordUseCase";
5
- import { IIsEntryLockedUseCase } from "../abstractions/IIsEntryLocked";
6
- import { IGetLockedEntryLockRecordUseCase } from "../abstractions/IGetLockedEntryLockRecordUseCase";
7
- import { ILockEntryUseCase } from "../abstractions/ILockEntryUseCase";
8
- import { IUpdateEntryLockUseCase } from "../abstractions/IUpdateEntryLockUseCase";
9
- import { IUnlockEntryUseCase } from "../abstractions/IUnlockEntryUseCase";
10
- import { IUnlockEntryRequestUseCase } from "../abstractions/IUnlockEntryRequestUseCase";
11
- export interface ICreateUseCasesParams {
12
- getIdentity: IGetIdentity;
13
- getManager(): Promise<IRecordLockingModelManager>;
14
- hasFullAccess: IHasFullAccessCallable;
15
- getWebsockets: IGetWebsocketsContextCallable;
16
- }
17
- export interface ICreateUseCasesResponse {
18
- listAllLockRecordsUseCase: IListAllLockRecordsUseCase;
19
- listLockRecordsUseCase: IListLockRecordsUseCase;
20
- getLockRecordUseCase: IGetLockRecordUseCase;
21
- isEntryLockedUseCase: IIsEntryLockedUseCase;
22
- getLockedEntryLockRecordUseCase: IGetLockedEntryLockRecordUseCase;
23
- lockEntryUseCase: ILockEntryUseCase;
24
- updateEntryLockUseCase: IUpdateEntryLockUseCase;
25
- unlockEntryUseCase: IUnlockEntryUseCase;
26
- unlockEntryRequestUseCase: IUnlockEntryRequestUseCase;
27
- }
28
- export declare const createUseCases: (params: ICreateUseCasesParams) => ICreateUseCasesResponse;
package/useCases/index.js DELETED
@@ -1,83 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createUseCases = void 0;
7
- var _GetLockRecordUseCase = require("./GetLockRecord/GetLockRecordUseCase");
8
- var _IsEntryLockedUseCase = require("./IsEntryLocked/IsEntryLockedUseCase");
9
- var _LockEntryUseCase = require("./LockEntryUseCase/LockEntryUseCase");
10
- var _UnlockEntryUseCase = require("./UnlockEntryUseCase/UnlockEntryUseCase");
11
- var _UnlockEntryRequestUseCase = require("./UnlockRequestUseCase/UnlockEntryRequestUseCase");
12
- var _ListAllLockRecordsUseCase = require("./ListAllLockRecordsUseCase/ListAllLockRecordsUseCase");
13
- var _ListLockRecordsUseCase = require("./ListLockRecordsUseCase/ListLockRecordsUseCase");
14
- var _isLockedFactory = require("../utils/isLockedFactory");
15
- var _UpdateEntryLockUseCase = require("./UpdateEntryLock/UpdateEntryLockUseCase");
16
- var _getTimeout = require("../utils/getTimeout");
17
- var _KickOutCurrentUserUseCase = require("./KickOutCurrentUser/KickOutCurrentUserUseCase");
18
- var _GetLockedEntryLockRecordUseCase = require("./GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase");
19
- const createUseCases = params => {
20
- const timeout = (0, _getTimeout.getTimeout)();
21
- const isLocked = (0, _isLockedFactory.isLockedFactory)(timeout);
22
- const listAllLockRecordsUseCase = new _ListAllLockRecordsUseCase.ListAllLockRecordsUseCase({
23
- getManager: params.getManager
24
- });
25
- const listLockRecordsUseCase = new _ListLockRecordsUseCase.ListLockRecordsUseCase({
26
- listAllLockRecordsUseCase,
27
- timeout,
28
- getIdentity: params.getIdentity
29
- });
30
- const getLockRecordUseCase = new _GetLockRecordUseCase.GetLockRecordUseCase({
31
- getManager: params.getManager
32
- });
33
- const isEntryLockedUseCase = new _IsEntryLockedUseCase.IsEntryLockedUseCase({
34
- getLockRecordUseCase,
35
- isLocked,
36
- getIdentity: params.getIdentity
37
- });
38
- const getLockedEntryLockRecordUseCase = new _GetLockedEntryLockRecordUseCase.GetLockedEntryLockRecordUseCase({
39
- getLockRecordUseCase,
40
- isLocked,
41
- getIdentity: params.getIdentity
42
- });
43
- const lockEntryUseCase = new _LockEntryUseCase.LockEntryUseCase({
44
- isEntryLockedUseCase,
45
- getManager: params.getManager
46
- });
47
- const updateEntryLockUseCase = new _UpdateEntryLockUseCase.UpdateEntryLockUseCase({
48
- getLockRecordUseCase,
49
- lockEntryUseCase,
50
- getManager: params.getManager,
51
- getIdentity: params.getIdentity
52
- });
53
- const kickOutCurrentUserUseCase = new _KickOutCurrentUserUseCase.KickOutCurrentUserUseCase({
54
- getWebsockets: params.getWebsockets,
55
- getIdentity: params.getIdentity
56
- });
57
- const unlockEntryUseCase = new _UnlockEntryUseCase.UnlockEntryUseCase({
58
- getLockRecordUseCase,
59
- kickOutCurrentUserUseCase,
60
- getManager: params.getManager,
61
- getIdentity: params.getIdentity,
62
- hasFullAccess: params.hasFullAccess
63
- });
64
- const unlockEntryRequestUseCase = new _UnlockEntryRequestUseCase.UnlockEntryRequestUseCase({
65
- getLockRecordUseCase,
66
- getIdentity: params.getIdentity,
67
- getManager: params.getManager
68
- });
69
- return {
70
- listAllLockRecordsUseCase,
71
- listLockRecordsUseCase,
72
- getLockRecordUseCase,
73
- isEntryLockedUseCase,
74
- getLockedEntryLockRecordUseCase,
75
- lockEntryUseCase,
76
- updateEntryLockUseCase,
77
- unlockEntryUseCase,
78
- unlockEntryRequestUseCase
79
- };
80
- };
81
- exports.createUseCases = createUseCases;
82
-
83
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_GetLockRecordUseCase","require","_IsEntryLockedUseCase","_LockEntryUseCase","_UnlockEntryUseCase","_UnlockEntryRequestUseCase","_ListAllLockRecordsUseCase","_ListLockRecordsUseCase","_isLockedFactory","_UpdateEntryLockUseCase","_getTimeout","_KickOutCurrentUserUseCase","_GetLockedEntryLockRecordUseCase","createUseCases","params","timeout","getTimeout","isLocked","isLockedFactory","listAllLockRecordsUseCase","ListAllLockRecordsUseCase","getManager","listLockRecordsUseCase","ListLockRecordsUseCase","getIdentity","getLockRecordUseCase","GetLockRecordUseCase","isEntryLockedUseCase","IsEntryLockedUseCase","getLockedEntryLockRecordUseCase","GetLockedEntryLockRecordUseCase","lockEntryUseCase","LockEntryUseCase","updateEntryLockUseCase","UpdateEntryLockUseCase","kickOutCurrentUserUseCase","KickOutCurrentUserUseCase","getWebsockets","unlockEntryUseCase","UnlockEntryUseCase","hasFullAccess","unlockEntryRequestUseCase","UnlockEntryRequestUseCase","exports"],"sources":["index.ts"],"sourcesContent":["import {\n IGetIdentity,\n IGetWebsocketsContextCallable,\n IHasFullAccessCallable,\n IRecordLockingModelManager\n} from \"~/types\";\nimport { GetLockRecordUseCase } from \"./GetLockRecord/GetLockRecordUseCase\";\nimport { IsEntryLockedUseCase } from \"./IsEntryLocked/IsEntryLockedUseCase\";\nimport { LockEntryUseCase } from \"./LockEntryUseCase/LockEntryUseCase\";\nimport { UnlockEntryUseCase } from \"./UnlockEntryUseCase/UnlockEntryUseCase\";\nimport { UnlockEntryRequestUseCase } from \"./UnlockRequestUseCase/UnlockEntryRequestUseCase\";\nimport { ListAllLockRecordsUseCase } from \"./ListAllLockRecordsUseCase/ListAllLockRecordsUseCase\";\nimport { ListLockRecordsUseCase } from \"./ListLockRecordsUseCase/ListLockRecordsUseCase\";\nimport { isLockedFactory } from \"~/utils/isLockedFactory\";\nimport { UpdateEntryLockUseCase } from \"~/useCases/UpdateEntryLock/UpdateEntryLockUseCase\";\nimport { getTimeout } from \"~/utils/getTimeout\";\nimport { KickOutCurrentUserUseCase } from \"./KickOutCurrentUser/KickOutCurrentUserUseCase\";\nimport { GetLockedEntryLockRecordUseCase } from \"~/useCases/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase\";\nimport { IListAllLockRecordsUseCase } from \"~/abstractions/IListAllLockRecordsUseCase\";\nimport { IListLockRecordsUseCase } from \"~/abstractions/IListLockRecordsUseCase\";\nimport { IGetLockRecordUseCase } from \"~/abstractions/IGetLockRecordUseCase\";\nimport { IIsEntryLockedUseCase } from \"~/abstractions/IIsEntryLocked\";\nimport { IGetLockedEntryLockRecordUseCase } from \"~/abstractions/IGetLockedEntryLockRecordUseCase\";\nimport { ILockEntryUseCase } from \"~/abstractions/ILockEntryUseCase\";\nimport { IUpdateEntryLockUseCase } from \"~/abstractions/IUpdateEntryLockUseCase\";\nimport { IUnlockEntryUseCase } from \"~/abstractions/IUnlockEntryUseCase\";\nimport { IUnlockEntryRequestUseCase } from \"~/abstractions/IUnlockEntryRequestUseCase\";\n\nexport interface ICreateUseCasesParams {\n getIdentity: IGetIdentity;\n getManager(): Promise<IRecordLockingModelManager>;\n hasFullAccess: IHasFullAccessCallable;\n getWebsockets: IGetWebsocketsContextCallable;\n}\n\nexport interface ICreateUseCasesResponse {\n listAllLockRecordsUseCase: IListAllLockRecordsUseCase;\n listLockRecordsUseCase: IListLockRecordsUseCase;\n getLockRecordUseCase: IGetLockRecordUseCase;\n isEntryLockedUseCase: IIsEntryLockedUseCase;\n getLockedEntryLockRecordUseCase: IGetLockedEntryLockRecordUseCase;\n lockEntryUseCase: ILockEntryUseCase;\n updateEntryLockUseCase: IUpdateEntryLockUseCase;\n unlockEntryUseCase: IUnlockEntryUseCase;\n unlockEntryRequestUseCase: IUnlockEntryRequestUseCase;\n}\n\nexport const createUseCases = (params: ICreateUseCasesParams): ICreateUseCasesResponse => {\n const timeout = getTimeout();\n const isLocked = isLockedFactory(timeout);\n\n const listAllLockRecordsUseCase = new ListAllLockRecordsUseCase({\n getManager: params.getManager\n });\n\n const listLockRecordsUseCase = new ListLockRecordsUseCase({\n listAllLockRecordsUseCase,\n timeout,\n getIdentity: params.getIdentity\n });\n\n const getLockRecordUseCase = new GetLockRecordUseCase({\n getManager: params.getManager\n });\n\n const isEntryLockedUseCase = new IsEntryLockedUseCase({\n getLockRecordUseCase,\n isLocked,\n getIdentity: params.getIdentity\n });\n\n const getLockedEntryLockRecordUseCase = new GetLockedEntryLockRecordUseCase({\n getLockRecordUseCase,\n isLocked,\n getIdentity: params.getIdentity\n });\n\n const lockEntryUseCase = new LockEntryUseCase({\n isEntryLockedUseCase,\n getManager: params.getManager\n });\n\n const updateEntryLockUseCase = new UpdateEntryLockUseCase({\n getLockRecordUseCase,\n lockEntryUseCase,\n getManager: params.getManager,\n getIdentity: params.getIdentity\n });\n\n const kickOutCurrentUserUseCase = new KickOutCurrentUserUseCase({\n getWebsockets: params.getWebsockets,\n getIdentity: params.getIdentity\n });\n\n const unlockEntryUseCase = new UnlockEntryUseCase({\n getLockRecordUseCase,\n kickOutCurrentUserUseCase,\n getManager: params.getManager,\n getIdentity: params.getIdentity,\n hasFullAccess: params.hasFullAccess\n });\n\n const unlockEntryRequestUseCase = new UnlockEntryRequestUseCase({\n getLockRecordUseCase,\n getIdentity: params.getIdentity,\n getManager: params.getManager\n });\n\n return {\n listAllLockRecordsUseCase,\n listLockRecordsUseCase,\n getLockRecordUseCase,\n isEntryLockedUseCase,\n getLockedEntryLockRecordUseCase,\n lockEntryUseCase,\n updateEntryLockUseCase,\n unlockEntryUseCase,\n unlockEntryRequestUseCase\n };\n};\n"],"mappings":";;;;;;AAMA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,0BAAA,GAAAJ,OAAA;AACA,IAAAK,0BAAA,GAAAL,OAAA;AACA,IAAAM,uBAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AACA,IAAAQ,uBAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,0BAAA,GAAAV,OAAA;AACA,IAAAW,gCAAA,GAAAX,OAAA;AA8BO,MAAMY,cAAc,GAAIC,MAA6B,IAA8B;EACtF,MAAMC,OAAO,GAAG,IAAAC,sBAAU,EAAC,CAAC;EAC5B,MAAMC,QAAQ,GAAG,IAAAC,gCAAe,EAACH,OAAO,CAAC;EAEzC,MAAMI,yBAAyB,GAAG,IAAIC,oDAAyB,CAAC;IAC5DC,UAAU,EAAEP,MAAM,CAACO;EACvB,CAAC,CAAC;EAEF,MAAMC,sBAAsB,GAAG,IAAIC,8CAAsB,CAAC;IACtDJ,yBAAyB;IACzBJ,OAAO;IACPS,WAAW,EAAEV,MAAM,CAACU;EACxB,CAAC,CAAC;EAEF,MAAMC,oBAAoB,GAAG,IAAIC,0CAAoB,CAAC;IAClDL,UAAU,EAAEP,MAAM,CAACO;EACvB,CAAC,CAAC;EAEF,MAAMM,oBAAoB,GAAG,IAAIC,0CAAoB,CAAC;IAClDH,oBAAoB;IACpBR,QAAQ;IACRO,WAAW,EAAEV,MAAM,CAACU;EACxB,CAAC,CAAC;EAEF,MAAMK,+BAA+B,GAAG,IAAIC,gEAA+B,CAAC;IACxEL,oBAAoB;IACpBR,QAAQ;IACRO,WAAW,EAAEV,MAAM,CAACU;EACxB,CAAC,CAAC;EAEF,MAAMO,gBAAgB,GAAG,IAAIC,kCAAgB,CAAC;IAC1CL,oBAAoB;IACpBN,UAAU,EAAEP,MAAM,CAACO;EACvB,CAAC,CAAC;EAEF,MAAMY,sBAAsB,GAAG,IAAIC,8CAAsB,CAAC;IACtDT,oBAAoB;IACpBM,gBAAgB;IAChBV,UAAU,EAAEP,MAAM,CAACO,UAAU;IAC7BG,WAAW,EAAEV,MAAM,CAACU;EACxB,CAAC,CAAC;EAEF,MAAMW,yBAAyB,GAAG,IAAIC,oDAAyB,CAAC;IAC5DC,aAAa,EAAEvB,MAAM,CAACuB,aAAa;IACnCb,WAAW,EAAEV,MAAM,CAACU;EACxB,CAAC,CAAC;EAEF,MAAMc,kBAAkB,GAAG,IAAIC,sCAAkB,CAAC;IAC9Cd,oBAAoB;IACpBU,yBAAyB;IACzBd,UAAU,EAAEP,MAAM,CAACO,UAAU;IAC7BG,WAAW,EAAEV,MAAM,CAACU,WAAW;IAC/BgB,aAAa,EAAE1B,MAAM,CAAC0B;EAC1B,CAAC,CAAC;EAEF,MAAMC,yBAAyB,GAAG,IAAIC,oDAAyB,CAAC;IAC5DjB,oBAAoB;IACpBD,WAAW,EAAEV,MAAM,CAACU,WAAW;IAC/BH,UAAU,EAAEP,MAAM,CAACO;EACvB,CAAC,CAAC;EAEF,OAAO;IACHF,yBAAyB;IACzBG,sBAAsB;IACtBG,oBAAoB;IACpBE,oBAAoB;IACpBE,+BAA+B;IAC/BE,gBAAgB;IAChBE,sBAAsB;IACtBK,kBAAkB;IAClBG;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAA9B,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- import { IHeadlessCmsLockRecordParams } from "./convertEntryToLockRecord";
2
- export declare const calculateExpiresOn: (input: Pick<IHeadlessCmsLockRecordParams, "savedOn">) => Date;
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.calculateExpiresOn = void 0;
7
- var _getTimeout = require("./getTimeout");
8
- const calculateExpiresOn = input => {
9
- const timeout = (0, _getTimeout.getTimeout)();
10
- const savedOn = new Date(input.savedOn);
11
- return new Date(savedOn.getTime() + timeout);
12
- };
13
- exports.calculateExpiresOn = calculateExpiresOn;
14
-
15
- //# sourceMappingURL=calculateExpiresOn.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_getTimeout","require","calculateExpiresOn","input","timeout","getTimeout","savedOn","Date","getTime","exports"],"sources":["calculateExpiresOn.ts"],"sourcesContent":["import { IHeadlessCmsLockRecordParams } from \"./convertEntryToLockRecord\";\nimport { getTimeout } from \"./getTimeout\";\n\nexport const calculateExpiresOn = (input: Pick<IHeadlessCmsLockRecordParams, \"savedOn\">): Date => {\n const timeout = getTimeout();\n\n const savedOn = new Date(input.savedOn);\n\n return new Date(savedOn.getTime() + timeout);\n};\n"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEO,MAAMC,kBAAkB,GAAIC,KAAoD,IAAW;EAC9F,MAAMC,OAAO,GAAG,IAAAC,sBAAU,EAAC,CAAC;EAE5B,MAAMC,OAAO,GAAG,IAAIC,IAAI,CAACJ,KAAK,CAACG,OAAO,CAAC;EAEvC,OAAO,IAAIC,IAAI,CAACD,OAAO,CAACE,OAAO,CAAC,CAAC,GAAGJ,OAAO,CAAC;AAChD,CAAC;AAACK,OAAA,CAAAP,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -1,7 +0,0 @@
1
- import { Context } from "../types";
2
- /**
3
- * Simple permission check. Only full access can access the websockets API via GraphQL - ({name: "*"})
4
- *
5
- * @throws
6
- */
7
- export declare const checkPermissions: (context: Pick<Context, "security">) => Promise<void>;
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.checkPermissions = void 0;
7
- var _apiSecurity = require("@webiny/api-security");
8
- /**
9
- * Simple permission check. Only full access can access the websockets API via GraphQL - ({name: "*"})
10
- *
11
- * @throws
12
- */
13
- const checkPermissions = async context => {
14
- const identity = context.security.getIdentity();
15
- if (!identity.id) {
16
- throw new _apiSecurity.NotAuthorizedError();
17
- }
18
- };
19
- exports.checkPermissions = checkPermissions;
20
-
21
- //# sourceMappingURL=checkPermissions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_apiSecurity","require","checkPermissions","context","identity","security","getIdentity","id","NotAuthorizedError","exports"],"sources":["checkPermissions.ts"],"sourcesContent":["import { NotAuthorizedError } from \"@webiny/api-security\";\nimport { Context } from \"~/types\";\n\n/**\n * Simple permission check. Only full access can access the websockets API via GraphQL - ({name: \"*\"})\n *\n * @throws\n */\nexport const checkPermissions = async (context: Pick<Context, \"security\">): Promise<void> => {\n const identity = context.security.getIdentity();\n if (!identity.id) {\n throw new NotAuthorizedError();\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACO,MAAMC,gBAAgB,GAAG,MAAOC,OAAkC,IAAoB;EACzF,MAAMC,QAAQ,GAAGD,OAAO,CAACE,QAAQ,CAACC,WAAW,CAAC,CAAC;EAC/C,IAAI,CAACF,QAAQ,CAACG,EAAE,EAAE;IACd,MAAM,IAAIC,+BAAkB,CAAC,CAAC;EAClC;AACJ,CAAC;AAACC,OAAA,CAAAP,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -1,28 +0,0 @@
1
- import { CmsEntry, IRecordLockingIdentity } from "../types";
2
- import { IRecordLockingLockRecord, IRecordLockingLockRecordAction, IRecordLockingLockRecordApprovedAction, IRecordLockingLockRecordDeniedAction, IRecordLockingLockRecordEntryType, IRecordLockingLockRecordObject, IRecordLockingLockRecordRequestedAction, IRecordLockingLockRecordValues } from "../types";
3
- export declare const convertEntryToLockRecord: (entry: CmsEntry<IRecordLockingLockRecordValues>) => IRecordLockingLockRecord;
4
- export declare type IHeadlessCmsLockRecordParams = Pick<CmsEntry<IRecordLockingLockRecordValues>, "entryId" | "values" | "createdBy" | "createdOn" | "savedOn">;
5
- export declare class HeadlessCmsLockRecord implements IRecordLockingLockRecord {
6
- private readonly _id;
7
- private readonly _targetId;
8
- private readonly _type;
9
- private readonly _lockedBy;
10
- private readonly _lockedOn;
11
- private readonly _updatedOn;
12
- private readonly _expiresOn;
13
- private _actions?;
14
- get id(): string;
15
- get targetId(): string;
16
- get type(): IRecordLockingLockRecordEntryType;
17
- get lockedBy(): IRecordLockingIdentity;
18
- get lockedOn(): Date;
19
- get updatedOn(): Date;
20
- get expiresOn(): Date;
21
- get actions(): IRecordLockingLockRecordAction[] | undefined;
22
- constructor(input: IHeadlessCmsLockRecordParams);
23
- toObject(): IRecordLockingLockRecordObject;
24
- addAction(action: IRecordLockingLockRecordAction): void;
25
- getUnlockRequested(): IRecordLockingLockRecordRequestedAction | undefined;
26
- getUnlockApproved(): IRecordLockingLockRecordApprovedAction | undefined;
27
- getUnlockDenied(): IRecordLockingLockRecordDeniedAction | undefined;
28
- }
@@ -1 +0,0 @@
1
- {"version":3,"names":["_types","require","_lockRecordDatabaseId","_calculateExpiresOn","convertEntryToLockRecord","entry","HeadlessCmsLockRecord","exports","id","_id","targetId","_targetId","type","_type","lockedBy","_lockedBy","lockedOn","_lockedOn","updatedOn","_updatedOn","expiresOn","_expiresOn","actions","_actions","constructor","input","removeLockRecordDatabasePrefix","entryId","values","createdBy","Date","createdOn","savedOn","calculateExpiresOn","toObject","addAction","action","push","getUnlockRequested","length","undefined","find","IRecordLockingLockRecordActionType","requested","getUnlockApproved","approved","getUnlockDenied","denied"],"sources":["convertEntryToLockRecord.ts"],"sourcesContent":["import { CmsEntry, IRecordLockingIdentity } from \"~/types\";\nimport {\n IRecordLockingLockRecord,\n IRecordLockingLockRecordAction,\n IRecordLockingLockRecordActionType,\n IRecordLockingLockRecordApprovedAction,\n IRecordLockingLockRecordDeniedAction,\n IRecordLockingLockRecordEntryType,\n IRecordLockingLockRecordObject,\n IRecordLockingLockRecordRequestedAction,\n IRecordLockingLockRecordValues\n} from \"~/types\";\nimport { removeLockRecordDatabasePrefix } from \"~/utils/lockRecordDatabaseId\";\nimport { calculateExpiresOn } from \"~/utils/calculateExpiresOn\";\n\nexport const convertEntryToLockRecord = (\n entry: CmsEntry<IRecordLockingLockRecordValues>\n): IRecordLockingLockRecord => {\n return new HeadlessCmsLockRecord(entry);\n};\n\nexport type IHeadlessCmsLockRecordParams = Pick<\n CmsEntry<IRecordLockingLockRecordValues>,\n \"entryId\" | \"values\" | \"createdBy\" | \"createdOn\" | \"savedOn\"\n>;\n\nexport class HeadlessCmsLockRecord implements IRecordLockingLockRecord {\n private readonly _id: string;\n private readonly _targetId: string;\n private readonly _type: IRecordLockingLockRecordEntryType;\n private readonly _lockedBy: IRecordLockingIdentity;\n private readonly _lockedOn: Date;\n private readonly _updatedOn: Date;\n private readonly _expiresOn: Date;\n private _actions?: IRecordLockingLockRecordAction[];\n\n public get id(): string {\n return this._id;\n }\n\n public get targetId(): string {\n return this._targetId;\n }\n\n public get type(): IRecordLockingLockRecordEntryType {\n return this._type;\n }\n\n public get lockedBy(): IRecordLockingIdentity {\n return this._lockedBy;\n }\n\n public get lockedOn(): Date {\n return this._lockedOn;\n }\n\n public get updatedOn(): Date {\n return this._updatedOn;\n }\n\n public get expiresOn(): Date {\n return this._expiresOn;\n }\n\n public get actions(): IRecordLockingLockRecordAction[] | undefined {\n return this._actions;\n }\n\n public constructor(input: IHeadlessCmsLockRecordParams) {\n this._id = removeLockRecordDatabasePrefix(input.entryId);\n this._targetId = input.values.targetId;\n this._type = input.values.type;\n this._lockedBy = input.createdBy;\n this._lockedOn = new Date(input.createdOn);\n this._updatedOn = new Date(input.savedOn);\n this._expiresOn = calculateExpiresOn(input);\n this._actions = input.values.actions;\n }\n\n public toObject(): IRecordLockingLockRecordObject {\n return {\n id: this._id,\n targetId: this._targetId,\n type: this._type,\n lockedBy: this._lockedBy,\n lockedOn: this._lockedOn,\n updatedOn: this._updatedOn,\n expiresOn: this._expiresOn,\n actions: this._actions\n };\n }\n\n public addAction(action: IRecordLockingLockRecordAction) {\n if (!this._actions) {\n this._actions = [];\n }\n this._actions.push(action);\n }\n\n public getUnlockRequested(): IRecordLockingLockRecordRequestedAction | undefined {\n if (!this._actions?.length) {\n return undefined;\n }\n return this._actions.find(\n (action): action is IRecordLockingLockRecordRequestedAction =>\n action.type === IRecordLockingLockRecordActionType.requested\n );\n }\n\n public getUnlockApproved(): IRecordLockingLockRecordApprovedAction | undefined {\n if (!this._actions?.length) {\n return undefined;\n }\n return this._actions.find(\n (action): action is IRecordLockingLockRecordApprovedAction =>\n action.type === IRecordLockingLockRecordActionType.approved\n );\n }\n\n public getUnlockDenied(): IRecordLockingLockRecordDeniedAction | undefined {\n if (!this._actions?.length) {\n return undefined;\n }\n return this._actions.find(\n (action): action is IRecordLockingLockRecordDeniedAction =>\n action.type === IRecordLockingLockRecordActionType.denied\n );\n }\n}\n"],"mappings":"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","ignoreList":[]}
@@ -1,5 +0,0 @@
1
- import { IRecordLockingLockRecord } from "../types";
2
- export interface IIsLocked {
3
- (record?: Pick<IRecordLockingLockRecord, "lockedOn"> | null): boolean;
4
- }
5
- export declare const isLockedFactory: (timeoutInput: number) => IIsLocked;
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isLockedFactory = void 0;
7
- const isLockedFactory = timeoutInput => {
8
- const timeout = timeoutInput * 1000;
9
- return record => {
10
- if (!record || record.lockedOn instanceof Date === false) {
11
- return false;
12
- }
13
- const now = new Date().getTime();
14
- const lockedOn = record.lockedOn.getTime();
15
- return lockedOn + timeout >= now;
16
- };
17
- };
18
- exports.isLockedFactory = isLockedFactory;
19
-
20
- //# sourceMappingURL=isLockedFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["isLockedFactory","timeoutInput","timeout","record","lockedOn","Date","now","getTime","exports"],"sources":["isLockedFactory.ts"],"sourcesContent":["import { IRecordLockingLockRecord } from \"~/types\";\n\nexport interface IIsLocked {\n (record?: Pick<IRecordLockingLockRecord, \"lockedOn\"> | null): boolean;\n}\n\nexport const isLockedFactory = (timeoutInput: number): IIsLocked => {\n const timeout = timeoutInput * 1000;\n return record => {\n if (!record || record.lockedOn instanceof Date === false) {\n return false;\n }\n const now = new Date().getTime();\n const lockedOn = record.lockedOn.getTime();\n return lockedOn + timeout >= now;\n };\n};\n"],"mappings":";;;;;;AAMO,MAAMA,eAAe,GAAIC,YAAoB,IAAgB;EAChE,MAAMC,OAAO,GAAGD,YAAY,GAAG,IAAI;EACnC,OAAOE,MAAM,IAAI;IACb,IAAI,CAACA,MAAM,IAAIA,MAAM,CAACC,QAAQ,YAAYC,IAAI,KAAK,KAAK,EAAE;MACtD,OAAO,KAAK;IAChB;IACA,MAAMC,GAAG,GAAG,IAAID,IAAI,CAAC,CAAC,CAACE,OAAO,CAAC,CAAC;IAChC,MAAMH,QAAQ,GAAGD,MAAM,CAACC,QAAQ,CAACG,OAAO,CAAC,CAAC;IAC1C,OAAOH,QAAQ,GAAGF,OAAO,IAAII,GAAG;EACpC,CAAC;AACL,CAAC;AAACE,OAAA,CAAAR,eAAA,GAAAA,eAAA","ignoreList":[]}
package/utils/resolve.js DELETED
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.resolveList = exports.resolve = void 0;
7
- var _handlerGraphql = require("@webiny/handler-graphql");
8
- const resolve = async cb => {
9
- try {
10
- const result = await cb();
11
- return new _handlerGraphql.Response(result);
12
- } catch (ex) {
13
- return new _handlerGraphql.ErrorResponse(ex);
14
- }
15
- };
16
- exports.resolve = resolve;
17
- const resolveList = async cb => {
18
- try {
19
- const {
20
- items,
21
- meta
22
- } = await cb();
23
- return new _handlerGraphql.ListResponse(items, meta);
24
- } catch (ex) {
25
- return new _handlerGraphql.ListErrorResponse(ex);
26
- }
27
- };
28
- exports.resolveList = resolveList;
29
-
30
- //# sourceMappingURL=resolve.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_handlerGraphql","require","resolve","cb","result","Response","ex","ErrorResponse","exports","resolveList","items","meta","ListResponse","ListErrorResponse"],"sources":["resolve.ts"],"sourcesContent":["import { ErrorResponse, ListErrorResponse, ListResponse, Response } from \"@webiny/handler-graphql\";\nimport { IRecordLockingMeta } from \"~/types\";\n\nexport const resolve = async <T>(cb: () => Promise<T>): Promise<Response<T> | ErrorResponse> => {\n try {\n const result = await cb();\n return new Response<T>(result);\n } catch (ex) {\n return new ErrorResponse(ex);\n }\n};\n\nexport interface IListResponse<T> {\n items: T[];\n meta: IRecordLockingMeta;\n}\n\nexport const resolveList = async <T>(\n cb: () => Promise<IListResponse<T>>\n): Promise<Response<T[]> | ErrorResponse> => {\n try {\n const { items, meta } = await cb();\n return new ListResponse(items, meta);\n } catch (ex) {\n return new ListErrorResponse(ex);\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAGO,MAAMC,OAAO,GAAG,MAAUC,EAAoB,IAA2C;EAC5F,IAAI;IACA,MAAMC,MAAM,GAAG,MAAMD,EAAE,CAAC,CAAC;IACzB,OAAO,IAAIE,wBAAQ,CAAID,MAAM,CAAC;EAClC,CAAC,CAAC,OAAOE,EAAE,EAAE;IACT,OAAO,IAAIC,6BAAa,CAACD,EAAE,CAAC;EAChC;AACJ,CAAC;AAACE,OAAA,CAAAN,OAAA,GAAAA,OAAA;AAOK,MAAMO,WAAW,GAAG,MACvBN,EAAmC,IACM;EACzC,IAAI;IACA,MAAM;MAAEO,KAAK;MAAEC;IAAK,CAAC,GAAG,MAAMR,EAAE,CAAC,CAAC;IAClC,OAAO,IAAIS,4BAAY,CAACF,KAAK,EAAEC,IAAI,CAAC;EACxC,CAAC,CAAC,OAAOL,EAAE,EAAE;IACT,OAAO,IAAIO,iCAAiB,CAACP,EAAE,CAAC;EACpC;AACJ,CAAC;AAACE,OAAA,CAAAC,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -1,6 +0,0 @@
1
- import { IRecordLockingIdentity } from "../types";
2
- export interface IValidateSameIdentityParams {
3
- getIdentity: () => Pick<IRecordLockingIdentity, "id">;
4
- target: Pick<IRecordLockingIdentity, "id">;
5
- }
6
- export declare const validateSameIdentity: (params: IValidateSameIdentityParams) => void;
@@ -1,24 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.validateSameIdentity = void 0;
7
- var _apiSecurity = require("@webiny/api-security");
8
- const validateSameIdentity = params => {
9
- const {
10
- getIdentity,
11
- target
12
- } = params;
13
- const identity = getIdentity();
14
- if (identity.id === target.id) {
15
- return;
16
- }
17
- throw new _apiSecurity.NotAuthorizedError({
18
- message: "Cannot update lock record. Record is locked by another user.",
19
- code: "LOCK_UPDATE_ERROR"
20
- });
21
- };
22
- exports.validateSameIdentity = validateSameIdentity;
23
-
24
- //# sourceMappingURL=validateSameIdentity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_apiSecurity","require","validateSameIdentity","params","getIdentity","target","identity","id","NotAuthorizedError","message","code","exports"],"sources":["validateSameIdentity.ts"],"sourcesContent":["import { NotAuthorizedError } from \"@webiny/api-security\";\nimport { IRecordLockingIdentity } from \"~/types\";\n\nexport interface IValidateSameIdentityParams {\n getIdentity: () => Pick<IRecordLockingIdentity, \"id\">;\n target: Pick<IRecordLockingIdentity, \"id\">;\n}\n\nexport const validateSameIdentity = (params: IValidateSameIdentityParams): void => {\n const { getIdentity, target } = params;\n const identity = getIdentity();\n if (identity.id === target.id) {\n return;\n }\n throw new NotAuthorizedError({\n message: \"Cannot update lock record. Record is locked by another user.\",\n code: \"LOCK_UPDATE_ERROR\"\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQO,MAAMC,oBAAoB,GAAIC,MAAmC,IAAW;EAC/E,MAAM;IAAEC,WAAW;IAAEC;EAAO,CAAC,GAAGF,MAAM;EACtC,MAAMG,QAAQ,GAAGF,WAAW,CAAC,CAAC;EAC9B,IAAIE,QAAQ,CAACC,EAAE,KAAKF,MAAM,CAACE,EAAE,EAAE;IAC3B;EACJ;EACA,MAAM,IAAIC,+BAAkB,CAAC;IACzBC,OAAO,EAAE,8DAA8D;IACvEC,IAAI,EAAE;EACV,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAT,oBAAA,GAAAA,oBAAA","ignoreList":[]}