diff --git a/examples/base64png-editor-vscode-extension/package.json b/examples/base64png-editor-vscode-extension/package.json index 0e70e043272..6155b482575 100644 --- a/examples/base64png-editor-vscode-extension/package.json +++ b/examples/base64png-editor-vscode-extension/package.json @@ -23,7 +23,6 @@ "watch": "export WEBPACK__sourceMaps=true; WEBPACK__minimize=false; webpack --env dev" }, "dependencies": { - "@kie-tools-core/backend": "workspace:*", "@kie-tools-core/editor": "workspace:*", "@kie-tools-core/i18n": "workspace:*", "@kie-tools-core/patternfly-base": "workspace:*", diff --git a/examples/base64png-editor-vscode-extension/src/extension.ts b/examples/base64png-editor-vscode-extension/src/extension.ts index 93e2dccc967..46efb46d375 100644 --- a/examples/base64png-editor-vscode-extension/src/extension.ts +++ b/examples/base64png-editor-vscode-extension/src/extension.ts @@ -19,21 +19,13 @@ import * as vscode from "vscode"; import * as KogitoVsCode from "@kie-tools-core/vscode-extension"; -import { VsCodeBackendProxy } from "@kie-tools-core/backend/dist/vscode"; -import { I18n } from "@kie-tools-core/i18n/dist/core"; -import { backendI18nDefaults, backendI18nDictionaries } from "@kie-tools-core/backend/dist/i18n"; import * as path from "path"; import * as fs from "fs"; import { EditorEnvelopeLocator, EnvelopeContentType, EnvelopeMapping } from "@kie-tools-core/editor/dist/api"; -let backendProxy: VsCodeBackendProxy; - export function activate(context: vscode.ExtensionContext) { console.info("Extension is alive."); - const backendI18n = new I18n(backendI18nDefaults, backendI18nDictionaries, vscode.env.language); - backendProxy = new VsCodeBackendProxy(context, backendI18n); - /** * Starts the extension and set initial properties: * @@ -58,7 +50,6 @@ export function activate(context: vscode.ExtensionContext) { envelopeContent: { type: EnvelopeContentType.PATH, path: "dist/envelope/index.js" }, }), ]), - backendProxy: backendProxy, }); /** @@ -92,5 +83,4 @@ export function activate(context: vscode.ExtensionContext) { export function deactivate() { console.info("Extension is deactivating"); - backendProxy?.stopServices(); } diff --git a/packages/backend/LICENSE b/packages/backend/LICENSE deleted file mode 100644 index 261eeb9e9f8..00000000000 --- a/packages/backend/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/backend/README.md b/packages/backend/README.md deleted file mode 100644 index 0a65c0e8f01..00000000000 --- a/packages/backend/README.md +++ /dev/null @@ -1,44 +0,0 @@ - - -Apache KIE Tools Backend API - ---- - -Apache KIE (incubating) is an effort undergoing incubation at The Apache Software -Foundation (ASF), sponsored by the name of Apache Incubator. Incubation is -required of all newly accepted projects until a further review indicates that -the infrastructure, communications, and decision making process have stabilized -in a manner consistent with other successful ASF projects. While incubation -status is not necessarily a reflection of the completeness or stability of the -code, it does indicate that the project has yet to be fully endorsed by the ASF. - -Some of the incubating project’s releases may not be fully compliant with ASF -policy. For example, releases may have incomplete or un-reviewed licensing -conditions. What follows is a list of known issues the project is currently -aware of (note that this list, by definition, is likely to be incomplete): - -- Hibernate, an LGPL project, is being used. Hibernate is in the process of - relicensing to ASL v2 -- Some files, particularly test files, and those not supporting comments, may - be missing the ASF Licensing Header - -If you are planning to incorporate this work into your product/project, please -be aware that you will need to conduct a thorough licensing review to determine -the overall implications of including this work. For the current status of this -project through the Apache Incubator visit: -https://incubator.apache.org/projects/kie.html diff --git a/packages/backend/env/index.js b/packages/backend/env/index.js deleted file mode 100644 index 61bc742bd66..00000000000 --- a/packages/backend/env/index.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -const { varsWithName, composeEnv } = require("@kie-tools-scripts/build-env"); - -module.exports = composeEnv([require("@kie-tools/root-env/env")], { - vars: varsWithName({}), - get env() { - return {}; - }, -}); diff --git a/packages/backend/jest.config.js b/packages/backend/jest.config.js deleted file mode 100644 index e26a965fbbf..00000000000 --- a/packages/backend/jest.config.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -const { config, typescriptTransform } = require("@kie-tools/jest-base/jest.config"); - -/** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { - ...config, - testEnvironment: "node", - transform: { - ...typescriptTransform, - }, -}; diff --git a/packages/backend/package.json b/packages/backend/package.json deleted file mode 100644 index 792009c6f83..00000000000 --- a/packages/backend/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "@kie-tools-core/backend", - "version": "0.0.0", - "description": "", - "license": "Apache-2.0", - "keywords": [], - "homepage": "https://github.com/apache/incubator-kie-tools", - "repository": { - "type": "git", - "url": "https://github.com/apache/incubator-kie-tools.git" - }, - "bugs": { - "url": "https://github.com/apache/incubator-kie-tools/issues" - }, - "files": [ - "dist", - "src" - ], - "scripts": { - "build:dev": "rimraf dist && tsc -p tsconfig.json", - "build:prod": "pnpm lint && rimraf dist && tsc -p tsconfig.json && pnpm test", - "lint": "run-script-if --bool \"$(build-env linters.run)\" --then \"kie-tools--eslint ./src\"", - "test": "run-script-if --ignore-errors \"$(build-env tests.ignoreFailures)\" --bool \"$(build-env tests.run)\" --then \"jest --silent --verbose --passWithNoTests\"" - }, - "dependencies": { - "@kie-tools-core/i18n": "workspace:*", - "@kie-tools-core/notifications": "workspace:*", - "@kie-tools-core/workspace": "workspace:*", - "axios": "^1.7.4", - "fast-xml-parser": "^4.4.1", - "portfinder": "^1.0.32", - "semver": "^7.5.4", - "sinon": "^11.1.1" - }, - "devDependencies": { - "@babel/core": "^7.16.0", - "@babel/preset-env": "^7.16.0", - "@babel/preset-react": "^7.16.0", - "@kie-tools/eslint": "workspace:*", - "@kie-tools/jest-base": "workspace:*", - "@kie-tools/root-env": "workspace:*", - "@kie-tools/tsconfig": "workspace:*", - "@types/jest": "^29.5.12", - "@types/jest-when": "^3.5.5", - "@types/semver": "^7.5.2", - "@types/sinon": "^10.0.2", - "@types/vscode": "1.67.0", - "jest": "^29.7.0", - "jest-junit": "^16.0.0", - "jest-when": "^3.6.0", - "rimraf": "^3.0.2", - "stream": "^0.0.2", - "ts-jest": "^29.1.5", - "typescript": "^5.5.3" - } -} diff --git a/packages/backend/src/api/core/BackendManagerService.ts b/packages/backend/src/api/core/BackendManagerService.ts deleted file mode 100644 index a33e22d9afa..00000000000 --- a/packages/backend/src/api/core/BackendManagerService.ts +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { HttpBridge, HttpService, LocalHttpServer, LocalHttpService } from ".."; -import { Service } from "./Service"; - -/** - * Service responsible for managing all backend services. - */ -export class BackendManagerService implements Service { - private readonly serviceRegistry: Map = new Map(); - - /** - * @param args.bridge Service bridge. Required to start up HTTP services. - * @param args.localHttpServer Local HTTP server. Required to start up local HTTP services. - * @param args.bootstrapServices Services that should be started up along with the backend manager. - * @param args.lazyServices Services that should be started upon the first usage. - */ - public constructor( - private readonly args: { - bridge?: HttpBridge; - localHttpServer?: LocalHttpServer; - bootstrapServices?: Service[]; - lazyServices?: Service[]; - } - ) {} - - public identify(): string { - return "BACKEND_MANAGER"; - } - - public async start(): Promise { - if (this.args.localHttpServer) { - await this.registerService(this.args.localHttpServer); - } - - if (!this.args.bootstrapServices || this.args.bootstrapServices.length === 0) { - return; - } - - for (const service of this.args.bootstrapServices) { - await this.registerService(service); - } - } - - public stop(): void { - this.serviceRegistry.forEach((service) => service.stop()); - this.serviceRegistry.clear(); - } - - public async satisfyRequirements(): Promise { - return true; - } - - /** - * Register and start up a new service. - * @param service Service to be registered. - * @returns True if registration succeeded otherwise false. - */ - public async registerService(service: Service): Promise { - if (this.serviceRegistry.has(service.identify())) { - return true; - } - - if (!(await service.satisfyRequirements())) { - console.warn(`Could not satisfy requirements for service ${service.identify()}. Skipping registration.`); - return false; - } - - try { - await service.start(); - - if (service instanceof HttpService) { - if (!this.args.bridge) { - console.warn(`Could not register an HTTP service (${service.identify()}) without having an HTTP bridge.`); - return false; - } - service.registerHttpBridge(this.args.bridge); - } - - if (service instanceof LocalHttpService) { - if (!this.args.localHttpServer || !this.serviceRegistry.get(this.args.localHttpServer.identify())) { - console.warn( - `Could not register a local HTTP service (${service.identify()}) without having a local server registered.` - ); - return false; - } - service.registerPort(this.args.localHttpServer.getPort()); - } - - this.serviceRegistry.set(service.identify(), service); - return true; - } catch (e) { - console.error(`An error has occurred while starting ${service.identify()} up: ${e}`); - return false; - } - } - - /** - * Look up for a service from the registry by its identifier. - * @param id The identifier of the service. - * @returns The required service if it is registered otherwise undefined. - */ - public async getService(id: string): Promise { - const registeredService = this.serviceRegistry.get(id); - - if (registeredService) { - return registeredService as T; - } - - if (!this.args.lazyServices || this.args.lazyServices.length === 0) { - return; - } - - const lazyService = this.args.lazyServices.find((s) => s.identify() === id); - - if (!lazyService || !(await this.registerService(lazyService))) { - return; - } - - return lazyService as T; - } -} diff --git a/packages/backend/src/api/core/BackendProxy.ts b/packages/backend/src/api/core/BackendProxy.ts deleted file mode 100644 index 4906cbb64e7..00000000000 --- a/packages/backend/src/api/core/BackendProxy.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { BackendManagerService } from "./BackendManagerService"; -import { Capability } from "./Capability"; -import { CapabilityResponse } from "./CapabilityResponse"; - -/** - * Expose all relevant methods for clients accessing backend services. - */ -export class BackendProxy { - protected backendManager: BackendManagerService | undefined; - - /** - * Register the backend manager. - * @param backendManager The backend manager - */ - public registerBackendManager(backendManager: BackendManagerService) { - this.backendManager = backendManager; - } - - /** - * Execute the given callback if the capability is resolved otherwise reject the promise. - * @param serviceId Id of the service associated with the capability. - * @param consumer Consumer to run. - */ - public async withCapability( - serviceId: string, - consumer: (capability: T) => Promise> - ): Promise> { - if (!this.backendManager) { - return CapabilityResponse.missingInfra(); - } - - const service = await this.backendManager.getService(serviceId); - - if (!service) { - return CapabilityResponse.notAvailable(`Service ${serviceId} not available.`); - } - - return consumer(service as Capability as T); - } - - /** - * Stop all backend services through backend manager. - */ - public stopServices(): void { - if (!this.backendManager) { - return; - } - this.backendManager.stop(); - } -} diff --git a/packages/backend/src/api/core/Capability.ts b/packages/backend/src/api/core/Capability.ts deleted file mode 100644 index b4344740817..00000000000 --- a/packages/backend/src/api/core/Capability.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Base interface for all capabilities. - */ -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface Capability {} diff --git a/packages/backend/src/api/core/CapabilityResponse.ts b/packages/backend/src/api/core/CapabilityResponse.ts deleted file mode 100644 index 7127efcc746..00000000000 --- a/packages/backend/src/api/core/CapabilityResponse.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { CapabilityResponseStatus } from "./CapabilityResponseStatus"; - -/** - * Arguments to build a capability response. - */ -interface CapabilityResponseArgs { - status: CapabilityResponseStatus; - body?: T; - message?: string; -} - -/** - * Wrapper object for capability responses. - */ -export class CapabilityResponse { - public readonly status: CapabilityResponseStatus; - public readonly body?: T; - public readonly message?: string; - public constructor(args: CapabilityResponseArgs) { - this.status = args.status; - this.body = args.body; - this.message = args.message; - } - - /** - * Utility to create a response with OK status and optional body. - * @param body Optional body that the response can include. - * @returns A capability response with OK status. - */ - public static ok(body?: U): CapabilityResponse { - return new CapabilityResponse({ status: CapabilityResponseStatus.OK, body: body }); - } - - /** - * Utility to create a response with NOT_AVAILABLE status and message. - * @param message Message associated with the unavailability of the capability. - * @returns A capability response with NOT_AVAILABLE status. - */ - public static notAvailable(message: string): CapabilityResponse { - return new CapabilityResponse({ status: CapabilityResponseStatus.NOT_AVAILABLE, message: message }); - } - - /** - * Utility to create a response with MISSING_INFRA status. - * @returns A capability response with MISSING_INFRA status. - */ - public static missingInfra(): CapabilityResponse { - return new CapabilityResponse({ status: CapabilityResponseStatus.MISSING_INFRA }); - } -} diff --git a/packages/backend/src/api/core/CapabilityResponseStatus.ts b/packages/backend/src/api/core/CapabilityResponseStatus.ts deleted file mode 100644 index a25d477754b..00000000000 --- a/packages/backend/src/api/core/CapabilityResponseStatus.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Available status for capability responses. - */ -export enum CapabilityResponseStatus { - /** - * Response completed. - */ - OK = "OK", - - /** - * Infrastructure for capabilities is not available. - */ - MISSING_INFRA = "MISSING_INFRA", - - /** - * Requested capability could not be resolved. - */ - NOT_AVAILABLE = "NOT_AVAILABLE", -} diff --git a/packages/backend/src/api/core/Service.ts b/packages/backend/src/api/core/Service.ts deleted file mode 100644 index 3651dac86c7..00000000000 --- a/packages/backend/src/api/core/Service.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * A service that has an identity and lifecycle methods. - */ -export interface Service { - /** - * Inform the identity of the service. - */ - identify(): string; - - /** - * Start the service. - */ - start(): Promise; - - /** - * Stop the service. - */ - stop(): void; - - /** - * Check whether all requirements are met or not before starting the service up. - */ - satisfyRequirements(): Promise; -} diff --git a/packages/backend/src/api/core/index.ts b/packages/backend/src/api/core/index.ts deleted file mode 100644 index 8bc571c31b0..00000000000 --- a/packages/backend/src/api/core/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export { BackendManagerService } from "./BackendManagerService"; -export { BackendProxy } from "./BackendProxy"; -export { Capability } from "./Capability"; -export { CapabilityResponse } from "./CapabilityResponse"; -export { CapabilityResponseStatus } from "./CapabilityResponseStatus"; -export { Service } from "./Service"; diff --git a/packages/backend/src/api/http/HttpBridge.ts b/packages/backend/src/api/http/HttpBridge.ts deleted file mode 100644 index 109f44df506..00000000000 --- a/packages/backend/src/api/http/HttpBridge.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { HttpRequest } from "./HttpRequest"; -import { HttpResponse } from "./HttpResponse"; - -/** - * Bridge between channels and external services accessed through HTTP. - */ -export interface HttpBridge { - /** - * Perform a request to a server and return a response. - * @param request The request to the server - * @returns The response associated with the request. - */ - request(request: HttpRequest): Promise; -} diff --git a/packages/backend/src/api/http/HttpRequest.ts b/packages/backend/src/api/http/HttpRequest.ts deleted file mode 100644 index f16540684c0..00000000000 --- a/packages/backend/src/api/http/HttpRequest.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Represent an HTTP request. - */ -export interface HttpRequest { - /** - * The endpoint to send the request. - */ - endpoint: string; - /** - * Optional body request. - */ - body?: any; -} diff --git a/packages/backend/src/api/http/HttpResponse.ts b/packages/backend/src/api/http/HttpResponse.ts deleted file mode 100644 index 9c07f30fdbe..00000000000 --- a/packages/backend/src/api/http/HttpResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Represent an HTTP response. - */ -export interface HttpResponse { - /** - * Optional body response. - */ - body?: any; -} diff --git a/packages/backend/src/api/http/HttpService.ts b/packages/backend/src/api/http/HttpService.ts deleted file mode 100644 index dabdf911be2..00000000000 --- a/packages/backend/src/api/http/HttpService.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { Service } from ".."; -import { HttpBridge } from "./HttpBridge"; -import { HttpResponse } from "./HttpResponse"; - -/** - * A service that makes HTTP requests. - */ -export abstract class HttpService implements Service { - private bridge: HttpBridge | undefined; - - public abstract identify(): string; - - public async start(): Promise { - /* Nothing to do here as default implementation */ - } - - public stop(): void { - /* Nothing to do here as default implementation */ - } - - public async satisfyRequirements(): Promise { - return true; - } - - /** - * Register the HTTP bridge to be used when making requests. - * @param bridge The HTTP bridge. - */ - public registerHttpBridge(bridge: HttpBridge): void { - this.bridge = bridge; - } - - /** - * Execute a request. - * @param endpoint Full path endpoint. - * @param body Optional request body. - * @returns The Http response. - */ - public execute(endpoint: string, body?: any): Promise { - if (!this.bridge) { - return Promise.reject("Service bridge is not registered."); - } - return this.bridge.request({ endpoint: endpoint, body: body }); - } -} diff --git a/packages/backend/src/api/http/LocalHttpServer.ts b/packages/backend/src/api/http/LocalHttpServer.ts deleted file mode 100644 index 6e618eba63c..00000000000 --- a/packages/backend/src/api/http/LocalHttpServer.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { Service } from ".."; - -/** - * A service that controls a local HTTP server. - */ -export abstract class LocalHttpServer implements Service { - /** - * Port number of the local http server. - */ - protected port: number; - - /** - * Inform the registered port. - */ - public getPort(): number { - return this.port; - } - - public abstract identify(): string; - - public abstract start(): Promise; - - public abstract stop(): void; - - public abstract satisfyRequirements(): Promise; -} diff --git a/packages/backend/src/api/http/LocalHttpService.ts b/packages/backend/src/api/http/LocalHttpService.ts deleted file mode 100644 index abd4e4d8207..00000000000 --- a/packages/backend/src/api/http/LocalHttpService.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { HttpResponse } from "./HttpResponse"; -import { HttpService } from "./HttpService"; - -/** - * A service that makes local HTTP requests. - */ -export abstract class LocalHttpService extends HttpService { - private readonly hostname = "http://localhost"; - private port: number | undefined; - - /** - * Register the local HTTP port to use when making requests. - * @param port The port to be accessed. - */ - public registerPort(port: number): void { - this.port = port; - } - - /** - * Execute a local request. - * @param path Path of the local endpoint. - * @param body Optional request body. - * @returns The Http response. - */ - public execute(path: string, body?: any): Promise { - if (!this.port) { - return Promise.reject("Local port not registered."); - } - return super.execute(`${this.hostname}:${this.port}${path}`, body); - } -} diff --git a/packages/backend/src/api/http/index.ts b/packages/backend/src/api/http/index.ts deleted file mode 100644 index a6fe6a346e6..00000000000 --- a/packages/backend/src/api/http/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export { HttpBridge } from "./HttpBridge"; -export { HttpRequest } from "./HttpRequest"; -export { HttpResponse } from "./HttpResponse"; -export { HttpService } from "./HttpService"; -export { LocalHttpServer } from "./LocalHttpServer"; -export { LocalHttpService } from "./LocalHttpService"; diff --git a/packages/backend/src/api/index.ts b/packages/backend/src/api/index.ts deleted file mode 100644 index 757c0c8aec5..00000000000 --- a/packages/backend/src/api/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export * from "./core"; -export * from "./http"; diff --git a/packages/backend/src/channel-api/ServiceId.ts b/packages/backend/src/channel-api/ServiceId.ts deleted file mode 100644 index a2b36e1697b..00000000000 --- a/packages/backend/src/channel-api/ServiceId.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Identification of services. - */ -export enum ServiceId { - TEST_SCENARIO_RUNNER = "TEST_SCENARIO_RUNNER", -} diff --git a/packages/backend/src/channel-api/capability/CapabilityChannelApi.ts b/packages/backend/src/channel-api/capability/CapabilityChannelApi.ts deleted file mode 100644 index 33d3b87456f..00000000000 --- a/packages/backend/src/channel-api/capability/CapabilityChannelApi.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface CapabilityChannelApi { - // receive_xxx methods go here. -} diff --git a/packages/backend/src/channel-api/capability/index.ts b/packages/backend/src/channel-api/capability/index.ts deleted file mode 100644 index 2922f5e6e26..00000000000 --- a/packages/backend/src/channel-api/capability/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export { CapabilityChannelApi } from "./CapabilityChannelApi"; -export * from "./testScenarioRunner"; diff --git a/packages/backend/src/channel-api/capability/testScenarioRunner/TestResult.ts b/packages/backend/src/channel-api/capability/testScenarioRunner/TestResult.ts deleted file mode 100644 index c0be0ffcfbb..00000000000 --- a/packages/backend/src/channel-api/capability/testScenarioRunner/TestResult.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export interface TestResult { - /** - * Path of the result file. - */ - filePath: string; - /** - * Number of tests. - */ - tests: number; - /** - * Number of errors. - */ - errors: number; - /** - * Number of skipped. - */ - skipped: number; - /** - * Number of failures. - */ - failures: number; -} diff --git a/packages/backend/src/channel-api/capability/testScenarioRunner/TestScenarioRunnerCapability.ts b/packages/backend/src/channel-api/capability/testScenarioRunner/TestScenarioRunnerCapability.ts deleted file mode 100644 index 91a2fcf6f39..00000000000 --- a/packages/backend/src/channel-api/capability/testScenarioRunner/TestScenarioRunnerCapability.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { Capability, CapabilityResponse } from "../../../api"; -import { TestResult } from "./TestResult"; - -/** - * Capability for running test scenarios. - */ -export interface TestScenarioRunnerCapability extends Capability { - /** - * Execute a `mvn clean test` on the given `baseDir` and report back the result. - * @param baseDir Directory path where the `pom.xml` file is located. - * @param runnerClass Fully qualified class name of the runner, e.g. `testscenario.KogitoScenarioJunitActivatorTest`. - * @returns Test result. - */ - execute(baseDir: string, runnerClass: string): Promise>; - - /** - * Stop the current active execution, if any. - */ - stopActiveExecution(): void; -} diff --git a/packages/backend/src/channel-api/capability/testScenarioRunner/index.ts b/packages/backend/src/channel-api/capability/testScenarioRunner/index.ts deleted file mode 100644 index 6ca7db4a002..00000000000 --- a/packages/backend/src/channel-api/capability/testScenarioRunner/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export { TestResult } from "./TestResult"; -export { TestScenarioRunnerCapability } from "./TestScenarioRunnerCapability"; diff --git a/packages/backend/src/channel-api/extension/BackendExtensionApi.ts b/packages/backend/src/channel-api/extension/BackendExtensionApi.ts deleted file mode 100644 index 458415d3d09..00000000000 --- a/packages/backend/src/channel-api/extension/BackendExtensionApi.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { BackendManagerService } from "../../api"; - -/** - * Backend API exposed by an extension. - */ -export interface BackendExtensionApi { - backendManager: BackendManagerService; -} diff --git a/packages/backend/src/channel-api/extension/index.ts b/packages/backend/src/channel-api/extension/index.ts deleted file mode 100644 index 47bae19d820..00000000000 --- a/packages/backend/src/channel-api/extension/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export { BackendExtensionApi } from "./BackendExtensionApi"; diff --git a/packages/backend/src/channel-api/index.ts b/packages/backend/src/channel-api/index.ts deleted file mode 100644 index 2fd471338d7..00000000000 --- a/packages/backend/src/channel-api/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export * from "./capability"; -export * from "./extension"; -export { ServiceId } from "./ServiceId"; diff --git a/packages/backend/src/http-bridge/DefaultHttpBridge.ts b/packages/backend/src/http-bridge/DefaultHttpBridge.ts deleted file mode 100644 index 13535670e7a..00000000000 --- a/packages/backend/src/http-bridge/DefaultHttpBridge.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import axios, { AxiosError } from "axios"; -import { HttpBridge, HttpRequest, HttpResponse } from "../api"; - -/** - * Default bridge between channels and external services that are accessed through HTTP. - */ -export class DefaultHttpBridge implements HttpBridge { - public async request(request: HttpRequest): Promise { - try { - const response = request.body - ? await axios.post(request.endpoint, request.body) - : await axios.get(request.endpoint); - return { body: response.data }; - } catch (e) { - let message = e.message; - - const axiosError = e as AxiosError; - if (axiosError.config?.url) { - message += " " + axiosError.config.url; - } - - return Promise.reject(message); - } - } -} diff --git a/packages/backend/src/http-bridge/index.ts b/packages/backend/src/http-bridge/index.ts deleted file mode 100644 index 60838c99815..00000000000 --- a/packages/backend/src/http-bridge/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export { DefaultHttpBridge } from "./DefaultHttpBridge"; diff --git a/packages/backend/src/i18n/BackendI18n.ts b/packages/backend/src/i18n/BackendI18n.ts deleted file mode 100644 index c4fbd4da55d..00000000000 --- a/packages/backend/src/i18n/BackendI18n.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { ReferenceDictionary } from "@kie-tools-core/i18n/dist/core"; - -interface BackendDictionary extends ReferenceDictionary { - dontShowAgain: string; - installExtension: string; - installBackendExtensionMessage: string; - viewTestSummary: string; - runningTestScenarios: string; - testScenarioSummary: (tests: number, errors: number, skipped: number, failures: number) => string; -} - -export interface BackendI18n extends BackendDictionary {} diff --git a/packages/backend/src/i18n/index.ts b/packages/backend/src/i18n/index.ts deleted file mode 100644 index 424796ab1c9..00000000000 --- a/packages/backend/src/i18n/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export * from "./BackendI18n"; -export * from "./setup"; diff --git a/packages/backend/src/i18n/locales/de.ts b/packages/backend/src/i18n/locales/de.ts deleted file mode 100644 index 203335c7c23..00000000000 --- a/packages/backend/src/i18n/locales/de.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { BackendI18n } from ".."; - -export const de: BackendI18n = { - dontShowAgain: "Nicht mehr anzeigen", - installExtension: "Installieren", - installBackendExtensionMessage: - "Installieren Sie die Backend-Erweiterung, um die Möglichkeiten der Editoren zu erweitern.", - viewTestSummary: "Zusammenfassung anzeigen", - runningTestScenarios: "Ausführung von Testszenarien ...", - testScenarioSummary: (tests: number, errors: number, skipped: number, failures: number) => - `Vollständige Ausführung von ${tests} Tests (Fehler: ${errors}, Übersprungen: ${skipped}, Fehlschläge: ${failures})`, -}; diff --git a/packages/backend/src/i18n/locales/en.ts b/packages/backend/src/i18n/locales/en.ts deleted file mode 100644 index 3f98295668e..00000000000 --- a/packages/backend/src/i18n/locales/en.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { BackendI18n } from ".."; - -export const en: BackendI18n = { - dontShowAgain: "Don't Show Again", - installExtension: "Install", - installBackendExtensionMessage: - "Consider installing the backend extension to augment the capabilities of the editors.", - viewTestSummary: "View summary", - runningTestScenarios: "Running test scenarios ...", - testScenarioSummary: (tests: number, errors: number, skipped: number, failures: number) => - `Completed execution of ${tests} tests (errors: ${errors}, skipped: ${skipped}, failures: ${failures})`, -}; diff --git a/packages/backend/src/i18n/locales/index.ts b/packages/backend/src/i18n/locales/index.ts deleted file mode 100644 index ce52f5ba8d3..00000000000 --- a/packages/backend/src/i18n/locales/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export { en } from "./en"; -export { de } from "./de"; diff --git a/packages/backend/src/i18n/setup.ts b/packages/backend/src/i18n/setup.ts deleted file mode 100644 index 81c51e12119..00000000000 --- a/packages/backend/src/i18n/setup.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { I18nDefaults, I18nDictionaries } from "@kie-tools-core/i18n/dist/core"; -import { BackendI18n } from "./BackendI18n"; -import { en } from "./locales"; -import { de } from "./locales"; - -export const backendI18nDefaults: I18nDefaults = { locale: "en", dictionary: en }; -export const backendI18nDictionaries: I18nDictionaries = new Map([ - ["en", en], - ["de", de], -]); diff --git a/packages/backend/src/node/QuarkusLocalServer.ts b/packages/backend/src/node/QuarkusLocalServer.ts deleted file mode 100644 index 44602abb0f3..00000000000 --- a/packages/backend/src/node/QuarkusLocalServer.ts +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import * as cp from "child_process"; -import * as fs from "fs"; -import { getPortPromise } from "portfinder"; -import { LocalHttpServer } from "../api"; -import * as utils from "./utils"; - -export class QuarkusLocalServer extends LocalHttpServer { - private activeProcess: cp.ChildProcess | undefined; - - public constructor(private readonly jarFilePath: string) { - super(); - } - - public identify(): string { - return "QUARKUS_LOCAL_SERVER"; - } - - public async start(): Promise { - this.activeProcess = cp.spawn("java", [`-Dquarkus.http.port=${this.port}`, "-jar", this.jarFilePath]); - - const timeoutPromise = new Promise((resolve) => { - setTimeout(() => { - resolve(false); - }, 5000); - }); - - const checkServerPromise = new Promise((resolve) => { - if (!this.activeProcess || !this.activeProcess.stdout) { - resolve(false); - return; - } - - this.activeProcess.stdout.on("data", (data) => { - if (data.toString().includes("Listening on")) { - resolve(true); - } - }); - }); - - return Promise.race([timeoutPromise, checkServerPromise]).then((result: boolean) => { - if (!result) { - throw new Error("Could not start the Quarkus local server."); - } - }); - } - - public stop(): void { - if (!this.activeProcess) { - return; - } - utils.killProcess(this.activeProcess); - this.activeProcess = undefined; - } - - public async satisfyRequirements(): Promise { - if (!fs.existsSync(this.jarFilePath)) { - console.error(`${this.jarFilePath} does not exist.`); - return false; - } - - if (!(await utils.isJavaAvailable({ major: 11, minor: 0, patch: 0 }))) { - console.error("Java 11.0.0+ could not be identified."); - return false; - } - - try { - this.port = await getPortPromise({ port: 8082 }); - return true; - } catch (e) { - console.error(e); - return false; - } - } -} diff --git a/packages/backend/src/node/TestScenarioRunnerService.ts b/packages/backend/src/node/TestScenarioRunnerService.ts deleted file mode 100644 index 8dddcff292d..00000000000 --- a/packages/backend/src/node/TestScenarioRunnerService.ts +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import * as cp from "child_process"; -import { XMLParser } from "fast-xml-parser"; -import * as fs from "fs"; -import * as path from "path"; -import { CapabilityResponse, Service } from "../api"; -import { ServiceId, TestResult, TestScenarioRunnerCapability } from "../channel-api"; -import * as utils from "./utils"; - -export class TestScenarioRunnerService implements Service, TestScenarioRunnerCapability { - private activeProcess: cp.ChildProcess | undefined; - - public identify(): string { - return ServiceId.TEST_SCENARIO_RUNNER; - } - - public async start(): Promise { - /* Nothing to do here */ - } - - public stop(): void { - if (!this.activeProcess) { - return; - } - - utils.killProcess(this.activeProcess); - this.activeProcess = undefined; - } - - public async satisfyRequirements(): Promise { - if (!(await utils.isMavenAvailable({ major: 3, minor: 6, patch: 2 }))) { - console.error("Maven 3.6.2+ could not be identified."); - return false; - } - - if (!(await utils.isJavaAvailable({ major: 11, minor: 0, patch: 0 }))) { - console.error("Java 11.0.0+ could not be identified."); - return false; - } - - return true; - } - - public stopActiveExecution() { - this.stop(); - } - - public execute(baseDir: string, runnerClass: string): Promise> { - if (!fs.existsSync(path.join(baseDir, "pom.xml"))) { - return Promise.reject(`Unable to find a pom.xml file inside ${baseDir}`); - } - - if (!fs.existsSync(path.join(baseDir, "src", "test", "java", runnerClass.replace(".", path.sep) + ".java"))) { - return Promise.reject(`Unable to find ${runnerClass} file in the src/test/java folder`); - } - - return new Promise((resolve, reject) => { - this.stopActiveExecution(); - - this.activeProcess = cp.spawn("mvn", ["clean", "test", "-f", baseDir]); - - this.activeProcess.on("exit", (code: number | null) => { - if (code !== 0) { - resolve(CapabilityResponse.ok()); - return; - } - - const resultFilePath = path.join(baseDir, "target", "surefire-reports", runnerClass + ".txt"); - - if (!fs.existsSync(resultFilePath)) { - reject("Test report file could not be found."); - return; - } - - const resultXmlPath = path.join(baseDir, "target", "surefire-reports", "TEST-" + runnerClass + ".xml"); - const parser = new XMLParser({ - attributeNamePrefix: "", - removeNSPrefix: true, - ignoreAttributes: false, - parseAttributeValue: true, - trimValues: true, - }); - const attrsMap = parser.parse(fs.readFileSync(resultXmlPath).toString()).testsuites.testsuite[0]; - - resolve( - CapabilityResponse.ok({ - filePath: resultFilePath, - tests: attrsMap.tests, - errors: attrsMap.errors, - failures: attrsMap.failures, - skipped: attrsMap.skipped, - }) - ); - }); - }); - } -} diff --git a/packages/backend/src/node/index.ts b/packages/backend/src/node/index.ts deleted file mode 100644 index 9b0215e53e0..00000000000 --- a/packages/backend/src/node/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export { QuarkusLocalServer } from "./QuarkusLocalServer"; -export { TestScenarioRunnerService } from "./TestScenarioRunnerService"; -export * from "./utils"; diff --git a/packages/backend/src/node/utils.ts b/packages/backend/src/node/utils.ts deleted file mode 100644 index 2f9c454b4f1..00000000000 --- a/packages/backend/src/node/utils.ts +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import * as cp from "child_process"; -import * as os from "os"; -import { lte } from "semver"; - -interface Version { - major: number; - minor: number; - patch: number; -} - -/** - * Verify if Maven is installed on the local machine. - * @param version Optional minimum version to match. - * @returns Whether Maven is installed or not. - */ -export function isMavenAvailable(version?: Version): Promise { - return new Promise((resolve) => { - cp.exec("mvn -version", (error, stdout, _) => { - if (error) { - resolve(false); - return; - } - - const firstLine = stdout.toString().split("\n")[0]; - const regexMatch = new RegExp("^(Apache Maven) (\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:[_\\.](\\d+))?)?)?").exec( - firstLine - ); - - if (!regexMatch) { - resolve(false); - return; - } - - if (!version) { - resolve(!!regexMatch); - return; - } - - const [, , major, minor, patch] = regexMatch; - - const requiredVersion = Object.values(version).join("."); - const actualVersion = `${+major}.${minor ? +minor : 0}.${patch ? +patch : 0}`; - - resolve(lte(requiredVersion, actualVersion)); - }); - }); -} - -/** - * Verify if Java is installed on the local machine. - * @param version Optional minimum version to match. - * @returns Whether Java is installed or not. - */ -export function isJavaAvailable(version?: Version): Promise { - return new Promise((resolve) => { - cp.exec("java -version", (error, _, stderr) => { - if (error) { - resolve(false); - return; - } - - const firstLine = stderr.toString().split("\n")[0]; - const regexMatch = new RegExp( - '^(java|openjdk) (version) "?(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:[_\\.](\\d+))?)?)?"?' - ).exec(firstLine); - - if (!regexMatch) { - resolve(false); - return; - } - - if (!version) { - resolve(!!regexMatch); - return; - } - - const [, , , major, minor, patch] = regexMatch; - - const requiredVersion = Object.values(version).join("."); - const actualVersion = `${+major}.${minor ? +minor : 0}.${patch ? +patch : 0}`; - - resolve(lte(requiredVersion, actualVersion)); - }); - }); -} - -/** - * Kill the given process. - * @param process Process to be killed. - */ -export function killProcess(process: cp.ChildProcess) { - switch (os.platform()) { - case "win32": - cp.spawn("taskkill", ["/pid", process.pid!.toString(), "/f", "/t"]); - break; - case "darwin": - case "linux": - default: - process.kill("SIGINT"); - break; - } -} diff --git a/packages/backend/src/vscode/VsCodeBackendProxy.ts b/packages/backend/src/vscode/VsCodeBackendProxy.ts deleted file mode 100644 index ea991db3bfb..00000000000 --- a/packages/backend/src/vscode/VsCodeBackendProxy.ts +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { I18n } from "@kie-tools-core/i18n/dist/core/I18n"; -import * as vscode from "vscode"; -import { BackendProxy, Capability, CapabilityResponse, CapabilityResponseStatus } from "../api"; -import { BackendExtensionApi } from "../channel-api"; -import { BackendI18n } from "../i18n"; - -const SUGGEST_BACKEND_KEY = "SUGGEST_BACKEND"; - -/** - * Augmented {@link BackendProxy} for the VS Code channel. - */ -export class VsCodeBackendProxy extends BackendProxy { - /** - * @param context The `vscode.ExtensionContext` provided on the activate method of the extension. - * @param backendI18n I18n for backend services. - * @param backendExtensionId The backend extension ID in `publisher.name` format (optional). - */ - public constructor( - private readonly context: vscode.ExtensionContext, - private readonly backendI18n: I18n, - private readonly backendExtensionId?: string - ) { - super(); - } - - public async withCapability( - serviceId: string, - consumer: (capability: T) => Promise> - ): Promise> { - await this.tryLoadBackendExtension(false); - - const response = await super.withCapability(serviceId, consumer); - if (response.status === CapabilityResponseStatus.MISSING_INFRA) { - this.suggestBackendExtension(); - } - return response; - } - - /** - * Try to load the API from the backend extension if it hasn't been already loaded. - * @param suggestInstall Whether or not to suggest installing the backend extension in case it is missing. - */ - public async tryLoadBackendExtension(suggestInstall: boolean): Promise { - if (!this.backendExtensionId) { - return; // Ignoring since no backend extension ID is provided - } - - const backendExtension = vscode.extensions.getExtension(this.backendExtensionId); - - if (!backendExtension) { - if (suggestInstall) { - this.trySuggestBackendExtension(); - } - return; // Backend extension is not installed - } - - if (this.backendManager && backendExtension) { - return; // Backend extension API already loaded - } - - const backendExtensionApi: BackendExtensionApi = backendExtension.isActive - ? backendExtension.exports - : await backendExtension.activate(); - - this.backendManager = backendExtensionApi.backendManager; - } - - /** - * If `SUGGEST_BACKEND` config is enabled, - * show a notification informing the user to install the backend extension. - * This notification also includes a `Don't show again` button to disable the `SUGGEST_BACKEND` config. - */ - public trySuggestBackendExtension(): void { - const suggestBackend = this.context.globalState.get(SUGGEST_BACKEND_KEY) ?? true; - - if (!suggestBackend) { - return; - } - - const i18n = this.backendI18n.getCurrent(); - - vscode.window - .showInformationMessage(i18n.installBackendExtensionMessage, i18n.installExtension, i18n.dontShowAgain) - .then(async (selection) => { - if (!selection) { - return; - } - - if (selection === i18n.installExtension) { - await vscode.env.openExternal( - vscode.Uri.parse(`${vscode.env.uriScheme}:extension/${this.backendExtensionId}`) - ); - } - - if (selection === i18n.dontShowAgain) { - this.context.globalState.update(SUGGEST_BACKEND_KEY, false); - } - }); - } - - /** - * Show a notification informing the user to install the backend extension. - */ - public suggestBackendExtension(): void { - const i18n = this.backendI18n.getCurrent(); - - vscode.window - .showInformationMessage(i18n.installBackendExtensionMessage, i18n.installExtension) - .then(async (selection) => { - if (!selection) { - return; - } - - if (selection === i18n.installExtension) { - await vscode.env.openExternal( - vscode.Uri.parse(`${vscode.env.uriScheme}:extension/${this.backendExtensionId}`) - ); - } - }); - } -} diff --git a/packages/backend/src/vscode/VsCodeTestScenarioRunnerService.ts b/packages/backend/src/vscode/VsCodeTestScenarioRunnerService.ts deleted file mode 100644 index 248226a1601..00000000000 --- a/packages/backend/src/vscode/VsCodeTestScenarioRunnerService.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import * as vscode from "vscode"; -import { TestScenarioRunnerService } from "../node"; - -/** - * Augmented {@link TestScenarioRunnerService} for the VS Code channel. - */ -export class VsCodeTestScenarioRunnerService extends TestScenarioRunnerService { - public async satisfyRequirements(): Promise { - if (!vscode.workspace.workspaceFolders || vscode.workspace.workspaceFolders.length === 0) { - console.error("There isn't any workspace folder on VS Code."); - return false; - } - - return super.satisfyRequirements(); - } -} diff --git a/packages/backend/src/vscode/index.ts b/packages/backend/src/vscode/index.ts deleted file mode 100644 index c7150e73b10..00000000000 --- a/packages/backend/src/vscode/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export { VsCodeBackendProxy } from "./VsCodeBackendProxy"; -export { VsCodeTestScenarioRunnerService } from "./VsCodeTestScenarioRunnerService"; diff --git a/packages/backend/tests/api/core/BackendManagerService.test.ts b/packages/backend/tests/api/core/BackendManagerService.test.ts deleted file mode 100644 index 02020948d73..00000000000 --- a/packages/backend/tests/api/core/BackendManagerService.test.ts +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { BackendManagerService, HttpBridge } from "@kie-tools-core/backend/dist/api"; -import { createMockedService, DummyHttpService, DummyLocalHttpServer, DummyLocalHttpService } from "../dummyServices"; - -const localHttpServer = new DummyLocalHttpServer(); - -describe("satisfy requirements of the backend manager service", () => { - test("should always return TRUE since there are no requirements to satisfy", async () => { - const manager = new BackendManagerService({}); - await expect(manager.satisfyRequirements()).resolves.toBeTruthy(); - }); -}); - -describe("stop the backend manager service", () => { - test("should stop all registered services", async () => { - const serviceA = createMockedService("Service A"); - const serviceB = createMockedService("Service B"); - const serviceC = createMockedService("Service C"); - const manager = new BackendManagerService({ - localHttpServer: localHttpServer, - bootstrapServices: [serviceA, serviceB], - lazyServices: [serviceC], - }); - const localServerStopFn = jest.spyOn(localHttpServer, "stop"); - await manager.start(); - await manager.getService("Service C"); - manager.stop(); - expect(serviceA.stop).toHaveBeenCalled(); - expect(serviceB.stop).toHaveBeenCalled(); - expect(serviceC.stop).toHaveBeenCalled(); - expect(localServerStopFn).toHaveBeenCalled(); - }); -}); - -describe("start the backend manager service", () => { - test("should not register when there is no service to be registered", async () => { - const manager = new BackendManagerService({}); - const registerServiceFn = jest.spyOn(manager, "registerService"); - await manager.start(); - expect(registerServiceFn).not.toHaveBeenCalled(); - }); - - test("should only register the local http server", async () => { - const manager = new BackendManagerService({ localHttpServer: localHttpServer }); - const registerServiceFn = jest.spyOn(manager, "registerService"); - await manager.start(); - expect(registerServiceFn).toHaveBeenCalledTimes(1); - expect(registerServiceFn).toHaveBeenCalledWith(localHttpServer); - }); - - test("should only register the bootstrap services", async () => { - const serviceA = createMockedService("Service A"); - const serviceB = createMockedService("Service B"); - const manager = new BackendManagerService({ bootstrapServices: [serviceA, serviceB] }); - const registerServiceFn = jest.spyOn(manager, "registerService"); - await manager.start(); - expect(registerServiceFn).toHaveBeenCalledTimes(2); - expect(registerServiceFn).toHaveBeenCalledWith(serviceA); - expect(registerServiceFn).toHaveBeenCalledWith(serviceB); - }); - - test("should register both the local http server and the bootstrap services", async () => { - const serviceA = createMockedService("Service A"); - const serviceB = createMockedService("Service B"); - const manager = new BackendManagerService({ - localHttpServer: localHttpServer, - bootstrapServices: [serviceA, serviceB], - }); - const registerServiceFn = jest.spyOn(manager, "registerService"); - await manager.start(); - expect(registerServiceFn).toHaveBeenCalledTimes(3); - expect(registerServiceFn).toHaveBeenCalledWith(localHttpServer); - expect(registerServiceFn).toHaveBeenCalledWith(serviceA); - expect(registerServiceFn).toHaveBeenCalledWith(serviceB); - }); - - test("should not register the lazy services", async () => { - const serviceA = createMockedService("Service A"); - const serviceB = createMockedService("Service B"); - const manager = new BackendManagerService({ lazyServices: [serviceA, serviceB] }); - const registerServiceFn = jest.spyOn(manager, "registerService"); - await manager.start(); - expect(registerServiceFn).not.toHaveBeenCalled(); - }); -}); - -describe("retrieve a service", () => { - test("should return undefined when the required service is not found", async () => { - const manager = new BackendManagerService({}); - await expect(manager.getService("Unknown Service")).resolves.toBeUndefined(); - }); - - test("should return undefined when the required service is not found while having other lazy services", async () => { - const manager = new BackendManagerService({ lazyServices: [createMockedService("Service A")] }); - await expect(manager.getService("Unknown Service")).resolves.toBeUndefined(); - }); - - test("should return the required bootstrap service", async () => { - const serviceId = "Service A"; - const serviceA = createMockedService(serviceId); - const manager = new BackendManagerService({ bootstrapServices: [serviceA] }); - const registerServiceFn = jest.spyOn(manager, "registerService"); - await manager.start(); - await expect(manager.getService(serviceId)).resolves.toBe(serviceA); - expect(registerServiceFn).toHaveBeenCalledTimes(1); - }); - - test("should register and return the required lazy service", async () => { - const serviceId = "Service A"; - const serviceA = createMockedService(serviceId); - const manager = new BackendManagerService({ lazyServices: [serviceA] }); - const registerServiceFn = jest.spyOn(manager, "registerService"); - await expect(manager.getService(serviceId)).resolves.toBe(serviceA); - expect(registerServiceFn).toHaveBeenCalled(); - }); -}); - -describe("register a new service", () => { - const httpService = new DummyHttpService(); - const localHttpService = new DummyLocalHttpService(); - const httpBridge: jest.Mocked = { - request: jest.fn(), - }; - - test("should return TRUE when the service is already registered", async () => { - const serviceA = createMockedService("Service A"); - const manager = new BackendManagerService({ bootstrapServices: [serviceA] }); - await manager.start(); - await expect(manager.registerService(serviceA)).resolves.toBeTruthy(); - }); - - test("should return FALSE when the requirements are not satisfied", async () => { - const serviceA = createMockedService("Service A", false); - const manager = new BackendManagerService({}); - await expect(manager.registerService(serviceA)).resolves.toBeFalsy(); - }); - - test("should start the service when the requirements are satisfied", async () => { - const serviceA = createMockedService("Service A"); - const manager = new BackendManagerService({}); - await expect(manager.registerService(serviceA)).resolves.toBeTruthy(); - expect(serviceA.start).toHaveBeenCalled(); - }); - - test("should return FALSE when an error occurs while starting the service up", async () => { - const serviceA = createMockedService("Service A"); - const manager = new BackendManagerService({}); - serviceA.start.mockRejectedValueOnce("Some error"); - await expect(manager.registerService(serviceA)).resolves.toBeFalsy(); - }); - - test("should return FALSE when there is no HTTP bridge for an HTTP service", async () => { - const manager = new BackendManagerService({}); - await expect(manager.registerService(httpService)).resolves.toBeFalsy(); - }); - - test("should return TRUE when there is an HTTP bridge for an HTTP service", async () => { - const manager = new BackendManagerService({ bridge: httpBridge }); - const registerHttpBridgeFn = jest.spyOn(httpService, "registerHttpBridge"); - await expect(manager.registerService(httpService)).resolves.toBeTruthy(); - expect(registerHttpBridgeFn).toHaveBeenCalled(); - }); - - test("should return FALSE when there is no HTTP bridge for a local HTTP service", async () => { - const manager = new BackendManagerService({}); - await expect(manager.registerService(localHttpService)).resolves.toBeFalsy(); - }); - - test("should return FALSE when there is no local HTTP server for a local HTTP service", async () => { - const manager = new BackendManagerService({ bridge: httpBridge }); - await expect(manager.registerService(localHttpService)).resolves.toBeFalsy(); - }); - - test("should return TRUE when there is a local HTTP server for a local HTTP service", async () => { - const manager = new BackendManagerService({ bridge: httpBridge, localHttpServer: localHttpServer }); - const registerPortFn = jest.spyOn(localHttpService, "registerPort"); - await manager.start(); - await expect(manager.registerService(localHttpService)).resolves.toBeTruthy(); - expect(registerPortFn).toHaveBeenCalled(); - }); -}); diff --git a/packages/backend/tests/api/core/BackendProxy.test.ts b/packages/backend/tests/api/core/BackendProxy.test.ts deleted file mode 100644 index 41615a9afad..00000000000 --- a/packages/backend/tests/api/core/BackendProxy.test.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { - BackendManagerService, - BackendProxy, - CapabilityResponse, - CapabilityResponseStatus, -} from "@kie-tools-core/backend/dist/api"; -import { createMockedService } from "../dummyServices"; - -const backendManager = new BackendManagerService({}); - -let backendProxy: BackendProxy; -beforeEach(() => { - backendProxy = new BackendProxy(); -}); - -describe("stop services", () => { - test("should call the registered backend manager stop function", () => { - const stopFn = jest.spyOn(backendManager, "stop"); - backendProxy.registerBackendManager(backendManager); - backendProxy.stopServices(); - expect(stopFn).toHaveBeenCalled(); - }); -}); - -describe("access a capability", () => { - const testServiceId = "Service A"; - - test("should return a MISSING_INFRA response when no backend manager is registered", async () => { - const response = await backendProxy.withCapability(testServiceId, async () => CapabilityResponse.ok()); - expect(response.status).toBe(CapabilityResponseStatus.MISSING_INFRA); - }); - - test("should return a NOT_AVAILABLE response when the required service is not found", async () => { - jest.spyOn(backendManager, "getService").mockResolvedValueOnce(undefined); - backendProxy.registerBackendManager(backendManager); - - const response = await backendProxy.withCapability(testServiceId, async () => CapabilityResponse.ok()); - expect(response.status).toBe(CapabilityResponseStatus.NOT_AVAILABLE); - expect(response.message).toBe(`Service ${testServiceId} not available.`); - }); - - test("should execute the callback when the service is found", async () => { - const responseContent = { foo: "bar" }; - jest.spyOn(backendManager, "getService").mockResolvedValueOnce(createMockedService("Service A")); - const testCallback = jest.fn().mockImplementation(async () => CapabilityResponse.ok(responseContent)); - backendProxy.registerBackendManager(backendManager); - - const response = await backendProxy.withCapability(testServiceId, testCallback); - expect(testCallback).toHaveBeenCalled(); - expect(response.status).toBe(CapabilityResponseStatus.OK); - expect(response.body).toBe(responseContent); - }); -}); diff --git a/packages/backend/tests/api/core/CapabilityResponse.test.ts b/packages/backend/tests/api/core/CapabilityResponse.test.ts deleted file mode 100644 index 8afa7c008ec..00000000000 --- a/packages/backend/tests/api/core/CapabilityResponse.test.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { CapabilityResponse, CapabilityResponseStatus } from "@kie-tools-core/backend/dist/api"; - -describe("utility methods to create a CapabilityResponse", () => { - test("should be an empty OK response", () => { - const response = CapabilityResponse.ok(); - expect(response.status).toBe(CapabilityResponseStatus.OK); - expect(response.body).toBeUndefined(); - expect(response.message).toBeUndefined(); - }); - - test("should be an OK response with a body", () => { - const responseBody = { foo: "bar" }; - const response = CapabilityResponse.ok(responseBody); - expect(response.status).toBe(CapabilityResponseStatus.OK); - expect(response.body).toBe(responseBody); - expect(response.message).toBeUndefined(); - }); - - test("should be a NOT_AVAILABLE response", () => { - const responseMessage = "some message"; - const response = CapabilityResponse.notAvailable(responseMessage); - expect(response.status).toBe(CapabilityResponseStatus.NOT_AVAILABLE); - expect(response.body).toBeUndefined(); - expect(response.message).toBe(responseMessage); - }); - - test("should be a MISSING_INFRA response", () => { - const response = CapabilityResponse.missingInfra(); - expect(response.status).toBe(CapabilityResponseStatus.MISSING_INFRA); - expect(response.body).toBeUndefined(); - }); -}); diff --git a/packages/backend/tests/api/dummyServices.ts b/packages/backend/tests/api/dummyServices.ts deleted file mode 100644 index 48147bd3359..00000000000 --- a/packages/backend/tests/api/dummyServices.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { HttpService, LocalHttpServer, LocalHttpService, Service } from "@kie-tools-core/backend/dist/api"; - -export class DummyLocalHttpServer extends LocalHttpServer { - public identify(): string { - return "Dummy Local HTTP Server"; - } - public async start(): Promise { - // Intentionally empty - } - public stop(): void { - // Intentionally empty - } - public async satisfyRequirements(): Promise { - return true; - } -} - -export class DummyHttpService extends HttpService { - public identify(): string { - return "Dummy HTTP Service"; - } -} - -export class DummyLocalHttpService extends LocalHttpService { - public identify(): string { - return "Dummy Local HTTP Service"; - } -} - -export function createMockedService(id: string, reqSatisfied: boolean = true): jest.Mocked { - return { - identify: jest.fn(() => id), - satisfyRequirements: jest.fn(async () => reqSatisfied), - start: jest.fn(), - stop: jest.fn(), - }; -} diff --git a/packages/backend/tests/api/http/HttpService.test.ts b/packages/backend/tests/api/http/HttpService.test.ts deleted file mode 100644 index 84685a811e8..00000000000 --- a/packages/backend/tests/api/http/HttpService.test.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { HttpBridge, HttpResponse, HttpService } from "@kie-tools-core/backend/dist/api"; -import { DummyHttpService } from "../dummyServices"; - -let httpService: HttpService; -beforeEach(() => { - httpService = new DummyHttpService(); -}); - -describe("execute http requests", () => { - const testEndpoint = "some.endpoint/test"; - test("should reject promise when bridge is not registered", async () => { - try { - await httpService.execute(testEndpoint); - fail("should not have reached here"); - } catch (e) { - expect(e).toBe("Service bridge is not registered."); - } - }); - - test("should return response when bridge is registered", async () => { - const response: HttpResponse = { body: "some content" }; - const bridge: jest.Mocked = { request: jest.fn().mockResolvedValue(response) }; - httpService.registerHttpBridge(bridge); - await expect(httpService.execute(testEndpoint)).resolves.toBe(response); - }); - - test("should reject the promise when an error occurs in the bridge", async () => { - const errorMsg = "Some error"; - const bridge: jest.Mocked = { request: jest.fn().mockRejectedValue(errorMsg) }; - httpService.registerHttpBridge(bridge); - try { - await httpService.execute(testEndpoint); - fail("should not have reached here"); - } catch (e) { - expect(e).toBe(errorMsg); - } - }); -}); - -describe("satisfy requirements of the http service", () => { - test("should always return TRUE since there are no requirements to satisfy", async () => { - await expect(httpService.satisfyRequirements()).resolves.toBeTruthy(); - }); -}); diff --git a/packages/backend/tests/api/http/LocalHttpService.test.ts b/packages/backend/tests/api/http/LocalHttpService.test.ts deleted file mode 100644 index 715cb33db99..00000000000 --- a/packages/backend/tests/api/http/LocalHttpService.test.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { HttpResponse, HttpService, LocalHttpService } from "@kie-tools-core/backend/dist/api"; -import { DummyLocalHttpService } from "../dummyServices"; - -const testEndpoint = "/some/local/endpoint"; -const testResponse: HttpResponse = { body: "some response content" }; -const testPort = 8099; - -let localHttpService: LocalHttpService; -beforeEach(() => { - localHttpService = new DummyLocalHttpService(); -}); - -describe("execute local http requests", () => { - test("should reject promise when port is not registered", async () => { - try { - await localHttpService.execute(testEndpoint); - fail("should not have reached here"); - } catch (e) { - expect(e).toBe("Local port not registered."); - } - }); - - test("should return response when port is registered", async () => { - const requestBody = "some request content"; - jest.spyOn(HttpService.prototype, "execute").mockResolvedValue(testResponse); - - localHttpService.registerPort(testPort); - await expect(localHttpService.execute(testEndpoint, requestBody)).resolves.toMatchObject(testResponse); - expect(HttpService.prototype.execute).toHaveBeenCalledWith( - `http://localhost:${testPort}${testEndpoint}`, - requestBody - ); - }); - - test("should reject the promise when an error occurs in the bridge", async () => { - const errorMsg = "Some error"; - jest.spyOn(HttpService.prototype, "execute").mockRejectedValue(errorMsg); - - localHttpService.registerPort(testPort); - try { - await localHttpService.execute(testEndpoint); - fail("should not have reached here"); - } catch (e) { - expect(e).toBe(errorMsg); - } - }); -}); diff --git a/packages/backend/tests/http-bridge/DefaultHttpBridge.test.ts b/packages/backend/tests/http-bridge/DefaultHttpBridge.test.ts deleted file mode 100644 index 4db9a866e7b..00000000000 --- a/packages/backend/tests/http-bridge/DefaultHttpBridge.test.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import axios, { AxiosError } from "axios"; -import { DefaultHttpBridge } from "@kie-tools-core/backend/dist/http-bridge"; - -jest.mock("axios"); -const mockAxios = axios as jest.Mocked; - -const bridge = new DefaultHttpBridge(); -const testEndpoint = "some.endpoint/test"; - -describe("requests throught DefaultHttpBridge", () => { - test("should execute GET when the request does not have a body", async () => { - mockAxios.get.mockResolvedValueOnce({}); - await bridge.request({ endpoint: testEndpoint }); - expect(mockAxios.get).toHaveBeenCalledWith(testEndpoint); - }); - - test("should execute POST when the request has a body", async () => { - const requestBody = { foo: "bar" }; - mockAxios.post.mockResolvedValueOnce({}); - await bridge.request({ endpoint: testEndpoint, body: requestBody }); - expect(mockAxios.post).toHaveBeenCalledWith(testEndpoint, requestBody); - }); - - test("should return the response data on success of a GET", async () => { - const responseData = { some: "data" }; - mockAxios.get.mockResolvedValueOnce({ data: responseData }); - const response = await bridge.request({ endpoint: testEndpoint }); - expect(response.body).toBe(responseData); - }); - - test("should return the response data on success of a POST", async () => { - const responseData = { some: "data" }; - mockAxios.post.mockResolvedValueOnce({ data: responseData }); - const response = await bridge.request({ endpoint: testEndpoint, body: { foo: "bar" } }); - expect(response.body).toBe(responseData); - }); - - test("should reject the promise when a generic error ocurrs", async () => { - const errorMsg = "Some error"; - mockAxios.get.mockRejectedValueOnce(new Error(errorMsg)); - try { - await bridge.request({ endpoint: testEndpoint }); - fail("should not have reached here"); - } catch (e) { - expect(e).toBe(errorMsg); - } - }); - - test("should reject the promise when an error ocurrs on the endpoint", async () => { - const errorMsg = "Some error"; - mockAxios.get.mockRejectedValueOnce({ message: errorMsg, config: { url: testEndpoint } } as AxiosError); - try { - await bridge.request({ endpoint: testEndpoint }); - fail("should not have reached here"); - } catch (e) { - expect(e).toBe(`${errorMsg} ${testEndpoint}`); - } - }); -}); diff --git a/packages/backend/tests/node/QuarkusLocalServer.test.ts b/packages/backend/tests/node/QuarkusLocalServer.test.ts deleted file mode 100644 index 95753df6191..00000000000 --- a/packages/backend/tests/node/QuarkusLocalServer.test.ts +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import * as cp from "child_process"; -import * as events from "events"; -import * as fs from "fs"; -import * as portfinder from "portfinder"; -import * as sinon from "sinon"; -import * as stream from "stream"; -import { QuarkusLocalServer } from "@kie-tools-core/backend/dist/node"; -import * as utils from "@kie-tools-core/backend/dist/node/utils"; - -jest.mock("fs"); - -const testPort = 8099; -const testJarFile = "jar/file/path.jar"; - -beforeAll(() => { - jest.resetAllMocks(); -}); - -describe("satisfy requirements of the Quarkus local server", () => { - const service = new QuarkusLocalServer(testJarFile); - const mockGetPortPromise = jest.spyOn(portfinder, "getPortPromise"); - const mockIsJavaAvailableFn = jest.spyOn(utils, "isJavaAvailable"); - const mockFs = fs as jest.Mocked; - - test("should check if path provided in the constructor exists", async () => { - await service.satisfyRequirements(); - expect(mockFs.existsSync).toHaveBeenCalledWith(testJarFile); - }); - - test("should return FALSE when the runner jar file is missing", async () => { - mockFs.existsSync.mockReturnValueOnce(false); - await expect(service.satisfyRequirements()).resolves.toBeFalsy(); - expect(mockIsJavaAvailableFn).not.toHaveBeenCalled(); - }); - - test("should return FALSE when java is missing", async () => { - mockFs.existsSync.mockReturnValueOnce(true); - mockIsJavaAvailableFn.mockResolvedValueOnce(false); - await expect(service.satisfyRequirements()).resolves.toBeFalsy(); - }); - - test("should return FALSE when an error occurs while trying to find a port", async () => { - mockFs.existsSync.mockReturnValue(true); - mockIsJavaAvailableFn.mockResolvedValueOnce(true); - mockGetPortPromise.mockRejectedValueOnce(new Error()); - await expect(service.satisfyRequirements()).resolves.toBeFalsy(); - }); - - test("should return TRUE when all requirements are satisfied", async () => { - mockFs.existsSync.mockReturnValueOnce(true); - mockIsJavaAvailableFn.mockResolvedValueOnce(true); - mockGetPortPromise.mockResolvedValueOnce(testPort); - await expect(service.satisfyRequirements()).resolves.toBeTruthy(); - expect(service.getPort()).toBe(testPort); - }); -}); - -describe("start the Quarkus local server", () => { - const sandbox = sinon.createSandbox(); - - let quarkusServer: QuarkusLocalServer; - beforeEach(() => { - quarkusServer = new QuarkusLocalServer(testJarFile); - }); - - afterEach(() => { - sandbox.restore(); - }); - - test("should reject the promise when cannot identify that Quarkus is up (timeout reached)", async () => { - const process = new events.EventEmitter() as cp.ChildProcess; - process.stdout = new events.EventEmitter() as stream.Readable; - sandbox.stub(cp, "spawn").returns(process); - - try { - await quarkusServer.start(); - fail("should not have reached here"); - } catch (e) { - expect(e.message).toBe("Could not start the Quarkus local server."); - } - }, 10000); - - test("should reject the promise when there is no stdout", async () => { - sandbox.stub(cp, "spawn").returns(new events.EventEmitter() as cp.ChildProcess); - - try { - await quarkusServer.start(); - fail("should not have reached here"); - } catch (e) { - expect(e.message).toBe("Could not start the Quarkus local server."); - } - }, 10000); - - test("should reject the promise when the expected data is not emitted on the stdout (timeout reached)", async () => { - const process = new events.EventEmitter() as cp.ChildProcess; - process.stdout = new events.EventEmitter() as stream.Readable; - sandbox.stub(cp, "spawn").returns(process); - - setTimeout(() => { - process.stdout!.emit("data", "Some other data"); - }, 1000); - - try { - await quarkusServer.start(); - fail("should not have reached here"); - } catch (e) { - expect(e.message).toBe("Could not start the Quarkus local server."); - } - }, 10000); - - test("should resolve the promise when Quarkus is up", async () => { - const process = new events.EventEmitter() as cp.ChildProcess; - process.stdout = new events.EventEmitter() as stream.Readable; - sandbox.stub(cp, "spawn").returns(process); - - setTimeout(() => { - process.stdout!.emit("data", "Listening on"); - }, 500); - - await expect(quarkusServer.start()).resolves.toBeUndefined(); - }); -}); - -describe("stop the Quarkus local server", () => { - const sandbox = sinon.createSandbox(); - const mockKillProcessFn = jest.spyOn(utils, "killProcess"); - - let quarkusServer: QuarkusLocalServer; - beforeEach(() => { - quarkusServer = new QuarkusLocalServer(testJarFile); - }); - - afterEach(() => { - sandbox.restore(); - }); - - test("should do nothing since there is no active process", async () => { - quarkusServer.stop(); - expect(mockKillProcessFn).not.toHaveBeenCalled(); - }); - - test("should kill the process", async () => { - await startQuarkusServerTest(quarkusServer); - quarkusServer.stop(); - expect(mockKillProcessFn).toHaveBeenCalled(); - }); - - async function startQuarkusServerTest(server: QuarkusLocalServer): Promise { - const process = { kill: jest.fn(), pid: 9999 } as unknown as cp.ChildProcess; - process.stdout = new events.EventEmitter() as stream.Readable; - sandbox.stub(cp, "spawn").returns(process); - - setTimeout(() => { - process.stdout!.emit("data", "Listening on"); - }, 500); - - await server.start(); - sandbox.restore(); - } -}); diff --git a/packages/backend/tests/node/utils.test.ts b/packages/backend/tests/node/utils.test.ts deleted file mode 100644 index bedb5c0ef52..00000000000 --- a/packages/backend/tests/node/utils.test.ts +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import * as cp from "child_process"; -import * as utils from "@kie-tools-core/backend/dist/node"; -import * as sinon from "sinon"; -import * as os from "os"; - -jest.mock("child_process"); - -describe("utility to check whether maven is available or not", () => { - test("should return FALSE when an error occurs", async () => { - mockCpExecCallbackOnce({ name: "error", message: "error" }, "", ""); - await expect(utils.isMavenAvailable({ major: 3, minor: 6, patch: 3 })).resolves.toBeFalsy(); - }); - - test("should return FALSE when stdout is empty", async () => { - mockCpExecCallbackOnce(null, "", ""); - await expect(utils.isMavenAvailable({ major: 3, minor: 6, patch: 3 })).resolves.toBeFalsy(); - }); - - test("should return FALSE when regex does not match", async () => { - mockCpExecCallbackOnce(null, "some text that does not match the regex", ""); - await expect(utils.isMavenAvailable({ major: 3, minor: 6, patch: 3 })).resolves.toBeFalsy(); - }); - - test("should return FALSE when minimun required version > actual version", async () => { - mockCpExecCallbackOnce(null, "Apache Maven 3.6.3", ""); - await expect(utils.isMavenAvailable({ major: 4, minor: 0, patch: 0 })).resolves.toBeFalsy(); - }); - - test("should return TRUE when a match is found and version is not specified", async () => { - mockCpExecCallbackOnce(null, "Apache Maven 3.6.3", ""); - await expect(utils.isMavenAvailable()).resolves.toBeTruthy(); - }); - - test("should return TRUE when only the major value is found/given", async () => { - mockCpExecCallbackOnce(null, "Apache Maven 3", ""); - await expect(utils.isMavenAvailable({ major: 3, minor: 0, patch: 0 })).resolves.toBeTruthy(); - }); - - test("should return TRUE when minimun required version == actual version", async () => { - mockCpExecCallbackOnce(null, "Apache Maven 3.6.3", ""); - await expect(utils.isMavenAvailable({ major: 3, minor: 6, patch: 3 })).resolves.toBeTruthy(); - }); - - test("should return TRUE when minimun required version < actual version", async () => { - mockCpExecCallbackOnce(null, "Apache Maven 3.6.3", ""); - await expect(utils.isMavenAvailable({ major: 3, minor: 5, patch: 2 })).resolves.toBeTruthy(); - }); - - test("should return TRUE when minimun required version < actual version (some combinations)", async () => { - const versions = [ - { major: 2, minor: 15, patch: 0 }, - { major: 2, minor: 0, patch: 15 }, - { major: 2, minor: 15, patch: 15 }, - { major: 2, minor: 0, patch: 0 }, - { major: 3, minor: 6, patch: 0 }, - { major: 3, minor: 0, patch: 10 }, - ]; - - for (const v of versions) { - mockCpExecCallbackOnce(null, "Apache Maven 3.6.3", ""); - await expect(utils.isMavenAvailable(v)).resolves.toBeTruthy(); - } - }); -}); - -describe("utility to check whether java|openjdk is available or not", () => { - test("should return FALSE when an error occurs", async () => { - mockCpExecCallbackOnce({ name: "error", message: "error" }, "", ""); - await expect(utils.isJavaAvailable({ major: 11, minor: 0, patch: 0 })).resolves.toBeFalsy(); - }); - - test("should return FALSE when stderr is empty", async () => { - mockCpExecCallbackOnce(null, "", ""); - await expect(utils.isJavaAvailable({ major: 11, minor: 0, patch: 0 })).resolves.toBeFalsy(); - }); - - test("should return FALSE when regex does not match", async () => { - mockCpExecCallbackOnce(null, "", "some text that does not match the regex"); - await expect(utils.isJavaAvailable({ major: 11, minor: 0, patch: 0 })).resolves.toBeFalsy(); - }); - - test("should return FALSE when minimun required version > actual version (up to java 8 format)", async () => { - mockCpExecCallbackOnce(null, "", 'java version "1.7.0_55"'); - await expect(utils.isJavaAvailable({ major: 1, minor: 8, patch: 0 })).resolves.toBeFalsy(); - mockCpExecCallbackOnce(null, "", 'openjdk version "1.7.0_55"'); - await expect(utils.isJavaAvailable({ major: 1, minor: 8, patch: 0 })).resolves.toBeFalsy(); - }); - - test("should return FALSE when minimun required version > actual version (java 9+ format)", async () => { - mockCpExecCallbackOnce(null, "", 'java version "11.0.0" 2020-04-14 LTS'); - await expect(utils.isJavaAvailable({ major: 12, minor: 0, patch: 0 })).resolves.toBeFalsy(); - mockCpExecCallbackOnce(null, "", 'openjdk version "11.0.0" 2020-04-14 LTS'); - await expect(utils.isJavaAvailable({ major: 12, minor: 0, patch: 0 })).resolves.toBeFalsy(); - }); - - test("should return TRUE when a match is found and version is not specified", async () => { - mockCpExecCallbackOnce(null, "", 'java version "11.0.0" 2020-04-14 LTS'); - await expect(utils.isJavaAvailable()).resolves.toBeTruthy(); - mockCpExecCallbackOnce(null, "", 'openjdk version "11.0.0" 2020-04-14 LTS'); - await expect(utils.isJavaAvailable()).resolves.toBeTruthy(); - }); - - test("should return TRUE when only the major value is found/given", async () => { - mockCpExecCallbackOnce(null, "", 'java version "11" 2020-04-14 LTS'); - await expect(utils.isJavaAvailable({ major: 11, minor: 0, patch: 0 })).resolves.toBeTruthy(); - mockCpExecCallbackOnce(null, "", 'openjdk version "11" 2020-04-14 LTS'); - await expect(utils.isJavaAvailable({ major: 11, minor: 0, patch: 0 })).resolves.toBeTruthy(); - }); - - test("should return TRUE when minimun required version == actual version", async () => { - mockCpExecCallbackOnce(null, "", 'java version "11.0.0" 2020-04-14 LTS'); - await expect(utils.isJavaAvailable({ major: 11, minor: 0, patch: 0 })).resolves.toBeTruthy(); - mockCpExecCallbackOnce(null, "", 'openjdk version "11.0.0" 2020-04-14 LTS'); - await expect(utils.isJavaAvailable({ major: 11, minor: 0, patch: 0 })).resolves.toBeTruthy(); - }); - - test("should return TRUE when minimun required version < actual version", async () => { - mockCpExecCallbackOnce(null, "", 'java version "12.0.0" 2020-04-14 LTS'); - await expect(utils.isJavaAvailable({ major: 11, minor: 0, patch: 0 })).resolves.toBeTruthy(); - mockCpExecCallbackOnce(null, "", 'openjdk version "12.0.0" 2020-04-14 LTS'); - await expect(utils.isJavaAvailable({ major: 11, minor: 0, patch: 0 })).resolves.toBeTruthy(); - }); - - test("should return TRUE when minimun required version < actual version (some combinations)", async () => { - const versions = [ - { major: 9, minor: 15, patch: 0 }, - { major: 9, minor: 0, patch: 15 }, - { major: 9, minor: 15, patch: 15 }, - { major: 9, minor: 0, patch: 0 }, - { major: 10, minor: 10, patch: 0 }, - { major: 10, minor: 0, patch: 15 }, - ]; - - for (const v of versions) { - mockCpExecCallbackOnce(null, "", 'java version "10.10.10" 2020-04-14 LTS'); - await expect(utils.isJavaAvailable(v)).resolves.toBeTruthy(); - } - }); -}); - -function mockCpExecCallbackOnce(error: cp.ExecException | null, stdout: string, stderr: string) { - (cp as jest.Mocked).exec.mockImplementationOnce((( - command: string, - callback?: (error: cp.ExecException | null, stdout: string, stderr: string) => void - ): cp.ChildProcess => { - if (callback) { - callback(error, stdout, stderr); - } - - return {} as cp.ChildProcess; - }) as typeof cp.exec); -} - -describe("Utility to kill a process", () => { - const process = { kill: jest.fn(), pid: 9999 } as unknown as cp.ChildProcess; - const sandbox = sinon.createSandbox(); - - afterEach(() => { - sandbox.restore(); - }); - - test("should kill the process through taskkill on Windows OS", async () => { - const cpStub = sandbox.stub(cp, "spawn"); - sandbox.stub(os, "platform").returns("win32"); - utils.killProcess(process); - expect(cpStub.called).toBeTruthy(); - }); - - test("should kill the process through the active process on Linux OS", async () => { - sandbox.stub(os, "platform").returns("linux"); - utils.killProcess(process); - expect(process.kill).toHaveBeenCalled(); - }); - - test("should kill the process through the active process on Mac OS", async () => { - sandbox.stub(os, "platform").returns("darwin"); - utils.killProcess(process); - expect(process.kill).toHaveBeenCalled(); - }); -}); diff --git a/packages/backend/tsconfig.json b/packages/backend/tsconfig.json deleted file mode 100644 index a0f97e68c47..00000000000 --- a/packages/backend/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "@kie-tools/tsconfig/tsconfig.cjs.json" -} diff --git a/packages/backend/tsconfig.tests.json b/packages/backend/tsconfig.tests.json deleted file mode 100644 index fc8520e7376..00000000000 --- a/packages/backend/tsconfig.tests.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./tsconfig.json" -} diff --git a/packages/bpmn-vscode-extension/package.json b/packages/bpmn-vscode-extension/package.json index 12f1b6d6e90..2a09b5ed3cb 100644 --- a/packages/bpmn-vscode-extension/package.json +++ b/packages/bpmn-vscode-extension/package.json @@ -25,7 +25,6 @@ "watch": "export WEBPACK__sourceMaps=true; WEBPACK__minimize=false; webpack --env dev" }, "dependencies": { - "@kie-tools-core/backend": "workspace:*", "@kie-tools-core/editor": "workspace:*", "@kie-tools-core/i18n": "workspace:*", "@kie-tools-core/patternfly-base": "workspace:*", diff --git a/packages/bpmn-vscode-extension/src/extension/extension.ts b/packages/bpmn-vscode-extension/src/extension/extension.ts index 6f6438483f6..941fb58fb8c 100644 --- a/packages/bpmn-vscode-extension/src/extension/extension.ts +++ b/packages/bpmn-vscode-extension/src/extension/extension.ts @@ -17,22 +17,15 @@ * under the License. */ -import { backendI18nDefaults, backendI18nDictionaries } from "@kie-tools-core/backend/dist/i18n"; import { EditorEnvelopeLocator, EnvelopeContentType, EnvelopeMapping } from "@kie-tools-core/editor/dist/api"; import { I18n } from "@kie-tools-core/i18n/dist/core"; -import { VsCodeBackendProxy } from "@kie-tools-core/backend/dist/vscode"; import * as KogitoVsCode from "@kie-tools-core/vscode-extension"; import * as vscode from "vscode"; import { generateFormsCommand } from "@kie-tools/form-code-generator-vscode-command/dist/generateFormCodeCommand"; -let backendProxy: VsCodeBackendProxy; - export function activate(context: vscode.ExtensionContext) { console.info("Extension is alive."); - const backendI18n = new I18n(backendI18nDefaults, backendI18nDictionaries, vscode.env.language); - backendProxy = new VsCodeBackendProxy(context, backendI18n); - KogitoVsCode.startExtension({ extensionName: "kie-group.bpmn-vscode-extension", context: context, @@ -47,7 +40,6 @@ export function activate(context: vscode.ExtensionContext) { envelopeContent: { type: EnvelopeContentType.PATH, path: "dist/webview/BpmnEditorEnvelopeApp.js" }, }), ]), - backendProxy: backendProxy, }); context.subscriptions.push( @@ -62,5 +54,5 @@ export function activate(context: vscode.ExtensionContext) { } export function deactivate() { - backendProxy?.stopServices(); + console.info("Extension is deactivated."); } diff --git a/packages/dmn-editor-standalone/package.json b/packages/dmn-editor-standalone/package.json index 1715ade3959..06d6adc1c7a 100644 --- a/packages/dmn-editor-standalone/package.json +++ b/packages/dmn-editor-standalone/package.json @@ -33,7 +33,6 @@ "@babel/preset-env": "^7.16.0", "@babel/preset-react": "^7.16.0", "@babel/preset-typescript": "^7.22.5", - "@kie-tools-core/backend": "workspace:*", "@kie-tools-core/editor": "workspace:*", "@kie-tools-core/envelope-bus": "workspace:*", "@kie-tools-core/i18n": "workspace:*", diff --git a/packages/dmn-vscode-extension/package.json b/packages/dmn-vscode-extension/package.json index 618329ea0af..0a44f0b4ea7 100644 --- a/packages/dmn-vscode-extension/package.json +++ b/packages/dmn-vscode-extension/package.json @@ -25,7 +25,6 @@ "watch": "export WEBPACK__sourceMaps=true; WEBPACK__minimize=false; webpack --env dev" }, "dependencies": { - "@kie-tools-core/backend": "workspace:*", "@kie-tools-core/editor": "workspace:*", "@kie-tools-core/i18n": "workspace:*", "@kie-tools-core/patternfly-base": "workspace:*", @@ -47,7 +46,6 @@ "copy-webpack-plugin": "^11.0.0", "process": "^0.11.10", "rimraf": "^3.0.2", - "stream-browserify": "3.0.0", "webpack": "^5.94.0", "webpack-cli": "^4.10.0", "webpack-dev-server": "^4.15.1", diff --git a/packages/dmn-vscode-extension/src/extension/extension.ts b/packages/dmn-vscode-extension/src/extension/extension.ts index d6cf46b97b5..3e8f4d5b4c2 100644 --- a/packages/dmn-vscode-extension/src/extension/extension.ts +++ b/packages/dmn-vscode-extension/src/extension/extension.ts @@ -17,21 +17,13 @@ * under the License. */ -import { backendI18nDefaults, backendI18nDictionaries } from "@kie-tools-core/backend/dist/i18n"; -import { VsCodeBackendProxy } from "@kie-tools-core/backend/dist/vscode"; import { EditorEnvelopeLocator, EnvelopeContentType, EnvelopeMapping } from "@kie-tools-core/editor/dist/api"; -import { I18n } from "@kie-tools-core/i18n/dist/core"; import * as KogitoVsCode from "@kie-tools-core/vscode-extension"; import * as vscode from "vscode"; -let backendProxy: VsCodeBackendProxy; - export function activate(context: vscode.ExtensionContext) { console.info("Extension is alive."); - const backendI18n = new I18n(backendI18nDefaults, backendI18nDictionaries, vscode.env.language); - backendProxy = new VsCodeBackendProxy(context, backendI18n); - KogitoVsCode.startExtension({ extensionName: "kie-group.dmn-vscode-extension", context: context, @@ -52,7 +44,6 @@ export function activate(context: vscode.ExtensionContext) { envelopeContent: { type: EnvelopeContentType.PATH, path: "dist/webview/SceSimEditorEnvelopeApp.js" }, }), ]), - backendProxy: backendProxy, }); KogitoVsCode.startExtension({ @@ -69,7 +60,6 @@ export function activate(context: vscode.ExtensionContext) { envelopeContent: { type: EnvelopeContentType.PATH, path: "dist/webview/NewDmnEditorEnvelopeApp.js" }, }), ]), - backendProxy: backendProxy, }); KogitoVsCode.VsCodeRecommendation.showExtendedServicesRecommendation(context); @@ -78,5 +68,5 @@ export function activate(context: vscode.ExtensionContext) { } export function deactivate() { - backendProxy?.stopServices(); + console.info("Extension is deactivated."); } diff --git a/packages/dmn-vscode-extension/webpack.config.js b/packages/dmn-vscode-extension/webpack.config.js index be947339e93..3086d7b2830 100644 --- a/packages/dmn-vscode-extension/webpack.config.js +++ b/packages/dmn-vscode-extension/webpack.config.js @@ -99,11 +99,5 @@ module.exports = async (webpackEnv) => [ ], }), ], - resolve: { - fallback: { - stream: require.resolve("stream-browserify"), - buffer: require.resolve("buffer/"), - }, - }, }), ]; diff --git a/packages/editor/package.json b/packages/editor/package.json index 2e567161ee9..aef14fe06c5 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -26,7 +26,6 @@ "test": "run-script-if --ignore-errors \"$(build-env tests.ignoreFailures)\" --bool \"$(build-env tests.run)\" --then \"jest --silent --verbose --passWithNoTests\"" }, "dependencies": { - "@kie-tools-core/backend": "workspace:*", "@kie-tools-core/envelope": "workspace:*", "@kie-tools-core/envelope-bus": "workspace:*", "@kie-tools-core/i18n": "workspace:*", diff --git a/packages/editor/src/api/KogitoEditorChannelApi.ts b/packages/editor/src/api/KogitoEditorChannelApi.ts index dfd5fce0ae6..e15c68e3aee 100644 --- a/packages/editor/src/api/KogitoEditorChannelApi.ts +++ b/packages/editor/src/api/KogitoEditorChannelApi.ts @@ -17,7 +17,6 @@ * under the License. */ -import { CapabilityChannelApi } from "@kie-tools-core/backend/dist/channel-api"; import { NotificationsChannelApi } from "@kie-tools-core/notifications/dist/api"; import { I18nChannelApi } from "@kie-tools-core/i18n/dist/api"; import { WorkspaceChannelApi } from "@kie-tools-core/workspace/dist/api"; @@ -26,11 +25,7 @@ import { StateControlCommand } from "./StateControlCommand"; import { EditorTheme } from "./EditorTheme"; import { SharedValueProvider } from "@kie-tools-core/envelope-bus/dist/api"; -export interface KogitoEditorChannelApi - extends I18nChannelApi, - CapabilityChannelApi, - WorkspaceChannelApi, - NotificationsChannelApi { +export interface KogitoEditorChannelApi extends I18nChannelApi, WorkspaceChannelApi, NotificationsChannelApi { kogitoEditor_ready(): void; kogitoEditor_setContentError(content: EditorContent): void; kogitoEditor_stateControlCommandUpdate(command: StateControlCommand): void; diff --git a/packages/kie-editors-dev-vscode-extension/package.json b/packages/kie-editors-dev-vscode-extension/package.json index cb21f557cc2..88b1726ac2e 100644 --- a/packages/kie-editors-dev-vscode-extension/package.json +++ b/packages/kie-editors-dev-vscode-extension/package.json @@ -30,7 +30,6 @@ "watch": "export WEBPACK__sourceMaps=true; WEBPACK__minimize=false; webpack --env dev" }, "dependencies": { - "@kie-tools-core/backend": "workspace:*", "@kie-tools-core/editor": "workspace:*", "@kie-tools-core/envelope": "workspace:*", "@kie-tools-core/i18n": "workspace:*", diff --git a/packages/kie-editors-dev-vscode-extension/src/extension/extension.ts b/packages/kie-editors-dev-vscode-extension/src/extension/extension.ts index 6c16d35aaf4..70df0a5be2d 100644 --- a/packages/kie-editors-dev-vscode-extension/src/extension/extension.ts +++ b/packages/kie-editors-dev-vscode-extension/src/extension/extension.ts @@ -17,22 +17,14 @@ * under the License. */ -import { backendI18nDefaults, backendI18nDictionaries } from "@kie-tools-core/backend/dist/i18n"; -import { VsCodeBackendProxy } from "@kie-tools-core/backend/dist/vscode"; import { EditorEnvelopeLocator, EnvelopeContentType, EnvelopeMapping } from "@kie-tools-core/editor/dist/api"; -import { I18n } from "@kie-tools-core/i18n/dist/core"; import * as KogitoVsCode from "@kie-tools-core/vscode-extension"; import * as vscode from "vscode"; import { generateFormsCommand } from "@kie-tools/form-code-generator-vscode-command/dist/generateFormCodeCommand"; -let backendProxy: VsCodeBackendProxy; - export async function activate(context: vscode.ExtensionContext) { console.info("Extension is alive."); - const backendI18n = new I18n(backendI18nDefaults, backendI18nDictionaries, vscode.env.language); - backendProxy = new VsCodeBackendProxy(context, backendI18n); - KogitoVsCode.startExtension({ extensionName: "kie-group.kie-editors-dev-vscode-extension", context: context, @@ -65,7 +57,6 @@ export async function activate(context: vscode.ExtensionContext) { envelopeContent: { type: EnvelopeContentType.PATH, path: "dist/webview/PMMLEditorEnvelopeApp.js" }, }), ]), - backendProxy: backendProxy, }); context.subscriptions.push( @@ -78,5 +69,5 @@ export async function activate(context: vscode.ExtensionContext) { } export function deactivate() { - backendProxy?.stopServices(); + console.info("Extension is deactivated."); } diff --git a/packages/kie-editors-standalone/package.json b/packages/kie-editors-standalone/package.json index 1363eec9c35..3f5049949a6 100644 --- a/packages/kie-editors-standalone/package.json +++ b/packages/kie-editors-standalone/package.json @@ -42,7 +42,6 @@ "@babel/core": "^7.16.0", "@babel/preset-env": "^7.16.0", "@babel/preset-react": "^7.16.0", - "@kie-tools-core/backend": "workspace:*", "@kie-tools-core/editor": "workspace:*", "@kie-tools-core/envelope-bus": "workspace:*", "@kie-tools-core/i18n": "workspace:*", diff --git a/packages/pmml-vscode-extension/package.json b/packages/pmml-vscode-extension/package.json index d19ca6c7414..80d800ba83b 100644 --- a/packages/pmml-vscode-extension/package.json +++ b/packages/pmml-vscode-extension/package.json @@ -25,7 +25,6 @@ "watch": "export WEBPACK__sourceMaps=true; WEBPACK__minimize=false; webpack --env dev" }, "dependencies": { - "@kie-tools-core/backend": "workspace:*", "@kie-tools-core/editor": "workspace:*", "@kie-tools-core/i18n": "workspace:*", "@kie-tools-core/monaco-editor": "workspace:*", diff --git a/packages/pmml-vscode-extension/src/extension/extension.ts b/packages/pmml-vscode-extension/src/extension/extension.ts index f2c5d052a9c..80327590198 100644 --- a/packages/pmml-vscode-extension/src/extension/extension.ts +++ b/packages/pmml-vscode-extension/src/extension/extension.ts @@ -17,26 +17,13 @@ * under the License. */ -import { backendI18nDefaults, backendI18nDictionaries } from "@kie-tools-core/backend/dist/i18n"; -import { VsCodeBackendProxy } from "@kie-tools-core/backend/dist/vscode"; import { EditorEnvelopeLocator, EnvelopeContentType, EnvelopeMapping } from "@kie-tools-core/editor/dist/api"; -import { I18n } from "@kie-tools-core/i18n/dist/core"; import * as KogitoVsCode from "@kie-tools-core/vscode-extension"; import * as vscode from "vscode"; -let backendProxy: VsCodeBackendProxy; - export function activate(context: vscode.ExtensionContext) { console.info("Extension is alive."); - const backendI18n = new I18n(backendI18nDefaults, backendI18nDictionaries, vscode.env.language); - backendProxy = new VsCodeBackendProxy(context, backendI18n); - - const pmmlEnvelope = { - envelopePath: "dist/webview/PmmlEditorEnvelopeApp.js", - resourcesPathPrefix: "dist/webview/editors/pmml", - }; - KogitoVsCode.startExtension({ extensionName: "kie-group.pmml-vscode-extension", context: context, @@ -49,12 +36,11 @@ export function activate(context: vscode.ExtensionContext) { envelopeContent: { type: EnvelopeContentType.PATH, path: "dist/webview/PmmlEditorEnvelopeApp.js" }, }), ]), - backendProxy: backendProxy, }); console.info("Extension is successfully setup."); } export function deactivate() { - backendProxy?.stopServices(); + console.info("Extension is deactivated."); } diff --git a/packages/serverless-workflow-vscode-extension/package.json b/packages/serverless-workflow-vscode-extension/package.json index 50e4a75384e..22d25c03228 100644 --- a/packages/serverless-workflow-vscode-extension/package.json +++ b/packages/serverless-workflow-vscode-extension/package.json @@ -30,7 +30,6 @@ "watch": "export WEBPACK__sourceMaps=true; WEBPACK__minimize=false; webpack --env dev" }, "dependencies": { - "@kie-tools-core/backend": "workspace:*", "@kie-tools-core/editor": "workspace:*", "@kie-tools-core/envelope-bus": "workspace:*", "@kie-tools-core/i18n": "workspace:*", diff --git a/packages/serverless-workflow-vscode-extension/src/extension/ServerlessWorkflowDiagramEditorChannelApiImpl.ts b/packages/serverless-workflow-vscode-extension/src/extension/ServerlessWorkflowDiagramEditorChannelApiImpl.ts index 4f6bb260d5b..9bb9c15708e 100644 --- a/packages/serverless-workflow-vscode-extension/src/extension/ServerlessWorkflowDiagramEditorChannelApiImpl.ts +++ b/packages/serverless-workflow-vscode-extension/src/extension/ServerlessWorkflowDiagramEditorChannelApiImpl.ts @@ -17,7 +17,6 @@ * under the License. */ -import { BackendProxy } from "@kie-tools-core/backend/dist/api"; import { EditorContent, EditorTheme, @@ -68,7 +67,6 @@ export class ServerlessWorkflowDiagramEditorChannelApiImpl implements Serverless private readonly editor: VsCodeKieEditorController, resourceContentService: ResourceContentService, vscodeWorkspace: VsCodeWorkspaceChannelApiImpl, - backendProxy: BackendProxy, vscodeNotifications: VsCodeNotificationsChannelApiImpl, javaCodeCompletionApi: JavaCodeCompletionApi, viewType: string, @@ -81,7 +79,6 @@ export class ServerlessWorkflowDiagramEditorChannelApiImpl implements Serverless editor, resourceContentService, vscodeWorkspace, - backendProxy, vscodeNotifications, javaCodeCompletionApi, viewType, diff --git a/packages/serverless-workflow-vscode-extension/src/extension/ServerlessWorkflowDiagramEditorChannelApiProducer.ts b/packages/serverless-workflow-vscode-extension/src/extension/ServerlessWorkflowDiagramEditorChannelApiProducer.ts index b27d32ba3a9..4f4ee671e4d 100644 --- a/packages/serverless-workflow-vscode-extension/src/extension/ServerlessWorkflowDiagramEditorChannelApiProducer.ts +++ b/packages/serverless-workflow-vscode-extension/src/extension/ServerlessWorkflowDiagramEditorChannelApiProducer.ts @@ -17,10 +17,8 @@ * under the License. */ -import { BackendProxy } from "@kie-tools-core/backend/dist/api"; import { KogitoEditorChannelApi } from "@kie-tools-core/editor/dist/api"; import { I18n } from "@kie-tools-core/i18n/dist/core"; -import { NotificationsChannelApi } from "@kie-tools-core/notifications/dist/api"; import { VsCodeI18n } from "@kie-tools-core/vscode-extension/dist/i18n"; import { VsCodeKieEditorChannelApiProducer } from "@kie-tools-core/vscode-extension/dist/VsCodeKieEditorChannelApiProducer"; import { VsCodeKieEditorController } from "@kie-tools-core/vscode-extension/dist/VsCodeKieEditorController"; @@ -47,7 +45,6 @@ export class ServerlessWorkflowDiagramEditorChannelApiProducer implements VsCode editor: VsCodeKieEditorController, resourceContentService: ResourceContentService, vscodeWorkspace: VsCodeWorkspaceChannelApiImpl, - backendProxy: BackendProxy, vscodeNotifications: VsCodeNotificationsChannelApiImpl, javaCodeCompletionApi: JavaCodeCompletionApi, viewType: string, @@ -57,7 +54,6 @@ export class ServerlessWorkflowDiagramEditorChannelApiProducer implements VsCode editor, resourceContentService, vscodeWorkspace, - backendProxy, vscodeNotifications, javaCodeCompletionApi, viewType, diff --git a/packages/serverless-workflow-vscode-extension/src/extension/extension.ts b/packages/serverless-workflow-vscode-extension/src/extension/extension.ts index 3a0ae3d8d3f..795caa83801 100644 --- a/packages/serverless-workflow-vscode-extension/src/extension/extension.ts +++ b/packages/serverless-workflow-vscode-extension/src/extension/extension.ts @@ -17,10 +17,7 @@ * under the License. */ -import { backendI18nDefaults, backendI18nDictionaries } from "@kie-tools-core/backend/dist/i18n"; -import { VsCodeBackendProxy } from "@kie-tools-core/backend/dist/vscode/VsCodeBackendProxy"; import { EditorEnvelopeLocator, EnvelopeContentType, EnvelopeMapping } from "@kie-tools-core/editor/dist/api"; -import { I18n } from "@kie-tools-core/i18n/dist/core"; import * as KieToolsVsCodeExtensions from "@kie-tools-core/vscode-extension"; import * as vscode from "vscode"; import { ServerlessWorkflowDiagramEditorChannelApiProducer } from "./ServerlessWorkflowDiagramEditorChannelApiProducer"; @@ -38,14 +35,6 @@ import { RedHatAuthExtensionStateStore } from "./RedHatAuthExtensionStateStore"; export async function activate(context: vscode.ExtensionContext) { console.info("Extension is alive."); - const backendI18n = new I18n(backendI18nDefaults, backendI18nDictionaries, vscode.env.language); - const backendProxy = new VsCodeBackendProxy(context, backendI18n); - context.subscriptions.push( - new vscode.Disposable(() => { - return backendProxy.stopServices(); - }) - ); - const configuration = new SwfVsCodeExtensionConfiguration(); const redhatAuthExtensionStateStore = new RedHatAuthExtensionStateStore(); @@ -101,7 +90,6 @@ export async function activate(context: vscode.ExtensionContext) { vsCodeSwfLanguageService, swfServiceCatalogSupportActions, }), - backendProxy, }); setupBuiltInVsCodeEditorSwfContributions({ diff --git a/packages/vscode-extension-dashbuilder-editor/package.json b/packages/vscode-extension-dashbuilder-editor/package.json index 24d93d939fc..ac939c34eef 100644 --- a/packages/vscode-extension-dashbuilder-editor/package.json +++ b/packages/vscode-extension-dashbuilder-editor/package.json @@ -28,7 +28,6 @@ "watch": "export WEBPACK__sourceMaps=true; WEBPACK__minimize=false; webpack --env dev" }, "dependencies": { - "@kie-tools-core/backend": "workspace:*", "@kie-tools-core/editor": "workspace:*", "@kie-tools-core/envelope-bus": "workspace:*", "@kie-tools-core/i18n": "workspace:*", diff --git a/packages/vscode-extension-dashbuilder-editor/src/api/DashbuilderViewerChannelApiImpl.ts b/packages/vscode-extension-dashbuilder-editor/src/api/DashbuilderViewerChannelApiImpl.ts index d215c7984f4..e1162ce0797 100644 --- a/packages/vscode-extension-dashbuilder-editor/src/api/DashbuilderViewerChannelApiImpl.ts +++ b/packages/vscode-extension-dashbuilder-editor/src/api/DashbuilderViewerChannelApiImpl.ts @@ -17,7 +17,6 @@ * under the License. */ -import { BackendProxy } from "@kie-tools-core/backend/dist/api"; import { EditorContent, EditorTheme, @@ -25,7 +24,6 @@ import { StateControlCommand, } from "@kie-tools-core/editor/dist/api"; import { SharedValueProvider } from "@kie-tools-core/envelope-bus/dist/api"; - import { I18n } from "@kie-tools-core/i18n/dist/core"; import { Notification } from "@kie-tools-core/notifications/dist/api"; import { DefaultVsCodeKieEditorChannelApiImpl } from "@kie-tools-core/vscode-extension/dist/DefaultVsCodeKieEditorChannelApiImpl"; @@ -53,7 +51,6 @@ export class DashbuilderViewerChannelApiImpl implements DashbuilderViewerChannel private readonly editor: VsCodeKieEditorController, resourceContentService: ResourceContentService, vscodeWorkspace: VsCodeWorkspaceChannelApiImpl, - backendProxy: BackendProxy, vscodeNotifications: VsCodeNotificationsChannelApiImpl, javaCodeCompletionApi: JavaCodeCompletionApi, viewType: string, @@ -64,7 +61,6 @@ export class DashbuilderViewerChannelApiImpl implements DashbuilderViewerChannel editor, resourceContentService, vscodeWorkspace, - backendProxy, vscodeNotifications, javaCodeCompletionApi, viewType, diff --git a/packages/vscode-extension-dashbuilder-editor/src/api/DashbuilderViewerChannelApiProducer.ts b/packages/vscode-extension-dashbuilder-editor/src/api/DashbuilderViewerChannelApiProducer.ts index 915047fe55a..1ab077ded67 100644 --- a/packages/vscode-extension-dashbuilder-editor/src/api/DashbuilderViewerChannelApiProducer.ts +++ b/packages/vscode-extension-dashbuilder-editor/src/api/DashbuilderViewerChannelApiProducer.ts @@ -17,7 +17,6 @@ * under the License. */ -import { BackendProxy } from "@kie-tools-core/backend/dist/api"; import { KogitoEditorChannelApi } from "@kie-tools-core/editor/dist/api"; import { I18n } from "@kie-tools-core/i18n/dist/core"; import { VsCodeKieEditorChannelApiProducer } from "@kie-tools-core/vscode-extension/dist/VsCodeKieEditorChannelApiProducer"; @@ -40,7 +39,6 @@ export class DashbuilderViewerChannelApiProducer implements VsCodeKieEditorChann editor: VsCodeKieEditorController, resourceContentService: ResourceContentService, vscodeWorkspace: VsCodeWorkspaceChannelApiImpl, - backendProxy: BackendProxy, vscodeNotifications: VsCodeNotificationsChannelApiImpl, javaCodeCompletionApi: JavaCodeCompletionApi, viewType: string, @@ -50,7 +48,6 @@ export class DashbuilderViewerChannelApiProducer implements VsCodeKieEditorChann editor, resourceContentService, vscodeWorkspace, - backendProxy, vscodeNotifications, javaCodeCompletionApi, viewType, diff --git a/packages/vscode-extension-dashbuilder-editor/src/browser/extension.ts b/packages/vscode-extension-dashbuilder-editor/src/browser/extension.ts index de680573e4c..022091a9e0a 100644 --- a/packages/vscode-extension-dashbuilder-editor/src/browser/extension.ts +++ b/packages/vscode-extension-dashbuilder-editor/src/browser/extension.ts @@ -17,8 +17,6 @@ * under the License. */ -import { backendI18nDefaults, backendI18nDictionaries } from "@kie-tools-core/backend/dist/i18n"; -import { VsCodeBackendProxy } from "@kie-tools-core/backend/dist/vscode"; import { EditorEnvelopeLocator, EnvelopeContentType, EnvelopeMapping } from "@kie-tools-core/editor/dist/api"; import { I18n } from "@kie-tools-core/i18n/dist/core"; import * as KogitoVsCode from "@kie-tools-core/vscode-extension"; @@ -34,15 +32,6 @@ const componentServerUrl = "https://start.kubesmarts.org/dashbuilder-client/dash export async function activate(context: vscode.ExtensionContext) { console.info("Extension is alive."); - const backendI18n = new I18n(backendI18nDefaults, backendI18nDictionaries, vscode.env.language); - const backendProxy = new VsCodeBackendProxy(context, backendI18n); - - context.subscriptions.push( - new vscode.Disposable(() => { - return backendProxy.stopServices(); - }) - ); - const kieEditorsStore = await KogitoVsCode.startExtension({ extensionName: "kie-group.vscode-extension-dashbuilder-editor", context: context, @@ -57,7 +46,6 @@ export async function activate(context: vscode.ExtensionContext) { }), ]), channelApiProducer: new DashbuilderViewerChannelApiProducer(new Promise((resolve) => resolve(componentServerUrl))), - backendProxy: backendProxy, }); const configuration = new DashbuilderVsCodeExtensionConfiguration(); diff --git a/packages/vscode-extension-dashbuilder-editor/src/extension/ComponentsHttpServer.ts b/packages/vscode-extension-dashbuilder-editor/src/extension/ComponentsHttpServer.ts index ba194c99e5d..4df2fd7e324 100644 --- a/packages/vscode-extension-dashbuilder-editor/src/extension/ComponentsHttpServer.ts +++ b/packages/vscode-extension-dashbuilder-editor/src/extension/ComponentsHttpServer.ts @@ -17,14 +17,14 @@ * under the License. */ -import { LocalHttpServer } from "@kie-tools-core/backend/dist/api"; import { getPortPromise } from "portfinder"; import * as http from "http"; import * as fs from "fs"; import * as path from "path"; -export class ComponentServer extends LocalHttpServer { +export class ComponentServer { private server: http.Server; + public port: number | undefined; requestListener = (request: any, response: any) => { if (["/", "", "index.html"].includes(request.url)) { @@ -33,8 +33,8 @@ export class ComponentServer extends LocalHttpServer { return; } - var userInput = path.normalize(request.url).replace(/^(\.\.(\/|\\|$))+/, ""); - var filePath = path.join(this.componentsPath, userInput); + const userInput = path.normalize(request.url).replace(/^(\.\.(\/|\\|$))+/, ""); + const filePath = path.join(this.componentsPath, userInput); if (filePath.indexOf(this.componentsPath) !== 0) { console.debug("Denying access to file " + filePath); response.writeHead(403); @@ -58,9 +58,7 @@ export class ComponentServer extends LocalHttpServer { }); }; - constructor(private readonly componentsPath: string) { - super(); - } + constructor(private readonly componentsPath: string) {} identify(): string { return "Components HTTP Server"; diff --git a/packages/vscode-extension-dashbuilder-editor/src/extension/extension.ts b/packages/vscode-extension-dashbuilder-editor/src/extension/extension.ts index 3ff9bf0eb92..d58f50fb70d 100644 --- a/packages/vscode-extension-dashbuilder-editor/src/extension/extension.ts +++ b/packages/vscode-extension-dashbuilder-editor/src/extension/extension.ts @@ -17,14 +17,10 @@ * under the License. */ -import { backendI18nDefaults, backendI18nDictionaries } from "@kie-tools-core/backend/dist/i18n"; -import { VsCodeBackendProxy } from "@kie-tools-core/backend/dist/vscode"; import { EditorEnvelopeLocator, EnvelopeContentType, EnvelopeMapping } from "@kie-tools-core/editor/dist/api"; -import { I18n } from "@kie-tools-core/i18n/dist/core"; import * as KogitoVsCode from "@kie-tools-core/vscode-extension"; import * as vscode from "vscode"; import * as path from "path"; -import { BackendManagerService } from "@kie-tools-core/backend/dist/api"; import { ComponentServer } from "./ComponentsHttpServer"; import { DashbuilderVsCodeExtensionConfiguration } from "./configuration"; import { setupDashboardEditorControls } from "./setupDashboardEditorControls"; @@ -32,26 +28,16 @@ import { DashbuilderViewerChannelApiProducer } from "../api/DashbuilderViewerCha import { setupBuiltInVsCodeEditorDashbuilderContributions } from "./builtInVsCodeEditorDashbuilderContributions"; import { VsCodeDashbuilderLanguageService } from "./languageService/VsCodeDashbuilderLanguageService"; -let backendProxy: VsCodeBackendProxy; - export async function activate(context: vscode.ExtensionContext) { console.info("Extension is alive."); const componentsPath = path.join(context.extensionPath, "/dist/webview/dashbuilder/component/"); const componentServer = new ComponentServer(componentsPath); - const backendI18n = new I18n(backendI18nDefaults, backendI18nDictionaries, vscode.env.language); - const backendManager = new BackendManagerService({ localHttpServer: componentServer }); - backendProxy = new VsCodeBackendProxy(context, backendI18n); - - backendProxy.registerBackendManager(backendManager); - - await backendManager.start().catch((e) => { - console.info("Not able to start component server."); - }); + componentServer.start(); context.subscriptions.push( new vscode.Disposable(() => { - return backendProxy.stopServices(); + return componentServer.stop(); }) ); @@ -70,11 +56,10 @@ export async function activate(context: vscode.ExtensionContext) { ]), channelApiProducer: new DashbuilderViewerChannelApiProducer( new Promise((resolve) => { - const componentServerUrl = `http://localhost:${componentServer.getPort()}`; + const componentServerUrl = `http://localhost:${componentServer.port}`; resolve(componentServerUrl); }) ), - backendProxy: backendProxy, }); const configuration = new DashbuilderVsCodeExtensionConfiguration(); diff --git a/packages/vscode-extension/package.json b/packages/vscode-extension/package.json index 23dbebb4bfb..5d77e5129c8 100644 --- a/packages/vscode-extension/package.json +++ b/packages/vscode-extension/package.json @@ -26,7 +26,6 @@ "test": "run-script-if --ignore-errors \"$(build-env tests.ignoreFailures)\" --bool \"$(build-env tests.run)\" --then \"jest --silent --verbose --passWithNoTests\"" }, "dependencies": { - "@kie-tools-core/backend": "workspace:*", "@kie-tools-core/editor": "workspace:*", "@kie-tools-core/envelope-bus": "workspace:*", "@kie-tools-core/i18n": "workspace:*", diff --git a/packages/vscode-extension/src/DefaultVsCodeKieEditorChannelApiImpl.ts b/packages/vscode-extension/src/DefaultVsCodeKieEditorChannelApiImpl.ts index b1a3112ace7..54f20d27ff1 100644 --- a/packages/vscode-extension/src/DefaultVsCodeKieEditorChannelApiImpl.ts +++ b/packages/vscode-extension/src/DefaultVsCodeKieEditorChannelApiImpl.ts @@ -17,7 +17,6 @@ * under the License. */ -import { BackendProxy } from "@kie-tools-core/backend/dist/api"; import { EditorContent, KogitoEditorChannelApi, StateControlCommand } from "@kie-tools-core/editor/dist/api"; import { I18n } from "@kie-tools-core/i18n/dist/core"; import { Notification } from "@kie-tools-core/notifications/dist/api"; @@ -47,7 +46,6 @@ export class DefaultVsCodeKieEditorChannelApiImpl implements KogitoEditorChannel protected readonly editor: VsCodeKieEditorController, protected readonly resourceContentService: ResourceContentService, protected readonly vscodeWorkspace: VsCodeWorkspaceChannelApiImpl, - protected readonly backendProxy: BackendProxy, protected readonly vscodeNotifications: VsCodeNotificationsChannelApiImpl, protected readonly javaCodeCompletionApi: JavaCodeCompletionApi, protected readonly viewType: string, diff --git a/packages/vscode-extension/src/VsCodeKieEditorChannelApiProducer.ts b/packages/vscode-extension/src/VsCodeKieEditorChannelApiProducer.ts index f2d569fd9b5..910a4c157f3 100644 --- a/packages/vscode-extension/src/VsCodeKieEditorChannelApiProducer.ts +++ b/packages/vscode-extension/src/VsCodeKieEditorChannelApiProducer.ts @@ -19,9 +19,7 @@ import { KogitoEditorChannelApi } from "@kie-tools-core/editor/dist/api"; import { VsCodeKieEditorController } from "./VsCodeKieEditorController"; -import { ResourceContentService, WorkspaceChannelApi } from "@kie-tools-core/workspace/dist/api"; -import { BackendProxy } from "@kie-tools-core/backend/dist/api"; -import { NotificationsChannelApi } from "@kie-tools-core/notifications/dist/api"; +import { ResourceContentService } from "@kie-tools-core/workspace/dist/api"; import { JavaCodeCompletionApi } from "@kie-tools-core/vscode-java-code-completion/dist/api"; import { I18n } from "@kie-tools-core/i18n/dist/core"; import { VsCodeI18n } from "./i18n"; @@ -39,7 +37,6 @@ export interface VsCodeKieEditorChannelApiProducer { * @param editor * @param resourceContentService * @param vscodeWorkspace - * @param backendProxy * @param vscodeNotifications * @param javaCodeCompletionApi * @param viewType @@ -49,7 +46,6 @@ export interface VsCodeKieEditorChannelApiProducer { editor: VsCodeKieEditorController, resourceContentService: ResourceContentService, vscodeWorkspace: VsCodeWorkspaceChannelApiImpl, - backendProxy: BackendProxy, vscodeNotifications: VsCodeNotificationsChannelApiImpl, javaCodeCompletionApi: JavaCodeCompletionApi, viewType: string, @@ -62,7 +58,6 @@ export class DefaultVsCodeEditorChannelApiProducer implements VsCodeKieEditorCha editor: VsCodeKieEditorController, resourceContentService: ResourceContentService, vscodeWorkspace: VsCodeWorkspaceChannelApiImpl, - backendProxy: BackendProxy, vscodeNotifications: VsCodeNotificationsChannelApiImpl, javaCodeCompletionApi: JavaCodeCompletionApi, viewType: string, @@ -72,7 +67,6 @@ export class DefaultVsCodeEditorChannelApiProducer implements VsCodeKieEditorCha editor, resourceContentService, vscodeWorkspace, - backendProxy, vscodeNotifications, javaCodeCompletionApi, viewType, diff --git a/packages/vscode-extension/src/VsCodeKieEditorControllerFactory.ts b/packages/vscode-extension/src/VsCodeKieEditorControllerFactory.ts index eeca06c13e5..79701998c8f 100644 --- a/packages/vscode-extension/src/VsCodeKieEditorControllerFactory.ts +++ b/packages/vscode-extension/src/VsCodeKieEditorControllerFactory.ts @@ -20,9 +20,7 @@ import * as vscode from "vscode"; import { Uri, Webview } from "vscode"; import * as __path from "path"; -import { NotificationsChannelApi } from "@kie-tools-core/notifications/dist/api"; -import { BackendProxy } from "@kie-tools-core/backend/dist/api"; -import { ResourceContentService, WorkspaceChannelApi } from "@kie-tools-core/workspace/dist/api"; +import { ResourceContentService } from "@kie-tools-core/workspace/dist/api"; import { EditorEnvelopeLocator, EnvelopeContent, @@ -53,7 +51,6 @@ export class VsCodeKieEditorControllerFactory { private readonly editorEnvelopeLocator: EditorEnvelopeLocator, private readonly messageBroadcaster: EnvelopeBusMessageBroadcaster, private readonly vscodeWorkspace: VsCodeWorkspaceChannelApiImpl, - private readonly backendProxy: BackendProxy, private readonly vscodeNotifications: VsCodeNotificationsChannelApiImpl, private readonly javaCodeCompletionApi: JavaCodeCompletionApi, private readonly viewType: string, @@ -120,7 +117,6 @@ export class VsCodeKieEditorControllerFactory { editor, resourceContentService, this.vscodeWorkspace, - this.backendProxy, this.vscodeNotifications, this.javaCodeCompletionApi, this.viewType, diff --git a/packages/vscode-extension/src/index.ts b/packages/vscode-extension/src/index.ts index fa5d8941fdf..3841bace3bb 100644 --- a/packages/vscode-extension/src/index.ts +++ b/packages/vscode-extension/src/index.ts @@ -17,7 +17,6 @@ * under the License. */ -import { VsCodeBackendProxy } from "@kie-tools-core/backend/dist/vscode"; import { EditorEnvelopeLocator } from "@kie-tools-core/editor/dist/api"; import { I18n } from "@kie-tools-core/i18n/dist/core"; import { VsCodeJavaCodeCompletionApiImpl } from "@kie-tools-core/vscode-java-code-completion/dist/vscode"; @@ -42,7 +41,6 @@ import { VsCodeRecommendation } from "./VsCodeRecommendation"; * @param args.webviewLocation The relative path to search for an "index.js" file for the WebView panel. * @param args.context The vscode.ExtensionContext provided on the activate method of the extension. * @param args.routes The routes to be used to find resources for each language. - * @param args.backendProxy The proxy between channels and available backend services. * @param args.channelApiProducer Optional producer of custom KogitoEditorChannelApi instances. */ export async function startExtension(args: { @@ -52,12 +50,9 @@ export async function startExtension(args: { generateSvgCommandId?: string; silentlyGenerateSvgCommandId?: string; editorEnvelopeLocator: EditorEnvelopeLocator; - backendProxy: VsCodeBackendProxy; channelApiProducer?: VsCodeKieEditorChannelApiProducer; editorDocumentType?: "text" | "custom"; }) { - await args.backendProxy.tryLoadBackendExtension(true); - const i18n = new I18n(vsCodeI18nDefaults, vsCodeI18nDictionaries, vscode.env.language); const vscodeWorkspace = new VsCodeWorkspaceChannelApiImpl(); const editorStore = new VsCodeKieEditorStore(); @@ -71,7 +66,6 @@ export async function startExtension(args: { args.editorEnvelopeLocator, messageBroadcaster, vscodeWorkspace, - args.backendProxy, vscodeNotifications, vsCodeJavaCodeCompletionChannelApi, args.viewType, diff --git a/packages/webpack-base/package.json b/packages/webpack-base/package.json index 5c76fa380ec..a6bd94a7ed6 100644 --- a/packages/webpack-base/package.json +++ b/packages/webpack-base/package.json @@ -24,6 +24,7 @@ "path-browserify": "^1.0.1", "querystring-es3": "^0.2.1", "source-map-loader": "^2.0.2", + "stream-browserify": "^3.0.0", "ts-loader": "^9.4.2", "webpack": "^5.94.0" } diff --git a/packages/webpack-base/webpack.common.config.js b/packages/webpack-base/webpack.common.config.js index a10f0c908fe..b2f85e6d8bf 100644 --- a/packages/webpack-base/webpack.common.config.js +++ b/packages/webpack-base/webpack.common.config.js @@ -121,6 +121,7 @@ module.exports = (webpackEnv) => { child_process: false, net: false, buffer: require.resolve("buffer/"), + stream: require.resolve("stream-browserify"), querystring: require.resolve("querystring-es3"), }, extensions: [".tsx", ".ts", ".js", ".jsx"], diff --git a/packages/yard-vscode-extension/package.json b/packages/yard-vscode-extension/package.json index ecff850f0e5..ab377802792 100644 --- a/packages/yard-vscode-extension/package.json +++ b/packages/yard-vscode-extension/package.json @@ -29,7 +29,6 @@ "watch": "export WEBPACK__sourceMaps=true; WEBPACK__minimize=false; webpack --env dev" }, "dependencies": { - "@kie-tools-core/backend": "workspace:*", "@kie-tools-core/editor": "workspace:*", "@kie-tools-core/envelope-bus": "workspace:*", "@kie-tools-core/i18n": "workspace:*", diff --git a/packages/yard-vscode-extension/src/extension/extension.ts b/packages/yard-vscode-extension/src/extension/extension.ts index 99e0400b3a1..d69310687b4 100644 --- a/packages/yard-vscode-extension/src/extension/extension.ts +++ b/packages/yard-vscode-extension/src/extension/extension.ts @@ -17,27 +17,15 @@ * under the License. */ -import { backendI18nDefaults, backendI18nDictionaries } from "@kie-tools-core/backend/dist/i18n"; -import { VsCodeBackendProxy } from "@kie-tools-core/backend/dist/vscode/VsCodeBackendProxy"; import { EditorEnvelopeLocator, EnvelopeContentType, EnvelopeMapping } from "@kie-tools-core/editor/dist/api"; -import { I18n } from "@kie-tools-core/i18n/dist/core"; import * as KieToolsVsCodeExtensions from "@kie-tools-core/vscode-extension"; import * as vscode from "vscode"; import { YardVsCodeExtensionConfiguration, WEBVIEW_EDITOR_VIEW_TYPE } from "./configuration"; import { setupDiagramEditorControls } from "./setupDiagramEditorControls"; -import { COMMAND_IDS } from "./commandIds"; export async function activate(context: vscode.ExtensionContext) { console.info("Extension is alive."); - const backendI18n = new I18n(backendI18nDefaults, backendI18nDictionaries, vscode.env.language); - const backendProxy = new VsCodeBackendProxy(context, backendI18n); - context.subscriptions.push( - new vscode.Disposable(() => { - return backendProxy.stopServices(); - }) - ); - const configuration = new YardVsCodeExtensionConfiguration(); const kieEditorsStore = await KieToolsVsCodeExtensions.startExtension({ @@ -53,7 +41,6 @@ export async function activate(context: vscode.ExtensionContext) { envelopeContent: { type: EnvelopeContentType.PATH, path: "dist/webview/YardEditorEnvelopeApp.js" }, }), ]), - backendProxy, }); await setupDiagramEditorControls({ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d553e306137..4e0942d4870 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -183,9 +183,6 @@ importers: examples/base64png-editor-vscode-extension: dependencies: - '@kie-tools-core/backend': - specifier: workspace:* - version: link:../../packages/backend '@kie-tools-core/editor': specifier: workspace:* version: link:../../packages/editor @@ -1018,13 +1015,13 @@ importers: version: 6.2.0(webpack@5.94.0(@swc/core@1.3.92)(esbuild@0.18.20)(webpack-cli@4.10.0)) jest: specifier: ^29.7.0 - version: 29.7.0(@types/node@22.5.2)(node-notifier@8.0.2)(ts-node@10.9.2(@swc/core@1.3.92)(@types/node@22.5.2)(typescript@5.5.3)) + version: 29.7.0(@types/node@20.14.2)(node-notifier@8.0.2)(ts-node@10.9.2(@swc/core@1.3.92)(@types/node@20.14.2)(typescript@5.5.3)) jest-junit: specifier: ^16.0.0 version: 16.0.0 jest-when: specifier: ^3.6.0 - version: 3.6.0(jest@29.7.0(@types/node@22.5.2)(node-notifier@8.0.2)(ts-node@10.9.2(@swc/core@1.3.92)(@types/node@22.5.2)(typescript@5.5.3))) + version: 3.6.0(jest@29.7.0(@types/node@20.14.2)(node-notifier@8.0.2)(ts-node@10.9.2(@swc/core@1.3.92)(@types/node@20.14.2)(typescript@5.5.3))) react-json-view: specifier: ^1.21.3 version: 1.21.3(@types/react@17.0.21)(react-dom@17.0.2(react@17.0.2))(react@17.0.2) @@ -1039,7 +1036,7 @@ importers: version: 7.4.6 ts-jest: specifier: ^29.1.5 - version: 29.1.5(@babel/core@7.16.12)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.16.12))(esbuild@0.18.20)(jest@29.7.0(@types/node@22.5.2)(node-notifier@8.0.2)(ts-node@10.9.2(@swc/core@1.3.92)(@types/node@22.5.2)(typescript@5.5.3)))(typescript@5.5.3) + version: 29.1.5(@babel/core@7.16.12)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.16.12))(esbuild@0.18.20)(jest@29.7.0(@types/node@20.14.2)(node-notifier@8.0.2)(ts-node@10.9.2(@swc/core@1.3.92)(@types/node@20.14.2)(typescript@5.5.3)))(typescript@5.5.3) typescript: specifier: ^5.5.3 version: 5.5.3 @@ -1116,9 +1113,6 @@ importers: packages/bpmn-vscode-extension: dependencies: - '@kie-tools-core/backend': - specifier: workspace:* - version: link:../backend '@kie-tools-core/editor': specifier: workspace:* version: link:../editor @@ -3579,9 +3573,6 @@ importers: '@babel/preset-typescript': specifier: ^7.22.5 version: 7.23.0(@babel/core@7.23.9) - '@kie-tools-core/backend': - specifier: workspace:* - version: link:../backend '@kie-tools-core/editor': specifier: workspace:* version: link:../editor @@ -4038,9 +4029,6 @@ importers: packages/dmn-vscode-extension: dependencies: - '@kie-tools-core/backend': - specifier: workspace:* - version: link:../backend '@kie-tools-core/editor': specifier: workspace:* version: link:../editor @@ -4099,9 +4087,6 @@ importers: rimraf: specifier: ^3.0.2 version: 3.0.2 - stream-browserify: - specifier: 3.0.0 - version: 3.0.0 webpack: specifier: ^5.94.0 version: 5.94.0(webpack-cli@4.10.0) @@ -4117,9 +4102,6 @@ importers: packages/editor: dependencies: - '@kie-tools-core/backend': - specifier: workspace:* - version: link:../backend '@kie-tools-core/envelope': specifier: workspace:* version: link:../envelope @@ -5892,9 +5874,6 @@ importers: packages/kie-editors-dev-vscode-extension: dependencies: - '@kie-tools-core/backend': - specifier: workspace:* - version: link:../backend '@kie-tools-core/editor': specifier: workspace:* version: link:../editor @@ -6052,9 +6031,6 @@ importers: '@babel/preset-react': specifier: ^7.16.0 version: 7.16.0(@babel/core@7.16.12) - '@kie-tools-core/backend': - specifier: workspace:* - version: link:../backend '@kie-tools-core/editor': specifier: workspace:* version: link:../editor @@ -7417,9 +7393,6 @@ importers: packages/pmml-vscode-extension: dependencies: - '@kie-tools-core/backend': - specifier: workspace:* - version: link:../backend '@kie-tools-core/editor': specifier: workspace:* version: link:../editor @@ -10860,9 +10833,6 @@ importers: packages/serverless-workflow-vscode-extension: dependencies: - '@kie-tools-core/backend': - specifier: workspace:* - version: link:../backend '@kie-tools-core/editor': specifier: workspace:* version: link:../editor @@ -12299,9 +12269,6 @@ importers: packages/vscode-extension: dependencies: - '@kie-tools-core/backend': - specifier: workspace:* - version: link:../backend '@kie-tools-core/editor': specifier: workspace:* version: link:../editor @@ -12430,9 +12397,6 @@ importers: packages/vscode-extension-dashbuilder-editor: dependencies: - '@kie-tools-core/backend': - specifier: workspace:* - version: link:../backend '@kie-tools-core/editor': specifier: workspace:* version: link:../editor @@ -12702,6 +12666,9 @@ importers: source-map-loader: specifier: ^2.0.2 version: 2.0.2(webpack@5.94.0) + stream-browserify: + specifier: ^3.0.0 + version: 3.0.0 ts-loader: specifier: ^9.4.2 version: 9.4.2(typescript@5.5.3)(webpack@5.94.0) @@ -13284,9 +13251,6 @@ importers: packages/yard-vscode-extension: dependencies: - '@kie-tools-core/backend': - specifier: workspace:* - version: link:../backend '@kie-tools-core/editor': specifier: workspace:* version: link:../editor @@ -30499,7 +30463,7 @@ snapshots: dependencies: '@ampproject/remapping': 2.3.0 '@angular-devkit/architect': 0.1801.3(chokidar@3.6.0) - '@angular-devkit/build-webpack': 0.1801.3(chokidar@3.6.0)(webpack-dev-server@5.0.4(webpack@5.92.1(esbuild@0.21.5)))(webpack@5.92.1(esbuild@0.21.5)) + '@angular-devkit/build-webpack': 0.1801.3(chokidar@3.6.0)(webpack-dev-server@5.0.4(webpack@5.94.0))(webpack@5.92.1(esbuild@0.21.5)) '@angular-devkit/core': 18.1.3(chokidar@3.6.0) '@angular/build': 18.1.3(@angular/compiler-cli@18.1.3(@angular/compiler@18.1.3(@angular/core@18.1.3(rxjs@7.5.2)(zone.js@0.14.8)))(typescript@5.5.3))(@types/node@22.5.2)(chokidar@3.6.0)(less@4.2.0)(postcss@8.4.38)(stylus@0.59.0)(terser@5.29.2)(typescript@5.5.3) '@angular/compiler-cli': 18.1.3(@angular/compiler@18.1.3(@angular/core@18.1.3(rxjs@7.5.2)(zone.js@0.14.8)))(typescript@5.5.3) @@ -30585,7 +30549,7 @@ snapshots: - utf-8-validate - webpack-cli - '@angular-devkit/build-webpack@0.1801.3(chokidar@3.6.0)(webpack-dev-server@5.0.4(webpack@5.92.1(esbuild@0.21.5)))(webpack@5.92.1(esbuild@0.21.5))': + '@angular-devkit/build-webpack@0.1801.3(chokidar@3.6.0)(webpack-dev-server@5.0.4(webpack@5.94.0))(webpack@5.92.1(esbuild@0.21.5))': dependencies: '@angular-devkit/architect': 0.1801.3(chokidar@3.6.0) rxjs: 7.8.1 @@ -56189,11 +56153,11 @@ snapshots: babel-jest: 29.7.0(@babel/core@7.16.12) esbuild: 0.15.13 - ts-jest@29.1.5(@babel/core@7.16.12)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.16.12))(esbuild@0.18.20)(jest@29.7.0(@types/node@22.5.2)(node-notifier@8.0.2)(ts-node@10.9.2(@swc/core@1.3.92)(@types/node@22.5.2)(typescript@5.5.3)))(typescript@5.5.3): + ts-jest@29.1.5(@babel/core@7.16.12)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.16.12))(esbuild@0.18.20)(jest@29.7.0(@types/node@20.14.2)(node-notifier@8.0.2)(ts-node@10.9.2(@swc/core@1.3.92)(@types/node@20.14.2)(typescript@5.5.3)))(typescript@5.5.3): dependencies: bs-logger: 0.2.6 fast-json-stable-stringify: 2.1.0 - jest: 29.7.0(@types/node@22.5.2)(node-notifier@8.0.2)(ts-node@10.9.2(@swc/core@1.3.92)(@types/node@22.5.2)(typescript@5.5.3)) + jest: 29.7.0(@types/node@20.14.2)(node-notifier@8.0.2)(ts-node@10.9.2(@swc/core@1.3.92)(@types/node@20.14.2)(typescript@5.5.3)) jest-util: 29.7.0 json5: 2.2.3 lodash.memoize: 4.1.2 diff --git a/repo/graph.dot b/repo/graph.dot index 3090bb49c1b..3e22c2ef251 100644 --- a/repo/graph.dot +++ b/repo/graph.dot @@ -39,8 +39,6 @@ digraph G { "@kie-tools-examples/webapp" [ color = "orange", fontcolor = "orange", style = "dashed, rounded" ]; "@kie-tools/kie-editors-standalone" [ color = "blue", fontcolor = "blue", style = "rounded" ]; "@kie-tools/serverless-workflow-standalone-editor" [ color = "blue", fontcolor = "blue", style = "rounded" ]; - "@kie-tools-core/backend" [ color = "purple", fontcolor = "purple", style = "rounded" ]; - "@kie-tools-core/notifications" [ color = "purple", fontcolor = "purple", style = "rounded" ]; "@kie-tools/boxed-expression-component" [ color = "blue", fontcolor = "blue", style = "rounded" ]; "@kie-tools-core/operating-system" [ color = "purple", fontcolor = "purple", style = "rounded" ]; "@kie-tools/feel-input-component" [ color = "blue", fontcolor = "blue", style = "rounded" ]; @@ -112,6 +110,7 @@ digraph G { "@kie-tools/extended-services-api" [ color = "blue", fontcolor = "blue", style = "rounded" ]; "dmn-vscode-extension" [ color = "blue", fontcolor = "blue", style = "rounded" ]; "@kie-tools-core/keyboard-shortcuts" [ color = "purple", fontcolor = "purple", style = "rounded" ]; + "@kie-tools-core/notifications" [ color = "purple", fontcolor = "purple", style = "rounded" ]; "@kie-tools-core/envelope-bus" [ color = "purple", fontcolor = "purple", style = "rounded" ]; "@kie-tools/extended-services" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; "@kie-tools/extended-services-java" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; @@ -244,7 +243,6 @@ digraph G { "@kie-tools-examples/webapp" -> "@kie-tools/dmn-editor-standalone" [ style = "solid", color = "orange" ]; "@kie-tools-examples/webapp" -> "@kie-tools/kie-editors-standalone" [ style = "solid", color = "orange" ]; "@kie-tools-examples/webapp" -> "@kie-tools/serverless-workflow-standalone-editor" [ style = "solid", color = "orange" ]; - "@kie-tools-core/backend" -> "@kie-tools-core/notifications" [ style = "solid", color = "purple" ]; "@kie-tools/boxed-expression-component" -> "@kie-tools-core/operating-system" [ style = "solid", color = "blue" ]; "@kie-tools/boxed-expression-component" -> "@kie-tools/feel-input-component" [ style = "solid", color = "blue" ]; "@kie-tools/boxed-expression-component" -> "@kie-tools/playwright-base" [ style = "dashed", color = "blue" ]; @@ -363,9 +361,9 @@ digraph G { "dmn-vscode-extension" -> "@kie-tools/kie-bc-editors" [ style = "solid", color = "blue" ]; "dmn-vscode-extension" -> "@kie-tools/stunner-editors" [ style = "dashed", color = "blue" ]; "dmn-vscode-extension" -> "@kie-tools/vscode-java-code-completion-extension-plugin" [ style = "dashed", color = "blue" ]; - "@kie-tools-core/editor" -> "@kie-tools-core/backend" [ style = "solid", color = "purple" ]; "@kie-tools-core/editor" -> "@kie-tools-core/envelope" [ style = "solid", color = "purple" ]; "@kie-tools-core/editor" -> "@kie-tools-core/keyboard-shortcuts" [ style = "solid", color = "purple" ]; + "@kie-tools-core/editor" -> "@kie-tools-core/notifications" [ style = "solid", color = "purple" ]; "@kie-tools-core/editor" -> "@kie-tools-core/patternfly-base" [ style = "solid", color = "purple" ]; "@kie-tools-core/envelope" -> "@kie-tools-core/envelope-bus" [ style = "solid", color = "purple" ]; "@kie-tools-core/envelope-bus" -> "@kie-tools/eslint" [ style = "dashed", color = "purple" ]; diff --git a/repo/graph.json b/repo/graph.json index 3ccae914e70..0f3378f7b52 100644 --- a/repo/graph.json +++ b/repo/graph.json @@ -13,9 +13,9 @@ { "id": "@kie-tools/tsconfig" }, { "id": "@kie-tools-examples/base64png-editor" }, { "id": "@kie-tools-core/editor" }, - { "id": "@kie-tools-core/backend" }, { "id": "@kie-tools-core/envelope" }, { "id": "@kie-tools-core/keyboard-shortcuts" }, + { "id": "@kie-tools-core/notifications" }, { "id": "@kie-tools-core/patternfly-base" }, { "id": "@kie-tools-examples/base64png-editor-chrome-extension" }, { "id": "@kie-tools-core/chrome-extension" }, @@ -56,9 +56,6 @@ { "id": "@kie-tools/kie-bc-editors" }, { "id": "@kie-tools/stunner-editors" }, { "id": "@kie-tools/serverless-workflow-combined-editor" }, - { "id": "@kie-tools-core/notifications" }, - { "id": "@kie-tools-core/i18n" }, - { "id": "@kie-tools-core/workspace" }, { "id": "@kie-tools/boxed-expression-component" }, { "id": "@kie-tools-core/operating-system" }, { "id": "@kie-tools/feel-input-component" }, @@ -106,7 +103,9 @@ { "id": "@kie-tools/dashbuilder-viewer-deployment-webapp" }, { "id": "@kie-tools-core/workspaces-git-fs" }, { "id": "@kie-tools-core/react-hooks" }, + { "id": "@kie-tools-core/workspace" }, { "id": "@kie-tools/kie-sandbox-fs" }, + { "id": "@kie-tools-core/i18n" }, { "id": "@kie-tools/dashbuilder-viewer-image" }, { "id": "@kie-tools/dashbuilder-viewer-image-env" }, { "id": "@kie-tools/data-index-webapp" }, @@ -265,11 +264,6 @@ "target": "@kie-tools-core/editor", "weight": 1 }, - { - "source": "@kie-tools-core/editor", - "target": "@kie-tools-core/backend", - "weight": 1 - }, { "source": "@kie-tools-core/editor", "target": "@kie-tools-core/envelope", @@ -282,12 +276,12 @@ }, { "source": "@kie-tools-core/editor", - "target": "@kie-tools-core/patternfly-base", + "target": "@kie-tools-core/notifications", "weight": 1 }, { - "source": "@kie-tools-core/backend", - "target": "@kie-tools-core/notifications", + "source": "@kie-tools-core/editor", + "target": "@kie-tools-core/patternfly-base", "weight": 1 }, { @@ -305,6 +299,16 @@ "target": "@kie-tools-core/operating-system", "weight": 1 }, + { + "source": "@kie-tools-core/notifications", + "target": "@kie-tools-core/i18n", + "weight": 1 + }, + { + "source": "@kie-tools-core/notifications", + "target": "@kie-tools-core/workspace", + "weight": 1 + }, { "source": "@kie-tools-core/patternfly-base", "target": "@kie-tools/root-env", @@ -685,36 +689,6 @@ "target": "@kie-tools/serverless-workflow-text-editor", "weight": 1 }, - { - "source": "@kie-tools-core/notifications", - "target": "@kie-tools-core/i18n", - "weight": 1 - }, - { - "source": "@kie-tools-core/notifications", - "target": "@kie-tools-core/workspace", - "weight": 1 - }, - { - "source": "@kie-tools-core/i18n", - "target": "@kie-tools/eslint", - "weight": 1 - }, - { - "source": "@kie-tools-core/i18n", - "target": "@kie-tools/jest-base", - "weight": 1 - }, - { - "source": "@kie-tools-core/i18n", - "target": "@kie-tools/tsconfig", - "weight": 1 - }, - { - "source": "@kie-tools-core/workspace", - "target": "@kie-tools-core/operating-system", - "weight": 1 - }, { "source": "@kie-tools/boxed-expression-component", "target": "@kie-tools-core/operating-system", @@ -1340,6 +1314,11 @@ "target": "@kie-tools/tsconfig", "weight": 1 }, + { + "source": "@kie-tools-core/workspace", + "target": "@kie-tools-core/operating-system", + "weight": 1 + }, { "source": "@kie-tools/kie-sandbox-fs", "target": "@kie-tools/root-env", @@ -1350,6 +1329,21 @@ "target": "@kie-tools/tsconfig", "weight": 1 }, + { + "source": "@kie-tools-core/i18n", + "target": "@kie-tools/eslint", + "weight": 1 + }, + { + "source": "@kie-tools-core/i18n", + "target": "@kie-tools/jest-base", + "weight": 1 + }, + { + "source": "@kie-tools-core/i18n", + "target": "@kie-tools/tsconfig", + "weight": 1 + }, { "source": "@kie-tools/dashbuilder-viewer-image", "target": "@kie-tools/dashbuilder-viewer-deployment-webapp", @@ -2587,7 +2581,6 @@ ["kie-tools-examples-todo-list-view-vscode-extension", "examples/todo-list-view-vscode-extension"], ["@kie-tools-examples/uniforms-patternfly", "examples/uniforms-patternfly"], ["@kie-tools-examples/webapp", "examples/webapp"], - ["@kie-tools-core/backend", "packages/backend"], ["@kie-tools/boxed-expression-component", "packages/boxed-expression-component"], ["@kie-tools/bpmn-marshaller", "packages/bpmn-marshaller"], ["bpmn-vscode-extension", "packages/bpmn-vscode-extension"],