@prismatic-io/spectral 10.12.1 → 10.12.2
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.
|
@@ -594,8 +594,9 @@ const generateTriggerPerformFn = (componentRef, onTrigger, componentRegistry) =>
|
|
|
594
594
|
* Returns the deep-merged results of the two, prioritizing the custom response
|
|
595
595
|
* if there's a conflict. */
|
|
596
596
|
const generateOnInstanceWrapperFn = (componentRef, onTrigger, eventName, componentRegistry, customFn) => {
|
|
597
|
-
const
|
|
598
|
-
|
|
597
|
+
const usesComponentRef = componentRef && typeof onTrigger !== "function";
|
|
598
|
+
if (usesComponentRef) {
|
|
599
|
+
return (context, params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
599
600
|
var _a;
|
|
600
601
|
// @ts-expect-error: _components isn't part of the public API
|
|
601
602
|
const _components = (_a = context._components) !== null && _a !== void 0 ? _a : {
|
|
@@ -612,17 +613,20 @@ const generateOnInstanceWrapperFn = (componentRef, onTrigger, eventName, compone
|
|
|
612
613
|
}
|
|
613
614
|
return (0, merge_1.default)(invokeResponse, customResponse);
|
|
614
615
|
}));
|
|
615
|
-
})
|
|
616
|
-
: (context, params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
617
|
-
if (customFn) {
|
|
618
|
-
const cniContext = (0, context_1.createCNIContext)(context, componentRegistry);
|
|
619
|
-
// Using runWithContext allows for component action invocation via manifest.
|
|
620
|
-
return yield (0, asyncContext_1.runWithContext)(cniContext, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
621
|
-
return yield customFn(cniContext, params);
|
|
622
|
-
}));
|
|
623
|
-
}
|
|
624
616
|
});
|
|
625
|
-
|
|
617
|
+
}
|
|
618
|
+
else if (customFn) {
|
|
619
|
+
return (context, params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
620
|
+
const cniContext = (0, context_1.createCNIContext)(context, componentRegistry);
|
|
621
|
+
// Using runWithContext allows for component action invocation via manifest.
|
|
622
|
+
return yield (0, asyncContext_1.runWithContext)(cniContext, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
623
|
+
return yield customFn(cniContext, params);
|
|
624
|
+
}));
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
else {
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
626
630
|
};
|
|
627
631
|
const convertOnExecution = (onExecution, componentRegistry) => (context, params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
628
632
|
const actionContext = (0, context_1.createCNIContext)(context, componentRegistry);
|
package/package.json
CHANGED