@wooksjs/event-wf 0.3.10 → 0.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -120,32 +120,38 @@ class WooksWf extends wooks.WooksAdapterBase {
120
120
  null;
121
121
  if (handlers && handlers.length) {
122
122
  let result = {};
123
- for (const handler of handlers) {
124
- restoreCtx();
125
- const { id, init } = (yield handler());
126
- if (init) {
127
- yield init();
123
+ try {
124
+ for (const handler of handlers) {
128
125
  restoreCtx();
129
- }
130
- if (resume) {
131
- result = yield this.wf.resume(id, { context: inputContext, indexes }, input);
132
- break;
133
- }
134
- else {
135
- result = yield this.wf.start(id, inputContext, input);
136
- break;
126
+ const { id, init } = (yield handler());
127
+ if (init) {
128
+ yield init();
129
+ restoreCtx();
130
+ }
131
+ if (resume) {
132
+ result = yield this.wf.resume(id, { context: inputContext, indexes }, input);
133
+ break;
134
+ }
135
+ else {
136
+ result = yield this.wf.start(id, inputContext, input);
137
+ break;
138
+ }
137
139
  }
138
140
  }
139
- if (cleanup) {
140
- restoreCtx();
141
- cleanup();
141
+ catch (e) {
142
+ clean();
143
+ throw e;
142
144
  }
145
+ clean();
143
146
  clearCtx();
144
147
  return result;
145
148
  }
146
- if (cleanup) {
147
- restoreCtx();
148
- cleanup();
149
+ clean();
150
+ function clean() {
151
+ if (cleanup) {
152
+ restoreCtx();
153
+ cleanup();
154
+ }
149
155
  }
150
156
  clearCtx();
151
157
  throw new Error('Unknown schemaId: ' + schemaId);
package/dist/index.mjs CHANGED
@@ -118,32 +118,38 @@ class WooksWf extends WooksAdapterBase {
118
118
  null;
119
119
  if (handlers && handlers.length) {
120
120
  let result = {};
121
- for (const handler of handlers) {
122
- restoreCtx();
123
- const { id, init } = (yield handler());
124
- if (init) {
125
- yield init();
121
+ try {
122
+ for (const handler of handlers) {
126
123
  restoreCtx();
127
- }
128
- if (resume) {
129
- result = yield this.wf.resume(id, { context: inputContext, indexes }, input);
130
- break;
131
- }
132
- else {
133
- result = yield this.wf.start(id, inputContext, input);
134
- break;
124
+ const { id, init } = (yield handler());
125
+ if (init) {
126
+ yield init();
127
+ restoreCtx();
128
+ }
129
+ if (resume) {
130
+ result = yield this.wf.resume(id, { context: inputContext, indexes }, input);
131
+ break;
132
+ }
133
+ else {
134
+ result = yield this.wf.start(id, inputContext, input);
135
+ break;
136
+ }
135
137
  }
136
138
  }
137
- if (cleanup) {
138
- restoreCtx();
139
- cleanup();
139
+ catch (e) {
140
+ clean();
141
+ throw e;
140
142
  }
143
+ clean();
141
144
  clearCtx();
142
145
  return result;
143
146
  }
144
- if (cleanup) {
145
- restoreCtx();
146
- cleanup();
147
+ clean();
148
+ function clean() {
149
+ if (cleanup) {
150
+ restoreCtx();
151
+ cleanup();
152
+ }
147
153
  }
148
154
  clearCtx();
149
155
  throw new Error('Unknown schemaId: ' + schemaId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wooksjs/event-wf",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "@wooksjs/event-wf",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -25,8 +25,8 @@
25
25
  "author": "Artem Maltsev",
26
26
  "license": "MIT",
27
27
  "peerDependencies": {
28
- "wooks": "0.3.10",
29
- "@wooksjs/event-core": "0.3.10"
28
+ "wooks": "0.3.11",
29
+ "@wooksjs/event-core": "0.3.11"
30
30
  },
31
31
  "dependencies": {
32
32
  "@prostojs/logger": "^0.3.6",