@webiny/api-record-locking 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.e6f0dc8ca7
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.
- package/README.md +10 -9
- package/domain/LockRecord.d.ts +45 -0
- package/{utils/convertEntryToLockRecord.js → domain/LockRecord.js} +10 -21
- package/domain/LockRecord.js.map +1 -0
- package/domain/RecordLockingModel.d.ts +9 -0
- package/domain/RecordLockingModel.js +29 -0
- package/domain/RecordLockingModel.js.map +1 -0
- package/domain/abstractions.d.ts +18 -0
- package/domain/abstractions.js +10 -0
- package/domain/abstractions.js.map +1 -0
- package/domain/calculateExpiresOn.d.ts +1 -0
- package/domain/calculateExpiresOn.js +9 -0
- package/domain/calculateExpiresOn.js.map +1 -0
- package/domain/errors.d.ts +71 -0
- package/domain/errors.js +95 -0
- package/domain/errors.js.map +1 -0
- package/domain/index.d.ts +4 -0
- package/domain/index.js +6 -0
- package/domain/index.js.map +1 -0
- package/domain/types.d.ts +44 -0
- package/domain/types.js +12 -0
- package/domain/types.js.map +1 -0
- package/features/GetLockRecord/GetLockRecordRepository.d.ts +16 -0
- package/features/GetLockRecord/GetLockRecordRepository.js +37 -0
- package/features/GetLockRecord/GetLockRecordRepository.js.map +1 -0
- package/features/GetLockRecord/GetLockRecordUseCase.d.ts +12 -0
- package/features/GetLockRecord/GetLockRecordUseCase.js +15 -0
- package/features/GetLockRecord/GetLockRecordUseCase.js.map +1 -0
- package/features/GetLockRecord/abstractions.d.ts +41 -0
- package/features/GetLockRecord/abstractions.js +17 -0
- package/features/GetLockRecord/abstractions.js.map +1 -0
- package/features/GetLockRecord/feature.d.ts +4 -0
- package/features/GetLockRecord/feature.js +12 -0
- package/features/GetLockRecord/feature.js.map +1 -0
- package/features/GetLockRecord/index.d.ts +2 -0
- package/features/GetLockRecord/index.js +4 -0
- package/features/GetLockRecord/index.js.map +1 -0
- package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.d.ts +15 -0
- package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js +39 -0
- package/features/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js.map +1 -0
- package/features/GetLockedEntryLockRecord/abstractions.d.ts +26 -0
- package/features/GetLockedEntryLockRecord/abstractions.js +13 -0
- package/features/GetLockedEntryLockRecord/abstractions.js.map +1 -0
- package/features/GetLockedEntryLockRecord/feature.d.ts +4 -0
- package/features/GetLockedEntryLockRecord/feature.js +10 -0
- package/features/GetLockedEntryLockRecord/feature.js.map +1 -0
- package/features/GetLockedEntryLockRecord/index.d.ts +2 -0
- package/features/GetLockedEntryLockRecord/index.js +4 -0
- package/features/GetLockedEntryLockRecord/index.js.map +1 -0
- package/features/IsEntryLocked/IsEntryLockedUseCase.d.ts +14 -0
- package/features/IsEntryLocked/IsEntryLockedUseCase.js +39 -0
- package/features/IsEntryLocked/IsEntryLockedUseCase.js.map +1 -0
- package/features/IsEntryLocked/abstractions.d.ts +24 -0
- package/features/IsEntryLocked/abstractions.js +12 -0
- package/features/IsEntryLocked/abstractions.js.map +1 -0
- package/features/IsEntryLocked/feature.d.ts +4 -0
- package/features/IsEntryLocked/feature.js +10 -0
- package/features/IsEntryLocked/feature.js.map +1 -0
- package/features/IsEntryLocked/index.d.ts +1 -0
- package/features/IsEntryLocked/index.js +3 -0
- package/features/IsEntryLocked/index.js.map +1 -0
- package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.d.ts +15 -0
- package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.js +42 -0
- package/features/KickOutCurrentUser/KickOutCurrentUserUseCase.js.map +1 -0
- package/features/KickOutCurrentUser/abstractions.d.ts +17 -0
- package/features/KickOutCurrentUser/abstractions.js +9 -0
- package/features/KickOutCurrentUser/abstractions.js.map +1 -0
- package/features/KickOutCurrentUser/feature.d.ts +4 -0
- package/features/KickOutCurrentUser/feature.js +10 -0
- package/features/KickOutCurrentUser/feature.js.map +1 -0
- package/features/KickOutCurrentUser/index.d.ts +1 -0
- package/features/KickOutCurrentUser/index.js +3 -0
- package/features/KickOutCurrentUser/index.js.map +1 -0
- package/features/ListAllLockRecords/ListAllLockRecordsRepository.d.ts +16 -0
- package/features/ListAllLockRecords/ListAllLockRecordsRepository.js +43 -0
- package/features/ListAllLockRecords/ListAllLockRecordsRepository.js.map +1 -0
- package/features/ListAllLockRecords/ListAllLockRecordsUseCase.d.ts +11 -0
- package/features/ListAllLockRecords/ListAllLockRecordsUseCase.js +15 -0
- package/features/ListAllLockRecords/ListAllLockRecordsUseCase.js.map +1 -0
- package/features/ListAllLockRecords/abstractions.d.ts +40 -0
- package/features/ListAllLockRecords/abstractions.js +17 -0
- package/features/ListAllLockRecords/abstractions.js.map +1 -0
- package/features/ListAllLockRecords/feature.d.ts +4 -0
- package/features/ListAllLockRecords/feature.js +12 -0
- package/features/ListAllLockRecords/feature.js.map +1 -0
- package/features/ListAllLockRecords/index.d.ts +2 -0
- package/features/ListAllLockRecords/index.js +4 -0
- package/features/ListAllLockRecords/index.js.map +1 -0
- package/features/ListLockRecords/ListLockRecordsRepository.d.ts +15 -0
- package/features/ListLockRecords/ListLockRecordsRepository.js +43 -0
- package/features/ListLockRecords/ListLockRecordsRepository.js.map +1 -0
- package/features/ListLockRecords/ListLockRecordsUseCase.d.ts +15 -0
- package/features/ListLockRecords/ListLockRecordsUseCase.js +30 -0
- package/features/ListLockRecords/ListLockRecordsUseCase.js.map +1 -0
- package/features/ListLockRecords/abstractions.d.ts +45 -0
- package/features/ListLockRecords/abstractions.js +17 -0
- package/features/ListLockRecords/abstractions.js.map +1 -0
- package/features/ListLockRecords/feature.d.ts +4 -0
- package/features/ListLockRecords/feature.js +12 -0
- package/features/ListLockRecords/feature.js.map +1 -0
- package/features/ListLockRecords/index.d.ts +1 -0
- package/features/ListLockRecords/index.js +3 -0
- package/features/ListLockRecords/index.js.map +1 -0
- package/features/LockEntry/LockEntryEventsDecorator.d.ts +14 -0
- package/features/LockEntry/LockEntryEventsDecorator.js +40 -0
- package/features/LockEntry/LockEntryEventsDecorator.js.map +1 -0
- package/features/LockEntry/LockEntryRepository.d.ts +16 -0
- package/features/LockEntry/LockEntryRepository.js +42 -0
- package/features/LockEntry/LockEntryRepository.js.map +1 -0
- package/features/LockEntry/LockEntryUseCase.d.ts +14 -0
- package/features/LockEntry/LockEntryUseCase.js +36 -0
- package/features/LockEntry/LockEntryUseCase.js.map +1 -0
- package/features/LockEntry/abstractions.d.ts +41 -0
- package/features/LockEntry/abstractions.js +17 -0
- package/features/LockEntry/abstractions.js.map +1 -0
- package/features/LockEntry/events.d.ts +45 -0
- package/features/LockEntry/events.js +40 -0
- package/features/LockEntry/events.js.map +1 -0
- package/features/LockEntry/feature.d.ts +4 -0
- package/features/LockEntry/feature.js +14 -0
- package/features/LockEntry/feature.js.map +1 -0
- package/features/LockEntry/index.d.ts +1 -0
- package/features/LockEntry/index.js +3 -0
- package/features/LockEntry/index.js.map +1 -0
- package/features/RecordLockingFeature.d.ts +15 -0
- package/features/RecordLockingFeature.js +36 -0
- package/features/RecordLockingFeature.js.map +1 -0
- package/features/UnlockEntry/UnlockEntryEventsDecorator.d.ts +14 -0
- package/features/UnlockEntry/UnlockEntryEventsDecorator.js +41 -0
- package/features/UnlockEntry/UnlockEntryEventsDecorator.js.map +1 -0
- package/features/UnlockEntry/UnlockEntryRepository.d.ts +14 -0
- package/features/UnlockEntry/UnlockEntryRepository.js +40 -0
- package/features/UnlockEntry/UnlockEntryRepository.js.map +1 -0
- package/features/UnlockEntry/UnlockEntryUseCase.d.ts +18 -0
- package/features/UnlockEntry/UnlockEntryUseCase.js +81 -0
- package/features/UnlockEntry/UnlockEntryUseCase.js.map +1 -0
- package/features/UnlockEntry/abstractions.d.ts +44 -0
- package/features/UnlockEntry/abstractions.js +17 -0
- package/features/UnlockEntry/abstractions.js.map +1 -0
- package/features/UnlockEntry/events.d.ts +46 -0
- package/features/UnlockEntry/events.js +40 -0
- package/features/UnlockEntry/events.js.map +1 -0
- package/features/UnlockEntry/feature.d.ts +4 -0
- package/features/UnlockEntry/feature.js +14 -0
- package/features/UnlockEntry/feature.js.map +1 -0
- package/features/UnlockEntry/hasFullAccessPermission.d.ts +2 -0
- package/features/UnlockEntry/hasFullAccessPermission.js +10 -0
- package/features/UnlockEntry/hasFullAccessPermission.js.map +1 -0
- package/features/UnlockEntry/index.d.ts +1 -0
- package/features/UnlockEntry/index.js +3 -0
- package/features/UnlockEntry/index.js.map +1 -0
- package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.d.ts +14 -0
- package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.js +40 -0
- package/features/UnlockEntryRequest/UnlockEntryRequestEventsDecorator.js.map +1 -0
- package/features/UnlockEntryRequest/UnlockEntryRequestRepository.d.ts +17 -0
- package/features/UnlockEntryRequest/UnlockEntryRequestRepository.js +43 -0
- package/features/UnlockEntryRequest/UnlockEntryRequestRepository.js.map +1 -0
- package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.d.ts +16 -0
- package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.js +92 -0
- package/features/UnlockEntryRequest/UnlockEntryRequestUseCase.js.map +1 -0
- package/features/UnlockEntryRequest/abstractions.d.ts +42 -0
- package/features/UnlockEntryRequest/abstractions.js +17 -0
- package/features/UnlockEntryRequest/abstractions.js.map +1 -0
- package/features/UnlockEntryRequest/events.d.ts +45 -0
- package/features/UnlockEntryRequest/events.js +40 -0
- package/features/UnlockEntryRequest/events.js.map +1 -0
- package/features/UnlockEntryRequest/feature.d.ts +4 -0
- package/features/UnlockEntryRequest/feature.js +14 -0
- package/features/UnlockEntryRequest/feature.js.map +1 -0
- package/features/UnlockEntryRequest/index.d.ts +3 -0
- package/features/UnlockEntryRequest/index.js +5 -0
- package/features/UnlockEntryRequest/index.js.map +1 -0
- package/features/UpdateEntryLock/UpdateEntryLockRepository.d.ts +20 -0
- package/features/UpdateEntryLock/UpdateEntryLockRepository.js +63 -0
- package/features/UpdateEntryLock/UpdateEntryLockRepository.js.map +1 -0
- package/features/UpdateEntryLock/UpdateEntryLockUseCase.d.ts +18 -0
- package/features/UpdateEntryLock/UpdateEntryLockUseCase.js +62 -0
- package/features/UpdateEntryLock/UpdateEntryLockUseCase.js.map +1 -0
- package/features/UpdateEntryLock/abstractions.d.ts +42 -0
- package/features/UpdateEntryLock/abstractions.js +17 -0
- package/features/UpdateEntryLock/abstractions.js.map +1 -0
- package/features/UpdateEntryLock/feature.d.ts +4 -0
- package/features/UpdateEntryLock/feature.js +12 -0
- package/features/UpdateEntryLock/feature.js.map +1 -0
- package/features/UpdateEntryLock/index.d.ts +1 -0
- package/features/UpdateEntryLock/index.js +3 -0
- package/features/UpdateEntryLock/index.js.map +1 -0
- package/graphql/checkPermissions.d.ts +5 -0
- package/graphql/checkPermissions.js +14 -0
- package/graphql/checkPermissions.js.map +1 -0
- package/{utils → graphql}/resolve.d.ts +3 -3
- package/graphql/resolve.js +22 -0
- package/graphql/resolve.js.map +1 -0
- package/graphql/schema.d.ts +7 -3
- package/graphql/schema.js +101 -66
- package/graphql/schema.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +49 -25
- package/index.js.map +1 -1
- package/package.json +25 -26
- package/types.d.ts +3 -132
- package/types.js +2 -20
- package/types.js.map +1 -1
- package/utils/convertWhereCondition.d.ts +1 -1
- package/utils/convertWhereCondition.js +11 -14
- package/utils/convertWhereCondition.js.map +1 -1
- package/utils/getTimeout.js +1 -8
- package/utils/getTimeout.js.map +1 -1
- package/utils/lockRecordDatabaseId.js +4 -12
- package/utils/lockRecordDatabaseId.js.map +1 -1
- package/abstractions/IGetLockRecordUseCase.d.ts +0 -8
- package/abstractions/IGetLockRecordUseCase.js +0 -7
- package/abstractions/IGetLockRecordUseCase.js.map +0 -1
- package/abstractions/IGetLockedEntryLockRecordUseCase.d.ts +0 -8
- package/abstractions/IGetLockedEntryLockRecordUseCase.js +0 -7
- package/abstractions/IGetLockedEntryLockRecordUseCase.js.map +0 -1
- package/abstractions/IIsEntryLocked.d.ts +0 -8
- package/abstractions/IIsEntryLocked.js +0 -7
- package/abstractions/IIsEntryLocked.js.map +0 -1
- package/abstractions/IKickOutCurrentUserUseCase.d.ts +0 -5
- package/abstractions/IKickOutCurrentUserUseCase.js +0 -7
- package/abstractions/IKickOutCurrentUserUseCase.js.map +0 -1
- package/abstractions/IListAllLockRecordsUseCase.d.ts +0 -9
- package/abstractions/IListAllLockRecordsUseCase.js +0 -7
- package/abstractions/IListAllLockRecordsUseCase.js.map +0 -1
- package/abstractions/IListLockRecordsUseCase.d.ts +0 -10
- package/abstractions/IListLockRecordsUseCase.js +0 -7
- package/abstractions/IListLockRecordsUseCase.js.map +0 -1
- package/abstractions/ILockEntryUseCase.d.ts +0 -11
- package/abstractions/ILockEntryUseCase.js +0 -7
- package/abstractions/ILockEntryUseCase.js.map +0 -1
- package/abstractions/IUnlockEntryRequestUseCase.d.ts +0 -11
- package/abstractions/IUnlockEntryRequestUseCase.js +0 -7
- package/abstractions/IUnlockEntryRequestUseCase.js.map +0 -1
- package/abstractions/IUnlockEntryUseCase.d.ts +0 -12
- package/abstractions/IUnlockEntryUseCase.js +0 -7
- package/abstractions/IUnlockEntryUseCase.js.map +0 -1
- package/abstractions/IUpdateEntryLockUseCase.d.ts +0 -11
- package/abstractions/IUpdateEntryLockUseCase.js +0 -7
- package/abstractions/IUpdateEntryLockUseCase.js.map +0 -1
- package/crud/crud.d.ts +0 -7
- package/crud/crud.js +0 -204
- package/crud/crud.js.map +0 -1
- package/crud/model.d.ts +0 -2
- package/crud/model.js +0 -127
- package/crud/model.js.map +0 -1
- package/useCases/GetLockRecord/GetLockRecordUseCase.d.ts +0 -16
- package/useCases/GetLockRecord/GetLockRecordUseCase.js +0 -39
- package/useCases/GetLockRecord/GetLockRecordUseCase.js.map +0 -1
- package/useCases/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.d.ts +0 -16
- package/useCases/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js +0 -29
- package/useCases/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase.js.map +0 -1
- package/useCases/IsEntryLocked/IsEntryLockedUseCase.d.ts +0 -13
- package/useCases/IsEntryLocked/IsEntryLockedUseCase.js +0 -31
- package/useCases/IsEntryLocked/IsEntryLockedUseCase.js.map +0 -1
- package/useCases/KickOutCurrentUser/KickOutCurrentUserUseCase.d.ts +0 -12
- package/useCases/KickOutCurrentUser/KickOutCurrentUserUseCase.js +0 -46
- package/useCases/KickOutCurrentUser/KickOutCurrentUserUseCase.js.map +0 -1
- package/useCases/ListAllLockRecordsUseCase/ListAllLockRecordsUseCase.d.ts +0 -13
- package/useCases/ListAllLockRecordsUseCase/ListAllLockRecordsUseCase.js +0 -34
- package/useCases/ListAllLockRecordsUseCase/ListAllLockRecordsUseCase.js.map +0 -1
- package/useCases/ListLockRecordsUseCase/ListLockRecordsUseCase.d.ts +0 -14
- package/useCases/ListLockRecordsUseCase/ListLockRecordsUseCase.js +0 -27
- package/useCases/ListLockRecordsUseCase/ListLockRecordsUseCase.js.map +0 -1
- package/useCases/LockEntryUseCase/LockEntryUseCase.d.ts +0 -21
- package/useCases/LockEntryUseCase/LockEntryUseCase.js +0 -64
- package/useCases/LockEntryUseCase/LockEntryUseCase.js.map +0 -1
- package/useCases/UnlockEntryUseCase/UnlockEntryUseCase.d.ts +0 -23
- package/useCases/UnlockEntryUseCase/UnlockEntryUseCase.js +0 -90
- package/useCases/UnlockEntryUseCase/UnlockEntryUseCase.js.map +0 -1
- package/useCases/UnlockRequestUseCase/UnlockEntryRequestUseCase.d.ts +0 -21
- package/useCases/UnlockRequestUseCase/UnlockEntryRequestUseCase.js +0 -82
- package/useCases/UnlockRequestUseCase/UnlockEntryRequestUseCase.js.map +0 -1
- package/useCases/UpdateEntryLock/UpdateEntryLockUseCase.d.ts +0 -26
- package/useCases/UpdateEntryLock/UpdateEntryLockUseCase.js +0 -93
- package/useCases/UpdateEntryLock/UpdateEntryLockUseCase.js.map +0 -1
- package/useCases/index.d.ts +0 -31
- package/useCases/index.js +0 -96
- package/useCases/index.js.map +0 -1
- package/useCases/types.d.ts +0 -5
- package/useCases/types.js +0 -7
- package/useCases/types.js.map +0 -1
- package/utils/calculateExpiresOn.d.ts +0 -2
- package/utils/calculateExpiresOn.js +0 -16
- package/utils/calculateExpiresOn.js.map +0 -1
- package/utils/checkPermissions.d.ts +0 -7
- package/utils/checkPermissions.js +0 -21
- package/utils/checkPermissions.js.map +0 -1
- package/utils/convertEntryToLockRecord.d.ts +0 -28
- package/utils/convertEntryToLockRecord.js.map +0 -1
- package/utils/resolve.js +0 -30
- package/utils/resolve.js.map +0 -1
- package/utils/validateSameIdentity.d.ts +0 -6
- package/utils/validateSameIdentity.js +0 -24
- package/utils/validateSameIdentity.js.map +0 -1
package/useCases/index.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createUseCases = void 0;
|
|
7
|
-
var _GetLockRecordUseCase = require("./GetLockRecord/GetLockRecordUseCase");
|
|
8
|
-
var _IsEntryLockedUseCase = require("./IsEntryLocked/IsEntryLockedUseCase");
|
|
9
|
-
var _LockEntryUseCase = require("./LockEntryUseCase/LockEntryUseCase");
|
|
10
|
-
var _UnlockEntryUseCase = require("./UnlockEntryUseCase/UnlockEntryUseCase");
|
|
11
|
-
var _UnlockEntryRequestUseCase = require("./UnlockRequestUseCase/UnlockEntryRequestUseCase");
|
|
12
|
-
var _ListAllLockRecordsUseCase = require("./ListAllLockRecordsUseCase/ListAllLockRecordsUseCase");
|
|
13
|
-
var _ListLockRecordsUseCase = require("./ListLockRecordsUseCase/ListLockRecordsUseCase");
|
|
14
|
-
var _UpdateEntryLockUseCase = require("./UpdateEntryLock/UpdateEntryLockUseCase");
|
|
15
|
-
var _KickOutCurrentUserUseCase = require("./KickOutCurrentUser/KickOutCurrentUserUseCase");
|
|
16
|
-
var _GetLockedEntryLockRecordUseCase = require("./GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase");
|
|
17
|
-
var _convertEntryToLockRecord = require("../utils/convertEntryToLockRecord");
|
|
18
|
-
const createUseCases = params => {
|
|
19
|
-
const {
|
|
20
|
-
getTimeout
|
|
21
|
-
} = params;
|
|
22
|
-
const timeout = getTimeout();
|
|
23
|
-
const convertEntryToLockRecord = entry => {
|
|
24
|
-
return (0, _convertEntryToLockRecord.convertEntryToLockRecord)(entry, timeout);
|
|
25
|
-
};
|
|
26
|
-
const listAllLockRecordsUseCase = new _ListAllLockRecordsUseCase.ListAllLockRecordsUseCase({
|
|
27
|
-
getManager: params.getManager,
|
|
28
|
-
convert: convertEntryToLockRecord
|
|
29
|
-
});
|
|
30
|
-
const listLockRecordsUseCase = new _ListLockRecordsUseCase.ListLockRecordsUseCase({
|
|
31
|
-
listAllLockRecordsUseCase,
|
|
32
|
-
timeout,
|
|
33
|
-
getIdentity: params.getIdentity
|
|
34
|
-
});
|
|
35
|
-
const getLockRecordUseCase = new _GetLockRecordUseCase.GetLockRecordUseCase({
|
|
36
|
-
getManager: params.getManager,
|
|
37
|
-
getSecurity: params.getSecurity,
|
|
38
|
-
convert: convertEntryToLockRecord
|
|
39
|
-
});
|
|
40
|
-
const isEntryLockedUseCase = new _IsEntryLockedUseCase.IsEntryLockedUseCase({
|
|
41
|
-
getLockRecordUseCase,
|
|
42
|
-
getIdentity: params.getIdentity
|
|
43
|
-
});
|
|
44
|
-
const getLockedEntryLockRecordUseCase = new _GetLockedEntryLockRecordUseCase.GetLockedEntryLockRecordUseCase({
|
|
45
|
-
getLockRecordUseCase,
|
|
46
|
-
getIdentity: params.getIdentity
|
|
47
|
-
});
|
|
48
|
-
const lockEntryUseCase = new _LockEntryUseCase.LockEntryUseCase({
|
|
49
|
-
isEntryLockedUseCase,
|
|
50
|
-
getManager: params.getManager,
|
|
51
|
-
getSecurity: params.getSecurity,
|
|
52
|
-
getIdentity: params.getIdentity,
|
|
53
|
-
convert: convertEntryToLockRecord
|
|
54
|
-
});
|
|
55
|
-
const updateEntryLockUseCase = new _UpdateEntryLockUseCase.UpdateEntryLockUseCase({
|
|
56
|
-
getLockRecordUseCase,
|
|
57
|
-
lockEntryUseCase,
|
|
58
|
-
getManager: params.getManager,
|
|
59
|
-
getSecurity: params.getSecurity,
|
|
60
|
-
getIdentity: params.getIdentity,
|
|
61
|
-
convert: convertEntryToLockRecord
|
|
62
|
-
});
|
|
63
|
-
const kickOutCurrentUserUseCase = new _KickOutCurrentUserUseCase.KickOutCurrentUserUseCase({
|
|
64
|
-
getWebsockets: params.getWebsockets,
|
|
65
|
-
getIdentity: params.getIdentity
|
|
66
|
-
});
|
|
67
|
-
const unlockEntryUseCase = new _UnlockEntryUseCase.UnlockEntryUseCase({
|
|
68
|
-
getLockRecordUseCase,
|
|
69
|
-
kickOutCurrentUserUseCase,
|
|
70
|
-
getManager: params.getManager,
|
|
71
|
-
getSecurity: params.getSecurity,
|
|
72
|
-
getIdentity: params.getIdentity,
|
|
73
|
-
hasRecordLockingAccess: params.hasRecordLockingAccess
|
|
74
|
-
});
|
|
75
|
-
const unlockEntryRequestUseCase = new _UnlockEntryRequestUseCase.UnlockEntryRequestUseCase({
|
|
76
|
-
getLockRecordUseCase,
|
|
77
|
-
getIdentity: params.getIdentity,
|
|
78
|
-
getSecurity: params.getSecurity,
|
|
79
|
-
getManager: params.getManager,
|
|
80
|
-
convert: convertEntryToLockRecord
|
|
81
|
-
});
|
|
82
|
-
return {
|
|
83
|
-
listAllLockRecordsUseCase,
|
|
84
|
-
listLockRecordsUseCase,
|
|
85
|
-
getLockRecordUseCase,
|
|
86
|
-
isEntryLockedUseCase,
|
|
87
|
-
getLockedEntryLockRecordUseCase,
|
|
88
|
-
lockEntryUseCase,
|
|
89
|
-
updateEntryLockUseCase,
|
|
90
|
-
unlockEntryUseCase,
|
|
91
|
-
unlockEntryRequestUseCase
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
exports.createUseCases = createUseCases;
|
|
95
|
-
|
|
96
|
-
//# sourceMappingURL=index.js.map
|
package/useCases/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_GetLockRecordUseCase","require","_IsEntryLockedUseCase","_LockEntryUseCase","_UnlockEntryUseCase","_UnlockEntryRequestUseCase","_ListAllLockRecordsUseCase","_ListLockRecordsUseCase","_UpdateEntryLockUseCase","_KickOutCurrentUserUseCase","_GetLockedEntryLockRecordUseCase","_convertEntryToLockRecord","createUseCases","params","getTimeout","timeout","convertEntryToLockRecord","entry","baseConvertEntryToLockRecord","listAllLockRecordsUseCase","ListAllLockRecordsUseCase","getManager","convert","listLockRecordsUseCase","ListLockRecordsUseCase","getIdentity","getLockRecordUseCase","GetLockRecordUseCase","getSecurity","isEntryLockedUseCase","IsEntryLockedUseCase","getLockedEntryLockRecordUseCase","GetLockedEntryLockRecordUseCase","lockEntryUseCase","LockEntryUseCase","updateEntryLockUseCase","UpdateEntryLockUseCase","kickOutCurrentUserUseCase","KickOutCurrentUserUseCase","getWebsockets","unlockEntryUseCase","UnlockEntryUseCase","hasRecordLockingAccess","unlockEntryRequestUseCase","UnlockEntryRequestUseCase","exports"],"sources":["index.ts"],"sourcesContent":["import type {\n IGetIdentity,\n IGetWebsocketsContextCallable,\n IHasRecordLockingAccessCallable,\n IRecordLockingModelManager\n} from \"~/types\";\nimport { GetLockRecordUseCase } from \"./GetLockRecord/GetLockRecordUseCase\";\nimport { IsEntryLockedUseCase } from \"./IsEntryLocked/IsEntryLockedUseCase\";\nimport { LockEntryUseCase } from \"./LockEntryUseCase/LockEntryUseCase\";\nimport { UnlockEntryUseCase } from \"./UnlockEntryUseCase/UnlockEntryUseCase\";\nimport { UnlockEntryRequestUseCase } from \"./UnlockRequestUseCase/UnlockEntryRequestUseCase\";\nimport { ListAllLockRecordsUseCase } from \"./ListAllLockRecordsUseCase/ListAllLockRecordsUseCase\";\nimport { ListLockRecordsUseCase } from \"./ListLockRecordsUseCase/ListLockRecordsUseCase\";\nimport { UpdateEntryLockUseCase } from \"~/useCases/UpdateEntryLock/UpdateEntryLockUseCase\";\nimport { KickOutCurrentUserUseCase } from \"./KickOutCurrentUser/KickOutCurrentUserUseCase\";\nimport { GetLockedEntryLockRecordUseCase } from \"~/useCases/GetLockedEntryLockRecord/GetLockedEntryLockRecordUseCase\";\nimport type { IListAllLockRecordsUseCase } from \"~/abstractions/IListAllLockRecordsUseCase\";\nimport type { IListLockRecordsUseCase } from \"~/abstractions/IListLockRecordsUseCase\";\nimport type { IGetLockRecordUseCase } from \"~/abstractions/IGetLockRecordUseCase\";\nimport type { IIsEntryLockedUseCase } from \"~/abstractions/IIsEntryLocked\";\nimport type { IGetLockedEntryLockRecordUseCase } from \"~/abstractions/IGetLockedEntryLockRecordUseCase\";\nimport type { ILockEntryUseCase } from \"~/abstractions/ILockEntryUseCase\";\nimport type { IUpdateEntryLockUseCase } from \"~/abstractions/IUpdateEntryLockUseCase\";\nimport type { IUnlockEntryUseCase } from \"~/abstractions/IUnlockEntryUseCase\";\nimport type { IUnlockEntryRequestUseCase } from \"~/abstractions/IUnlockEntryRequestUseCase\";\nimport { convertEntryToLockRecord as baseConvertEntryToLockRecord } from \"~/utils/convertEntryToLockRecord\";\nimport type { ConvertEntryToLockRecordCb } from \"~/useCases/types\";\nimport type { Security } from \"@webiny/api-security/types\";\n\nexport interface ICreateUseCasesParams {\n getTimeout: () => number;\n getIdentity: IGetIdentity;\n getManager(): Promise<IRecordLockingModelManager>;\n getSecurity(): Pick<Security, \"withoutAuthorization\">;\n hasRecordLockingAccess: IHasRecordLockingAccessCallable;\n getWebsockets: IGetWebsocketsContextCallable;\n}\n\nexport interface ICreateUseCasesResponse {\n listAllLockRecordsUseCase: IListAllLockRecordsUseCase;\n listLockRecordsUseCase: IListLockRecordsUseCase;\n getLockRecordUseCase: IGetLockRecordUseCase;\n isEntryLockedUseCase: IIsEntryLockedUseCase;\n getLockedEntryLockRecordUseCase: IGetLockedEntryLockRecordUseCase;\n lockEntryUseCase: ILockEntryUseCase;\n updateEntryLockUseCase: IUpdateEntryLockUseCase;\n unlockEntryUseCase: IUnlockEntryUseCase;\n unlockEntryRequestUseCase: IUnlockEntryRequestUseCase;\n}\n\nexport const createUseCases = (params: ICreateUseCasesParams): ICreateUseCasesResponse => {\n const { getTimeout } = params;\n const timeout = getTimeout();\n\n const convertEntryToLockRecord: ConvertEntryToLockRecordCb = entry => {\n return baseConvertEntryToLockRecord(entry, timeout);\n };\n\n const listAllLockRecordsUseCase = new ListAllLockRecordsUseCase({\n getManager: params.getManager,\n convert: convertEntryToLockRecord\n });\n\n const listLockRecordsUseCase = new ListLockRecordsUseCase({\n listAllLockRecordsUseCase,\n timeout,\n getIdentity: params.getIdentity\n });\n\n const getLockRecordUseCase = new GetLockRecordUseCase({\n getManager: params.getManager,\n getSecurity: params.getSecurity,\n convert: convertEntryToLockRecord\n });\n\n const isEntryLockedUseCase = new IsEntryLockedUseCase({\n getLockRecordUseCase,\n getIdentity: params.getIdentity\n });\n\n const getLockedEntryLockRecordUseCase = new GetLockedEntryLockRecordUseCase({\n getLockRecordUseCase,\n getIdentity: params.getIdentity\n });\n\n const lockEntryUseCase = new LockEntryUseCase({\n isEntryLockedUseCase,\n getManager: params.getManager,\n getSecurity: params.getSecurity,\n getIdentity: params.getIdentity,\n convert: convertEntryToLockRecord\n });\n\n const updateEntryLockUseCase = new UpdateEntryLockUseCase({\n getLockRecordUseCase,\n lockEntryUseCase,\n getManager: params.getManager,\n getSecurity: params.getSecurity,\n getIdentity: params.getIdentity,\n convert: convertEntryToLockRecord\n });\n\n const kickOutCurrentUserUseCase = new KickOutCurrentUserUseCase({\n getWebsockets: params.getWebsockets,\n getIdentity: params.getIdentity\n });\n\n const unlockEntryUseCase = new UnlockEntryUseCase({\n getLockRecordUseCase,\n kickOutCurrentUserUseCase,\n getManager: params.getManager,\n getSecurity: params.getSecurity,\n getIdentity: params.getIdentity,\n hasRecordLockingAccess: params.hasRecordLockingAccess\n });\n\n const unlockEntryRequestUseCase = new UnlockEntryRequestUseCase({\n getLockRecordUseCase,\n getIdentity: params.getIdentity,\n getSecurity: params.getSecurity,\n getManager: params.getManager,\n convert: convertEntryToLockRecord\n });\n\n return {\n listAllLockRecordsUseCase,\n listLockRecordsUseCase,\n getLockRecordUseCase,\n isEntryLockedUseCase,\n getLockedEntryLockRecordUseCase,\n lockEntryUseCase,\n updateEntryLockUseCase,\n unlockEntryUseCase,\n unlockEntryRequestUseCase\n };\n};\n"],"mappings":";;;;;;AAMA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,0BAAA,GAAAJ,OAAA;AACA,IAAAK,0BAAA,GAAAL,OAAA;AACA,IAAAM,uBAAA,GAAAN,OAAA;AACA,IAAAO,uBAAA,GAAAP,OAAA;AACA,IAAAQ,0BAAA,GAAAR,OAAA;AACA,IAAAS,gCAAA,GAAAT,OAAA;AAUA,IAAAU,yBAAA,GAAAV,OAAA;AAyBO,MAAMW,cAAc,GAAIC,MAA6B,IAA8B;EACtF,MAAM;IAAEC;EAAW,CAAC,GAAGD,MAAM;EAC7B,MAAME,OAAO,GAAGD,UAAU,CAAC,CAAC;EAE5B,MAAME,wBAAoD,GAAGC,KAAK,IAAI;IAClE,OAAO,IAAAC,kDAA4B,EAACD,KAAK,EAAEF,OAAO,CAAC;EACvD,CAAC;EAED,MAAMI,yBAAyB,GAAG,IAAIC,oDAAyB,CAAC;IAC5DC,UAAU,EAAER,MAAM,CAACQ,UAAU;IAC7BC,OAAO,EAAEN;EACb,CAAC,CAAC;EAEF,MAAMO,sBAAsB,GAAG,IAAIC,8CAAsB,CAAC;IACtDL,yBAAyB;IACzBJ,OAAO;IACPU,WAAW,EAAEZ,MAAM,CAACY;EACxB,CAAC,CAAC;EA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AAE7B,MAAM,CAAC6B;EACnC,CAAC,CAAC;EAEF,MAAMC,yBAAyB,GAAG,IAAIC,oDAAyB,CAAC;IAC5DlB,oBAAoB;IACpBD,WAAW,EAAEZ,MAAM,CAACY,WAAW;IAC/BG,WAAW,EAAEf,MAAM,CAACe,WAAW;IAC/BP,UAAU,EAAER,MAAM,CAACQ,UAAU;IAC7BC,OAAO,EAAEN;EACb,CAAC,CAAC;EAEF,OAAO;IACHG,yBAAyB;IACzBI,sBAAsB;IACtBG,oBAAoB;IACpBG,oBAAoB;IACpBE,+BAA+B;IAC/BE,gBAAgB;IAChBE,sBAAsB;IACtBK,kBAAkB;IAClBG;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAAjC,cAAA,GAAAA,cAAA","ignoreList":[]}
|
package/useCases/types.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { CmsEntry } from "@webiny/api-headless-cms/types";
|
|
2
|
-
import type { IRecordLockingLockRecord, IRecordLockingLockRecordValues } from "../types";
|
|
3
|
-
export interface ConvertEntryToLockRecordCb {
|
|
4
|
-
(entry: CmsEntry<IRecordLockingLockRecordValues>): IRecordLockingLockRecord;
|
|
5
|
-
}
|
package/useCases/types.js
DELETED
package/useCases/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { CmsEntry } from \"@webiny/api-headless-cms/types\";\nimport type { IRecordLockingLockRecord, IRecordLockingLockRecordValues } from \"~/types\";\n\nexport interface ConvertEntryToLockRecordCb {\n (entry: CmsEntry<IRecordLockingLockRecordValues>): IRecordLockingLockRecord;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.calculateExpiresOn = void 0;
|
|
7
|
-
const calculateExpiresOn = (input, timeout) => {
|
|
8
|
-
if (!input.savedOn) {
|
|
9
|
-
throw new Error("Missing savedOn property.");
|
|
10
|
-
}
|
|
11
|
-
const savedOn = new Date(input.savedOn);
|
|
12
|
-
return new Date(savedOn.getTime() + timeout);
|
|
13
|
-
};
|
|
14
|
-
exports.calculateExpiresOn = calculateExpiresOn;
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=calculateExpiresOn.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["calculateExpiresOn","input","timeout","savedOn","Error","Date","getTime","exports"],"sources":["calculateExpiresOn.ts"],"sourcesContent":["import type { IHeadlessCmsLockRecordParams } from \"./convertEntryToLockRecord\";\n\nexport const calculateExpiresOn = (\n input: Pick<IHeadlessCmsLockRecordParams, \"savedOn\">,\n timeout: number\n): Date => {\n if (!input.savedOn) {\n throw new Error(\"Missing savedOn property.\");\n }\n const savedOn = new Date(input.savedOn);\n\n return new Date(savedOn.getTime() + timeout);\n};\n"],"mappings":";;;;;;AAEO,MAAMA,kBAAkB,GAAGA,CAC9BC,KAAoD,EACpDC,OAAe,KACR;EACP,IAAI,CAACD,KAAK,CAACE,OAAO,EAAE;IAChB,MAAM,IAAIC,KAAK,CAAC,2BAA2B,CAAC;EAChD;EACA,MAAMD,OAAO,GAAG,IAAIE,IAAI,CAACJ,KAAK,CAACE,OAAO,CAAC;EAEvC,OAAO,IAAIE,IAAI,CAACF,OAAO,CAACG,OAAO,CAAC,CAAC,GAAGJ,OAAO,CAAC;AAChD,CAAC;AAACK,OAAA,CAAAP,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.checkPermissions = void 0;
|
|
7
|
-
var _apiSecurity = require("@webiny/api-security");
|
|
8
|
-
/**
|
|
9
|
-
* Simple permission check. Only full access can access the websockets API via GraphQL - ({name: "*"})
|
|
10
|
-
*
|
|
11
|
-
* @throws
|
|
12
|
-
*/
|
|
13
|
-
const checkPermissions = async context => {
|
|
14
|
-
const identity = context.security.getIdentity();
|
|
15
|
-
if (!identity.id) {
|
|
16
|
-
throw new _apiSecurity.NotAuthorizedError();
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
exports.checkPermissions = checkPermissions;
|
|
20
|
-
|
|
21
|
-
//# sourceMappingURL=checkPermissions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_apiSecurity","require","checkPermissions","context","identity","security","getIdentity","id","NotAuthorizedError","exports"],"sources":["checkPermissions.ts"],"sourcesContent":["import { NotAuthorizedError } from \"@webiny/api-security\";\nimport type { Context } from \"~/types\";\n\n/**\n * Simple permission check. Only full access can access the websockets API via GraphQL - ({name: \"*\"})\n *\n * @throws\n */\nexport const checkPermissions = async (context: Pick<Context, \"security\">): Promise<void> => {\n const identity = context.security.getIdentity();\n if (!identity.id) {\n throw new NotAuthorizedError();\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACO,MAAMC,gBAAgB,GAAG,MAAOC,OAAkC,IAAoB;EACzF,MAAMC,QAAQ,GAAGD,OAAO,CAACE,QAAQ,CAACC,WAAW,CAAC,CAAC;EAC/C,IAAI,CAACF,QAAQ,CAACG,EAAE,EAAE;IACd,MAAM,IAAIC,+BAAkB,CAAC,CAAC;EAClC;AACJ,CAAC;AAACC,OAAA,CAAAP,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { CmsEntry, IRecordLockingIdentity, IRecordLockingLockRecord, IRecordLockingLockRecordAction, IRecordLockingLockRecordApprovedAction, IRecordLockingLockRecordDeniedAction, IRecordLockingLockRecordEntryType, IRecordLockingLockRecordObject, IRecordLockingLockRecordRequestedAction, IRecordLockingLockRecordValues } from "../types";
|
|
2
|
-
export declare const convertEntryToLockRecord: (entry: CmsEntry<IRecordLockingLockRecordValues>, timeout: number) => IRecordLockingLockRecord;
|
|
3
|
-
export type IHeadlessCmsLockRecordParams = Pick<CmsEntry<IRecordLockingLockRecordValues>, "entryId" | "values" | "createdBy" | "createdOn" | "savedOn">;
|
|
4
|
-
export declare class HeadlessCmsLockRecord implements IRecordLockingLockRecord {
|
|
5
|
-
private readonly _id;
|
|
6
|
-
private readonly _targetId;
|
|
7
|
-
private readonly _type;
|
|
8
|
-
private readonly _lockedBy;
|
|
9
|
-
private readonly _lockedOn;
|
|
10
|
-
private readonly _updatedOn;
|
|
11
|
-
private readonly _expiresOn;
|
|
12
|
-
private _actions?;
|
|
13
|
-
get id(): string;
|
|
14
|
-
get targetId(): string;
|
|
15
|
-
get type(): IRecordLockingLockRecordEntryType;
|
|
16
|
-
get lockedBy(): IRecordLockingIdentity;
|
|
17
|
-
get lockedOn(): Date;
|
|
18
|
-
get updatedOn(): Date;
|
|
19
|
-
get expiresOn(): Date;
|
|
20
|
-
get actions(): IRecordLockingLockRecordAction[] | undefined;
|
|
21
|
-
constructor(input: IHeadlessCmsLockRecordParams, timeout: number);
|
|
22
|
-
toObject(): IRecordLockingLockRecordObject;
|
|
23
|
-
addAction(action: IRecordLockingLockRecordAction): void;
|
|
24
|
-
getUnlockRequested(): IRecordLockingLockRecordRequestedAction | undefined;
|
|
25
|
-
getUnlockApproved(): IRecordLockingLockRecordApprovedAction | undefined;
|
|
26
|
-
getUnlockDenied(): IRecordLockingLockRecordDeniedAction | undefined;
|
|
27
|
-
isExpired(): boolean;
|
|
28
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_types","require","_lockRecordDatabaseId","_calculateExpiresOn","convertEntryToLockRecord","entry","timeout","HeadlessCmsLockRecord","exports","id","_id","targetId","_targetId","type","_type","lockedBy","_lockedBy","lockedOn","_lockedOn","updatedOn","_updatedOn","expiresOn","_expiresOn","actions","_actions","constructor","input","removeLockRecordDatabasePrefix","entryId","values","createdBy","Date","createdOn","savedOn","calculateExpiresOn","toObject","addAction","action","push","getUnlockRequested","length","undefined","find","RecordLockingLockRecordActionType","requested","getUnlockApproved","approved","getUnlockDenied","denied","isExpired","getTime"],"sources":["convertEntryToLockRecord.ts"],"sourcesContent":["import type {\n CmsEntry,\n IRecordLockingIdentity,\n IRecordLockingLockRecord,\n IRecordLockingLockRecordAction,\n IRecordLockingLockRecordApprovedAction,\n IRecordLockingLockRecordDeniedAction,\n IRecordLockingLockRecordEntryType,\n IRecordLockingLockRecordObject,\n IRecordLockingLockRecordRequestedAction,\n IRecordLockingLockRecordValues\n} from \"~/types\";\nimport { RecordLockingLockRecordActionType } from \"~/types\";\nimport { removeLockRecordDatabasePrefix } from \"~/utils/lockRecordDatabaseId\";\nimport { calculateExpiresOn } from \"~/utils/calculateExpiresOn\";\n\nexport const convertEntryToLockRecord = (\n entry: CmsEntry<IRecordLockingLockRecordValues>,\n timeout: number\n): IRecordLockingLockRecord => {\n return new HeadlessCmsLockRecord(entry, timeout);\n};\n\nexport type IHeadlessCmsLockRecordParams = Pick<\n CmsEntry<IRecordLockingLockRecordValues>,\n \"entryId\" | \"values\" | \"createdBy\" | \"createdOn\" | \"savedOn\"\n>;\n\nexport class HeadlessCmsLockRecord implements IRecordLockingLockRecord {\n private readonly _id: string;\n private readonly _targetId: string;\n private readonly _type: IRecordLockingLockRecordEntryType;\n private readonly _lockedBy: IRecordLockingIdentity;\n private readonly _lockedOn: Date;\n private readonly _updatedOn: Date;\n private readonly _expiresOn: Date;\n private _actions?: IRecordLockingLockRecordAction[];\n\n public get id(): string {\n return this._id;\n }\n\n public get targetId(): string {\n return this._targetId;\n }\n\n public get type(): IRecordLockingLockRecordEntryType {\n return this._type;\n }\n\n public get lockedBy(): IRecordLockingIdentity {\n return this._lockedBy;\n }\n\n public get lockedOn(): Date {\n return this._lockedOn;\n }\n\n public get updatedOn(): Date {\n return this._updatedOn;\n }\n\n public get expiresOn(): Date {\n return this._expiresOn;\n }\n\n public get actions(): IRecordLockingLockRecordAction[] | undefined {\n return this._actions;\n }\n\n public constructor(input: IHeadlessCmsLockRecordParams, timeout: number) {\n this._id = removeLockRecordDatabasePrefix(input.entryId);\n this._targetId = input.values.targetId;\n this._type = input.values.type;\n this._lockedBy = input.createdBy;\n this._lockedOn = new Date(input.createdOn);\n this._updatedOn = new Date(input.savedOn);\n this._expiresOn = calculateExpiresOn(input, timeout);\n this._actions = input.values.actions;\n }\n\n public toObject(): IRecordLockingLockRecordObject {\n return {\n id: this._id,\n targetId: this._targetId,\n type: this._type,\n lockedBy: this._lockedBy,\n lockedOn: this._lockedOn,\n updatedOn: this._updatedOn,\n expiresOn: this._expiresOn,\n actions: this._actions\n };\n }\n\n public addAction(action: IRecordLockingLockRecordAction) {\n if (!this._actions) {\n this._actions = [];\n }\n this._actions.push(action);\n }\n\n public getUnlockRequested(): IRecordLockingLockRecordRequestedAction | undefined {\n if (!this._actions?.length) {\n return undefined;\n }\n return this._actions.find(\n (action): action is IRecordLockingLockRecordRequestedAction =>\n action.type === RecordLockingLockRecordActionType.requested\n );\n }\n\n public getUnlockApproved(): IRecordLockingLockRecordApprovedAction | undefined {\n if (!this._actions?.length) {\n return undefined;\n }\n return this._actions.find(\n (action): action is IRecordLockingLockRecordApprovedAction =>\n action.type === RecordLockingLockRecordActionType.approved\n );\n }\n\n public getUnlockDenied(): IRecordLockingLockRecordDeniedAction | undefined {\n if (!this._actions?.length) {\n return undefined;\n }\n return this._actions.find(\n (action): action is IRecordLockingLockRecordDeniedAction =>\n action.type === RecordLockingLockRecordActionType.denied\n );\n }\n\n public isExpired(): boolean {\n return this._expiresOn.getTime() < new Date().getTime();\n }\n}\n"],"mappings":";;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAEO,MAAMG,wBAAwB,GAAGA,CACpCC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O,IAAI,CAACjB,QAAQ,CAACkB,IAAI,CACpBL,MAAM,IACHA,MAAM,CAACxB,IAAI,KAAK8B,wCAAiC,CAACK,MAC1D,CAAC;EACL;EAEOC,SAASA,CAAA,EAAY;IACxB,OAAO,IAAI,CAAC3B,UAAU,CAAC4B,OAAO,CAAC,CAAC,GAAG,IAAInB,IAAI,CAAC,CAAC,CAACmB,OAAO,CAAC,CAAC;EAC3D;AACJ;AAAC1C,OAAA,CAAAD,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
package/utils/resolve.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.resolveList = exports.resolve = void 0;
|
|
7
|
-
var _handlerGraphql = require("@webiny/handler-graphql");
|
|
8
|
-
const resolve = async cb => {
|
|
9
|
-
try {
|
|
10
|
-
const result = await cb();
|
|
11
|
-
return new _handlerGraphql.Response(result);
|
|
12
|
-
} catch (ex) {
|
|
13
|
-
return new _handlerGraphql.ErrorResponse(ex);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
exports.resolve = resolve;
|
|
17
|
-
const resolveList = async cb => {
|
|
18
|
-
try {
|
|
19
|
-
const {
|
|
20
|
-
items,
|
|
21
|
-
meta
|
|
22
|
-
} = await cb();
|
|
23
|
-
return new _handlerGraphql.ListResponse(items, meta);
|
|
24
|
-
} catch (ex) {
|
|
25
|
-
return new _handlerGraphql.ListErrorResponse(ex);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
exports.resolveList = resolveList;
|
|
29
|
-
|
|
30
|
-
//# sourceMappingURL=resolve.js.map
|
package/utils/resolve.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_handlerGraphql","require","resolve","cb","result","Response","ex","ErrorResponse","exports","resolveList","items","meta","ListResponse","ListErrorResponse"],"sources":["resolve.ts"],"sourcesContent":["import { ErrorResponse, ListErrorResponse, ListResponse, Response } from \"@webiny/handler-graphql\";\nimport type { IRecordLockingMeta } from \"~/types\";\n\nexport const resolve = async <T>(cb: () => Promise<T>): Promise<Response<T> | ErrorResponse> => {\n try {\n const result = await cb();\n return new Response<T>(result);\n } catch (ex) {\n return new ErrorResponse(ex);\n }\n};\n\nexport interface IListResponse<T> {\n items: T[];\n meta: IRecordLockingMeta;\n}\n\nexport const resolveList = async <T>(\n cb: () => Promise<IListResponse<T>>\n): Promise<Response<T[]> | ErrorResponse> => {\n try {\n const { items, meta } = await cb();\n return new ListResponse(items, meta);\n } catch (ex) {\n return new ListErrorResponse(ex);\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAGO,MAAMC,OAAO,GAAG,MAAUC,EAAoB,IAA2C;EAC5F,IAAI;IACA,MAAMC,MAAM,GAAG,MAAMD,EAAE,CAAC,CAAC;IACzB,OAAO,IAAIE,wBAAQ,CAAID,MAAM,CAAC;EAClC,CAAC,CAAC,OAAOE,EAAE,EAAE;IACT,OAAO,IAAIC,6BAAa,CAACD,EAAE,CAAC;EAChC;AACJ,CAAC;AAACE,OAAA,CAAAN,OAAA,GAAAA,OAAA;AAOK,MAAMO,WAAW,GAAG,MACvBN,EAAmC,IACM;EACzC,IAAI;IACA,MAAM;MAAEO,KAAK;MAAEC;IAAK,CAAC,GAAG,MAAMR,EAAE,CAAC,CAAC;IAClC,OAAO,IAAIS,4BAAY,CAACF,KAAK,EAAEC,IAAI,CAAC;EACxC,CAAC,CAAC,OAAOL,EAAE,EAAE;IACT,OAAO,IAAIO,iCAAiB,CAACP,EAAE,CAAC;EACpC;AACJ,CAAC;AAACE,OAAA,CAAAC,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { IRecordLockingIdentity } from "../types";
|
|
2
|
-
export interface IValidateSameIdentityParams {
|
|
3
|
-
getIdentity: () => Pick<IRecordLockingIdentity, "id">;
|
|
4
|
-
target: Pick<IRecordLockingIdentity, "id">;
|
|
5
|
-
}
|
|
6
|
-
export declare const validateSameIdentity: (params: IValidateSameIdentityParams) => void;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.validateSameIdentity = void 0;
|
|
7
|
-
var _apiSecurity = require("@webiny/api-security");
|
|
8
|
-
const validateSameIdentity = params => {
|
|
9
|
-
const {
|
|
10
|
-
getIdentity,
|
|
11
|
-
target
|
|
12
|
-
} = params;
|
|
13
|
-
const identity = getIdentity();
|
|
14
|
-
if (identity.id === target.id) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
throw new _apiSecurity.NotAuthorizedError({
|
|
18
|
-
message: "Cannot update lock record. Record is locked by another user.",
|
|
19
|
-
code: "LOCK_UPDATE_ERROR"
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
exports.validateSameIdentity = validateSameIdentity;
|
|
23
|
-
|
|
24
|
-
//# sourceMappingURL=validateSameIdentity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_apiSecurity","require","validateSameIdentity","params","getIdentity","target","identity","id","NotAuthorizedError","message","code","exports"],"sources":["validateSameIdentity.ts"],"sourcesContent":["import { NotAuthorizedError } from \"@webiny/api-security\";\nimport type { IRecordLockingIdentity } from \"~/types\";\n\nexport interface IValidateSameIdentityParams {\n getIdentity: () => Pick<IRecordLockingIdentity, \"id\">;\n target: Pick<IRecordLockingIdentity, \"id\">;\n}\n\nexport const validateSameIdentity = (params: IValidateSameIdentityParams): void => {\n const { getIdentity, target } = params;\n const identity = getIdentity();\n if (identity.id === target.id) {\n return;\n }\n throw new NotAuthorizedError({\n message: \"Cannot update lock record. Record is locked by another user.\",\n code: \"LOCK_UPDATE_ERROR\"\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQO,MAAMC,oBAAoB,GAAIC,MAAmC,IAAW;EAC/E,MAAM;IAAEC,WAAW;IAAEC;EAAO,CAAC,GAAGF,MAAM;EACtC,MAAMG,QAAQ,GAAGF,WAAW,CAAC,CAAC;EAC9B,IAAIE,QAAQ,CAACC,EAAE,KAAKF,MAAM,CAACE,EAAE,EAAE;IAC3B;EACJ;EACA,MAAM,IAAIC,+BAAkB,CAAC;IACzBC,OAAO,EAAE,8DAA8D;IACvEC,IAAI,EAAE;EACV,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAT,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|