@or-sdk/idw 1.1.0-beta.1277.0 → 1.1.0-beta.1286.0

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/dist/cjs/idw.js CHANGED
@@ -54,12 +54,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
54
54
  exports.IDW = void 0;
55
55
  var base_1 = require("@or-sdk/base");
56
56
  var graph_1 = require("@or-sdk/graph");
57
+ var users_1 = require("@or-sdk/users");
57
58
  var constants_1 = require("./constants");
58
59
  var IDW = (function (_super) {
59
60
  __extends(IDW, _super);
60
61
  function IDW(params) {
61
62
  var _this = this;
62
- var accountId = params.accountId, discoveryUrl = params.discoveryUrl, graphUrl = params.graphUrl, token = params.token;
63
+ var accountId = params.accountId, discoveryUrl = params.discoveryUrl, graphUrl = params.graphUrl, sdkApiUrl = params.sdkApiUrl, token = params.token;
63
64
  _this = _super.call(this, {
64
65
  accountId: accountId,
65
66
  discoveryUrl: discoveryUrl,
@@ -72,45 +73,40 @@ var IDW = (function (_super) {
72
73
  graphUrl: graphUrl,
73
74
  token: token,
74
75
  });
76
+ _this.users = new users_1.Users({
77
+ accountId: accountId,
78
+ token: token,
79
+ discoveryUrl: discoveryUrl,
80
+ sdkUrl: sdkApiUrl,
81
+ });
75
82
  return _this;
76
83
  }
77
- IDW.prototype.createOrUpdateFlow = function (flow, _a) {
78
- var userId = _a.userId;
84
+ IDW.prototype.createOrUpdateFlow = function (flow) {
79
85
  return __awaiter(this, void 0, void 0, function () {
80
- var meta;
81
- return __generator(this, function (_b) {
82
- switch (_b.label) {
86
+ var userId;
87
+ return __generator(this, function (_a) {
88
+ switch (_a.label) {
83
89
  case 0:
84
90
  if (flow.id === undefined) {
85
91
  throw new Error('Only flows with id can be added to the IDW graph');
86
92
  }
87
93
  if (!flow.isDeleted) return [3, 2];
88
94
  return [4, this.deleteFlow(flow.id)];
89
- case 1: return [2, _b.sent()];
90
- case 2: return [4, this.graphQuery('\
91
- MERGE (flow:FLOW { id: $id } )\n\
92
- SET createdAt = $createdAt\n\
93
- SET createdBy = $userId\n\
94
- SET description = $description\n\
95
- SET groupId = groupId\n\
96
- SET isActive = false\n\
97
- SET name = $name\n\
98
- SET updatedAt = $updatedAt\n\
99
- SET updatedBy = $userId\n\
100
- ', {
101
- createdAt: flow.dateCreated,
102
- description: flow.data.description,
103
- groupId: flow.botId,
104
- id: flow.id,
105
- name: flow.data.label,
106
- updatedAt: flow.dateModified,
107
- userId: userId,
108
- })];
95
+ case 1: return [2, _a.sent()];
96
+ case 2: return [4, this.users.getCurrentUser()];
109
97
  case 3:
110
- _b.sent();
111
- meta = flow.data.meta.idw;
112
- if (meta) {
113
- }
98
+ userId = (_a.sent()).userId;
99
+ return [4, this.graphQuery("\n MERGE (flow:FLOW { id: $id })\n ON MATCH\n SET flow.createdAt = $createdAt,\n flow.createdBy = $userId,\n flow.description = $description,\n flow.groupId = $groupId,\n flow.name = $name,\n flow.updatedAt = $updatedAt,\n flow.updatedBy = $userId\n ON CREATE\n SET flow.createdAt = $createdAt,\n flow.createdBy = $userId,\n flow.description = $description,\n flow.groupId = $groupId,\n flow.isActive = false,\n flow.name = $name,\n flow.updatedAt = $updatedAt,\n flow.updatedBy = $userId\n RETURN flow\n ", {
100
+ createdAt: flow.dateCreated,
101
+ description: flow.data.description,
102
+ groupId: flow.botId,
103
+ id: flow.id,
104
+ name: flow.data.label,
105
+ updatedAt: flow.dateModified,
106
+ userId: userId,
107
+ })];
108
+ case 4:
109
+ _a.sent();
114
110
  return [2];
115
111
  }
116
112
  });
@@ -120,10 +116,7 @@ var IDW = (function (_super) {
120
116
  return __awaiter(this, void 0, void 0, function () {
121
117
  return __generator(this, function (_a) {
122
118
  switch (_a.label) {
123
- case 0: return [4, this.graphQuery('\
124
- MATCH (flow:FLOW { id: $id } )\n\
125
- DETACH DELETE flow\
126
- ', { id: id })];
119
+ case 0: return [4, this.graphQuery("\n MATCH (flow:FLOW { id: $id })\n DETACH DELETE flow\n ", { id: id })];
127
120
  case 1:
128
121
  _a.sent();
129
122
  return [2];
@@ -131,18 +124,20 @@ var IDW = (function (_super) {
131
124
  });
132
125
  });
133
126
  };
134
- IDW.prototype.activateFlow = function (id, activatedAt) {
127
+ IDW.prototype.activateFlow = function (flow) {
135
128
  return __awaiter(this, void 0, void 0, function () {
129
+ var id;
136
130
  return __generator(this, function (_a) {
137
131
  switch (_a.label) {
138
- case 0: return [4, this.graphQuery('\
139
- MATCH (flow:FLOW { id: $id } )\n\
140
- SET flow.isActive = true\
141
- SET flow.activatedAt = $activatedAt\
142
- ', {
143
- activatedAt: activatedAt,
144
- id: id,
145
- })];
132
+ case 0:
133
+ id = flow.id;
134
+ if (id === undefined) {
135
+ throw new Error('Only flows with id can be added to the IDW graph');
136
+ }
137
+ return [4, this.graphQuery("\n MATCH (flow:FLOW { id: $id })\n SET flow.isActive = true,\n flow.activatedAt = $activatedAt\n RETURN flow\n ", {
138
+ activatedAt: Date.now(),
139
+ id: id,
140
+ })];
146
141
  case 1:
147
142
  _a.sent();
148
143
  return [2];
@@ -154,11 +149,7 @@ var IDW = (function (_super) {
154
149
  return __awaiter(this, void 0, void 0, function () {
155
150
  return __generator(this, function (_a) {
156
151
  switch (_a.label) {
157
- case 0: return [4, this.graphQuery('\
158
- MATCH (flow:FLOW { id: $id } )\n\
159
- SET flow.isActive = false\
160
- REMOVE flow.activatedAt\
161
- ', { id: id })];
152
+ case 0: return [4, this.graphQuery("\n MATCH (flow:FLOW { id: $id } )\n SET flow.isActive = false\n REMOVE flow.activatedAt\n RETURN flow\n ", { id: id })];
162
153
  case 1:
163
154
  _a.sent();
164
155
  return [2];
@@ -187,41 +178,6 @@ var IDW = (function (_super) {
187
178
  });
188
179
  });
189
180
  };
190
- IDW.prototype.afterSave = function () {
191
- return __awaiter(this, void 0, void 0, function () {
192
- return __generator(this, function (_a) {
193
- return [2];
194
- });
195
- });
196
- };
197
- IDW.prototype.afterActivate = function () {
198
- return __awaiter(this, void 0, void 0, function () {
199
- return __generator(this, function (_a) {
200
- return [2];
201
- });
202
- });
203
- };
204
- IDW.prototype.afterDeactivate = function () {
205
- return __awaiter(this, void 0, void 0, function () {
206
- return __generator(this, function (_a) {
207
- return [2];
208
- });
209
- });
210
- };
211
- IDW.prototype.splitFromTree = function () {
212
- return __awaiter(this, void 0, void 0, function () {
213
- return __generator(this, function (_a) {
214
- return [2];
215
- });
216
- });
217
- };
218
- IDW.prototype.deleteFromTree = function () {
219
- return __awaiter(this, void 0, void 0, function () {
220
- return __generator(this, function (_a) {
221
- return [2];
222
- });
223
- });
224
- };
225
181
  return IDW;
226
182
  }(base_1.Base));
227
183
  exports.IDW = IDW;
@@ -1 +1 @@
1
- {"version":3,"file":"idw.js","sourceRoot":"","sources":["../../src/idw.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAAoC;AAEpC,uCAAuC;AACvC,yCAAsD;AAUtD;IAAyB,uBAAI;IAc3B,aAAY,MAAiB;QAA7B,iBAqBC;QAnBG,IAAA,SAAS,GAIP,MAAM,UAJC,EACT,YAAY,GAGV,MAAM,aAHI,EACZ,QAAQ,GAEN,MAAM,SAFA,EACR,KAAK,GACH,MAAM,MADH,CACI;gBAEX,kBAAM;YACJ,SAAS,WAAA;YACT,YAAY,cAAA;YACZ,UAAU,EAAE,uBAAW;YACvB,KAAK,OAAA;SACN,CAAC;QAEF,KAAI,CAAC,QAAQ,GAAG,IAAI,cAAM,CAAC;YACzB,SAAS,WAAA;YACT,YAAY,cAAA;YACZ,QAAQ,UAAA;YACR,KAAK,OAAA;SACN,CAAC,CAAC;;IACL,CAAC;IAEK,gCAAkB,GAAxB,UAAyB,IAAU,EAAE,EAA+B;YAA7B,MAAM,YAAA;;;;;;wBAC3C,IAAI,IAAI,CAAC,EAAE,KAAK,SAAS,EAAE;4BACzB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;yBACrE;6BAEG,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EAAE,EAAE,EAAE,IAAA,EAAE,CAAC,EAAA;;wBALV,SAKU,CAAC;;;;;KACZ;IAEa,wBAAU,GAAxB,UAAyB,KAAa,EAAE,MAAyD;;;;;;;wBAEtF,WAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;gCAC/B,KAAK,EAAE,sBAAU;gCACjB,MAAM,QAAA;gCACN,KAAK,OAAA;6BACN,CAAC,EAAA;4BAJF,WAAO,SAIL,EAAC;;;;;;;;KAKN;IACH,UAAC;AAAD,CAAC,AAzMD,CAAyB,WAAI,GAyM5B;AAzMY,kBAAG"}
package/dist/esm/idw.js CHANGED
@@ -9,10 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { Base } from '@or-sdk/base';
11
11
  import { Graphs } from '@or-sdk/graph';
12
+ import { Users } from '@or-sdk/users';
12
13
  import { GRAPH_NAME, SERVICE_KEY } from './constants';
13
14
  export class IDW extends Base {
14
15
  constructor(params) {
15
- const { accountId, discoveryUrl, graphUrl, token, } = params;
16
+ const { accountId, discoveryUrl, graphUrl, sdkApiUrl, token, } = params;
16
17
  super({
17
18
  accountId,
18
19
  discoveryUrl,
@@ -25,8 +26,14 @@ export class IDW extends Base {
25
26
  graphUrl,
26
27
  token,
27
28
  });
29
+ this.users = new Users({
30
+ accountId,
31
+ token,
32
+ discoveryUrl,
33
+ sdkUrl: sdkApiUrl,
34
+ });
28
35
  }
29
- createOrUpdateFlow(flow, { userId }) {
36
+ createOrUpdateFlow(flow) {
30
37
  return __awaiter(this, void 0, void 0, function* () {
31
38
  if (flow.id === undefined) {
32
39
  throw new Error('Only flows with id can be added to the IDW graph');
@@ -34,17 +41,28 @@ export class IDW extends Base {
34
41
  if (flow.isDeleted) {
35
42
  return yield this.deleteFlow(flow.id);
36
43
  }
37
- yield this.graphQuery('\
38
- MERGE (flow:FLOW { id: $id } )\n\
39
- SET createdAt = $createdAt\n\
40
- SET createdBy = $userId\n\
41
- SET description = $description\n\
42
- SET groupId = groupId\n\
43
- SET isActive = false\n\
44
- SET name = $name\n\
45
- SET updatedAt = $updatedAt\n\
46
- SET updatedBy = $userId\n\
47
- ', {
44
+ const { userId } = yield this.users.getCurrentUser();
45
+ yield this.graphQuery(`
46
+ MERGE (flow:FLOW { id: $id })
47
+ ON MATCH
48
+ SET flow.createdAt = $createdAt,
49
+ flow.createdBy = $userId,
50
+ flow.description = $description,
51
+ flow.groupId = $groupId,
52
+ flow.name = $name,
53
+ flow.updatedAt = $updatedAt,
54
+ flow.updatedBy = $userId
55
+ ON CREATE
56
+ SET flow.createdAt = $createdAt,
57
+ flow.createdBy = $userId,
58
+ flow.description = $description,
59
+ flow.groupId = $groupId,
60
+ flow.isActive = false,
61
+ flow.name = $name,
62
+ flow.updatedAt = $updatedAt,
63
+ flow.updatedBy = $userId
64
+ RETURN flow
65
+ `, {
48
66
  createdAt: flow.dateCreated,
49
67
  description: flow.data.description,
50
68
  groupId: flow.botId,
@@ -53,38 +71,41 @@ export class IDW extends Base {
53
71
  updatedAt: flow.dateModified,
54
72
  userId,
55
73
  });
56
- const meta = flow.data.meta.idw;
57
- if (meta) {
58
- }
59
74
  });
60
75
  }
61
76
  deleteFlow(id) {
62
77
  return __awaiter(this, void 0, void 0, function* () {
63
- yield this.graphQuery('\
64
- MATCH (flow:FLOW { id: $id } )\n\
65
- DETACH DELETE flow\
66
- ', { id });
78
+ yield this.graphQuery(`
79
+ MATCH (flow:FLOW { id: $id })
80
+ DETACH DELETE flow
81
+ `, { id });
67
82
  });
68
83
  }
69
- activateFlow(id, activatedAt) {
84
+ activateFlow(flow) {
70
85
  return __awaiter(this, void 0, void 0, function* () {
71
- yield this.graphQuery('\
72
- MATCH (flow:FLOW { id: $id } )\n\
73
- SET flow.isActive = true\
74
- SET flow.activatedAt = $activatedAt\
75
- ', {
76
- activatedAt,
86
+ const id = flow.id;
87
+ if (id === undefined) {
88
+ throw new Error('Only flows with id can be added to the IDW graph');
89
+ }
90
+ yield this.graphQuery(`
91
+ MATCH (flow:FLOW { id: $id })
92
+ SET flow.isActive = true,
93
+ flow.activatedAt = $activatedAt
94
+ RETURN flow
95
+ `, {
96
+ activatedAt: Date.now(),
77
97
  id,
78
98
  });
79
99
  });
80
100
  }
81
101
  deactivateFlow(id) {
82
102
  return __awaiter(this, void 0, void 0, function* () {
83
- yield this.graphQuery('\
84
- MATCH (flow:FLOW { id: $id } )\n\
85
- SET flow.isActive = false\
86
- REMOVE flow.activatedAt\
87
- ', { id });
103
+ yield this.graphQuery(`
104
+ MATCH (flow:FLOW { id: $id } )
105
+ SET flow.isActive = false
106
+ REMOVE flow.activatedAt
107
+ RETURN flow
108
+ `, { id });
88
109
  });
89
110
  }
90
111
  graphQuery(query, params) {
@@ -100,25 +121,5 @@ export class IDW extends Base {
100
121
  }
101
122
  });
102
123
  }
103
- afterSave() {
104
- return __awaiter(this, void 0, void 0, function* () {
105
- });
106
- }
107
- afterActivate() {
108
- return __awaiter(this, void 0, void 0, function* () {
109
- });
110
- }
111
- afterDeactivate() {
112
- return __awaiter(this, void 0, void 0, function* () {
113
- });
114
- }
115
- splitFromTree() {
116
- return __awaiter(this, void 0, void 0, function* () {
117
- });
118
- }
119
- deleteFromTree() {
120
- return __awaiter(this, void 0, void 0, function* () {
121
- });
122
- }
123
124
  }
124
125
  //# sourceMappingURL=idw.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"idw.js","sourceRoot":"","sources":["../../src/idw.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAUtD,MAAM,OAAO,GAAI,SAAQ,IAAI;IAc3B,YAAY,MAAiB;QAC3B,MAAM,EACJ,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,KAAK,GACN,GAAG,MAAM,CAAC;QAEX,KA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AU,CAAC;;;;;KAKrB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QACb,CAAC;KAAA;IAEa,UAAU,CAAC,KAAa,EAAE,MAAyD;;YAC/F,IAAI;gBACF,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;oBAC/B,KAAK,EAAE,UAAU;oBACjB,MAAM;oBACN,KAAK;iBACN,CAAC,CAAC;aACJ;YAAC,OAAO,CAAC,EAAE;aAGX;QACH,CAAC;KAAA;CACF"}
@@ -3,18 +3,12 @@ import { Flow } from '@or-sdk/deployer';
3
3
  import { IDWConfig } from './types';
4
4
  export declare class IDW extends Base {
5
5
  private readonly graphApi;
6
+ private readonly users;
6
7
  constructor(params: IDWConfig);
7
- createOrUpdateFlow(flow: Flow, { userId }: {
8
- userId: string;
9
- }): Promise<void>;
8
+ createOrUpdateFlow(flow: Flow): Promise<void>;
10
9
  deleteFlow(id: string): Promise<void>;
11
- activateFlow(id: string, activatedAt: number): Promise<void>;
10
+ activateFlow(flow: Flow): Promise<void>;
12
11
  deactivateFlow(id: string): Promise<void>;
13
12
  private graphQuery;
14
- afterSave(): Promise<void>;
15
- afterActivate(): Promise<void>;
16
- afterDeactivate(): Promise<void>;
17
- splitFromTree(): Promise<void>;
18
- deleteFromTree(): Promise<void>;
19
13
  }
20
14
  //# sourceMappingURL=idw.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"idw.d.ts","sourceRoot":"","sources":["../../src/idw.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,OAAO,EAAY,SAAS,EAAE,MAAM,SAAS,CAAC;AAS9C,qBAAa,GAAI,SAAQ,IAAI;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAatB,MAAM,EAAE,SAAS;IAuBvB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;KAAE;IAmC9D,UAAU,CAAC,EAAE,EAAE,MAAM;IAOrB,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAW5C,cAAc,CAAC,EAAE,EAAE,MAAM;YAQjB,UAAU;IAgBlB,SAAS;IAgBT,aAAa;IASb,eAAe;IAaf,aAAa;IAsBb,cAAc;CAWrB"}
1
+ {"version":3,"file":"idw.d.ts","sourceRoot":"","sources":["../../src/idw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAIxC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AASpC,qBAAa,GAAI,SAAQ,IAAI;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;gBAalB,MAAM,EAAE,SAAS;IA8BvB,kBAAkB,CAAC,IAAI,EAAE,IAAI;IAqG7B,UAAU,CAAC,EAAE,EAAE,MAAM;IAOrB,YAAY,CAAC,IAAI,EAAE,IAAI;IA2BvB,cAAc,CAAC,EAAE,EAAE,MAAM;YASjB,UAAU;CAYzB"}
@@ -3,11 +3,7 @@ export type IDWConfig = {
3
3
  accountId?: string;
4
4
  discoveryUrl?: string;
5
5
  graphUrl?: string;
6
+ sdkApiUrl?: string;
6
7
  token: Token;
7
8
  };
8
- export interface FlowMeta {
9
- idw?: {
10
- channel: string;
11
- } | undefined;
12
- }
13
9
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,MAAM,MAAM,SAAS,GAAG;IAItB,SAAS,CAAC,EAAE,MAAM,CAAC;IAKnB,YAAY,CAAC,EAAE,MAAM,CAAC;IAKtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAKlB,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,MAAM,WAAW,QAAQ;IACvB,GAAG,CAAC,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;KACjB,GAAG,SAAS,CAAC;CACf"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,MAAM,MAAM,SAAS,GAAG;IAItB,SAAS,CAAC,EAAE,MAAM,CAAC;IAKnB,YAAY,CAAC,EAAE,MAAM,CAAC;IAKtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAKlB,SAAS,CAAC,EAAE,MAAM,CAAC;IAKnB,KAAK,EAAE,KAAK,CAAC;CACd,CAAC"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.0-beta.1277.0",
2
+ "version": "1.1.0-beta.1286.0",
3
3
  "name": "@or-sdk/idw",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
@@ -27,7 +27,7 @@
27
27
  "@or-sdk/base": "workspace:^",
28
28
  "@or-sdk/deployer": "workspace:^",
29
29
  "@or-sdk/graph": "workspace:^",
30
- "@or-sdk/sdk-api": "workspace:^",
30
+ "@or-sdk/users": "workspace:*",
31
31
  "lodash": "^4.17.21"
32
32
  }
33
33
  }
package/src/idw.ts CHANGED
@@ -1,9 +1,9 @@
1
-
2
1
  import { Base } from '@or-sdk/base';
3
2
  import { Flow } from '@or-sdk/deployer';
4
3
  import { Graphs } from '@or-sdk/graph';
4
+ import { Users } from '@or-sdk/users';
5
5
  import { GRAPH_NAME, SERVICE_KEY } from './constants';
6
- import { FlowMeta, IDWConfig } from './types';
6
+ import { IDWConfig } from './types';
7
7
 
8
8
  /**
9
9
  * OneReach IDW service client
@@ -14,6 +14,7 @@ import { FlowMeta, IDWConfig } from './types';
14
14
  */
15
15
  export class IDW extends Base {
16
16
  private readonly graphApi: Graphs;
17
+ private readonly users: Users;
17
18
 
18
19
  /**
19
20
  * ```typescript
@@ -31,6 +32,7 @@ export class IDW extends Base {
31
32
  accountId,
32
33
  discoveryUrl,
33
34
  graphUrl,
35
+ sdkApiUrl,
34
36
  token,
35
37
  } = params;
36
38
 
@@ -47,9 +49,15 @@ export class IDW extends Base {
47
49
  graphUrl,
48
50
  token,
49
51
  });
52
+ this.users = new Users({
53
+ accountId,
54
+ token,
55
+ discoveryUrl,
56
+ sdkUrl: sdkApiUrl,
57
+ });
50
58
  }
51
59
 
52
- async createOrUpdateFlow(flow: Flow, { userId }: { userId: string; }) {
60
+ async createOrUpdateFlow(flow: Flow) {
53
61
  if (flow.id === undefined) {
54
62
  throw new Error('Only flows with id can be added to the IDW graph');
55
63
  }
@@ -58,56 +66,139 @@ export class IDW extends Base {
58
66
  return await this.deleteFlow(flow.id);
59
67
  }
60
68
 
61
- await this.graphQuery('\
62
- MERGE (flow:FLOW { id: $id } )\n\
63
- SET createdAt = $createdAt\n\
64
- SET createdBy = $userId\n\
65
- SET description = $description\n\
66
- SET groupId = groupId\n\
67
- SET isActive = false\n\
68
- SET name = $name\n\
69
- SET updatedAt = $updatedAt\n\
70
- SET updatedBy = $userId\n\
71
- ', {
69
+ const { userId } = await this.users.getCurrentUser();
70
+
71
+ await this.graphQuery(`
72
+ MERGE (flow:FLOW { id: $id })
73
+ ON MATCH
74
+ SET flow.createdAt = $createdAt,
75
+ flow.createdBy = $userId,
76
+ flow.description = $description,
77
+ flow.groupId = $groupId,
78
+ flow.name = $name,
79
+ flow.updatedAt = $updatedAt,
80
+ flow.updatedBy = $userId
81
+ ON CREATE
82
+ SET flow.createdAt = $createdAt,
83
+ flow.createdBy = $userId,
84
+ flow.description = $description,
85
+ flow.groupId = $groupId,
86
+ flow.isActive = false,
87
+ flow.name = $name,
88
+ flow.updatedAt = $updatedAt,
89
+ flow.updatedBy = $userId
90
+ RETURN flow
91
+ `,
92
+ {
72
93
  createdAt: flow.dateCreated,
73
94
  description: flow.data.description,
74
95
  groupId: flow.botId,
75
- id: flow.id as string,
96
+ id: flow.id,
76
97
  name: flow.data.label,
77
98
  updatedAt: flow.dateModified,
78
99
  userId,
79
- });
80
-
81
- const meta = (flow.data.meta as FlowMeta).idw;
82
- if (meta) {
83
- // TODO: process channel meta
84
100
  }
101
+ );
102
+
103
+ // const channel = flow.data.meta.idw?.channel;
104
+ // if (channel !== undefined) {
105
+ // const _channel = await this.getChannel(channel);
106
+ // if (channel !== undefined && _.isEmpty(_channel)) return;
107
+ // // TODO: ON MATCH DELETE [:IMPLEMENTS] relationship with channel node's { id != $channel }
108
+ // await this.deleteRelationship(flow.id, channel);
109
+ // // TODO: create :IMPLEMENTS relationship with channel node { id: $channel }
110
+ // await this.createRelationship(flow.id, channel);
111
+ // } else {
112
+ // // TODO: ON MATCH DELETE [:IMPLEMENTS] relationship with channel nodes
113
+ // await this.deleteAllRelationship(flow.id);
114
+ // }
85
115
  }
86
116
 
117
+ // async getChannel(channel: string) {
118
+ // return await this.graphQuery(`
119
+ // MATCH (channel: CHANNEL {id: $channel})
120
+ // RETURN channel`,
121
+ // { channel });
122
+ // }
123
+
124
+ // async getActivatedFlow(channel: string) {
125
+ // return await this.graphQuery(`
126
+ // MATCH (flow:FLOW { isActive: true })-[:IMPLEMENTS]-(:CHANNEL { channel: $channel })
127
+ // RETURN flow`,
128
+ // { channel });
129
+ // }
130
+
131
+ // async deleteRelationship(id: string, channel = '') {
132
+ // await this.graphQuery(`
133
+ // MATCH (:FLOW {id: $id})-[r:IMPLEMENTS]->(:CHANNEL {id: $channel})
134
+ // DELETE r
135
+ // `, {
136
+ // id,
137
+ // channel,
138
+ // });
139
+ // }
140
+
141
+ // async deleteAllRelationship(id: string, channel = '') {
142
+ // await this.graphQuery(`
143
+ // MATCH (:FLOW {id: $id})-[r:IMPLEMENTS]->(:CHANNEL)
144
+ // DELETE r
145
+ // `, {
146
+ // id,
147
+ // channel,
148
+ // });
149
+ // }
150
+
151
+ // async createRelationship(id: string, channel: string) {
152
+ // await this.graphQuery(`
153
+ // MATCH (f:FLOW {id: $id}), (c:CHANNEL {id: $channel})
154
+ // MERGE (f)-[:IMPLEMENTS]->(c)
155
+ // `, {
156
+ // id,
157
+ // channel,
158
+ // });
159
+ // }
160
+
87
161
  async deleteFlow(id: string) {
88
- await this.graphQuery('\
89
- MATCH (flow:FLOW { id: $id } )\n\
90
- DETACH DELETE flow\
91
- ', { id });
162
+ await this.graphQuery(`
163
+ MATCH (flow:FLOW { id: $id })
164
+ DETACH DELETE flow
165
+ `, { id });
92
166
  }
93
167
 
94
- async activateFlow(id: string, activatedAt: number) {
95
- await this.graphQuery('\
96
- MATCH (flow:FLOW { id: $id } )\n\
97
- SET flow.isActive = true\
98
- SET flow.activatedAt = $activatedAt\
99
- ', {
100
- activatedAt,
168
+ async activateFlow(flow: Flow) {
169
+ const id = flow.id;
170
+ if (id === undefined) {
171
+ throw new Error('Only flows with id can be added to the IDW graph');
172
+ }
173
+
174
+ // const channel = flow.data.meta?.idw?.channel;
175
+ // if (channel != undefined) {
176
+ // // TODO: only throw if a (:FLOW { isActive: true })-[:IMPLEMENTS]-(:CHANNEL { channel: $channel })
177
+ // const activatedFlow = await this.getActivatedFlow(channel);
178
+ // if (activatedFlow && activatedFlow.length > 0) {
179
+ // throw new Error(`Cannot activate second flow for channel ${channel}`);
180
+ // }
181
+ // }
182
+
183
+ await this.graphQuery(`
184
+ MATCH (flow:FLOW { id: $id })
185
+ SET flow.isActive = true,
186
+ flow.activatedAt = $activatedAt
187
+ RETURN flow
188
+ `, {
189
+ activatedAt: Date.now(),
101
190
  id,
102
191
  });
103
192
  }
104
193
 
194
+
105
195
  async deactivateFlow(id: string) {
106
- await this.graphQuery('\
107
- MATCH (flow:FLOW { id: $id } )\n\
108
- SET flow.isActive = false\
109
- REMOVE flow.activatedAt\
110
- ', { id });
196
+ await this.graphQuery(`
197
+ MATCH (flow:FLOW { id: $id } )
198
+ SET flow.isActive = false
199
+ REMOVE flow.activatedAt
200
+ RETURN flow
201
+ `, { id });
111
202
  }
112
203
 
113
204
  private async graphQuery(query: string, params?: Record<string, null | number | string | boolean>) {
@@ -118,83 +209,8 @@ export class IDW extends Base {
118
209
  query,
119
210
  });
120
211
  } catch (e) {
212
+
121
213
  // TODO: if 'idw' graph doesn't exist - create it, seed with channels data, and retry query
122
214
  }
123
215
  }
124
-
125
- /**
126
- * Create new node FLOW {activatede: false}
127
- * Create relationship FLOW-[:IMPLAMENTS]-CHANNEL
128
- */
129
- async afterSave() {
130
- // TODO: do we need this? this should be processed on flow save triggered from datahub
131
-
132
- // const channel = await this.getChannel();
133
- // const flow = await this.getFlow();
134
-
135
- // if (_.isEmpty(channel)) this.createChannel();
136
-
137
- // if (_.isEmpty(flow)) {
138
- // await this.createFlow();
139
- // }
140
- }
141
-
142
- /**
143
- * Set FLOW {activated: true}
144
- */
145
- async afterActivate() {
146
- // TODO: do we need this? this should be processed on activation triggered from deployer
147
-
148
- // this.setActivated(true);
149
- }
150
-
151
- /**
152
- * Set FLOW {activated: false}
153
- */
154
- async afterDeactivate() {
155
- // TODO: do we need this? this should be processed on deactivation triggered from deployer
156
-
157
- // this.setActivated(false);
158
- }
159
-
160
- /**
161
- * Set FLOW {activated: false}
162
- * Remove relationship FLOW-[:IMPLAMENTS]-CHANNEL
163
- * Remove flow.data.meta.idwData
164
- */
165
- // TODO: should be called by what it does, not the hook name - setChannelDataInFlowMeta
166
- // TODO: should accept parameters from the actual hook, not rely on properties of the IDW instance
167
- async splitFromTree() {
168
- // TODO: do we need this? AFAIU only meta should be updated
169
-
170
- // await this.setActivated(false);
171
- // await this.deleteRelationship(
172
- // 'FLOW',
173
- // { id: `'${this.flowId}'` },
174
- // 'CHANNEL',
175
- // { id: `'${this.channel}'` },
176
- // 'IMPLEMENTS'
177
- // );
178
-
179
- // delete this.flow.data.meta.idw;
180
- }
181
-
182
- /**
183
- * Set FLOW {activated: false}
184
- * Remove relationship FLOW-[:IMPLAMENTS]-CHANNEL
185
- * Remove flow.data.meta.idwData
186
- */
187
- // TODO: should be called by what it does, not the hook name - deleteChannelDataFromFlowMeta?
188
- // TODO: should accept parameters from the actual hook, not rely on properties of the IDW instance
189
- async deleteFromTree() {
190
- // await this.setActivated(false);
191
- // await this.deleteRelationship(
192
- // 'FLOW',
193
- // { id: `'${this.flowId}'` },
194
- // 'CHANNEL',
195
- // { id: `'${this.channel}'` },
196
- // 'IMPLEMENTS'
197
- // );
198
- // delete this.flow.data.meta.idwData;
199
- }
200
216
  }
package/src/types.ts CHANGED
@@ -12,18 +12,17 @@ export type IDWConfig = {
12
12
  discoveryUrl?: string;
13
13
 
14
14
  /**
15
- * Url of OneReach graph api
15
+ * Url of OneReach.ai Graph api
16
16
  */
17
17
  graphUrl?: string;
18
18
 
19
+ /**
20
+ * Url of OneReach.ai SDK api
21
+ */
22
+ sdkApiUrl?: string;
23
+
19
24
  /**
20
25
  * token
21
26
  */
22
27
  token: Token;
23
28
  };
24
-
25
- export interface FlowMeta {
26
- idw?: {
27
- channel: string;
28
- } | undefined;
29
- }