@or-sdk/idw 3.1.1 → 4.0.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/CHANGELOG.md +13 -0
- package/dist/cjs/index.js +1 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +0 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/types/api/channelApi.d.ts +3 -1
- package/dist/types/api/channelApi.d.ts.map +1 -1
- package/dist/types/api/memoryApi.d.ts +1 -1
- package/dist/types/api/memoryApi.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types/config.d.ts +0 -7
- package/dist/types/types/config.d.ts.map +1 -1
- package/package.json +3 -9
- package/src/api/channelApi.ts +1 -1
- package/src/api/memoryApi.ts +1 -1
- package/src/index.ts +0 -3
- package/src/types/config.ts +0 -28
- package/dist/cjs/idw.js +0 -323
- package/dist/cjs/idw.js.map +0 -1
- package/dist/cjs/migration-base.js +0 -72
- package/dist/cjs/migration-base.js.map +0 -1
- package/dist/cjs/migration-handler.js +0 -183
- package/dist/cjs/migration-handler.js.map +0 -1
- package/dist/cjs/migrations/Migration__1.js +0 -108
- package/dist/cjs/migrations/Migration__1.js.map +0 -1
- package/dist/cjs/migrations/Migration__2.js +0 -155
- package/dist/cjs/migrations/Migration__2.js.map +0 -1
- package/dist/cjs/migrations/Migration__3.js +0 -108
- package/dist/cjs/migrations/Migration__3.js.map +0 -1
- package/dist/cjs/migrations/index.js +0 -13
- package/dist/cjs/migrations/index.js.map +0 -1
- package/dist/esm/idw.js +0 -252
- package/dist/esm/idw.js.map +0 -1
- package/dist/esm/migration-base.js +0 -30
- package/dist/esm/migration-base.js.map +0 -1
- package/dist/esm/migration-handler.js +0 -86
- package/dist/esm/migration-handler.js.map +0 -1
- package/dist/esm/migrations/Migration__1.js +0 -40
- package/dist/esm/migrations/Migration__1.js.map +0 -1
- package/dist/esm/migrations/Migration__2.js +0 -80
- package/dist/esm/migrations/Migration__2.js.map +0 -1
- package/dist/esm/migrations/Migration__3.js +0 -53
- package/dist/esm/migrations/Migration__3.js.map +0 -1
- package/dist/esm/migrations/index.js +0 -4
- package/dist/esm/migrations/index.js.map +0 -1
- package/dist/types/idw.d.ts +0 -23
- package/dist/types/idw.d.ts.map +0 -1
- package/dist/types/migration-base.d.ts +0 -24
- package/dist/types/migration-base.d.ts.map +0 -1
- package/dist/types/migration-handler.d.ts +0 -20
- package/dist/types/migration-handler.d.ts.map +0 -1
- package/dist/types/migrations/Migration__1.d.ts +0 -6
- package/dist/types/migrations/Migration__1.d.ts.map +0 -1
- package/dist/types/migrations/Migration__2.d.ts +0 -7
- package/dist/types/migrations/Migration__2.d.ts.map +0 -1
- package/dist/types/migrations/Migration__3.d.ts +0 -5
- package/dist/types/migrations/Migration__3.d.ts.map +0 -1
- package/dist/types/migrations/index.d.ts +0 -4
- package/dist/types/migrations/index.d.ts.map +0 -1
- package/src/idw.ts +0 -291
- package/src/migration-base.ts +0 -35
- package/src/migration-handler.ts +0 -94
- package/src/migrations/Migration__1.ts +0 -33
- package/src/migrations/Migration__2.ts +0 -69
- package/src/migrations/Migration__3.ts +0 -45
- package/src/migrations/index.ts +0 -3
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
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
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
-
function step(op) {
|
|
39
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
-
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;
|
|
42
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
-
switch (op[0]) {
|
|
44
|
-
case 0: case 1: t = op; break;
|
|
45
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
-
default:
|
|
49
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
-
if (t[2]) _.ops.pop();
|
|
54
|
-
_.trys.pop(); continue;
|
|
55
|
-
}
|
|
56
|
-
op = body.call(thisArg, _);
|
|
57
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
-
var constants_1 = require("./constants");
|
|
63
|
-
var migrations = __importStar(require("./migrations"));
|
|
64
|
-
var PREFIX = 'Migration__';
|
|
65
|
-
var MigrationHandler = (function () {
|
|
66
|
-
function MigrationHandler(graphApi, users, accounts, settings, accountId, flows) {
|
|
67
|
-
var _this = this;
|
|
68
|
-
this.graphApi = graphApi;
|
|
69
|
-
this.users = users;
|
|
70
|
-
this.accounts = accounts;
|
|
71
|
-
this.settings = settings;
|
|
72
|
-
this.accountId = accountId;
|
|
73
|
-
this.flows = flows;
|
|
74
|
-
this.migrations = new Map(Object.values(migrations)
|
|
75
|
-
.map(function (ctor) { return [
|
|
76
|
-
ctor.name, new ctor(_this.graphApi, _this.users, _this.accounts, _this.settings, _this.accountId, _this.flows),
|
|
77
|
-
]; }));
|
|
78
|
-
}
|
|
79
|
-
MigrationHandler.prototype.applyMigrations = function () {
|
|
80
|
-
var _a;
|
|
81
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
82
|
-
var accountsLatestVersion, migrationVersions, i, migration, e_1;
|
|
83
|
-
return __generator(this, function (_b) {
|
|
84
|
-
switch (_b.label) {
|
|
85
|
-
case 0: return [4, this.findAccountsMigrationVersion()];
|
|
86
|
-
case 1:
|
|
87
|
-
accountsLatestVersion = (_a = (_b.sent())) !== null && _a !== void 0 ? _a : 0;
|
|
88
|
-
migrationVersions = Array.from(this.migrations.keys()).map(function (migrationName) {
|
|
89
|
-
var _a = migrationName.split(PREFIX), version = _a[1];
|
|
90
|
-
return Number(version);
|
|
91
|
-
}).sort();
|
|
92
|
-
i = 0;
|
|
93
|
-
_b.label = 2;
|
|
94
|
-
case 2:
|
|
95
|
-
if (!(i < migrationVersions.length)) return [3, 8];
|
|
96
|
-
if (!(migrationVersions[i] > accountsLatestVersion)) return [3, 7];
|
|
97
|
-
migration = this.migrations.get(PREFIX + migrationVersions[i]);
|
|
98
|
-
if (!migration) return [3, 7];
|
|
99
|
-
_b.label = 3;
|
|
100
|
-
case 3:
|
|
101
|
-
_b.trys.push([3, 6, , 7]);
|
|
102
|
-
return [4, migration.up()];
|
|
103
|
-
case 4:
|
|
104
|
-
_b.sent();
|
|
105
|
-
return [4, this.saveVersion(migrationVersions[i])];
|
|
106
|
-
case 5:
|
|
107
|
-
_b.sent();
|
|
108
|
-
return [3, 7];
|
|
109
|
-
case 6:
|
|
110
|
-
e_1 = _b.sent();
|
|
111
|
-
throw new Error("Migration ".concat(migration.constructor.name, " is not applied"));
|
|
112
|
-
case 7:
|
|
113
|
-
i++;
|
|
114
|
-
return [3, 2];
|
|
115
|
-
case 8: return [2];
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
MigrationHandler.prototype.saveVersion = function (currentLatestVersion) {
|
|
121
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
122
|
-
var params, e_2;
|
|
123
|
-
return __generator(this, function (_a) {
|
|
124
|
-
switch (_a.label) {
|
|
125
|
-
case 0:
|
|
126
|
-
_a.trys.push([0, 2, , 3]);
|
|
127
|
-
params = {
|
|
128
|
-
key: "".concat(constants_1.SERVICE_KEY, ".").concat(constants_1.VERSION_PROP),
|
|
129
|
-
value: currentLatestVersion,
|
|
130
|
-
};
|
|
131
|
-
return [4, this.settings.setAccountSettings(params)];
|
|
132
|
-
case 1:
|
|
133
|
-
_a.sent();
|
|
134
|
-
return [3, 3];
|
|
135
|
-
case 2:
|
|
136
|
-
e_2 = _a.sent();
|
|
137
|
-
throw new Error("Error while saving migration \"".concat(PREFIX + currentLatestVersion, "\""));
|
|
138
|
-
case 3: return [2];
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
};
|
|
143
|
-
MigrationHandler.prototype.deleteMigrationVersion = function () {
|
|
144
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
145
|
-
var params;
|
|
146
|
-
return __generator(this, function (_a) {
|
|
147
|
-
switch (_a.label) {
|
|
148
|
-
case 0:
|
|
149
|
-
params = {
|
|
150
|
-
key: "".concat(constants_1.SERVICE_KEY, ".").concat(constants_1.VERSION_PROP),
|
|
151
|
-
};
|
|
152
|
-
return [4, this.settings.deleteAccountSettings(params)];
|
|
153
|
-
case 1:
|
|
154
|
-
_a.sent();
|
|
155
|
-
return [2];
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
};
|
|
160
|
-
MigrationHandler.prototype.findAccountsMigrationVersion = function () {
|
|
161
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
162
|
-
var params, e_3;
|
|
163
|
-
return __generator(this, function (_a) {
|
|
164
|
-
switch (_a.label) {
|
|
165
|
-
case 0:
|
|
166
|
-
_a.trys.push([0, 2, , 3]);
|
|
167
|
-
params = {
|
|
168
|
-
key: "".concat(constants_1.SERVICE_KEY, ".").concat(constants_1.VERSION_PROP),
|
|
169
|
-
};
|
|
170
|
-
return [4, this.settings.getAccountSettings(params)];
|
|
171
|
-
case 1: return [2, _a.sent()];
|
|
172
|
-
case 2:
|
|
173
|
-
e_3 = _a.sent();
|
|
174
|
-
throw new Error('Error while getting account settings');
|
|
175
|
-
case 3: return [2];
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
return MigrationHandler;
|
|
181
|
-
}());
|
|
182
|
-
exports.default = MigrationHandler;
|
|
183
|
-
//# sourceMappingURL=migration-handler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migration-handler.js","sourceRoot":"","sources":["../../src/migration-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,yCAAwD;AACxD,uDAA2C;AAG3C,IAAM,MAAM,GAAG,aAAa,CAAC;AAE7B;IAGE,0BACU,QAAgB,EAChB,KAAY,EACZ,QAAkB,EAClB,QAAkB,EAClB,SAA6B,EAC7B,KAAY;QANtB,iBAsBC;QArBS,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;QAGpB,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,CACvB,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;aACtB,GAAG,CAAC,UAAA,IAAI,IAAI,OAAA;YACX,IAAI,CAAC,IAAI,EAAE,IAAI,IAAI,CACjB,KAAI,CAAC,QAAQ,EACb,KAAI,CAAC,KAAK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G,uBAAW,cAAI,wBAAY,CAAE;4BACrC,KAAK,EAAE,oBAAoB;yBAC5B,CAAC;wBACF,WAAM,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAA;;wBAA9C,SAA8C,CAAC;;;;wBAG/C,MAAM,IAAI,KAAK,CAAC,yCAAiC,MAAM,GAAG,oBAAoB,OAAG,CAAC,CAAC;;;;;KAEtF;IAEK,iDAAsB,GAA5B;;;;;;wBACQ,MAAM,GAAG;4BACb,GAAG,EAAE,UAAG,uBAAW,cAAI,wBAAY,CAAE;yBACT,CAAC;wBAC/B,WAAM,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAA;;wBAAjD,SAAiD,CAAC;;;;;KACnD;IAEK,uDAA4B,GAAlC;;;;;;;wBAEU,MAAM,GAAG;4BACb,GAAG,EAAE,UAAG,uBAAW,cAAI,wBAAY,CAAE;yBACtC,CAAC;wBACK,WAAM,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAA;4BAArD,WAAO,SAA8C,EAAC;;;wBAGtD,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;;;;;KAE3D;IACH,uBAAC;AAAD,CAAC,AAlFD,IAkFC"}
|
|
@@ -1,108 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
var migration_base_1 = require("../migration-base");
|
|
55
|
-
var idwSetupData = {
|
|
56
|
-
description: 'Add a fancy description to your IDW',
|
|
57
|
-
role: 'You can set your IDW\'s role/s just by chatting with the embedded RWC',
|
|
58
|
-
avatar: 'https://files.qa.api.onereach.ai/public/03db4abe-0477-47c0-ae4e-4c68f1047d59/IDW/IDWs-media-data/Img.png',
|
|
59
|
-
};
|
|
60
|
-
var Migration__1 = (function (_super) {
|
|
61
|
-
__extends(Migration__1, _super);
|
|
62
|
-
function Migration__1() {
|
|
63
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
64
|
-
}
|
|
65
|
-
Migration__1.prototype.up = function () {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
67
|
-
return __generator(this, function (_a) {
|
|
68
|
-
switch (_a.label) {
|
|
69
|
-
case 0: return [4, this.checkOrSetupIDWInfo()];
|
|
70
|
-
case 1:
|
|
71
|
-
_a.sent();
|
|
72
|
-
return [2];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
Migration__1.prototype.checkOrSetupIDWInfo = function () {
|
|
78
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
79
|
-
var accountId, idwData, hasIdwInfo, name_1, role, description, avatar;
|
|
80
|
-
return __generator(this, function (_a) {
|
|
81
|
-
switch (_a.label) {
|
|
82
|
-
case 0: return [4, this.resolveAccountId()];
|
|
83
|
-
case 1:
|
|
84
|
-
accountId = _a.sent();
|
|
85
|
-
return [4, this.accounts.getIdwData(accountId)];
|
|
86
|
-
case 2:
|
|
87
|
-
idwData = _a.sent();
|
|
88
|
-
hasIdwInfo = Boolean(idwData && idwData.name && idwData.role);
|
|
89
|
-
if (!!hasIdwInfo) return [3, 4];
|
|
90
|
-
name_1 = idwData.name, role = idwData.role, description = idwData.description, avatar = idwData.avatar;
|
|
91
|
-
return [4, this.accounts.updateIdwData(accountId, {
|
|
92
|
-
name: name_1,
|
|
93
|
-
role: (role === null || role === void 0 ? void 0 : role.trim()) || idwSetupData.role,
|
|
94
|
-
description: (description === null || description === void 0 ? void 0 : description.trim()) || idwSetupData.description,
|
|
95
|
-
avatar: (avatar === null || avatar === void 0 ? void 0 : avatar.trim()) || idwSetupData.avatar,
|
|
96
|
-
})];
|
|
97
|
-
case 3:
|
|
98
|
-
_a.sent();
|
|
99
|
-
return [2, new Promise(function (res) { return setTimeout(res, 60000); })];
|
|
100
|
-
case 4: return [2];
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
return Migration__1;
|
|
106
|
-
}(migration_base_1.MigrationBase));
|
|
107
|
-
exports.default = Migration__1;
|
|
108
|
-
//# sourceMappingURL=Migration__1.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Migration__1.js","sourceRoot":"","sources":["../../../src/migrations/Migration__1.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA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AAK,CAAC,EAAtB,CAAsB,CAAC,EAAC;;;;;KAErD;IACH,mBAAC;AAAD,CAAC,AAvBD,CAA0C,8BAAa,GAuBtD"}
|
|
@@ -1,155 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
var constants_1 = require("../constants");
|
|
55
|
-
var migration_base_1 = require("../migration-base");
|
|
56
|
-
var startUpChannels = [
|
|
57
|
-
{
|
|
58
|
-
id: 'facebook-messenger',
|
|
59
|
-
name: 'Facebook Messenger',
|
|
60
|
-
icon: 'https://files.qa.api.onereach.ai/public/9c1b43df-0f7c-43fe-819f-be9df1f39759/channel-icons/messenger.png',
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
id: 'sms',
|
|
64
|
-
name: 'SMS',
|
|
65
|
-
icon: 'https://files.qa.api.onereach.ai/public/9c1b43df-0f7c-43fe-819f-be9df1f39759/channel-icons/sms.png',
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
id: 'telegram',
|
|
69
|
-
name: 'Telegram',
|
|
70
|
-
icon: 'https://files.qa.api.onereach.ai/public/9c1b43df-0f7c-43fe-819f-be9df1f39759/channel-icons/telegram.png',
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
id: 'twitter',
|
|
74
|
-
name: 'Twitter',
|
|
75
|
-
icon: 'https://files.qa.api.onereach.ai/public/9c1b43df-0f7c-43fe-819f-be9df1f39759/channel-icons/twitter.png',
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
id: 'viber',
|
|
79
|
-
name: 'Viber',
|
|
80
|
-
icon: 'https://files.qa.api.onereach.ai/public/9c1b43df-0f7c-43fe-819f-be9df1f39759/channel-icons/viber.png',
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
id: 'viber-business',
|
|
84
|
-
name: 'Viber Business',
|
|
85
|
-
icon: 'https://files.qa.api.onereach.ai/public/9c1b43df-0f7c-43fe-819f-be9df1f39759/channel-icons/viber.png',
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
id: 'whatsapp',
|
|
89
|
-
name: 'WhatsApp',
|
|
90
|
-
icon: 'https://files.qa.api.onereach.ai/public/9c1b43df-0f7c-43fe-819f-be9df1f39759/channel-icons/whatsapp.png',
|
|
91
|
-
},
|
|
92
|
-
];
|
|
93
|
-
var Migration__2 = (function (_super) {
|
|
94
|
-
__extends(Migration__2, _super);
|
|
95
|
-
function Migration__2() {
|
|
96
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
97
|
-
}
|
|
98
|
-
Migration__2.prototype.up = function () {
|
|
99
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
100
|
-
var channelsExist;
|
|
101
|
-
return __generator(this, function (_a) {
|
|
102
|
-
switch (_a.label) {
|
|
103
|
-
case 0: return [4, this.checkIfChannelsExist()];
|
|
104
|
-
case 1:
|
|
105
|
-
channelsExist = _a.sent();
|
|
106
|
-
if (!!channelsExist) return [3, 3];
|
|
107
|
-
return [4, this.createChannels()];
|
|
108
|
-
case 2:
|
|
109
|
-
_a.sent();
|
|
110
|
-
_a.label = 3;
|
|
111
|
-
case 3: return [2];
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
Migration__2.prototype.createChannels = function () {
|
|
117
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
118
|
-
return __generator(this, function (_a) {
|
|
119
|
-
switch (_a.label) {
|
|
120
|
-
case 0: return [4, this.graphApi.query({
|
|
121
|
-
graph: constants_1.GRAPH_NAME,
|
|
122
|
-
query: "CREATE ".concat(startUpChannels.map(function (_a) {
|
|
123
|
-
var id = _a.id, name = _a.name, icon = _a.icon;
|
|
124
|
-
return "(:CHANNEL {id: '".concat(id, "', name: '").concat(name, "', icon: '").concat(icon, "'})");
|
|
125
|
-
}).join(', ')),
|
|
126
|
-
params: {},
|
|
127
|
-
})];
|
|
128
|
-
case 1:
|
|
129
|
-
_a.sent();
|
|
130
|
-
return [2];
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
};
|
|
135
|
-
Migration__2.prototype.checkIfChannelsExist = function () {
|
|
136
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
137
|
-
var data;
|
|
138
|
-
return __generator(this, function (_a) {
|
|
139
|
-
switch (_a.label) {
|
|
140
|
-
case 0: return [4, this.graphApi.query({
|
|
141
|
-
graph: constants_1.GRAPH_NAME,
|
|
142
|
-
query: 'MATCH (channels: CHANNEL) RETURN collect(DISTINCT channels) as channels',
|
|
143
|
-
params: {},
|
|
144
|
-
})];
|
|
145
|
-
case 1:
|
|
146
|
-
data = (_a.sent())[0];
|
|
147
|
-
return [2, data.channels.length > 0];
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
};
|
|
152
|
-
return Migration__2;
|
|
153
|
-
}(migration_base_1.MigrationBase));
|
|
154
|
-
exports.default = Migration__2;
|
|
155
|
-
//# sourceMappingURL=Migration__2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Migration__2.js","sourceRoot":"","sources":["../../../src/migrations/Migration__2.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA0C;AAC1C,oDAAkD;AAElD,IAAM,eAAe,GAAG;IACtB;QACE,EAAE,EAAE,oBAAoB;QACxB,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,0GAA0G;KACjH;IACD;QACE,EAAE,EAAE,KAAK;QACT,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,oGAAoG;KAC3G;IACD;QACE,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,yGAAyG;KAChH;IACD;QACE,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,wGAAwG;KAC/G;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,sGAAsG;KAC7G;IACD;QACE,EAAE,EAAE,gBAAgB;QACpB,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,sGAAsG;KAC7G;IACD;QACE,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,yGAAyG;KAChH;CACF,CAAC;AAGF;IAA0C,gCAAa;IAAvD;;IA0BA,CAAC;IAzBO,yBAAE,GAAR;;;;;4BACwB,WAAM,IAAI,CAAC,oBAAoB,EAAE,EAAA;;wBAAjD,aAAa,GAAG,SAAiC;6BACnD,CAAC,aAAa,EAAd,cAAc;wBAChB,WAAM,IAAI,CAAC,cAAc,EAAE,EAAA;;wBAA3B,SAA2B,CAAC;;;;;;KAE/B;IAEa,qCAAc,GAA5B;;;;4BACE,WAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;4BACxB,KAAK,EAAE,sBAAU;4BACjB,KAAK,EAAE,iBAAU,eAAe,CAAC,GAAG,CAAC,UAAC,EAAkB;oCAAhB,EAAE,QAAA,EAAE,IAAI,UAAA,EAAE,IAAI,UAAA;gCACpD,OAAO,0BAAmB,EAAE,uBAAa,IAAI,uBAAa,IAAI,QAAK,CAAC;4BACtE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAE;4BACf,MAAM,EAAE,EAAE;yBACX,CAAC,EAAA;;wBANF,SAME,CAAC;;;;;KACJ;IAEa,2CAAoB,GAAlC;;;;;4BACiB,WAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAuB;4BAC7D,KAAK,EAAE,sBAAU;4BACjB,KAAK,EAAE,yEAAyE;4BAChF,MAAM,EAAE,EAAE;yBACX,CAAC,EAAA;;wBAJK,IAAI,GAAI,CAAA,SAIb,CAAA,GAJS;wBAKX,WAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAC;;;;KACjC;IACH,mBAAC;AAAD,CAAC,AA1BD,CAA0C,8BAAa,GA0BtD"}
|
|
@@ -1,108 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
var migration_base_1 = require("../migration-base");
|
|
55
|
-
var constants_1 = require("../constants");
|
|
56
|
-
var Migration__3 = (function (_super) {
|
|
57
|
-
__extends(Migration__3, _super);
|
|
58
|
-
function Migration__3() {
|
|
59
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
60
|
-
}
|
|
61
|
-
Migration__3.prototype.up = function () {
|
|
62
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
-
var flowsIds, preparedIds, flows, pairs;
|
|
64
|
-
return __generator(this, function (_a) {
|
|
65
|
-
switch (_a.label) {
|
|
66
|
-
case 0: return [4, this.graphApi.query({
|
|
67
|
-
graph: constants_1.GRAPH_NAME,
|
|
68
|
-
query: "match (flow: FLOW)\n where flow.steps is NULL\n return flow.id as id\n ",
|
|
69
|
-
params: {},
|
|
70
|
-
})];
|
|
71
|
-
case 1:
|
|
72
|
-
flowsIds = _a.sent();
|
|
73
|
-
if (!flowsIds.length) return [3, 4];
|
|
74
|
-
preparedIds = flowsIds.map(function (f) { return f.id; });
|
|
75
|
-
return [4, this.flows.listFlows({
|
|
76
|
-
query: {
|
|
77
|
-
id: preparedIds,
|
|
78
|
-
},
|
|
79
|
-
projection: ['data.trees.main.steps'],
|
|
80
|
-
})];
|
|
81
|
-
case 2:
|
|
82
|
-
flows = _a.sent();
|
|
83
|
-
pairs = flows.items.map(function (flow) {
|
|
84
|
-
var _a, _b, _c;
|
|
85
|
-
return ({
|
|
86
|
-
steps: (_c = (_b = (_a = flow.data.trees) === null || _a === void 0 ? void 0 : _a.main.steps) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0,
|
|
87
|
-
id: flow.id,
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
return [4, this.graphApi.query({
|
|
91
|
-
graph: constants_1.GRAPH_NAME,
|
|
92
|
-
query: "\n unwind $list as pairs\n MERGE (flow:FLOW { id: pairs.id })\n SET flow.steps = pairs.steps\n ",
|
|
93
|
-
params: {
|
|
94
|
-
list: pairs,
|
|
95
|
-
},
|
|
96
|
-
})];
|
|
97
|
-
case 3:
|
|
98
|
-
_a.sent();
|
|
99
|
-
_a.label = 4;
|
|
100
|
-
case 4: return [2];
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
return Migration__3;
|
|
106
|
-
}(migration_base_1.MigrationBase));
|
|
107
|
-
exports.default = Migration__3;
|
|
108
|
-
//# sourceMappingURL=Migration__3.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Migration__3.js","sourceRoot":"","sources":["../../../src/migrations/Migration__3.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Migration__3 = exports.Migration__2 = exports.Migration__1 = void 0;
|
|
7
|
-
var Migration__1_1 = require("./Migration__1");
|
|
8
|
-
Object.defineProperty(exports, "Migration__1", { enumerable: true, get: function () { return __importDefault(Migration__1_1).default; } });
|
|
9
|
-
var Migration__2_1 = require("./Migration__2");
|
|
10
|
-
Object.defineProperty(exports, "Migration__2", { enumerable: true, get: function () { return __importDefault(Migration__2_1).default; } });
|
|
11
|
-
var Migration__3_1 = require("./Migration__3");
|
|
12
|
-
Object.defineProperty(exports, "Migration__3", { enumerable: true, get: function () { return __importDefault(Migration__3_1).default; } });
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/migrations/index.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAyD;AAAhD,6HAAA,OAAO,OAAgB;AAChC,+CAAyD;AAAhD,6HAAA,OAAO,OAAgB;AAChC,+CAAyD;AAAhD,6HAAA,OAAO,OAAgB"}
|