@gravitee/ui-policy-studio-angular 16.1.0 → 16.2.0-renovate-angular-875b892

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,28 @@ function fakeMcpFlow(modifier) {
152
152
  ...modifier,
153
153
  };
154
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
+ }
155
177
 
156
178
  /*
157
179
  * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
@@ -329,6 +351,7 @@ function fakeTestPolicy(modifier) {
329
351
  flowPhaseCompatibility: {
330
352
  HTTP_PROXY: ['REQUEST', 'RESPONSE'],
331
353
  HTTP_MCP_PROXY: ['REQUEST', 'RESPONSE'],
354
+ HTTP_LLM_PROXY: ['REQUEST', 'RESPONSE'],
332
355
  HTTP_MESSAGE: ['REQUEST', 'RESPONSE', 'SUBSCRIBE', 'PUBLISH'],
333
356
  NATIVE_KAFKA: ['CONNECT', 'INTERACT', 'PUBLISH', 'SUBSCRIBE'],
334
357
  },
@@ -767,6 +790,36 @@ function fakeMCPProxyEndpoint(modifier) {
767
790
  ...modifier,
768
791
  };
769
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
+ }
770
823
 
771
824
  /*
772
825
  * Copyright (C) 2022 The Gravitee team (http://gravitee.io)
@@ -1711,6 +1764,99 @@ class GioPolicyStudioFlowMcpFormDialogHarness extends ComponentHarness {
1711
1764
  }
1712
1765
  }
1713
1766
 
1767
+ /*
1768
+ * Copyright (C) 2022 The Gravitee team (http://gravitee.io)
1769
+ *
1770
+ * Licensed under the Apache License, Version 2.0 (the "License");
1771
+ * you may not use this file except in compliance with the License.
1772
+ * You may obtain a copy of the License at
1773
+ *
1774
+ * http://www.apache.org/licenses/LICENSE-2.0
1775
+ *
1776
+ * Unless required by applicable law or agreed to in writing, software
1777
+ * distributed under the License is distributed on an "AS IS" BASIS,
1778
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1779
+ * See the License for the specific language governing permissions and
1780
+ * limitations under the License.
1781
+ */
1782
+ class GioPolicyStudioFlowLlmFormDialogHarness extends ComponentHarness {
1783
+ constructor() {
1784
+ super(...arguments);
1785
+ this.getSaveBtn = this.locatorFor(MatButtonHarness.with({ selector: '.actions__saveBtn' }));
1786
+ this.getCancelBtn = this.locatorFor(MatButtonHarness.with({ selector: '.actions__cancelBtn' }));
1787
+ this.nameInput = this.locatorFor(MatInputHarness.with({ selector: '[formControlName="name"]' }));
1788
+ this.pathOperatorInput = this.locatorFor(MatSelectHarness.with({ selector: '[formControlName="pathOperator"]' }));
1789
+ this.pathInput = this.locatorFor(MatInputHarness.with({ selector: '[formControlName="path"]' }));
1790
+ this.methodsInput = this.locatorFor(GioFormTagsInputHarness.with({ selector: '[formControlName="methods"]' }));
1791
+ this.conditionInput = this.locatorFor(MatInputHarness.with({ selector: '[formControlName="condition"]' }));
1792
+ }
1793
+ static { this.hostSelector = 'gio-ps-flow-llm-form-dialog'; }
1794
+ async setFlowFormValues(flow) {
1795
+ if (flow.name) {
1796
+ const nameInput = await this.nameInput();
1797
+ await nameInput.setValue(flow.name);
1798
+ }
1799
+ if (flow.pathOperator) {
1800
+ const pathOperatorInput = await this.pathOperatorInput();
1801
+ await pathOperatorInput.open();
1802
+ // Unselect all options before selecting the new one
1803
+ for (const option of await pathOperatorInput.getOptions()) {
1804
+ if (await option.isSelected()) {
1805
+ await option.click();
1806
+ }
1807
+ }
1808
+ await pathOperatorInput.clickOptions({ text: new RegExp(flow.pathOperator, 'i') });
1809
+ }
1810
+ if (flow.path) {
1811
+ const input = await this.pathInput();
1812
+ await input.setValue(flow.path);
1813
+ }
1814
+ if (flow.methods) {
1815
+ const methodsInput = await this.methodsInput();
1816
+ await methodsInput.removeTag('ALL');
1817
+ for (const method of flow.methods) {
1818
+ await methodsInput.addTag(method);
1819
+ }
1820
+ }
1821
+ if (flow.condition) {
1822
+ const conditionInput = await this.conditionInput();
1823
+ await conditionInput.setValue(flow.condition);
1824
+ }
1825
+ }
1826
+ async getFlowFormValues() {
1827
+ return {
1828
+ name: await this.getFlowName(),
1829
+ pathOperator: await this.getPathOperator(),
1830
+ path: await this.getFlowPath(),
1831
+ methods: await this.getMethods(),
1832
+ condition: await this.getCondition(),
1833
+ };
1834
+ }
1835
+ async getFlowName() {
1836
+ return this.nameInput().then(input => input.getValue());
1837
+ }
1838
+ async getFlowPath() {
1839
+ return this.pathInput().then(input => input.getValue());
1840
+ }
1841
+ async getPathOperator() {
1842
+ return this.pathOperatorInput().then(input => input.getValueText());
1843
+ }
1844
+ async getMethods() {
1845
+ return this.methodsInput().then(input => input.getTags());
1846
+ }
1847
+ async getCondition() {
1848
+ return this.conditionInput().then(input => input.getValue());
1849
+ }
1850
+ async save() {
1851
+ const button = await this.getSaveBtn();
1852
+ await button.click();
1853
+ }
1854
+ async cancel() {
1855
+ const button = await this.getCancelBtn();
1856
+ await button.click();
1857
+ }
1858
+ }
1859
+
1714
1860
  /*
1715
1861
  * Copyright (C) 2022 The Gravitee team (http://gravitee.io)
1716
1862
  *
@@ -1871,7 +2017,13 @@ class GioPolicyStudioHarness extends ComponentHarness {
1871
2017
  return;
1872
2018
  }
1873
2019
  if (httpSelector) {
1874
- const flowFormNewDialog = await this.documentRootLocatorFactory().locatorFor(GioPolicyStudioFlowProxyFormDialogHarness)();
2020
+ let flowFormNewDialog = await this.documentRootLocatorFactory().locatorForOptional(GioPolicyStudioFlowProxyFormDialogHarness)();
2021
+ if (!flowFormNewDialog) {
2022
+ flowFormNewDialog = await this.documentRootLocatorFactory().locatorForOptional(GioPolicyStudioFlowLlmFormDialogHarness)();
2023
+ }
2024
+ if (!flowFormNewDialog) {
2025
+ throw new Error('No Proxy or LLM flow form dialog found.');
2026
+ }
1875
2027
  await flowFormNewDialog.setFlowFormValues({
1876
2028
  name: flow.name,
1877
2029
  path: httpSelector?.path,
@@ -1981,5 +2133,5 @@ class GioPolicyGroupStudioHarness extends ComponentHarness {
1981
2133
  * Generated bundle index. Do not edit.
1982
2134
  */
1983
2135
 
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 };
2136
+ 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
2137
  //# sourceMappingURL=gravitee-ui-policy-studio-angular-testing.mjs.map