@gravitee/ui-policy-studio-angular 16.0.1-apim-11428-mcp-proxy-1b4e3b1 → 16.0.1-apim-11657-adapt-ui-for-llm-e538197

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.
@@ -152,6 +152,26 @@ function fakeMcpFlow(modifier) {
152
152
  ...modifier,
153
153
  };
154
154
  }
155
+ function fakeLlmFlow(modifier) {
156
+ const llmSelector = {
157
+ type: 'LLM',
158
+ methods: [],
159
+ };
160
+ const base = {
161
+ name: 'Flow name',
162
+ selectors: [llmSelector],
163
+ request: [],
164
+ response: [],
165
+ enabled: true,
166
+ };
167
+ if (isFunction(modifier)) {
168
+ return modifier(base);
169
+ }
170
+ return {
171
+ ...base,
172
+ ...modifier,
173
+ };
174
+ }
155
175
 
156
176
  /*
157
177
  * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
@@ -329,6 +349,7 @@ function fakeTestPolicy(modifier) {
329
349
  flowPhaseCompatibility: {
330
350
  HTTP_PROXY: ['REQUEST', 'RESPONSE'],
331
351
  HTTP_MCP_PROXY: ['REQUEST', 'RESPONSE'],
352
+ HTTP_LLM_PROXY: ['REQUEST', 'RESPONSE'],
332
353
  HTTP_MESSAGE: ['REQUEST', 'RESPONSE', 'SUBSCRIBE', 'PUBLISH'],
333
354
  NATIVE_KAFKA: ['CONNECT', 'INTERACT', 'PUBLISH', 'SUBSCRIBE'],
334
355
  },
@@ -767,6 +788,36 @@ function fakeMCPProxyEndpoint(modifier) {
767
788
  ...modifier,
768
789
  };
769
790
  }
791
+ function fakeLlmProxyEntrypoint(modifier) {
792
+ const base = {
793
+ type: 'llm-proxy',
794
+ name: 'LLM Proxy',
795
+ supportedModes: ['REQUEST_RESPONSE'],
796
+ icon: 'gio:language',
797
+ };
798
+ if (isFunction(modifier)) {
799
+ return modifier(base);
800
+ }
801
+ return {
802
+ ...base,
803
+ ...modifier,
804
+ };
805
+ }
806
+ function fakeLlmProxyEndpoint(modifier) {
807
+ const base = {
808
+ type: 'llm-proxy',
809
+ name: 'LLM Proxy',
810
+ supportedModes: ['REQUEST_RESPONSE'],
811
+ icon: 'gio:language',
812
+ };
813
+ if (isFunction(modifier)) {
814
+ return modifier(base);
815
+ }
816
+ return {
817
+ ...base,
818
+ ...modifier,
819
+ };
820
+ }
770
821
 
771
822
  /*
772
823
  * Copyright (C) 2022 The Gravitee team (http://gravitee.io)
@@ -1711,6 +1762,67 @@ class GioPolicyStudioFlowMcpFormDialogHarness extends ComponentHarness {
1711
1762
  }
1712
1763
  }
1713
1764
 
1765
+ /*
1766
+ * Copyright (C) 2022 The Gravitee team (http://gravitee.io)
1767
+ *
1768
+ * Licensed under the Apache License, Version 2.0 (the "License");
1769
+ * you may not use this file except in compliance with the License.
1770
+ * You may obtain a copy of the License at
1771
+ *
1772
+ * http://www.apache.org/licenses/LICENSE-2.0
1773
+ *
1774
+ * Unless required by applicable law or agreed to in writing, software
1775
+ * distributed under the License is distributed on an "AS IS" BASIS,
1776
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1777
+ * See the License for the specific language governing permissions and
1778
+ * limitations under the License.
1779
+ */
1780
+ class GioPolicyStudioFlowLlmFormDialogHarness extends ComponentHarness {
1781
+ constructor() {
1782
+ super(...arguments);
1783
+ this.getSaveBtn = this.locatorFor(MatButtonHarness.with({ selector: '.actions__saveBtn' }));
1784
+ this.getCancelBtn = this.locatorFor(MatButtonHarness.with({ selector: '.actions__cancelBtn' }));
1785
+ this.nameInput = this.locatorFor(MatInputHarness.with({ selector: '[formControlName="name"]' }));
1786
+ this.methodsInput = this.locatorFor(GioFormTagsInputHarness.with({ selector: '[formControlName="llmMethods"]' }));
1787
+ this.conditionInput = this.locatorFor(MatInputHarness.with({ selector: '[formControlName="condition"]' }));
1788
+ }
1789
+ static { this.hostSelector = 'gio-ps-flow-llm-form-dialog'; }
1790
+ async setFlowFormValues(flow) {
1791
+ if (flow.name) {
1792
+ const nameInput = await this.nameInput();
1793
+ await nameInput.setValue(flow.name);
1794
+ }
1795
+ if (flow.methods) {
1796
+ const methodsInput = await this.methodsInput();
1797
+ for (const method of flow.methods) {
1798
+ await methodsInput.addTag(method);
1799
+ }
1800
+ }
1801
+ if (flow.condition) {
1802
+ const conditionInput = await this.conditionInput();
1803
+ await conditionInput.setValue(flow.condition);
1804
+ }
1805
+ }
1806
+ async getFlowFormValues() {
1807
+ return {
1808
+ name: await this.getFlowName(),
1809
+ methods: await this.methodsInput().then(input => input.getTags()),
1810
+ condition: await this.conditionInput().then(input => input.getValue()),
1811
+ };
1812
+ }
1813
+ async getFlowName() {
1814
+ return this.nameInput().then(input => input.getValue());
1815
+ }
1816
+ async save() {
1817
+ const button = await this.getSaveBtn();
1818
+ await button.click();
1819
+ }
1820
+ async cancel() {
1821
+ const button = await this.getCancelBtn();
1822
+ await button.click();
1823
+ }
1824
+ }
1825
+
1714
1826
  /*
1715
1827
  * Copyright (C) 2022 The Gravitee team (http://gravitee.io)
1716
1828
  *
@@ -1850,6 +1962,7 @@ class GioPolicyStudioHarness extends ComponentHarness {
1850
1962
  const httpSelector = flow.selectors?.find(s => s.type === 'HTTP');
1851
1963
  const conditionSelector = flow.selectors?.find(s => s.type === 'CONDITION');
1852
1964
  const mcpSelector = flow.selectors?.find(s => s.type === 'MCP');
1965
+ const llmSelector = flow.selectors?.find(s => s.type === 'HTTP');
1853
1966
  if (!!channelSelector && !!httpSelector) {
1854
1967
  throw new Error('Channel and HTTP selectors are not be used together.');
1855
1968
  }
@@ -1892,6 +2005,16 @@ class GioPolicyStudioHarness extends ComponentHarness {
1892
2005
  await flowFormNewDialog.save();
1893
2006
  return;
1894
2007
  }
2008
+ if (llmSelector) {
2009
+ const flowFormNewDialog = await this.documentRootLocatorFactory().locatorFor(GioPolicyStudioFlowLlmFormDialogHarness)();
2010
+ await flowFormNewDialog.setFlowFormValues({
2011
+ name: flow.name,
2012
+ methods: llmSelector?.methods,
2013
+ condition: conditionSelector?.condition,
2014
+ });
2015
+ await flowFormNewDialog.save();
2016
+ return;
2017
+ }
1895
2018
  if (!channelSelector && !httpSelector) {
1896
2019
  const flowFormNewDialog = await this.documentRootLocatorFactory().locatorFor(GioPolicyStudioFlowNativeFormDialogHarness)();
1897
2020
  await flowFormNewDialog.setFlowFormValues({
@@ -1981,5 +2104,5 @@ class GioPolicyGroupStudioHarness extends ComponentHarness {
1981
2104
  * Generated bundle index. Do not edit.
1982
2105
  */
1983
2106
 
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 };
2107
+ 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 };
1985
2108
  //# sourceMappingURL=gravitee-ui-policy-studio-angular-testing.mjs.map