@punks/backend-entity-manager 0.0.261 → 0.0.263
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/dist/cjs/index.js +10 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/platforms/nest/services/operations/operation-lock.service.d.ts +1 -0
- package/dist/esm/index.js +10 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/platforms/nest/services/operations/operation-lock.service.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import { ILockRepository } from "../../../../abstractions";
|
|
|
2
2
|
import { ExclusiveOperationResult, ExecuteExclusiveInput } from "./types";
|
|
3
3
|
export declare class OperationLockService {
|
|
4
4
|
private readonly operations;
|
|
5
|
+
private readonly logger;
|
|
5
6
|
constructor(operations: ILockRepository);
|
|
6
7
|
executeExclusive: <T>(input: ExecuteExclusiveInput<T>) => Promise<ExclusiveOperationResult<T>>;
|
|
7
8
|
private executeOperation;
|
package/dist/esm/index.js
CHANGED
|
@@ -21851,9 +21851,11 @@ function differenceInMinutes(dateLeft, dateRight, options) {
|
|
|
21851
21851
|
return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
|
|
21852
21852
|
}
|
|
21853
21853
|
|
|
21854
|
-
|
|
21854
|
+
var OperationLockService_1;
|
|
21855
|
+
let OperationLockService = OperationLockService_1 = class OperationLockService {
|
|
21855
21856
|
constructor(operations) {
|
|
21856
21857
|
this.operations = operations;
|
|
21858
|
+
this.logger = Log.getLogger(OperationLockService_1.name);
|
|
21857
21859
|
this.executeExclusive = async (input) => {
|
|
21858
21860
|
const lock = await this.operations.acquire({
|
|
21859
21861
|
lockUid: input.lockUid,
|
|
@@ -21891,9 +21893,15 @@ let OperationLockService = class OperationLockService {
|
|
|
21891
21893
|
this.isLockExpired = (item, refDate, timeoutMinutes) => {
|
|
21892
21894
|
return differenceInMinutes(refDate, item.createdOn) > timeoutMinutes;
|
|
21893
21895
|
};
|
|
21896
|
+
if (!operations) {
|
|
21897
|
+
this.logger.warn(`Cannot resolve locks repository: ${getEntityManagerProviderToken("OperationsLockRepository")}`);
|
|
21898
|
+
}
|
|
21899
|
+
else {
|
|
21900
|
+
this.logger.info(`Resolved locks repository: ${getEntityManagerProviderToken("OperationsLockRepository")}`);
|
|
21901
|
+
}
|
|
21894
21902
|
}
|
|
21895
21903
|
};
|
|
21896
|
-
OperationLockService = __decorate([
|
|
21904
|
+
OperationLockService = OperationLockService_1 = __decorate([
|
|
21897
21905
|
Injectable(),
|
|
21898
21906
|
__param(0, Optional()),
|
|
21899
21907
|
__param(0, Inject(getEntityManagerProviderToken("OperationsLockRepository"))),
|