@nocobase/plugin-workflow 0.7.0-alpha.34 → 0.7.0-alpha.57
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/lib/actions/index.js +31 -32
- package/lib/actions/nodes.js +310 -182
- package/lib/actions/workflows.js +260 -157
- package/lib/calculators/index.js +142 -90
- package/lib/collections/executions.js +40 -43
- package/lib/collections/flow_nodes.js +60 -65
- package/lib/collections/jobs.js +45 -47
- package/lib/collections/workflows.js +78 -87
- package/lib/constants.js +22 -17
- package/lib/index.js +71 -22
- package/lib/instructions/calculation.js +34 -29
- package/lib/instructions/condition.js +94 -87
- package/lib/instructions/create.js +43 -26
- package/lib/instructions/destroy.js +42 -25
- package/lib/instructions/index.js +46 -25
- package/lib/instructions/parallel.js +99 -84
- package/lib/instructions/prompt.js +21 -13
- package/lib/instructions/query.js +47 -29
- package/lib/instructions/update.js +44 -25
- package/lib/models/Execution.js +401 -248
- package/lib/models/FlowNode.js +18 -5
- package/lib/models/Job.js +18 -5
- package/lib/models/Workflow.js +132 -88
- package/lib/server.js +93 -66
- package/lib/triggers/collection.js +113 -51
- package/lib/triggers/index.js +25 -11
- package/package.json +7 -12
- package/esm/actions/index.d.ts +0 -1
- package/esm/actions/index.js +0 -14
- package/esm/actions/index.js.map +0 -1
- package/esm/actions/nodes.d.ts +0 -4
- package/esm/actions/nodes.js +0 -187
- package/esm/actions/nodes.js.map +0 -1
- package/esm/actions/workflows.d.ts +0 -3
- package/esm/actions/workflows.js +0 -163
- package/esm/actions/workflows.js.map +0 -1
- package/esm/calculators/index.d.ts +0 -38
- package/esm/calculators/index.js +0 -128
- package/esm/calculators/index.js.map +0 -1
- package/esm/collections/executions.d.ts +0 -3
- package/esm/collections/executions.js +0 -43
- package/esm/collections/executions.js.map +0 -1
- package/esm/collections/flow_nodes.d.ts +0 -3
- package/esm/collections/flow_nodes.js +0 -65
- package/esm/collections/flow_nodes.js.map +0 -1
- package/esm/collections/jobs.d.ts +0 -3
- package/esm/collections/jobs.js +0 -47
- package/esm/collections/jobs.js.map +0 -1
- package/esm/collections/workflows.d.ts +0 -3
- package/esm/collections/workflows.js +0 -87
- package/esm/collections/workflows.js.map +0 -1
- package/esm/constants.d.ts +0 -17
- package/esm/constants.js +0 -18
- package/esm/constants.js.map +0 -1
- package/esm/index.d.ts +0 -5
- package/esm/index.js +0 -6
- package/esm/index.js.map +0 -1
- package/esm/instructions/calculation.d.ts +0 -8
- package/esm/instructions/calculation.js +0 -55
- package/esm/instructions/calculation.js.map +0 -1
- package/esm/instructions/condition.d.ts +0 -5
- package/esm/instructions/condition.js +0 -99
- package/esm/instructions/condition.js.map +0 -1
- package/esm/instructions/create.d.ts +0 -8
- package/esm/instructions/create.js +0 -26
- package/esm/instructions/create.js.map +0 -1
- package/esm/instructions/destroy.d.ts +0 -8
- package/esm/instructions/destroy.js +0 -25
- package/esm/instructions/destroy.js.map +0 -1
- package/esm/instructions/index.d.ts +0 -15
- package/esm/instructions/index.js +0 -20
- package/esm/instructions/index.js.map +0 -1
- package/esm/instructions/parallel.d.ts +0 -13
- package/esm/instructions/parallel.js +0 -88
- package/esm/instructions/parallel.js.map +0 -1
- package/esm/instructions/prompt.d.ts +0 -7
- package/esm/instructions/prompt.js +0 -13
- package/esm/instructions/prompt.js.map +0 -1
- package/esm/instructions/query.d.ts +0 -8
- package/esm/instructions/query.js +0 -29
- package/esm/instructions/query.js.map +0 -1
- package/esm/instructions/update.d.ts +0 -9
- package/esm/instructions/update.js +0 -25
- package/esm/instructions/update.js.map +0 -1
- package/esm/models/Execution.d.ts +0 -51
- package/esm/models/Execution.js +0 -256
- package/esm/models/Execution.js.map +0 -1
- package/esm/models/FlowNode.d.ts +0 -17
- package/esm/models/FlowNode.js +0 -4
- package/esm/models/FlowNode.js.map +0 -1
- package/esm/models/Job.d.ts +0 -15
- package/esm/models/Job.js +0 -4
- package/esm/models/Job.js.map +0 -1
- package/esm/models/Workflow.d.ts +0 -29
- package/esm/models/Workflow.js +0 -88
- package/esm/models/Workflow.js.map +0 -1
- package/esm/server.d.ts +0 -5
- package/esm/server.js +0 -62
- package/esm/server.js.map +0 -1
- package/esm/triggers/collection.d.ts +0 -12
- package/esm/triggers/collection.js +0 -61
- package/esm/triggers/collection.js.map +0 -1
- package/esm/triggers/index.d.ts +0 -9
- package/esm/triggers/index.js +0 -6
- package/esm/triggers/index.js.map +0 -1
- package/lib/actions/index.js.map +0 -1
- package/lib/actions/nodes.js.map +0 -1
- package/lib/actions/workflows.js.map +0 -1
- package/lib/calculators/index.js.map +0 -1
- package/lib/collections/executions.js.map +0 -1
- package/lib/collections/flow_nodes.js.map +0 -1
- package/lib/collections/jobs.js.map +0 -1
- package/lib/collections/workflows.js.map +0 -1
- package/lib/constants.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/instructions/calculation.js.map +0 -1
- package/lib/instructions/condition.js.map +0 -1
- package/lib/instructions/create.js.map +0 -1
- package/lib/instructions/destroy.js.map +0 -1
- package/lib/instructions/index.js.map +0 -1
- package/lib/instructions/parallel.js.map +0 -1
- package/lib/instructions/prompt.js.map +0 -1
- package/lib/instructions/query.js.map +0 -1
- package/lib/instructions/update.js.map +0 -1
- package/lib/models/Execution.js.map +0 -1
- package/lib/models/FlowNode.js.map +0 -1
- package/lib/models/Job.js.map +0 -1
- package/lib/models/Workflow.js.map +0 -1
- package/lib/server.js.map +0 -1
- package/lib/triggers/collection.js.map +0 -1
- package/lib/triggers/index.js.map +0 -1
- package/tsconfig.build.json +0 -9
package/lib/actions/workflows.js
CHANGED
|
@@ -1,168 +1,271 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
12
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
13
|
-
var m = o[Symbol.asyncIterator], i;
|
|
14
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
15
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
16
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
17
|
-
};
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.duplicate = exports.update = void 0;
|
|
20
|
-
const actions_1 = require("@nocobase/actions");
|
|
21
|
-
const database_1 = require("@nocobase/database");
|
|
22
|
-
function update(context, next) {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
const { db } = context;
|
|
25
|
-
const repository = actions_1.utils.getRepositoryFromParams(context);
|
|
26
|
-
const { filterByTk, values, whitelist, blacklist, filter, updateAssociationValues } = context.action.params;
|
|
27
|
-
context.body = yield db.sequelize.transaction((transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
const others = {};
|
|
29
|
-
if (values.enabled) {
|
|
30
|
-
values.current = true;
|
|
31
|
-
others.enabled = false;
|
|
32
|
-
}
|
|
33
|
-
if (values.current) {
|
|
34
|
-
others.current = false;
|
|
35
|
-
yield repository.update({
|
|
36
|
-
filter: {
|
|
37
|
-
key: values.key,
|
|
38
|
-
id: {
|
|
39
|
-
[database_1.Op.ne]: filterByTk
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
values: others,
|
|
43
|
-
context,
|
|
44
|
-
transaction
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
const instance = yield repository.update({
|
|
48
|
-
filterByTk,
|
|
49
|
-
values,
|
|
50
|
-
whitelist,
|
|
51
|
-
blacklist,
|
|
52
|
-
filter,
|
|
53
|
-
updateAssociationValues,
|
|
54
|
-
context,
|
|
55
|
-
transaction
|
|
56
|
-
});
|
|
57
|
-
return instance;
|
|
58
|
-
}));
|
|
59
|
-
yield next();
|
|
60
|
-
});
|
|
61
|
-
}
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.duplicate = duplicate;
|
|
62
7
|
exports.update = update;
|
|
8
|
+
|
|
9
|
+
function _actions() {
|
|
10
|
+
const data = require("@nocobase/actions");
|
|
11
|
+
|
|
12
|
+
_actions = function _actions() {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function _database() {
|
|
20
|
+
const data = require("@nocobase/database");
|
|
21
|
+
|
|
22
|
+
_database = function _database() {
|
|
23
|
+
return data;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
30
|
+
|
|
31
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
32
|
+
|
|
33
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
34
|
+
|
|
35
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
36
|
+
|
|
37
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
38
|
+
|
|
39
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
40
|
+
|
|
41
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
42
|
+
|
|
43
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
44
|
+
|
|
45
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
46
|
+
|
|
47
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
48
|
+
|
|
49
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
50
|
+
|
|
51
|
+
function _asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
|
|
52
|
+
|
|
53
|
+
function AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function _return(value) { var ret = this.s.return; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, throw: function _throw(value) { var thr = this.s.return; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(s); }
|
|
54
|
+
|
|
55
|
+
function update(_x, _x2) {
|
|
56
|
+
return _update.apply(this, arguments);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function _update() {
|
|
60
|
+
_update = _asyncToGenerator(function* (context, next) {
|
|
61
|
+
const db = context.db;
|
|
62
|
+
|
|
63
|
+
const repository = _actions().utils.getRepositoryFromParams(context);
|
|
64
|
+
|
|
65
|
+
const _context$action$param = context.action.params,
|
|
66
|
+
filterByTk = _context$action$param.filterByTk,
|
|
67
|
+
values = _context$action$param.values,
|
|
68
|
+
whitelist = _context$action$param.whitelist,
|
|
69
|
+
blacklist = _context$action$param.blacklist,
|
|
70
|
+
filter = _context$action$param.filter,
|
|
71
|
+
updateAssociationValues = _context$action$param.updateAssociationValues;
|
|
72
|
+
context.body = yield db.sequelize.transaction( /*#__PURE__*/function () {
|
|
73
|
+
var _ref = _asyncToGenerator(function* (transaction) {
|
|
74
|
+
const others = {};
|
|
75
|
+
|
|
76
|
+
if (values.enabled) {
|
|
77
|
+
values.current = true;
|
|
78
|
+
others.enabled = false;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (values.current) {
|
|
82
|
+
others.current = false;
|
|
83
|
+
yield repository.update({
|
|
84
|
+
filter: {
|
|
85
|
+
key: values.key,
|
|
86
|
+
id: {
|
|
87
|
+
[_database().Op.ne]: filterByTk
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
values: others,
|
|
91
|
+
context,
|
|
92
|
+
transaction
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const instance = yield repository.update({
|
|
97
|
+
filterByTk,
|
|
98
|
+
values,
|
|
99
|
+
whitelist,
|
|
100
|
+
blacklist,
|
|
101
|
+
filter,
|
|
102
|
+
updateAssociationValues,
|
|
103
|
+
context,
|
|
104
|
+
transaction
|
|
105
|
+
});
|
|
106
|
+
return instance;
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
return function (_x5) {
|
|
110
|
+
return _ref.apply(this, arguments);
|
|
111
|
+
};
|
|
112
|
+
}());
|
|
113
|
+
yield next();
|
|
114
|
+
});
|
|
115
|
+
return _update.apply(this, arguments);
|
|
116
|
+
}
|
|
117
|
+
|
|
63
118
|
function typeOf(value) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return typeof value;
|
|
119
|
+
if (Array.isArray(value)) {
|
|
120
|
+
return 'array';
|
|
121
|
+
} else if (value instanceof Date) {
|
|
122
|
+
return 'date';
|
|
123
|
+
} else if (value === null) {
|
|
124
|
+
return 'null';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return typeof value;
|
|
74
128
|
}
|
|
129
|
+
|
|
75
130
|
function migrateConfig(config, oldToNew) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
131
|
+
function migrate(value) {
|
|
132
|
+
switch (typeOf(value)) {
|
|
133
|
+
case 'object':
|
|
134
|
+
return Object.keys(value).reduce((result, key) => _objectSpread(_objectSpread({}, result), {}, {
|
|
135
|
+
[key]: migrate(value[key])
|
|
136
|
+
}), {});
|
|
137
|
+
|
|
138
|
+
case 'array':
|
|
139
|
+
return value.map(item => migrate(item));
|
|
140
|
+
|
|
141
|
+
case 'string':
|
|
142
|
+
return value.replace(/(\{\{\$jobsMapByNodeId\.)(\d+)/, (_, prefix, id) => `${prefix}${oldToNew.get(Number.parseInt(id, 10)).id}`);
|
|
143
|
+
|
|
144
|
+
default:
|
|
145
|
+
return value;
|
|
88
146
|
}
|
|
89
|
-
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return migrate(config);
|
|
90
150
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
origin.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
151
|
+
|
|
152
|
+
function duplicate(_x3, _x4) {
|
|
153
|
+
return _duplicate.apply(this, arguments);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function _duplicate() {
|
|
157
|
+
_duplicate = _asyncToGenerator(function* (context, next) {
|
|
158
|
+
const db = context.db;
|
|
159
|
+
|
|
160
|
+
const repository = _actions().utils.getRepositoryFromParams(context);
|
|
161
|
+
|
|
162
|
+
const filterByTk = context.action.params.filterByTk;
|
|
163
|
+
context.body = yield db.sequelize.transaction( /*#__PURE__*/function () {
|
|
164
|
+
var _ref2 = _asyncToGenerator(function* (transaction) {
|
|
165
|
+
const origin = yield repository.findOne({
|
|
166
|
+
filterByTk,
|
|
167
|
+
appends: ['nodes'],
|
|
168
|
+
context,
|
|
169
|
+
transaction
|
|
170
|
+
});
|
|
171
|
+
const instance = yield repository.create({
|
|
172
|
+
values: {
|
|
173
|
+
key: origin.key,
|
|
174
|
+
title: origin.title,
|
|
175
|
+
description: origin.description,
|
|
176
|
+
type: origin.type,
|
|
177
|
+
config: origin.config
|
|
178
|
+
},
|
|
179
|
+
transaction
|
|
180
|
+
});
|
|
181
|
+
const originalNodesMap = new Map();
|
|
182
|
+
origin.nodes.forEach(node => {
|
|
183
|
+
originalNodesMap.set(node.id, node);
|
|
184
|
+
});
|
|
185
|
+
const oldToNew = new Map();
|
|
186
|
+
const newToOld = new Map();
|
|
187
|
+
var _iteratorAbruptCompletion = false;
|
|
188
|
+
var _didIteratorError = false;
|
|
189
|
+
|
|
190
|
+
var _iteratorError;
|
|
191
|
+
|
|
192
|
+
try {
|
|
193
|
+
for (var _iterator = _asyncIterator(origin.nodes), _step; _iteratorAbruptCompletion = !(_step = yield _iterator.next()).done; _iteratorAbruptCompletion = false) {
|
|
194
|
+
const node = _step.value;
|
|
195
|
+
const newNode = yield instance.createNode({
|
|
196
|
+
type: node.type,
|
|
197
|
+
config: node.config,
|
|
198
|
+
title: node.title,
|
|
199
|
+
branchIndex: node.branchIndex
|
|
200
|
+
}, {
|
|
201
|
+
transaction
|
|
202
|
+
}); // NOTE: keep original node references for later replacement
|
|
203
|
+
|
|
204
|
+
oldToNew.set(node.id, newNode);
|
|
205
|
+
newToOld.set(newNode.id, node);
|
|
206
|
+
}
|
|
207
|
+
} catch (err) {
|
|
208
|
+
_didIteratorError = true;
|
|
209
|
+
_iteratorError = err;
|
|
210
|
+
} finally {
|
|
211
|
+
try {
|
|
212
|
+
if (_iteratorAbruptCompletion && _iterator.return != null) {
|
|
213
|
+
yield _iterator.return();
|
|
134
214
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (_f && !_f.done && (_a = _e.return)) yield _a.call(_e);
|
|
139
|
-
}
|
|
140
|
-
finally { if (e_1) throw e_1.error; }
|
|
215
|
+
} finally {
|
|
216
|
+
if (_didIteratorError) {
|
|
217
|
+
throw _iteratorError;
|
|
141
218
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
var _iteratorAbruptCompletion2 = false;
|
|
223
|
+
var _didIteratorError2 = false;
|
|
224
|
+
|
|
225
|
+
var _iteratorError2;
|
|
226
|
+
|
|
227
|
+
try {
|
|
228
|
+
for (var _iterator2 = _asyncIterator(oldToNew.entries()), _step2; _iteratorAbruptCompletion2 = !(_step2 = yield _iterator2.next()).done; _iteratorAbruptCompletion2 = false) {
|
|
229
|
+
var _newUpstream$id, _newDownstream$id;
|
|
230
|
+
|
|
231
|
+
const _step2$value = _slicedToArray(_step2.value, 2),
|
|
232
|
+
oldId = _step2$value[0],
|
|
233
|
+
newNode = _step2$value[1];
|
|
234
|
+
|
|
235
|
+
const oldNode = originalNodesMap.get(oldId);
|
|
236
|
+
const newUpstream = oldNode.upstreamId ? oldToNew.get(oldNode.upstreamId) : null;
|
|
237
|
+
const newDownstream = oldNode.downstreamId ? oldToNew.get(oldNode.downstreamId) : null;
|
|
238
|
+
yield newNode.update({
|
|
239
|
+
upstreamId: (_newUpstream$id = newUpstream === null || newUpstream === void 0 ? void 0 : newUpstream.id) !== null && _newUpstream$id !== void 0 ? _newUpstream$id : null,
|
|
240
|
+
downstreamId: (_newDownstream$id = newDownstream === null || newDownstream === void 0 ? void 0 : newDownstream.id) !== null && _newDownstream$id !== void 0 ? _newDownstream$id : null,
|
|
241
|
+
config: migrateConfig(oldNode.config, oldToNew)
|
|
242
|
+
}, {
|
|
243
|
+
transaction
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
} catch (err) {
|
|
247
|
+
_didIteratorError2 = true;
|
|
248
|
+
_iteratorError2 = err;
|
|
249
|
+
} finally {
|
|
250
|
+
try {
|
|
251
|
+
if (_iteratorAbruptCompletion2 && _iterator2.return != null) {
|
|
252
|
+
yield _iterator2.return();
|
|
154
253
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if (_h && !_h.done && (_b = _g.return)) yield _b.call(_g);
|
|
159
|
-
}
|
|
160
|
-
finally { if (e_2) throw e_2.error; }
|
|
254
|
+
} finally {
|
|
255
|
+
if (_didIteratorError2) {
|
|
256
|
+
throw _iteratorError2;
|
|
161
257
|
}
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return instance;
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
return function (_x6) {
|
|
265
|
+
return _ref2.apply(this, arguments);
|
|
266
|
+
};
|
|
267
|
+
}());
|
|
268
|
+
yield next();
|
|
269
|
+
});
|
|
270
|
+
return _duplicate.apply(this, arguments);
|
|
271
|
+
}
|