karavan-core 4.8.0 → 99.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of karavan-core might be problematic. Click here for more details.

Files changed (115) hide show
  1. package/index.js +3 -0
  2. package/package.json +8 -58
  3. package/.bebelrc +0 -3
  4. package/.mocharc.json +0 -11
  5. package/.prettierignore +0 -9
  6. package/.prettierrc +0 -14
  7. package/src/core/api/CamelDefinitionApi.ts +0 -3271
  8. package/src/core/api/CamelDefinitionApiExt.ts +0 -757
  9. package/src/core/api/CamelDefinitionYaml.ts +0 -412
  10. package/src/core/api/CamelDefinitionYamlStep.ts +0 -4733
  11. package/src/core/api/CamelDisplayUtil.ts +0 -143
  12. package/src/core/api/CamelUtil.ts +0 -360
  13. package/src/core/api/ComponentApi.ts +0 -368
  14. package/src/core/api/KameletApi.ts +0 -147
  15. package/src/core/api/MainConfigurationApi.ts +0 -47
  16. package/src/core/api/ProjectModelApi.ts +0 -75
  17. package/src/core/api/SpiBeanApi.ts +0 -104
  18. package/src/core/api/TemplateApi.ts +0 -58
  19. package/src/core/api/TopologyUtils.ts +0 -392
  20. package/src/core/api/VariableUtil.ts +0 -104
  21. package/src/core/model/CamelDefinition.ts +0 -3783
  22. package/src/core/model/CamelMetadata.ts +0 -2714
  23. package/src/core/model/ComponentModels.ts +0 -106
  24. package/src/core/model/IntegrationDefinition.ts +0 -188
  25. package/src/core/model/KameletModels.ts +0 -223
  26. package/src/core/model/MainConfigurationModel.ts +0 -37
  27. package/src/core/model/ProjectModel.ts +0 -43
  28. package/src/core/model/SpiBeanModels.ts +0 -53
  29. package/src/core/model/TopologyDefinition.ts +0 -117
  30. package/test/addStep.spec.ts +0 -124
  31. package/test/addStep1.yaml +0 -27
  32. package/test/allowableValues.camel.yaml +0 -19
  33. package/test/allowableValues.spec.ts +0 -30
  34. package/test/avro-serialize-action.kamelet.yaml +0 -70
  35. package/test/beans.spec.ts +0 -92
  36. package/test/beans1.yaml +0 -36
  37. package/test/beans2.yaml +0 -42
  38. package/test/beans3.yaml +0 -7
  39. package/test/checkRequired.spec.ts +0 -53
  40. package/test/circuitBreaker.spec.ts +0 -57
  41. package/test/circuitBreaker.yaml +0 -19
  42. package/test/cloneDefinition.spec.ts +0 -106
  43. package/test/createKamelet.spec.ts +0 -38
  44. package/test/cxf.json +0 -615
  45. package/test/cxf.spec.ts +0 -44
  46. package/test/cxf.yaml +0 -15
  47. package/test/deleteStep.spec.ts +0 -74
  48. package/test/demo.spec.ts +0 -49
  49. package/test/demo.yaml +0 -32
  50. package/test/doCatchOnWhen.camel.yaml +0 -20
  51. package/test/doCatchOnWhen.spec.ts +0 -36
  52. package/test/errorHandler.spec.ts +0 -38
  53. package/test/errorHandler1.yaml +0 -27
  54. package/test/expression.spec.ts +0 -55
  55. package/test/findStep.spec.ts +0 -112
  56. package/test/findStep.yaml +0 -65
  57. package/test/getElementProperties.spec.ts +0 -32
  58. package/test/getElementPropertiesByName.spec.ts +0 -31
  59. package/test/getExpressionLanguage.spec.ts +0 -40
  60. package/test/hasElementWithId.camel.yaml +0 -98
  61. package/test/hasElementWithId.spec.ts +0 -57
  62. package/test/hasElementWithId1.camel.yaml +0 -16
  63. package/test/hasElementWithIdError.camel.yaml +0 -98
  64. package/test/integration.spec.ts +0 -60
  65. package/test/integration1.yaml +0 -24
  66. package/test/integration2.yaml +0 -23
  67. package/test/integrationToYaml.spec.ts +0 -51
  68. package/test/intercept.spec.ts +0 -62
  69. package/test/intercept.yaml +0 -19
  70. package/test/is-not-integration.yaml +0 -5114
  71. package/test/isIntegration.spec.ts +0 -45
  72. package/test/kamelet.spec.ts +0 -61
  73. package/test/metadata/components.json +0 -697
  74. package/test/metadata/kamelets.yaml +0 -23414
  75. package/test/metadata/spiBeans.json +0 -3094
  76. package/test/multiObjectProperties.spec.ts +0 -46
  77. package/test/multiObjectProperties1.yaml +0 -19
  78. package/test/multiple.spec.ts +0 -38
  79. package/test/multiple.yaml +0 -29
  80. package/test/openapi.spec.ts +0 -48
  81. package/test/openapi.yaml +0 -7
  82. package/test/placeholder.spec.ts +0 -32
  83. package/test/placeholder.yaml +0 -133
  84. package/test/plain-try-catch.yaml +0 -31
  85. package/test/plain.spec.ts +0 -72
  86. package/test/plain1.yaml +0 -22
  87. package/test/plain2.yaml +0 -13
  88. package/test/plain3.yaml +0 -5
  89. package/test/plain4.yaml +0 -5
  90. package/test/postgresql-source.kamelet.yaml +0 -113
  91. package/test/restConfigDsl.yaml +0 -15
  92. package/test/restDsl.spec.ts +0 -83
  93. package/test/restDsl.yaml +0 -29
  94. package/test/routes.spec.ts +0 -37
  95. package/test/routes1.yaml +0 -31
  96. package/test/supported-components.json +0 -1221
  97. package/test/supportedComponents.spec.ts +0 -34
  98. package/test/template1.AggregationStrategy.java +0 -21
  99. package/test/template1.Processor.java +0 -13
  100. package/test/template2.AggregationStrategy.java +0 -21
  101. package/test/template2.Processor.java +0 -13
  102. package/test/templateApi.spec.ts +0 -45
  103. package/test/timer-source.kamelet.yaml +0 -75
  104. package/test/tod.spec.ts +0 -31
  105. package/test/tod.yaml +0 -9
  106. package/test/topology.spec.ts +0 -51
  107. package/test/topology1.camel.yaml +0 -56
  108. package/test/topology2.camel.yaml +0 -44
  109. package/test/topology3.camel.yaml +0 -27
  110. package/test/tsconfig.testing.json +0 -14
  111. package/test/updateStep.spec.ts +0 -72
  112. package/test/variable1.camel.yaml +0 -42
  113. package/test/variable2.camel.yaml +0 -42
  114. package/test/variables.spec.ts +0 -34
  115. package/tsconfig.json +0 -34
@@ -1,412 +0,0 @@
1
- /*
2
- * Licensed to the Apache Software Foundation (ASF) under one or more
3
- * contributor license agreements. See the NOTICE file distributed with
4
- * this work for additional information regarding copyright ownership.
5
- * The ASF licenses this file to You under the Apache License, Version 2.0
6
- * (the "License"); you may not use this file except in compliance with
7
- * the License. You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- import * as yaml from 'js-yaml';
18
- import { Beans, CamelElement, Integration } from '../model/IntegrationDefinition';
19
- import { BeanFactoryDefinition, RouteConfigurationDefinition, RouteDefinition } from '../model/CamelDefinition';
20
- import { CamelUtil } from './CamelUtil';
21
- import { CamelDefinitionYamlStep } from './CamelDefinitionYamlStep';
22
-
23
- export class CamelDefinitionYaml {
24
- private constructor() {
25
- }
26
-
27
- static integrationToYaml = (integration: Integration): string => {
28
- const clone: any = CamelUtil.cloneIntegration(integration);
29
- const flows = integration.spec.flows;
30
- clone.spec.flows = flows
31
- ?.map((f: any) => CamelDefinitionYaml.cleanupElement(f))
32
- .filter(x => Object.keys(x).length !== 0);
33
- if (integration.type === 'crd') {
34
- delete clone.type;
35
- const i = JSON.parse(JSON.stringify(clone, (key, value) => CamelDefinitionYaml.replacer(key, value), 3)); // fix undefined in string attributes
36
- return CamelDefinitionYaml.yamlDump(i);
37
- } else if (integration.type === 'kamelet') {
38
- delete clone.type;
39
- // turn array of flows to object properties in template for Kamelet
40
- const template: any = {route: {}}
41
- const route: RouteDefinition = clone.spec.flows.filter((f: any) => f.dslName === 'RouteDefinition')?.[0];
42
- if (route) {
43
- template.route = Object.assign(template.route, route);
44
- } else if (clone.spec.template?.route) {
45
- template.route = clone.spec.template.route;
46
- } else if (clone.spec.template?.from) {
47
- template.route = {from: clone.spec.template?.from};
48
- }
49
- const from: RouteDefinition = clone.spec.flows.filter((f: any) => f.dslName === 'FromDefinition')?.[0];
50
- if (from) {
51
- template.from = {from: from};
52
- }
53
- const beans = clone.spec.flows.filter((f: any) => f.dslName === 'Beans')?.at(0)?.beans;
54
- if (beans) {
55
- template.beans = beans;
56
- } else if (clone.spec.template?.beans){
57
- template.beans = clone.spec.template.beans;
58
- }
59
- clone.spec.template = template;
60
- delete clone.spec.flows;
61
- const i = JSON.parse(JSON.stringify(clone, (key, value) => CamelDefinitionYaml.replacer(key, value, true), 3)); // fix undefined in string attributes
62
- return CamelDefinitionYaml.yamlDump(i);
63
- } else {
64
- const f = JSON.parse(
65
- JSON.stringify(clone.spec.flows, (key, value) => CamelDefinitionYaml.replacer(key, value), 3),
66
- );
67
- return CamelDefinitionYaml.yamlDump(f);
68
- }
69
- };
70
-
71
- static isEmpty = (value?: string): boolean => {
72
- return value === undefined || (value.trim && value.trim().length === 0);
73
- };
74
-
75
- static isEmptyObject(obj: any): boolean {
76
- // Check if it's an object and not null
77
- if (obj && typeof obj === 'object') {
78
- // Get all enumerable property names
79
- const keys = Object.keys(obj);
80
- // Get all non-enumerable property names
81
- const nonEnumProps = Object.getOwnPropertyNames(obj);
82
- // Check if there are no properties
83
- return keys.length === 0 && nonEnumProps.length === 0;
84
- }
85
- return false;
86
- }
87
-
88
-
89
- static cleanupElement = (element: CamelElement, inArray?: boolean, inSteps?: boolean): CamelElement => {
90
- const result: any = {};
91
- const object: any = { ...element };
92
-
93
- if (inArray) {
94
- object.inArray = inArray;
95
- object.inSteps = !!inSteps;
96
- }
97
-
98
- if (object.dslName.endsWith('Expression')) {
99
- delete object.language;
100
- delete object.expressionName;
101
- } else if (object.dslName.endsWith('DataFormat')) {
102
- delete object.dataFormatName;
103
- } else if (object.dslName === 'BeanFactoryDefinition') {
104
- if (object.properties && Object.keys(object.properties).length === 0) {
105
- delete object.properties;
106
- }
107
- if (object.constructors && CamelDefinitionYaml.isEmptyObject(object.constructors)) {
108
- delete object.constructors;
109
- }
110
- } else if (object.dslName === 'CatchDefinition' && object?.onWhen?.stepName !== undefined) {
111
- object.onWhen.stepName = 'onWhen'; // https://github.com/apache/camel-karavan/issues/1420
112
- }
113
-
114
- delete object.uuid;
115
- delete object.showChildren;
116
-
117
- for (const [key, value] of Object.entries(object) as [string, any][]) {
118
- if (value instanceof CamelElement || (typeof value === 'object' && value?.dslName)) {
119
- result[key] = CamelDefinitionYaml.cleanupElement(value);
120
- } else if (Array.isArray(value)) {
121
- if (value.length > 0) {
122
- result[key] = CamelDefinitionYaml.cleanupElements(value, key === 'steps');
123
- }
124
- } else if (key === 'parameters' && typeof value === 'object') {
125
- const parameters = Object.entries(value || {})
126
- .filter(([_, v]: [string, any]) => !CamelDefinitionYaml.isEmpty(v))
127
- .reduce((x: any, [k, v]) => ({ ...x, [k]: v }), {});
128
- if (Object.keys(parameters).length > 0) {
129
- result[key] = parameters;
130
- }
131
- } else {
132
- if (!CamelDefinitionYaml.isEmpty(value)) {
133
- result[key] = value;
134
- }
135
- }
136
- }
137
- return result as CamelElement;
138
- };
139
-
140
- static cleanupElements = (elements: CamelElement[], inSteps?: boolean): CamelElement[] => {
141
- const result: any[] = [];
142
- for (const element of elements) {
143
- if (typeof element === 'object') {
144
- result.push(CamelDefinitionYaml.cleanupElement(element, true, inSteps));
145
- } else {
146
- result.push(element);
147
- }
148
- }
149
- return result;
150
- };
151
-
152
- static yamlDump = (integration: any): string => {
153
- return yaml.dump(integration, {
154
- noRefs: false,
155
- noArrayIndent: false,
156
- // forceQuotes: true,
157
- quotingType: '"',
158
- sortKeys: function(a: any, b: any) {
159
- if (a === 'steps') return 1;
160
- else if (b === 'steps') return -1;
161
- else return 0;
162
- },
163
- });
164
- };
165
-
166
- static replacer = (key: string, value: any, isKamelet: boolean = false): any => {
167
- if (
168
- typeof value === 'object' &&
169
- (value.hasOwnProperty('stepName') || value.hasOwnProperty('inArray') || value.hasOwnProperty('inSteps'))
170
- ) {
171
- const stepNameField = value.hasOwnProperty('stepName') ? 'stepName' : 'step-name';
172
- const stepName = value[stepNameField];
173
- const dslName = value.dslName;
174
- let newValue: any = JSON.parse(JSON.stringify(value));
175
- delete newValue.dslName;
176
- delete newValue[stepNameField];
177
-
178
- if (
179
- value.inArray &&
180
- !value.inSteps &&
181
- ['intercept', 'interceptFrom', 'interceptSendToEndpoint', 'onCompletion', 'onException'].includes(
182
- stepName,
183
- )
184
- ) {
185
- delete newValue.inArray;
186
- delete newValue.inSteps;
187
- const xValue: any = {};
188
- xValue[stepName] = newValue;
189
- return xValue;
190
- } else if (
191
- (value.inArray && !value.inSteps) ||
192
- dslName === 'ExpressionSubElementDefinition' ||
193
- dslName === 'ExpressionDefinition' ||
194
- dslName?.endsWith('Expression') ||
195
- stepName === 'otherwise' ||
196
- stepName === 'doFinally' ||
197
- stepName === 'resilience4jConfiguration' ||
198
- stepName === 'faultToleranceConfiguration' ||
199
- stepName === 'errorHandler' ||
200
- stepName === 'onWhen' || // https://github.com/apache/camel-karavan/issues/1420
201
- stepName === 'deadLetterChannel' ||
202
- stepName === 'defaultErrorHandler' ||
203
- stepName === 'jtaTransactionErrorHandler' ||
204
- stepName === 'noErrorHandler' ||
205
- stepName === 'springTransactionErrorHandler' ||
206
- stepName === 'redeliveryPolicy' ||
207
- stepName === 'securityDefinitions' ||
208
- stepName === 'apiKey' ||
209
- stepName === 'basicAuth' ||
210
- stepName === 'bearer' ||
211
- stepName === 'mutualTls' ||
212
- stepName === 'oauth2' ||
213
- stepName === 'openIdConnect' ||
214
- stepName === 'openApi' ||
215
- key === 'from'
216
- ) {
217
- delete newValue.inArray;
218
- delete newValue.inSteps;
219
- return newValue;
220
- } else if (isKamelet && dslName === 'RouteDefinition') {
221
- delete value?.dslName;
222
- delete value?.stepName;
223
- return value;
224
- } else {
225
- delete newValue.inArray;
226
- delete newValue.inSteps;
227
- const xValue: any = {};
228
- xValue[stepName] = newValue;
229
- return xValue;
230
- }
231
- } else {
232
- delete value?.dslName;
233
- return value;
234
- }
235
- };
236
-
237
- static yamlToIntegration = (filename: string, text: string): Integration => {
238
- const integration: Integration = Integration.createNew(filename);
239
- const fromYaml: any = yaml.load(text);
240
- const camelized: any = CamelUtil.camelizeObject(fromYaml);
241
- if (camelized?.apiVersion && camelized.apiVersion.startsWith('camel.apache.org') && camelized.kind) {
242
- if (camelized?.metadata) {
243
- integration.metadata = camelized?.metadata;
244
- }
245
- if (camelized?.spec) {
246
- integration.spec.definition = camelized?.spec.definition;
247
- integration.spec.dependencies = camelized?.spec.dependencies;
248
- integration.spec.types = camelized?.spec.types;
249
- }
250
- const int: Integration = new Integration({ ...camelized });
251
- if (camelized.kind === 'Integration') {
252
- integration.type = 'crd';
253
- integration.spec.flows?.push(...CamelDefinitionYaml.flowsToCamelElements(int.spec.flows || []));
254
- } else if (camelized.kind === 'Kamelet') {
255
- integration.type = 'kamelet';
256
- integration.kind = 'Kamelet';
257
- const flows: any[] = [];
258
- // turn kamelet template object properties to array of flows
259
- const beans = int.spec.template?.beans;
260
- if (beans) {
261
- flows.push(new Beans({beans: beans}))
262
- }
263
- const from = int.spec.template?.from;
264
- if (from) {
265
- flows.push(new RouteDefinition({from: from}))
266
- } else {
267
- const route = int.spec.template?.route;
268
- flows.push(route);
269
- }
270
- integration.spec.flows?.push(...CamelDefinitionYaml.flowsToCamelElements(flows || []));
271
- }
272
- } else if (Array.isArray(camelized)) {
273
- integration.type = 'plain';
274
- const flows: any[] = camelized;
275
- integration.spec.flows?.push(...CamelDefinitionYaml.flowsToCamelElements(flows));
276
- }
277
- return integration;
278
- };
279
-
280
- static yamlIsIntegration = (text: string): 'crd' | 'plain' | 'kamelet' | 'none' => {
281
- try {
282
- const fromYaml: any = yaml.load(text);
283
- const camelized: any = CamelUtil.camelizeObject(fromYaml);
284
- if (camelized?.apiVersion && camelized.apiVersion.startsWith('camel.apache.org') && camelized.kind) {
285
- if (camelized.kind === 'Integration') {
286
- return 'crd';
287
- } else if (camelized.kind === 'Kamelet') {
288
- return 'kamelet';
289
- }
290
- } else if (Array.isArray(camelized)) {
291
- return 'plain';
292
- } else {
293
- return 'none';
294
- }
295
- } catch (e) {
296
- }
297
- return 'none';
298
- };
299
- static flowsToCamelElements = (flows: any[]): any[] => {
300
- const result: any[] = [];
301
- flows.filter((e: any) => e.hasOwnProperty('restConfiguration'))
302
- .forEach((f: any) => result.push(CamelDefinitionYamlStep.readRestConfigurationDefinition(f.restConfiguration)));
303
- flows.filter((e: any) => e.hasOwnProperty('rest'))
304
- .forEach((f: any) => result.push(CamelDefinitionYamlStep.readRestDefinition(f.rest)));
305
- flows.filter((e: any) => e.hasOwnProperty('route'))
306
- .forEach((f: any) => result.push(CamelDefinitionYamlStep.readRouteDefinition(f.route)));
307
- flows.filter((e: any) => e.hasOwnProperty('from'))
308
- .forEach((f: any) => result.push(CamelDefinitionYamlStep.readRouteDefinition(new RouteDefinition({from: f.from}))));
309
- flows.filter((e: any) => e.hasOwnProperty('beans'))
310
- .forEach((b: any) => result.push(CamelDefinitionYaml.readBeanDefinition(b)));
311
- flows.filter((e: any) => e.hasOwnProperty('routeConfiguration'))
312
- .forEach((e: any) => result.push(CamelDefinitionYamlStep.readRouteConfigurationDefinition(e.routeConfiguration)));
313
- flows.filter((e: any) => e.hasOwnProperty('errorHandler'))
314
- .forEach((f: any) => result.push(CamelDefinitionYamlStep.readRouteConfigurationDefinition(new RouteConfigurationDefinition({errorHandler: f.errorHandler}))));
315
- flows.filter((e: any) => e.hasOwnProperty('onException'))
316
- .forEach((f: any) => result.push(CamelDefinitionYamlStep.readRouteConfigurationDefinition(new RouteConfigurationDefinition({onException: f.onException}))));
317
- flows.filter((e: any) => e.hasOwnProperty('intercept'))
318
- .forEach((f: any) => result.push(CamelDefinitionYamlStep.readRouteConfigurationDefinition(new RouteConfigurationDefinition({intercept: f.intercept}))));
319
- flows.filter((e: any) => e.hasOwnProperty('interceptFrom'))
320
- .forEach((f: any) => result.push(CamelDefinitionYamlStep.readRouteConfigurationDefinition(new RouteConfigurationDefinition({interceptFrom: f.interceptFrom}))));
321
- flows.filter((e: any) => e.hasOwnProperty('interceptSendToEndpoint'))
322
- .forEach((f: any) => result.push(CamelDefinitionYamlStep.readRouteConfigurationDefinition(new RouteConfigurationDefinition({interceptSendToEndpoint: f.interceptSendToEndpoint}))));
323
- flows.filter((e: any) => e.hasOwnProperty('onCompletion'))
324
- .forEach((f: any) => result.push(CamelDefinitionYamlStep.readRouteConfigurationDefinition(new RouteConfigurationDefinition({onCompletion: f.onCompletion}))));
325
-
326
- return result;
327
- };
328
-
329
- static readBeanDefinition = (beans: any): Beans => {
330
- const result: Beans = new Beans();
331
- for (const bean of beans.beans) {
332
- const props: any = {};
333
- if (bean && bean.properties) {
334
- // convert map style to properties if requires
335
- for (const [key, value] of Object.entries(bean.properties)) {
336
- CamelDefinitionYaml.flatMapProperty(key, value, new Map<string, any>()).forEach(
337
- (v, k) => (props[k] = v),
338
- );
339
- }
340
- }
341
- if (bean && bean.property && Array.isArray(bean.property)) {
342
- // convert map style to properties if requires
343
- Array.from(bean.property).forEach((val: any) => {
344
- props[val.key] = val.value;
345
- })
346
- delete bean.property;
347
- }
348
- bean.properties = props;
349
- result.beans.push(new BeanFactoryDefinition(bean));
350
- }
351
- return result;
352
- };
353
-
354
- // convert map style to properties if requires
355
- static flatMapProperty = (key: string, value: any, properties: Map<string, any>): Map<string, any> => {
356
- if (value === undefined) {
357
- return properties;
358
- }
359
-
360
- if (typeof value === 'object') {
361
- for (const k in value) {
362
- const key2 = key + '.' + k;
363
- const value2: any = value[k];
364
- CamelDefinitionYaml.flatMapProperty(key2, value2, new Map<string, any>()).forEach((value1, key1) =>
365
- properties.set(key1, value1),
366
- );
367
- }
368
- } else {
369
- properties.set(key, value);
370
- }
371
- return properties;
372
- };
373
-
374
- // add generated Integration YAML into existing Integration YAML
375
- static addYamlToIntegrationYaml = (
376
- filename: string,
377
- camelYaml: string | undefined,
378
- restYaml: string,
379
- addREST: boolean,
380
- addRoutes: boolean,
381
- ): string => {
382
- const existing =
383
- camelYaml !== undefined
384
- ? CamelDefinitionYaml.yamlToIntegration(filename, camelYaml)
385
- : Integration.createNew(filename);
386
- const generated = CamelDefinitionYaml.yamlToIntegration(filename, restYaml);
387
-
388
- const flows: CamelElement[] =
389
- existing.spec.flows?.filter(f => !['RouteDefinition', 'RestDefinition'].includes(f.dslName)) || [];
390
-
391
- const restE: CamelElement[] = existing.spec.flows?.filter(f => f.dslName === 'RestDefinition') || [];
392
- const restG: CamelElement[] = generated.spec.flows?.filter(f => f.dslName === 'RestDefinition') || [];
393
-
394
- if (addREST) {
395
- flows.push(...restG);
396
- } else {
397
- flows.push(...restE);
398
- }
399
-
400
- const routeE: CamelElement[] = existing.spec.flows?.filter(f => f.dslName === 'RouteDefinition') || [];
401
- const routeG: CamelElement[] = generated.spec.flows?.filter(f => f.dslName === 'RouteDefinition') || [];
402
-
403
- if (addRoutes) {
404
- flows.push(...routeG);
405
- } else {
406
- flows.push(...routeE);
407
- }
408
-
409
- existing.spec.flows = flows;
410
- return CamelDefinitionYaml.integrationToYaml(existing);
411
- };
412
- }