@pxp-nd/flow 1.1.14 → 1.1.16

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.
@@ -252,8 +252,8 @@ let Flow = class Flow extends core_1.Controller {
252
252
  };
253
253
  let flowDataClone;
254
254
  let isCopy = false;
255
- //if we have a vendoId as parameter the origin is a template
256
- if (params.vendorId) {
255
+ //if we have a name as parameter the origin is a template
256
+ if (params.name) {
257
257
  flowDataClone = await (0, typeorm_1.getManager)().save(Flow_1.default, { ...flowToClone, name: `${params.name}`, vendorId: params.vendorId, type: 'custom' });
258
258
  }
259
259
  else {
@@ -18,5 +18,6 @@ declare class FlowInstance extends Controller {
18
18
  processPending(params: Record<string, any>, manager: EntityManager): Promise<unknown>;
19
19
  eventProcesss(manager: EntityManager): Promise<void>;
20
20
  checkConditions(viewData: Record<string, any>, flowId: number, actionId: number): Promise<boolean>;
21
+ insert(params: Record<string, any>, manager: EntityManager): Promise<unknown>;
21
22
  }
22
23
  export default FlowInstance;
@@ -135,6 +135,18 @@ class FlowInstance extends core_1.Controller {
135
135
  }
136
136
  return res;
137
137
  }
138
+ async insert(params, manager) {
139
+ const { flowId, dataId, status, actionId, originName = '', originKey = '' } = params;
140
+ let flowInstance = new FlowInstance_1.default();
141
+ flowInstance.flowId = flowId;
142
+ flowInstance.dataId = dataId;
143
+ flowInstance.originName = originName;
144
+ flowInstance.originKey = originKey;
145
+ flowInstance.actionId = actionId;
146
+ flowInstance.status = status;
147
+ flowInstance = await manager.save(FlowInstance_1.default, flowInstance);
148
+ return flowInstance;
149
+ }
138
150
  }
139
151
  __decorate([
140
152
  (0, core_1.Post)(),
@@ -145,4 +157,13 @@ __decorate([
145
157
  __metadata("design:paramtypes", [Object, typeorm_1.EntityManager]),
146
158
  __metadata("design:returntype", Promise)
147
159
  ], FlowInstance.prototype, "processPending", null);
160
+ __decorate([
161
+ (0, core_1.Post)(),
162
+ (0, core_1.DbSettings)('Orm'),
163
+ (0, core_1.ReadOnly)(false),
164
+ (0, core_1.Log)(true),
165
+ __metadata("design:type", Function),
166
+ __metadata("design:paramtypes", [Object, typeorm_1.EntityManager]),
167
+ __metadata("design:returntype", Promise)
168
+ ], FlowInstance.prototype, "insert", null);
148
169
  exports.default = FlowInstance;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pxp-nd/flow",
3
- "version": "1.1.14",
3
+ "version": "1.1.16",
4
4
  "description": "Workflow module for pxp-nd framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",