@webiny/app-record-locking 0.0.0-unstable.e6f0dc8ca7 → 0.0.0-unstable.eb81deee7e

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 (266) hide show
  1. package/RecordLockingModule.d.ts +2 -0
  2. package/RecordLockingModule.js +74 -0
  3. package/RecordLockingModule.js.map +1 -0
  4. package/SecurityPermissions.js +15 -0
  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} +4 -3
  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 +3 -2
  61. package/features/permissions/abstractions.js.map +1 -1
  62. package/features/permissions/feature.js +3 -2
  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 +20 -27
  78. package/index.js.map +1 -1
  79. package/package.json +18 -20
  80. package/permissions/permissionsSchema.js +10 -0
  81. package/permissions/permissionsSchema.js.map +1 -0
  82. package/presentation/entryLocking/ContentEntryFormPresenterDecorator.d.ts +23 -0
  83. package/presentation/entryLocking/ContentEntryFormPresenterDecorator.js +64 -0
  84. package/presentation/entryLocking/ContentEntryFormPresenterDecorator.js.map +1 -0
  85. package/presentation/entryLocking/RecordLockingPresenter.d.ts +32 -0
  86. package/presentation/entryLocking/RecordLockingPresenter.js +164 -0
  87. package/presentation/entryLocking/RecordLockingPresenter.js.map +1 -0
  88. package/presentation/entryLocking/SingleEntryContentDecorator.d.ts +2 -0
  89. package/presentation/entryLocking/SingleEntryContentDecorator.js +72 -0
  90. package/presentation/entryLocking/SingleEntryContentDecorator.js.map +1 -0
  91. package/presentation/entryLocking/SingleEntryPresenterDecorator.d.ts +15 -0
  92. package/presentation/entryLocking/SingleEntryPresenterDecorator.js +40 -0
  93. package/presentation/entryLocking/SingleEntryPresenterDecorator.js.map +1 -0
  94. package/presentation/entryLocking/abstractions.d.ts +26 -0
  95. package/presentation/entryLocking/abstractions.js +5 -0
  96. package/presentation/entryLocking/abstractions.js.map +1 -0
  97. package/presentation/entryLocking/components/ForceUnlockButton.d.ts +11 -0
  98. package/presentation/entryLocking/components/ForceUnlockButton.js +37 -0
  99. package/presentation/entryLocking/components/ForceUnlockButton.js.map +1 -0
  100. package/presentation/entryLocking/components/LockedEntryOverlay.d.ts +10 -0
  101. package/presentation/entryLocking/components/LockedEntryOverlay.js +52 -0
  102. package/presentation/entryLocking/components/LockedEntryOverlay.js.map +1 -0
  103. package/presentation/entryLocking/components/RecordLockingGuard.d.ts +12 -0
  104. package/presentation/entryLocking/components/RecordLockingGuard.js +74 -0
  105. package/presentation/entryLocking/components/RecordLockingGuard.js.map +1 -0
  106. package/presentation/entryLocking/feature.d.ts +3 -0
  107. package/presentation/entryLocking/feature.js +21 -0
  108. package/presentation/entryLocking/feature.js.map +1 -0
  109. package/presentation/listLocking/ContentEntriesPresenterDecorator.d.ts +25 -0
  110. package/presentation/listLocking/ContentEntriesPresenterDecorator.js +70 -0
  111. package/presentation/listLocking/ContentEntriesPresenterDecorator.js.map +1 -0
  112. package/presentation/listLocking/ListLockRecordsPresenter.d.ts +17 -0
  113. package/presentation/listLocking/ListLockRecordsPresenter.js +52 -0
  114. package/presentation/listLocking/ListLockRecordsPresenter.js.map +1 -0
  115. package/presentation/listLocking/abstractions.d.ts +16 -0
  116. package/presentation/listLocking/abstractions.js +5 -0
  117. package/presentation/listLocking/abstractions.js.map +1 -0
  118. package/presentation/listLocking/components/ListLockRecordsSync.d.ts +4 -0
  119. package/presentation/listLocking/components/ListLockRecordsSync.js +26 -0
  120. package/presentation/listLocking/components/ListLockRecordsSync.js.map +1 -0
  121. package/presentation/listLocking/components/LockIndicatorCell.d.ts +2 -0
  122. package/presentation/listLocking/components/LockIndicatorCell.js +39 -0
  123. package/presentation/listLocking/components/LockIndicatorCell.js.map +1 -0
  124. package/presentation/listLocking/feature.d.ts +3 -0
  125. package/presentation/listLocking/feature.js +19 -0
  126. package/presentation/listLocking/feature.js.map +1 -0
  127. package/types.d.ts +1 -62
  128. package/types.js +0 -3
  129. package/components/HeadlessCmsActionsAcoCell.d.ts +0 -2
  130. package/components/HeadlessCmsActionsAcoCell.js +0 -60
  131. package/components/HeadlessCmsActionsAcoCell.js.map +0 -1
  132. package/components/HeadlessCmsContentEntry/ContentEntryGuard.d.ts +0 -9
  133. package/components/HeadlessCmsContentEntry/ContentEntryGuard.js +0 -42
  134. package/components/HeadlessCmsContentEntry/ContentEntryGuard.js.map +0 -1
  135. package/components/HeadlessCmsContentEntry/ContentEntryLocker.d.ts +0 -18
  136. package/components/HeadlessCmsContentEntry/ContentEntryLocker.js +0 -99
  137. package/components/HeadlessCmsContentEntry/ContentEntryLocker.js.map +0 -1
  138. package/components/HeadlessCmsContentEntry/HeadlessCmsContentEntry.d.ts +0 -2
  139. package/components/HeadlessCmsContentEntry/HeadlessCmsContentEntry.js +0 -68
  140. package/components/HeadlessCmsContentEntry/HeadlessCmsContentEntry.js.map +0 -1
  141. package/components/HeadlessCmsContentEntry/index.d.ts +0 -1
  142. package/components/HeadlessCmsContentEntry/index.js +0 -3
  143. package/components/HeadlessCmsContentEntry/index.js.map +0 -1
  144. package/components/LockedRecord/LockedRecord.d.ts +0 -6
  145. package/components/LockedRecord/LockedRecord.js +0 -66
  146. package/components/LockedRecord/LockedRecord.js.map +0 -1
  147. package/components/LockedRecord/LockedRecordForceUnlock.d.ts +0 -9
  148. package/components/LockedRecord/LockedRecordForceUnlock.js +0 -71
  149. package/components/LockedRecord/LockedRecordForceUnlock.js.map +0 -1
  150. package/components/LockedRecord/index.d.ts +0 -1
  151. package/components/LockedRecord/index.js +0 -3
  152. package/components/LockedRecord/index.js.map +0 -1
  153. package/components/RecordLockingProvider.d.ts +0 -7
  154. package/components/RecordLockingProvider.js +0 -125
  155. package/components/RecordLockingProvider.js.map +0 -1
  156. package/components/SecurityPermissions.js +0 -18
  157. package/components/SecurityPermissions.js.map +0 -1
  158. package/components/decorators/UseContentEntriesListHookDecorator.d.ts +0 -1
  159. package/components/decorators/UseContentEntriesListHookDecorator.js +0 -23
  160. package/components/decorators/UseContentEntriesListHookDecorator.js.map +0 -1
  161. package/components/decorators/UseRecordsDecorator.d.ts +0 -8
  162. package/components/decorators/UseRecordsDecorator.js +0 -25
  163. package/components/decorators/UseRecordsDecorator.js.map +0 -1
  164. package/components/decorators/UseSaveEntryDecorator.d.ts +0 -1
  165. package/components/decorators/UseSaveEntryDecorator.js +0 -55
  166. package/components/decorators/UseSaveEntryDecorator.js.map +0 -1
  167. package/domain/RecordLocking.d.ts +0 -28
  168. package/domain/RecordLocking.js +0 -321
  169. package/domain/RecordLocking.js.map +0 -1
  170. package/domain/RecordLockingClient.d.ts +0 -12
  171. package/domain/RecordLockingClient.js +0 -19
  172. package/domain/RecordLockingClient.js.map +0 -1
  173. package/domain/RecordLockingGetLockRecord.d.ts +0 -11
  174. package/domain/RecordLockingGetLockRecord.js +0 -21
  175. package/domain/RecordLockingGetLockRecord.js.map +0 -1
  176. package/domain/RecordLockingGetLockedEntryLockRecord.d.ts +0 -11
  177. package/domain/RecordLockingGetLockedEntryLockRecord.js +0 -19
  178. package/domain/RecordLockingGetLockedEntryLockRecord.js.map +0 -1
  179. package/domain/RecordLockingIsEntryLocked.d.ts +0 -11
  180. package/domain/RecordLockingIsEntryLocked.js +0 -19
  181. package/domain/RecordLockingIsEntryLocked.js.map +0 -1
  182. package/domain/RecordLockingListLockRecords.d.ts +0 -12
  183. package/domain/RecordLockingListLockRecords.js +0 -31
  184. package/domain/RecordLockingListLockRecords.js.map +0 -1
  185. package/domain/RecordLockingLockEntry.d.ts +0 -11
  186. package/domain/RecordLockingLockEntry.js +0 -13
  187. package/domain/RecordLockingLockEntry.js.map +0 -1
  188. package/domain/RecordLockingUnlockEntry.d.ts +0 -11
  189. package/domain/RecordLockingUnlockEntry.js +0 -19
  190. package/domain/RecordLockingUnlockEntry.js.map +0 -1
  191. package/domain/RecordLockingUpdateEntryLock.d.ts +0 -11
  192. package/domain/RecordLockingUpdateEntryLock.js +0 -19
  193. package/domain/RecordLockingUpdateEntryLock.js.map +0 -1
  194. package/domain/abstractions/IRecordLocking.d.ts +0 -25
  195. package/domain/abstractions/IRecordLocking.js +0 -3
  196. package/domain/abstractions/IRecordLocking.js.map +0 -1
  197. package/domain/abstractions/IRecordLockingClient.d.ts +0 -6
  198. package/domain/abstractions/IRecordLockingClient.js +0 -3
  199. package/domain/abstractions/IRecordLockingClient.js.map +0 -1
  200. package/domain/abstractions/IRecordLockingGetLockRecord.d.ts +0 -12
  201. package/domain/abstractions/IRecordLockingGetLockRecord.js +0 -3
  202. package/domain/abstractions/IRecordLockingGetLockRecord.js.map +0 -1
  203. package/domain/abstractions/IRecordLockingGetLockedEntryLockRecord.d.ts +0 -12
  204. package/domain/abstractions/IRecordLockingGetLockedEntryLockRecord.js +0 -3
  205. package/domain/abstractions/IRecordLockingGetLockedEntryLockRecord.js.map +0 -1
  206. package/domain/abstractions/IRecordLockingIsEntryLocked.d.ts +0 -8
  207. package/domain/abstractions/IRecordLockingIsEntryLocked.js +0 -3
  208. package/domain/abstractions/IRecordLockingIsEntryLocked.js.map +0 -1
  209. package/domain/abstractions/IRecordLockingListLockRecords.d.ts +0 -19
  210. package/domain/abstractions/IRecordLockingListLockRecords.js +0 -3
  211. package/domain/abstractions/IRecordLockingListLockRecords.js.map +0 -1
  212. package/domain/abstractions/IRecordLockingLockEntry.d.ts +0 -12
  213. package/domain/abstractions/IRecordLockingLockEntry.js +0 -3
  214. package/domain/abstractions/IRecordLockingLockEntry.js.map +0 -1
  215. package/domain/abstractions/IRecordLockingUnlockEntry.d.ts +0 -13
  216. package/domain/abstractions/IRecordLockingUnlockEntry.js +0 -3
  217. package/domain/abstractions/IRecordLockingUnlockEntry.js.map +0 -1
  218. package/domain/abstractions/IRecordLockingUpdateEntryLock.d.ts +0 -12
  219. package/domain/abstractions/IRecordLockingUpdateEntryLock.js +0 -3
  220. package/domain/abstractions/IRecordLockingUpdateEntryLock.js.map +0 -1
  221. package/domain/graphql/fields.js.map +0 -1
  222. package/domain/graphql/getLockRecord.d.ts +0 -12
  223. package/domain/graphql/getLockRecord.js +0 -18
  224. package/domain/graphql/getLockRecord.js.map +0 -1
  225. package/domain/graphql/getLockedEntryLockRecord.d.ts +0 -12
  226. package/domain/graphql/getLockedEntryLockRecord.js +0 -18
  227. package/domain/graphql/getLockedEntryLockRecord.js.map +0 -1
  228. package/domain/graphql/isEntryLocked.d.ts +0 -12
  229. package/domain/graphql/isEntryLocked.js +0 -16
  230. package/domain/graphql/isEntryLocked.js.map +0 -1
  231. package/domain/graphql/listLockRecords.d.ts +0 -17
  232. package/domain/graphql/listLockRecords.js +0 -26
  233. package/domain/graphql/listLockRecords.js.map +0 -1
  234. package/domain/graphql/lockEntry.d.ts +0 -12
  235. package/domain/graphql/lockEntry.js +0 -20
  236. package/domain/graphql/lockEntry.js.map +0 -1
  237. package/domain/graphql/unlockEntry.d.ts +0 -12
  238. package/domain/graphql/unlockEntry.js +0 -18
  239. package/domain/graphql/unlockEntry.js.map +0 -1
  240. package/domain/graphql/updateEntryLock.d.ts +0 -12
  241. package/domain/graphql/updateEntryLock.js +0 -18
  242. package/domain/graphql/updateEntryLock.js.map +0 -1
  243. package/domain/permissionsSchema.js +0 -9
  244. package/domain/permissionsSchema.js.map +0 -1
  245. package/domain/utils/createRecordLockingClient.d.ts +0 -3
  246. package/domain/utils/createRecordLockingClient.js +0 -12
  247. package/domain/utils/createRecordLockingClient.js.map +0 -1
  248. package/domain/utils/createRecordLockingError.d.ts +0 -6
  249. package/domain/utils/createRecordLockingError.js +0 -16
  250. package/domain/utils/createRecordLockingError.js.map +0 -1
  251. package/hooks/index.d.ts +0 -2
  252. package/hooks/index.js +0 -4
  253. package/hooks/index.js.map +0 -1
  254. package/hooks/usePermission.d.ts +0 -3
  255. package/hooks/usePermission.js +0 -20
  256. package/hooks/usePermission.js.map +0 -1
  257. package/hooks/useRecordLocking.d.ts +0 -2
  258. package/hooks/useRecordLocking.js +0 -12
  259. package/hooks/useRecordLocking.js.map +0 -1
  260. package/types.js.map +0 -1
  261. package/utils/createCacheKey.d.ts +0 -3
  262. package/utils/createCacheKey.js +0 -15
  263. package/utils/createCacheKey.js.map +0 -1
  264. /package/{components/SecurityPermissions.d.ts → SecurityPermissions.d.ts} +0 -0
  265. /package/{domain/graphql/fields.d.ts → features/graphqlFields.d.ts} +0 -0
  266. /package/{domain → permissions}/permissionsSchema.d.ts +0 -0
@@ -1,321 +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
- loading = false;
14
- records = [];
15
- onErrorCb = null;
16
- constructor(params) {
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) {
27
- return undefined;
28
- }
29
- return result.map(record => {
30
- const {
31
- id: entryId
32
- } = parseIdentifier(record.id);
33
- return {
34
- ...record,
35
- $type: "RECORD",
36
- $lockingType: type,
37
- $locked: record.$locked,
38
- $selectable: record.$locked ? false : record.$selectable,
39
- entryId
40
- };
41
- });
42
- }
43
- async fetchLockRecord(params) {
44
- const {
45
- id,
46
- $lockingType
47
- } = params;
48
- const {
49
- id: entryId
50
- } = parseIdentifier(id);
51
- try {
52
- const result = await this._getLockRecord.execute({
53
- id: entryId,
54
- type: $lockingType
55
- });
56
- return {
57
- data: result.data,
58
- error: result.error
59
- };
60
- } catch (ex) {
61
- return {
62
- data: null,
63
- error: ex
64
- };
65
- }
66
- }
67
- async fetchLockedEntryLockRecord(params) {
68
- const {
69
- id,
70
- $lockingType
71
- } = params;
72
- const {
73
- id: entryId
74
- } = parseIdentifier(id);
75
- const result = await this._getLockedEntryLockRecord.execute({
76
- id: entryId,
77
- type: $lockingType
78
- });
79
- return result.data;
80
- }
81
- getLockRecordEntry(id) {
82
- return this.records.find(record => {
83
- const {
84
- id: entryId
85
- } = parseIdentifier(id);
86
- return record.entryId === entryId;
87
- });
88
- }
89
- isRecordLocked(record) {
90
- const result = this.records.find(r => {
91
- const {
92
- id: entryId
93
- } = parseIdentifier(record.id);
94
- return r.entryId === entryId && !!r.$locked && r.$lockingType === record.$lockingType;
95
- });
96
- if (!result?.$locked?.expiresOn) {
97
- return false;
98
- }
99
- const isExpired = this.isLockExpired(result.$locked.expiresOn);
100
- return !isExpired;
101
- }
102
- async updateEntryLock(params) {
103
- try {
104
- return await this._updateEntryLock.execute({
105
- id: params.id,
106
- type: params.$lockingType
107
- });
108
- } catch (ex) {
109
- this.triggerOnError(ex);
110
- return {
111
- data: null,
112
- error: ex
113
- };
114
- }
115
- }
116
- removeEntryLock(params) {
117
- const index = this.records.findIndex(record => {
118
- return record.entryId === params.id && record.$lockingType === params.$lockingType;
119
- });
120
- if (index === -1) {
121
- return;
122
- }
123
- this.records[index] = {
124
- ...this.records[index],
125
- $locked: null,
126
- $selectable: true
127
- };
128
- }
129
- async unlockEntry(params, force) {
130
- try {
131
- const result = await this._unlockEntry.execute({
132
- id: params.id,
133
- type: params.$lockingType,
134
- force
135
- });
136
- const id = result.data?.id;
137
- if (!id) {
138
- return result;
139
- }
140
- this.removeEntryLock({
141
- ...params
142
- });
143
- return result;
144
- } catch (ex) {
145
- this.triggerOnError(ex);
146
- return {
147
- data: null,
148
- error: ex
149
- };
150
- }
151
- }
152
- onError(cb) {
153
- this.onErrorCb = cb;
154
- }
155
- triggerOnError(error) {
156
- this.setIsLoading(false);
157
- if (!this.onErrorCb) {
158
- return;
159
- }
160
- this.onErrorCb(error);
161
- }
162
- isLockExpired(input) {
163
- const expiresOn = new Date(input);
164
- return expiresOn <= new Date();
165
- }
166
- setIsLoading(loading) {
167
- this._setLoading(loading);
168
- this.loading = loading;
169
- }
170
- async fetchAndAssignRecords(folderId, type, records) {
171
- if (records.length === 0) {
172
- return;
173
- } else if (this.loading) {
174
- return;
175
- }
176
- const assignedIdList = await this.assignRecords(folderId, type, records);
177
- if (assignedIdList.length === 0) {
178
- return;
179
- }
180
- this.setIsLoading(true);
181
- let result;
182
- try {
183
- result = await this._listLockRecords.execute({
184
- where: {
185
- id_in: assignedIdList,
186
- type
187
- },
188
- limit: 10000
189
- });
190
- } catch (ex) {
191
- console.error(ex);
192
- this.triggerOnError(ex);
193
- return;
194
- } finally {
195
- this.setIsLoading(false);
196
- }
197
- if (result.error) {
198
- this.triggerOnError(result.error);
199
- return;
200
- } else if (!result.data) {
201
- this.triggerOnError(createRecordLockingError({
202
- message: `There is no data in the result and there is no error. Please check the network tab for more info.`,
203
- code: "NO_DATA_IN_RESULT"
204
- }));
205
- return;
206
- } else if (result.data.length === 0) {
207
- return;
208
- }
209
- for (const record of result.data) {
210
- const index = this.records.findIndex(r => {
211
- const {
212
- id: entryId
213
- } = parseIdentifier(record.id);
214
- return r.entryId === entryId;
215
- });
216
- if (index < 0) {
217
- console.error(`There is no record with id ${record.id} in the records array.`);
218
- continue;
219
- }
220
- this.records[index] = {
221
- ...this.records[index],
222
- $locked: {
223
- lockedBy: record.lockedBy,
224
- expiresOn: record.expiresOn,
225
- lockedOn: record.lockedOn,
226
- actions: record.actions
227
- }
228
- };
229
- }
230
- return this.records;
231
- }
232
- /**
233
- * Assign records and return the assigned ID list.
234
- */
235
- async assignRecords(folderId, type, records) {
236
- /**
237
- * First we check the record keys against ones in the local cache.
238
- */
239
- const keys = records.map(record => {
240
- if (record.entryId) {
241
- return record.entryId;
242
- }
243
- const {
244
- id: entryId
245
- } = parseIdentifier(record.id);
246
- return entryId;
247
- });
248
- const cacheKey = await createCacheKey(keys);
249
- if (this.currentRecordsCacheKey === cacheKey) {
250
- return [];
251
- }
252
- this.currentRecordsCacheKey = cacheKey;
253
-
254
- /**
255
- * Reset records if new type is not as same as the old type / folderId.
256
- */
257
- if (this.currentRecordType !== type || this.currentFolderId !== folderId) {
258
- this.records = [];
259
- this.currentRecordType = type;
260
- this.currentFolderId = folderId;
261
- }
262
- return records.reduce((collection, record) => {
263
- const {
264
- id: entryId
265
- } = parseIdentifier(record.id);
266
- const index = this.records.findIndex(r => r.entryId === entryId);
267
- if (index >= 0) {
268
- return collection;
269
- }
270
- this.records.push({
271
- ...record,
272
- entryId,
273
- $lockingType: type,
274
- $locked: undefined
275
- });
276
- if (record.$type !== "RECORD") {
277
- return collection;
278
- }
279
- collection.push(entryId);
280
- return collection;
281
- }, []);
282
- }
283
- }
284
- export const createRecordLocking = config => {
285
- const client = new RecordLockingClient({
286
- client: config.client
287
- });
288
- const getLockRecord = new RecordLockingGetLockRecord({
289
- client
290
- });
291
- const getLockedEntryLockRecord = new RecordLockingGetLockedEntryLockRecord({
292
- client
293
- });
294
- const isEntryLocked = new RecordLockingIsEntryLocked({
295
- client
296
- });
297
- const listLockRecords = new RecordLockingListLockRecords({
298
- client
299
- });
300
- const lockEntry = new RecordLockingLockEntry({
301
- client
302
- });
303
- const unlockEntry = new RecordLockingUnlockEntry({
304
- client
305
- });
306
- const updateEntryLock = new RecordLockingUpdateEntryLock({
307
- client
308
- });
309
- return new RecordLocking({
310
- setLoading: config.setLoading,
311
- getLockRecord,
312
- getLockedEntryLockRecord,
313
- isEntryLocked,
314
- listLockRecords,
315
- updateEntryLock,
316
- lockEntry,
317
- unlockEntry
318
- });
319
- };
320
-
321
- //# sourceMappingURL=RecordLocking.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["RecordLockingGetLockRecord","RecordLockingIsEntryLocked","RecordLockingListLockRecords","RecordLockingLockEntry","RecordLockingUnlockEntry","RecordLockingClient","createRecordLockingError","parseIdentifier","createCacheKey","RecordLockingUpdateEntryLock","RecordLockingGetLockedEntryLockRecord","RecordLocking","loading","records","onErrorCb","constructor","params","_setLoading","setLoading","_getLockRecord","getLockRecord","_getLockedEntryLockRecord","getLockedEntryLockRecord","_listLockRecords","listLockRecords","_unlockEntry","unlockEntry","_updateEntryLock","updateEntryLock","setRecords","folderId","type","result","fetchAndAssignRecords","undefined","map","record","id","entryId","$type","$lockingType","$locked","$selectable","fetchLockRecord","execute","data","error","ex","fetchLockedEntryLockRecord","getLockRecordEntry","find","isRecordLocked","r","expiresOn","isExpired","isLockExpired","triggerOnError","removeEntryLock","index","findIndex","force","onError","cb","setIsLoading","input","Date","length","assignedIdList","assignRecords","where","id_in","limit","console","message","code","lockedBy","lockedOn","actions","keys","cacheKey","currentRecordsCacheKey","currentRecordType","currentFolderId","reduce","collection","push","createRecordLocking","config","client","isEntryLocked","lockEntry"],"sources":["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"],"mappings":"AAKA,SAASA,0BAA0B;AACnC,SAASC,0BAA0B;AACnC,SAASC,4BAA4B;AACrC,SAASC,sBAAsB;AAC/B,SAASC,wBAAwB;AACjC,SAASC,mBAAmB;AAwB5B,SAASC,wBAAwB;AACjC,SAASC,eAAe,QAAQ,kCAAkC;AAClE,SAASC,cAAc;AACvB,SAASC,4BAA4B;AAErC,SAASC,qCAAqC;AAuB9C,MAAMC,aAAa,CAEY;EAKpBC,OAAO,GAAG,KAAK;EACfC,OAAO,GAA2B,EAAE;EAOnCC,SAAS,GAAsB,IAAI;EAEpCC,WAAWA,CAACC,MAA4B,EAAE;IAC7C,IAAI,CAACC,WAAW,GAAGD,MAAM,CAACE,UAAU;IACpC,IAAI,CAACC,cAAc,GAAGH,MAAM,CAACI,aAAa;IAC1C,IAAI,CAACC,yBAAyB,GAAGL,MAAM,CAACM,wBAAwB;IAChE,IAAI,CAACC,gBAAgB,GAAGP,MAAM,CAACQ,eAAe;IAC9C,IAAI,CAACC,YAAY,GAA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ions } 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,19 +0,0 @@
1
- export 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
-
19
- //# sourceMappingURL=RecordLockingClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["RecordLockingClient","constructor","params","client","query","fetchPolicy","mutation","options","mutate"],"sources":["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"],"mappings":"AAQA,OAAO,MAAMA,mBAAmB,CAAiC;EAGtDC,WAAWA,CAACC,MAAkC,EAAE;IACnD,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;EAC/B;EAEA,MAAaC,KAAKA,CAAOF,MAAuB,EAAiC;IAC7E,OAAO,IAAI,CAACC,MAAM,CAACC,KAAK,CAAO;MAC3B,GAAGF,MAAM;MACTG,WAAW,EAAE;IACjB,CAAC,CAAC;EACN;EAEA,MAAaC,QAAQA,CAAOC,OAA8B,EAA2B;IACjF,OAAO,IAAI,CAACJ,MAAM,CAACK,MAAM,CAAO;MAC5B,GAAGD,OAAO;MACVF,WAAW,EAAE;IACjB,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
@@ -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,21 +0,0 @@
1
- import { GET_LOCK_RECORD_QUERY } from "./graphql/getLockRecord.js";
2
- import { WebinyError } from "@webiny/error";
3
- export 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) {
13
- throw new WebinyError(result.data.recordLocking.getLockRecord.error);
14
- } else if (!result.data.recordLocking.getLockRecord.data) {
15
- throw new WebinyError("No data returned from server.");
16
- }
17
- return result.data.recordLocking.getLockRecord;
18
- }
19
- }
20
-
21
- //# sourceMappingURL=RecordLockingGetLockRecord.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["GET_LOCK_RECORD_QUERY","WebinyError","RecordLockingGetLockRecord","constructor","params","client","execute","result","query","variables","data","recordLocking","getLockRecord","error"],"sources":["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"],"mappings":"AAUA,SAASA,qBAAqB;AAC9B,SAASC,WAAW,QAAQ,eAAe;AAM3C,OAAO,MAAMC,0BAA0B,CAAwC;EAGpEC,WAAWA,CAACC,MAAc,EAAE;IAC/B,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;EAC/B;EACA,MAAaC,OAAOA,CAChBF,MAAgD,EACC;IACjD,MAAMG,MAAM,GAAG,MAAM,IAAI,CAACF,MAAM,CAACG,KAAK,CAGpC;MACEA,KAAK,EAAER,qBAAqB;MAC5BS,SAAS,EAAEL;IACf,CAAC,CAAC;IACF,IAAIG,MAAM,CAACG,IAAI,CAACC,aAAa,CAACC,aAAa,CAACC,KAAK,EAAE;MAC/C,MAAM,IAAIZ,WAAW,CAACM,MAAM,CAACG,IAAI,CAACC,aAAa,CAACC,aAAa,CAACC,KAAK,CAAC;IACxE,CAAC,MAAM,IAAI,CAACN,MAAM,CAACG,IAAI,CAACC,aAAa,CAACC,aAAa,CAACF,IAAI,EAAE;MACtD,MAAM,IAAIT,WAAW,CAAC,+BAA+B,CAAC;IAC1D;IACA,OAAOM,MAAM,CAACG,IAAI,CAACC,aAAa,CAACC,aAAa;EAClD;AACJ","ignoreList":[]}
@@ -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,19 +0,0 @@
1
- import { GET_LOCKED_ENTRY_LOCK_RECORD_QUERY } from "./graphql/getLockedEntryLockRecord.js";
2
- import { WebinyError } from "@webiny/error";
3
- export 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) {
13
- throw new WebinyError(result.data.recordLocking.getLockedEntryLockRecord.error);
14
- }
15
- return result.data.recordLocking.getLockedEntryLockRecord;
16
- }
17
- }
18
-
19
- //# sourceMappingURL=RecordLockingGetLockedEntryLockRecord.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["GET_LOCKED_ENTRY_LOCK_RECORD_QUERY","WebinyError","RecordLockingGetLockedEntryLockRecord","constructor","params","client","execute","result","query","variables","data","recordLocking","getLockedEntryLockRecord","error"],"sources":["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"],"mappings":"AAKA,SAASA,kCAAkC;AAC3C,SAASC,WAAW,QAAQ,eAAe;AAW3C,OAAO,MAAMC,qCAAqC,CAAmD;EAG1FC,WAAWA,CAACC,MAAc,EAAE;IAC/B,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;EAC/B;EACA,MAAaC,OAAOA,CAChBF,MAA2D,EACC;IAC5D,MAAMG,MAAM,GAAG,MAAM,IAAI,CAACF,MAAM,CAACG,KAAK,CAGpC;MACEA,KAAK,EAAER,kCAAkC;MACzCS,SAAS,EAAEL;IACf,CAAC,CAAC;IACF,IAAIG,MAAM,CAACG,IAAI,CAACC,aAAa,CAACC,wBAAwB,CAACC,KAAK,EAAE;MAC1D,MAAM,IAAIZ,WAAW,CAACM,MAAM,CAACG,IAAI,CAACC,aAAa,CAACC,wBAAwB,CAACC,KAAK,CAAC;IACnF;IACA,OAAON,MAAM,CAACG,IAAI,CAACC,aAAa,CAACC,wBAAwB;EAC7D;AACJ","ignoreList":[]}
@@ -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,19 +0,0 @@
1
- import { IS_ENTRY_LOCKED_QUERY } from "./graphql/isEntryLocked.js";
2
- export 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
-
19
- //# sourceMappingURL=RecordLockingIsEntryLocked.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["IS_ENTRY_LOCKED_QUERY","RecordLockingIsEntryLocked","constructor","params","client","execute","result","query","variables","data","recordLocking","isEntryLocked"],"sources":["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"],"mappings":"AAUA,SAASA,qBAAqB;AAM9B,OAAO,MAAMC,0BAA0B,CAAwC;EAGpEC,WAAWA,CAACC,MAAc,EAAE;IAC/B,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;EAC/B;EACA,MAAaC,OAAOA,CAChBF,MAAyC,EACC;IAC1C,IAAI;MACA,MAAMG,MAAM,GAAG,MAAM,IAAI,CAACF,MAAM,CAACG,KAAK,CAGpC;QACEA,KAAK,EAAEP,qBAAqB;QAC5BQ,SAAS,EAAEL;MACf,CAAC,CAAC;MACF,OAAO,CAAC,CAACG,MAAM,CAACG,IAAI,CAACC,aAAa,CAACC,aAAa,CAACF,IAAI;IACzD,CAAC,CAAC,MAAM;MACJ,OAAO,KAAK;IAChB;EACJ;AACJ","ignoreList":[]}
@@ -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,31 +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
- export class RecordLockingListLockRecords {
5
- constructor(params) {
6
- this.client = createRecordLockingClient(params.client);
7
- }
8
- async execute(params) {
9
- const {
10
- where,
11
- sort,
12
- limit,
13
- after
14
- } = params;
15
- const result = await this.client.query({
16
- query: LIST_LOCK_RECORDS,
17
- variables: {
18
- where,
19
- sort,
20
- limit,
21
- after
22
- }
23
- });
24
- if (!result.data?.recordLocking?.listLockRecords) {
25
- throw new WebinyError("No data returned from server.");
26
- }
27
- return result.data.recordLocking.listLockRecords;
28
- }
29
- }
30
-
31
- //# sourceMappingURL=RecordLockingListLockRecords.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["WebinyError","createRecordLockingClient","LIST_LOCK_RECORDS","RecordLockingListLockRecords","constructor","params","client","execute","where","sort","limit","after","result","query","variables","data","recordLocking","listLockRecords"],"sources":["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"],"mappings":"AAAA,SAASA,WAAW,QAAQ,eAAe;AAQ3C,SAASC,yBAAyB;AAKlC,SAASC,iBAAiB;AAM1B,OAAO,MAAMC,4BAA4B,CAA0C;EAGxEC,WAAWA,CAACC,MAAc,EAAE;IAC/B,IAAI,CAACC,MAAM,GAAGL,yBAAyB,CAACI,MAAM,CAACC,MAAM,CAAC;EAC1D;EACA,MAAaC,OAAOA,CAChBF,MAA2C,EACC;IAC5C,MAAM;MAAEG,KAAK;MAAEC,IAAI;MAAEC,KAAK;MAAEC;IAAM,CAAC,GAAGN,MAAM;IAE5C,MAAMO,MAAM,GAAG,MAAM,IAAI,CAACN,MAAM,CAACO,KAAK,CAGpC;MACEA,KAAK,EAAEX,iBAAiB;MACxBY,SAAS,EAAE;QACPN,KAAK;QACLC,IAAI;QACJC,KAAK;QACLC;MACJ;IACJ,CAAC,CAAC;IACF,IAAI,CAACC,MAAM,CAACG,IAAI,EAAEC,aAAa,EAAEC,eAAe,EAAE;MAC9C,MAAM,IAAIjB,WAAW,CAAC,+BAA+B,CAAC;IAC1D;IACA,OAAOY,MAAM,CAACG,IAAI,CAACC,aAAa,CAACC,eAAe;EACpD;AACJ","ignoreList":[]}
@@ -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,13 +0,0 @@
1
- import { WebinyError } from "@webiny/error";
2
- export class RecordLockingLockEntry {
3
- constructor(params) {
4
- this.client = params.client;
5
- }
6
- async execute(
7
- // oxlint-disable-next-line
8
- params) {
9
- throw new WebinyError("Method not implemented.");
10
- }
11
- }
12
-
13
- //# sourceMappingURL=RecordLockingLockEntry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["WebinyError","RecordLockingLockEntry","constructor","params","client","execute"],"sources":["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"],"mappings":"AAAA,SAASA,WAAW,QAAQ,eAAe;AAY3C,OAAO,MAAMC,sBAAsB,CAAoC;EAG5DC,WAAWA,CAACC,MAAc,EAAE;IAC/B,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;EAC/B;EACA,MAAaC,OAAOA;EAChB;EACAF,MAAqC,EACC;IACtC,MAAM,IAAIH,WAAW,CAAC,yBAAyB,CAAC;EACpD;AACJ","ignoreList":[]}
@@ -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 {};