@or-sdk/idw 3.1.1 → 3.1.2-beta.1709.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.
Files changed (66) hide show
  1. package/dist/cjs/index.js +1 -17
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/esm/index.js +0 -4
  4. package/dist/esm/index.js.map +1 -1
  5. package/dist/types/api/channelApi.d.ts +3 -1
  6. package/dist/types/api/channelApi.d.ts.map +1 -1
  7. package/dist/types/api/memoryApi.d.ts +1 -1
  8. package/dist/types/api/memoryApi.d.ts.map +1 -1
  9. package/dist/types/index.d.ts +0 -3
  10. package/dist/types/index.d.ts.map +1 -1
  11. package/dist/types/types/config.d.ts +0 -7
  12. package/dist/types/types/config.d.ts.map +1 -1
  13. package/package.json +3 -10
  14. package/src/api/channelApi.ts +1 -1
  15. package/src/api/memoryApi.ts +1 -1
  16. package/src/index.ts +0 -3
  17. package/src/types/config.ts +0 -28
  18. package/dist/cjs/idw.js +0 -323
  19. package/dist/cjs/idw.js.map +0 -1
  20. package/dist/cjs/migration-base.js +0 -72
  21. package/dist/cjs/migration-base.js.map +0 -1
  22. package/dist/cjs/migration-handler.js +0 -183
  23. package/dist/cjs/migration-handler.js.map +0 -1
  24. package/dist/cjs/migrations/Migration__1.js +0 -108
  25. package/dist/cjs/migrations/Migration__1.js.map +0 -1
  26. package/dist/cjs/migrations/Migration__2.js +0 -155
  27. package/dist/cjs/migrations/Migration__2.js.map +0 -1
  28. package/dist/cjs/migrations/Migration__3.js +0 -108
  29. package/dist/cjs/migrations/Migration__3.js.map +0 -1
  30. package/dist/cjs/migrations/index.js +0 -13
  31. package/dist/cjs/migrations/index.js.map +0 -1
  32. package/dist/esm/idw.js +0 -252
  33. package/dist/esm/idw.js.map +0 -1
  34. package/dist/esm/migration-base.js +0 -30
  35. package/dist/esm/migration-base.js.map +0 -1
  36. package/dist/esm/migration-handler.js +0 -86
  37. package/dist/esm/migration-handler.js.map +0 -1
  38. package/dist/esm/migrations/Migration__1.js +0 -40
  39. package/dist/esm/migrations/Migration__1.js.map +0 -1
  40. package/dist/esm/migrations/Migration__2.js +0 -80
  41. package/dist/esm/migrations/Migration__2.js.map +0 -1
  42. package/dist/esm/migrations/Migration__3.js +0 -53
  43. package/dist/esm/migrations/Migration__3.js.map +0 -1
  44. package/dist/esm/migrations/index.js +0 -4
  45. package/dist/esm/migrations/index.js.map +0 -1
  46. package/dist/types/idw.d.ts +0 -23
  47. package/dist/types/idw.d.ts.map +0 -1
  48. package/dist/types/migration-base.d.ts +0 -24
  49. package/dist/types/migration-base.d.ts.map +0 -1
  50. package/dist/types/migration-handler.d.ts +0 -20
  51. package/dist/types/migration-handler.d.ts.map +0 -1
  52. package/dist/types/migrations/Migration__1.d.ts +0 -6
  53. package/dist/types/migrations/Migration__1.d.ts.map +0 -1
  54. package/dist/types/migrations/Migration__2.d.ts +0 -7
  55. package/dist/types/migrations/Migration__2.d.ts.map +0 -1
  56. package/dist/types/migrations/Migration__3.d.ts +0 -5
  57. package/dist/types/migrations/Migration__3.d.ts.map +0 -1
  58. package/dist/types/migrations/index.d.ts +0 -4
  59. package/dist/types/migrations/index.d.ts.map +0 -1
  60. package/src/idw.ts +0 -291
  61. package/src/migration-base.ts +0 -35
  62. package/src/migration-handler.ts +0 -94
  63. package/src/migrations/Migration__1.ts +0 -33
  64. package/src/migrations/Migration__2.ts +0 -69
  65. package/src/migrations/Migration__3.ts +0 -45
  66. package/src/migrations/index.ts +0 -3
package/dist/cjs/index.js CHANGED
@@ -10,28 +10,12 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
15
  };
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
16
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.IdwApi = exports.migrations = exports.IDW = void 0;
30
- var idw_1 = require("./idw");
31
- Object.defineProperty(exports, "IDW", { enumerable: true, get: function () { return idw_1.IDW; } });
17
+ exports.IdwApi = void 0;
32
18
  __exportStar(require("./types"), exports);
33
- exports.migrations = __importStar(require("./migrations"));
34
- __exportStar(require("./api"), exports);
35
19
  var idwApi_1 = require("./idwApi");
36
20
  Object.defineProperty(exports, "IdwApi", { enumerable: true, get: function () { return idwApi_1.IdwApi; } });
37
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA4B;AAAnB,0FAAA,GAAG,OAAA;AACZ,0CAAwB;AACxB,2DAA2C;AAC3C,wCAAsB;AACtB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA"}
package/dist/esm/index.js CHANGED
@@ -1,7 +1,3 @@
1
- export { IDW } from './idw';
2
1
  export * from './types';
3
- import * as migrations_1 from './migrations';
4
- export { migrations_1 as migrations };
5
- export * from './api';
6
2
  export { IdwApi } from './idwApi';
7
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,cAAc,SAAS,CAAC;8BACI,cAAc;yBAA9B,UAAU;AACtB,cAAc,OAAO,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
@@ -9,6 +9,8 @@ export declare class ChannelApi {
9
9
  deleteAllChannels(): Promise<void>;
10
10
  updateChannel(id: string, data: ChannelUpdateData): Promise<Channel>;
11
11
  createChannel(data: ChannelCreateData): Promise<Channel>;
12
- getSuggestedChannels(): Promise<ListChannels>;
12
+ getSuggestedChannels(): Promise<{
13
+ channels: Channel[];
14
+ }>;
13
15
  }
14
16
  //# sourceMappingURL=channelApi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"channelApi.d.ts","sourceRoot":"","sources":["../../../src/api/channelApi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACxG,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,qBAAa,UAAU;IAEnB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAOvC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAahD,cAAc,IAAI,OAAO,CAAC,YAAY,CAAC;IAUvC,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAaxC,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAYlC,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAepE,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAWxD,oBAAoB,IAAI,OAAO,CAAC,YAAY,CAAC;CAK9C"}
1
+ {"version":3,"file":"channelApi.d.ts","sourceRoot":"","sources":["../../../src/api/channelApi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACxG,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,qBAAa,UAAU;IAEnB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAOvC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAahD,cAAc,IAAI,OAAO,CAAC,YAAY,CAAC;IAUvC,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAaxC,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAYlC,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAepE,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAWxD,oBAAoB,IAAI,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;KAAC,CAAC;CAKxD"}
@@ -1,5 +1,5 @@
1
1
  import { Providers } from '@or-sdk/providers';
2
- import { ListMemories, Memory, MemoryCreateData, MemoryUpdateData } from '../types/memory';
2
+ import { ListMemories, Memory, MemoryCreateData, MemoryUpdateData } from '../types';
3
3
  export declare class MemoryApi {
4
4
  private readonly providers;
5
5
  constructor(providers: Providers);
@@ -1 +1 @@
1
- {"version":3,"file":"memoryApi.d.ts","sourceRoot":"","sources":["../../../src/api/memoryApi.ts"],"names":[],"mappings":"AAAA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AC;IAejE,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;CAOtD"}
@@ -1,6 +1,3 @@
1
- export { IDW } from './idw';
2
1
  export * from './types';
3
- export * as migrations from './migrations';
4
- export * from './api';
5
2
  export { IdwApi } from './idwApi';
6
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,cAAc,OAAO,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
@@ -1,11 +1,4 @@
1
1
  import { Token } from '@or-sdk/base';
2
- export type IDWConfig = {
3
- accountId?: string;
4
- discoveryUrl?: string;
5
- graphUrl?: string;
6
- sdkApiUrl?: string;
7
- token: Token;
8
- };
9
2
  export type IDWBaseConfig = {
10
3
  providerAccountId: string;
11
4
  emUrl: string;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,MAAM,MAAM,SAAS,GAAG;IAKtB,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;AAEF,MAAM,MAAM,aAAa,GAAG;IAI1B,iBAAiB,EAAE,MAAM,CAAC;IAI1B,KAAK,EAAE,MAAM,CAAC;IAId,KAAK,EAAE,KAAK,CAAC;CACd,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,MAAM,MAAM,aAAa,GAAG;IAI1B,iBAAiB,EAAE,MAAM,CAAC;IAI1B,KAAK,EAAE,MAAM,CAAC;IAId,KAAK,EAAE,KAAK,CAAC;CACd,CAAC"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.1.1",
2
+ "version": "3.1.2-beta.1709.0",
3
3
  "name": "@or-sdk/idw",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
@@ -24,15 +24,8 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "@or-sdk/accounts": "^1.2.13",
28
27
  "@or-sdk/base": "^0.28.3",
29
28
  "@or-sdk/deployer": "^1.1.5",
30
- "@or-sdk/flows": "^2.1.3",
31
- "@or-sdk/graph": "^1.6.0",
32
- "@or-sdk/providers": "^0.2.4",
33
- "@or-sdk/settings": "^0.24.11",
34
- "@or-sdk/users": "^0.30.2",
35
- "axios": "^0.24.0"
36
- },
37
- "gitHead": "4bdccd42eb7764b461ce826645cd0dff6e789d68"
29
+ "@or-sdk/providers": "^0.2.4"
30
+ }
38
31
  }
@@ -85,7 +85,7 @@ export class ChannelApi {
85
85
  /**
86
86
  * @description Get all suggested (unlinked) channels
87
87
  */
88
- getSuggestedChannels(): Promise<ListChannels> {
88
+ getSuggestedChannels(): Promise<{channels: Channel[];}> {
89
89
  return this.providers.makeRequest({
90
90
  route: buildRoute('channels/suggested'),
91
91
  });
@@ -1,5 +1,5 @@
1
1
  import { Providers } from '@or-sdk/providers';
2
- import { ListMemories, Memory, MemoryCreateData, MemoryUpdateData } from '../types/memory';
2
+ import { ListMemories, Memory, MemoryCreateData, MemoryUpdateData } from '../types';
3
3
  import { buildRoute } from '../helpers';
4
4
 
5
5
  export class MemoryApi {
package/src/index.ts CHANGED
@@ -1,5 +1,2 @@
1
- export { IDW } from './idw';
2
1
  export * from './types';
3
- export * as migrations from './migrations';
4
- export * from './api';
5
2
  export { IdwApi } from './idwApi';
@@ -1,33 +1,5 @@
1
1
  import { Token } from '@or-sdk/base';
2
2
 
3
- export type IDWConfig = {
4
-
5
- /**
6
- * Account ID for cross-account requests (super admin only)
7
- */
8
- accountId?: string;
9
-
10
- /**
11
- * Url of OneReach service discovery api
12
- */
13
- discoveryUrl?: string;
14
-
15
- /**
16
- * Url of OneReach.ai Graph api
17
- */
18
- graphUrl?: string;
19
-
20
- /**
21
- * Url of OneReach.ai SDK api
22
- */
23
- sdkApiUrl?: string;
24
-
25
- /**
26
- * token
27
- */
28
- token: Token;
29
- };
30
-
31
3
  export type IDWBaseConfig = {
32
4
  /**
33
5
  * onereach account ID
package/dist/cjs/idw.js DELETED
@@ -1,323 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
- var __importDefault = (this && this.__importDefault) || function (mod) {
54
- return (mod && mod.__esModule) ? mod : { "default": mod };
55
- };
56
- Object.defineProperty(exports, "__esModule", { value: true });
57
- exports.IDW = void 0;
58
- var settings_1 = require("@or-sdk/settings");
59
- var base_1 = require("@or-sdk/base");
60
- var graph_1 = require("@or-sdk/graph");
61
- var users_1 = require("@or-sdk/users");
62
- var accounts_1 = require("@or-sdk/accounts");
63
- var constants_1 = require("./constants");
64
- var migration_handler_1 = __importDefault(require("./migration-handler"));
65
- var flows_1 = require("@or-sdk/flows");
66
- var IDW = (function (_super) {
67
- __extends(IDW, _super);
68
- function IDW(params) {
69
- var _this = this;
70
- var accountId = params.accountId, discoveryUrl = params.discoveryUrl, graphUrl = params.graphUrl, sdkApiUrl = params.sdkApiUrl, token = params.token;
71
- _this = _super.call(this, {
72
- accountId: accountId,
73
- discoveryUrl: discoveryUrl,
74
- serviceKey: constants_1.SERVICE_KEY,
75
- token: token,
76
- }) || this;
77
- _this.graphApi = new graph_1.Graphs({
78
- accountId: accountId,
79
- discoveryUrl: discoveryUrl,
80
- graphUrl: graphUrl,
81
- token: token,
82
- });
83
- _this.users = new users_1.Users({
84
- accountId: accountId,
85
- token: token,
86
- discoveryUrl: discoveryUrl,
87
- sdkUrl: sdkApiUrl,
88
- });
89
- _this.accounts = new accounts_1.Accounts({
90
- token: token,
91
- discoveryUrl: discoveryUrl,
92
- sdkUrl: sdkApiUrl,
93
- });
94
- _this.settings = new settings_1.Settings({
95
- token: token,
96
- sdkUrl: sdkApiUrl,
97
- });
98
- _this.flows = new flows_1.Flows({
99
- token: token,
100
- discoveryUrl: discoveryUrl,
101
- });
102
- _this.accountId = accountId;
103
- _this.migrationHandler = new migration_handler_1.default(_this.graphApi, _this.users, _this.accounts, _this.settings, _this.accountId, _this.flows);
104
- return _this;
105
- }
106
- IDW.prototype.runMigrations = function () {
107
- return __awaiter(this, void 0, void 0, function () {
108
- return __generator(this, function (_a) {
109
- switch (_a.label) {
110
- case 0: return [4, this.migrationHandler.applyMigrations()];
111
- case 1:
112
- _a.sent();
113
- return [2];
114
- }
115
- });
116
- });
117
- };
118
- IDW.prototype.checkOrCreateDb = function () {
119
- return __awaiter(this, void 0, void 0, function () {
120
- var e_1;
121
- return __generator(this, function (_a) {
122
- switch (_a.label) {
123
- case 0:
124
- _a.trys.push([0, 2, , 3]);
125
- return [4, this.graphApi.getGraphInfo(constants_1.GRAPH_NAME)];
126
- case 1:
127
- _a.sent();
128
- return [3, 3];
129
- case 2:
130
- e_1 = _a.sent();
131
- this.createDb();
132
- this.migrationHandler.deleteMigrationVersion();
133
- return [3, 3];
134
- case 3: return [2];
135
- }
136
- });
137
- });
138
- };
139
- IDW.prototype.createDb = function () {
140
- return __awaiter(this, void 0, void 0, function () {
141
- return __generator(this, function (_a) {
142
- switch (_a.label) {
143
- case 0: return [4, this.graphApi.createGraph({ name: constants_1.GRAPH_NAME })];
144
- case 1:
145
- _a.sent();
146
- return [2];
147
- }
148
- });
149
- });
150
- };
151
- IDW.prototype.createOrUpdateFlow = function (flow) {
152
- var _a, _b, _c, _d, _e, _f;
153
- return __awaiter(this, void 0, void 0, function () {
154
- var id, _g, username, userId, channel, skills, preparedIds;
155
- return __generator(this, function (_h) {
156
- switch (_h.label) {
157
- case 0:
158
- id = flow.id;
159
- if (id === undefined) {
160
- throw new Error('Only flows with id can be added to the IDW graph');
161
- }
162
- if (!flow.isDeleted) return [3, 2];
163
- return [4, this.deleteFlow(id)];
164
- case 1: return [2, _h.sent()];
165
- case 2: return [4, this.users.getCurrentUser()];
166
- case 3:
167
- _g = _h.sent(), username = _g.username, userId = _g.userId;
168
- 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 = $username,\n flow.steps = $steps\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 = $username,\n flow.steps = $steps\n RETURN flow\n ", {
169
- createdAt: flow.dateCreated,
170
- description: flow.data.description,
171
- groupId: flow.botId,
172
- id: id,
173
- name: flow.data.label,
174
- updatedAt: flow.dateModified,
175
- username: username,
176
- userId: userId,
177
- steps: (_d = (_c = (_b = (_a = flow.data.trees) === null || _a === void 0 ? void 0 : _a.main) === null || _b === void 0 ? void 0 : _b.steps) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0,
178
- })];
179
- case 4:
180
- _h.sent();
181
- return [4, this.graphQuery("\n MATCH (flow:FLOW { id: $id })\n OPTIONAL MATCH (flow)-[channelRelations:IMPLEMENTS { isActive: false }]->(:CHANNEL)\n OPTIONAL MATCH (flow)-[skillRelations:IMPLEMENTS { isActive: false }]->(:SKILL)\n DELETE channelRelations, skillRelations\n ", { id: id })];
182
- case 5:
183
- _h.sent();
184
- channel = (_e = flow.data.meta.idw) === null || _e === void 0 ? void 0 : _e.channel;
185
- skills = (_f = flow.data.meta.idw) === null || _f === void 0 ? void 0 : _f.skills;
186
- if (!(channel !== undefined && channel.length !== 0)) return [3, 7];
187
- return [4, this.graphQuery("\n MATCH (flow:FLOW { id: $id }),\n (channel:CHANNEL { id: $channel })\n MERGE (flow)-[relationship:IMPLEMENTS]->(channel)\n ON CREATE\n SET relationship.isActive = false\n ", {
188
- channel: channel,
189
- id: id,
190
- })];
191
- case 6:
192
- _h.sent();
193
- _h.label = 7;
194
- case 7:
195
- if (!(skills === null || skills === void 0 ? void 0 : skills.length)) return [3, 9];
196
- preparedIds = skills.map(function (id) { return "'".concat(id, "'"); });
197
- return [4, this.graphQuery("\n MATCH (flow:FLOW { id: $id }), (skill:SKILL)\n WHERE skill.id in [".concat(preparedIds, "]\n MERGE (flow)-[relationship:IMPLEMENTS]->(skill)\n ON CREATE\n SET relationship.isActive = false\n "), {
198
- id: id,
199
- })];
200
- case 8:
201
- _h.sent();
202
- _h.label = 9;
203
- case 9: return [2];
204
- }
205
- });
206
- });
207
- };
208
- IDW.prototype.deleteFlow = function (id) {
209
- return __awaiter(this, void 0, void 0, function () {
210
- return __generator(this, function (_a) {
211
- switch (_a.label) {
212
- case 0: return [4, this.graphQuery("\n MATCH (flow:FLOW { id: $id })\n DETACH DELETE flow\n ", { id: id })];
213
- case 1:
214
- _a.sent();
215
- return [2];
216
- }
217
- });
218
- });
219
- };
220
- IDW.prototype.deleteFlows = function (ids) {
221
- return __awaiter(this, void 0, void 0, function () {
222
- return __generator(this, function (_a) {
223
- switch (_a.label) {
224
- case 0:
225
- if (!ids.length) return [3, 2];
226
- return [4, this.graphQuery("\n MATCH (flow:FLOW)\n where flow.id in [".concat(ids.map(function (id) { return "'".concat(id, "'"); }), "]\n DETACH DELETE flow\n "))];
227
- case 1:
228
- _a.sent();
229
- _a.label = 2;
230
- case 2: return [2];
231
- }
232
- });
233
- });
234
- };
235
- IDW.prototype.activateFlow = function (flow) {
236
- var _a, _b;
237
- return __awaiter(this, void 0, void 0, function () {
238
- var id, channel, skills, preparedIds;
239
- return __generator(this, function (_c) {
240
- switch (_c.label) {
241
- case 0:
242
- id = flow.id;
243
- if (id === undefined) {
244
- throw new Error('Only flows with id can be added to the IDW graph');
245
- }
246
- return [4, this.graphQuery("\n MATCH (flow:FLOW { id: $id })\n OPTIONAL MATCH (flow)-[channelRelations:IMPLEMENTS]->(:CHANNEL)\n OPTIONAL MATCH (flow)-[skillRelations:IMPLEMENTS]->(:SKILL)\n DELETE channelRelations, skillRelations\n SET flow.activatedAt = $activatedAt,\n flow.isActive = true\n ", {
247
- activatedAt: Date.now(),
248
- id: id,
249
- })];
250
- case 1:
251
- _c.sent();
252
- channel = (_a = flow.data.meta.idw) === null || _a === void 0 ? void 0 : _a.channel;
253
- skills = (_b = flow.data.meta.idw) === null || _b === void 0 ? void 0 : _b.skills;
254
- if (!(channel !== undefined && channel.length !== 0)) return [3, 3];
255
- return [4, this.graphQuery("\n MATCH (flow:FLOW { id: $id }),\n (channel:CHANNEL { id: $channel })\n MERGE (flow)-[relationship:IMPLEMENTS]->(channel)\n SET relationship.isActive = true\n ", {
256
- channel: channel,
257
- id: id,
258
- })];
259
- case 2:
260
- _c.sent();
261
- _c.label = 3;
262
- case 3:
263
- if (!(skills === null || skills === void 0 ? void 0 : skills.length)) return [3, 5];
264
- preparedIds = skills.map(function (id) { return "'".concat(id, "'"); });
265
- return [4, this.graphQuery("\n MATCH (flow:FLOW { id: $id }), (skill:SKILL)\n WHERE skill.id in [".concat(preparedIds, "]\n MERGE (flow)-[relationship:IMPLEMENTS]->(skill)\n SET relationship.isActive = true\n "), {
266
- id: id,
267
- })];
268
- case 4:
269
- _c.sent();
270
- _c.label = 5;
271
- case 5: return [2];
272
- }
273
- });
274
- });
275
- };
276
- IDW.prototype.deactivateFlow = function (id) {
277
- return __awaiter(this, void 0, void 0, function () {
278
- return __generator(this, function (_a) {
279
- switch (_a.label) {
280
- case 0: return [4, this.graphQuery("\n MATCH (flow:FLOW { id: $id })\n OPTIONAL MATCH (flow)-[channelRelations:IMPLEMENTS]->(:CHANNEL)\n OPTIONAL MATCH (flow)-[skillRelations:IMPLEMENTS]->(:SKILL)\n SET flow.isActive = false,\n channelRelations.isActive = false,\n skillRelations.isActive = false\n REMOVE flow.activatedAt\n RETURN flow\n ", { id: id })];
281
- case 1:
282
- _a.sent();
283
- return [2];
284
- }
285
- });
286
- });
287
- };
288
- IDW.prototype.graphQuery = function (query, params) {
289
- return __awaiter(this, void 0, void 0, function () {
290
- var e_2, e_3;
291
- return __generator(this, function (_a) {
292
- switch (_a.label) {
293
- case 0:
294
- _a.trys.push([0, 2, , 3]);
295
- return [4, this.checkOrCreateDb()];
296
- case 1:
297
- _a.sent();
298
- return [3, 3];
299
- case 2:
300
- e_2 = _a.sent();
301
- console.warn(e_2);
302
- return [3, 3];
303
- case 3:
304
- _a.trys.push([3, 5, , 6]);
305
- return [4, this.graphApi.query({
306
- graph: constants_1.GRAPH_NAME,
307
- params: params,
308
- query: query,
309
- })];
310
- case 4: return [2, _a.sent()];
311
- case 5:
312
- e_3 = _a.sent();
313
- console.warn(e_3);
314
- return [3, 6];
315
- case 6: return [2];
316
- }
317
- });
318
- });
319
- };
320
- return IDW;
321
- }(base_1.Base));
322
- exports.IDW = IDW;
323
- //# sourceMappingURL=idw.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"idw.js","sourceRoot":"","sources":["../../src/idw.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA4C;AAC5C,qCAAoC;AACpC,uCAAuC;AACvC,uCAAsC;AACtC,6CAA4C;AAC5C,yCAAsD;AAEtD,0EAAmD;AAEnD,uCAAsC;AAQtC;IAAyB,uBAAI;IAoB3B,aAAY,MAAiB;QAA7B,iBAoDC;QAlDG,IAAA,SAAS,GAKP,MAAM,UALC,EACT,YAAY,GAIV,MAAM,aAJI,EACZ,QAAQ,GAGN,MAAM,SAHA,EACR,SAAS,GAEP,MAAM,UAFC,EACT,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;QACH,KAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC;YACrB,SAAS,WAAA;YACT,KAAK,OAAA;YACL,YAAY,cAAA;YACZ,MAAM,EAAE,SAAS;SAClB,CAAC,CAAC;QACH,KAAI,CAAC,QAAQ,GAAG,IAAI,mBAAQ,CAAC;YAC3B,KAAK,OAAA;YACL,YAAY,cAAA;YACZ,MAAM,EAAE,SAAS;SAClB,CAAC,CAAC;QACH,KAAI,CAAC,QAAQ,GAAG,IAAI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C,yMAKrB,EAAE;gCACD,OAAO,SAAA;gCACP,EAAE,IAAA;6BACH,CAAC,EAAA;;wBARF,SAQE,CAAC;;;6BAGD,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,CAAA,EAAd,cAAc;wBACV,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,UAAA,EAAE,IAAI,OAAA,WAAI,EAAE,MAAG,EAAT,CAAS,CAAC,CAAC;wBAChD,WAAM,IAAI,CAAC,UAAU,CAAC,6FAEC,WAAW,iHAGjC,EAAE;gCACD,EAAE,IAAA;6BACH,CAAC,EAAA;;wBAPF,SAOE,CAAC;;;;;;KAEN;IAEK,4BAAc,GAApB,UAAqB,EAAU;;;;4BAC7B,WAAM,IAAI,CAAC,UAAU,CAAC,oWASrB,EAAE,EAAE,EAAE,IAAA,EAAE,CAAC,EAAA;;wBATV,SASU,CAAC;;;;;KACZ;IAEa,wBAAU,GAAxB,UAAyB,KAAa,EAAE,MAAyD;;;;;;;wBAG7F,WAAM,IAAI,CAAC,eAAe,EAAE,EAAA;;wBAA5B,SAA4B,CAAC;;;;wBAE7B,OAAO,CAAC,IAAI,CAAC,GAAC,CAAC,CAAC;;;;wBAKT,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;;;wBAEH,OAAO,CAAC,IAAI,CAAC,GAAC,CAAC,CAAC;;;;;;KAGnB;IACH,UAAC;AAAD,CAAC,AAjRD,CAAyB,WAAI,GAiR5B;AAjRY,kBAAG"}
@@ -1,72 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.MigrationBase = void 0;
40
- var MigrationBase = (function () {
41
- function MigrationBase(graphApi, users, accounts, settings, accountId, flows) {
42
- this.graphApi = graphApi;
43
- this.users = users;
44
- this.accounts = accounts;
45
- this.settings = settings;
46
- this.accountId = accountId;
47
- this.flows = flows;
48
- }
49
- MigrationBase.prototype.resolveAccountId = function () {
50
- var _a;
51
- return __awaiter(this, void 0, void 0, function () {
52
- var _this = this;
53
- return __generator(this, function (_b) {
54
- return [2, (_a = this.accountId) !== null && _a !== void 0 ? _a : (function () { return __awaiter(_this, void 0, void 0, function () {
55
- var accountId;
56
- return __generator(this, function (_a) {
57
- switch (_a.label) {
58
- case 0: return [4, this.users.getCurrentUser()];
59
- case 1:
60
- accountId = (_a.sent()).accountId;
61
- this.accountId = accountId;
62
- return [2, accountId];
63
- }
64
- });
65
- }); })()];
66
- });
67
- });
68
- };
69
- return MigrationBase;
70
- }());
71
- exports.MigrationBase = MigrationBase;
72
- //# sourceMappingURL=migration-base.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"migration-base.js","sourceRoot":"","sources":["../../src/migration-base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA;IACE,uBACY,QAAgB,EAChB,KAAY,EACZ,QAAkB,EAClB,QAAkB,EAClB,SAA6B,EAC7B,KAAY;QALZ,aAAQ,GAAR,QAAQ,CAAQ;QAChB,UAAK,GAAL,KAAK,CAAO;QACZ,aAAQ,GAAR,QAAQ,CAAU;QAClB,aAAQ,GAAR,QAAQ,CAAU;QAClB,cAAS,GAAT,SAAS,CAAoB;QAC7B,UAAK,GAAL,KAAK,CAAO;IAExB,CAAC;IAIe,wCAAgB,GAAhC;;;;;gBACE,WAAO,MAAA,IAAI,CAAC,SAAS,mCAAI,CAAC;;;;wCACF,WAAM,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,EAAA;;oCAA/C,SAAS,GAAK,CAAA,SAAiC,CAAA,UAAtC;oCACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;oCAC3B,WAAO,SAAS,EAAC;;;yBAClB,CAAC,EAAE,EAAC;;;KACN;IACH,oBAAC;AAAD,CAAC,AApBD,IAoBC;AApBqB,sCAAa"}