@things-factory/board-service 9.0.0-beta.65 → 9.0.0-beta.68

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.
@@ -1,4 +1,4 @@
1
- import { EntitySubscriberInterface, InsertEvent, UpdateEvent } from 'typeorm';
1
+ import { EntitySubscriberInterface, UpdateEvent } from 'typeorm';
2
2
  import { HistoryEntitySubscriber } from '@operato/typeorm-history';
3
3
  import { Board } from './board.js';
4
4
  import { BoardHistory } from './board-history.js';
@@ -10,6 +10,6 @@ export declare class BoardSubscriber implements EntitySubscriberInterface<Board>
10
10
  export declare class BoardHistoryEntitySubscriber extends HistoryEntitySubscriber<Board, BoardHistory> {
11
11
  get entity(): typeof Board;
12
12
  get historyEntity(): typeof BoardHistory;
13
- afterInsert(event: InsertEvent<Board>): Promise<void>;
14
- afterUpdate(event: UpdateEvent<Board>): Promise<void>;
13
+ afterInsert(event: any): Promise<void>;
14
+ afterUpdate(event: any): Promise<void>;
15
15
  }
@@ -47,12 +47,12 @@ let BoardHistoryEntitySubscriber = class BoardHistoryEntitySubscriber extends ty
47
47
  }
48
48
  async afterInsert(event) {
49
49
  if (event.entity.state == 'released') {
50
- super.afterInsert(event);
50
+ await super.afterInsert(event);
51
51
  }
52
52
  }
53
53
  async afterUpdate(event) {
54
54
  if (event.entity.state == 'released') {
55
- super.afterUpdate(event);
55
+ await super.afterUpdate(event);
56
56
  }
57
57
  }
58
58
  };
@@ -1 +1 @@
1
- {"version":3,"file":"event-subscriber.js","sourceRoot":"","sources":["../../../server/service/board/event-subscriber.ts"],"names":[],"mappings":";;;;AAAA,qCAA8F;AAE9F,8DAAkE;AAClE,iDAA6D;AAE7D,yCAAkC;AAClC,yDAAiD;AAG1C,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,QAAQ;QACN,OAAO,gBAAK,CAAA;IACd,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,KAAyB;QAC1C,IAAI,KAAK,GAAG,KAAK,C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,KAAyB;QAChD,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,UAAU,EAAE,CAAC;YACrC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;QAC1B,CAAC;IACH,CAAC;CACF,CAAA;AApBY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,yBAAe,GAAE;GACL,4BAA4B,CAoBxC","sourcesContent":["import { EventSubscriber, EntitySubscriberInterface, InsertEvent, UpdateEvent } from 'typeorm'\n\nimport { HistoryEntitySubscriber } from '@operato/typeorm-history'\nimport { pubsub, getRepository } from '@things-factory/shell'\n\nimport { Board } from './board.js'\nimport { BoardHistory } from './board-history.js'\n\n@EventSubscriber()\nexport class BoardSubscriber implements EntitySubscriberInterface<Board> {\n listenTo() {\n return Board\n }\n\n async beforeUpdate(event: UpdateEvent<Board>): Promise<any> {\n var board = event.entity\n\n if (!board.version) {\n board.version = 0\n }\n }\n\n async afterUpdate(event: UpdateEvent<Board>): Promise<any> {\n var board = event.entity\n\n board = await event.manager.findOne(Board, {\n where: { domain: { id: board.domainId }, id: board.id },\n relations: ['playGroups']\n })\n\n if (!board || board.state != 'released') {\n return\n }\n\n board.playGroups.forEach(playGroup =>\n pubsub.publish('play-group', {\n playGroup\n })\n )\n\n pubsub.publish('board', {\n board\n })\n }\n}\n\n@EventSubscriber()\nexport class BoardHistoryEntitySubscriber extends HistoryEntitySubscriber<Board, BoardHistory> {\n public get entity() {\n return Board\n }\n\n public get historyEntity() {\n return BoardHistory\n }\n\n public async afterInsert(event: InsertEvent<Board>): Promise<void> {\n if (event.entity.state == 'released') {\n super.afterInsert(event)\n }\n }\n\n public async afterUpdate(event: UpdateEvent<Board>): Promise<void> {\n if (event.entity.state == 'released') {\n super.afterUpdate(event)\n }\n }\n}\n"]}
1
+ {"version":3,"file":"event-subscriber.js","sourceRoot":"","sources":["../../../server/service/board/event-subscriber.ts"],"names":[],"mappings":";;;;AAAA,qCAA8F;AAE9F,8DAAkE;AAClE,iDAA6D;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AAW,CAAC,KAAK;QAC5B,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,UAAU,EAAE,CAAC;YACrC,MAAM,KAAK,CAAC,WAAW,CAAC,KAAY,CAAC,CAAA;QACvC,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,KAAK;QAC5B,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,UAAU,EAAE,CAAC;YACrC,MAAM,KAAK,CAAC,WAAW,CAAC,KAAY,CAAC,CAAA;QACvC,CAAC;IACH,CAAC;CACF,CAAA;AApBY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,yBAAe,GAAE;GACL,4BAA4B,CAoBxC","sourcesContent":["import { EventSubscriber, EntitySubscriberInterface, InsertEvent, UpdateEvent } from 'typeorm'\n\nimport { HistoryEntitySubscriber } from '@operato/typeorm-history'\nimport { pubsub, getRepository } from '@things-factory/shell'\n\nimport { Board } from './board.js'\nimport { BoardHistory } from './board-history.js'\n\n@EventSubscriber()\nexport class BoardSubscriber implements EntitySubscriberInterface<Board> {\n listenTo() {\n return Board\n }\n\n async beforeUpdate(event: UpdateEvent<Board>): Promise<any> {\n var board = event.entity\n\n if (!board.version) {\n board.version = 0\n }\n }\n\n async afterUpdate(event: UpdateEvent<Board>): Promise<any> {\n var board = event.entity\n\n board = await event.manager.findOne(Board, {\n where: { domain: { id: board.domainId }, id: board.id },\n relations: ['playGroups']\n })\n\n if (!board || board.state != 'released') {\n return\n }\n\n board.playGroups.forEach(playGroup =>\n pubsub.publish('play-group', {\n playGroup\n })\n )\n\n pubsub.publish('board', {\n board\n })\n }\n}\n\n@EventSubscriber()\nexport class BoardHistoryEntitySubscriber extends HistoryEntitySubscriber<Board, BoardHistory> {\n public get entity() {\n return Board\n }\n\n public get historyEntity() {\n return BoardHistory\n }\n\n public async afterInsert(event): Promise<void> {\n if (event.entity.state == 'released') {\n await super.afterInsert(event as any)\n }\n }\n\n public async afterUpdate(event): Promise<void> {\n if (event.entity.state == 'released') {\n await super.afterUpdate(event as any)\n }\n }\n}\n"]}