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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/RecordLockingAppFeature.d.ts +11 -0
  2. package/RecordLockingAppFeature.js +20 -0
  3. package/RecordLockingAppFeature.js.map +1 -0
  4. package/domain/LockRecord.js +63 -70
  5. package/domain/LockRecord.js.map +1 -1
  6. package/domain/RecordLockingModel.js +27 -23
  7. package/domain/RecordLockingModel.js.map +1 -1
  8. package/domain/abstractions.d.ts +9 -3
  9. package/domain/abstractions.js +3 -7
  10. package/domain/abstractions.js.map +1 -1
  11. package/domain/calculateExpiresOn.js +5 -6
  12. package/domain/calculateExpiresOn.js.map +1 -1
  13. package/domain/errors.js +71 -81
  14. package/domain/errors.js.map +1 -1
  15. package/domain/index.js +0 -2
  16. package/domain/types.js +6 -9
  17. package/domain/types.js.map +1 -1
  18. package/features/GetLockRecord/GetLockRecordRepository.d.ts +4 -3
  19. package/features/GetLockRecord/GetLockRecordRepository.js +33 -25
  20. package/features/GetLockRecord/GetLockRecordRepository.js.map +1 -1
  21. package/features/GetLockRecord/GetLockRecordUseCase.js +13 -10
  22. package/features/GetLockRecord/GetLockRecordUseCase.js.map +1 -1
  23. package/features/GetLockRecord/abstractions.js +3 -14
  24. package/features/GetLockRecord/abstractions.js.map +1 -1
  25. package/features/GetLockRecord/feature.d.ts +4 -1
  26. package/features/GetLockRecord/feature.js +7 -6
  27. package/features/GetLockRecord/feature.js.map +1 -1
  28. package/features/GetLockRecord/index.js +0 -2
  29. package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.d.ts +1 -1
  30. package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js +20 -29
  31. package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js.map +1 -1
  32. package/features/GetLockedEntryLockRecord/abstractions.js +2 -10
  33. package/features/GetLockedEntryLockRecord/abstractions.js.map +1 -1
  34. package/features/GetLockedEntryLockRecord/feature.d.ts +4 -1
  35. package/features/GetLockedEntryLockRecord/feature.js +6 -5
  36. package/features/GetLockedEntryLockRecord/feature.js.map +1 -1
  37. package/features/GetLockedEntryLockRecord/index.js +0 -2
  38. package/features/IsEntryLocked/IsEntryLockedUseCase.d.ts +1 -1
  39. package/features/IsEntryLocked/IsEntryLockedUseCase.js +23 -29
  40. package/features/IsEntryLocked/IsEntryLockedUseCase.js.map +1 -1
  41. package/features/IsEntryLocked/abstractions.js +2 -9
  42. package/features/IsEntryLocked/abstractions.js.map +1 -1
  43. package/features/IsEntryLocked/feature.d.ts +4 -1
  44. package/features/IsEntryLocked/feature.js +6 -5
  45. package/features/IsEntryLocked/feature.js.map +1 -1
  46. package/features/IsEntryLocked/index.js +0 -2
  47. package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.d.ts +4 -4
  48. package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.js +28 -34
  49. package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.js.map +1 -1
  50. package/features/KickOutCurrentUser/abstractions.js +2 -6
  51. package/features/KickOutCurrentUser/abstractions.js.map +1 -1
  52. package/features/KickOutCurrentUser/feature.d.ts +4 -1
  53. package/features/KickOutCurrentUser/feature.js +6 -5
  54. package/features/KickOutCurrentUser/feature.js.map +1 -1
  55. package/features/KickOutCurrentUser/index.js +0 -2
  56. package/features/ListAllLockRecords/ListAllLockRecordsRepository.d.ts +5 -3
  57. package/features/ListAllLockRecords/ListAllLockRecordsRepository.js +39 -32
  58. package/features/ListAllLockRecords/ListAllLockRecordsRepository.js.map +1 -1
  59. package/features/ListAllLockRecords/ListAllLockRecordsUseCase.js +13 -10
  60. package/features/ListAllLockRecords/ListAllLockRecordsUseCase.js.map +1 -1
  61. package/features/ListAllLockRecords/abstractions.js +3 -14
  62. package/features/ListAllLockRecords/abstractions.js.map +1 -1
  63. package/features/ListAllLockRecords/feature.d.ts +4 -1
  64. package/features/ListAllLockRecords/feature.js +7 -6
  65. package/features/ListAllLockRecords/feature.js.map +1 -1
  66. package/features/ListAllLockRecords/index.js +0 -2
  67. package/features/ListLockRecords/ListLockRecordsRepository.d.ts +6 -3
  68. package/features/ListLockRecords/ListLockRecordsRepository.js +39 -32
  69. package/features/ListLockRecords/ListLockRecordsRepository.js.map +1 -1
  70. package/features/ListLockRecords/ListLockRecordsUseCase.d.ts +1 -1
  71. package/features/ListLockRecords/ListLockRecordsUseCase.js +27 -24
  72. package/features/ListLockRecords/ListLockRecordsUseCase.js.map +1 -1
  73. package/features/ListLockRecords/abstractions.js +3 -14
  74. package/features/ListLockRecords/abstractions.js.map +1 -1
  75. package/features/ListLockRecords/feature.d.ts +4 -1
  76. package/features/ListLockRecords/feature.js +7 -6
  77. package/features/ListLockRecords/feature.js.map +1 -1
  78. package/features/ListLockRecords/index.js +0 -2
  79. package/features/LockEntry/LockEntryEventsDecorator.d.ts +1 -1
  80. package/features/LockEntry/LockEntryEventsDecorator.js +32 -32
  81. package/features/LockEntry/LockEntryEventsDecorator.js.map +1 -1
  82. package/features/LockEntry/LockEntryRepository.d.ts +4 -3
  83. package/features/LockEntry/LockEntryRepository.js +35 -31
  84. package/features/LockEntry/LockEntryRepository.js.map +1 -1
  85. package/features/LockEntry/LockEntryUseCase.js +21 -26
  86. package/features/LockEntry/LockEntryUseCase.js.map +1 -1
  87. package/features/LockEntry/abstractions.js +3 -14
  88. package/features/LockEntry/abstractions.js.map +1 -1
  89. package/features/LockEntry/events.d.ts +8 -8
  90. package/features/LockEntry/events.js +26 -34
  91. package/features/LockEntry/events.js.map +1 -1
  92. package/features/LockEntry/feature.d.ts +4 -1
  93. package/features/LockEntry/feature.js +8 -7
  94. package/features/LockEntry/feature.js.map +1 -1
  95. package/features/LockEntry/index.js +0 -2
  96. package/features/RecordLockingFeature.d.ts +4 -6
  97. package/features/RecordLockingFeature.js +21 -22
  98. package/features/RecordLockingFeature.js.map +1 -1
  99. package/features/RecordLockingModelProvider.d.ts +18 -0
  100. package/features/RecordLockingModelProvider.js +22 -0
  101. package/features/RecordLockingModelProvider.js.map +1 -0
  102. package/features/UnlockEntry/UnlockEntryEventsDecorator.d.ts +1 -1
  103. package/features/UnlockEntry/UnlockEntryEventsDecorator.js +33 -33
  104. package/features/UnlockEntry/UnlockEntryEventsDecorator.js.map +1 -1
  105. package/features/UnlockEntry/UnlockEntryRepository.d.ts +3 -3
  106. package/features/UnlockEntry/UnlockEntryRepository.js +31 -28
  107. package/features/UnlockEntry/UnlockEntryRepository.js.map +1 -1
  108. package/features/UnlockEntry/UnlockEntryUseCase.d.ts +1 -1
  109. package/features/UnlockEntry/UnlockEntryUseCase.js +54 -70
  110. package/features/UnlockEntry/UnlockEntryUseCase.js.map +1 -1
  111. package/features/UnlockEntry/abstractions.js +3 -14
  112. package/features/UnlockEntry/abstractions.js.map +1 -1
  113. package/features/UnlockEntry/events.d.ts +8 -8
  114. package/features/UnlockEntry/events.js +26 -34
  115. package/features/UnlockEntry/events.js.map +1 -1
  116. package/features/UnlockEntry/feature.d.ts +4 -1
  117. package/features/UnlockEntry/feature.js +8 -7
  118. package/features/UnlockEntry/feature.js.map +1 -1
  119. package/features/UnlockEntry/hasFullAccessPermission.d.ts +1 -1
  120. package/features/UnlockEntry/hasFullAccessPermission.js +6 -7
  121. package/features/UnlockEntry/hasFullAccessPermission.js.map +1 -1
  122. package/features/UnlockEntry/index.js +0 -2
  123. package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.d.ts +1 -1
  124. package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.js +32 -32
  125. package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.js.map +1 -1
  126. package/features/UnlockEntryRequest/UnlockEntryRequestRepository.d.ts +4 -4
  127. package/features/UnlockEntryRequest/UnlockEntryRequestRepository.js +34 -32
  128. package/features/UnlockEntryRequest/UnlockEntryRequestRepository.js.map +1 -1
  129. package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.d.ts +1 -1
  130. package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.js +63 -80
  131. package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.js.map +1 -1
  132. package/features/UnlockEntryRequest/abstractions.js +3 -14
  133. package/features/UnlockEntryRequest/abstractions.js.map +1 -1
  134. package/features/UnlockEntryRequest/events.d.ts +8 -8
  135. package/features/UnlockEntryRequest/events.js +26 -34
  136. package/features/UnlockEntryRequest/events.js.map +1 -1
  137. package/features/UnlockEntryRequest/feature.d.ts +4 -1
  138. package/features/UnlockEntryRequest/feature.js +8 -7
  139. package/features/UnlockEntryRequest/feature.js.map +1 -1
  140. package/features/UnlockEntryRequest/index.js +0 -2
  141. package/features/UpdateEntryLock/UpdateEntryLockRepository.d.ts +5 -4
  142. package/features/UpdateEntryLock/UpdateEntryLockRepository.js +48 -50
  143. package/features/UpdateEntryLock/UpdateEntryLockRepository.js.map +1 -1
  144. package/features/UpdateEntryLock/UpdateEntryLockUseCase.d.ts +1 -1
  145. package/features/UpdateEntryLock/UpdateEntryLockUseCase.js +41 -52
  146. package/features/UpdateEntryLock/UpdateEntryLockUseCase.js.map +1 -1
  147. package/features/UpdateEntryLock/abstractions.js +3 -14
  148. package/features/UpdateEntryLock/abstractions.js.map +1 -1
  149. package/features/UpdateEntryLock/feature.d.ts +4 -1
  150. package/features/UpdateEntryLock/feature.js +7 -6
  151. package/features/UpdateEntryLock/feature.js.map +1 -1
  152. package/features/UpdateEntryLock/index.js +0 -2
  153. package/graphql/RecordLockingGraphQLSchema.d.ts +25 -0
  154. package/graphql/RecordLockingGraphQLSchema.js +390 -0
  155. package/graphql/RecordLockingGraphQLSchema.js.map +1 -0
  156. package/graphql/checkPermissions.d.ts +3 -3
  157. package/graphql/checkPermissions.js +4 -10
  158. package/graphql/checkPermissions.js.map +1 -1
  159. package/graphql/resolve.d.ts +1 -1
  160. package/graphql/resolve.js +16 -18
  161. package/graphql/resolve.js.map +1 -1
  162. package/index.d.ts +2 -9
  163. package/index.js +1 -62
  164. package/package.json +27 -22
  165. package/types.js +6 -9
  166. package/types.js.map +1 -1
  167. package/utils/convertWhereCondition.js +20 -32
  168. package/utils/convertWhereCondition.js.map +1 -1
  169. package/utils/getTimeout.js +8 -15
  170. package/utils/getTimeout.js.map +1 -1
  171. package/utils/lockRecordDatabaseId.js +6 -11
  172. package/utils/lockRecordDatabaseId.js.map +1 -1
  173. package/domain/index.js.map +0 -1
  174. package/features/GetLockRecord/index.js.map +0 -1
  175. package/features/GetLockedEntryLockRecord/index.js.map +0 -1
  176. package/features/IsEntryLocked/index.js.map +0 -1
  177. package/features/KickOutCurrentUser/index.js.map +0 -1
  178. package/features/ListAllLockRecords/index.js.map +0 -1
  179. package/features/ListLockRecords/index.js.map +0 -1
  180. package/features/LockEntry/index.js.map +0 -1
  181. package/features/UnlockEntry/index.js.map +0 -1
  182. package/features/UnlockEntryRequest/index.js.map +0 -1
  183. package/features/UpdateEntryLock/index.js.map +0 -1
  184. package/graphql/schema.d.ts +0 -11
  185. package/graphql/schema.js +0 -318
  186. package/graphql/schema.js.map +0 -1
  187. package/index.js.map +0 -1
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@webiny/api-record-locking",
3
- "version": "0.0.0-unstable.b9b64acb6d",
3
+ "version": "0.0.0-unstable.d0f34a8194",
4
4
  "type": "module",
5
- "main": "index.js",
5
+ "exports": {
6
+ ".": "./index.js",
7
+ "./*": "./*"
8
+ },
6
9
  "repository": {
7
10
  "type": "git",
8
11
  "url": "https://github.com/webiny/webiny-js.git"
@@ -13,30 +16,32 @@
13
16
  ],
14
17
  "license": "MIT",
15
18
  "dependencies": {
16
- "@webiny/api": "0.0.0-unstable.b9b64acb6d",
17
- "@webiny/api-headless-cms": "0.0.0-unstable.b9b64acb6d",
18
- "@webiny/api-websockets": "0.0.0-unstable.b9b64acb6d",
19
- "@webiny/feature": "0.0.0-unstable.b9b64acb6d",
20
- "@webiny/handler": "0.0.0-unstable.b9b64acb6d",
21
- "@webiny/handler-aws": "0.0.0-unstable.b9b64acb6d",
22
- "@webiny/handler-graphql": "0.0.0-unstable.b9b64acb6d",
23
- "@webiny/plugins": "0.0.0-unstable.b9b64acb6d",
24
- "@webiny/utils": "0.0.0-unstable.b9b64acb6d"
19
+ "@webiny/api": "0.0.0-unstable.d0f34a8194",
20
+ "@webiny/api-graphql": "0.0.0-unstable.d0f34a8194",
21
+ "@webiny/api-headless-cms": "0.0.0-unstable.d0f34a8194",
22
+ "@webiny/api-websockets": "0.0.0-unstable.d0f34a8194",
23
+ "@webiny/feature": "0.0.0-unstable.d0f34a8194",
24
+ "@webiny/handler": "0.0.0-unstable.d0f34a8194",
25
+ "@webiny/utils": "0.0.0-unstable.d0f34a8194"
25
26
  },
26
27
  "devDependencies": {
27
- "@webiny/api-core": "0.0.0-unstable.b9b64acb6d",
28
- "@webiny/build-tools": "0.0.0-unstable.b9b64acb6d",
29
- "@webiny/project-utils": "0.0.0-unstable.b9b64acb6d",
30
- "@webiny/wcp": "0.0.0-unstable.b9b64acb6d",
31
- "graphql": "16.13.0",
28
+ "@webiny/api-core": "0.0.0-unstable.d0f34a8194",
29
+ "@webiny/api-core-testing": "0.0.0-unstable.d0f34a8194",
30
+ "@webiny/build-tools": "0.0.0-unstable.d0f34a8194",
31
+ "@webiny/di": "2.0.0",
32
+ "@webiny/event-handler-core": "0.0.0-unstable.d0f34a8194",
33
+ "@webiny/wcp": "0.0.0-unstable.d0f34a8194",
34
+ "graphql": "16.14.2",
32
35
  "rimraf": "6.1.3",
33
- "type-fest": "5.4.4",
34
- "typescript": "5.9.3",
35
- "vitest": "4.0.18"
36
+ "type-fest": "5.8.0",
37
+ "typescript": "7.0.2",
38
+ "vitest": "4.1.11"
36
39
  },
37
40
  "publishConfig": {
38
- "access": "public",
39
- "directory": "dist"
41
+ "access": "public"
40
42
  },
41
- "gitHead": "b9b64acb6df55b308cfb277533fa07e0a6402546"
43
+ "gitHead": "8476da73b653c89cc1474d968baf55c1b0ae0e5f",
44
+ "webiny": {
45
+ "publishFrom": "dist"
46
+ }
42
47
  }
package/types.js CHANGED
@@ -1,12 +1,9 @@
1
- export let RecordLockingLockRecordActionType = /*#__PURE__*/function (RecordLockingLockRecordActionType) {
2
- RecordLockingLockRecordActionType["requested"] = "requested";
3
- RecordLockingLockRecordActionType["approved"] = "approved";
4
- RecordLockingLockRecordActionType["denied"] = "denied";
5
- return RecordLockingLockRecordActionType;
1
+ var types_RecordLockingLockRecordActionType = /*#__PURE__*/ function(RecordLockingLockRecordActionType) {
2
+ RecordLockingLockRecordActionType["requested"] = "requested";
3
+ RecordLockingLockRecordActionType["approved"] = "approved";
4
+ RecordLockingLockRecordActionType["denied"] = "denied";
5
+ return RecordLockingLockRecordActionType;
6
6
  }({});
7
-
8
- /**
9
- * Do not use any special chars other than #, as we use this to create lock record IDs.
10
- */
7
+ export { types_RecordLockingLockRecordActionType as RecordLockingLockRecordActionType };
11
8
 
12
9
  //# sourceMappingURL=types.js.map
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["RecordLockingLockRecordActionType"],"sources":["types.ts"],"sourcesContent":["import type {\n CmsEntryListParams,\n CmsEntryMeta,\n CmsIdentity\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { CmsEntry, CmsError } from \"@webiny/api-headless-cms/types/index.js\";\n\nexport type { CmsError, CmsEntry };\n\nexport type IRecordLockingIdentity = CmsIdentity;\n\nexport type IRecordLockingMeta = CmsEntryMeta;\n\nexport enum RecordLockingLockRecordActionType {\n requested = \"requested\",\n approved = \"approved\",\n denied = \"denied\"\n}\n\nexport interface IRecordLockingLockRecordRequestedAction {\n type: RecordLockingLockRecordActionType.requested;\n message?: string;\n createdOn: Date;\n createdBy: IRecordLockingIdentity;\n}\n\nexport interface IRecordLockingLockRecordApprovedAction {\n type: RecordLockingLockRecordActionType.approved;\n message?: string;\n createdOn: Date;\n createdBy: IRecordLockingIdentity;\n}\n\nexport interface IRecordLockingLockRecordDeniedAction {\n type: RecordLockingLockRecordActionType.denied;\n message?: string;\n createdOn: Date;\n createdBy: IRecordLockingIdentity;\n}\n\nexport type IRecordLockingLockRecordAction =\n | IRecordLockingLockRecordRequestedAction\n | IRecordLockingLockRecordApprovedAction\n | IRecordLockingLockRecordDeniedAction;\n\nexport interface IRecordLockingLockRecordObject {\n id: string;\n targetId: string;\n type: IRecordLockingLockRecordEntryType;\n lockedBy: IRecordLockingIdentity;\n lockedOn: Date;\n updatedOn: Date;\n expiresOn: Date;\n actions?: IRecordLockingLockRecordAction[];\n}\n\nexport interface IRecordLockingLockRecord extends IRecordLockingLockRecordObject {\n toObject(): IRecordLockingLockRecordObject;\n addAction(action: IRecordLockingLockRecordAction): void;\n getUnlockRequested(): IRecordLockingLockRecordRequestedAction | undefined;\n getUnlockApproved(): IRecordLockingLockRecordApprovedAction | undefined;\n getUnlockDenied(): IRecordLockingLockRecordDeniedAction | undefined;\n isExpired(): boolean;\n}\n\n/**\n * Do not use any special chars other than #, as we use this to create lock record IDs.\n */\nexport type IRecordLockingLockRecordEntryType = string;\n\nexport type IRecordLockingListAllLockRecordsParams = Pick<\n CmsEntryListParams,\n \"where\" | \"limit\" | \"sort\" | \"after\"\n>;\n\nexport type IRecordLockingListLockRecordsParams = IRecordLockingListAllLockRecordsParams;\n"],"mappings":"AAaA,WAAYA,iCAAiC,0BAAjCA,iCAAiC;EAAjCA,iCAAiC;EAAjCA,iCAAiC;EAAjCA,iCAAiC;EAAA,OAAjCA,iCAAiC;AAAA;;AAoD7C;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import type {\n CmsEntryListParams,\n CmsEntryMeta,\n CmsIdentity\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { CmsEntry, CmsError } from \"@webiny/api-headless-cms/types/index.js\";\n\nexport type { CmsError, CmsEntry };\n\nexport type IRecordLockingIdentity = CmsIdentity;\n\nexport type IRecordLockingMeta = CmsEntryMeta;\n\nexport enum RecordLockingLockRecordActionType {\n requested = \"requested\",\n approved = \"approved\",\n denied = \"denied\"\n}\n\nexport interface IRecordLockingLockRecordRequestedAction {\n type: RecordLockingLockRecordActionType.requested;\n message?: string;\n createdOn: Date;\n createdBy: IRecordLockingIdentity;\n}\n\nexport interface IRecordLockingLockRecordApprovedAction {\n type: RecordLockingLockRecordActionType.approved;\n message?: string;\n createdOn: Date;\n createdBy: IRecordLockingIdentity;\n}\n\nexport interface IRecordLockingLockRecordDeniedAction {\n type: RecordLockingLockRecordActionType.denied;\n message?: string;\n createdOn: Date;\n createdBy: IRecordLockingIdentity;\n}\n\nexport type IRecordLockingLockRecordAction =\n | IRecordLockingLockRecordRequestedAction\n | IRecordLockingLockRecordApprovedAction\n | IRecordLockingLockRecordDeniedAction;\n\nexport interface IRecordLockingLockRecordObject {\n id: string;\n targetId: string;\n type: IRecordLockingLockRecordEntryType;\n lockedBy: IRecordLockingIdentity;\n lockedOn: Date;\n updatedOn: Date;\n expiresOn: Date;\n actions?: IRecordLockingLockRecordAction[];\n}\n\nexport interface IRecordLockingLockRecord extends IRecordLockingLockRecordObject {\n toObject(): IRecordLockingLockRecordObject;\n addAction(action: IRecordLockingLockRecordAction): void;\n getUnlockRequested(): IRecordLockingLockRecordRequestedAction | undefined;\n getUnlockApproved(): IRecordLockingLockRecordApprovedAction | undefined;\n getUnlockDenied(): IRecordLockingLockRecordDeniedAction | undefined;\n isExpired(): boolean;\n}\n\n/**\n * Do not use any special chars other than #, as we use this to create lock record IDs.\n */\nexport type IRecordLockingLockRecordEntryType = string;\n\nexport type IRecordLockingListAllLockRecordsParams = Pick<\n CmsEntryListParams,\n \"where\" | \"limit\" | \"sort\" | \"after\"\n>;\n\nexport type IRecordLockingListLockRecordsParams = IRecordLockingListAllLockRecordsParams;\n"],"names":["RecordLockingLockRecordActionType"],"mappings":"AAaO,IAAKA,0CAAiCA,WAAAA,GAAAA,SAAjCA,iCAAiC;;;;WAAjCA"}
@@ -1,38 +1,26 @@
1
1
  import { createLockRecordDatabaseId } from "./lockRecordDatabaseId.js";
2
- const attachPrefix = value => {
3
- if (Array.isArray(value)) {
4
- return value.map(createLockRecordDatabaseId);
5
- }
6
- return createLockRecordDatabaseId(value);
2
+ const attachPrefix = (value)=>{
3
+ if (Array.isArray(value)) return value.map(createLockRecordDatabaseId);
4
+ return createLockRecordDatabaseId(value);
7
5
  };
8
- export const convertWhereCondition = where => {
9
- if (!where) {
10
- return where;
11
- }
12
- for (const key in where) {
13
- if (key.startsWith("AND") || key.startsWith("OR")) {
14
- const value = where[key];
15
- if (!value) {
16
- continue;
17
- }
18
- for (const subKey in value) {
19
- value[subKey] = convertWhereCondition(value[subKey]);
20
- }
21
- continue;
22
- } else if (key.startsWith("id") === false) {
23
- continue;
24
- }
25
- const value = where[key];
26
- if (!value) {
27
- continue;
6
+ const convertWhereCondition = (where)=>{
7
+ if (!where) return where;
8
+ for(const key in where){
9
+ if (key.startsWith("AND") || key.startsWith("OR")) {
10
+ const value = where[key];
11
+ if (!value) continue;
12
+ for(const subKey in value)value[subKey] = convertWhereCondition(value[subKey]);
13
+ continue;
14
+ }
15
+ if (false === key.startsWith("id")) continue;
16
+ const value = where[key];
17
+ if (!value) continue;
18
+ const newKey = key.replace("id", "entryId");
19
+ where[newKey] = attachPrefix(where[key]);
20
+ delete where[key];
28
21
  }
29
- const newKey = key.replace("id", "entryId");
30
- // @ts-expect-error
31
- where[newKey] = attachPrefix(where[key]);
32
- // @ts-expect-error
33
- delete where[key];
34
- }
35
- return where;
22
+ return where;
36
23
  };
24
+ export { convertWhereCondition };
37
25
 
38
26
  //# sourceMappingURL=convertWhereCondition.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createLockRecordDatabaseId","attachPrefix","value","Array","isArray","map","convertWhereCondition","where","key","startsWith","subKey","newKey","replace"],"sources":["convertWhereCondition.ts"],"sourcesContent":["import type { IRecordLockingListLockRecordsParams } from \"~/types.js\";\nimport { createLockRecordDatabaseId } from \"~/utils/lockRecordDatabaseId.js\";\n\ntype IWhere = IRecordLockingListLockRecordsParams[\"where\"] | undefined;\n\nconst attachPrefix = (value: string | string[]) => {\n if (Array.isArray(value)) {\n return value.map(createLockRecordDatabaseId);\n }\n return createLockRecordDatabaseId(value);\n};\n\nexport const convertWhereCondition = (where: IWhere): IWhere => {\n if (!where) {\n return where;\n }\n for (const key in where) {\n if (key.startsWith(\"AND\") || key.startsWith(\"OR\")) {\n const value = where[key as keyof typeof where] as IWhere[] | undefined;\n if (!value) {\n continue;\n }\n for (const subKey in value) {\n value[subKey] = convertWhereCondition(value[subKey]);\n }\n continue;\n } else if (key.startsWith(\"id\") === false) {\n continue;\n }\n const value = where[key as keyof typeof where];\n if (!value) {\n continue;\n }\n\n const newKey = key.replace(\"id\", \"entryId\") as keyof typeof where;\n // @ts-expect-error\n where[newKey] = attachPrefix(where[key]);\n // @ts-expect-error\n delete where[key];\n }\n return where;\n};\n"],"mappings":"AACA,SAASA,0BAA0B;AAInC,MAAMC,YAAY,GAAIC,KAAwB,IAAK;EAC/C,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;IACtB,OAAOA,KAAK,CAACG,GAAG,CAACL,0BAA0B,CAAC;EAChD;EACA,OAAOA,0BAA0B,CAACE,KAAK,CAAC;AAC5C,CAAC;AAED,OAAO,MAAMI,qBAAqB,GAAIC,KAAa,IAAa;EAC5D,IAAI,CAACA,KAAK,EAAE;IACR,OAAOA,KAAK;EAChB;EACA,KAAK,MAAMC,GAAG,IAAID,KAAK,EAAE;IACrB,IAAIC,GAAG,CAACC,UAAU,CAAC,KAAK,CAAC,IAAID,GAAG,CAACC,UAAU,CAAC,IAAI,CAAC,EAAE;MAC/C,MAAMP,KAAK,GAAGK,KAAK,CAACC,GAAG,CAA+C;MACtE,IAAI,CAACN,KAAK,EAAE;QACR;MACJ;MACA,KAAK,MAAMQ,MAAM,IAAIR,KAAK,EAAE;QACxBA,KAAK,CAACQ,MAAM,CAAC,GAAGJ,qBAAqB,CAACJ,KAAK,CAACQ,MAAM,CAAC,CAAC;MACxD;MACA;IACJ,CAAC,MAAM,IAAIF,GAAG,CAACC,UAAU,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE;MACvC;IACJ;IACA,MAAMP,KAAK,GAAGK,KAAK,CAACC,GAAG,CAAuB;IAC9C,IAAI,CAACN,KAAK,EAAE;MACR;IACJ;IAEA,MAAMS,MAAM,GAAGH,GAAG,CAACI,OAAO,CAAC,IAAI,EAAE,SAAS,CAAuB;IACjE;IACAL,KAAK,CAACI,MAAM,CAAC,GAAGV,YAAY,CAACM,KAAK,CAACC,GAAG,CAAC,CAAC;IACxC;IACA,OAAOD,KAAK,CAACC,GAAG,CAAC;EACrB;EACA,OAAOD,KAAK;AAChB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"utils/convertWhereCondition.js","sources":["../../src/utils/convertWhereCondition.ts"],"sourcesContent":["import type { IRecordLockingListLockRecordsParams } from \"~/types.js\";\nimport { createLockRecordDatabaseId } from \"~/utils/lockRecordDatabaseId.js\";\n\ntype IWhere = IRecordLockingListLockRecordsParams[\"where\"] | undefined;\n\nconst attachPrefix = (value: string | string[]) => {\n if (Array.isArray(value)) {\n return value.map(createLockRecordDatabaseId);\n }\n return createLockRecordDatabaseId(value);\n};\n\nexport const convertWhereCondition = (where: IWhere): IWhere => {\n if (!where) {\n return where;\n }\n for (const key in where) {\n if (key.startsWith(\"AND\") || key.startsWith(\"OR\")) {\n const value = where[key as keyof typeof where] as IWhere[] | undefined;\n if (!value) {\n continue;\n }\n for (const subKey in value) {\n value[subKey] = convertWhereCondition(value[subKey]);\n }\n continue;\n } else if (key.startsWith(\"id\") === false) {\n continue;\n }\n const value = where[key as keyof typeof where];\n if (!value) {\n continue;\n }\n\n const newKey = key.replace(\"id\", \"entryId\") as keyof typeof where;\n // @ts-expect-error\n where[newKey] = attachPrefix(where[key]);\n // @ts-expect-error\n delete where[key];\n }\n return where;\n};\n"],"names":["attachPrefix","value","Array","createLockRecordDatabaseId","convertWhereCondition","where","key","subKey","newKey"],"mappings":";AAKA,MAAMA,eAAe,CAACC;IAClB,IAAIC,MAAM,OAAO,CAACD,QACd,OAAOA,MAAM,GAAG,CAACE;IAErB,OAAOA,2BAA2BF;AACtC;AAEO,MAAMG,wBAAwB,CAACC;IAClC,IAAI,CAACA,OACD,OAAOA;IAEX,IAAK,MAAMC,OAAOD,MAAO;QACrB,IAAIC,IAAI,UAAU,CAAC,UAAUA,IAAI,UAAU,CAAC,OAAO;YAC/C,MAAML,QAAQI,KAAK,CAACC,IAA0B;YAC9C,IAAI,CAACL,OACD;YAEJ,IAAK,MAAMM,UAAUN,MACjBA,KAAK,CAACM,OAAO,GAAGH,sBAAsBH,KAAK,CAACM,OAAO;YAEvD;QACJ;QAAO,IAAID,AAAyB,UAAzBA,IAAI,UAAU,CAAC,OACtB;QAEJ,MAAML,QAAQI,KAAK,CAACC,IAA0B;QAC9C,IAAI,CAACL,OACD;QAGJ,MAAMO,SAASF,IAAI,OAAO,CAAC,MAAM;QAEjCD,KAAK,CAACG,OAAO,GAAGR,aAAaK,KAAK,CAACC,IAAI;QAEvC,OAAOD,KAAK,CAACC,IAAI;IACrB;IACA,OAAOD;AACX"}
@@ -1,21 +1,14 @@
1
1
  const minTimeoutInSeconds = 30;
2
2
  const defaultTimeoutInSeconds = 60;
3
- /**
4
- * Input is in seconds.
5
- * Output is milliseconds.
6
- */
7
- export const getTimeout = input => {
8
- if (input && input > 0) {
9
- if (input < minTimeoutInSeconds) {
10
- return minTimeoutInSeconds * 1000;
3
+ const getTimeout = (input)=>{
4
+ if (input && input > 0) {
5
+ if (input < minTimeoutInSeconds) return 1000 * minTimeoutInSeconds;
6
+ return 1000 * input;
11
7
  }
12
- return input * 1000;
13
- }
14
- const userDefined = process.env.WEBINY_RECORD_LOCK_TIMEOUT ? parseInt(process.env.WEBINY_RECORD_LOCK_TIMEOUT) : undefined;
15
- if (!userDefined || isNaN(userDefined) || userDefined <= 0) {
16
- return defaultTimeoutInSeconds * 1000;
17
- }
18
- return userDefined * 1000;
8
+ const userDefined = process.env.WEBINY_RECORD_LOCK_TIMEOUT ? parseInt(process.env.WEBINY_RECORD_LOCK_TIMEOUT) : void 0;
9
+ if (!userDefined || isNaN(userDefined) || userDefined <= 0) return 1000 * defaultTimeoutInSeconds;
10
+ return 1000 * userDefined;
19
11
  };
12
+ export { getTimeout };
20
13
 
21
14
  //# sourceMappingURL=getTimeout.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["minTimeoutInSeconds","defaultTimeoutInSeconds","getTimeout","input","userDefined","process","env","WEBINY_RECORD_LOCK_TIMEOUT","parseInt","undefined","isNaN"],"sources":["getTimeout.ts"],"sourcesContent":["const minTimeoutInSeconds = 30;\nconst defaultTimeoutInSeconds = 60;\n/**\n * Input is in seconds.\n * Output is milliseconds.\n */\nexport const getTimeout = (input: number | undefined) => {\n if (input && input > 0) {\n if (input < minTimeoutInSeconds) {\n return minTimeoutInSeconds * 1000;\n }\n return input * 1000;\n }\n const userDefined = process.env.WEBINY_RECORD_LOCK_TIMEOUT\n ? parseInt(process.env.WEBINY_RECORD_LOCK_TIMEOUT)\n : undefined;\n if (!userDefined || isNaN(userDefined) || userDefined <= 0) {\n return defaultTimeoutInSeconds * 1000;\n }\n return userDefined * 1000;\n};\n"],"mappings":"AAAA,MAAMA,mBAAmB,GAAG,EAAE;AAC9B,MAAMC,uBAAuB,GAAG,EAAE;AAClC;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAIC,KAAyB,IAAK;EACrD,IAAIA,KAAK,IAAIA,KAAK,GAAG,CAAC,EAAE;IACpB,IAAIA,KAAK,GAAGH,mBAAmB,EAAE;MAC7B,OAAOA,mBAAmB,GAAG,IAAI;IACrC;IACA,OAAOG,KAAK,GAAG,IAAI;EACvB;EACA,MAAMC,WAAW,GAAGC,OAAO,CAACC,GAAG,CAACC,0BAA0B,GACpDC,QAAQ,CAACH,OAAO,CAACC,GAAG,CAACC,0BAA0B,CAAC,GAChDE,SAAS;EACf,IAAI,CAACL,WAAW,IAAIM,KAAK,CAACN,WAAW,CAAC,IAAIA,WAAW,IAAI,CAAC,EAAE;IACxD,OAAOH,uBAAuB,GAAG,IAAI;EACzC;EACA,OAAOG,WAAW,GAAG,IAAI;AAC7B,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"utils/getTimeout.js","sources":["../../src/utils/getTimeout.ts"],"sourcesContent":["const minTimeoutInSeconds = 30;\nconst defaultTimeoutInSeconds = 60;\n/**\n * Input is in seconds.\n * Output is milliseconds.\n */\nexport const getTimeout = (input: number | undefined) => {\n if (input && input > 0) {\n if (input < minTimeoutInSeconds) {\n return minTimeoutInSeconds * 1000;\n }\n return input * 1000;\n }\n const userDefined = process.env.WEBINY_RECORD_LOCK_TIMEOUT\n ? parseInt(process.env.WEBINY_RECORD_LOCK_TIMEOUT)\n : undefined;\n if (!userDefined || isNaN(userDefined) || userDefined <= 0) {\n return defaultTimeoutInSeconds * 1000;\n }\n return userDefined * 1000;\n};\n"],"names":["minTimeoutInSeconds","defaultTimeoutInSeconds","getTimeout","input","userDefined","process","parseInt","undefined","isNaN"],"mappings":"AAAA,MAAMA,sBAAsB;AAC5B,MAAMC,0BAA0B;AAKzB,MAAMC,aAAa,CAACC;IACvB,IAAIA,SAASA,QAAQ,GAAG;QACpB,IAAIA,QAAQH,qBACR,OAAOA,AAAsB,OAAtBA;QAEX,OAAOG,AAAQ,OAARA;IACX;IACA,MAAMC,cAAcC,QAAQ,GAAG,CAAC,0BAA0B,GACpDC,SAASD,QAAQ,GAAG,CAAC,0BAA0B,IAC/CE;IACN,IAAI,CAACH,eAAeI,MAAMJ,gBAAgBA,eAAe,GACrD,OAAOH,AAA0B,OAA1BA;IAEX,OAAOG,AAAc,OAAdA;AACX"}
@@ -1,16 +1,11 @@
1
1
  import { parseIdentifier } from "@webiny/utils";
2
2
  const WBY_LM_PREFIX = "wby-lm-";
3
- export const createLockRecordDatabaseId = input => {
4
- const {
5
- id
6
- } = parseIdentifier(input);
7
- if (id.startsWith(WBY_LM_PREFIX)) {
8
- return id;
9
- }
10
- return `${WBY_LM_PREFIX}${id}`;
11
- };
12
- export const removeLockRecordDatabasePrefix = id => {
13
- return id.replace(WBY_LM_PREFIX, "");
3
+ const createLockRecordDatabaseId = (input)=>{
4
+ const { id } = parseIdentifier(input);
5
+ if (id.startsWith(WBY_LM_PREFIX)) return id;
6
+ return `${WBY_LM_PREFIX}${id}`;
14
7
  };
8
+ const removeLockRecordDatabasePrefix = (id)=>id.replace(WBY_LM_PREFIX, "");
9
+ export { createLockRecordDatabaseId, removeLockRecordDatabasePrefix };
15
10
 
16
11
  //# sourceMappingURL=lockRecordDatabaseId.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["parseIdentifier","WBY_LM_PREFIX","createLockRecordDatabaseId","input","id","startsWith","removeLockRecordDatabasePrefix","replace"],"sources":["lockRecordDatabaseId.ts"],"sourcesContent":["import { parseIdentifier } from \"@webiny/utils\";\n\nconst WBY_LM_PREFIX = \"wby-lm-\";\n\nexport const createLockRecordDatabaseId = (input: string): string => {\n const { id } = parseIdentifier(input);\n if (id.startsWith(WBY_LM_PREFIX)) {\n return id;\n }\n return `${WBY_LM_PREFIX}${id}`;\n};\n\nexport const removeLockRecordDatabasePrefix = (id: string) => {\n return id.replace(WBY_LM_PREFIX, \"\");\n};\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,eAAe;AAE/C,MAAMC,aAAa,GAAG,SAAS;AAE/B,OAAO,MAAMC,0BAA0B,GAAIC,KAAa,IAAa;EACjE,MAAM;IAAEC;EAAG,CAAC,GAAGJ,eAAe,CAACG,KAAK,CAAC;EACrC,IAAIC,EAAE,CAACC,UAAU,CAACJ,aAAa,CAAC,EAAE;IAC9B,OAAOG,EAAE;EACb;EACA,OAAO,GAAGH,aAAa,GAAGG,EAAE,EAAE;AAClC,CAAC;AAED,OAAO,MAAME,8BAA8B,GAAIF,EAAU,IAAK;EAC1D,OAAOA,EAAE,CAACG,OAAO,CAACN,aAAa,EAAE,EAAE,CAAC;AACxC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"utils/lockRecordDatabaseId.js","sources":["../../src/utils/lockRecordDatabaseId.ts"],"sourcesContent":["import { parseIdentifier } from \"@webiny/utils\";\n\nconst WBY_LM_PREFIX = \"wby-lm-\";\n\nexport const createLockRecordDatabaseId = (input: string): string => {\n const { id } = parseIdentifier(input);\n if (id.startsWith(WBY_LM_PREFIX)) {\n return id;\n }\n return `${WBY_LM_PREFIX}${id}`;\n};\n\nexport const removeLockRecordDatabasePrefix = (id: string) => {\n return id.replace(WBY_LM_PREFIX, \"\");\n};\n"],"names":["WBY_LM_PREFIX","createLockRecordDatabaseId","input","id","parseIdentifier","removeLockRecordDatabasePrefix"],"mappings":";AAEA,MAAMA,gBAAgB;AAEf,MAAMC,6BAA6B,CAACC;IACvC,MAAM,EAAEC,EAAE,EAAE,GAAGC,gBAAgBF;IAC/B,IAAIC,GAAG,UAAU,CAACH,gBACd,OAAOG;IAEX,OAAO,GAAGH,gBAAgBG,IAAI;AAClC;AAEO,MAAME,iCAAiC,CAACF,KACpCA,GAAG,OAAO,CAACH,eAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\nexport * from \"./errors.js\";\nexport * from \"./LockRecord.js\";\nexport * from \"./types.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["GetLockRecordFeature"],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\nexport { GetLockRecordFeature } from \"./feature.js\";\n"],"mappings":"AAAA;AACA,SAASA,oBAAoB","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\nexport * from \"./feature.js\";\n"],"mappings":"AAAA;AACA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\n"],"mappings":"AAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\n"],"mappings":"AAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\nexport * from \"./feature.js\";\n"],"mappings":"AAAA;AACA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\n"],"mappings":"AAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\n"],"mappings":"AAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\n"],"mappings":"AAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\nexport * from \"./events.js\";\nexport * from \"./feature.js\";\n"],"mappings":"AAAA;AACA;AACA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\n"],"mappings":"AAAA","ignoreList":[]}
@@ -1,11 +0,0 @@
1
- import type { IGraphQLSchemaPlugin } from "@webiny/handler-graphql";
2
- import type { ApiCoreContext } from "@webiny/api-core/types/core.js";
3
- import { CmsModel } from "@webiny/api-headless-cms/types/model.js";
4
- import type { CmsFieldTypePlugins } from "@webiny/api-headless-cms/types/index.js";
5
- interface Params {
6
- model: CmsModel;
7
- models: CmsModel[];
8
- fieldTypePlugins: CmsFieldTypePlugins;
9
- }
10
- export declare const createGraphQLSchema: (params: Params) => Promise<IGraphQLSchemaPlugin<ApiCoreContext>>;
11
- export {};
package/graphql/schema.js DELETED
@@ -1,318 +0,0 @@
1
- import { resolve, resolveList } from "./resolve.js";
2
- import { createGraphQLSchemaPlugin } from "@webiny/handler-graphql";
3
- import { renderFields } from "@webiny/api-headless-cms/utils/renderFields.js";
4
- import { renderListFilterFields } from "@webiny/api-headless-cms/utils/renderListFilterFields.js";
5
- import { renderSortEnum } from "@webiny/api-headless-cms/utils/renderSortEnum.js";
6
- import { checkPermissions } from "./checkPermissions.js";
7
- import { IsEntryLockedUseCase } from "../features/IsEntryLocked/abstractions.js";
8
- import { GetLockRecordUseCase } from "../features/GetLockRecord/abstractions.js";
9
- import { GetLockedEntryLockRecordUseCase } from "../features/GetLockedEntryLockRecord/abstractions.js";
10
- import { ListLockRecordsUseCase } from "../features/ListLockRecords/abstractions.js";
11
- import { ListAllLockRecordsUseCase } from "../features/ListAllLockRecords/abstractions.js";
12
- import { LockEntryUseCase } from "../features/LockEntry/abstractions.js";
13
- import { UpdateEntryLockUseCase } from "../features/UpdateEntryLock/abstractions.js";
14
- import { UnlockEntryUseCase } from "../features/UnlockEntry/abstractions.js";
15
- import { UnlockEntryRequestUseCase } from "../features/UnlockEntryRequest/abstractions.js";
16
- export const createGraphQLSchema = async params => {
17
- // Record locking model
18
- const model = params.model;
19
-
20
- // Other public models that have at least one field
21
- const models = params.models.filter(model => {
22
- return model.fields.length > 0;
23
- });
24
- const fieldTypePlugins = params.fieldTypePlugins;
25
- const recordLockingFields = renderFields({
26
- models,
27
- model,
28
- fields: model.fields,
29
- type: "manage",
30
- fieldTypePlugins
31
- });
32
- const listFilterFieldsRender = renderListFilterFields({
33
- model,
34
- fields: model.fields,
35
- type: "manage",
36
- fieldTypePlugins,
37
- excludeFields: ["entryId"]
38
- });
39
- const sortEnumRender = renderSortEnum({
40
- model,
41
- fields: model.fields,
42
- fieldTypePlugins,
43
- sorterPlugins: []
44
- });
45
- const plugin = createGraphQLSchemaPlugin({
46
- typeDefs: /* GraphQL */`
47
- ${recordLockingFields.map(f => f.typeDefs).join("\n")}
48
-
49
- type RecordLockingError {
50
- message: String
51
- code: String
52
- data: JSON
53
- stack: String
54
- }
55
-
56
- enum RecordLockingRecordActionType {
57
- requested
58
- approved
59
- denied
60
- }
61
-
62
- type RecordLockingIdentity {
63
- id: String!
64
- displayName: String
65
- type: String
66
- }
67
-
68
- type RecordLockingRecordAction {
69
- id: ID!
70
- type: RecordLockingRecordActionType!
71
- message: String
72
- createdBy: RecordLockingIdentity!
73
- createdOn: DateTime!
74
- }
75
-
76
- type RecordLockingRecord {
77
- id: ID!
78
- lockedBy: RecordLockingIdentity!
79
- lockedOn: DateTime!
80
- updatedOn: DateTime!
81
- expiresOn: DateTime!
82
- ${recordLockingFields.map(f => f.fields).join("\n")}
83
- }
84
-
85
- type RecordLockingIsEntryLockedResponse {
86
- data: Boolean
87
- error: RecordLockingError
88
- }
89
-
90
- type RecordLockingGetLockRecordResponse {
91
- data: RecordLockingRecord
92
- error: RecordLockingError
93
- }
94
-
95
- type RecordLockingGetLockedEntryLockRecordResponse {
96
- data: RecordLockingRecord
97
- error: RecordLockingError
98
- }
99
-
100
- type RecordLockingListLockRecordsResponse {
101
- data: [RecordLockingRecord!]
102
- error: RecordLockingError
103
- }
104
-
105
- type RecordLockingLockEntryResponse {
106
- data: RecordLockingRecord
107
- error: RecordLockingError
108
- }
109
-
110
- type RecordLockingUpdateLockResponse {
111
- data: RecordLockingRecord
112
- error: RecordLockingError
113
- }
114
-
115
- type RecordLockingUnlockEntryResponse {
116
- data: RecordLockingRecord
117
- error: RecordLockingError
118
- }
119
-
120
- type RecordLockingUnlockEntryRequestResponse {
121
- data: RecordLockingRecord
122
- error: RecordLockingError
123
- }
124
-
125
- input RecordLockingListWhereInput {
126
- ${listFilterFieldsRender.allFiltersAsString()}
127
- }
128
-
129
- enum RecordLockingListSorter {
130
- ${sortEnumRender}
131
- }
132
-
133
- type RecordLockingQuery {
134
- _empty: String
135
- }
136
-
137
- type RecordLockingMutation {
138
- _empty: String
139
- }
140
-
141
- extend type RecordLockingQuery {
142
- isEntryLocked(id: ID!, type: String!): RecordLockingIsEntryLockedResponse!
143
- getLockRecord(id: ID!, type: String!): RecordLockingGetLockRecordResponse!
144
- # Returns lock record or null - if entry is locked in context of the current user, does not throw an error like getLockRecord if no record in the DB
145
- getLockedEntryLockRecord(id: ID!, type: String!): RecordLockingGetLockedEntryLockRecordResponse!
146
- listAllLockRecords(
147
- where: RecordLockingListWhereInput
148
- sort: [RecordLockingListSorter!]
149
- limit: Int
150
- after: String
151
- ): RecordLockingListLockRecordsResponse!
152
- # Basically same as listAllLockRecords except this one will filter out records with expired lock.
153
- listLockRecords(
154
- where: RecordLockingListWhereInput
155
- sort: [RecordLockingListSorter!]
156
- limit: Int
157
- after: String
158
- ): RecordLockingListLockRecordsResponse!
159
- }
160
-
161
- extend type RecordLockingMutation {
162
- lockEntry(id: ID!, type: String!): RecordLockingLockEntryResponse!
163
- updateEntryLock(id: ID!, type: String!): RecordLockingUpdateLockResponse!
164
- unlockEntry(id: ID!, type: String!, force: Boolean): RecordLockingUnlockEntryResponse!
165
- unlockEntryRequest(
166
- id: ID!
167
- type: String!
168
- ): RecordLockingUnlockEntryRequestResponse!
169
- }
170
-
171
- extend type Query {
172
- recordLocking: RecordLockingQuery
173
- }
174
-
175
- extend type Mutation {
176
- recordLocking: RecordLockingMutation
177
- }
178
- `,
179
- resolvers: {
180
- Query: {
181
- recordLocking: async () => ({})
182
- },
183
- Mutation: {
184
- recordLocking: async () => ({})
185
- },
186
- RecordLockingQuery: {
187
- async isEntryLocked(_, args, context) {
188
- return resolve(async () => {
189
- await checkPermissions(context);
190
- const useCase = context.container.resolve(IsEntryLockedUseCase);
191
- const result = await useCase.execute({
192
- id: args.id,
193
- type: args.type
194
- });
195
- if (result.isFail()) {
196
- throw result.error;
197
- }
198
- return result.value;
199
- });
200
- },
201
- async getLockRecord(_, args, context) {
202
- return resolve(async () => {
203
- await checkPermissions(context);
204
- const useCase = context.container.resolve(GetLockRecordUseCase);
205
- const result = await useCase.execute({
206
- id: args.id,
207
- type: args.type
208
- });
209
- if (result.isFail()) {
210
- throw result.error;
211
- }
212
- return result.value;
213
- });
214
- },
215
- async getLockedEntryLockRecord(_, args, context) {
216
- return resolve(async () => {
217
- await checkPermissions(context);
218
- const useCase = context.container.resolve(GetLockedEntryLockRecordUseCase);
219
- const result = await useCase.execute({
220
- id: args.id,
221
- type: args.type
222
- });
223
- // Returns null if not found/expired/locked by current user
224
- if (result.isFail()) {
225
- return null;
226
- }
227
- return result.value;
228
- });
229
- },
230
- async listLockRecords(_, args, context) {
231
- return resolveList(async () => {
232
- await checkPermissions(context);
233
- const useCase = context.container.resolve(ListLockRecordsUseCase);
234
- const result = await useCase.execute(args);
235
- if (result.isFail()) {
236
- throw result.error;
237
- }
238
- return result.value;
239
- });
240
- },
241
- listAllLockRecords(_, args, context) {
242
- return resolveList(async () => {
243
- await checkPermissions(context);
244
- const useCase = context.container.resolve(ListAllLockRecordsUseCase);
245
- const result = await useCase.execute(args);
246
- if (result.isFail()) {
247
- throw result.error;
248
- }
249
- return result.value;
250
- });
251
- }
252
- },
253
- RecordLockingMutation: {
254
- async lockEntry(_, args, context) {
255
- return resolve(async () => {
256
- await checkPermissions(context);
257
- const useCase = context.container.resolve(LockEntryUseCase);
258
- const result = await useCase.execute({
259
- id: args.id,
260
- type: args.type
261
- });
262
- if (result.isFail()) {
263
- throw result.error;
264
- }
265
- return result.value;
266
- });
267
- },
268
- async updateEntryLock(_, args, context) {
269
- return resolve(async () => {
270
- await checkPermissions(context);
271
- const useCase = context.container.resolve(UpdateEntryLockUseCase);
272
- const result = await useCase.execute({
273
- id: args.id,
274
- type: args.type
275
- });
276
- if (result.isFail()) {
277
- throw result.error;
278
- }
279
- return result.value;
280
- });
281
- },
282
- async unlockEntry(_, args, context) {
283
- return resolve(async () => {
284
- await checkPermissions(context);
285
- const useCase = context.container.resolve(UnlockEntryUseCase);
286
- const result = await useCase.execute({
287
- id: args.id,
288
- type: args.type,
289
- force: args.force
290
- });
291
- if (result.isFail()) {
292
- throw result.error;
293
- }
294
- return result.value;
295
- });
296
- },
297
- async unlockEntryRequest(_, args, context) {
298
- return resolve(async () => {
299
- await checkPermissions(context);
300
- const useCase = context.container.resolve(UnlockEntryRequestUseCase);
301
- const result = await useCase.execute({
302
- id: args.id,
303
- type: args.type
304
- });
305
- if (result.isFail()) {
306
- throw result.error;
307
- }
308
- return result.value;
309
- });
310
- }
311
- }
312
- }
313
- });
314
- plugin.name = "recordLocking.graphql.schema.locking";
315
- return plugin;
316
- };
317
-
318
- //# sourceMappingURL=schema.js.map