@motiadev/core 0.0.37 → 0.0.38-alpha
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/src/utils.js +4 -10
- package/package.json +1 -1
package/dist/src/utils.js
CHANGED
|
@@ -4,15 +4,9 @@ exports.isAllowedToEmit = void 0;
|
|
|
4
4
|
const guards_1 = require("./guards");
|
|
5
5
|
const toTopic = (emit) => (typeof emit === 'string' ? emit : emit.topic);
|
|
6
6
|
const isAllowedToEmit = (step, emit) => {
|
|
7
|
-
if ((0, guards_1.isApiStep)(step))
|
|
8
|
-
return
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return step.config.emits.map(toTopic).includes(emit);
|
|
12
|
-
}
|
|
13
|
-
if ((0, guards_1.isCronStep)(step)) {
|
|
14
|
-
return step.config.emits.map(toTopic).includes(emit);
|
|
15
|
-
}
|
|
16
|
-
return false;
|
|
7
|
+
if (!(0, guards_1.isApiStep)(step) && !(0, guards_1.isCronStep)(step) && !(0, guards_1.isEventStep)(step))
|
|
8
|
+
return false;
|
|
9
|
+
const emitsTopics = step.config.emits.map(toTopic);
|
|
10
|
+
return emitsTopics.includes(emit) || emitsTopics.length === 0;
|
|
17
11
|
};
|
|
18
12
|
exports.isAllowedToEmit = isAllowedToEmit;
|