@pxp-nd/flow 1.0.79 → 1.0.81

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.
@@ -17,6 +17,7 @@
17
17
  * 01-Sep-2023 SP08SEP23 Rensi Arteaga add base flow list
18
18
  * 16-Sep-2023 SP22SEP23 Mercedes Zambrana Change GET to POST in insertEventFlow
19
19
  * 28-Sep-2023 SP06OCT23 Mercedes Zambrana Add Validation when change off status (validateFlow, deleteflow, saveFlow, saveflowName)
20
+ * 20-Feb-2024 SP01MAR24 Mercedes Zambrana Add in getFlowRender, insertEventFlow condition for at.name=PAGE
20
21
  * ******************************************************************************
21
22
  */
22
23
  import { EntityManager } from 'typeorm';
@@ -18,6 +18,7 @@
18
18
  * 01-Sep-2023 SP08SEP23 Rensi Arteaga add base flow list
19
19
  * 16-Sep-2023 SP22SEP23 Mercedes Zambrana Change GET to POST in insertEventFlow
20
20
  * 28-Sep-2023 SP06OCT23 Mercedes Zambrana Add Validation when change off status (validateFlow, deleteflow, saveFlow, saveflowName)
21
+ * 20-Feb-2024 SP01MAR24 Mercedes Zambrana Add in getFlowRender, insertEventFlow condition for at.name=PAGE
21
22
  * ******************************************************************************
22
23
  */
23
24
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
@@ -106,6 +107,7 @@ let Flow = class Flow extends core_1.Controller {
106
107
  // insert new node
107
108
  const newNode = new Node_1.default();
108
109
  const { nodeId, flowId, createdAt, modifiedAt, ...nodeToCopy } = node;
110
+ //for each node, get schema_json from action_type. So, if has templateId check in configGetDescValue the parameter storeId
109
111
  Object.assign(newNode, { ...nodeToCopy, flowId: newFlowId });
110
112
  const insertNewNode = await (0, core_1.__)(manager.save(Node_1.default, newNode));
111
113
  if (isFirst) {
@@ -366,25 +368,37 @@ let Flow = class Flow extends core_1.Controller {
366
368
  return { success: true, nodeId: newId };
367
369
  }
368
370
  async getFlowRender(params) {
369
- var _a;
371
+ var _a, _b, _c;
370
372
  const flow = await (0, typeorm_1.getManager)().findOne(Flow_1.default, params.flowId);
371
373
  const totalNodes = await (0, typeorm_1.getManager)()
372
374
  .createQueryBuilder(Node_1.default, "n")
373
375
  .select([
374
376
  "n.nodeId",
375
- "a.originName"
377
+ "a.originName",
378
+ "a.actionId"
376
379
  ])
377
380
  .innerJoin("n.action", "a")
378
381
  .where(`n.isActive = 1 and n.flowId = :flowId`, { flowId: params.flowId })
379
382
  .getOne();
380
383
  let cond = " and 0=0";
381
384
  if (!totalNodes) {
382
- cond = " and at.name= 'EVENT' ";
385
+ cond = " and (at.name in ( 'EVENT','PAGE')) ";
383
386
  }
384
387
  else {
385
388
  const oName = (_a = totalNodes === null || totalNodes === void 0 ? void 0 : totalNodes.action) === null || _a === void 0 ? void 0 : _a.originName;
386
- //
387
- cond = `and at.name != 'EVENT' and (a.originName is null or a.originName = '${oName}')`;
389
+ const condPage = " and a.actionId = " + ((_b = totalNodes === null || totalNodes === void 0 ? void 0 : totalNodes.action) === null || _b === void 0 ? void 0 : _b.actionId);
390
+ const actionTypePage = await (0, typeorm_1.getManager)().query(`
391
+ select at.name
392
+ from twf_action a
393
+ inner join twf_action_type at on at.action_type_id = a.action_type_id
394
+ where a.action_id = ${(_c = totalNodes === null || totalNodes === void 0 ? void 0 : totalNodes.action) === null || _c === void 0 ? void 0 : _c.actionId}
395
+ `);
396
+ if (actionTypePage[0].name == 'PAGE') {
397
+ cond = `and at.name = 'PAGE' `;
398
+ }
399
+ else {
400
+ cond = `and (at.name not in ('EVENT','PAGE')) and (a.originName is null or a.originName = '${oName}') `;
401
+ }
388
402
  }
389
403
  let actions = await (0, typeorm_1.getManager)()
390
404
  .createQueryBuilder(Action_1.default, "a")
@@ -500,7 +514,7 @@ let Flow = class Flow extends core_1.Controller {
500
514
  "a.actionId"
501
515
  ])
502
516
  .innerJoin("a.actionType", "at")
503
- .where(`a.isActive = 1 and a.hidden = 'N' and at.name = 'EVENT' and at.isActive = 1 `, { actionId: params.actionId })
517
+ .where(`a.isActive = 1 and a.hidden = 'N' and at.name in ('EVENT','PAGE') and at.isActive = 1 `, { actionId: params.actionId })
504
518
  .getMany();
505
519
  if (action) {
506
520
  const newNode = manager.create(Node_1.default, {
@@ -15,4 +15,5 @@ export default class Flow extends PxpEntity {
15
15
  status: string;
16
16
  modifiedAt: Date;
17
17
  modifiedBy: string;
18
+ templateType: string;
18
19
  }
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  * Date Change ID Author Description
24
24
  * ----------- ----------- -------------- ------------------------------------
25
25
  * 04-Sep-2023 SP08SEP23 Rensi Arteaga add modified at and by
26
+ * 19-Feb-2024 SP01MAR24 Mercedes Zambrana add template_type
26
27
  *****************************************************************************/
27
28
  const typeorm_1 = require("typeorm");
28
29
  const FlowInstance_1 = __importDefault(require("./FlowInstance"));
@@ -82,6 +83,10 @@ __decorate([
82
83
  (0, typeorm_1.Column)({ name: 'modified_by', type: 'varchar', length: 500 }),
83
84
  __metadata("design:type", String)
84
85
  ], Flow.prototype, "modifiedBy", void 0);
86
+ __decorate([
87
+ (0, typeorm_1.Column)({ name: 'template_type', type: 'varchar', nullable: false, length: 15 }),
88
+ __metadata("design:type", String)
89
+ ], Flow.prototype, "templateType", void 0);
85
90
  Flow = __decorate([
86
91
  (0, typeorm_1.Entity)({ name: 'twf_flow' })
87
92
  ], Flow);
@@ -3,12 +3,13 @@ import ActionType from './ActionType';
3
3
  import Event from './Event';
4
4
  import FieldMap from './FieldMap';
5
5
  import Flow from './Flow';
6
+ import FlowLog from './FlowLog';
6
7
  import FlowInstance from './FlowInstance';
7
8
  import Node from './Node';
8
9
  import NodeConnection from './NodeConnection';
9
10
  import NodeInstance from './NodeInstance';
10
11
  import OriginName from './OriginName';
11
- export { Action, ActionType, Event, FieldMap, Flow, FlowInstance, Node, NodeConnection, NodeInstance, OriginName };
12
+ export { Action, ActionType, Event, FieldMap, Flow, FlowInstance, Node, NodeConnection, NodeInstance, OriginName, FlowLog };
12
13
  export declare const entities: {
13
14
  Action: typeof Action;
14
15
  ActionType: typeof ActionType;
@@ -20,4 +21,5 @@ export declare const entities: {
20
21
  NodeConnection: typeof NodeConnection;
21
22
  NodeInstance: typeof NodeInstance;
22
23
  OriginName: typeof OriginName;
24
+ FlowLog: typeof FlowLog;
23
25
  };
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.entities = exports.OriginName = exports.NodeInstance = exports.NodeConnection = exports.Node = exports.FlowInstance = exports.Flow = exports.FieldMap = exports.Event = exports.ActionType = exports.Action = void 0;
6
+ exports.entities = exports.FlowLog = exports.OriginName = exports.NodeInstance = exports.NodeConnection = exports.Node = exports.FlowInstance = exports.Flow = exports.FieldMap = exports.Event = exports.ActionType = exports.Action = void 0;
7
7
  const Action_1 = __importDefault(require("./Action"));
8
8
  exports.Action = Action_1.default;
9
9
  const ActionType_1 = __importDefault(require("./ActionType"));
@@ -14,6 +14,8 @@ const FieldMap_1 = __importDefault(require("./FieldMap"));
14
14
  exports.FieldMap = FieldMap_1.default;
15
15
  const Flow_1 = __importDefault(require("./Flow"));
16
16
  exports.Flow = Flow_1.default;
17
+ const FlowLog_1 = __importDefault(require("./FlowLog"));
18
+ exports.FlowLog = FlowLog_1.default;
17
19
  const FlowInstance_1 = __importDefault(require("./FlowInstance"));
18
20
  exports.FlowInstance = FlowInstance_1.default;
19
21
  const Node_1 = __importDefault(require("./Node"));
@@ -24,4 +26,4 @@ const NodeInstance_1 = __importDefault(require("./NodeInstance"));
24
26
  exports.NodeInstance = NodeInstance_1.default;
25
27
  const OriginName_1 = __importDefault(require("./OriginName"));
26
28
  exports.OriginName = OriginName_1.default;
27
- exports.entities = { Action: Action_1.default, ActionType: ActionType_1.default, Event: Event_1.default, FieldMap: FieldMap_1.default, Flow: Flow_1.default, FlowInstance: FlowInstance_1.default, Node: Node_1.default, NodeConnection: NodeConnection_1.default, NodeInstance: NodeInstance_1.default, OriginName: OriginName_1.default };
29
+ exports.entities = { Action: Action_1.default, ActionType: ActionType_1.default, Event: Event_1.default, FieldMap: FieldMap_1.default, Flow: Flow_1.default, FlowInstance: FlowInstance_1.default, Node: Node_1.default, NodeConnection: NodeConnection_1.default, NodeInstance: NodeInstance_1.default, OriginName: OriginName_1.default, FlowLog: FlowLog_1.default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pxp-nd/flow",
3
- "version": "1.0.79",
3
+ "version": "1.0.81",
4
4
  "description": "Workflow module for pxp-nd framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",