@monorise/core 0.1.2 → 0.1.3
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/base/utils/index.js +2 -9
- package/dist/base/utils/index.js.map +1 -1
- package/dist/core/controllers/entity/create-entity.controller.js +39 -32
- package/dist/core/controllers/entity/create-entity.controller.js.map +1 -1
- package/dist/core/controllers/entity/delete-entity.controller.js +26 -20
- package/dist/core/controllers/entity/delete-entity.controller.js.map +1 -1
- package/dist/core/controllers/entity/get-entity-by-unique-field-value.controller.js +25 -17
- package/dist/core/controllers/entity/get-entity-by-unique-field-value.controller.js.map +1 -1
- package/dist/core/controllers/entity/get-entity.controller.js +25 -17
- package/dist/core/controllers/entity/get-entity.controller.js.map +1 -1
- package/dist/core/controllers/entity/list-entities.controller.js +39 -36
- package/dist/core/controllers/entity/list-entities.controller.js.map +1 -1
- package/dist/core/controllers/entity/update-entity.controller.js +40 -33
- package/dist/core/controllers/entity/update-entity.controller.js.map +1 -1
- package/dist/core/controllers/entity/upsert-entity.controller.js +64 -59
- package/dist/core/controllers/entity/upsert-entity.controller.js.map +1 -1
- package/dist/core/controllers/mutual/create-mutual.controller.js +42 -38
- package/dist/core/controllers/mutual/create-mutual.controller.js.map +1 -1
- package/dist/core/controllers/mutual/delete-mutual.controller.js +28 -22
- package/dist/core/controllers/mutual/delete-mutual.controller.js.map +1 -1
- package/dist/core/controllers/mutual/get-mutual.controller.js +25 -17
- package/dist/core/controllers/mutual/get-mutual.controller.js.map +1 -1
- package/dist/core/controllers/mutual/list-entities-by-entity.controller.js +52 -44
- package/dist/core/controllers/mutual/list-entities-by-entity.controller.js.map +1 -1
- package/dist/core/controllers/mutual/update-mutual.controller.js +38 -32
- package/dist/core/controllers/mutual/update-mutual.controller.js.map +1 -1
- package/dist/core/controllers/tag/list-tags.controller.js +39 -31
- package/dist/core/controllers/tag/list-tags.controller.js.map +1 -1
- package/dist/core/data/DbUtils.js +23 -12
- package/dist/core/data/DbUtils.js.map +1 -1
- package/dist/core/data/Entity.js +298 -334
- package/dist/core/data/Entity.js.map +1 -1
- package/dist/core/data/EventUtils.js +35 -27
- package/dist/core/data/EventUtils.js.map +1 -1
- package/dist/core/data/Mutual.js +282 -342
- package/dist/core/data/Mutual.js.map +1 -1
- package/dist/core/data/Tag.js +225 -228
- package/dist/core/data/Tag.js.map +1 -1
- package/dist/core/data/abstract/Repository.base.js +4 -7
- package/dist/core/data/abstract/Repository.base.js.map +1 -1
- package/dist/core/errors/extendable-error.js +0 -7
- package/dist/core/errors/extendable-error.js.map +1 -1
- package/dist/core/errors/standard-error.js +0 -3
- package/dist/core/errors/standard-error.js.map +1 -1
- package/dist/core/helpers/event.js +35 -34
- package/dist/core/helpers/event.js.map +1 -1
- package/dist/core/helpers/test/test-utils.js +60 -58
- package/dist/core/helpers/test/test-utils.js.map +1 -1
- package/dist/core/index.js +0 -8
- package/dist/core/index.js.map +1 -1
- package/dist/core/processors/create-entity-processor.js +12 -3
- package/dist/core/processors/create-entity-processor.js.map +1 -1
- package/dist/core/processors/mutual-processor.js +33 -23
- package/dist/core/processors/mutual-processor.js.map +1 -1
- package/dist/core/processors/prejoin-processor.js +117 -105
- package/dist/core/processors/prejoin-processor.js.map +1 -1
- package/dist/core/processors/replication-processor.js +27 -26
- package/dist/core/processors/replication-processor.js.map +1 -1
- package/dist/core/processors/tag-processor.js +47 -35
- package/dist/core/processors/tag-processor.js.map +1 -1
- package/dist/core/services/DependencyContainer.js +0 -4
- package/dist/core/services/DependencyContainer.js.map +1 -1
- package/dist/core/services/entity-service-lifecycle.js +29 -20
- package/dist/core/services/entity-service-lifecycle.js.map +1 -1
- package/dist/core/services/entity.service.js +95 -92
- package/dist/core/services/entity.service.js.map +1 -1
- package/dist/core/services/mutual.service.js +117 -113
- package/dist/core/services/mutual.service.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,31 +1,40 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import { EVENT } from '../types/event';
|
|
2
11
|
export class EntityServiceLifeCycle {
|
|
3
|
-
EntityConfig;
|
|
4
|
-
publishEvent;
|
|
5
|
-
eventUtils;
|
|
6
12
|
constructor(EntityConfig, publishEvent, eventUtils) {
|
|
7
13
|
this.EntityConfig = EntityConfig;
|
|
8
14
|
this.publishEvent = publishEvent;
|
|
9
15
|
this.eventUtils = eventUtils;
|
|
10
16
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
afterCreateEntityHook(entity, entityPayload, accountId) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
var _a;
|
|
20
|
+
const mutualSchema = (_a = this.EntityConfig[entity.entityType].mutual) === null || _a === void 0 ? void 0 : _a.mutualSchema;
|
|
21
|
+
const parsedMutualPayload = mutualSchema === null || mutualSchema === void 0 ? void 0 : mutualSchema.parse(entityPayload);
|
|
22
|
+
if (parsedMutualPayload) {
|
|
23
|
+
yield this.eventUtils.publishCreateMutualsEvent({
|
|
24
|
+
entity,
|
|
25
|
+
mutualPayload: parsedMutualPayload,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
yield this.publishEvent({
|
|
29
|
+
event: EVENT.CORE.ENTITY_CREATED,
|
|
30
|
+
payload: {
|
|
31
|
+
entityType: entity.entityType,
|
|
32
|
+
entityId: entity.entityId,
|
|
33
|
+
data: entity.data,
|
|
34
|
+
createdByAccountId: accountId,
|
|
35
|
+
publishedAt: entity.updatedAt || new Date().toISOString(),
|
|
36
|
+
},
|
|
18
37
|
});
|
|
19
|
-
}
|
|
20
|
-
await this.publishEvent({
|
|
21
|
-
event: EVENT.CORE.ENTITY_CREATED,
|
|
22
|
-
payload: {
|
|
23
|
-
entityType: entity.entityType,
|
|
24
|
-
entityId: entity.entityId,
|
|
25
|
-
data: entity.data,
|
|
26
|
-
createdByAccountId: accountId,
|
|
27
|
-
publishedAt: entity.updatedAt || new Date().toISOString(),
|
|
28
|
-
},
|
|
29
38
|
});
|
|
30
39
|
}
|
|
31
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-service-lifecycle.js","sourceRoot":"","sources":["../../../services/entity-service-lifecycle.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,MAAM,OAAO,sBAAsB;
|
|
1
|
+
{"version":3,"file":"entity-service-lifecycle.js","sourceRoot":"","sources":["../../../services/entity-service-lifecycle.ts"],"names":[],"mappings":";;;;;;;;;AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,MAAM,OAAO,sBAAsB;IACjC,YACU,YAAiB,EACjB,YAAqC,EACrC,UAAsB;QAFtB,iBAAY,GAAZ,YAAY,CAAK;QACjB,iBAAY,GAAZ,YAAY,CAAyB;QACrC,eAAU,GAAV,UAAU,CAAY;IAC7B,CAAC;IAEE,qBAAqB,CACzB,MAAiB,EACjB,aAAuC,EACvC,SAA6B;;;YAE7B,MAAM,YAAY,GAChB,MAAA,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,0CAAE,YAAY,CAAC;YAC5D,MAAM,mBAAmB,GAAG,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,KAAK,CAAC,aAAa,CAAC,CAAC;YAE/D,IAAI,mBAAmB,EAAE,CAAC;gBACxB,MAAM,IAAI,CAAC,UAAU,CAAC,yBAAyB,CAAC;oBAC9C,MAAM;oBACN,aAAa,EAAE,mBAAmB;iBACnC,CAAC,CAAC;YACL,CAAC;YAED,MAAM,IAAI,CAAC,YAAY,CAAC;gBACtB,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,cAAc;gBAChC,OAAO,EAAE;oBACP,UAAU,EAAE,MAAM,CAAC,UAAU;oBAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,kBAAkB,EAAE,SAAS;oBAC7B,WAAW,EAAE,MAAM,CAAC,SAAS,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;iBAC1D;aACF,CAAC,CAAC;QACL,CAAC;KAAA;CACF"}
|
|
@@ -1,117 +1,120 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import { z } from 'zod';
|
|
2
11
|
import { StandardError } from '../errors/standard-error';
|
|
3
12
|
import { EVENT } from '../types/event';
|
|
4
13
|
export class EntityService {
|
|
5
|
-
EntityConfig;
|
|
6
|
-
EmailAuthEnabledEntities;
|
|
7
|
-
entityRepository;
|
|
8
|
-
publishEvent;
|
|
9
|
-
entityServiceLifeCycle;
|
|
10
14
|
constructor(EntityConfig, EmailAuthEnabledEntities, entityRepository, publishEvent, entityServiceLifeCycle) {
|
|
11
15
|
this.EntityConfig = EntityConfig;
|
|
12
16
|
this.EmailAuthEnabledEntities = EmailAuthEnabledEntities;
|
|
13
17
|
this.entityRepository = entityRepository;
|
|
14
18
|
this.publishEvent = publishEvent;
|
|
15
19
|
this.entityServiceLifeCycle = entityServiceLifeCycle;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
...(options?.mutualId
|
|
20
|
+
this.createEntity = (_a) => __awaiter(this, [_a], void 0, function* ({ entityType, entityId, entityPayload, accountId, options, }) {
|
|
21
|
+
var _b, _c;
|
|
22
|
+
const finalSchema = this.EntityConfig[entityType].finalSchema;
|
|
23
|
+
const entitySchema = ((_b = this.EntityConfig[entityType]) === null || _b === void 0 ? void 0 : _b.createSchema) ||
|
|
24
|
+
((_c = this.EntityConfig[entityType]) === null || _c === void 0 ? void 0 : _c.baseSchema) ||
|
|
25
|
+
z.object({});
|
|
26
|
+
// const mutualSchema = this.EntityConfig[entityType]?.mutual?.mutualSchema;
|
|
27
|
+
if (!finalSchema || !entitySchema) {
|
|
28
|
+
throw new StandardError('INVALID_ENTITY_TYPE', 'Invalid entity type');
|
|
29
|
+
}
|
|
30
|
+
finalSchema.parse(entityPayload);
|
|
31
|
+
const parsedEntityPayload = entitySchema.parse(entityPayload);
|
|
32
|
+
// TODO: Create entity to accept mutual payload, so that mutual
|
|
33
|
+
// relationship can be formed when creating entity
|
|
34
|
+
// const parsedMutualPayload = mutualSchema?.parse(entityPayload);
|
|
35
|
+
if (this.EmailAuthEnabledEntities.includes(entityType)) {
|
|
36
|
+
yield this.entityRepository.getEmailAvailability(entityType, parsedEntityPayload.email);
|
|
37
|
+
}
|
|
38
|
+
const entity = yield this.entityRepository.createEntity(entityType, parsedEntityPayload, entityId, Object.assign(Object.assign({}, ((options === null || options === void 0 ? void 0 : options.mutualId)
|
|
36
39
|
? {
|
|
37
40
|
mutualId: `MUTUAL#${options.mutualId}`,
|
|
38
41
|
}
|
|
39
|
-
: {}),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
: {})), { createAndUpdateDatetime: (options === null || options === void 0 ? void 0 : options.createAndUpdateDatetime)
|
|
43
|
+
? new Date(options.createAndUpdateDatetime)
|
|
44
|
+
: new Date() }));
|
|
45
|
+
yield this.entityServiceLifeCycle.afterCreateEntityHook(entity, entityPayload, accountId);
|
|
46
|
+
return entity;
|
|
43
47
|
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
this.updateEntity = (_a) => __awaiter(this, [_a], void 0, function* ({ entityType, entityId, entityPayload, accountId, }) {
|
|
49
|
+
var _b, _c;
|
|
50
|
+
const errorContext = {};
|
|
51
|
+
try {
|
|
52
|
+
const entitySchema = this.EntityConfig[entityType].baseSchema;
|
|
53
|
+
const mutualSchema = (_b = this.EntityConfig[entityType].mutual) === null || _b === void 0 ? void 0 : _b.mutualSchema;
|
|
54
|
+
if (!entitySchema) {
|
|
55
|
+
throw new StandardError('Invalid entity type', 'INVALID_ENTITY_TYPE');
|
|
56
|
+
}
|
|
57
|
+
const parsedEntityPayload = entitySchema.parse(entityPayload);
|
|
58
|
+
const parsedMutualPayload = mutualSchema === null || mutualSchema === void 0 ? void 0 : mutualSchema.parse(entityPayload);
|
|
59
|
+
errorContext.parsedMutualPayload = parsedMutualPayload;
|
|
60
|
+
const entity = yield this.entityRepository.updateEntity(entityType, entityId, { data: parsedEntityPayload });
|
|
61
|
+
errorContext.entity = entity;
|
|
62
|
+
if (parsedMutualPayload) {
|
|
63
|
+
const byEntityType = entityType;
|
|
64
|
+
const byEntityId = entityId;
|
|
65
|
+
const publishEventPromises = [];
|
|
66
|
+
for (const [fieldKey, config] of Object.entries(((_c = this.EntityConfig[entityType].mutual) === null || _c === void 0 ? void 0 : _c.mutualFields) || {})) {
|
|
67
|
+
const toMutualIds = config.toMutualIds;
|
|
68
|
+
const mutualPayload = parsedMutualPayload[fieldKey];
|
|
69
|
+
if (!mutualPayload)
|
|
70
|
+
continue;
|
|
71
|
+
publishEventPromises.push(this.publishEvent({
|
|
72
|
+
event: EVENT.CORE.ENTITY_MUTUAL_TO_UPDATE,
|
|
73
|
+
payload: {
|
|
74
|
+
byEntityType,
|
|
75
|
+
byEntityId,
|
|
76
|
+
entityType: config.entityType,
|
|
77
|
+
field: fieldKey,
|
|
78
|
+
mutualIds: toMutualIds
|
|
79
|
+
? toMutualIds(mutualPayload)
|
|
80
|
+
: mutualPayload,
|
|
81
|
+
customContext: toMutualIds ? mutualPayload : {},
|
|
82
|
+
publishedAt: entity.updatedAt || new Date().toISOString(),
|
|
83
|
+
},
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
yield Promise.allSettled(publishEventPromises);
|
|
87
|
+
}
|
|
88
|
+
yield this.publishEvent({
|
|
89
|
+
event: EVENT.CORE.ENTITY_UPDATED,
|
|
90
|
+
payload: {
|
|
91
|
+
entityType,
|
|
92
|
+
entityId,
|
|
93
|
+
data: entity.data,
|
|
94
|
+
updatedByAccountId: accountId,
|
|
95
|
+
publishedAt: entity.updatedAt || new Date().toISOString(),
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
return entity;
|
|
54
99
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const entity = await this.entityRepository.updateEntity(entityType, entityId, { data: parsedEntityPayload });
|
|
59
|
-
errorContext.entity = entity;
|
|
60
|
-
if (parsedMutualPayload) {
|
|
61
|
-
const byEntityType = entityType;
|
|
62
|
-
const byEntityId = entityId;
|
|
63
|
-
const publishEventPromises = [];
|
|
64
|
-
for (const [fieldKey, config] of Object.entries(this.EntityConfig[entityType].mutual?.mutualFields || {})) {
|
|
65
|
-
const toMutualIds = config.toMutualIds;
|
|
66
|
-
const mutualPayload = parsedMutualPayload[fieldKey];
|
|
67
|
-
if (!mutualPayload)
|
|
68
|
-
continue;
|
|
69
|
-
publishEventPromises.push(this.publishEvent({
|
|
70
|
-
event: EVENT.CORE.ENTITY_MUTUAL_TO_UPDATE,
|
|
71
|
-
payload: {
|
|
72
|
-
byEntityType,
|
|
73
|
-
byEntityId,
|
|
74
|
-
entityType: config.entityType,
|
|
75
|
-
field: fieldKey,
|
|
76
|
-
mutualIds: toMutualIds
|
|
77
|
-
? toMutualIds(mutualPayload)
|
|
78
|
-
: mutualPayload,
|
|
79
|
-
customContext: toMutualIds ? mutualPayload : {},
|
|
80
|
-
publishedAt: entity.updatedAt || new Date().toISOString(),
|
|
81
|
-
},
|
|
82
|
-
}));
|
|
100
|
+
catch (error) {
|
|
101
|
+
if (error && typeof error === 'object') {
|
|
102
|
+
error.context = errorContext;
|
|
83
103
|
}
|
|
84
|
-
|
|
104
|
+
throw error;
|
|
85
105
|
}
|
|
86
|
-
|
|
87
|
-
|
|
106
|
+
});
|
|
107
|
+
this.deleteEntity = (_a) => __awaiter(this, [_a], void 0, function* ({ entityType, entityId, accountId, }) {
|
|
108
|
+
yield this.entityRepository.deleteEntity(entityType, entityId);
|
|
109
|
+
yield this.publishEvent({
|
|
110
|
+
event: EVENT.CORE.ENTITY_DELETED,
|
|
88
111
|
payload: {
|
|
89
112
|
entityType,
|
|
90
113
|
entityId,
|
|
91
|
-
|
|
92
|
-
updatedByAccountId: accountId,
|
|
93
|
-
publishedAt: entity.updatedAt || new Date().toISOString(),
|
|
114
|
+
deletedByAccountId: accountId,
|
|
94
115
|
},
|
|
95
116
|
});
|
|
96
|
-
return entity;
|
|
97
|
-
}
|
|
98
|
-
catch (error) {
|
|
99
|
-
if (error && typeof error === 'object') {
|
|
100
|
-
error.context = errorContext;
|
|
101
|
-
}
|
|
102
|
-
throw error;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
deleteEntity = async ({ entityType, entityId, accountId, }) => {
|
|
106
|
-
await this.entityRepository.deleteEntity(entityType, entityId);
|
|
107
|
-
await this.publishEvent({
|
|
108
|
-
event: EVENT.CORE.ENTITY_DELETED,
|
|
109
|
-
payload: {
|
|
110
|
-
entityType,
|
|
111
|
-
entityId,
|
|
112
|
-
deletedByAccountId: accountId,
|
|
113
|
-
},
|
|
114
117
|
});
|
|
115
|
-
}
|
|
118
|
+
}
|
|
116
119
|
}
|
|
117
120
|
//# sourceMappingURL=entity.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.service.js","sourceRoot":"","sources":["../../../services/entity.service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,MAAM,OAAO,aAAa;
|
|
1
|
+
{"version":3,"file":"entity.service.js","sourceRoot":"","sources":["../../../services/entity.service.ts"],"names":[],"mappings":";;;;;;;;;AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,MAAM,OAAO,aAAa;IACxB,YACU,YAGP,EACO,wBAAsC,EACtC,gBAAkC,EAClC,YAAqC,EACrC,sBAA8C;QAP9C,iBAAY,GAAZ,YAAY,CAGnB;QACO,6BAAwB,GAAxB,wBAAwB,CAAc;QACtC,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,iBAAY,GAAZ,YAAY,CAAyB;QACrC,2BAAsB,GAAtB,sBA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C,CAAC;gBAEH,OAAO,MAAM,CAAC;YAChB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;oBACtC,KAAiC,CAAC,OAAO,GAAG,YAAY,CAAC;gBAC5D,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC,CAAA,CAAC;QAEF,iBAAY,GAAG,KAQZ,EAAE,0CARuC,EAC1C,UAAU,EACV,QAAQ,EACR,SAAS,GAKV;YACC,MAAM,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YAE/D,MAAM,IAAI,CAAC,YAAY,CAAC;gBACtB,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,cAAc;gBAChC,OAAO,EAAE;oBACP,UAAU;oBACV,QAAQ;oBACR,kBAAkB,EAAE,SAAS;iBAC9B;aACF,CAAC,CAAC;QACL,CAAC,CAAA,CAAC;IAlLC,CAAC;CAmLL"}
|
|
@@ -1,137 +1,141 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import { ulid } from 'ulid';
|
|
2
11
|
import { z } from 'zod';
|
|
3
12
|
import { Entity } from '../data/Entity';
|
|
4
13
|
import { Mutual } from '../data/Mutual';
|
|
5
14
|
import { EVENT } from '../types/event';
|
|
6
15
|
export class MutualService {
|
|
7
|
-
entityRepository;
|
|
8
|
-
mutualRepository;
|
|
9
|
-
publishEvent;
|
|
10
|
-
ddbUtils;
|
|
11
|
-
entityServiceLifeCycle;
|
|
12
16
|
constructor(entityRepository, mutualRepository, publishEvent, ddbUtils, entityServiceLifeCycle) {
|
|
13
17
|
this.entityRepository = entityRepository;
|
|
14
18
|
this.mutualRepository = mutualRepository;
|
|
15
19
|
this.publishEvent = publishEvent;
|
|
16
20
|
this.ddbUtils = ddbUtils;
|
|
17
21
|
this.entityServiceLifeCycle = entityServiceLifeCycle;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
this.createMutual = (_a) => __awaiter(this, [_a], void 0, function* ({ byEntityType, byEntityId, entityType, entityId, mutualPayload, accountId, options = {}, }) {
|
|
23
|
+
const { ensureEntityStrongConsistentWrite = false, asEntity, createAndUpdateDatetime, mutualId, skipMutualCreation = false, ConditionExpression, ExpressionAttributeNames, ExpressionAttributeValues, } = options;
|
|
24
|
+
const errorContext = {
|
|
25
|
+
arguments: {
|
|
26
|
+
byEntityType,
|
|
27
|
+
byEntityId,
|
|
28
|
+
entityType,
|
|
29
|
+
entityId,
|
|
30
|
+
mutualPayload,
|
|
31
|
+
options,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
// TODO: schema validation for mutual data by config
|
|
35
|
+
const schema = z.record(z.string(), z.any());
|
|
36
|
+
const parsedMutualPayload = schema.parse(mutualPayload);
|
|
37
|
+
const [{ data: byEntityData }, { data: entityData }] = yield Promise.all([
|
|
38
|
+
this.entityRepository.getEntity(byEntityType, byEntityId),
|
|
39
|
+
this.entityRepository.getEntity(entityType, entityId),
|
|
40
|
+
]);
|
|
41
|
+
errorContext.byEntityData = byEntityData;
|
|
42
|
+
errorContext.entityData = entityData;
|
|
43
|
+
yield this.mutualRepository.checkMutualExist(byEntityType, byEntityId, entityType, entityId);
|
|
44
|
+
const currentDatetime = createAndUpdateDatetime || new Date();
|
|
45
|
+
const mutual = new Mutual(byEntityType, byEntityId, byEntityData, entityType, entityId, entityData, parsedMutualPayload, mutualId || ulid(), currentDatetime, currentDatetime, currentDatetime);
|
|
46
|
+
const mutualTransactions = skipMutualCreation
|
|
47
|
+
? []
|
|
48
|
+
: this.mutualRepository.createMutualTransactItems(mutual, {
|
|
49
|
+
ConditionExpression,
|
|
50
|
+
ExpressionAttributeNames,
|
|
51
|
+
ExpressionAttributeValues,
|
|
52
|
+
});
|
|
53
|
+
const entityTransactions = [];
|
|
54
|
+
let entity;
|
|
55
|
+
// construct entity transact item only if need to ensure strong consistent write
|
|
56
|
+
if (asEntity && ensureEntityStrongConsistentWrite) {
|
|
57
|
+
entity = new Entity(asEntity, mutual.mutualId, parsedMutualPayload, currentDatetime, currentDatetime);
|
|
58
|
+
entityTransactions.push(...this.entityRepository.createEntityTransactItems(entity, {
|
|
59
|
+
mutualId: mutual.mainPk,
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
// write to db regardless of options
|
|
63
|
+
const createTransactItems = [...mutualTransactions, ...entityTransactions];
|
|
64
|
+
errorContext.createTransactItems = createTransactItems;
|
|
65
|
+
yield this.ddbUtils.executeTransactWrite({
|
|
66
|
+
TransactItems: createTransactItems,
|
|
67
|
+
});
|
|
68
|
+
// duplicated behaviour from entityService.createEntity after write success
|
|
69
|
+
if (asEntity && entity && ensureEntityStrongConsistentWrite) {
|
|
70
|
+
yield this.entityServiceLifeCycle.afterCreateEntityHook(entity, mutualPayload, accountId);
|
|
71
|
+
}
|
|
72
|
+
// publish an event to create entity if asEntity defined
|
|
73
|
+
// since it's event-driven, it would be the creation of entity
|
|
74
|
+
// would be eventual consistent
|
|
75
|
+
if (options.asEntity && !ensureEntityStrongConsistentWrite) {
|
|
76
|
+
yield this.publishEvent({
|
|
77
|
+
event: EVENT.CORE.CREATE_ENTITY,
|
|
78
|
+
payload: {
|
|
79
|
+
entityType: options.asEntity,
|
|
80
|
+
entityId: mutual.mutualId,
|
|
81
|
+
entityPayload: mutual.mutualData,
|
|
82
|
+
accountId,
|
|
83
|
+
options: {
|
|
84
|
+
createAndUpdateDatetime: mutual.createdAt,
|
|
85
|
+
mutualId: mutual.mutualId,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
const eventPayload = {
|
|
23
91
|
byEntityType,
|
|
24
92
|
byEntityId,
|
|
25
93
|
entityType,
|
|
26
94
|
entityId,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
errorContext.entityData = entityData;
|
|
40
|
-
await this.mutualRepository.checkMutualExist(byEntityType, byEntityId, entityType, entityId);
|
|
41
|
-
const currentDatetime = createAndUpdateDatetime || new Date();
|
|
42
|
-
const mutual = new Mutual(byEntityType, byEntityId, byEntityData, entityType, entityId, entityData, parsedMutualPayload, mutualId || ulid(), currentDatetime, currentDatetime, currentDatetime);
|
|
43
|
-
const mutualTransactions = skipMutualCreation
|
|
44
|
-
? []
|
|
45
|
-
: this.mutualRepository.createMutualTransactItems(mutual, {
|
|
46
|
-
ConditionExpression,
|
|
47
|
-
ExpressionAttributeNames,
|
|
48
|
-
ExpressionAttributeValues,
|
|
49
|
-
});
|
|
50
|
-
const entityTransactions = [];
|
|
51
|
-
let entity;
|
|
52
|
-
// construct entity transact item only if need to ensure strong consistent write
|
|
53
|
-
if (asEntity && ensureEntityStrongConsistentWrite) {
|
|
54
|
-
entity = new Entity(asEntity, mutual.mutualId, parsedMutualPayload, currentDatetime, currentDatetime);
|
|
55
|
-
entityTransactions.push(...this.entityRepository.createEntityTransactItems(entity, {
|
|
56
|
-
mutualId: mutual.mainPk,
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
// write to db regardless of options
|
|
60
|
-
const createTransactItems = [...mutualTransactions, ...entityTransactions];
|
|
61
|
-
errorContext.createTransactItems = createTransactItems;
|
|
62
|
-
await this.ddbUtils.executeTransactWrite({
|
|
63
|
-
TransactItems: createTransactItems,
|
|
95
|
+
parsedMutualPayload,
|
|
96
|
+
accountId,
|
|
97
|
+
publishedAt: new Date().toISOString(),
|
|
98
|
+
};
|
|
99
|
+
const eventPromises = [
|
|
100
|
+
this.publishEvent({
|
|
101
|
+
event: EVENT.CORE.MUTUAL_CREATED(byEntityType, entityType),
|
|
102
|
+
payload: eventPayload,
|
|
103
|
+
}),
|
|
104
|
+
];
|
|
105
|
+
yield Promise.all(eventPromises);
|
|
106
|
+
return { mutual, eventPayload };
|
|
64
107
|
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
// would be eventual consistent
|
|
72
|
-
if (options.asEntity && !ensureEntityStrongConsistentWrite) {
|
|
73
|
-
await this.publishEvent({
|
|
74
|
-
event: EVENT.CORE.CREATE_ENTITY,
|
|
108
|
+
this.updateMutual = (_a) => __awaiter(this, [_a], void 0, function* ({ byEntityType, byEntityId, entityType, entityId, mutualPayload, accountId, options, }) {
|
|
109
|
+
const schema = z.record(z.string(), z.any());
|
|
110
|
+
const parsedMutualPayload = schema.parse(mutualPayload);
|
|
111
|
+
const mutual = yield this.mutualRepository.updateMutual(byEntityType, byEntityId, entityType, entityId, { mutualData: parsedMutualPayload }, options);
|
|
112
|
+
yield this.publishEvent({
|
|
113
|
+
event: EVENT.CORE.MUTUAL_UPDATED(byEntityType, entityType),
|
|
75
114
|
payload: {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
mutualId: mutual.mutualId,
|
|
83
|
-
},
|
|
115
|
+
byEntityType,
|
|
116
|
+
byEntityId,
|
|
117
|
+
entityType,
|
|
118
|
+
entityId,
|
|
119
|
+
parsedMutualPayload,
|
|
120
|
+
updatedByAccountId: accountId,
|
|
84
121
|
},
|
|
85
122
|
});
|
|
86
|
-
|
|
87
|
-
const eventPayload = {
|
|
88
|
-
byEntityType,
|
|
89
|
-
byEntityId,
|
|
90
|
-
entityType,
|
|
91
|
-
entityId,
|
|
92
|
-
parsedMutualPayload,
|
|
93
|
-
accountId,
|
|
94
|
-
publishedAt: new Date().toISOString(),
|
|
95
|
-
};
|
|
96
|
-
const eventPromises = [
|
|
97
|
-
this.publishEvent({
|
|
98
|
-
event: EVENT.CORE.MUTUAL_CREATED(byEntityType, entityType),
|
|
99
|
-
payload: eventPayload,
|
|
100
|
-
}),
|
|
101
|
-
];
|
|
102
|
-
await Promise.all(eventPromises);
|
|
103
|
-
return { mutual, eventPayload };
|
|
104
|
-
};
|
|
105
|
-
updateMutual = async ({ byEntityType, byEntityId, entityType, entityId, mutualPayload, accountId, options, }) => {
|
|
106
|
-
const schema = z.record(z.string(), z.any());
|
|
107
|
-
const parsedMutualPayload = schema.parse(mutualPayload);
|
|
108
|
-
const mutual = await this.mutualRepository.updateMutual(byEntityType, byEntityId, entityType, entityId, { mutualData: parsedMutualPayload }, options);
|
|
109
|
-
await this.publishEvent({
|
|
110
|
-
event: EVENT.CORE.MUTUAL_UPDATED(byEntityType, entityType),
|
|
111
|
-
payload: {
|
|
112
|
-
byEntityType,
|
|
113
|
-
byEntityId,
|
|
114
|
-
entityType,
|
|
115
|
-
entityId,
|
|
116
|
-
parsedMutualPayload,
|
|
117
|
-
updatedByAccountId: accountId,
|
|
118
|
-
},
|
|
123
|
+
return mutual;
|
|
119
124
|
});
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
125
|
+
this.deleteMutual = (_a) => __awaiter(this, [_a], void 0, function* ({ byEntityType, byEntityId, entityType, entityId, accountId, }) {
|
|
126
|
+
const mutual = yield this.mutualRepository.deleteMutual(byEntityType, byEntityId, entityType, entityId);
|
|
127
|
+
yield this.publishEvent({
|
|
128
|
+
event: EVENT.CORE.MUTUAL_UPDATED(byEntityType, entityType),
|
|
129
|
+
payload: {
|
|
130
|
+
byEntityType,
|
|
131
|
+
byEntityId,
|
|
132
|
+
entityType,
|
|
133
|
+
entityId,
|
|
134
|
+
deletedByAccountId: accountId,
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
return mutual;
|
|
133
138
|
});
|
|
134
|
-
|
|
135
|
-
};
|
|
139
|
+
}
|
|
136
140
|
}
|
|
137
141
|
//# sourceMappingURL=mutual.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutual.service.js","sourceRoot":"","sources":["../../../services/mutual.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,MAAM,EAAyB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAyB,MAAM,gBAAgB,CAAC;AAE/D,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,MAAM,OAAO,aAAa;
|
|
1
|
+
{"version":3,"file":"mutual.service.js","sourceRoot":"","sources":["../../../services/mutual.service.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,MAAM,EAAyB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAyB,MAAM,gBAAgB,CAAC;AAE/D,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,MAAM,OAAO,aAAa;IACxB,YACU,gBAAkC,EAClC,gBAAkC,EAClC,YAAqC,EACrC,QAAiB,EACjB,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