@gravitee/ui-policy-studio-angular 17.2.0 → 17.3.0-apim-12548-add-a2a-flow-support-b35c851

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.
@@ -122,6 +122,7 @@ function fakeNativeFlow(modifier) {
122
122
  interact: [],
123
123
  subscribe: [],
124
124
  publish: [],
125
+ entrypointConnect: [],
125
126
  enabled: true,
126
127
  };
127
128
  if (isFunction(modifier)) {
@@ -174,6 +175,28 @@ function fakeLlmFlow(modifier) {
174
175
  ...modifier,
175
176
  };
176
177
  }
178
+ function fakeA2aFlow(modifier) {
179
+ const httpSelector = {
180
+ type: 'HTTP',
181
+ path: '/path',
182
+ pathOperator: 'EQUALS',
183
+ methods: ['GET'],
184
+ };
185
+ const base = {
186
+ name: 'Flow name',
187
+ selectors: [httpSelector],
188
+ request: [],
189
+ response: [],
190
+ enabled: true,
191
+ };
192
+ if (isFunction(modifier)) {
193
+ return modifier(base);
194
+ }
195
+ return {
196
+ ...base,
197
+ ...modifier,
198
+ };
199
+ }
177
200
 
178
201
  /*
179
202
  * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
@@ -354,7 +377,7 @@ function fakeTestPolicy(modifier) {
354
377
  HTTP_PROXY: ['REQUEST', 'RESPONSE'],
355
378
  LLM_PROXY: ['REQUEST', 'RESPONSE'],
356
379
  MCP_PROXY: ['REQUEST', 'RESPONSE'],
357
- NATIVE_KAFKA: ['CONNECT', 'INTERACT', 'PUBLISH', 'SUBSCRIBE'],
380
+ NATIVE_KAFKA: ['INTERACT', 'PUBLISH', 'SUBSCRIBE', 'ENTRYPOINT_CONNECT'],
358
381
  },
359
382
  };
360
383
  if (isFunction(modifier)) {
@@ -735,7 +758,7 @@ function fakeKafkaNativeEntrypoint(modifier) {
735
758
  const base = {
736
759
  type: 'native-kafka',
737
760
  name: 'Client',
738
- supportedModes: ['INTERACT', 'PUBLISH', 'SUBSCRIBE'],
761
+ supportedModes: ['INTERACT', 'PUBLISH', 'SUBSCRIBE', 'ENTRYPOINT_CONNECT'],
739
762
  icon: 'gio:kafka',
740
763
  };
741
764
  if (isFunction(modifier)) {
@@ -750,7 +773,7 @@ function fakeKafkaNativeEndpoint(modifier) {
750
773
  const base = {
751
774
  type: 'native-kafka',
752
775
  name: 'Broker',
753
- supportedModes: ['INTERACT', 'PUBLISH', 'SUBSCRIBE'],
776
+ supportedModes: ['INTERACT', 'PUBLISH', 'SUBSCRIBE', 'ENTRYPOINT_CONNECT'],
754
777
  icon: 'gio:kafka',
755
778
  };
756
779
  if (isFunction(modifier)) {
@@ -821,6 +844,36 @@ function fakeLlmProxyEndpoint(modifier) {
821
844
  ...modifier,
822
845
  };
823
846
  }
847
+ function fakeA2aProxyEntrypoint(modifier) {
848
+ const base = {
849
+ type: 'a2a-proxy',
850
+ name: 'A2A Proxy',
851
+ supportedModes: ['REQUEST_RESPONSE'],
852
+ icon: 'gio:language',
853
+ };
854
+ if (isFunction(modifier)) {
855
+ return modifier(base);
856
+ }
857
+ return {
858
+ ...base,
859
+ ...modifier,
860
+ };
861
+ }
862
+ function fakeA2aProxyEndpoint(modifier) {
863
+ const base = {
864
+ type: 'a2a-proxy',
865
+ name: 'A2A Proxy',
866
+ supportedModes: ['REQUEST_RESPONSE'],
867
+ icon: 'gio:language',
868
+ };
869
+ if (isFunction(modifier)) {
870
+ return modifier(base);
871
+ }
872
+ return {
873
+ ...base,
874
+ ...modifier,
875
+ };
876
+ }
824
877
 
825
878
  /*
826
879
  * Copyright (C) 2022 The Gravitee team (http://gravitee.io)
@@ -1530,6 +1583,7 @@ const TYPE_TO_TEXT = {
1530
1583
  RESPONSE: 'Response phase',
1531
1584
  PUBLISH: 'Publish phase',
1532
1585
  SUBSCRIBE: 'Subscribe phase',
1586
+ ENTRYPOINT_CONNECT: 'Entrypoint Connect phase',
1533
1587
  };
1534
1588
  class GioPolicyStudioDetailsPhaseHarness extends ComponentHarness {
1535
1589
  constructor() {
@@ -1858,6 +1912,99 @@ class GioPolicyStudioFlowLlmFormDialogHarness extends ComponentHarness {
1858
1912
  }
1859
1913
  }
1860
1914
 
1915
+ /*
1916
+ * Copyright (C) 2022 The Gravitee team (http://gravitee.io)
1917
+ *
1918
+ * Licensed under the Apache License, Version 2.0 (the "License");
1919
+ * you may not use this file except in compliance with the License.
1920
+ * You may obtain a copy of the License at
1921
+ *
1922
+ * http://www.apache.org/licenses/LICENSE-2.0
1923
+ *
1924
+ * Unless required by applicable law or agreed to in writing, software
1925
+ * distributed under the License is distributed on an "AS IS" BASIS,
1926
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1927
+ * See the License for the specific language governing permissions and
1928
+ * limitations under the License.
1929
+ */
1930
+ class GioPolicyStudioFlowA2aFormDialogHarness extends ComponentHarness {
1931
+ constructor() {
1932
+ super(...arguments);
1933
+ this.getSaveBtn = this.locatorFor(MatButtonHarness.with({ selector: '.actions__saveBtn' }));
1934
+ this.getCancelBtn = this.locatorFor(MatButtonHarness.with({ selector: '.actions__cancelBtn' }));
1935
+ this.nameInput = this.locatorFor(MatInputHarness.with({ selector: '[formControlName="name"]' }));
1936
+ this.pathOperatorInput = this.locatorFor(MatSelectHarness.with({ selector: '[formControlName="pathOperator"]' }));
1937
+ this.pathInput = this.locatorFor(MatInputHarness.with({ selector: '[formControlName="path"]' }));
1938
+ this.methodsInput = this.locatorFor(GioFormTagsInputHarness.with({ selector: '[formControlName="methods"]' }));
1939
+ this.conditionInput = this.locatorFor(MatInputHarness.with({ selector: '[formControlName="condition"]' }));
1940
+ }
1941
+ static { this.hostSelector = 'gio-ps-flow-a2a-form-dialog'; }
1942
+ async setFlowFormValues(flow) {
1943
+ if (flow.name) {
1944
+ const nameInput = await this.nameInput();
1945
+ await nameInput.setValue(flow.name);
1946
+ }
1947
+ if (flow.pathOperator) {
1948
+ const pathOperatorInput = await this.pathOperatorInput();
1949
+ await pathOperatorInput.open();
1950
+ // Unselect all options before selecting the new one
1951
+ for (const option of await pathOperatorInput.getOptions()) {
1952
+ if (await option.isSelected()) {
1953
+ await option.click();
1954
+ }
1955
+ }
1956
+ await pathOperatorInput.clickOptions({ text: new RegExp(flow.pathOperator, 'i') });
1957
+ }
1958
+ if (flow.path) {
1959
+ const input = await this.pathInput();
1960
+ await input.setValue(flow.path);
1961
+ }
1962
+ if (flow.methods) {
1963
+ const methodsInput = await this.methodsInput();
1964
+ await methodsInput.removeTag('ALL');
1965
+ for (const method of flow.methods) {
1966
+ await methodsInput.addTag(method);
1967
+ }
1968
+ }
1969
+ if (flow.condition) {
1970
+ const conditionInput = await this.conditionInput();
1971
+ await conditionInput.setValue(flow.condition);
1972
+ }
1973
+ }
1974
+ async getFlowFormValues() {
1975
+ return {
1976
+ name: await this.getFlowName(),
1977
+ pathOperator: await this.getPathOperator(),
1978
+ path: await this.getFlowPath(),
1979
+ methods: await this.getMethods(),
1980
+ condition: await this.getCondition(),
1981
+ };
1982
+ }
1983
+ async getFlowName() {
1984
+ return this.nameInput().then(input => input.getValue());
1985
+ }
1986
+ async getFlowPath() {
1987
+ return this.pathInput().then(input => input.getValue());
1988
+ }
1989
+ async getPathOperator() {
1990
+ return this.pathOperatorInput().then(input => input.getValueText());
1991
+ }
1992
+ async getMethods() {
1993
+ return this.methodsInput().then(input => input.getTags());
1994
+ }
1995
+ async getCondition() {
1996
+ return this.conditionInput().then(input => input.getValue());
1997
+ }
1998
+ async save() {
1999
+ const button = await this.getSaveBtn();
2000
+ await button.click();
2001
+ }
2002
+ async cancel() {
2003
+ const button = await this.getCancelBtn();
2004
+ await button.click();
2005
+ }
2006
+ }
2007
+
1861
2008
  /*
1862
2009
  * Copyright (C) 2022 The Gravitee team (http://gravitee.io)
1863
2010
  *
@@ -1964,9 +2111,14 @@ class GioPolicyStudioHarness extends ComponentHarness {
1964
2111
  * @param phaseType Phase type to get
1965
2112
  */
1966
2113
  async getSelectedFlowPhase(phaseType) {
1967
- if (phaseType === 'PUBLISH' || phaseType === 'SUBSCRIBE') {
1968
- const matTabsHarness = await this.locatorFor(MatTabGroupHarness.with({ selector: '.content__tabs' }))();
1969
- await matTabsHarness.selectTab({ label: 'Event messages' });
2114
+ const matTabsHarness = await this.locatorForOptional(MatTabGroupHarness.with({ selector: '.content__tabs' }))();
2115
+ if (matTabsHarness) {
2116
+ if (phaseType === 'PUBLISH' || phaseType === 'SUBSCRIBE') {
2117
+ await matTabsHarness.selectTab({ label: 'Event messages' });
2118
+ }
2119
+ else if (phaseType === 'INTERACT' || phaseType === 'ENTRYPOINT_CONNECT') {
2120
+ await matTabsHarness.selectTab({ label: 'Global' });
2121
+ }
1970
2122
  }
1971
2123
  const steps = await this.phaseHarness(phaseType);
1972
2124
  return steps ? steps : undefined;
@@ -2023,7 +2175,10 @@ class GioPolicyStudioHarness extends ComponentHarness {
2023
2175
  flowFormNewDialog = await this.documentRootLocatorFactory().locatorForOptional(GioPolicyStudioFlowLlmFormDialogHarness)();
2024
2176
  }
2025
2177
  if (!flowFormNewDialog) {
2026
- throw new Error('No Proxy or LLM flow form dialog found.');
2178
+ flowFormNewDialog = await this.documentRootLocatorFactory().locatorForOptional(GioPolicyStudioFlowA2aFormDialogHarness)();
2179
+ }
2180
+ if (!flowFormNewDialog) {
2181
+ throw new Error('No Proxy, LLM or A2A flow form dialog found.');
2027
2182
  }
2028
2183
  await flowFormNewDialog.setFlowFormValues({
2029
2184
  name: flow.name,
@@ -2134,5 +2289,5 @@ class GioPolicyGroupStudioHarness extends ComponentHarness {
2134
2289
  * Generated bundle index. Do not edit.
2135
2290
  */
2136
2291
 
2137
- 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 };
2292
+ export { GioPolicyGroupStudioHarness, GioPolicyStudioHarness, POLICIES_V4_UNREGISTERED_ICON, fakeA2aFlow, fakeA2aProxyEndpoint, fakeA2aProxyEntrypoint, 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 };
2138
2293
  //# sourceMappingURL=gravitee-ui-policy-studio-angular-testing.mjs.map