@prismatic-io/spectral 10.12.0 → 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.
@@ -78,7 +78,7 @@ const fetchComponentDataForManifest = (_a) => __awaiter(void 0, [_a], void 0, fu
78
78
  }
79
79
  `;
80
80
  try {
81
- const response = yield axios_1.default.post(`${prismaticUrl}/api`, {
81
+ const response = yield axios_1.default.post(new URL("/api", prismaticUrl).toString(), {
82
82
  query,
83
83
  variables: {
84
84
  componentKey,
@@ -206,7 +206,7 @@ function getComponentActions(componentId, prismaticUrl, accessToken) {
206
206
  }
207
207
  }
208
208
  `;
209
- const response = yield axios_1.default.post(`${prismaticUrl}/api`, {
209
+ const response = yield axios_1.default.post(new URL("/api", prismaticUrl).toString(), {
210
210
  query: query,
211
211
  variables: {
212
212
  component: componentId,
@@ -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 onInstanceFn = componentRef && typeof onTrigger !== "function"
598
- ? (context, params) => __awaiter(void 0, void 0, void 0, function* () {
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
- return onInstanceFn;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "10.12.0",
3
+ "version": "10.12.2",
4
4
  "description": "Utility library for building Prismatic connectors and code-native integrations",
5
5
  "keywords": ["prismatic"],
6
6
  "main": "dist/index.js",