@webiny/api-record-locking 6.0.0-alpha.5 → 6.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. package/README.md +10 -9
  2. package/domain/LockRecord.d.ts +45 -0
  3. package/{utils/convertEntryToLockRecord.js → domain/LockRecord.js} +10 -21
  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 +7 -3
  195. package/graphql/schema.js +99 -61
  196. package/graphql/schema.js.map +1 -1
  197. package/index.d.ts +3 -3
  198. package/index.js +48 -25
  199. package/index.js.map +1 -1
  200. package/package.json +21 -25
  201. package/types.d.ts +3 -132
  202. package/types.js +2 -20
  203. package/types.js.map +1 -1
  204. package/utils/convertWhereCondition.d.ts +1 -1
  205. package/utils/convertWhereCondition.js +11 -14
  206. package/utils/convertWhereCondition.js.map +1 -1
  207. package/utils/getTimeout.js +1 -8
  208. package/utils/getTimeout.js.map +1 -1
  209. package/utils/lockRecordDatabaseId.js +4 -12
  210. package/utils/lockRecordDatabaseId.js.map +1 -1
  211. package/abstractions/IGetLockRecordUseCase.d.ts +0 -8
  212. package/abstractions/IGetLockRecordUseCase.js +0 -7
  213. package/abstractions/IGetLockRecordUseCase.js.map +0 -1
  214. package/abstractions/IGetLockedEntryLockRecordUseCase.d.ts +0 -8
  215. package/abstractions/IGetLockedEntryLockRecordUseCase.js +0 -7
  216. package/abstractions/IGetLockedEntryLockRecordUseCase.js.map +0 -1
  217. package/abstractions/IIsEntryLocked.d.ts +0 -8
  218. package/abstractions/IIsEntryLocked.js +0 -7
  219. package/abstractions/IIsEntryLocked.js.map +0 -1
  220. package/abstractions/IKickOutCurrentUserUseCase.d.ts +0 -5
  221. package/abstractions/IKickOutCurrentUserUseCase.js +0 -7
  222. package/abstractions/IKickOutCurrentUserUseCase.js.map +0 -1
  223. package/abstractions/IListAllLockRecordsUseCase.d.ts +0 -9
  224. package/abstractions/IListAllLockRecordsUseCase.js +0 -7
  225. package/abstractions/IListAllLockRecordsUseCase.js.map +0 -1
  226. package/abstractions/IListLockRecordsUseCase.d.ts +0 -10
  227. package/abstractions/IListLockRecordsUseCase.js +0 -7
  228. package/abstractions/IListLockRecordsUseCase.js.map +0 -1
  229. package/abstractions/ILockEntryUseCase.d.ts +0 -11
  230. package/abstractions/ILockEntryUseCase.js +0 -7
  231. package/abstractions/ILockEntryUseCase.js.map +0 -1
  232. package/abstractions/IUnlockEntryRequestUseCase.d.ts +0 -11
  233. package/abstractions/IUnlockEntryRequestUseCase.js +0 -7
  234. package/abstractions/IUnlockEntryRequestUseCase.js.map +0 -1
  235. package/abstractions/IUnlockEntryUseCase.d.ts +0 -12
  236. package/abstractions/IUnlockEntryUseCase.js +0 -7
  237. package/abstractions/IUnlockEntryUseCase.js.map +0 -1
  238. package/abstractions/IUpdateEntryLockUseCase.d.ts +0 -11
  239. package/abstractions/IUpdateEntryLockUseCase.js +0 -7
  240. package/abstractions/IUpdateEntryLockUseCase.js.map +0 -1
  241. package/crud/crud.d.ts +0 -7
  242. package/crud/crud.js +0 -204
  243. package/crud/crud.js.map +0 -1
  244. package/crud/model.d.ts +0 -2
  245. package/crud/model.js +0 -127
  246. package/crud/model.js.map +0 -1
  247. package/useCases/GetLockRecord/GetLockRecordUseCase.d.ts +0 -16
  248. package/useCases/GetLockRecord/GetLockRecordUseCase.js +0 -39
  249. package/useCases/GetLockRecord/GetLockRecordUseCase.js.map +0 -1
  250. package/useCases/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.d.ts +0 -16
  251. package/useCases/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js +0 -29
  252. package/useCases/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js.map +0 -1
  253. package/useCases/IsEntryLocked/IsEntryLockedUseCase.d.ts +0 -13
  254. package/useCases/IsEntryLocked/IsEntryLockedUseCase.js +0 -31
  255. package/useCases/IsEntryLocked/IsEntryLockedUseCase.js.map +0 -1
  256. package/useCases/KickOutCurrentUser/KickOutCurrentUserUseCase.d.ts +0 -12
  257. package/useCases/KickOutCurrentUser/KickOutCurrentUserUseCase.js +0 -46
  258. package/useCases/KickOutCurrentUser/KickOutCurrentUserUseCase.js.map +0 -1
  259. package/useCases/ListAllLockRecordsUseCase/ListAllLockRecordsUseCase.d.ts +0 -13
  260. package/useCases/ListAllLockRecordsUseCase/ListAllLockRecordsUseCase.js +0 -34
  261. package/useCases/ListAllLockRecordsUseCase/ListAllLockRecordsUseCase.js.map +0 -1
  262. package/useCases/ListLockRecordsUseCase/ListLockRecordsUseCase.d.ts +0 -14
  263. package/useCases/ListLockRecordsUseCase/ListLockRecordsUseCase.js +0 -27
  264. package/useCases/ListLockRecordsUseCase/ListLockRecordsUseCase.js.map +0 -1
  265. package/useCases/LockEntryUseCase/LockEntryUseCase.d.ts +0 -21
  266. package/useCases/LockEntryUseCase/LockEntryUseCase.js +0 -64
  267. package/useCases/LockEntryUseCase/LockEntryUseCase.js.map +0 -1
  268. package/useCases/UnlockEntryUseCase/UnlockEntryUseCase.d.ts +0 -23
  269. package/useCases/UnlockEntryUseCase/UnlockEntryUseCase.js +0 -90
  270. package/useCases/UnlockEntryUseCase/UnlockEntryUseCase.js.map +0 -1
  271. package/useCases/UnlockRequestUseCase/UnlockEntryRequestUseCase.d.ts +0 -21
  272. package/useCases/UnlockRequestUseCase/UnlockEntryRequestUseCase.js +0 -82
  273. package/useCases/UnlockRequestUseCase/UnlockEntryRequestUseCase.js.map +0 -1
  274. package/useCases/UpdateEntryLock/UpdateEntryLockUseCase.d.ts +0 -26
  275. package/useCases/UpdateEntryLock/UpdateEntryLockUseCase.js +0 -93
  276. package/useCases/UpdateEntryLock/UpdateEntryLockUseCase.js.map +0 -1
  277. package/useCases/index.d.ts +0 -31
  278. package/useCases/index.js +0 -96
  279. package/useCases/index.js.map +0 -1
  280. package/useCases/types.d.ts +0 -5
  281. package/useCases/types.js +0 -7
  282. package/useCases/types.js.map +0 -1
  283. package/utils/calculateExpiresOn.d.ts +0 -2
  284. package/utils/calculateExpiresOn.js +0 -16
  285. package/utils/calculateExpiresOn.js.map +0 -1
  286. package/utils/checkPermissions.d.ts +0 -7
  287. package/utils/checkPermissions.js +0 -21
  288. package/utils/checkPermissions.js.map +0 -1
  289. package/utils/convertEntryToLockRecord.d.ts +0 -28
  290. package/utils/convertEntryToLockRecord.js.map +0 -1
  291. package/utils/resolve.js +0 -30
  292. package/utils/resolve.js.map +0 -1
  293. package/utils/validateSameIdentity.d.ts +0 -6
  294. package/utils/validateSameIdentity.js +0 -24
  295. package/utils/validateSameIdentity.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_resolve","require","_handlerGraphql","_renderFields","_createFieldTypePluginRecords","_renderListFilterFields","_renderSortEnum","_checkPermissions","createGraphQLSchema","params","context","model","recordLocking","getModel","models","security","withoutAuthorization","cms","listModels","filter","fields","length","isPrivate","fieldTypePlugins","createFieldTypePluginRecords","plugins","recordLockingFields","renderFields","type","listFilterFieldsRender","renderListFilterFields","excludeFields","sortEnumRender","renderSortEnum","sorterPlugins","plugin","createGraphQLSchemaPlugin","typeDefs","map","f","join","resolvers","Query","Mutation","RecordLockingQuery","isEntryLocked","_","args","resolve","checkPermissions","id","getLockRecord","result","NotFoundError","getLockedEntryLockRecord","listLockRecords","resolveList","listAllLockRecords","RecordLockingMutation","lockEntry","updateEntryLock","unlockEntry","force","unlockEntryRequest","name","exports"],"sources":["schema.ts"],"sourcesContent":["import { resolve, resolveList } from \"~/utils/resolve\";\nimport type { Context } from \"~/types\";\nimport type { IGraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { createGraphQLSchemaPlugin, NotFoundError } from \"@webiny/handler-graphql\";\nimport { renderFields } from \"@webiny/api-headless-cms/utils/renderFields\";\nimport { createFieldTypePluginRecords } from \"@webiny/api-headless-cms/graphql/schema/createFieldTypePluginRecords\";\nimport { renderListFilterFields } from \"@webiny/api-headless-cms/utils/renderListFilterFields\";\nimport { renderSortEnum } from \"@webiny/api-headless-cms/utils/renderSortEnum\";\nimport { checkPermissions } from \"~/utils/checkPermissions\";\n\ninterface Params {\n context: Pick<Context, \"plugins\" | \"recordLocking\" | \"security\" | \"cms\">;\n}\nexport const createGraphQLSchema = async (\n params: Params\n): Promise<IGraphQLSchemaPlugin<Context>> => {\n const context = params.context;\n\n const model = await context.recordLocking.getModel();\n\n const models = await context.security.withoutAuthorization(async () => {\n return (await context.cms.listModels()).filter(model => {\n if (model.fields.length === 0) {\n return false;\n } else if (model.isPrivate) {\n return false;\n }\n return true;\n });\n });\n\n const fieldTypePlugins = createFieldTypePluginRecords(context.plugins);\n\n const recordLockingFields = renderFields({\n models,\n model,\n fields: model.fields,\n type: \"manage\",\n fieldTypePlugins\n });\n\n const listFilterFieldsRender = renderListFilterFields({\n model,\n fields: model.fields,\n type: \"manage\",\n fieldTypePlugins,\n excludeFields: [\"entryId\"]\n });\n\n const sortEnumRender = renderSortEnum({\n model,\n fields: model.fields,\n fieldTypePlugins,\n sorterPlugins: []\n });\n\n const plugin = createGraphQLSchemaPlugin<Context>({\n typeDefs: /* GraphQL */ `\n ${recordLockingFields.map(f => f.typeDefs).join(\"\\n\")}\n\n type RecordLockingError {\n message: String\n code: String\n data: JSON\n stack: String\n }\n\n enum RecordLockingRecordActionType {\n requested\n approved\n denied\n }\n\n type RecordLockingIdentity {\n id: String!\n displayName: String\n type: String\n }\n\n type RecordLockingRecordAction {\n id: ID!\n type: RecordLockingRecordActionType!\n message: String\n createdBy: RecordLockingIdentity!\n createdOn: DateTime!\n }\n\n type RecordLockingRecord {\n id: ID!\n lockedBy: RecordLockingIdentity!\n lockedOn: DateTime!\n updatedOn: DateTime!\n expiresOn: DateTime!\n ${recordLockingFields.map(f => f.fields).join(\"\\n\")}\n }\n\n type RecordLockingIsEntryLockedResponse {\n data: Boolean\n error: RecordLockingError\n }\n\n type RecordLockingGetLockRecordResponse {\n data: RecordLockingRecord\n error: RecordLockingError\n }\n\n type RecordLockingGetLockedEntryLockRecordResponse {\n data: RecordLockingRecord\n error: RecordLockingError\n }\n\n type RecordLockingListLockRecordsResponse {\n data: [RecordLockingRecord!]\n error: RecordLockingError\n }\n\n type RecordLockingLockEntryResponse {\n data: RecordLockingRecord\n error: RecordLockingError\n }\n \n type RecordLockingUpdateLockResponse {\n data: RecordLockingRecord\n error: RecordLockingError\n }\n\n type RecordLockingUnlockEntryResponse {\n data: RecordLockingRecord\n error: RecordLockingError\n }\n\n type RecordLockingUnlockEntryRequestResponse {\n data: RecordLockingRecord\n error: RecordLockingError\n }\n\n input RecordLockingListWhereInput {\n ${listFilterFieldsRender}\n }\n\n enum RecordLockingListSorter {\n ${sortEnumRender}\n }\n\n type RecordLockingQuery {\n _empty: String\n }\n\n type RecordLockingMutation {\n _empty: String\n }\n\n extend type RecordLockingQuery {\n isEntryLocked(id: ID!, type: String!): RecordLockingIsEntryLockedResponse!\n getLockRecord(id: ID!, type: String!): RecordLockingGetLockRecordResponse!\n # Returns lock record or null - if entry is locked in context of the current user, does not throw an error like getLockRecord if no record in the DB\n getLockedEntryLockRecord(id: ID!, type: String!): RecordLockingGetLockedEntryLockRecordResponse!\n listAllLockRecords(\n where: RecordLockingListWhereInput\n sort: [RecordLockingListSorter!]\n limit: Int\n after: String\n ): RecordLockingListLockRecordsResponse!\n # Basically same as listAllLockRecords except this one will filter out records with expired lock.\n listLockRecords(\n where: RecordLockingListWhereInput\n sort: [RecordLockingListSorter!]\n limit: Int\n after: String\n ): RecordLockingListLockRecordsResponse!\n }\n\n extend type RecordLockingMutation {\n lockEntry(id: ID!, type: String!): RecordLockingLockEntryResponse!\n updateEntryLock(id: ID!, type: String!): RecordLockingUpdateLockResponse!\n unlockEntry(id: ID!, type: String!, force: Boolean): RecordLockingUnlockEntryResponse!\n unlockEntryRequest(\n id: ID!\n type: String!\n ): RecordLockingUnlockEntryRequestResponse!\n }\n\n extend type Query {\n recordLocking: RecordLockingQuery\n }\n\n extend type Mutation {\n recordLocking: RecordLockingMutation\n }\n `,\n resolvers: {\n Query: {\n recordLocking: async () => ({})\n },\n Mutation: {\n recordLocking: async () => ({})\n },\n RecordLockingQuery: {\n async isEntryLocked(_, args, context) {\n return resolve(async () => {\n await checkPermissions(context);\n return context.recordLocking.isEntryLocked({\n id: args.id,\n type: args.type\n });\n });\n },\n async getLockRecord(_, args, context) {\n return resolve(async () => {\n await checkPermissions(context);\n const result = await context.recordLocking.getLockRecord({\n id: args.id,\n type: args.type\n });\n if (result) {\n return result;\n }\n throw new NotFoundError(\"Lock record not found.\");\n });\n },\n async getLockedEntryLockRecord(_, args, context) {\n return resolve(async () => {\n await checkPermissions(context);\n return await context.recordLocking.getLockedEntryLockRecord({\n id: args.id,\n type: args.type\n });\n });\n },\n\n async listLockRecords(_, args, context) {\n return resolveList(async () => {\n await checkPermissions(context);\n return await context.recordLocking.listLockRecords(args);\n });\n },\n listAllLockRecords(_, args, context) {\n return resolveList(async () => {\n await checkPermissions(context);\n return await context.recordLocking.listAllLockRecords(args);\n });\n }\n },\n RecordLockingMutation: {\n async lockEntry(_, args, context) {\n return resolve(async () => {\n await checkPermissions(context);\n return context.recordLocking.lockEntry({\n id: args.id,\n type: args.type\n });\n });\n },\n async updateEntryLock(_, args, context) {\n return resolve(async () => {\n await checkPermissions(context);\n return context.recordLocking.updateEntryLock({\n id: args.id,\n type: args.type\n });\n });\n },\n async unlockEntry(_, args, context) {\n return resolve(async () => {\n await checkPermissions(context);\n return await context.recordLocking.unlockEntry({\n id: args.id,\n type: args.type,\n force: args.force\n });\n });\n },\n async unlockEntryRequest(_, args, context) {\n return resolve(async () => {\n await checkPermissions(context);\n return await context.recordLocking.unlockEntryRequest({\n id: args.id,\n type: args.type\n });\n });\n }\n }\n }\n });\n\n plugin.name = \"recordLocking.graphql.schema.locking\";\n\n return plugin;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAGA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,6BAAA,GAAAH,OAAA;AACA,IAAAI,uBAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AAKO,MAAMO,mBAAmB,GAAG,MAC/BC,MAAc,IAC2B;EACzC,MAAMC,OAAO,GAAGD,MAAM,CAACC,OAAO;EAE9B,MAAMC,KAAK,GAAG,MAAMD,OAAO,CAACE,aAAa,CAACC,QAAQ,CAAC,CAAC;EAEpD,MAAMC,MAAM,GAAG,MAAMJ,OAAO,CAACK,QAAQ,CAACC,oBAAoB,CAAC,YAAY;IACnE,OAAO,CAAC,MAAMN,OAAO,CAACO,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,CAAC,IAAIA,CAAC,CAACnB,MAAM,CAAC,CAACoB,IAAI,CAAC,IAAI,CAAC;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkBX,sBAAsB;AACxC;AACA;AACA;AACA,kBAAkBG,cAAc;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;IACDS,SAAS,EAAE;MACPC,KAAK,EAAE;QACH9B,aAAa,EAAE,MAAAA,CAAA,MAAa,CAAC,CAAC;MAClC,CAAC;MACD+B,QAAQ,EAAE;QACN/B,aAAa,EAAE,MAAAA,CAAA,MAAa,CAAC,CAAC;MAClC,CAAC;MACDgC,kBAAkB,EAAE;QAChB,MAAMC,aAAaA,CAACC,CAAC,EAAEC,IAAI,EAAErC,OAAO,EAAE;UAClC,OAAO,IAAAsC,gBAAO,EAAC,YAAY;YACvB,MAAM,IAAAC,kCAAgB,EAACvC,OAAO,CAAC;YAC/B,OAAOA,OAAO,CAACE,aAAa,CAACiC,aAAa,CAAC;cACvCK,EAAE,EAAEH,IAAI,CAACG,EAAE;cACXtB,IAAI,EAAEmB,IAAI,CAACnB;YACf,CAAC,CAAC;UACN,CAAC,CAAC;QACN,CAAC;QACD,MAAMuB,aAAaA,CAACL,CAAC,EAAEC,IAAI,EAAErC,OAAO,EAAE;UAClC,OAAO,IAAAsC,gBAAO,EAAC,YAAY;YACvB,MAAM,IAAAC,kCAAgB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I,CAACnB;YACf,CAAC,CAAC;UACN,CAAC,CAAC;QACN;MACJ;IACJ;EACJ,CAAC,CAAC;EAEFO,MAAM,CAAC6B,IAAI,GAAG,sCAAsC;EAEpD,OAAO7B,MAAM;AACjB,CAAC;AAAC8B,OAAA,CAAAzD,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"names":["resolve","resolveList","createGraphQLSchemaPlugin","renderFields","renderListFilterFields","renderSortEnum","checkPermissions","IsEntryLockedUseCase","GetLockRecordUseCase","GetLockedEntryLockRecordUseCase","ListLockRecordsUseCase","ListAllLockRecordsUseCase","LockEntryUseCase","UpdateEntryLockUseCase","UnlockEntryUseCase","UnlockEntryRequestUseCase","createGraphQLSchema","params","model","models","filter","fields","length","fieldTypePlugins","recordLockingFields","type","listFilterFieldsRender","excludeFields","sortEnumRender","sorterPlugins","plugin","typeDefs","map","f","join","allFiltersAsString","resolvers","Query","recordLocking","Mutation","RecordLockingQuery","isEntryLocked","_","args","context","useCase","container","result","execute","id","isFail","error","value","getLockRecord","getLockedEntryLockRecord","listLockRecords","listAllLockRecords","RecordLockingMutation","lockEntry","updateEntryLock","unlockEntry","force","unlockEntryRequest","name"],"sources":["schema.ts"],"sourcesContent":["import { resolve, resolveList } from \"./resolve.js\";\nimport type { IGraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { createGraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { renderFields } from \"@webiny/api-headless-cms/utils/renderFields.js\";\nimport { renderListFilterFields } from \"@webiny/api-headless-cms/utils/renderListFilterFields.js\";\nimport { renderSortEnum } from \"@webiny/api-headless-cms/utils/renderSortEnum.js\";\nimport { checkPermissions } from \"./checkPermissions.js\";\nimport { IsEntryLockedUseCase } from \"~/features/IsEntryLocked/abstractions.js\";\nimport { GetLockRecordUseCase } from \"~/features/GetLockRecord/abstractions.js\";\nimport { GetLockedEntryLockRecordUseCase } from \"~/features/GetLockedEntryLockRecord/abstractions.js\";\nimport { ListLockRecordsUseCase } from \"~/features/ListLockRecords/abstractions.js\";\nimport { ListAllLockRecordsUseCase } from \"~/features/ListAllLockRecords/abstractions.js\";\nimport { LockEntryUseCase } from \"~/features/LockEntry/abstractions.js\";\nimport { UpdateEntryLockUseCase } from \"~/features/UpdateEntryLock/abstractions.js\";\nimport { UnlockEntryUseCase } from \"~/features/UnlockEntry/abstractions.js\";\nimport { UnlockEntryRequestUseCase } from \"~/features/UnlockEntryRequest/abstractions.js\";\nimport type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types/model.js\";\nimport type { CmsFieldTypePlugins } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface Params {\n // Record locking model\n model: CmsModel;\n // All public models\n models: CmsModel[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\nexport const createGraphQLSchema = async (\n params: Params\n): Promise<IGraphQLSchemaPlugin<ApiCoreContext>> => {\n // Record locking model\n const model = params.model;\n\n // Other public models that have at least one field\n const models = params.models.filter(model => {\n return model.fields.length > 0;\n });\n\n const fieldTypePlugins = params.fieldTypePlugins;\n\n const recordLockingFields = renderFields({\n models,\n model,\n fields: model.fields,\n type: \"manage\",\n fieldTypePlugins\n });\n\n const listFilterFieldsRender = renderListFilterFields({\n model,\n fields: model.fields,\n type: \"manage\",\n fieldTypePlugins,\n excludeFields: [\"entryId\"]\n });\n\n const sortEnumRender = renderSortEnum({\n model,\n fields: model.fields,\n fieldTypePlugins,\n sorterPlugins: []\n });\n\n const plugin = createGraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: /* GraphQL */ `\n ${recordLockingFields.map(f => f.typeDefs).join(\"\\n\")}\n\n type RecordLockingError {\n message: String\n code: String\n data: JSON\n stack: String\n }\n\n enum RecordLockingRecordActionType {\n requested\n approved\n denied\n }\n\n type RecordLockingIdentity {\n id: String!\n displayName: String\n type: String\n }\n\n type RecordLockingRecordAction {\n id: ID!\n type: RecordLockingRecordActionType!\n message: String\n createdBy: RecordLockingIdentity!\n createdOn: DateTime!\n }\n\n type RecordLockingRecord {\n id: ID!\n lockedBy: RecordLockingIdentity!\n lockedOn: DateTime!\n updatedOn: DateTime!\n expiresOn: DateTime!\n ${recordLockingFields.map(f => f.fields).join(\"\\n\")}\n }\n\n type RecordLockingIsEntryLockedResponse {\n data: Boolean\n error: RecordLockingError\n }\n\n type RecordLockingGetLockRecordResponse {\n data: RecordLockingRecord\n error: RecordLockingError\n }\n\n type RecordLockingGetLockedEntryLockRecordResponse {\n data: RecordLockingRecord\n error: RecordLockingError\n }\n\n type RecordLockingListLockRecordsResponse {\n data: [RecordLockingRecord!]\n error: RecordLockingError\n }\n\n type RecordLockingLockEntryResponse {\n data: RecordLockingRecord\n error: RecordLockingError\n }\n \n type RecordLockingUpdateLockResponse {\n data: RecordLockingRecord\n error: RecordLockingError\n }\n\n type RecordLockingUnlockEntryResponse {\n data: RecordLockingRecord\n error: RecordLockingError\n }\n\n type RecordLockingUnlockEntryRequestResponse {\n data: RecordLockingRecord\n error: RecordLockingError\n }\n\n input RecordLockingListWhereInput {\n ${listFilterFieldsRender.allFiltersAsString()}\n }\n\n enum RecordLockingListSorter {\n ${sortEnumRender}\n }\n\n type RecordLockingQuery {\n _empty: String\n }\n\n type RecordLockingMutation {\n _empty: String\n }\n\n extend type RecordLockingQuery {\n isEntryLocked(id: ID!, type: String!): RecordLockingIsEntryLockedResponse!\n getLockRecord(id: ID!, type: String!): RecordLockingGetLockRecordResponse!\n # Returns lock record or null - if entry is locked in context of the current user, does not throw an error like getLockRecord if no record in the DB\n getLockedEntryLockRecord(id: ID!, type: String!): RecordLockingGetLockedEntryLockRecordResponse!\n listAllLockRecords(\n where: RecordLockingListWhereInput\n sort: [RecordLockingListSorter!]\n limit: Int\n after: String\n ): RecordLockingListLockRecordsResponse!\n # Basically same as listAllLockRecords except this one will filter out records with expired lock.\n listLockRecords(\n where: RecordLockingListWhereInput\n sort: [RecordLockingListSorter!]\n limit: Int\n after: String\n ): RecordLockingListLockRecordsResponse!\n }\n\n extend type RecordLockingMutation {\n lockEntry(id: ID!, type: String!): RecordLockingLockEntryResponse!\n updateEntryLock(id: ID!, type: String!): RecordLockingUpdateLockResponse!\n unlockEntry(id: ID!, type: String!, force: Boolean): RecordLockingUnlockEntryResponse!\n unlockEntryRequest(\n id: ID!\n type: String!\n ): RecordLockingUnlockEntryRequestResponse!\n }\n\n extend type Query {\n recordLocking: RecordLockingQuery\n }\n\n extend type Mutation {\n recordLocking: RecordLockingMutation\n }\n `,\n resolvers: {\n Query: {\n recordLocking: async () => ({})\n },\n Mutation: {\n recordLocking: async () => ({})\n },\n RecordLockingQuery: {\n async isEntryLocked(_, args, context) {\n return resolve(async () => {\n await checkPermissions(context);\n const useCase = context.container.resolve(IsEntryLockedUseCase);\n const result = await useCase.execute({\n id: args.id,\n type: args.type\n });\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n },\n async getLockRecord(_, args, context) {\n return resolve(async () => {\n await checkPermissions(context);\n const useCase = context.container.resolve(GetLockRecordUseCase);\n const result = await useCase.execute({\n id: args.id,\n type: args.type\n });\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n },\n async getLockedEntryLockRecord(_, args, context) {\n return resolve(async () => {\n await checkPermissions(context);\n const useCase = context.container.resolve(GetLockedEntryLockRecordUseCase);\n const result = await useCase.execute({\n id: args.id,\n type: args.type\n });\n // Returns null if not found/expired/locked by current user\n if (result.isFail()) {\n return null;\n }\n return result.value;\n });\n },\n\n async listLockRecords(_, args, context) {\n return resolveList(async () => {\n await checkPermissions(context);\n const useCase = context.container.resolve(ListLockRecordsUseCase);\n const result = await useCase.execute(args);\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n },\n listAllLockRecords(_, args, context) {\n return resolveList(async () => {\n await checkPermissions(context);\n const useCase = context.container.resolve(ListAllLockRecordsUseCase);\n const result = await useCase.execute(args);\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n }\n },\n RecordLockingMutation: {\n async lockEntry(_, args, context) {\n return resolve(async () => {\n await checkPermissions(context);\n const useCase = context.container.resolve(LockEntryUseCase);\n const result = await useCase.execute({\n id: args.id,\n type: args.type\n });\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n },\n async updateEntryLock(_, args, context) {\n return resolve(async () => {\n await checkPermissions(context);\n const useCase = context.container.resolve(UpdateEntryLockUseCase);\n const result = await useCase.execute({\n id: args.id,\n type: args.type\n });\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n },\n async unlockEntry(_, args, context) {\n return resolve(async () => {\n await checkPermissions(context);\n const useCase = context.container.resolve(UnlockEntryUseCase);\n const result = await useCase.execute({\n id: args.id,\n type: args.type,\n force: args.force\n });\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n },\n async unlockEntryRequest(_, args, context) {\n return resolve(async () => {\n await checkPermissions(context);\n const useCase = context.container.resolve(UnlockEntryRequestUseCase);\n const result = await useCase.execute({\n id: args.id,\n type: args.type\n });\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n }\n }\n }\n });\n\n plugin.name = \"recordLocking.graphql.schema.locking\";\n\n return plugin;\n};\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,WAAW;AAE7B,SAASC,yBAAyB,QAAQ,yBAAyB;AACnE,SAASC,YAAY,QAAQ,gDAAgD;AAC7E,SAASC,sBAAsB,QAAQ,0DAA0D;AACjG,SAASC,cAAc,QAAQ,kDAAkD;AACjF,SAASC,gBAAgB;AACzB,SAASC,oBAAoB;AAC7B,SAASC,oBAAoB;AAC7B,SAASC,+BAA+B;AACxC,SAASC,sBAAsB;AAC/B,SAASC,yBAAyB;AAClC,SAASC,gBAAgB;AACzB,SAASC,sBAAsB;AAC/B,SAASC,kBAAkB;AAC3B,SAASC,yBAAyB;AAYlC,OAAO,MAAMC,mBAAmB,GAAG,MAC/BC,MAAc,IACkC;EAChD;EACA,MAAMC,KAAK,GAAGD,MAAM,CAACC,KAAK;;EAE1B;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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkBR,sBAAsB,CAACS,kBAAkB,CAAC,CAAC;AAC7D;AACA;AACA;AACA,kBAAkBP,cAAc;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;IACDQ,SAAS,EAAE;MACPC,KAAK,EAAE;QACHC,aAAa,EAAE,MAAAA,CAAA,MAAa,CAAC,CAAC;MAClC,CAAC;MACDC,QAAQ,EAAE;QACND,aAAa,EAAE,MAAAA,CAAA,MAAa,CAAC,CAAC;MAClC,CAAC;MACDE,kBAAkB,EAAE;QAChB,MAAMC,aAAaA,CAACC,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAE;UAClC,OAAO5C,OAAO,CAAC,YAAY;YACvB,MAAMM,gBAAgB,CAACsC,OAAO,CAAC;YAC/B,MAAMC,OAAO,GAAGD,OAAO,CAACE,SAAS,CAAC9C,OAAO,CAACO,oBAAoB,CAAC;YAC/D,MAAMwC,MAAM,GAAG,MAAMF,OAAO,CAACG,OAAO,CAAC;cACjCC,EAAE,EAAEN,IAAI,CAACM,EAAE;cACXxB,IAAI,EAAEkB,IAAI,CAAClB;YACf,CAAC,CAAC;YACF,IAAIsB,MAAM,CAACG,MAAM,CAAC,CAAC,EAAE;cACjB,MAAMH,MAAM,CAACI,KAAK;YACtB;YACA,OAAOJ,MAAM,CAACK,KAAK;UACvB,CAAC,CAAC;QACN,CAAC;QACD,MAAMC,aAAaA,CAACX,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAE;UAClC,OAAO5C,O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AC;cACjCC,EAAE,EAAEN,IAAI,CAACM,EAAE;cACXxB,IAAI,EAAEkB,IAAI,CAAClB;YACf,CAAC,CAAC;YACF,IAAIsB,MAAM,CAACG,MAAM,CAAC,CAAC,EAAE;cACjB,MAAMH,MAAM,CAACI,KAAK;YACtB;YACA,OAAOJ,MAAM,CAACK,KAAK;UACvB,CAAC,CAAC;QACN;MACJ;IACJ;EACJ,CAAC,CAAC;EAEFtB,MAAM,CAACiC,IAAI,GAAG,sCAAsC;EAEpD,OAAOjC,MAAM;AACjB,CAAC","ignoreList":[]}
package/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
+ import type { ApiCoreContext } from "@webiny/api-core/types/core.js";
1
2
  import { ContextPlugin } from "@webiny/api";
2
- import type { Context } from "./types";
3
3
  export interface ICreateContextPluginParams {
4
4
  /**
5
- * A number of seconds after last activity to wait before the record is automatically unlocked.
5
+ * A number of seconds after the last activity to wait before the record is automatically unlocked.
6
6
  */
7
7
  timeout?: number;
8
8
  }
9
- export declare const createRecordLocking: (params?: ICreateContextPluginParams) => ContextPlugin<Context>[];
9
+ export declare const createRecordLocking: (params?: ICreateContextPluginParams) => ContextPlugin<ApiCoreContext>[];
package/index.js CHANGED
@@ -1,39 +1,62 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createRecordLocking = void 0;
7
- var _schema = require("./graphql/schema");
8
- var _api = require("@webiny/api");
9
- var _crud = require("./crud/crud");
10
- var _model = require("./crud/model");
11
- var _apiHeadlessCms = require("@webiny/api-headless-cms");
1
+ import { ContextPlugin } from "@webiny/api";
2
+ import { WcpContext } from "@webiny/api-core/features/wcp/WcpContext/index.js";
3
+ import { ListModelsUseCase } from "@webiny/api-headless-cms/features/contentModel/ListModels";
4
+ import { GetModelUseCase } from "@webiny/api-headless-cms/features/contentModel/GetModel";
5
+ import { RecordLockingModel, RECORD_LOCKING_MODEL_ID } from "./domain/RecordLockingModel.js";
6
+ import { getTimeout } from "./utils/getTimeout.js";
7
+ import { RecordLockingFeature } from "./features/RecordLockingFeature.js";
8
+ import { createGraphQLSchema } from "./graphql/schema.js";
9
+ import { createFieldTypePluginRecords } from "@webiny/api-headless-cms/graphql/schema/createFieldTypePluginRecords.js";
10
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
11
+ import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
12
12
  const createContextPlugin = params => {
13
- const plugin = new _api.ContextPlugin(async context => {
14
- if (!context.wcp.canUseRecordLocking()) {
15
- return;
16
- }
17
- const ready = await (0, _apiHeadlessCms.isHeadlessCmsReady)(context);
18
- if (!ready) {
13
+ const plugin = new ContextPlugin(async context => {
14
+ const tenantContext = context.container.resolve(TenantContext);
15
+ const identityContext = context.container.resolve(IdentityContext);
16
+ const wcp = context.container.resolve(WcpContext);
17
+ const getModel = context.container.resolve(GetModelUseCase);
18
+ const listModels = context.container.resolve(ListModelsUseCase);
19
+ if (!wcp.canUseRecordLocking() || !tenantContext.getTenant()) {
19
20
  return;
20
21
  }
21
- context.plugins.register((0, _model.createLockingModel)());
22
- context.recordLocking = await (0, _crud.createRecordLockingCrud)({
23
- context,
24
- timeout: params?.timeout
22
+
23
+ // Register the private model
24
+ context.container.register(RecordLockingModel);
25
+
26
+ // Determine timeout value
27
+ const timeout = getTimeout(params?.timeout);
28
+
29
+ // Fetch CMS model to use for storing record locking data
30
+ const [model, publicModels] = await identityContext.withoutAuthorization(async () => {
31
+ const [model, publicModels] = await Promise.all([
32
+ // Get a record locking model
33
+ getModel.execute(RECORD_LOCKING_MODEL_ID),
34
+ // Get all models
35
+ listModels.execute({
36
+ includePrivate: false
37
+ })]);
38
+ return [model.value, publicModels.value];
25
39
  });
26
- const graphQlPlugin = await (0, _schema.createGraphQLSchema)({
27
- context
40
+
41
+ // Register GraphQL schema plugin
42
+ const graphQlPlugin = await createGraphQLSchema({
43
+ model,
44
+ models: publicModels,
45
+ fieldTypePlugins: createFieldTypePluginRecords(context.plugins)
28
46
  });
29
47
  context.plugins.register(graphQlPlugin);
48
+
49
+ // Register features
50
+ RecordLockingFeature.register(context.container, {
51
+ timeout,
52
+ model
53
+ });
30
54
  });
31
55
  plugin.name = "context.recordLocking";
32
56
  return plugin;
33
57
  };
34
- const createRecordLocking = params => {
58
+ export const createRecordLocking = params => {
35
59
  return [createContextPlugin(params)];
36
60
  };
37
- exports.createRecordLocking = createRecordLocking;
38
61
 
39
62
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_schema","require","_api","_crud","_model","_apiHeadlessCms","createContextPlugin","params","plugin","ContextPlugin","context","wcp","canUseRecordLocking","ready","isHeadlessCmsReady","plugins","register","createLockingModel","recordLocking","createRecordLockingCrud","timeout","graphQlPlugin","createGraphQLSchema","name","createRecordLocking","exports"],"sources":["index.ts"],"sourcesContent":["import { createGraphQLSchema } from \"~/graphql/schema\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport type { Context } from \"~/types\";\nimport { createRecordLockingCrud } from \"~/crud/crud\";\nimport { createLockingModel } from \"~/crud/model\";\nimport { isHeadlessCmsReady } from \"@webiny/api-headless-cms\";\n\nexport interface ICreateContextPluginParams {\n /**\n * A number of seconds after last activity to wait before the record is automatically unlocked.\n */\n timeout?: number;\n}\n\nconst createContextPlugin = (params?: ICreateContextPluginParams) => {\n const plugin = new ContextPlugin<Context>(async context => {\n if (!context.wcp.canUseRecordLocking()) {\n return;\n }\n\n const ready = await isHeadlessCmsReady(context);\n if (!ready) {\n return;\n }\n context.plugins.register(createLockingModel());\n\n context.recordLocking = await createRecordLockingCrud({\n context,\n timeout: params?.timeout\n });\n\n const graphQlPlugin = await createGraphQLSchema({ context });\n context.plugins.register(graphQlPlugin);\n });\n plugin.name = \"context.recordLocking\";\n\n return plugin;\n};\n\nexport const createRecordLocking = (params?: ICreateContextPluginParams) => {\n return [createContextPlugin(params)];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AASA,MAAMK,mBAAmB,GAAIC,MAAmC,IAAK;EACjE,MAAMC,MAAM,GAAG,IAAIC,kBAAa,CAAU,MAAMC,OAAO,IAAI;IACvD,IAAI,CAACA,OAAO,CAACC,GAAG,CAACC,mBAAmB,CAAC,CAAC,EAAE;MACpC;IACJ;IAEA,MAAMC,KAAK,GAAG,MAAM,IAAAC,kCAAkB,EAACJ,OAAO,CAAC;IAC/C,IAAI,CAACG,KAAK,EAAE;MACR;IACJ;IACAH,OAAO,CAACK,OAAO,CAACC,QAAQ,CAAC,IAAAC,yBAAkB,EAAC,CAAC,CAAC;IAE9CP,OAAO,CAACQ,aAAa,GAAG,MAAM,IAAAC,6BAAuB,EAAC;MAClDT,OAAO;MACPU,OAAO,EAAEb,MAAM,EAAEa;IACrB,CAAC,CAAC;IAEF,MAAMC,aAAa,GAAG,MAAM,IAAAC,2BAAmB,EAAC;MAAEZ;IAAQ,CAAC,CAAC;IAC5DA,OAAO,CAACK,OAAO,CAACC,QAAQ,CAACK,aAAa,CAAC;EAC3C,CAAC,CAAC;EACFb,MAAM,CAACe,IAAI,GAAG,uBAAuB;EAErC,OAAOf,MAAM;AACjB,CAAC;AAEM,MAAMgB,mBAAmB,GAAIjB,MAAmC,IAAK;EACxE,OAAO,CAACD,mBAAmB,CAACC,MAAM,CAAC,CAAC;AACxC,CAAC;AAACkB,OAAA,CAAAD,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"names":["ContextPlugin","WcpContext","ListModelsUseCase","GetModelUseCase","RecordLockingModel","RECORD_LOCKING_MODEL_ID","getTimeout","RecordLockingFeature","createGraphQLSchema","createFieldTypePluginRecords","IdentityContext","TenantContext","createContextPlugin","params","plugin","context","tenantContext","container","resolve","identityContext","wcp","getModel","listModels","canUseRecordLocking","getTenant","register","timeout","model","publicModels","withoutAuthorization","Promise","all","execute","includePrivate","value","graphQlPlugin","models","fieldTypePlugins","plugins","name","createRecordLocking"],"sources":["index.ts"],"sourcesContent":["import type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { WcpContext } from \"@webiny/api-core/features/wcp/WcpContext/index.js\";\nimport { ListModelsUseCase } from \"@webiny/api-headless-cms/features/contentModel/ListModels\";\nimport { GetModelUseCase } from \"@webiny/api-headless-cms/features/contentModel/GetModel\";\nimport { RecordLockingModel, RECORD_LOCKING_MODEL_ID } from \"~/domain/RecordLockingModel.js\";\nimport { getTimeout } from \"~/utils/getTimeout.js\";\nimport { RecordLockingFeature } from \"~/features/RecordLockingFeature.js\";\nimport { createGraphQLSchema } from \"~/graphql/schema.js\";\nimport { createFieldTypePluginRecords } from \"@webiny/api-headless-cms/graphql/schema/createFieldTypePluginRecords.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\n\nexport interface ICreateContextPluginParams {\n /**\n * A number of seconds after the last activity to wait before the record is automatically unlocked.\n */\n timeout?: number;\n}\n\nconst createContextPlugin = (params?: ICreateContextPluginParams) => {\n const plugin = new ContextPlugin<ApiCoreContext>(async context => {\n const tenantContext = context.container.resolve(TenantContext);\n const identityContext = context.container.resolve(IdentityContext);\n const wcp = context.container.resolve(WcpContext);\n const getModel = context.container.resolve(GetModelUseCase);\n const listModels = context.container.resolve(ListModelsUseCase);\n\n if (!wcp.canUseRecordLocking() || !tenantContext.getTenant()) {\n return;\n }\n\n // Register the private model\n context.container.register(RecordLockingModel);\n\n // Determine timeout value\n const timeout = getTimeout(params?.timeout);\n\n // Fetch CMS model to use for storing record locking data\n const [model, publicModels] = await identityContext.withoutAuthorization(async () => {\n const [model, publicModels] = await Promise.all([\n // Get a record locking model\n getModel.execute(RECORD_LOCKING_MODEL_ID),\n // Get all models\n listModels.execute({ includePrivate: false })\n ]);\n\n return [model.value, publicModels.value];\n });\n\n // Register GraphQL schema plugin\n const graphQlPlugin = await createGraphQLSchema({\n model,\n models: publicModels,\n fieldTypePlugins: createFieldTypePluginRecords(context.plugins)\n });\n\n context.plugins.register(graphQlPlugin);\n\n // Register features\n RecordLockingFeature.register(context.container, {\n timeout,\n model\n });\n });\n plugin.name = \"context.recordLocking\";\n\n return plugin;\n};\n\nexport const createRecordLocking = (params?: ICreateContextPluginParams) => {\n return [createContextPlugin(params)];\n};\n"],"mappings":"AACA,SAASA,aAAa,QAAQ,aAAa;AAC3C,SAASC,UAAU,QAAQ,mDAAmD;AAC9E,SAASC,iBAAiB,QAAQ,2DAA2D;AAC7F,SAASC,eAAe,QAAQ,yDAAyD;AACzF,SAASC,kBAAkB,EAAEC,uBAAuB;AACpD,SAASC,UAAU;AACnB,SAASC,oBAAoB;AAC7B,SAASC,mBAAmB;AAC5B,SAASC,4BAA4B,QAAQ,yEAAyE;AACtH,SAASC,eAAe,QAAQ,6DAA6D;AAC7F,SAASC,aAAa,QAAQ,0DAA0D;AASxF,MAAMC,mBAAmB,GAAIC,MAAmC,IAAK;EACjE,MAAMC,MAAM,GAAG,IAAId,aAAa,CAAiB,MAAMe,OAAO,IAAI;IAC9D,MAAMC,aAAa,GAAGD,OAAO,CAACE,SAAS,CAACC,OAAO,CAACP,aAAa,CAAC;IAC9D,MAAMQ,eAAe,GAAGJ,OAAO,CAACE,SAAS,CAACC,OAAO,CAACR,eAAe,CAAC;IAClE,MAAMU,GAAG,GAAGL,OAAO,CAACE,SAAS,CAACC,OAAO,CAACjB,UAAU,CAAC;IACjD,MAAMoB,QAAQ,GAAGN,OAAO,CAACE,SAAS,CAACC,OAAO,CAACf,eAAe,CAAC;IAC3D,MAAMmB,UAAU,GAAGP,OAAO,CAACE,SAAS,CAACC,OAAO,CAAChB,iBAAiB,CAAC;IAE/D,IAAI,CAACkB,GAAG,CAACG,m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/api-record-locking",
3
- "version": "6.0.0-alpha.5",
3
+ "version": "6.0.0-rc.0",
4
+ "type": "module",
4
5
  "main": "index.js",
5
6
  "repository": {
6
7
  "type": "git",
@@ -12,35 +13,30 @@
12
13
  ],
13
14
  "license": "MIT",
14
15
  "dependencies": {
15
- "@webiny/api": "6.0.0-alpha.5",
16
- "@webiny/api-headless-cms": "6.0.0-alpha.5",
17
- "@webiny/api-websockets": "6.0.0-alpha.5",
18
- "@webiny/error": "6.0.0-alpha.5",
19
- "@webiny/handler": "6.0.0-alpha.5",
20
- "@webiny/handler-aws": "6.0.0-alpha.5",
21
- "@webiny/handler-graphql": "6.0.0-alpha.5",
22
- "@webiny/plugins": "6.0.0-alpha.5",
23
- "@webiny/pubsub": "6.0.0-alpha.5",
24
- "@webiny/utils": "6.0.0-alpha.5"
16
+ "@webiny/api": "6.0.0-rc.0",
17
+ "@webiny/api-headless-cms": "6.0.0-rc.0",
18
+ "@webiny/api-websockets": "6.0.0-rc.0",
19
+ "@webiny/feature": "6.0.0-rc.0",
20
+ "@webiny/handler": "6.0.0-rc.0",
21
+ "@webiny/handler-aws": "6.0.0-rc.0",
22
+ "@webiny/handler-graphql": "6.0.0-rc.0",
23
+ "@webiny/plugins": "6.0.0-rc.0",
24
+ "@webiny/utils": "6.0.0-rc.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@webiny/api-i18n": "6.0.0-alpha.5",
28
- "@webiny/api-security": "6.0.0-alpha.5",
29
- "@webiny/api-tenancy": "6.0.0-alpha.5",
30
- "@webiny/api-wcp": "6.0.0-alpha.5",
31
- "@webiny/project-utils": "6.0.0-alpha.5",
32
- "graphql": "15.9.0",
33
- "rimraf": "6.0.1",
34
- "type-fest": "4.14.0",
35
- "typescript": "5.3.3"
27
+ "@webiny/api-core": "6.0.0-rc.0",
28
+ "@webiny/build-tools": "6.0.0-rc.0",
29
+ "@webiny/project-utils": "6.0.0-rc.0",
30
+ "@webiny/wcp": "6.0.0-rc.0",
31
+ "graphql": "16.12.0",
32
+ "rimraf": "6.1.3",
33
+ "type-fest": "5.4.4",
34
+ "typescript": "5.9.3",
35
+ "vitest": "4.0.18"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public",
39
39
  "directory": "dist"
40
40
  },
41
- "scripts": {
42
- "build": "node ../cli/bin.js run build",
43
- "watch": "node ../cli/bin.js run watch"
44
- },
45
- "gitHead": "b7e120541b093e91f214904a9f13e4c2c4640978"
41
+ "gitHead": "0f2aa699f4642e550ab62c96fcd050e8d02345c9"
46
42
  }
package/types.d.ts CHANGED
@@ -1,26 +1,8 @@
1
- import type { CmsContext, CmsEntryListParams, CmsEntryMeta, CmsIdentity, CmsModel, CmsModelManager } from "@webiny/api-headless-cms/types";
2
- import { CmsEntry, CmsError } from "@webiny/api-headless-cms/types";
3
- import type { Topic } from "@webiny/pubsub/types";
4
- import type { Context as IWebsocketsContext, IWebsocketsContextObject } from "@webiny/api-websockets/types";
5
- import type { SecurityPermission } from "@webiny/api-security/types";
6
- export { CmsError, CmsEntry };
1
+ import type { CmsEntryListParams, CmsEntryMeta, CmsIdentity } from "@webiny/api-headless-cms/types/index.js";
2
+ import { CmsEntry, CmsError } from "@webiny/api-headless-cms/types/index.js";
3
+ export type { CmsError, CmsEntry };
7
4
  export type IRecordLockingIdentity = CmsIdentity;
8
- export type IRecordLockingModelManager = CmsModelManager<IRecordLockingLockRecordValues>;
9
5
  export type IRecordLockingMeta = CmsEntryMeta;
10
- export interface IHasRecordLockingAccessCallable {
11
- (): Promise<boolean>;
12
- }
13
- export interface IGetWebsocketsContextCallable {
14
- (): IWebsocketsContextObject;
15
- }
16
- export interface IGetIdentity {
17
- (): IRecordLockingIdentity;
18
- }
19
- export interface IRecordLockingLockRecordValues {
20
- targetId: string;
21
- type: IRecordLockingLockRecordEntryType;
22
- actions?: IRecordLockingLockRecordAction[];
23
- }
24
6
  export declare enum RecordLockingLockRecordActionType {
25
7
  requested = "requested",
26
8
  approved = "approved",
@@ -69,114 +51,3 @@ export interface IRecordLockingLockRecord extends IRecordLockingLockRecordObject
69
51
  export type IRecordLockingLockRecordEntryType = string;
70
52
  export type IRecordLockingListAllLockRecordsParams = Pick<CmsEntryListParams, "where" | "limit" | "sort" | "after">;
71
53
  export type IRecordLockingListLockRecordsParams = IRecordLockingListAllLockRecordsParams;
72
- export interface IRecordLockingListAllLockRecordsResponse {
73
- items: IRecordLockingLockRecord[];
74
- meta: IRecordLockingMeta;
75
- }
76
- export type IRecordLockingListLockRecordsResponse = IRecordLockingListAllLockRecordsResponse;
77
- export interface IRecordLockingGetLockRecordParams {
78
- id: string;
79
- type: IRecordLockingLockRecordEntryType;
80
- }
81
- export interface IRecordLockingIsLockedParams {
82
- id: string;
83
- type: IRecordLockingLockRecordEntryType;
84
- }
85
- export interface IRecordLockingGetLockedEntryLockRecordParams {
86
- id: string;
87
- type: IRecordLockingLockRecordEntryType;
88
- }
89
- export interface IRecordLockingLockEntryParams {
90
- id: string;
91
- type: IRecordLockingLockRecordEntryType;
92
- }
93
- export interface IRecordLockingUpdateEntryLockParams {
94
- id: string;
95
- type: IRecordLockingLockRecordEntryType;
96
- }
97
- export interface IRecordLockingUnlockEntryParams {
98
- id: string;
99
- type: IRecordLockingLockRecordEntryType;
100
- force?: boolean;
101
- }
102
- export interface IRecordLockingUnlockEntryRequestParams {
103
- id: string;
104
- type: IRecordLockingLockRecordEntryType;
105
- }
106
- export interface OnEntryBeforeLockTopicParams {
107
- id: string;
108
- type: IRecordLockingLockRecordEntryType;
109
- }
110
- export interface OnEntryAfterLockTopicParams {
111
- id: string;
112
- type: IRecordLockingLockRecordEntryType;
113
- record: IRecordLockingLockRecord;
114
- }
115
- export interface OnEntryLockErrorTopicParams {
116
- id: string;
117
- type: IRecordLockingLockRecordEntryType;
118
- error: CmsError;
119
- }
120
- export interface OnEntryBeforeUnlockTopicParams {
121
- id: string;
122
- type: IRecordLockingLockRecordEntryType;
123
- getIdentity: IGetIdentity;
124
- }
125
- export interface OnEntryAfterUnlockTopicParams {
126
- id: string;
127
- type: IRecordLockingLockRecordEntryType;
128
- record: IRecordLockingLockRecord;
129
- }
130
- export interface OnEntryUnlockErrorTopicParams {
131
- id: string;
132
- type: IRecordLockingLockRecordEntryType;
133
- error: CmsError;
134
- }
135
- export interface OnEntryBeforeUnlockRequestTopicParams {
136
- id: string;
137
- type: IRecordLockingLockRecordEntryType;
138
- }
139
- export interface OnEntryAfterUnlockRequestTopicParams {
140
- id: string;
141
- type: IRecordLockingLockRecordEntryType;
142
- record: IRecordLockingLockRecord;
143
- }
144
- export interface OnEntryUnlockRequestErrorTopicParams {
145
- id: string;
146
- type: IRecordLockingLockRecordEntryType;
147
- error: CmsError;
148
- }
149
- export interface IRecordLocking {
150
- /**
151
- * In milliseconds.
152
- */
153
- getTimeout: () => number;
154
- onEntryBeforeLock: Topic<OnEntryBeforeLockTopicParams>;
155
- onEntryAfterLock: Topic<OnEntryAfterLockTopicParams>;
156
- onEntryLockError: Topic<OnEntryLockErrorTopicParams>;
157
- onEntryBeforeUnlock: Topic<OnEntryBeforeUnlockTopicParams>;
158
- onEntryAfterUnlock: Topic<OnEntryAfterUnlockTopicParams>;
159
- onEntryUnlockError: Topic<OnEntryUnlockErrorTopicParams>;
160
- onEntryBeforeUnlockRequest: Topic<OnEntryBeforeUnlockRequestTopicParams>;
161
- onEntryAfterUnlockRequest: Topic<OnEntryAfterUnlockRequestTopicParams>;
162
- onEntryUnlockRequestError: Topic<OnEntryUnlockRequestErrorTopicParams>;
163
- getModel(): Promise<CmsModel>;
164
- listAllLockRecords(params?: IRecordLockingListAllLockRecordsParams): Promise<IRecordLockingListAllLockRecordsResponse>;
165
- /**
166
- * Same call as listAllLockRecords, except this one will filter out records with expired lock.
167
- */
168
- listLockRecords(params?: IRecordLockingListLockRecordsParams): Promise<IRecordLockingListLockRecordsResponse>;
169
- getLockRecord(params: IRecordLockingGetLockRecordParams): Promise<IRecordLockingLockRecord | null>;
170
- isEntryLocked(params: IRecordLockingIsLockedParams): Promise<boolean>;
171
- getLockedEntryLockRecord(params: IRecordLockingGetLockedEntryLockRecordParams): Promise<IRecordLockingLockRecord | null>;
172
- lockEntry(params: IRecordLockingLockEntryParams): Promise<IRecordLockingLockRecord>;
173
- updateEntryLock(params: IRecordLockingUpdateEntryLockParams): Promise<IRecordLockingLockRecord>;
174
- unlockEntry(params: IRecordLockingUnlockEntryParams): Promise<IRecordLockingLockRecord>;
175
- unlockEntryRequest(params: IRecordLockingUnlockEntryRequestParams): Promise<IRecordLockingLockRecord>;
176
- }
177
- export interface Context extends CmsContext, IWebsocketsContext {
178
- recordLocking: IRecordLocking;
179
- }
180
- export interface RecordLockingSecurityPermission extends SecurityPermission {
181
- canForceUnlock?: string;
182
- }
package/types.js CHANGED
@@ -1,28 +1,10 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "CmsEntry", {
7
- enumerable: true,
8
- get: function () {
9
- return _types.CmsEntry;
10
- }
11
- });
12
- Object.defineProperty(exports, "CmsError", {
13
- enumerable: true,
14
- get: function () {
15
- return _types.CmsError;
16
- }
17
- });
18
- exports.RecordLockingLockRecordActionType = void 0;
19
- var _types = require("@webiny/api-headless-cms/types");
20
- let RecordLockingLockRecordActionType = exports.RecordLockingLockRecordActionType = /*#__PURE__*/function (RecordLockingLockRecordActionType) {
1
+ export let RecordLockingLockRecordActionType = /*#__PURE__*/function (RecordLockingLockRecordActionType) {
21
2
  RecordLockingLockRecordActionType["requested"] = "requested";
22
3
  RecordLockingLockRecordActionType["approved"] = "approved";
23
4
  RecordLockingLockRecordActionType["denied"] = "denied";
24
5
  return RecordLockingLockRecordActionType;
25
6
  }({});
7
+
26
8
  /**
27
9
  * Do not use any special chars other than #, as we use this to create lock record IDs.
28
10
  */
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_types","require","RecordLockingLockRecordActionType","exports"],"sources":["types.ts"],"sourcesContent":["import type {\n CmsContext,\n CmsEntryListParams,\n CmsEntryMeta,\n CmsIdentity,\n CmsModel,\n CmsModelManager\n} from \"@webiny/api-headless-cms/types\";\nimport { CmsEntry, CmsError } from \"@webiny/api-headless-cms/types\";\nimport type { Topic } from \"@webiny/pubsub/types\";\nimport type {\n Context as IWebsocketsContext,\n IWebsocketsContextObject\n} from \"@webiny/api-websockets/types\";\nimport type { SecurityPermission } from \"@webiny/api-security/types\";\n\nexport { CmsError, CmsEntry };\n\nexport type IRecordLockingIdentity = CmsIdentity;\n\nexport type IRecordLockingModelManager = CmsModelManager<IRecordLockingLockRecordValues>;\n\nexport type IRecordLockingMeta = CmsEntryMeta;\n\nexport interface IHasRecordLockingAccessCallable {\n (): Promise<boolean>;\n}\n\nexport interface IGetWebsocketsContextCallable {\n (): IWebsocketsContextObject;\n}\n\nexport interface IGetIdentity {\n (): IRecordLockingIdentity;\n}\n\nexport interface IRecordLockingLockRecordValues {\n targetId: string;\n type: IRecordLockingLockRecordEntryType;\n actions?: IRecordLockingLockRecordAction[];\n}\nexport enum RecordLockingLockRecordActionType {\n requested = \"requested\",\n approved = \"approved\",\n denied = \"denied\"\n}\n\nexport interface IRecordLockingLockRecordRequestedAction {\n type: RecordLockingLockRecordActionType.requested;\n message?: string;\n createdOn: Date;\n createdBy: IRecordLockingIdentity;\n}\n\nexport interface IRecordLockingLockRecordApprovedAction {\n type: RecordLockingLockRecordActionType.approved;\n message?: string;\n createdOn: Date;\n createdBy: IRecordLockingIdentity;\n}\n\nexport interface IRecordLockingLockRecordDeniedAction {\n type: RecordLockingLockRecordActionType.denied;\n message?: string;\n createdOn: Date;\n createdBy: IRecordLockingIdentity;\n}\n\nexport type IRecordLockingLockRecordAction =\n | IRecordLockingLockRecordRequestedAction\n | IRecordLockingLockRecordApprovedAction\n | IRecordLockingLockRecordDeniedAction;\n\nexport interface IRecordLockingLockRecordObject {\n id: string;\n targetId: string;\n type: IRecordLockingLockRecordEntryType;\n lockedBy: IRecordLockingIdentity;\n lockedOn: Date;\n updatedOn: Date;\n expiresOn: Date;\n actions?: IRecordLockingLockRecordAction[];\n}\n\nexport interface IRecordLockingLockRecord extends IRecordLockingLockRecordObject {\n toObject(): IRecordLockingLockRecordObject;\n addAction(action: IRecordLockingLockRecordAction): void;\n getUnlockRequested(): IRecordLockingLockRecordRequestedAction | undefined;\n getUnlockApproved(): IRecordLockingLockRecordApprovedAction | undefined;\n getUnlockDenied(): IRecordLockingLockRecordDeniedAction | undefined;\n isExpired(): boolean;\n}\n\n/**\n * Do not use any special chars other than #, as we use this to create lock record IDs.\n */\nexport type IRecordLockingLockRecordEntryType = string;\n\nexport type IRecordLockingListAllLockRecordsParams = Pick<\n CmsEntryListParams,\n \"where\" | \"limit\" | \"sort\" | \"after\"\n>;\n\nexport type IRecordLockingListLockRecordsParams = IRecordLockingListAllLockRecordsParams;\n\nexport interface IRecordLockingListAllLockRecordsResponse {\n items: IRecordLockingLockRecord[];\n meta: IRecordLockingMeta;\n}\n\nexport type IRecordLockingListLockRecordsResponse = IRecordLockingListAllLockRecordsResponse;\n\nexport interface IRecordLockingGetLockRecordParams {\n id: string;\n type: IRecordLockingLockRecordEntryType;\n}\n\nexport interface IRecordLockingIsLockedParams {\n id: string;\n type: IRecordLockingLockRecordEntryType;\n}\n\nexport interface IRecordLockingGetLockedEntryLockRecordParams {\n id: string;\n type: IRecordLockingLockRecordEntryType;\n}\n\nexport interface IRecordLockingLockEntryParams {\n id: string;\n type: IRecordLockingLockRecordEntryType;\n}\n\nexport interface IRecordLockingUpdateEntryLockParams {\n id: string;\n type: IRecordLockingLockRecordEntryType;\n}\n\nexport interface IRecordLockingUnlockEntryParams {\n id: string;\n type: IRecordLockingLockRecordEntryType;\n force?: boolean;\n}\n\nexport interface IRecordLockingUnlockEntryRequestParams {\n id: string;\n type: IRecordLockingLockRecordEntryType;\n}\n\nexport interface OnEntryBeforeLockTopicParams {\n id: string;\n type: IRecordLockingLockRecordEntryType;\n}\n\nexport interface OnEntryAfterLockTopicParams {\n id: string;\n type: IRecordLockingLockRecordEntryType;\n record: IRecordLockingLockRecord;\n}\n\nexport interface OnEntryLockErrorTopicParams {\n id: string;\n type: IRecordLockingLockRecordEntryType;\n error: CmsError;\n}\n\nexport interface OnEntryBeforeUnlockTopicParams {\n id: string;\n type: IRecordLockingLockRecordEntryType;\n getIdentity: IGetIdentity;\n}\n\nexport interface OnEntryAfterUnlockTopicParams {\n id: string;\n type: IRecordLockingLockRecordEntryType;\n record: IRecordLockingLockRecord;\n}\n\nexport interface OnEntryUnlockErrorTopicParams {\n id: string;\n type: IRecordLockingLockRecordEntryType;\n error: CmsError;\n}\n\nexport interface OnEntryBeforeUnlockRequestTopicParams {\n id: string;\n type: IRecordLockingLockRecordEntryType;\n}\n\nexport interface OnEntryAfterUnlockRequestTopicParams {\n id: string;\n type: IRecordLockingLockRecordEntryType;\n record: IRecordLockingLockRecord;\n}\n\nexport interface OnEntryUnlockRequestErrorTopicParams {\n id: string;\n type: IRecordLockingLockRecordEntryType;\n error: CmsError;\n}\n\nexport interface IRecordLocking {\n /**\n * In milliseconds.\n */\n getTimeout: () => number;\n onEntryBeforeLock: Topic<OnEntryBeforeLockTopicParams>;\n onEntryAfterLock: Topic<OnEntryAfterLockTopicParams>;\n onEntryLockError: Topic<OnEntryLockErrorTopicParams>;\n onEntryBeforeUnlock: Topic<OnEntryBeforeUnlockTopicParams>;\n onEntryAfterUnlock: Topic<OnEntryAfterUnlockTopicParams>;\n onEntryUnlockError: Topic<OnEntryUnlockErrorTopicParams>;\n onEntryBeforeUnlockRequest: Topic<OnEntryBeforeUnlockRequestTopicParams>;\n onEntryAfterUnlockRequest: Topic<OnEntryAfterUnlockRequestTopicParams>;\n onEntryUnlockRequestError: Topic<OnEntryUnlockRequestErrorTopicParams>;\n getModel(): Promise<CmsModel>;\n listAllLockRecords(\n params?: IRecordLockingListAllLockRecordsParams\n ): Promise<IRecordLockingListAllLockRecordsResponse>;\n /**\n * Same call as listAllLockRecords, except this one will filter out records with expired lock.\n */\n listLockRecords(\n params?: IRecordLockingListLockRecordsParams\n ): Promise<IRecordLockingListLockRecordsResponse>;\n getLockRecord(\n params: IRecordLockingGetLockRecordParams\n ): Promise<IRecordLockingLockRecord | null>;\n isEntryLocked(params: IRecordLockingIsLockedParams): Promise<boolean>;\n getLockedEntryLockRecord(\n params: IRecordLockingGetLockedEntryLockRecordParams\n ): Promise<IRecordLockingLockRecord | null>;\n lockEntry(params: IRecordLockingLockEntryParams): Promise<IRecordLockingLockRecord>;\n updateEntryLock(params: IRecordLockingUpdateEntryLockParams): Promise<IRecordLockingLockRecord>;\n unlockEntry(params: IRecordLockingUnlockEntryParams): Promise<IRecordLockingLockRecord>;\n unlockEntryRequest(\n params: IRecordLockingUnlockEntryRequestParams\n ): Promise<IRecordLockingLockRecord>;\n}\n\nexport interface Context extends CmsContext, IWebsocketsContext {\n recordLocking: IRecordLocking;\n}\n\nexport interface RecordLockingSecurityPermission extends SecurityPermission {\n canForceUnlock?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAQA,IAAAA,MAAA,GAAAC,OAAA;AAAoE,IAiCxDC,iCAAiC,GAAAC,OAAA,CAAAD,iCAAA,0BAAjCA,iCAAiC;EAAjCA,iCAAiC;EAAjCA,iCAAiC;EAAjCA,iCAAiC;EAAA,OAAjCA,iCAAiC;AAAA;AAoD7C;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"names":["RecordLockingLockRecordActionType"],"sources":["types.ts"],"sourcesContent":["import type {\n CmsEntryListParams,\n CmsEntryMeta,\n CmsIdentity\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { CmsEntry, CmsError } from \"@webiny/api-headless-cms/types/index.js\";\n\nexport type { CmsError, CmsEntry };\n\nexport type IRecordLockingIdentity = CmsIdentity;\n\nexport type IRecordLockingMeta = CmsEntryMeta;\n\nexport enum RecordLockingLockRecordActionType {\n requested = \"requested\",\n approved = \"approved\",\n denied = \"denied\"\n}\n\nexport interface IRecordLockingLockRecordRequestedAction {\n type: RecordLockingLockRecordActionType.requested;\n message?: string;\n createdOn: Date;\n createdBy: IRecordLockingIdentity;\n}\n\nexport interface IRecordLockingLockRecordApprovedAction {\n type: RecordLockingLockRecordActionType.approved;\n message?: string;\n createdOn: Date;\n createdBy: IRecordLockingIdentity;\n}\n\nexport interface IRecordLockingLockRecordDeniedAction {\n type: RecordLockingLockRecordActionType.denied;\n message?: string;\n createdOn: Date;\n createdBy: IRecordLockingIdentity;\n}\n\nexport type IRecordLockingLockRecordAction =\n | IRecordLockingLockRecordRequestedAction\n | IRecordLockingLockRecordApprovedAction\n | IRecordLockingLockRecordDeniedAction;\n\nexport interface IRecordLockingLockRecordObject {\n id: string;\n targetId: string;\n type: IRecordLockingLockRecordEntryType;\n lockedBy: IRecordLockingIdentity;\n lockedOn: Date;\n updatedOn: Date;\n expiresOn: Date;\n actions?: IRecordLockingLockRecordAction[];\n}\n\nexport interface IRecordLockingLockRecord extends IRecordLockingLockRecordObject {\n toObject(): IRecordLockingLockRecordObject;\n addAction(action: IRecordLockingLockRecordAction): void;\n getUnlockRequested(): IRecordLockingLockRecordRequestedAction | undefined;\n getUnlockApproved(): IRecordLockingLockRecordApprovedAction | undefined;\n getUnlockDenied(): IRecordLockingLockRecordDeniedAction | undefined;\n isExpired(): boolean;\n}\n\n/**\n * Do not use any special chars other than #, as we use this to create lock record IDs.\n */\nexport type IRecordLockingLockRecordEntryType = string;\n\nexport type IRecordLockingListAllLockRecordsParams = Pick<\n CmsEntryListParams,\n \"where\" | \"limit\" | \"sort\" | \"after\"\n>;\n\nexport type IRecordLockingListLockRecordsParams = IRecordLockingListAllLockRecordsParams;\n"],"mappings":"AAaA,WAAYA,iCAAiC,0BAAjCA,iCAAiC;EAAjCA,iCAAiC;EAAjCA,iCAAiC;EAAjCA,iCAAiC;EAAA,OAAjCA,iCAAiC;AAAA;;AAoD7C;AACA;AACA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { IRecordLockingListLockRecordsParams } from "../types";
1
+ import type { IRecordLockingListLockRecordsParams } from "../types.js";
2
2
  type IWhere = IRecordLockingListLockRecordsParams["where"] | undefined;
3
3
  export declare const convertWhereCondition: (where: IWhere) => IWhere;
4
4
  export {};
@@ -1,19 +1,11 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.convertWhereCondition = void 0;
7
- var _lockRecordDatabaseId = require("./lockRecordDatabaseId");
1
+ import { createLockRecordDatabaseId } from "./lockRecordDatabaseId.js";
8
2
  const attachPrefix = value => {
9
- if (!value) {
10
- return value;
11
- } else if (Array.isArray(value)) {
12
- return value.map(_lockRecordDatabaseId.createLockRecordDatabaseId);
3
+ if (Array.isArray(value)) {
4
+ return value.map(createLockRecordDatabaseId);
13
5
  }
14
- return (0, _lockRecordDatabaseId.createLockRecordDatabaseId)(value);
6
+ return createLockRecordDatabaseId(value);
15
7
  };
16
- const convertWhereCondition = where => {
8
+ export const convertWhereCondition = where => {
17
9
  if (!where) {
18
10
  return where;
19
11
  }
@@ -30,12 +22,17 @@ const convertWhereCondition = where => {
30
22
  } else if (key.startsWith("id") === false) {
31
23
  continue;
32
24
  }
25
+ const value = where[key];
26
+ if (!value) {
27
+ continue;
28
+ }
33
29
  const newKey = key.replace("id", "entryId");
30
+ // @ts-expect-error
34
31
  where[newKey] = attachPrefix(where[key]);
32
+ // @ts-expect-error
35
33
  delete where[key];
36
34
  }
37
35
  return where;
38
36
  };
39
- exports.convertWhereCondition = convertWhereCondition;
40
37
 
41
38
  //# sourceMappingURL=convertWhereCondition.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_lockRecordDatabaseId","require","attachPrefix","value","Array","isArray","map","createLockRecordDatabaseId","convertWhereCondition","where","key","startsWith","subKey","newKey","replace","exports"],"sources":["convertWhereCondition.ts"],"sourcesContent":["import type { IRecordLockingListLockRecordsParams } from \"~/types\";\nimport { createLockRecordDatabaseId } from \"~/utils/lockRecordDatabaseId\";\n\ntype IWhere = IRecordLockingListLockRecordsParams[\"where\"] | undefined;\n\nconst attachPrefix = (value: string | string[] | undefined) => {\n if (!value) {\n return value;\n } else if (Array.isArray(value)) {\n return value.map(createLockRecordDatabaseId);\n }\n return createLockRecordDatabaseId(value);\n};\n\nexport const convertWhereCondition = (where: IWhere): IWhere => {\n if (!where) {\n return where;\n }\n for (const key in where) {\n if (key.startsWith(\"AND\") || key.startsWith(\"OR\")) {\n const value = where[key] as IWhere[] | undefined;\n if (!value) {\n continue;\n }\n for (const subKey in value) {\n value[subKey] = convertWhereCondition(value[subKey]);\n }\n continue;\n } else if (key.startsWith(\"id\") === false) {\n continue;\n }\n const newKey = key.replace(\"id\", \"entryId\");\n where[newKey] = attachPrefix(where[key] as string | string[] | undefined);\n delete where[key];\n }\n return where;\n};\n"],"mappings":";;;;;;AACA,IAAAA,qBAAA,GAAAC,OAAA;AAIA,MAAMC,YAAY,GAAIC,KAAoC,IAAK;EAC3D,IAAI,CAACA,KAAK,EAAE;IACR,OAAOA,KAAK;EAChB,CAAC,MAAM,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;IAC7B,OAAOA,KAAK,CAACG,GAAG,CAACC,gDAA0B,CAAC;EAChD;EACA,OAAO,IAAAA,gDAA0B,EAACJ,KAAK,CAAC;AAC5C,CAAC;AAEM,MAAMK,qBAAqB,GAAIC,KAAa,IAAa;EAC5D,IAAI,CAACA,KAAK,EAAE;IACR,OAAOA,KAAK;EAChB;EACA,KAAK,MAAMC,GAAG,IAAID,KAAK,EAAE;IACrB,IAAIC,GAAG,CAACC,UAAU,CAAC,KAAK,CAAC,IAAID,GAAG,CAACC,UAAU,CAAC,IAAI,CAAC,EAAE;MAC/C,MAAMR,KAAK,GAAGM,KAAK,CAACC,GAAG,CAAyB;MAChD,IAAI,CAACP,KAAK,EAAE;QACR;MACJ;MACA,KAAK,MAAMS,MAAM,IAAIT,KAAK,EAAE;QACxBA,KAAK,CAACS,MAAM,CAAC,GAAGJ,qBAAqB,CAACL,KAAK,CAACS,MAAM,CAAC,CAAC;MACxD;MACA;IACJ,CAAC,MAAM,IAAIF,GAAG,CAACC,UAAU,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE;MACvC;IACJ;IACA,MAAME,MAAM,GAAGH,GAAG,CAACI,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC;IAC3CL,KAAK,CAACI,MAAM,CAAC,GAAGX,YAAY,CAACO,KAAK,CAACC,GAAG,CAAkC,CAAC;IACzE,OAAOD,KAAK,CAACC,GAAG,CAAC;EACrB;EACA,OAAOD,KAAK;AAChB,CAAC;AAACM,OAAA,CAAAP,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"names":["createLockRecordDatabaseId","attachPrefix","value","Array","isArray","map","convertWhereCondition","where","key","startsWith","subKey","newKey","replace"],"sources":["convertWhereCondition.ts"],"sourcesContent":["import type { IRecordLockingListLockRecordsParams } from \"~/types.js\";\nimport { createLockRecordDatabaseId } from \"~/utils/lockRecordDatabaseId.js\";\n\ntype IWhere = IRecordLockingListLockRecordsParams[\"where\"] | undefined;\n\nconst attachPrefix = (value: string | string[]) => {\n if (Array.isArray(value)) {\n return value.map(createLockRecordDatabaseId);\n }\n return createLockRecordDatabaseId(value);\n};\n\nexport const convertWhereCondition = (where: IWhere): IWhere => {\n if (!where) {\n return where;\n }\n for (const key in where) {\n if (key.startsWith(\"AND\") || key.startsWith(\"OR\")) {\n const value = where[key as keyof typeof where] as IWhere[] | undefined;\n if (!value) {\n continue;\n }\n for (const subKey in value) {\n value[subKey] = convertWhereCondition(value[subKey]);\n }\n continue;\n } else if (key.startsWith(\"id\") === false) {\n continue;\n }\n const value = where[key as keyof typeof where];\n if (!value) {\n continue;\n }\n\n const newKey = key.replace(\"id\", \"entryId\") as keyof typeof where;\n // @ts-expect-error\n where[newKey] = attachPrefix(where[key]);\n // @ts-expect-error\n delete where[key];\n }\n return where;\n};\n"],"mappings":"AACA,SAASA,0BAA0B;AAInC,MAAMC,YAAY,GAAIC,KAAwB,IAAK;EAC/C,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;IACtB,OAAOA,KAAK,CAACG,GAAG,CAACL,0BAA0B,CAAC;EAChD;EACA,OAAOA,0BAA0B,CAACE,KAAK,CAAC;AAC5C,CAAC;AAED,OAAO,MAAMI,qBAAqB,GAAIC,KAAa,IAAa;EAC5D,IAAI,CAACA,KAAK,EAAE;IACR,OAAOA,KAAK;EAChB;EACA,KAAK,MAAMC,GAAG,IAAID,KAAK,EAAE;IACrB,IAAIC,GAAG,CAACC,UAAU,CAAC,KAAK,CAAC,IAAID,GAAG,CAACC,UAAU,CAAC,IAAI,CAAC,EAAE;MAC/C,MAAMP,KAAK,GAAGK,KAAK,CAACC,GAAG,CAA+C;MACtE,IAAI,CAACN,KAAK,EAAE;QACR;MACJ;MACA,KAAK,MAAMQ,MAAM,IAAIR,KAAK,EAAE;QACxBA,KAAK,CAACQ,MAAM,CAAC,GAAGJ,qBAAqB,CAACJ,KAAK,CAACQ,MAAM,CAAC,CAAC;MACxD;MACA;IACJ,CAAC,MAAM,IAAIF,GAAG,CAACC,UAAU,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE;MACvC;IACJ;IACA,MAAMP,KAAK,GAAGK,KAAK,CAACC,GAAG,CAAuB;IAC9C,IAAI,CAACN,KAAK,EAAE;MACR;IACJ;IAEA,MAAMS,MAAM,GAAGH,GAAG,CAACI,OAAO,CAAC,IAAI,EAAE,SAAS,CAAuB;IACjE;IACAL,KAAK,CAACI,MAAM,CAAC,GAAGV,YAAY,CAACM,KAAK,CAACC,GAAG,CAAC,CAAC;IACxC;IACA,OAAOD,KAAK,CAACC,GAAG,CAAC;EACrB;EACA,OAAOD,KAAK;AAChB,CAAC","ignoreList":[]}
@@ -1,16 +1,10 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getTimeout = void 0;
7
1
  const minTimeoutInSeconds = 30;
8
2
  const defaultTimeoutInSeconds = 60;
9
3
  /**
10
4
  * Input is in seconds.
11
5
  * Output is milliseconds.
12
6
  */
13
- const getTimeout = input => {
7
+ export const getTimeout = input => {
14
8
  if (input && input > 0) {
15
9
  if (input < minTimeoutInSeconds) {
16
10
  return minTimeoutInSeconds * 1000;
@@ -23,6 +17,5 @@ const getTimeout = input => {
23
17
  }
24
18
  return userDefined * 1000;
25
19
  };
26
- exports.getTimeout = getTimeout;
27
20
 
28
21
  //# sourceMappingURL=getTimeout.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["minTimeoutInSeconds","defaultTimeoutInSeconds","getTimeout","input","userDefined","process","env","WEBINY_RECORD_LOCK_TIMEOUT","parseInt","undefined","isNaN","exports"],"sources":["getTimeout.ts"],"sourcesContent":["const minTimeoutInSeconds = 30;\nconst defaultTimeoutInSeconds = 60;\n/**\n * Input is in seconds.\n * Output is milliseconds.\n */\nexport const getTimeout = (input: number | undefined) => {\n if (input && input > 0) {\n if (input < minTimeoutInSeconds) {\n return minTimeoutInSeconds * 1000;\n }\n return input * 1000;\n }\n const userDefined = process.env.WEBINY_RECORD_LOCK_TIMEOUT\n ? parseInt(process.env.WEBINY_RECORD_LOCK_TIMEOUT)\n : undefined;\n if (!userDefined || isNaN(userDefined) || userDefined <= 0) {\n return defaultTimeoutInSeconds * 1000;\n }\n return userDefined * 1000;\n};\n"],"mappings":";;;;;;AAAA,MAAMA,mBAAmB,GAAG,EAAE;AAC9B,MAAMC,uBAAuB,GAAG,EAAE;AAClC;AACA;AACA;AACA;AACO,MAAMC,UAAU,GAAIC,KAAyB,IAAK;EACrD,IAAIA,KAAK,IAAIA,KAAK,GAAG,CAAC,EAAE;IACpB,IAAIA,KAAK,GAAGH,mBAAmB,EAAE;MAC7B,OAAOA,mBAAmB,GAAG,IAAI;IACrC;IACA,OAAOG,KAAK,GAAG,IAAI;EACvB;EACA,MAAMC,WAAW,GAAGC,OAAO,CAACC,GAAG,CAACC,0BAA0B,GACpDC,QAAQ,CAACH,OAAO,CAACC,GAAG,CAACC,0BAA0B,CAAC,GAChDE,SAAS;EACf,IAAI,CAACL,WAAW,IAAIM,KAAK,CAACN,WAAW,CAAC,IAAIA,WAAW,IAAI,CAAC,EAAE;IACxD,OAAOH,uBAAuB,GAAG,IAAI;EACzC;EACA,OAAOG,WAAW,GAAG,IAAI;AAC7B,CAAC;AAACO,OAAA,CAAAT,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"names":["minTimeoutInSeconds","defaultTimeoutInSeconds","getTimeout","input","userDefined","process","env","WEBINY_RECORD_LOCK_TIMEOUT","parseInt","undefined","isNaN"],"sources":["getTimeout.ts"],"sourcesContent":["const minTimeoutInSeconds = 30;\nconst defaultTimeoutInSeconds = 60;\n/**\n * Input is in seconds.\n * Output is milliseconds.\n */\nexport const getTimeout = (input: number | undefined) => {\n if (input && input > 0) {\n if (input < minTimeoutInSeconds) {\n return minTimeoutInSeconds * 1000;\n }\n return input * 1000;\n }\n const userDefined = process.env.WEBINY_RECORD_LOCK_TIMEOUT\n ? parseInt(process.env.WEBINY_RECORD_LOCK_TIMEOUT)\n : undefined;\n if (!userDefined || isNaN(userDefined) || userDefined <= 0) {\n return defaultTimeoutInSeconds * 1000;\n }\n return userDefined * 1000;\n};\n"],"mappings":"AAAA,MAAMA,mBAAmB,GAAG,EAAE;AAC9B,MAAMC,uBAAuB,GAAG,EAAE;AAClC;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAIC,KAAyB,IAAK;EACrD,IAAIA,KAAK,IAAIA,KAAK,GAAG,CAAC,EAAE;IACpB,IAAIA,KAAK,GAAGH,mBAAmB,EAAE;MAC7B,OAAOA,mBAAmB,GAAG,IAAI;IACrC;IACA,OAAOG,KAAK,GAAG,IAAI;EACvB;EACA,MAAMC,WAAW,GAAGC,OAAO,CAACC,GAAG,CAACC,0BAA0B,GACpDC,QAAQ,CAACH,OAAO,CAACC,GAAG,CAACC,0BAA0B,CAAC,GAChDE,SAAS;EACf,IAAI,CAACL,WAAW,IAAIM,KAAK,CAACN,WAAW,CAAC,IAAIA,WAAW,IAAI,CAAC,EAAE;IACxD,OAAOH,uBAAuB,GAAG,IAAI;EACzC;EACA,OAAOG,WAAW,GAAG,IAAI;AAC7B,CAAC","ignoreList":[]}