@webiny/app-record-locking 6.4.5 → 6.6.0-alpha.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 (250) hide show
  1. package/RecordLockingModule.d.ts +2 -0
  2. package/RecordLockingModule.js +74 -0
  3. package/RecordLockingModule.js.map +1 -0
  4. package/{components/SecurityPermissions.js → SecurityPermissions.js} +1 -1
  5. package/SecurityPermissions.js.map +1 -0
  6. package/features/acquireLock/AcquireLockGateway.d.ts +12 -0
  7. package/features/acquireLock/AcquireLockGateway.js +43 -0
  8. package/features/acquireLock/AcquireLockGateway.js.map +1 -0
  9. package/features/acquireLock/AcquireLockUseCase.d.ts +10 -0
  10. package/features/acquireLock/AcquireLockUseCase.js +18 -0
  11. package/features/acquireLock/AcquireLockUseCase.js.map +1 -0
  12. package/features/acquireLock/abstractions.d.ts +19 -0
  13. package/features/acquireLock/abstractions.js +6 -0
  14. package/features/acquireLock/abstractions.js.map +1 -0
  15. package/features/acquireLock/feature.d.ts +3 -0
  16. package/features/acquireLock/feature.js +19 -0
  17. package/features/acquireLock/feature.js.map +1 -0
  18. package/features/checkLockStatus/CheckLockStatusGateway.d.ts +12 -0
  19. package/features/checkLockStatus/CheckLockStatusGateway.js +43 -0
  20. package/features/checkLockStatus/CheckLockStatusGateway.js.map +1 -0
  21. package/features/checkLockStatus/CheckLockStatusUseCase.d.ts +10 -0
  22. package/features/checkLockStatus/CheckLockStatusUseCase.js +18 -0
  23. package/features/checkLockStatus/CheckLockStatusUseCase.js.map +1 -0
  24. package/features/checkLockStatus/abstractions.d.ts +19 -0
  25. package/features/checkLockStatus/abstractions.js +6 -0
  26. package/features/checkLockStatus/abstractions.js.map +1 -0
  27. package/features/checkLockStatus/feature.d.ts +3 -0
  28. package/features/checkLockStatus/feature.js +19 -0
  29. package/features/checkLockStatus/feature.js.map +1 -0
  30. package/features/feature.d.ts +1 -0
  31. package/features/feature.js +19 -0
  32. package/features/feature.js.map +1 -0
  33. package/features/forceUnlock/ForceUnlockGateway.d.ts +12 -0
  34. package/features/forceUnlock/ForceUnlockGateway.js +44 -0
  35. package/features/forceUnlock/ForceUnlockGateway.js.map +1 -0
  36. package/features/forceUnlock/ForceUnlockUseCase.d.ts +10 -0
  37. package/features/forceUnlock/ForceUnlockUseCase.js +18 -0
  38. package/features/forceUnlock/ForceUnlockUseCase.js.map +1 -0
  39. package/features/forceUnlock/abstractions.d.ts +19 -0
  40. package/features/forceUnlock/abstractions.js +6 -0
  41. package/features/forceUnlock/abstractions.js.map +1 -0
  42. package/features/forceUnlock/feature.d.ts +3 -0
  43. package/features/forceUnlock/feature.js +19 -0
  44. package/features/forceUnlock/feature.js.map +1 -0
  45. package/{domain/graphql/fields.js → features/graphqlFields.js} +1 -1
  46. package/features/graphqlFields.js.map +1 -0
  47. package/features/listLockRecords/ListLockRecordsGateway.d.ts +12 -0
  48. package/features/listLockRecords/ListLockRecordsGateway.js +48 -0
  49. package/features/listLockRecords/ListLockRecordsGateway.js.map +1 -0
  50. package/features/listLockRecords/ListLockRecordsUseCase.d.ts +10 -0
  51. package/features/listLockRecords/ListLockRecordsUseCase.js +18 -0
  52. package/features/listLockRecords/ListLockRecordsUseCase.js.map +1 -0
  53. package/features/listLockRecords/abstractions.d.ts +22 -0
  54. package/features/listLockRecords/abstractions.js +6 -0
  55. package/features/listLockRecords/abstractions.js.map +1 -0
  56. package/features/listLockRecords/feature.d.ts +3 -0
  57. package/features/listLockRecords/feature.js +19 -0
  58. package/features/listLockRecords/feature.js.map +1 -0
  59. package/features/permissions/abstractions.d.ts +1 -1
  60. package/features/permissions/abstractions.js +1 -1
  61. package/features/permissions/abstractions.js.map +1 -1
  62. package/features/permissions/feature.js +1 -1
  63. package/features/permissions/feature.js.map +1 -1
  64. package/features/releaseLock/ReleaseLockGateway.d.ts +12 -0
  65. package/features/releaseLock/ReleaseLockGateway.js +44 -0
  66. package/features/releaseLock/ReleaseLockGateway.js.map +1 -0
  67. package/features/releaseLock/ReleaseLockUseCase.d.ts +10 -0
  68. package/features/releaseLock/ReleaseLockUseCase.js +18 -0
  69. package/features/releaseLock/ReleaseLockUseCase.js.map +1 -0
  70. package/features/releaseLock/abstractions.d.ts +19 -0
  71. package/features/releaseLock/abstractions.js +6 -0
  72. package/features/releaseLock/abstractions.js.map +1 -0
  73. package/features/releaseLock/feature.d.ts +3 -0
  74. package/features/releaseLock/feature.js +19 -0
  75. package/features/releaseLock/feature.js.map +1 -0
  76. package/index.d.ts +0 -5
  77. package/index.js +12 -13
  78. package/index.js.map +1 -1
  79. package/package.json +13 -17
  80. package/permissions/permissionsSchema.js.map +1 -0
  81. package/presentation/entryLocking/ContentEntryFormPresenterDecorator.d.ts +22 -0
  82. package/presentation/entryLocking/ContentEntryFormPresenterDecorator.js +61 -0
  83. package/presentation/entryLocking/ContentEntryFormPresenterDecorator.js.map +1 -0
  84. package/presentation/entryLocking/RecordLockingPresenter.d.ts +32 -0
  85. package/presentation/entryLocking/RecordLockingPresenter.js +164 -0
  86. package/presentation/entryLocking/RecordLockingPresenter.js.map +1 -0
  87. package/presentation/entryLocking/SingleEntryContentDecorator.d.ts +2 -0
  88. package/presentation/entryLocking/SingleEntryContentDecorator.js +72 -0
  89. package/presentation/entryLocking/SingleEntryContentDecorator.js.map +1 -0
  90. package/presentation/entryLocking/SingleEntryPresenterDecorator.d.ts +15 -0
  91. package/presentation/entryLocking/SingleEntryPresenterDecorator.js +40 -0
  92. package/presentation/entryLocking/SingleEntryPresenterDecorator.js.map +1 -0
  93. package/presentation/entryLocking/abstractions.d.ts +26 -0
  94. package/presentation/entryLocking/abstractions.js +5 -0
  95. package/presentation/entryLocking/abstractions.js.map +1 -0
  96. package/presentation/entryLocking/components/ForceUnlockButton.d.ts +11 -0
  97. package/presentation/entryLocking/components/ForceUnlockButton.js +37 -0
  98. package/presentation/entryLocking/components/ForceUnlockButton.js.map +1 -0
  99. package/presentation/entryLocking/components/LockedEntryOverlay.d.ts +10 -0
  100. package/presentation/entryLocking/components/LockedEntryOverlay.js +52 -0
  101. package/presentation/entryLocking/components/LockedEntryOverlay.js.map +1 -0
  102. package/presentation/entryLocking/components/RecordLockingGuard.d.ts +12 -0
  103. package/presentation/entryLocking/components/RecordLockingGuard.js +74 -0
  104. package/presentation/entryLocking/components/RecordLockingGuard.js.map +1 -0
  105. package/presentation/entryLocking/feature.d.ts +3 -0
  106. package/presentation/entryLocking/feature.js +21 -0
  107. package/presentation/entryLocking/feature.js.map +1 -0
  108. package/presentation/listLocking/ContentEntriesPresenterDecorator.d.ts +24 -0
  109. package/presentation/listLocking/ContentEntriesPresenterDecorator.js +67 -0
  110. package/presentation/listLocking/ContentEntriesPresenterDecorator.js.map +1 -0
  111. package/presentation/listLocking/ListLockRecordsPresenter.d.ts +17 -0
  112. package/presentation/listLocking/ListLockRecordsPresenter.js +52 -0
  113. package/presentation/listLocking/ListLockRecordsPresenter.js.map +1 -0
  114. package/presentation/listLocking/abstractions.d.ts +16 -0
  115. package/presentation/listLocking/abstractions.js +5 -0
  116. package/presentation/listLocking/abstractions.js.map +1 -0
  117. package/presentation/listLocking/components/ListLockRecordsSync.d.ts +3 -0
  118. package/presentation/listLocking/components/ListLockRecordsSync.js +26 -0
  119. package/presentation/listLocking/components/ListLockRecordsSync.js.map +1 -0
  120. package/presentation/listLocking/components/LockIndicatorCell.d.ts +2 -0
  121. package/presentation/listLocking/components/LockIndicatorCell.js +39 -0
  122. package/presentation/listLocking/components/LockIndicatorCell.js.map +1 -0
  123. package/presentation/listLocking/feature.d.ts +3 -0
  124. package/presentation/listLocking/feature.js +19 -0
  125. package/presentation/listLocking/feature.js.map +1 -0
  126. package/types.d.ts +1 -62
  127. package/components/HeadlessCmsActionsAcoCell.d.ts +0 -2
  128. package/components/HeadlessCmsActionsAcoCell.js +0 -38
  129. package/components/HeadlessCmsActionsAcoCell.js.map +0 -1
  130. package/components/HeadlessCmsContentEntry/ContentEntryGuard.d.ts +0 -9
  131. package/components/HeadlessCmsContentEntry/ContentEntryGuard.js +0 -34
  132. package/components/HeadlessCmsContentEntry/ContentEntryGuard.js.map +0 -1
  133. package/components/HeadlessCmsContentEntry/ContentEntryLocker.d.ts +0 -18
  134. package/components/HeadlessCmsContentEntry/ContentEntryLocker.js +0 -80
  135. package/components/HeadlessCmsContentEntry/ContentEntryLocker.js.map +0 -1
  136. package/components/HeadlessCmsContentEntry/HeadlessCmsContentEntry.d.ts +0 -2
  137. package/components/HeadlessCmsContentEntry/HeadlessCmsContentEntry.js +0 -44
  138. package/components/HeadlessCmsContentEntry/HeadlessCmsContentEntry.js.map +0 -1
  139. package/components/HeadlessCmsContentEntry/index.d.ts +0 -1
  140. package/components/HeadlessCmsContentEntry/index.js +0 -1
  141. package/components/LockedRecord/LockedRecord.d.ts +0 -6
  142. package/components/LockedRecord/LockedRecord.js +0 -54
  143. package/components/LockedRecord/LockedRecord.js.map +0 -1
  144. package/components/LockedRecord/LockedRecordForceUnlock.d.ts +0 -9
  145. package/components/LockedRecord/LockedRecordForceUnlock.js +0 -57
  146. package/components/LockedRecord/LockedRecordForceUnlock.js.map +0 -1
  147. package/components/LockedRecord/index.d.ts +0 -1
  148. package/components/LockedRecord/index.js +0 -1
  149. package/components/RecordLockingProvider.d.ts +0 -7
  150. package/components/RecordLockingProvider.js +0 -111
  151. package/components/RecordLockingProvider.js.map +0 -1
  152. package/components/SecurityPermissions.js.map +0 -1
  153. package/components/decorators/UseContentEntriesListHookDecorator.d.ts +0 -1
  154. package/components/decorators/UseContentEntriesListHookDecorator.js +0 -23
  155. package/components/decorators/UseContentEntriesListHookDecorator.js.map +0 -1
  156. package/components/decorators/UseRecordsDecorator.d.ts +0 -8
  157. package/components/decorators/UseRecordsDecorator.js +0 -16
  158. package/components/decorators/UseRecordsDecorator.js.map +0 -1
  159. package/components/decorators/UseSaveEntryDecorator.d.ts +0 -1
  160. package/components/decorators/UseSaveEntryDecorator.js +0 -41
  161. package/components/decorators/UseSaveEntryDecorator.js.map +0 -1
  162. package/domain/RecordLocking.d.ts +0 -28
  163. package/domain/RecordLocking.js +0 -259
  164. package/domain/RecordLocking.js.map +0 -1
  165. package/domain/RecordLockingClient.d.ts +0 -12
  166. package/domain/RecordLockingClient.js +0 -20
  167. package/domain/RecordLockingClient.js.map +0 -1
  168. package/domain/RecordLockingGetLockRecord.d.ts +0 -11
  169. package/domain/RecordLockingGetLockRecord.js +0 -19
  170. package/domain/RecordLockingGetLockRecord.js.map +0 -1
  171. package/domain/RecordLockingGetLockedEntryLockRecord.d.ts +0 -11
  172. package/domain/RecordLockingGetLockedEntryLockRecord.js +0 -18
  173. package/domain/RecordLockingGetLockedEntryLockRecord.js.map +0 -1
  174. package/domain/RecordLockingIsEntryLocked.d.ts +0 -11
  175. package/domain/RecordLockingIsEntryLocked.js +0 -20
  176. package/domain/RecordLockingIsEntryLocked.js.map +0 -1
  177. package/domain/RecordLockingListLockRecords.d.ts +0 -12
  178. package/domain/RecordLockingListLockRecords.js +0 -25
  179. package/domain/RecordLockingListLockRecords.js.map +0 -1
  180. package/domain/RecordLockingLockEntry.d.ts +0 -11
  181. package/domain/RecordLockingLockEntry.js +0 -12
  182. package/domain/RecordLockingLockEntry.js.map +0 -1
  183. package/domain/RecordLockingUnlockEntry.d.ts +0 -11
  184. package/domain/RecordLockingUnlockEntry.js +0 -18
  185. package/domain/RecordLockingUnlockEntry.js.map +0 -1
  186. package/domain/RecordLockingUpdateEntryLock.d.ts +0 -11
  187. package/domain/RecordLockingUpdateEntryLock.js +0 -18
  188. package/domain/RecordLockingUpdateEntryLock.js.map +0 -1
  189. package/domain/abstractions/IRecordLocking.d.ts +0 -25
  190. package/domain/abstractions/IRecordLocking.js +0 -0
  191. package/domain/abstractions/IRecordLockingClient.d.ts +0 -6
  192. package/domain/abstractions/IRecordLockingClient.js +0 -0
  193. package/domain/abstractions/IRecordLockingGetLockRecord.d.ts +0 -12
  194. package/domain/abstractions/IRecordLockingGetLockRecord.js +0 -0
  195. package/domain/abstractions/IRecordLockingGetLockedEntryLockRecord.d.ts +0 -12
  196. package/domain/abstractions/IRecordLockingGetLockedEntryLockRecord.js +0 -0
  197. package/domain/abstractions/IRecordLockingIsEntryLocked.d.ts +0 -8
  198. package/domain/abstractions/IRecordLockingIsEntryLocked.js +0 -0
  199. package/domain/abstractions/IRecordLockingListLockRecords.d.ts +0 -19
  200. package/domain/abstractions/IRecordLockingListLockRecords.js +0 -0
  201. package/domain/abstractions/IRecordLockingLockEntry.d.ts +0 -12
  202. package/domain/abstractions/IRecordLockingLockEntry.js +0 -0
  203. package/domain/abstractions/IRecordLockingUnlockEntry.d.ts +0 -13
  204. package/domain/abstractions/IRecordLockingUnlockEntry.js +0 -0
  205. package/domain/abstractions/IRecordLockingUpdateEntryLock.d.ts +0 -12
  206. package/domain/abstractions/IRecordLockingUpdateEntryLock.js +0 -0
  207. package/domain/graphql/fields.js.map +0 -1
  208. package/domain/graphql/getLockRecord.d.ts +0 -12
  209. package/domain/graphql/getLockRecord.js +0 -19
  210. package/domain/graphql/getLockRecord.js.map +0 -1
  211. package/domain/graphql/getLockedEntryLockRecord.d.ts +0 -12
  212. package/domain/graphql/getLockedEntryLockRecord.js +0 -19
  213. package/domain/graphql/getLockedEntryLockRecord.js.map +0 -1
  214. package/domain/graphql/isEntryLocked.d.ts +0 -12
  215. package/domain/graphql/isEntryLocked.js +0 -17
  216. package/domain/graphql/isEntryLocked.js.map +0 -1
  217. package/domain/graphql/listLockRecords.d.ts +0 -17
  218. package/domain/graphql/listLockRecords.js +0 -25
  219. package/domain/graphql/listLockRecords.js.map +0 -1
  220. package/domain/graphql/lockEntry.d.ts +0 -12
  221. package/domain/graphql/lockEntry.js +0 -19
  222. package/domain/graphql/lockEntry.js.map +0 -1
  223. package/domain/graphql/unlockEntry.d.ts +0 -12
  224. package/domain/graphql/unlockEntry.js +0 -19
  225. package/domain/graphql/unlockEntry.js.map +0 -1
  226. package/domain/graphql/updateEntryLock.d.ts +0 -12
  227. package/domain/graphql/updateEntryLock.js +0 -19
  228. package/domain/graphql/updateEntryLock.js.map +0 -1
  229. package/domain/permissionsSchema.js.map +0 -1
  230. package/domain/utils/createRecordLockingClient.d.ts +0 -3
  231. package/domain/utils/createRecordLockingClient.js +0 -11
  232. package/domain/utils/createRecordLockingClient.js.map +0 -1
  233. package/domain/utils/createRecordLockingError.d.ts +0 -6
  234. package/domain/utils/createRecordLockingError.js +0 -15
  235. package/domain/utils/createRecordLockingError.js.map +0 -1
  236. package/hooks/index.d.ts +0 -2
  237. package/hooks/index.js +0 -2
  238. package/hooks/usePermission.d.ts +0 -3
  239. package/hooks/usePermission.js +0 -19
  240. package/hooks/usePermission.js.map +0 -1
  241. package/hooks/useRecordLocking.d.ts +0 -2
  242. package/hooks/useRecordLocking.js +0 -11
  243. package/hooks/useRecordLocking.js.map +0 -1
  244. package/utils/createCacheKey.d.ts +0 -3
  245. package/utils/createCacheKey.js +0 -14
  246. package/utils/createCacheKey.js.map +0 -1
  247. /package/{components/SecurityPermissions.d.ts → SecurityPermissions.d.ts} +0 -0
  248. /package/{domain/graphql/fields.d.ts → features/graphqlFields.d.ts} +0 -0
  249. /package/{domain → permissions}/permissionsSchema.d.ts +0 -0
  250. /package/{domain → permissions}/permissionsSchema.js +0 -0
@@ -1,41 +0,0 @@
1
- import { useCallback } from "react";
2
- import { useRecordLocking } from "../../hooks/index.js";
3
- import { ContentEntryEditorConfig, useModel } from "@webiny/app-headless-cms";
4
- import { useSnackbar } from "@webiny/app-admin";
5
- const { ContentEntry: { ContentEntryForm: ContentEntryForm } } = ContentEntryEditorConfig;
6
- const UseSaveEntryDecorator = ContentEntryForm.useContentEntryForm.createDecorator((originalHook)=>function() {
7
- const hook = originalHook();
8
- const { fetchLockedEntryLockRecord, updateEntryLock } = useRecordLocking();
9
- const { showSnackbar } = useSnackbar();
10
- const { model } = useModel();
11
- const { entry } = hook;
12
- const saveEntry = useCallback(async (...params)=>{
13
- if (!entry.id) return hook.saveEntry(...params);
14
- const result = await fetchLockedEntryLockRecord({
15
- id: entry.id,
16
- $lockingType: model.modelId
17
- });
18
- if (result?.lockedBy) {
19
- const lockedBy = result.lockedBy;
20
- showSnackbar(`It seems that the entry is locked by ${lockedBy.displayName || lockedBy.id}. You can't save your changes.`);
21
- return null;
22
- }
23
- const saveResult = await hook.saveEntry(...params);
24
- if (saveResult) await updateEntryLock({
25
- id: saveResult.id,
26
- $lockingType: model.modelId
27
- });
28
- return saveResult;
29
- }, [
30
- entry?.id,
31
- model.modelId,
32
- updateEntryLock
33
- ]);
34
- return {
35
- ...hook,
36
- saveEntry
37
- };
38
- });
39
- export { UseSaveEntryDecorator };
40
-
41
- //# sourceMappingURL=UseSaveEntryDecorator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"components/decorators/UseSaveEntryDecorator.js","sources":["../../../src/components/decorators/UseSaveEntryDecorator.tsx"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useRecordLocking } from \"~/hooks/index.js\";\nimport { ContentEntryEditorConfig, useModel } from \"@webiny/app-headless-cms\";\nimport { useSnackbar } from \"@webiny/app-admin\";\n\nconst {\n ContentEntry: { ContentEntryForm }\n} = ContentEntryEditorConfig;\n\ntype SaveEntry = ReturnType<typeof ContentEntryForm.useContentEntryForm>[\"saveEntry\"];\n\nexport const UseSaveEntryDecorator = ContentEntryForm.useContentEntryForm.createDecorator(\n originalHook => {\n return function useRecordLockingUseSave() {\n const hook = originalHook();\n const { fetchLockedEntryLockRecord, updateEntryLock } = useRecordLocking();\n const { showSnackbar } = useSnackbar();\n const { model } = useModel();\n\n const { entry } = hook;\n\n const saveEntry: SaveEntry = useCallback(\n async (...params) => {\n if (!entry.id) {\n return hook.saveEntry(...params);\n }\n\n const result = await fetchLockedEntryLockRecord({\n id: entry.id,\n $lockingType: model.modelId\n });\n\n if (result?.lockedBy) {\n const lockedBy = result.lockedBy;\n showSnackbar(\n `It seems that the entry is locked by ${\n lockedBy.displayName || lockedBy.id\n }. You can't save your changes.`\n );\n return null;\n }\n\n const saveResult = await hook.saveEntry(...params);\n if (saveResult) {\n await updateEntryLock({\n id: saveResult.id,\n $lockingType: model.modelId\n });\n }\n\n return saveResult;\n },\n [entry?.id, model.modelId, updateEntryLock]\n );\n\n return {\n ...hook,\n saveEntry\n };\n };\n }\n);\n"],"names":["ContentEntryForm","ContentEntryEditorConfig","UseSaveEntryDecorator","originalHook","hook","fetchLockedEntryLockRecord","updateEntryLock","useRecordLocking","showSnackbar","useSnackbar","model","useModel","entry","saveEntry","useCallback","params","result","lockedBy","saveResult"],"mappings":";;;;AAKA,MAAM,EACF,cAAc,EAAEA,kBAAAA,gBAAgB,EAAE,EACrC,GAAGC;AAIG,MAAMC,wBAAwBF,iBAAiB,mBAAmB,CAAC,eAAe,CACrFG,CAAAA,eACW;QACH,MAAMC,OAAOD;QACb,MAAM,EAAEE,0BAA0B,EAAEC,eAAe,EAAE,GAAGC;QACxD,MAAM,EAAEC,YAAY,EAAE,GAAGC;QACzB,MAAM,EAAEC,KAAK,EAAE,GAAGC;QAElB,MAAM,EAAEC,KAAK,EAAE,GAAGR;QAElB,MAAMS,YAAuBC,YACzB,OAAO,GAAGC;YACN,IAAI,CAACH,MAAM,EAAE,EACT,OAAOR,KAAK,SAAS,IAAIW;YAG7B,MAAMC,SAAS,MAAMX,2BAA2B;gBAC5C,IAAIO,MAAM,EAAE;gBACZ,cAAcF,MAAM,OAAO;YAC/B;YAEA,IAAIM,QAAQ,UAAU;gBAClB,MAAMC,WAAWD,OAAO,QAAQ;gBAChCR,aACI,CAAC,qCAAqC,EAClCS,SAAS,WAAW,IAAIA,SAAS,EAAE,CACtC,8BAA8B,CAAC;gBAEpC,OAAO;YACX;YAEA,MAAMC,aAAa,MAAMd,KAAK,SAAS,IAAIW;YAC3C,IAAIG,YACA,MAAMZ,gBAAgB;gBAClB,IAAIY,WAAW,EAAE;gBACjB,cAAcR,MAAM,OAAO;YAC/B;YAGJ,OAAOQ;QACX,GACA;YAACN,OAAO;YAAIF,MAAM,OAAO;YAAEJ;SAAgB;QAG/C,OAAO;YACH,GAAGF,IAAI;YACPS;QACJ;IACJ"}
@@ -1,28 +0,0 @@
1
- import type { IRecordLocking } from "./abstractions/IRecordLocking.js";
2
- import type { ApolloClient } from "apollo-client";
3
- import type { IRecordLockingGetLockRecord } from "./abstractions/IRecordLockingGetLockRecord.js";
4
- import type { IRecordLockingIsEntryLocked } from "./abstractions/IRecordLockingIsEntryLocked.js";
5
- import type { IRecordLockingListLockRecords } from "./abstractions/IRecordLockingListLockRecords.js";
6
- import type { IRecordLockingLockEntry } from "./abstractions/IRecordLockingLockEntry.js";
7
- import type { IRecordLockingUnlockEntry } from "./abstractions/IRecordLockingUnlockEntry.js";
8
- import type { IRecordLockingError, IRecordLockingRecord } from "../types.js";
9
- import type { IRecordLockingUpdateEntryLock } from "../domain/abstractions/IRecordLockingUpdateEntryLock.js";
10
- import type { IRecordLockingGetLockedEntryLockRecord } from "./abstractions/IRecordLockingGetLockedEntryLockRecord.js";
11
- export interface ICreateRecordLockingParams {
12
- client: ApolloClient<any>;
13
- setLoading: (loading: boolean) => void;
14
- }
15
- export interface IRecordLockingParams {
16
- setLoading: (loading: boolean) => void;
17
- getLockRecord: IRecordLockingGetLockRecord;
18
- getLockedEntryLockRecord: IRecordLockingGetLockedEntryLockRecord;
19
- isEntryLocked: IRecordLockingIsEntryLocked;
20
- listLockRecords: IRecordLockingListLockRecords;
21
- lockEntry: IRecordLockingLockEntry;
22
- unlockEntry: IRecordLockingUnlockEntry;
23
- updateEntryLock: IRecordLockingUpdateEntryLock;
24
- }
25
- export interface IOnErrorCb {
26
- (error: IRecordLockingError): void;
27
- }
28
- export declare const createRecordLocking: <T extends IRecordLockingRecord>(config: ICreateRecordLockingParams) => IRecordLocking;
@@ -1,259 +0,0 @@
1
- import { RecordLockingGetLockRecord } from "./RecordLockingGetLockRecord.js";
2
- import { RecordLockingIsEntryLocked } from "./RecordLockingIsEntryLocked.js";
3
- import { RecordLockingListLockRecords } from "./RecordLockingListLockRecords.js";
4
- import { RecordLockingLockEntry } from "./RecordLockingLockEntry.js";
5
- import { RecordLockingUnlockEntry } from "./RecordLockingUnlockEntry.js";
6
- import { RecordLockingClient } from "./RecordLockingClient.js";
7
- import { createRecordLockingError } from "./utils/createRecordLockingError.js";
8
- import { parseIdentifier } from "@webiny/utils/parseIdentifier.js";
9
- import { createCacheKey } from "../utils/createCacheKey.js";
10
- import { RecordLockingUpdateEntryLock } from "./RecordLockingUpdateEntryLock.js";
11
- import { RecordLockingGetLockedEntryLockRecord } from "./RecordLockingGetLockedEntryLockRecord.js";
12
- class RecordLocking {
13
- constructor(params){
14
- this.loading = false;
15
- this.records = [];
16
- this.onErrorCb = null;
17
- this._setLoading = params.setLoading;
18
- this._getLockRecord = params.getLockRecord;
19
- this._getLockedEntryLockRecord = params.getLockedEntryLockRecord;
20
- this._listLockRecords = params.listLockRecords;
21
- this._unlockEntry = params.unlockEntry;
22
- this._updateEntryLock = params.updateEntryLock;
23
- }
24
- async setRecords(folderId, type, records) {
25
- const result = await this.fetchAndAssignRecords(folderId, type, records);
26
- if (!result) return;
27
- return result.map((record)=>{
28
- const { id: entryId } = parseIdentifier(record.id);
29
- return {
30
- ...record,
31
- $type: "RECORD",
32
- $lockingType: type,
33
- $locked: record.$locked,
34
- $selectable: record.$locked ? false : record.$selectable,
35
- entryId
36
- };
37
- });
38
- }
39
- async fetchLockRecord(params) {
40
- const { id, $lockingType } = params;
41
- const { id: entryId } = parseIdentifier(id);
42
- try {
43
- const result = await this._getLockRecord.execute({
44
- id: entryId,
45
- type: $lockingType
46
- });
47
- return {
48
- data: result.data,
49
- error: result.error
50
- };
51
- } catch (ex) {
52
- return {
53
- data: null,
54
- error: ex
55
- };
56
- }
57
- }
58
- async fetchLockedEntryLockRecord(params) {
59
- const { id, $lockingType } = params;
60
- const { id: entryId } = parseIdentifier(id);
61
- const result = await this._getLockedEntryLockRecord.execute({
62
- id: entryId,
63
- type: $lockingType
64
- });
65
- return result.data;
66
- }
67
- getLockRecordEntry(id) {
68
- return this.records.find((record)=>{
69
- const { id: entryId } = parseIdentifier(id);
70
- return record.entryId === entryId;
71
- });
72
- }
73
- isRecordLocked(record) {
74
- const result = this.records.find((r)=>{
75
- const { id: entryId } = parseIdentifier(record.id);
76
- return r.entryId === entryId && !!r.$locked && r.$lockingType === record.$lockingType;
77
- });
78
- if (!result?.$locked?.expiresOn) return false;
79
- const isExpired = this.isLockExpired(result.$locked.expiresOn);
80
- return !isExpired;
81
- }
82
- async updateEntryLock(params) {
83
- try {
84
- return await this._updateEntryLock.execute({
85
- id: params.id,
86
- type: params.$lockingType
87
- });
88
- } catch (ex) {
89
- this.triggerOnError(ex);
90
- return {
91
- data: null,
92
- error: ex
93
- };
94
- }
95
- }
96
- removeEntryLock(params) {
97
- const index = this.records.findIndex((record)=>record.entryId === params.id && record.$lockingType === params.$lockingType);
98
- if (-1 === index) return;
99
- this.records[index] = {
100
- ...this.records[index],
101
- $locked: null,
102
- $selectable: true
103
- };
104
- }
105
- async unlockEntry(params, force) {
106
- try {
107
- const result = await this._unlockEntry.execute({
108
- id: params.id,
109
- type: params.$lockingType,
110
- force
111
- });
112
- const id = result.data?.id;
113
- if (!id) return result;
114
- this.removeEntryLock({
115
- ...params
116
- });
117
- return result;
118
- } catch (ex) {
119
- this.triggerOnError(ex);
120
- return {
121
- data: null,
122
- error: ex
123
- };
124
- }
125
- }
126
- onError(cb) {
127
- this.onErrorCb = cb;
128
- }
129
- triggerOnError(error) {
130
- this.setIsLoading(false);
131
- if (!this.onErrorCb) return;
132
- this.onErrorCb(error);
133
- }
134
- isLockExpired(input) {
135
- const expiresOn = new Date(input);
136
- return expiresOn <= new Date();
137
- }
138
- setIsLoading(loading) {
139
- this._setLoading(loading);
140
- this.loading = loading;
141
- }
142
- async fetchAndAssignRecords(folderId, type, records) {
143
- if (0 === records.length) return;
144
- if (this.loading) return;
145
- const assignedIdList = await this.assignRecords(folderId, type, records);
146
- if (0 === assignedIdList.length) return;
147
- this.setIsLoading(true);
148
- let result;
149
- try {
150
- result = await this._listLockRecords.execute({
151
- where: {
152
- id_in: assignedIdList,
153
- type
154
- },
155
- limit: 10000
156
- });
157
- } catch (ex) {
158
- console.error(ex);
159
- this.triggerOnError(ex);
160
- return;
161
- } finally{
162
- this.setIsLoading(false);
163
- }
164
- if (result.error) return void this.triggerOnError(result.error);
165
- if (!result.data) return void this.triggerOnError(createRecordLockingError({
166
- message: "There is no data in the result and there is no error. Please check the network tab for more info.",
167
- code: "NO_DATA_IN_RESULT"
168
- }));
169
- if (0 === result.data.length) return;
170
- for (const record of result.data){
171
- const index = this.records.findIndex((r)=>{
172
- const { id: entryId } = parseIdentifier(record.id);
173
- return r.entryId === entryId;
174
- });
175
- if (index < 0) {
176
- console.error(`There is no record with id ${record.id} in the records array.`);
177
- continue;
178
- }
179
- this.records[index] = {
180
- ...this.records[index],
181
- $locked: {
182
- lockedBy: record.lockedBy,
183
- expiresOn: record.expiresOn,
184
- lockedOn: record.lockedOn,
185
- actions: record.actions
186
- }
187
- };
188
- }
189
- return this.records;
190
- }
191
- async assignRecords(folderId, type, records) {
192
- const keys = records.map((record)=>{
193
- if (record.entryId) return record.entryId;
194
- const { id: entryId } = parseIdentifier(record.id);
195
- return entryId;
196
- });
197
- const cacheKey = await createCacheKey(keys);
198
- if (this.currentRecordsCacheKey === cacheKey) return [];
199
- this.currentRecordsCacheKey = cacheKey;
200
- if (this.currentRecordType !== type || this.currentFolderId !== folderId) {
201
- this.records = [];
202
- this.currentRecordType = type;
203
- this.currentFolderId = folderId;
204
- }
205
- return records.reduce((collection, record)=>{
206
- const { id: entryId } = parseIdentifier(record.id);
207
- const index = this.records.findIndex((r)=>r.entryId === entryId);
208
- if (index >= 0) return collection;
209
- this.records.push({
210
- ...record,
211
- entryId,
212
- $lockingType: type,
213
- $locked: void 0
214
- });
215
- if ("RECORD" !== record.$type) return collection;
216
- collection.push(entryId);
217
- return collection;
218
- }, []);
219
- }
220
- }
221
- const createRecordLocking = (config)=>{
222
- const client = new RecordLockingClient({
223
- client: config.client
224
- });
225
- const getLockRecord = new RecordLockingGetLockRecord({
226
- client
227
- });
228
- const getLockedEntryLockRecord = new RecordLockingGetLockedEntryLockRecord({
229
- client
230
- });
231
- const isEntryLocked = new RecordLockingIsEntryLocked({
232
- client
233
- });
234
- const listLockRecords = new RecordLockingListLockRecords({
235
- client
236
- });
237
- const lockEntry = new RecordLockingLockEntry({
238
- client
239
- });
240
- const unlockEntry = new RecordLockingUnlockEntry({
241
- client
242
- });
243
- const updateEntryLock = new RecordLockingUpdateEntryLock({
244
- client
245
- });
246
- return new RecordLocking({
247
- setLoading: config.setLoading,
248
- getLockRecord,
249
- getLockedEntryLockRecord,
250
- isEntryLocked,
251
- listLockRecords,
252
- updateEntryLock,
253
- lockEntry,
254
- unlockEntry
255
- });
256
- };
257
- export { createRecordLocking };
258
-
259
- //# sourceMappingURL=RecordLocking.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"domain/RecordLocking.js","sources":["../../src/domain/RecordLocking.ts"],"sourcesContent":["import type {\n IRecordLocking,\n IRecordLockingUpdateEntryLockResult\n} from \"./abstractions/IRecordLocking.js\";\nimport type { ApolloClient } from \"apollo-client\";\nimport { RecordLockingGetLockRecord } from \"./RecordLockingGetLockRecord.js\";\nimport { RecordLockingIsEntryLocked } from \"./RecordLockingIsEntryLocked.js\";\nimport { RecordLockingListLockRecords } from \"./RecordLockingListLockRecords.js\";\nimport { RecordLockingLockEntry } from \"./RecordLockingLockEntry.js\";\nimport { RecordLockingUnlockEntry } from \"./RecordLockingUnlockEntry.js\";\nimport { RecordLockingClient } from \"./RecordLockingClient.js\";\nimport type { IRecordLockingGetLockRecord } from \"./abstractions/IRecordLockingGetLockRecord.js\";\nimport type { IRecordLockingIsEntryLocked } from \"./abstractions/IRecordLockingIsEntryLocked.js\";\nimport type {\n IRecordLockingListLockRecords,\n IRecordLockingListLockRecordsResult\n} from \"./abstractions/IRecordLockingListLockRecords.js\";\nimport type { IRecordLockingLockEntry } from \"./abstractions/IRecordLockingLockEntry.js\";\nimport type {\n IRecordLockingUnlockEntry,\n IRecordLockingUnlockEntryResult\n} from \"./abstractions/IRecordLockingUnlockEntry.js\";\nimport type {\n IFetchLockedEntryLockRecordParams,\n IFetchLockRecordParams,\n IFetchLockRecordResult,\n IIsRecordLockedParams,\n IPossiblyRecordLockingRecord,\n IRecordLockingError,\n IRecordLockingLockRecord,\n IRecordLockingRecord,\n IUnlockEntryParams,\n IUpdateEntryLockParams\n} from \"~/types.js\";\nimport { createRecordLockingError } from \"./utils/createRecordLockingError.js\";\nimport { parseIdentifier } from \"@webiny/utils/parseIdentifier.js\";\nimport { createCacheKey } from \"~/utils/createCacheKey.js\";\nimport { RecordLockingUpdateEntryLock } from \"~/domain/RecordLockingUpdateEntryLock.js\";\nimport type { IRecordLockingUpdateEntryLock } from \"~/domain/abstractions/IRecordLockingUpdateEntryLock.js\";\nimport { RecordLockingGetLockedEntryLockRecord } from \"~/domain/RecordLockingGetLockedEntryLockRecord.js\";\nimport type { IRecordLockingGetLockedEntryLockRecord } from \"./abstractions/IRecordLockingGetLockedEntryLockRecord.js\";\n\nexport interface ICreateRecordLockingParams {\n client: ApolloClient<any>;\n setLoading: (loading: boolean) => void;\n}\n\nexport interface IRecordLockingParams {\n setLoading: (loading: boolean) => void;\n getLockRecord: IRecordLockingGetLockRecord;\n getLockedEntryLockRecord: IRecordLockingGetLockedEntryLockRecord;\n isEntryLocked: IRecordLockingIsEntryLocked;\n listLockRecords: IRecordLockingListLockRecords;\n lockEntry: IRecordLockingLockEntry;\n unlockEntry: IRecordLockingUnlockEntry;\n updateEntryLock: IRecordLockingUpdateEntryLock;\n}\n\nexport interface IOnErrorCb {\n (error: IRecordLockingError): void;\n}\n\nclass RecordLocking<\n T extends IPossiblyRecordLockingRecord = IPossiblyRecordLockingRecord\n> implements IRecordLocking<T> {\n private currentRecordType?: string;\n private currentFolderId?: string;\n private currentRecordsCacheKey?: string;\n private readonly _setLoading: (loading: boolean) => void;\n public loading = false;\n public records: IRecordLockingRecord[] = [];\n private readonly _getLockRecord: IRecordLockingGetLockRecord;\n private readonly _getLockedEntryLockRecord: IRecordLockingGetLockedEntryLockRecord;\n private readonly _listLockRecords: IRecordLockingListLockRecords;\n private readonly _unlockEntry: IRecordLockingUnlockEntry;\n private readonly _updateEntryLock: IRecordLockingUpdateEntryLock;\n\n private onErrorCb: IOnErrorCb | null = null;\n\n public constructor(params: IRecordLockingParams) {\n this._setLoading = params.setLoading;\n this._getLockRecord = params.getLockRecord;\n this._getLockedEntryLockRecord = params.getLockedEntryLockRecord;\n this._listLockRecords = params.listLockRecords;\n this._unlockEntry = params.unlockEntry;\n this._updateEntryLock = params.updateEntryLock;\n }\n\n public async setRecords(\n folderId: string,\n type: string,\n records: T[]\n ): Promise<IRecordLockingRecord[] | undefined> {\n const result = await this.fetchAndAssignRecords(folderId, type, records);\n if (!result) {\n return undefined;\n }\n\n return result.map(record => {\n const { id: entryId } = parseIdentifier(record.id);\n return {\n ...record,\n $type: \"RECORD\",\n $lockingType: type,\n $locked: record.$locked,\n $selectable: record.$locked ? false : record.$selectable,\n entryId\n };\n });\n }\n\n public async fetchLockRecord(params: IFetchLockRecordParams): Promise<IFetchLockRecordResult> {\n const { id, $lockingType } = params;\n\n const { id: entryId } = parseIdentifier(id);\n\n try {\n const result = await this._getLockRecord.execute({\n id: entryId,\n type: $lockingType\n });\n\n return {\n data: result.data,\n error: result.error\n };\n } catch (ex) {\n return {\n data: null,\n error: ex\n };\n }\n }\n\n public async fetchLockedEntryLockRecord(\n params: IFetchLockedEntryLockRecordParams\n ): Promise<IRecordLockingLockRecord | null> {\n const { id, $lockingType } = params;\n\n const { id: entryId } = parseIdentifier(id);\n const result = await this._getLockedEntryLockRecord.execute({\n id: entryId,\n type: $lockingType\n });\n return result.data;\n }\n\n public getLockRecordEntry(id: string): IRecordLockingRecord | undefined {\n return this.records.find(record => {\n const { id: entryId } = parseIdentifier(id);\n return record.entryId === entryId;\n });\n }\n\n public isRecordLocked(record: IIsRecordLockedParams): boolean {\n const result = this.records.find(r => {\n const { id: entryId } = parseIdentifier(record.id);\n\n return r.entryId === entryId && !!r.$locked && r.$lockingType === record.$lockingType;\n });\n if (!result?.$locked?.expiresOn) {\n return false;\n }\n const isExpired = this.isLockExpired(result.$locked.expiresOn);\n return !isExpired;\n }\n\n public async updateEntryLock(\n params: IUpdateEntryLockParams\n ): Promise<IRecordLockingUpdateEntryLockResult> {\n try {\n return await this._updateEntryLock.execute({\n id: params.id,\n type: params.$lockingType\n });\n } catch (ex) {\n this.triggerOnError(ex);\n return {\n data: null,\n error: ex\n };\n }\n }\n\n public removeEntryLock(params: IUnlockEntryParams): void {\n const index = this.records.findIndex(record => {\n return record.entryId === params.id && record.$lockingType === params.$lockingType;\n });\n if (index === -1) {\n return;\n }\n this.records[index] = {\n ...this.records[index],\n $locked: null,\n $selectable: true\n };\n }\n\n public async unlockEntry(\n params: IUnlockEntryParams,\n force?: boolean\n ): Promise<IRecordLockingUnlockEntryResult> {\n try {\n const result = await this._unlockEntry.execute({\n id: params.id,\n type: params.$lockingType,\n force\n });\n\n const id = result.data?.id;\n if (!id) {\n return result;\n }\n this.removeEntryLock({\n ...params\n });\n return result;\n } catch (ex) {\n this.triggerOnError(ex);\n return {\n data: null,\n error: ex\n };\n }\n }\n\n public onError(cb: IOnErrorCb): void {\n this.onErrorCb = cb;\n }\n\n public triggerOnError(error: IRecordLockingError): void {\n this.setIsLoading(false);\n if (!this.onErrorCb) {\n return;\n }\n this.onErrorCb(error);\n }\n\n public isLockExpired(input: Date | string): boolean {\n const expiresOn = new Date(input);\n return expiresOn <= new Date();\n }\n\n private setIsLoading(loading: boolean): void {\n this._setLoading(loading);\n this.loading = loading;\n }\n\n private async fetchAndAssignRecords(\n folderId: string,\n type: string,\n records: T[]\n ): Promise<IPossiblyRecordLockingRecord[] | undefined> {\n if (records.length === 0) {\n return;\n } else if (this.loading) {\n return;\n }\n const assignedIdList = await this.assignRecords(folderId, type, records);\n if (assignedIdList.length === 0) {\n return;\n }\n this.setIsLoading(true);\n let result: IRecordLockingListLockRecordsResult;\n try {\n result = await this._listLockRecords.execute({\n where: {\n id_in: assignedIdList,\n type\n },\n limit: 10000\n });\n } catch (ex) {\n console.error(ex);\n this.triggerOnError(ex);\n return;\n } finally {\n this.setIsLoading(false);\n }\n if (result.error) {\n this.triggerOnError(result.error);\n return;\n } else if (!result.data) {\n this.triggerOnError(\n createRecordLockingError({\n message: `There is no data in the result and there is no error. Please check the network tab for more info.`,\n code: \"NO_DATA_IN_RESULT\"\n })\n );\n return;\n } else if (result.data.length === 0) {\n return;\n }\n\n for (const record of result.data) {\n const index = this.records.findIndex(r => {\n const { id: entryId } = parseIdentifier(record.id);\n return r.entryId === entryId;\n });\n if (index < 0) {\n console.error(`There is no record with id ${record.id} in the records array.`);\n continue;\n }\n this.records[index] = {\n ...this.records[index],\n $locked: {\n lockedBy: record.lockedBy,\n expiresOn: record.expiresOn,\n lockedOn: record.lockedOn,\n actions: record.actions\n }\n };\n }\n\n return this.records;\n }\n /**\n * Assign records and return the assigned ID list.\n */\n private async assignRecords(folderId: string, type: string, records: T[]): Promise<string[]> {\n /**\n * First we check the record keys against ones in the local cache.\n */\n const keys = records.map(record => {\n if (record.entryId) {\n return record.entryId;\n }\n const { id: entryId } = parseIdentifier(record.id);\n return entryId;\n });\n const cacheKey = await createCacheKey(keys);\n if (this.currentRecordsCacheKey === cacheKey) {\n return [];\n }\n this.currentRecordsCacheKey = cacheKey;\n\n /**\n * Reset records if new type is not as same as the old type / folderId.\n */\n if (this.currentRecordType !== type || this.currentFolderId !== folderId) {\n this.records = [];\n this.currentRecordType = type;\n this.currentFolderId = folderId;\n }\n\n return records.reduce<string[]>((collection, record) => {\n const { id: entryId } = parseIdentifier(record.id);\n const index = this.records.findIndex(r => r.entryId === entryId);\n if (index >= 0) {\n return collection;\n }\n this.records.push({\n ...record,\n entryId,\n $lockingType: type,\n $locked: undefined\n });\n if (record.$type !== \"RECORD\") {\n return collection;\n }\n collection.push(entryId);\n return collection;\n }, []);\n }\n}\n\nexport const createRecordLocking = <T extends IRecordLockingRecord>(\n config: ICreateRecordLockingParams\n): IRecordLocking => {\n const client = new RecordLockingClient({\n client: config.client\n });\n\n const getLockRecord = new RecordLockingGetLockRecord({\n client\n });\n\n const getLockedEntryLockRecord = new RecordLockingGetLockedEntryLockRecord({\n client\n });\n\n const isEntryLocked = new RecordLockingIsEntryLocked({\n client\n });\n\n const listLockRecords = new RecordLockingListLockRecords({\n client\n });\n\n const lockEntry = new RecordLockingLockEntry({\n client\n });\n\n const unlockEntry = new RecordLockingUnlockEntry({\n client\n });\n\n const updateEntryLock = new RecordLockingUpdateEntryLock({\n client\n });\n\n return new RecordLocking<T>({\n setLoading: config.setLoading,\n getLockRecord,\n getLockedEntryLockRecord,\n isEntryLocked,\n listLockRecords,\n updateEntryLock,\n lockEntry,\n unlockEntry\n });\n};\n"],"names":["RecordLocking","params","folderId","type","records","result","record","entryId","parseIdentifier","id","$lockingType","ex","r","isExpired","index","force","cb","error","input","expiresOn","Date","loading","assignedIdList","console","createRecordLockingError","keys","cacheKey","createCacheKey","collection","undefined","createRecordLocking","config","client","RecordLockingClient","getLockRecord","RecordLockingGetLockRecord","getLockedEntryLockRecord","RecordLockingGetLockedEntryLockRecord","isEntryLocked","RecordLockingIsEntryLocked","listLockRecords","RecordLockingListLockRecords","lockEntry","RecordLockingLockEntry","unlockEntry","RecordLockingUnlockEntry","updateEntryLock","RecordLockingUpdateEntryLock"],"mappings":";;;;;;;;;;;AA8DA,MAAMA;IAiBF,YAAmBC,MAA4B,CAAE;aAV1C,OAAO,GAAG;aACV,OAAO,GAA2B,EAAE;aAOnC,SAAS,GAAsB;QAGnC,IAAI,CAAC,WAAW,GAAGA,OAAO,UAAU;QACpC,IAAI,CAAC,cAAc,GAAGA,OAAO,aAAa;QAC1C,IAAI,CAAC,yBAAyB,GAAGA,OAAO,wBAAwB;QAChE,IAAI,CAAC,gBAAgB,GAAGA,OAAO,eAAe;QAC9C,IAAI,CAAC,YAA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,0 @@
1
- import type { ApolloClient, ApolloQueryResult, MutationOptions, QueryOptions } from "apollo-client";
2
- import type { FetchResult } from "apollo-link";
3
- import type { IRecordLockingClient } from "../domain/abstractions/IRecordLockingClient.js";
4
- export interface IRecordLockingClientParams {
5
- client: ApolloClient<any>;
6
- }
7
- export declare class RecordLockingClient implements IRecordLockingClient {
8
- private readonly client;
9
- constructor(params: IRecordLockingClientParams);
10
- query<T, R>(params: QueryOptions<R>): Promise<ApolloQueryResult<T>>;
11
- mutation<T, R>(options: MutationOptions<T, R>): Promise<FetchResult<T>>;
12
- }
@@ -1,20 +0,0 @@
1
- class RecordLockingClient {
2
- constructor(params){
3
- this.client = params.client;
4
- }
5
- async query(params) {
6
- return this.client.query({
7
- ...params,
8
- fetchPolicy: "network-only"
9
- });
10
- }
11
- async mutation(options) {
12
- return this.client.mutate({
13
- ...options,
14
- fetchPolicy: "no-cache"
15
- });
16
- }
17
- }
18
- export { RecordLockingClient };
19
-
20
- //# sourceMappingURL=RecordLockingClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"domain/RecordLockingClient.js","sources":["../../src/domain/RecordLockingClient.ts"],"sourcesContent":["import type { ApolloClient, ApolloQueryResult, MutationOptions, QueryOptions } from \"apollo-client\";\nimport type { FetchResult } from \"apollo-link\";\nimport type { IRecordLockingClient } from \"~/domain/abstractions/IRecordLockingClient.js\";\n\nexport interface IRecordLockingClientParams {\n client: ApolloClient<any>;\n}\n\nexport class RecordLockingClient implements IRecordLockingClient {\n private readonly client: ApolloClient<any>;\n\n public constructor(params: IRecordLockingClientParams) {\n this.client = params.client;\n }\n\n public async query<T, R>(params: QueryOptions<R>): Promise<ApolloQueryResult<T>> {\n return this.client.query<T, R>({\n ...params,\n fetchPolicy: \"network-only\"\n });\n }\n\n public async mutation<T, R>(options: MutationOptions<T, R>): Promise<FetchResult<T>> {\n return this.client.mutate<T, R>({\n ...options,\n fetchPolicy: \"no-cache\"\n });\n }\n}\n"],"names":["RecordLockingClient","params","options"],"mappings":"AAQO,MAAMA;IAGT,YAAmBC,MAAkC,CAAE;QACnD,IAAI,CAAC,MAAM,GAAGA,OAAO,MAAM;IAC/B;IAEA,MAAa,MAAYA,MAAuB,EAAiC;QAC7E,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAO;YAC3B,GAAGA,MAAM;YACT,aAAa;QACjB;IACJ;IAEA,MAAa,SAAeC,OAA8B,EAA2B;QACjF,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAO;YAC5B,GAAGA,OAAO;YACV,aAAa;QACjB;IACJ;AACJ"}
@@ -1,11 +0,0 @@
1
- import type { IRecordLockingGetLockRecord, IRecordLockingGetLockRecordExecuteParams, IRecordLockingGetLockRecordExecuteResult } from "../domain/abstractions/IRecordLockingGetLockRecord.js";
2
- import type { IRecordLockingClient } from "../domain/abstractions/IRecordLockingClient.js";
3
- interface Params {
4
- client: IRecordLockingClient;
5
- }
6
- export declare class RecordLockingGetLockRecord implements IRecordLockingGetLockRecord {
7
- private readonly client;
8
- constructor(params: Params);
9
- execute(params: IRecordLockingGetLockRecordExecuteParams): Promise<IRecordLockingGetLockRecordExecuteResult>;
10
- }
11
- export {};
@@ -1,19 +0,0 @@
1
- import { GET_LOCK_RECORD_QUERY } from "./graphql/getLockRecord.js";
2
- import { WebinyError } from "@webiny/error";
3
- class RecordLockingGetLockRecord {
4
- constructor(params){
5
- this.client = params.client;
6
- }
7
- async execute(params) {
8
- const result = await this.client.query({
9
- query: GET_LOCK_RECORD_QUERY,
10
- variables: params
11
- });
12
- if (result.data.recordLocking.getLockRecord.error) throw new WebinyError(result.data.recordLocking.getLockRecord.error);
13
- if (!result.data.recordLocking.getLockRecord.data) throw new WebinyError("No data returned from server.");
14
- return result.data.recordLocking.getLockRecord;
15
- }
16
- }
17
- export { RecordLockingGetLockRecord };
18
-
19
- //# sourceMappingURL=RecordLockingGetLockRecord.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"domain/RecordLockingGetLockRecord.js","sources":["../../src/domain/RecordLockingGetLockRecord.ts"],"sourcesContent":["import type {\n IRecordLockingGetLockRecord,\n IRecordLockingGetLockRecordExecuteParams,\n IRecordLockingGetLockRecordExecuteResult\n} from \"~/domain/abstractions/IRecordLockingGetLockRecord.js\";\nimport type { IRecordLockingClient } from \"~/domain/abstractions/IRecordLockingClient.js\";\nimport type {\n IRecordLockingGetLockRecordResponse,\n IRecordLockingGetLockRecordVariables\n} from \"~/domain/graphql/getLockRecord.js\";\nimport { GET_LOCK_RECORD_QUERY } from \"~/domain/graphql/getLockRecord.js\";\nimport { WebinyError } from \"@webiny/error\";\n\ninterface Params {\n client: IRecordLockingClient;\n}\n\nexport class RecordLockingGetLockRecord implements IRecordLockingGetLockRecord {\n private readonly client: IRecordLockingClient;\n\n public constructor(params: Params) {\n this.client = params.client;\n }\n public async execute(\n params: IRecordLockingGetLockRecordExecuteParams\n ): Promise<IRecordLockingGetLockRecordExecuteResult> {\n const result = await this.client.query<\n IRecordLockingGetLockRecordResponse,\n IRecordLockingGetLockRecordVariables\n >({\n query: GET_LOCK_RECORD_QUERY,\n variables: params\n });\n if (result.data.recordLocking.getLockRecord.error) {\n throw new WebinyError(result.data.recordLocking.getLockRecord.error);\n } else if (!result.data.recordLocking.getLockRecord.data) {\n throw new WebinyError(\"No data returned from server.\");\n }\n return result.data.recordLocking.getLockRecord;\n }\n}\n"],"names":["RecordLockingGetLockRecord","params","result","GET_LOCK_RECORD_QUERY","WebinyError"],"mappings":";;AAiBO,MAAMA;IAGT,YAAmBC,MAAc,CAAE;QAC/B,IAAI,CAAC,MAAM,GAAGA,OAAO,MAAM;IAC/B;IACA,MAAa,QACTA,MAAgD,EACC;QACjD,MAAMC,SAAS,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAGpC;YACE,OAAOC;YACP,WAAWF;QACf;QACA,IAAIC,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,KAAK,EAC7C,MAAM,IAAIE,YAAYF,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,KAAK;QAChE,IAAI,CAACA,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,EACpD,MAAM,IAAIE,YAAY;QAE1B,OAAOF,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa;IAClD;AACJ"}
@@ -1,11 +0,0 @@
1
- import type { IRecordLockingClient } from "../domain/abstractions/IRecordLockingClient.js";
2
- import type { IRecordLockingGetLockedEntryLockRecord, IRecordLockingGetLockedEntryLockRecordExecuteParams, IRecordLockingGetLockedEntryLockRecordExecuteResult } from "../domain/abstractions/IRecordLockingGetLockedEntryLockRecord.js";
3
- interface Params {
4
- client: IRecordLockingClient;
5
- }
6
- export declare class RecordLockingGetLockedEntryLockRecord implements IRecordLockingGetLockedEntryLockRecord {
7
- private readonly client;
8
- constructor(params: Params);
9
- execute(params: IRecordLockingGetLockedEntryLockRecordExecuteParams): Promise<IRecordLockingGetLockedEntryLockRecordExecuteResult>;
10
- }
11
- export {};
@@ -1,18 +0,0 @@
1
- import { GET_LOCKED_ENTRY_LOCK_RECORD_QUERY } from "./graphql/getLockedEntryLockRecord.js";
2
- import { WebinyError } from "@webiny/error";
3
- class RecordLockingGetLockedEntryLockRecord {
4
- constructor(params){
5
- this.client = params.client;
6
- }
7
- async execute(params) {
8
- const result = await this.client.query({
9
- query: GET_LOCKED_ENTRY_LOCK_RECORD_QUERY,
10
- variables: params
11
- });
12
- if (result.data.recordLocking.getLockedEntryLockRecord.error) throw new WebinyError(result.data.recordLocking.getLockedEntryLockRecord.error);
13
- return result.data.recordLocking.getLockedEntryLockRecord;
14
- }
15
- }
16
- export { RecordLockingGetLockedEntryLockRecord };
17
-
18
- //# sourceMappingURL=RecordLockingGetLockedEntryLockRecord.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"domain/RecordLockingGetLockedEntryLockRecord.js","sources":["../../src/domain/RecordLockingGetLockedEntryLockRecord.ts"],"sourcesContent":["import type { IRecordLockingClient } from \"~/domain/abstractions/IRecordLockingClient.js\";\nimport type {\n IRecordLockingGetLockedEntryLockRecordResponse,\n IRecordLockingGetLockedEntryLockRecordVariables\n} from \"~/domain/graphql/getLockedEntryLockRecord.js\";\nimport { GET_LOCKED_ENTRY_LOCK_RECORD_QUERY } from \"~/domain/graphql/getLockedEntryLockRecord.js\";\nimport { WebinyError } from \"@webiny/error\";\nimport type {\n IRecordLockingGetLockedEntryLockRecord,\n IRecordLockingGetLockedEntryLockRecordExecuteParams,\n IRecordLockingGetLockedEntryLockRecordExecuteResult\n} from \"~/domain/abstractions/IRecordLockingGetLockedEntryLockRecord.js\";\n\ninterface Params {\n client: IRecordLockingClient;\n}\n\nexport class RecordLockingGetLockedEntryLockRecord implements IRecordLockingGetLockedEntryLockRecord {\n private readonly client: IRecordLockingClient;\n\n public constructor(params: Params) {\n this.client = params.client;\n }\n public async execute(\n params: IRecordLockingGetLockedEntryLockRecordExecuteParams\n ): Promise<IRecordLockingGetLockedEntryLockRecordExecuteResult> {\n const result = await this.client.query<\n IRecordLockingGetLockedEntryLockRecordResponse,\n IRecordLockingGetLockedEntryLockRecordVariables\n >({\n query: GET_LOCKED_ENTRY_LOCK_RECORD_QUERY,\n variables: params\n });\n if (result.data.recordLocking.getLockedEntryLockRecord.error) {\n throw new WebinyError(result.data.recordLocking.getLockedEntryLockRecord.error);\n }\n return result.data.recordLocking.getLockedEntryLockRecord;\n }\n}\n"],"names":["RecordLockingGetLockedEntryLockRecord","params","result","GET_LOCKED_ENTRY_LOCK_RECORD_QUERY","WebinyError"],"mappings":";;AAiBO,MAAMA;IAGT,YAAmBC,MAAc,CAAE;QAC/B,IAAI,CAAC,MAAM,GAAGA,OAAO,MAAM;IAC/B;IACA,MAAa,QACTA,MAA2D,EACC;QAC5D,MAAMC,SAAS,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAGpC;YACE,OAAOC;YACP,WAAWF;QACf;QACA,IAAIC,OAAO,IAAI,CAAC,aAAa,CAAC,wBAAwB,CAAC,KAAK,EACxD,MAAM,IAAIE,YAAYF,OAAO,IAAI,CAAC,aAAa,CAAC,wBAAwB,CAAC,KAAK;QAElF,OAAOA,OAAO,IAAI,CAAC,aAAa,CAAC,wBAAwB;IAC7D;AACJ"}
@@ -1,11 +0,0 @@
1
- import type { IRecordLockingIsEntryLocked, IRecordLockingIsEntryLockedParams, IRecordLockingIsEntryLockedResult } from "../domain/abstractions/IRecordLockingIsEntryLocked.js";
2
- import type { IRecordLockingClient } from "./abstractions/IRecordLockingClient.js";
3
- interface Params {
4
- client: IRecordLockingClient;
5
- }
6
- export declare class RecordLockingIsEntryLocked implements IRecordLockingIsEntryLocked {
7
- private readonly client;
8
- constructor(params: Params);
9
- execute(params: IRecordLockingIsEntryLockedParams): Promise<IRecordLockingIsEntryLockedResult>;
10
- }
11
- export {};
@@ -1,20 +0,0 @@
1
- import { IS_ENTRY_LOCKED_QUERY } from "./graphql/isEntryLocked.js";
2
- class RecordLockingIsEntryLocked {
3
- constructor(params){
4
- this.client = params.client;
5
- }
6
- async execute(params) {
7
- try {
8
- const result = await this.client.query({
9
- query: IS_ENTRY_LOCKED_QUERY,
10
- variables: params
11
- });
12
- return !!result.data.recordLocking.isEntryLocked.data;
13
- } catch {
14
- return false;
15
- }
16
- }
17
- }
18
- export { RecordLockingIsEntryLocked };
19
-
20
- //# sourceMappingURL=RecordLockingIsEntryLocked.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"domain/RecordLockingIsEntryLocked.js","sources":["../../src/domain/RecordLockingIsEntryLocked.ts"],"sourcesContent":["import type {\n IRecordLockingIsEntryLocked,\n IRecordLockingIsEntryLockedParams,\n IRecordLockingIsEntryLockedResult\n} from \"~/domain/abstractions/IRecordLockingIsEntryLocked.js\";\nimport type { IRecordLockingClient } from \"./abstractions/IRecordLockingClient.js\";\nimport type {\n IRecordLockingIsEntryLockedResponse,\n IRecordLockingIsEntryLockedVariables\n} from \"~/domain/graphql/isEntryLocked.js\";\nimport { IS_ENTRY_LOCKED_QUERY } from \"~/domain/graphql/isEntryLocked.js\";\n\ninterface Params {\n client: IRecordLockingClient;\n}\n\nexport class RecordLockingIsEntryLocked implements IRecordLockingIsEntryLocked {\n private readonly client: IRecordLockingClient;\n\n public constructor(params: Params) {\n this.client = params.client;\n }\n public async execute(\n params: IRecordLockingIsEntryLockedParams\n ): Promise<IRecordLockingIsEntryLockedResult> {\n try {\n const result = await this.client.query<\n IRecordLockingIsEntryLockedResponse,\n IRecordLockingIsEntryLockedVariables\n >({\n query: IS_ENTRY_LOCKED_QUERY,\n variables: params\n });\n return !!result.data.recordLocking.isEntryLocked.data;\n } catch {\n return false;\n }\n }\n}\n"],"names":["RecordLockingIsEntryLocked","params","result","IS_ENTRY_LOCKED_QUERY"],"mappings":";AAgBO,MAAMA;IAGT,YAAmBC,MAAc,CAAE;QAC/B,IAAI,CAAC,MAAM,GAAGA,OAAO,MAAM;IAC/B;IACA,MAAa,QACTA,MAAyC,EACC;QAC1C,IAAI;YACA,MAAMC,SAAS,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAGpC;gBACE,OAAOC;gBACP,WAAWF;YACf;YACA,OAAO,CAAC,CAACC,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI;QACzD,EAAE,OAAM;YACJ,OAAO;QACX;IACJ;AACJ"}
@@ -1,12 +0,0 @@
1
- import type { ApolloClient } from "apollo-client";
2
- import type { IRecordLockingListLockRecords, IRecordLockingListLockRecordsParams, IRecordLockingListLockRecordsResult } from "./abstractions/IRecordLockingListLockRecords.js";
3
- import type { IRecordLockingClient } from "./abstractions/IRecordLockingClient.js";
4
- interface Params {
5
- client: IRecordLockingClient | ApolloClient<any>;
6
- }
7
- export declare class RecordLockingListLockRecords implements IRecordLockingListLockRecords {
8
- private readonly client;
9
- constructor(params: Params);
10
- execute(params: IRecordLockingListLockRecordsParams): Promise<IRecordLockingListLockRecordsResult>;
11
- }
12
- export {};
@@ -1,25 +0,0 @@
1
- import { WebinyError } from "@webiny/error";
2
- import { createRecordLockingClient } from "./utils/createRecordLockingClient.js";
3
- import { LIST_LOCK_RECORDS } from "./graphql/listLockRecords.js";
4
- class RecordLockingListLockRecords {
5
- constructor(params){
6
- this.client = createRecordLockingClient(params.client);
7
- }
8
- async execute(params) {
9
- const { where, sort, limit, after } = params;
10
- const result = await this.client.query({
11
- query: LIST_LOCK_RECORDS,
12
- variables: {
13
- where,
14
- sort,
15
- limit,
16
- after
17
- }
18
- });
19
- if (!result.data?.recordLocking?.listLockRecords) throw new WebinyError("No data returned from server.");
20
- return result.data.recordLocking.listLockRecords;
21
- }
22
- }
23
- export { RecordLockingListLockRecords };
24
-
25
- //# sourceMappingURL=RecordLockingListLockRecords.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"domain/RecordLockingListLockRecords.js","sources":["../../src/domain/RecordLockingListLockRecords.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport type { ApolloClient } from \"apollo-client\";\nimport type {\n IRecordLockingListLockRecords,\n IRecordLockingListLockRecordsParams,\n IRecordLockingListLockRecordsResult\n} from \"./abstractions/IRecordLockingListLockRecords.js\";\nimport type { IRecordLockingClient } from \"./abstractions/IRecordLockingClient.js\";\nimport { createRecordLockingClient } from \"./utils/createRecordLockingClient.js\";\nimport type {\n IRecordLockingListLockedRecordsResponse,\n IRecordLockingListLockedRecordsVariables\n} from \"~/domain/graphql/listLockRecords.js\";\nimport { LIST_LOCK_RECORDS } from \"~/domain/graphql/listLockRecords.js\";\n\ninterface Params {\n client: IRecordLockingClient | ApolloClient<any>;\n}\n\nexport class RecordLockingListLockRecords implements IRecordLockingListLockRecords {\n private readonly client: IRecordLockingClient;\n\n public constructor(params: Params) {\n this.client = createRecordLockingClient(params.client);\n }\n public async execute(\n params: IRecordLockingListLockRecordsParams\n ): Promise<IRecordLockingListLockRecordsResult> {\n const { where, sort, limit, after } = params;\n\n const result = await this.client.query<\n IRecordLockingListLockedRecordsResponse,\n IRecordLockingListLockedRecordsVariables\n >({\n query: LIST_LOCK_RECORDS,\n variables: {\n where,\n sort,\n limit,\n after\n }\n });\n if (!result.data?.recordLocking?.listLockRecords) {\n throw new WebinyError(\"No data returned from server.\");\n }\n return result.data.recordLocking.listLockRecords;\n }\n}\n"],"names":["RecordLockingListLockRecords","params","createRecordLockingClient","where","sort","limit","after","result","LIST_LOCK_RECORDS","WebinyError"],"mappings":";;;AAmBO,MAAMA;IAGT,YAAmBC,MAAc,CAAE;QAC/B,IAAI,CAAC,MAAM,GAAGC,0BAA0BD,OAAO,MAAM;IACzD;IACA,MAAa,QACTA,MAA2C,EACC;QAC5C,MAAM,EAAEE,KAAK,EAAEC,IAAI,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGL;QAEtC,MAAMM,SAAS,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAGpC;YACE,OAAOC;YACP,WAAW;gBACPL;gBACAC;gBACAC;gBACAC;YACJ;QACJ;QACA,IAAI,CAACC,OAAO,IAAI,EAAE,eAAe,iBAC7B,MAAM,IAAIE,YAAY;QAE1B,OAAOF,OAAO,IAAI,CAAC,aAAa,CAAC,eAAe;IACpD;AACJ"}
@@ -1,11 +0,0 @@
1
- import type { IRecordLockingLockEntry, IRecordLockingLockEntryParams, IRecordLockingLockEntryResult } from "../domain/abstractions/IRecordLockingLockEntry.js";
2
- import type { IRecordLockingClient } from "./abstractions/IRecordLockingClient.js";
3
- interface Params {
4
- client: IRecordLockingClient;
5
- }
6
- export declare class RecordLockingLockEntry implements IRecordLockingLockEntry {
7
- private readonly client;
8
- constructor(params: Params);
9
- execute(params: IRecordLockingLockEntryParams): Promise<IRecordLockingLockEntryResult>;
10
- }
11
- export {};
@@ -1,12 +0,0 @@
1
- import { WebinyError } from "@webiny/error";
2
- class RecordLockingLockEntry {
3
- constructor(params){
4
- this.client = params.client;
5
- }
6
- async execute(params) {
7
- throw new WebinyError("Method not implemented.");
8
- }
9
- }
10
- export { RecordLockingLockEntry };
11
-
12
- //# sourceMappingURL=RecordLockingLockEntry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"domain/RecordLockingLockEntry.js","sources":["../../src/domain/RecordLockingLockEntry.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport type {\n IRecordLockingLockEntry,\n IRecordLockingLockEntryParams,\n IRecordLockingLockEntryResult\n} from \"~/domain/abstractions/IRecordLockingLockEntry.js\";\nimport type { IRecordLockingClient } from \"./abstractions/IRecordLockingClient.js\";\n\ninterface Params {\n client: IRecordLockingClient;\n}\n\nexport class RecordLockingLockEntry implements IRecordLockingLockEntry {\n private readonly client: IRecordLockingClient;\n\n public constructor(params: Params) {\n this.client = params.client;\n }\n public async execute(\n // oxlint-disable-next-line\n params: IRecordLockingLockEntryParams\n ): Promise<IRecordLockingLockEntryResult> {\n throw new WebinyError(\"Method not implemented.\");\n }\n}\n"],"names":["RecordLockingLockEntry","params","WebinyError"],"mappings":";AAYO,MAAMA;IAGT,YAAmBC,MAAc,CAAE;QAC/B,IAAI,CAAC,MAAM,GAAGA,OAAO,MAAM;IAC/B;IACA,MAAa,QAETA,MAAqC,EACC;QACtC,MAAM,IAAIC,YAAY;IAC1B;AACJ"}
@@ -1,11 +0,0 @@
1
- import type { IRecordLockingUnlockEntry, IRecordLockingUnlockEntryParams, IRecordLockingUnlockEntryResult } from "../domain/abstractions/IRecordLockingUnlockEntry.js";
2
- import type { IRecordLockingClient } from "./abstractions/IRecordLockingClient.js";
3
- interface Params {
4
- client: IRecordLockingClient;
5
- }
6
- export declare class RecordLockingUnlockEntry implements IRecordLockingUnlockEntry {
7
- private readonly client;
8
- constructor(params: Params);
9
- execute(params: IRecordLockingUnlockEntryParams): Promise<IRecordLockingUnlockEntryResult>;
10
- }
11
- export {};