@simitgroup/simpleapp-generator 1.6.7-k-alpha → 1.6.7-m-alpha

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 (43) hide show
  1. package/ReleaseNote.md +7 -1
  2. package/dist/buildinschemas/message.d.ts +3 -0
  3. package/dist/buildinschemas/message.d.ts.map +1 -0
  4. package/dist/buildinschemas/message.js +34 -0
  5. package/dist/buildinschemas/message.js.map +1 -0
  6. package/dist/buildinschemas/webhookhistory.d.ts +3 -0
  7. package/dist/buildinschemas/webhookhistory.d.ts.map +1 -0
  8. package/dist/buildinschemas/webhookhistory.js +44 -0
  9. package/dist/buildinschemas/webhookhistory.js.map +1 -0
  10. package/dist/createproject.js +138 -0
  11. package/dist/createproject.js.map +1 -0
  12. package/dist/generate-allow-changebackend.js +305 -0
  13. package/dist/generate-allow-changebackend.js.map +1 -0
  14. package/dist/generate.d.ts.map +1 -1
  15. package/dist/generate.js +9 -4
  16. package/dist/generate.js.map +1 -1
  17. package/dist/index2.js +118 -0
  18. package/dist/index2.js.map +1 -0
  19. package/dist/installdependency.js +20 -0
  20. package/dist/installdependency.js.map +1 -0
  21. package/dist/installnest.js +2 -0
  22. package/dist/installnest.js.map +1 -0
  23. package/dist/installnuxt.js +2 -0
  24. package/dist/installnuxt.js.map +1 -0
  25. package/dist/processors/groupsbuilder.js +2 -0
  26. package/dist/processors/groupsbuilder.js.map +1 -0
  27. package/dist/schematype/baseschema.js +25 -0
  28. package/dist/schematype/baseschema.js.map +1 -0
  29. package/dist/schematype/default.js +2 -0
  30. package/dist/schematype/default.js.map +1 -0
  31. package/dist/schematype/index.js +12 -0
  32. package/dist/schematype/index.js.map +1 -0
  33. package/dist/schematype/primarymasterdata.js +38 -0
  34. package/dist/schematype/primarymasterdata.js.map +1 -0
  35. package/dist/schematype/simple.js +24 -0
  36. package/dist/schematype/simple.js.map +1 -0
  37. package/dist/schematype/simplemasterdata.js +31 -0
  38. package/dist/schematype/simplemasterdata.js.map +1 -0
  39. package/dist/schematype/transaction.js +74 -0
  40. package/dist/schematype/transaction.js.map +1 -0
  41. package/package.json +1 -1
  42. package/src/generate.ts +10 -3
  43. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +17 -9
@@ -337,12 +337,9 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
337
337
  }
338
338
 
339
339
  async createManyWithId(appuser: UserContext, datas: T[]) {
340
- if (Array.isArray(datas)) {
341
- const dbsession = appuser.getDBSession();
342
- if (dbsession && !dbsession.inTransaction()) {
343
- dbsession.startTransaction({ readPreference: 'primary' });
344
- }
345
340
 
341
+ if (Array.isArray(datas)) {
342
+
346
343
  for (let i = 0; i < datas.length; i++) {
347
344
  const data = datas[i];
348
345
  let isolationFilter: any = { ...appuser.getCreateFilterWithId() };
@@ -354,6 +351,11 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
354
351
  this.applyNestedDateTime(appuser, data, 'create');
355
352
  }
356
353
 
354
+ const dbsession = appuser.getDBSession();
355
+ if (dbsession && !dbsession.inTransaction()) {
356
+ dbsession.startTransaction({ readPreference: 'primary' });
357
+ }
358
+
357
359
  const result = await this.doc.insertMany(datas, { session: dbsession });
358
360
  await this.audittrail.addManyEvents(appuser, this.documentName, 'createMany', datas);
359
361
  for (let i = 0; i < datas.length; i++) {
@@ -444,8 +446,11 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
444
446
  await this.validateData(appuser, data);
445
447
  this.applyNestedDateTime(appuser, data, 'create');
446
448
  }
447
-
448
- const result = await this.doc.insertMany(datas);
449
+ const dbsession = appuser.getDBSession();
450
+ if (dbsession && !dbsession.inTransaction()) {
451
+ dbsession.startTransaction({ readPreference: 'primary' });
452
+ }
453
+ const result = await this.doc.insertMany(datas,{session:dbsession});
449
454
  await this.audittrail.addManyEvents(appuser, this.documentName, 'createMany', datas);
450
455
  return result;
451
456
  } else {
@@ -831,7 +836,7 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
831
836
  }
832
837
  };
833
838
 
834
- findIdThenPatch = async (appuser: UserContext, id: string, data: T, session: mongo.ClientSession = undefined) => {
839
+ findIdThenPatch = async (appuser: UserContext, id: string, data: T, session: mongo.ClientSession = undefined,skipLog:boolean=false) => {
835
840
  const existingdata = await this.findById(appuser, id);
836
841
  if (!existingdata) {
837
842
  throw new NotFoundException(`${id} not found`, 'not found');
@@ -873,7 +878,10 @@ export class SimpleAppService<T extends { _id?: string; __v?: number }> {
873
878
  session: dbsession,
874
879
  new: true,
875
880
  });
876
- await this.audittrail.addEvent(appuser, this.documentName, id, 'patch', data);
881
+ //skip audit trail, useful when want to patch x-foreignkey code,label
882
+ if(!skipLog) {
883
+ await this.audittrail.addEvent(appuser, this.documentName, id, 'patch', data);
884
+ }
877
885
  appuser.addUpdatedRecordId(this.documentName, data._id);
878
886
 
879
887
  if (this.hooks.afterUpdate) await this.hooks.afterUpdate(appuser, id, existingdata, result);