@open-mercato/core 0.11.1-develop.8527.1.47d81d2fa0 → 0.11.1-develop.8532.1.ffc8ada7f5
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/.turbo/turbo-build.log +1 -1
- package/dist/modules/customers/commands/companies.js +8 -5
- package/dist/modules/customers/commands/companies.js.map +2 -2
- package/dist/modules/customers/commands/people.js +10 -7
- package/dist/modules/customers/commands/people.js.map +2 -2
- package/dist/modules/customers/commands/shared.js +6 -4
- package/dist/modules/customers/commands/shared.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +52 -22
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/workflows/lib/workflow-executor.js +23 -0
- package/dist/modules/workflows/lib/workflow-executor.js.map +2 -2
- package/package.json +7 -7
- package/src/modules/customers/commands/companies.ts +14 -7
- package/src/modules/customers/commands/people.ts +16 -9
- package/src/modules/customers/commands/shared.ts +7 -4
- package/src/modules/sales/commands/documents.ts +88 -38
- package/src/modules/workflows/lib/workflow-executor.ts +23 -0
|
@@ -657,7 +657,7 @@ const createPersonCommand = {
|
|
|
657
657
|
newProfile = graph.profile;
|
|
658
658
|
},
|
|
659
659
|
() => syncLegacyPrimaryCompanyLink(em, newEntity, newProfile, after.profile.companyEntityId),
|
|
660
|
-
() => syncEntityTags(em, newEntity, after.tagIds)
|
|
660
|
+
() => syncEntityTags(em, newEntity, after.tagIds, { ignoreMissing: true })
|
|
661
661
|
], { transaction: true });
|
|
662
662
|
entity = newEntity;
|
|
663
663
|
profile = newProfile;
|
|
@@ -700,7 +700,7 @@ const createPersonCommand = {
|
|
|
700
700
|
profile.twitterUrl = after.profile.twitterUrl;
|
|
701
701
|
},
|
|
702
702
|
() => syncLegacyPrimaryCompanyLink(em, survivingEntity, profile, after.profile.companyEntityId),
|
|
703
|
-
() => syncEntityTags(em, survivingEntity, after.tagIds)
|
|
703
|
+
() => syncEntityTags(em, survivingEntity, after.tagIds, { ignoreMissing: true })
|
|
704
704
|
], { transaction: true });
|
|
705
705
|
}
|
|
706
706
|
const restoredEntity = entity;
|
|
@@ -735,7 +735,7 @@ const updatePersonCommand = {
|
|
|
735
735
|
const snapshot = await loadPersonSnapshot(em, parsed.id, ctx);
|
|
736
736
|
return snapshot ? { before: snapshot } : {};
|
|
737
737
|
},
|
|
738
|
-
async execute(rawInput, ctx) {
|
|
738
|
+
async execute(rawInput, ctx, ignoreMissingTags = false) {
|
|
739
739
|
const { parsed, custom } = parseWithCustomFields(personUpdateSchema, rawInput);
|
|
740
740
|
const em = ctx.container.resolve("em").fork();
|
|
741
741
|
const entity = await findScopedCustomerCommandTarget(
|
|
@@ -863,7 +863,7 @@ const updatePersonCommand = {
|
|
|
863
863
|
await syncLegacyPrimaryCompanyLink(em, record, profile, parsed.companyEntityId);
|
|
864
864
|
}
|
|
865
865
|
},
|
|
866
|
-
() => syncEntityTags(em, record, parsed.tags)
|
|
866
|
+
() => syncEntityTags(em, record, parsed.tags, { ignoreMissing: ignoreMissingTags })
|
|
867
867
|
], { transaction: true });
|
|
868
868
|
await invalidateDictionaryKindCaches(ctx, record, createdDictionaryKinds);
|
|
869
869
|
await setCustomFieldsForPerson(ctx, record.id, profile.id, record.organizationId, record.tenantId, custom);
|
|
@@ -967,7 +967,7 @@ const updatePersonCommand = {
|
|
|
967
967
|
em.persist(newProfile);
|
|
968
968
|
},
|
|
969
969
|
() => syncLegacyPrimaryCompanyLink(em, newEntity, newProfile, before.profile.companyEntityId),
|
|
970
|
-
() => syncEntityTags(em, newEntity, before.tagIds)
|
|
970
|
+
() => syncEntityTags(em, newEntity, before.tagIds, { ignoreMissing: true })
|
|
971
971
|
], { transaction: true });
|
|
972
972
|
} else {
|
|
973
973
|
await withAtomicFlush(em, [
|
|
@@ -1009,7 +1009,7 @@ const updatePersonCommand = {
|
|
|
1009
1009
|
await syncLegacyPrimaryCompanyLink(em, entity, profile, before.profile.companyEntityId);
|
|
1010
1010
|
}
|
|
1011
1011
|
},
|
|
1012
|
-
() => syncEntityTags(em, entity, before.tagIds)
|
|
1012
|
+
() => syncEntityTags(em, entity, before.tagIds, { ignoreMissing: true })
|
|
1013
1013
|
], { transaction: true });
|
|
1014
1014
|
}
|
|
1015
1015
|
const indexedEntity = await findOneWithDecryption(em, CustomerEntity, { id: before.entity.id, tenantId: before.entity.tenantId, organizationId: before.entity.organizationId }, void 0, {
|
|
@@ -1038,6 +1038,9 @@ const updatePersonCommand = {
|
|
|
1038
1038
|
if (Object.keys(resetValues).length) {
|
|
1039
1039
|
await setCustomFieldsForPerson(ctx, before.entity.id, before.profile.id, before.entity.organizationId, before.entity.tenantId, resetValues);
|
|
1040
1040
|
}
|
|
1041
|
+
},
|
|
1042
|
+
redo({ input, ctx }) {
|
|
1043
|
+
return updatePersonCommand.execute(input, ctx, true);
|
|
1041
1044
|
}
|
|
1042
1045
|
};
|
|
1043
1046
|
const deletePersonCommand = {
|
|
@@ -1346,7 +1349,7 @@ const deletePersonCommand = {
|
|
|
1346
1349
|
}
|
|
1347
1350
|
}
|
|
1348
1351
|
await withAtomicFlush(em, [
|
|
1349
|
-
() => syncEntityTags(em, entity2, before.tagIds)
|
|
1352
|
+
() => syncEntityTags(em, entity2, before.tagIds, { ignoreMissing: true })
|
|
1350
1353
|
]);
|
|
1351
1354
|
const restoredLabelAssignments = await restoreEntityLabelAssignments(em, entity2, payload?.labelAssignments);
|
|
1352
1355
|
await em.flush();
|