@gravitee/ui-policy-studio-angular 16.0.1 → 16.1.0

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