@gravitee/ui-policy-studio-angular 16.0.0 → 16.0.1-apim-11428-mcp-proxy-4ee5192

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.
@@ -132,6 +132,25 @@ function fakeNativeFlow(modifier) {
132
132
  ...modifier,
133
133
  };
134
134
  }
135
+ function fakeMcpFlow(modifier) {
136
+ const mcpSelector = {
137
+ type: 'MCP',
138
+ };
139
+ const base = {
140
+ name: 'Flow name',
141
+ selectors: [mcpSelector],
142
+ request: [],
143
+ response: [],
144
+ enabled: true,
145
+ };
146
+ if (isFunction(modifier)) {
147
+ return modifier(base);
148
+ }
149
+ return {
150
+ ...base,
151
+ ...modifier,
152
+ };
153
+ }
135
154
 
136
155
  /*
137
156
  * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
@@ -308,6 +327,7 @@ function fakeTestPolicy(modifier) {
308
327
  icon: 'gio:gift',
309
328
  flowPhaseCompatibility: {
310
329
  HTTP_PROXY: ['REQUEST', 'RESPONSE'],
330
+ HTTP_MCP_PROXY: ['REQUEST', 'RESPONSE'],
311
331
  HTTP_MESSAGE: ['REQUEST', 'RESPONSE', 'SUBSCRIBE', 'PUBLISH'],
312
332
  NATIVE_KAFKA: ['CONNECT', 'INTERACT', 'PUBLISH', 'SUBSCRIBE'],
313
333
  },
@@ -716,6 +736,36 @@ function fakeKafkaNativeEndpoint(modifier) {
716
736
  ...modifier,
717
737
  };
718
738
  }
739
+ function fakeMCPProxyEntrypoint(modifier) {
740
+ const base = {
741
+ type: 'mcp-proxy',
742
+ name: 'MCP Proxy',
743
+ supportedModes: ['REQUEST_RESPONSE'],
744
+ icon: 'gio:language',
745
+ };
746
+ if (isFunction(modifier)) {
747
+ return modifier(base);
748
+ }
749
+ return {
750
+ ...base,
751
+ ...modifier,
752
+ };
753
+ }
754
+ function fakeMCPProxyEndpoint(modifier) {
755
+ const base = {
756
+ type: 'mcp-proxy',
757
+ name: 'MCP Proxy',
758
+ supportedModes: ['REQUEST_RESPONSE'],
759
+ icon: 'gio:language',
760
+ };
761
+ if (isFunction(modifier)) {
762
+ return modifier(base);
763
+ }
764
+ return {
765
+ ...base,
766
+ ...modifier,
767
+ };
768
+ }
719
769
 
720
770
  /*
721
771
  * Copyright (C) 2022 The Gravitee team (http://gravitee.io)
@@ -1599,6 +1649,65 @@ class GioPolicyStudioFlowNativeFormDialogHarness extends ComponentHarness {
1599
1649
  }
1600
1650
  }
1601
1651
 
1652
+ /*
1653
+ * Copyright (C) 2022 The Gravitee team (http://gravitee.io)
1654
+ *
1655
+ * Licensed under the Apache License, Version 2.0 (the "License");
1656
+ * you may not use this file except in compliance with the License.
1657
+ * You may obtain a copy of the License at
1658
+ *
1659
+ * http://www.apache.org/licenses/LICENSE-2.0
1660
+ *
1661
+ * Unless required by applicable law or agreed to in writing, software
1662
+ * distributed under the License is distributed on an "AS IS" BASIS,
1663
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1664
+ * See the License for the specific language governing permissions and
1665
+ * limitations under the License.
1666
+ */
1667
+ class GioPolicyStudioFlowMcpFormDialogHarness extends ComponentHarness {
1668
+ constructor() {
1669
+ super(...arguments);
1670
+ this.getSaveBtn = this.locatorFor(MatButtonHarness.with({ selector: '.actions__saveBtn' }));
1671
+ this.getCancelBtn = this.locatorFor(MatButtonHarness.with({ selector: '.actions__cancelBtn' }));
1672
+ this.nameInput = this.locatorFor(MatInputHarness.with({ selector: '[formControlName="name"]' }));
1673
+ this.methodsInput = this.locatorFor(GioFormTagsInputHarness.with({ selector: '[formControlName="mcpMethods"]' }));
1674
+ this.conditionInput = this.locatorFor(MatInputHarness.with({ selector: '[formControlName="condition"]' }));
1675
+ }
1676
+ static { this.hostSelector = 'gio-ps-flow-mcp-form-dialog'; }
1677
+ async setFlowFormValues(flow) {
1678
+ if (flow.name) {
1679
+ const nameInput = await this.nameInput();
1680
+ await nameInput.setValue(flow.name);
1681
+ }
1682
+ if (flow.methods) {
1683
+ const methodsInput = await this.methodsInput();
1684
+ for (const method of flow.methods) {
1685
+ await methodsInput.addTag(method);
1686
+ }
1687
+ }
1688
+ if (flow.condition) {
1689
+ const conditionInput = await this.conditionInput();
1690
+ await conditionInput.setValue(flow.condition);
1691
+ }
1692
+ }
1693
+ async getFlowFormValues() {
1694
+ return {
1695
+ name: await this.getFlowName(),
1696
+ };
1697
+ }
1698
+ async getFlowName() {
1699
+ return this.nameInput().then(input => input.getValue());
1700
+ }
1701
+ async save() {
1702
+ const button = await this.getSaveBtn();
1703
+ await button.click();
1704
+ }
1705
+ async cancel() {
1706
+ const button = await this.getCancelBtn();
1707
+ await button.click();
1708
+ }
1709
+ }
1710
+
1602
1711
  /*
1603
1712
  * Copyright (C) 2022 The Gravitee team (http://gravitee.io)
1604
1713
  *
@@ -1737,6 +1846,7 @@ class GioPolicyStudioHarness extends ComponentHarness {
1737
1846
  const channelSelector = flow.selectors?.find(s => s.type === 'CHANNEL');
1738
1847
  const httpSelector = flow.selectors?.find(s => s.type === 'HTTP');
1739
1848
  const conditionSelector = flow.selectors?.find(s => s.type === 'CONDITION');
1849
+ const mcpSelector = flow.selectors?.find(s => s.type === 'MCP');
1740
1850
  if (!!channelSelector && !!httpSelector) {
1741
1851
  throw new Error('Channel and HTTP selectors are not be used together.');
1742
1852
  }
@@ -1769,6 +1879,16 @@ class GioPolicyStudioHarness extends ComponentHarness {
1769
1879
  await flowFormNewDialog.save();
1770
1880
  return;
1771
1881
  }
1882
+ if (mcpSelector) {
1883
+ const flowFormNewDialog = await this.documentRootLocatorFactory().locatorFor(GioPolicyStudioFlowMcpFormDialogHarness)();
1884
+ await flowFormNewDialog.setFlowFormValues({
1885
+ name: flow.name,
1886
+ methods: mcpSelector?.methods,
1887
+ condition: conditionSelector?.condition,
1888
+ });
1889
+ await flowFormNewDialog.save();
1890
+ return;
1891
+ }
1772
1892
  if (!channelSelector && !httpSelector) {
1773
1893
  const flowFormNewDialog = await this.documentRootLocatorFactory().locatorFor(GioPolicyStudioFlowNativeFormDialogHarness)();
1774
1894
  await flowFormNewDialog.setFlowFormValues({
@@ -1858,5 +1978,5 @@ class GioPolicyGroupStudioHarness extends ComponentHarness {
1858
1978
  * Generated bundle index. Do not edit.
1859
1979
  */
1860
1980
 
1861
- export { GioPolicyGroupStudioHarness, GioPolicyStudioHarness, POLICIES_V4_UNREGISTERED_ICON, fakeAllPolicies, fakeBestMatchFlowExecution, fakeChannelFlow, fakeConditionedChannelFlow, fakeConditionedHttpFlow, fakeDefaultFlowExecution, fakeHTTPGetMessageEntrypoint, fakeHTTPPostMessageEntrypoint, fakeHTTPProxyEndpoint, fakeHTTPProxyEntrypoint, fakeHttpFlow, fakeJsonToXmlStep, fakeKafkaMessageEndpoint, fakeKafkaNativeEndpoint, fakeKafkaNativeEntrypoint, fakeMockMessageEndpoint, fakeNativeFlow, fakePlan, fakeRateLimitStep, fakeSSEMessageEntrypoint, fakeSharedPolicyGroupPolicyStep, fakeTestPolicy, fakeTestPolicyStep, fakeWebhookMessageEntrypoint, fakeWebsocketMessageEntrypoint };
1981
+ export { GioPolicyGroupStudioHarness, GioPolicyStudioHarness, POLICIES_V4_UNREGISTERED_ICON, fakeAllPolicies, fakeBestMatchFlowExecution, fakeChannelFlow, fakeConditionedChannelFlow, fakeConditionedHttpFlow, fakeDefaultFlowExecution, fakeHTTPGetMessageEntrypoint, fakeHTTPPostMessageEntrypoint, fakeHTTPProxyEndpoint, fakeHTTPProxyEntrypoint, fakeHttpFlow, fakeJsonToXmlStep, fakeKafkaMessageEndpoint, fakeKafkaNativeEndpoint, fakeKafkaNativeEntrypoint, fakeMCPProxyEndpoint, fakeMCPProxyEntrypoint, fakeMcpFlow, fakeMockMessageEndpoint, fakeNativeFlow, fakePlan, fakeRateLimitStep, fakeSSEMessageEntrypoint, fakeSharedPolicyGroupPolicyStep, fakeTestPolicy, fakeTestPolicyStep, fakeWebhookMessageEntrypoint, fakeWebsocketMessageEntrypoint };
1862
1982
  //# sourceMappingURL=gravitee-ui-policy-studio-angular-testing.mjs.map