@gravitee/ui-policy-studio-angular 16.0.1 → 16.1.0-apim-11657-adapt-ui-for-llm-0f84059

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,48 @@ 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
+ }
155
+ function fakeLlmFlow(modifier) {
156
+ const httpSelector = {
157
+ type: 'HTTP',
158
+ path: '/path',
159
+ pathOperator: 'EQUALS',
160
+ methods: ['GET'],
161
+ };
162
+ const base = {
163
+ name: 'Flow name',
164
+ selectors: [httpSelector],
165
+ request: [],
166
+ response: [],
167
+ enabled: true,
168
+ };
169
+ if (isFunction(modifier)) {
170
+ return modifier(base);
171
+ }
172
+ return {
173
+ ...base,
174
+ ...modifier,
175
+ };
176
+ }
135
177
 
136
178
  /*
137
179
  * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
@@ -308,6 +350,8 @@ function fakeTestPolicy(modifier) {
308
350
  icon: 'gio:gift',
309
351
  flowPhaseCompatibility: {
310
352
  HTTP_PROXY: ['REQUEST', 'RESPONSE'],
353
+ HTTP_MCP_PROXY: ['REQUEST', 'RESPONSE'],
354
+ HTTP_LLM_PROXY: ['REQUEST', 'RESPONSE'],
311
355
  HTTP_MESSAGE: ['REQUEST', 'RESPONSE', 'SUBSCRIBE', 'PUBLISH'],
312
356
  NATIVE_KAFKA: ['CONNECT', 'INTERACT', 'PUBLISH', 'SUBSCRIBE'],
313
357
  },
@@ -716,6 +760,66 @@ function fakeKafkaNativeEndpoint(modifier) {
716
760
  ...modifier,
717
761
  };
718
762
  }
763
+ function fakeMCPProxyEntrypoint(modifier) {
764
+ const base = {
765
+ type: 'mcp-proxy',
766
+ name: 'MCP Proxy',
767
+ supportedModes: ['REQUEST_RESPONSE'],
768
+ icon: 'gio:language',
769
+ };
770
+ if (isFunction(modifier)) {
771
+ return modifier(base);
772
+ }
773
+ return {
774
+ ...base,
775
+ ...modifier,
776
+ };
777
+ }
778
+ function fakeMCPProxyEndpoint(modifier) {
779
+ const base = {
780
+ type: 'mcp-proxy',
781
+ name: 'MCP Proxy',
782
+ supportedModes: ['REQUEST_RESPONSE'],
783
+ icon: 'gio:language',
784
+ };
785
+ if (isFunction(modifier)) {
786
+ return modifier(base);
787
+ }
788
+ return {
789
+ ...base,
790
+ ...modifier,
791
+ };
792
+ }
793
+ function fakeLlmProxyEntrypoint(modifier) {
794
+ const base = {
795
+ type: 'llm-proxy',
796
+ name: 'LLM Proxy',
797
+ supportedModes: ['REQUEST_RESPONSE'],
798
+ icon: 'gio:language',
799
+ };
800
+ if (isFunction(modifier)) {
801
+ return modifier(base);
802
+ }
803
+ return {
804
+ ...base,
805
+ ...modifier,
806
+ };
807
+ }
808
+ function fakeLlmProxyEndpoint(modifier) {
809
+ const base = {
810
+ type: 'llm-proxy',
811
+ name: 'LLM Proxy',
812
+ supportedModes: ['REQUEST_RESPONSE'],
813
+ icon: 'gio:language',
814
+ };
815
+ if (isFunction(modifier)) {
816
+ return modifier(base);
817
+ }
818
+ return {
819
+ ...base,
820
+ ...modifier,
821
+ };
822
+ }
719
823
 
720
824
  /*
721
825
  * Copyright (C) 2022 The Gravitee team (http://gravitee.io)
@@ -1599,6 +1703,67 @@ class GioPolicyStudioFlowNativeFormDialogHarness extends ComponentHarness {
1599
1703
  }
1600
1704
  }
1601
1705
 
1706
+ /*
1707
+ * Copyright (C) 2022 The Gravitee team (http://gravitee.io)
1708
+ *
1709
+ * Licensed under the Apache License, Version 2.0 (the "License");
1710
+ * you may not use this file except in compliance with the License.
1711
+ * You may obtain a copy of the License at
1712
+ *
1713
+ * http://www.apache.org/licenses/LICENSE-2.0
1714
+ *
1715
+ * Unless required by applicable law or agreed to in writing, software
1716
+ * distributed under the License is distributed on an "AS IS" BASIS,
1717
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1718
+ * See the License for the specific language governing permissions and
1719
+ * limitations under the License.
1720
+ */
1721
+ class GioPolicyStudioFlowMcpFormDialogHarness extends ComponentHarness {
1722
+ constructor() {
1723
+ super(...arguments);
1724
+ this.getSaveBtn = this.locatorFor(MatButtonHarness.with({ selector: '.actions__saveBtn' }));
1725
+ this.getCancelBtn = this.locatorFor(MatButtonHarness.with({ selector: '.actions__cancelBtn' }));
1726
+ this.nameInput = this.locatorFor(MatInputHarness.with({ selector: '[formControlName="name"]' }));
1727
+ this.methodsInput = this.locatorFor(GioFormTagsInputHarness.with({ selector: '[formControlName="mcpMethods"]' }));
1728
+ this.conditionInput = this.locatorFor(MatInputHarness.with({ selector: '[formControlName="condition"]' }));
1729
+ }
1730
+ static { this.hostSelector = 'gio-ps-flow-mcp-form-dialog'; }
1731
+ async setFlowFormValues(flow) {
1732
+ if (flow.name) {
1733
+ const nameInput = await this.nameInput();
1734
+ await nameInput.setValue(flow.name);
1735
+ }
1736
+ if (flow.methods) {
1737
+ const methodsInput = await this.methodsInput();
1738
+ for (const method of flow.methods) {
1739
+ await methodsInput.addTag(method);
1740
+ }
1741
+ }
1742
+ if (flow.condition) {
1743
+ const conditionInput = await this.conditionInput();
1744
+ await conditionInput.setValue(flow.condition);
1745
+ }
1746
+ }
1747
+ async getFlowFormValues() {
1748
+ return {
1749
+ name: await this.getFlowName(),
1750
+ methods: await this.methodsInput().then(input => input.getTags()),
1751
+ condition: await this.conditionInput().then(input => input.getValue()),
1752
+ };
1753
+ }
1754
+ async getFlowName() {
1755
+ return this.nameInput().then(input => input.getValue());
1756
+ }
1757
+ async save() {
1758
+ const button = await this.getSaveBtn();
1759
+ await button.click();
1760
+ }
1761
+ async cancel() {
1762
+ const button = await this.getCancelBtn();
1763
+ await button.click();
1764
+ }
1765
+ }
1766
+
1602
1767
  /*
1603
1768
  * Copyright (C) 2022 The Gravitee team (http://gravitee.io)
1604
1769
  *
@@ -1737,6 +1902,7 @@ class GioPolicyStudioHarness extends ComponentHarness {
1737
1902
  const channelSelector = flow.selectors?.find(s => s.type === 'CHANNEL');
1738
1903
  const httpSelector = flow.selectors?.find(s => s.type === 'HTTP');
1739
1904
  const conditionSelector = flow.selectors?.find(s => s.type === 'CONDITION');
1905
+ const mcpSelector = flow.selectors?.find(s => s.type === 'MCP');
1740
1906
  if (!!channelSelector && !!httpSelector) {
1741
1907
  throw new Error('Channel and HTTP selectors are not be used together.');
1742
1908
  }
@@ -1769,6 +1935,16 @@ class GioPolicyStudioHarness extends ComponentHarness {
1769
1935
  await flowFormNewDialog.save();
1770
1936
  return;
1771
1937
  }
1938
+ if (mcpSelector) {
1939
+ const flowFormNewDialog = await this.documentRootLocatorFactory().locatorFor(GioPolicyStudioFlowMcpFormDialogHarness)();
1940
+ await flowFormNewDialog.setFlowFormValues({
1941
+ name: flow.name,
1942
+ methods: mcpSelector?.methods,
1943
+ condition: conditionSelector?.condition,
1944
+ });
1945
+ await flowFormNewDialog.save();
1946
+ return;
1947
+ }
1772
1948
  if (!channelSelector && !httpSelector) {
1773
1949
  const flowFormNewDialog = await this.documentRootLocatorFactory().locatorFor(GioPolicyStudioFlowNativeFormDialogHarness)();
1774
1950
  await flowFormNewDialog.setFlowFormValues({
@@ -1858,5 +2034,5 @@ class GioPolicyGroupStudioHarness extends ComponentHarness {
1858
2034
  * Generated bundle index. Do not edit.
1859
2035
  */
1860
2036
 
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 };
2037
+ export { GioPolicyGroupStudioHarness, GioPolicyStudioHarness, POLICIES_V4_UNREGISTERED_ICON, fakeAllPolicies, fakeBestMatchFlowExecution, fakeChannelFlow, fakeConditionedChannelFlow, fakeConditionedHttpFlow, fakeDefaultFlowExecution, fakeHTTPGetMessageEntrypoint, fakeHTTPPostMessageEntrypoint, fakeHTTPProxyEndpoint, fakeHTTPProxyEntrypoint, fakeHttpFlow, fakeJsonToXmlStep, fakeKafkaMessageEndpoint, fakeKafkaNativeEndpoint, fakeKafkaNativeEntrypoint, fakeLlmFlow, fakeLlmProxyEndpoint, fakeLlmProxyEntrypoint, fakeMCPProxyEndpoint, fakeMCPProxyEntrypoint, fakeMcpFlow, fakeMockMessageEndpoint, fakeNativeFlow, fakePlan, fakeRateLimitStep, fakeSSEMessageEntrypoint, fakeSharedPolicyGroupPolicyStep, fakeTestPolicy, fakeTestPolicyStep, fakeWebhookMessageEntrypoint, fakeWebsocketMessageEntrypoint };
1862
2038
  //# sourceMappingURL=gravitee-ui-policy-studio-angular-testing.mjs.map