diff --git a/.yarnrc.yml b/.yarnrc.yml index dc79fc379c..aa654b4428 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -20,7 +20,7 @@ packageExtensions: "@swc/types": "*" "@typescript-eslint/rule-tester@*": dependencies: - "@typescript-eslint/parser": ~8.17.0 + "@typescript-eslint/parser": ~8.18.0 "@angular-eslint/eslint-plugin-template@*": dependencies: "@typescript-eslint/types": "^8.0.0" diff --git a/apps/chrome-devtools/src/app-components/app.component.ts b/apps/chrome-devtools/src/app-components/app.component.ts index 26ac6a3116..e7c0d2f716 100644 --- a/apps/chrome-devtools/src/app-components/app.component.ts +++ b/apps/chrome-devtools/src/app-components/app.component.ts @@ -139,8 +139,7 @@ export class AppComponent { ]).pipe( map(([info, executions]) => executions.filter((execution) => - (execution.rulesetInformation?.linkedComponent?.name === info.componentName) - || (execution.rulesetInformation?.linkedComponents?.or.some((linkedComp) => linkedComp.name === info.componentName)) + (execution.rulesetInformation?.linkedComponents?.or.some((linkedComp) => linkedComp.name === info.componentName)) ) ) ); diff --git a/apps/chrome-devtools/src/app-devtools/component-panel/component-panel-pres.component.ts b/apps/chrome-devtools/src/app-devtools/component-panel/component-panel-pres.component.ts index 3519aae114..6f6c5c96d6 100644 --- a/apps/chrome-devtools/src/app-devtools/component-panel/component-panel-pres.component.ts +++ b/apps/chrome-devtools/src/app-devtools/component-panel/component-panel-pres.component.ts @@ -117,8 +117,7 @@ export class ComponentPanelPresComponent { ]).pipe( map(([info, executions]) => executions.filter((execution) => - (execution.rulesetInformation?.linkedComponent?.name === info.componentName) - || (execution.rulesetInformation?.linkedComponents?.or.some((linkedComp) => linkedComp.name === info.componentName)) + (execution.rulesetInformation?.linkedComponents?.or.some((linkedComp) => linkedComp.name === info.componentName)) ) ) ); diff --git a/apps/chrome-devtools/src/components/otter-component/otter-component.component.ts b/apps/chrome-devtools/src/components/otter-component/otter-component.component.ts index 35948eed59..b4f428b6f5 100644 --- a/apps/chrome-devtools/src/components/otter-component/otter-component.component.ts +++ b/apps/chrome-devtools/src/components/otter-component/otter-component.component.ts @@ -106,9 +106,10 @@ export class OtterComponentComponent implements OnChanges { this.librariesLinkedToRulesetExecutions = [...( new Set((this.rulesetExecutions || []) .flatMap((execution) => { - const linkedComponent = execution.rulesetInformation?.linkedComponent; const linkedComponents = execution.rulesetInformation?.linkedComponents?.or; - return (linkedComponents?.map((lc) => lc.library) || [linkedComponent?.library]).filter((lib): lib is string => !!lib); + return linkedComponents + ? (linkedComponents.map((lc) => lc.library)).filter((lib): lib is string => !!lib) + : []; }) ) )]; diff --git a/docs/ab-testing/AB_TESTING.md b/docs/ab-testing/AB_TESTING.md index 3af64db125..0280aea6b1 100644 --- a/docs/ab-testing/AB_TESTING.md +++ b/docs/ab-testing/AB_TESTING.md @@ -261,5 +261,3 @@ You can now create A/B testing-driven rulesets . } ``` -> Note: In v10 and previously, we used `linkedComponent` property to activate a ruleset on demand. This becomes deprecated and will be removed in v12. Use `linkedComponents` instead; - diff --git a/docs/components/COMPONENT_REPLACEMENT.md b/docs/components/COMPONENT_REPLACEMENT.md index 40408e728f..b87528628d 100644 --- a/docs/components/COMPONENT_REPLACEMENT.md +++ b/docs/components/COMPONENT_REPLACEMENT.md @@ -163,7 +163,8 @@ That information is expected to be a property of the **component's configuration Since configurations **have** to have a default value, in this specific instance it must always be the **empty string**. The default presenter will be declared in the component's class. ````typescript -import { computeConfigurationName, Configuration } from '@o3r/configuration'; +import { Configuration } from '@o3r/configuration'; +import { computeItemIdentifier } from '@o3r/core'; export interface DummyContConfig extends Configuration { /** Key used to identify a custom component, if provided */ @@ -174,7 +175,7 @@ export const DUMMY_CONT_DEFAULT_CONFIG: DummyContConfig = { customDummyKey: '' } -export const DUMMY_CONT_CONFIG_ID = computeConfigurationName('DummyContConfig', '@scope/o3r-components'); +export const DUMMY_CONT_CONFIG_ID = computeItemIdentifier('DummyContConfig', '@scope/o3r-components'); ```` For more information on configuration, you can check this [documentation](../configuration/OVERVIEW.md). diff --git a/docs/components/PLACEHOLDERS.md b/docs/components/PLACEHOLDERS.md index 0febab0502..6bfce931cb 100644 --- a/docs/components/PLACEHOLDERS.md +++ b/docs/components/PLACEHOLDERS.md @@ -296,107 +296,6 @@ Thanks to the parameters map you can use fact variables with JSONPath in localiz } ``` -#### Variable support for localization variables (DEPRECATED) - -Before, localization variables could reference facts via variables instead of parameters. This feature is currently deprecated and will be removed from Otter v12 as it is replaced by the parameters explained above. - -``en-GB.json`` - -```json -{ - "o3r-increment-key": "{increment, plural, =1 {1 second has} other {{{increment}} seconds have}} elapsed since you opened the page" -} -``` - -``template.json`` - -```json -{ - "vars": { - "incrementKey": { - "type": "localisation", - "value": "o3r-increment-key", - "vars": [ - "incrementVar" - ] - }, - "incrementVar": { - "type": "fact", - "value": "increment" - } - }, - "template": "
<%= incrementKey %>
" -} -``` - -The 1-to-1 mapping between the fact name and the reference in the translation brings many inconveniences as explained below. - -> [!CAUTION] -> **Limitations** -> Today you can only make a reference to a fact with the same name. You also cannot use JSON path to resolve your fact. - -This means the following is not possible: - -``ruleset.json`` - -```json -{ - "vars": { - "incrementKey": { - "type": "localisation", - "value": "o3r-increment-key", - "vars": [ - "incrementVar" - ] - }, - "incrementVar": { - "type": "fact", - "value": "incrementFact", - "path": "$.this.is.a.json.path" - } - }, - "template": "
<%= incrementKey %>
" -} -``` - -> [!TIPS] -> **General notice** - -Keep in mind that this feature deeply binds functional facts exposed in your application to your translations. -You will need to carefully plan the way you bind your localization key to your facts to avoid messy references. - -For example, let's imagine you want a generic counter until specific events. -You will probably want to reuse your placeholder in different pages for different events: - -```json -{ - "vars": { - "titleKey": { - "type": "localisation", - "value": "o3r-event-title-key" - }, - "contentWithCounterKey": { - "type": "localisation", - "value": "o3r-event-counter-key", - "vars": [ - "increment" - ] - }, - "increment": { - "type": "fact", - "value": "increment" - } - }, - "template": "
<%= titleKey %>
<%= contentWithCounterKey %>
" -} -``` - -You might be tempted to use this generic template for all your events but the value of your counter parameter will -depend on the event itself (Easter or next Summer Holidays for example). -This means that ``increment`` might have a different value depending on the context of the page which might be tricky to -maintain and to debug. -Try to keep it as simple as possible. - ### Multiple templates in same placeholder You can use placeholder actions to target the same placeholderId with different template URLs. diff --git a/docs/linter/eslint-plugin/rules/matching-configuration-name.md b/docs/linter/eslint-plugin/rules/matching-configuration-name.md index 0cd0f18240..bd791308ce 100644 --- a/docs/linter/eslint-plugin/rules/matching-configuration-name.md +++ b/docs/linter/eslint-plugin/rules/matching-configuration-name.md @@ -1,6 +1,6 @@ # @o3r/matching-configuration-name -Ensures that the configuration interface name matches the first parameter of `computeConfigurationName` used beside the configuration interface to expose its ID (as generated by the configuration module). +Ensures that the configuration interface name matches the first parameter of `computeItemIdentifier` used beside the configuration interface to expose its ID (as generated by the configuration module). ## How to use diff --git a/docs/rules-engine/how-to-use/dedicated-component-ruleset.md b/docs/rules-engine/how-to-use/dedicated-component-ruleset.md index b3081fd672..91be13aa3b 100644 --- a/docs/rules-engine/how-to-use/dedicated-component-ruleset.md +++ b/docs/rules-engine/how-to-use/dedicated-component-ruleset.md @@ -89,9 +89,6 @@ prevent the execution of the Ruleset until your component is available in the pa ] } ``` -> [!INFO] -> In v10 and the previous version, the Otter framework exposed the `linkedComponent` property to activate a ruleset on demand. -> This is now deprecated and will be removed in v12. Use `linkedComponents` instead. ## How it works diff --git a/packages/@ama-sdk/client-angular/src/api-angular-client.ts b/packages/@ama-sdk/client-angular/src/api-angular-client.ts index f3589f6152..7f85d93f1e 100644 --- a/packages/@ama-sdk/client-angular/src/api-angular-client.ts +++ b/packages/@ama-sdk/client-angular/src/api-angular-client.ts @@ -169,8 +169,7 @@ export class ApiAngularClient implements ApiClient { exception = new EmptyResponseError(e.message || 'Fail to Fetch', undefined, { apiName, operationId, url, origin }); } - // eslint-disable-next-line no-console -- `console.error` is supposed to be the default value if the `options` argument is not provided, can be removed in Otter v12. - const reviver = getResponseReviver(revivers, response, operationId, { disableFallback: this.options.disableFallback, log: console.error }); + const reviver = getResponseReviver(revivers, response, operationId, { disableFallback: this.options.disableFallback }); const replyPlugins = this.options.replyPlugins ? this.options.replyPlugins.map((plugin) => plugin.load({ dictionaries: root && root.dictionaries, diff --git a/packages/@ama-sdk/client-fetch/package.json b/packages/@ama-sdk/client-fetch/package.json index 6a44f37453..57d269e75b 100644 --- a/packages/@ama-sdk/client-fetch/package.json +++ b/packages/@ama-sdk/client-fetch/package.json @@ -40,6 +40,7 @@ }, "dependencies": { "@swc/helpers": "~0.5.0", + "ts-node": "~10.9.2", "tslib": "^2.6.2", "uuid": "^10.0.0" }, diff --git a/packages/@ama-sdk/core/package.json b/packages/@ama-sdk/core/package.json index 5d61036269..9a98255a7e 100644 --- a/packages/@ama-sdk/core/package.json +++ b/packages/@ama-sdk/core/package.json @@ -83,6 +83,7 @@ }, "dependencies": { "@swc/helpers": "~0.5.0", + "ts-node": "~10.9.2", "tslib": "^2.6.2", "uuid": "^10.0.0" }, diff --git a/packages/@ama-sdk/core/src/clients/api-angular-client.ts b/packages/@ama-sdk/core/src/clients/api-angular-client.ts index a0d6f0eb11..390ce71bf3 100644 --- a/packages/@ama-sdk/core/src/clients/api-angular-client.ts +++ b/packages/@ama-sdk/core/src/clients/api-angular-client.ts @@ -193,8 +193,7 @@ export class ApiAngularClient implements ApiClient { exception = new EmptyResponseError(e.message || 'Fail to Fetch', undefined, { apiName, operationId, url, origin }); } - // eslint-disable-next-line no-console -- `console.error` is supposed to be the default value if the `options` argument is not provided, can be removed in Otter v12. - const reviver = getResponseReviver(revivers, response, operationId, { disableFallback: this.options.disableFallback, log: console.error }); + const reviver = getResponseReviver(revivers, response, operationId, { disableFallback: this.options.disableFallback }); const replyPlugins = this.options.replyPlugins ? this.options.replyPlugins.map((plugin) => plugin.load({ dictionaries: root && root.dictionaries, diff --git a/packages/@ama-sdk/core/src/fwk/api.helpers.ts b/packages/@ama-sdk/core/src/fwk/api.helpers.ts index 2765e5a480..0271449538 100644 --- a/packages/@ama-sdk/core/src/fwk/api.helpers.ts +++ b/packages/@ama-sdk/core/src/fwk/api.helpers.ts @@ -115,7 +115,7 @@ export function tokenizeRequestOptions(tokenizedUrl: string, queryParameters: { * @param endpoint * @param options `{ disableFallback: false, log: console.error }` by default * @param options.disableFallback `false` by default - * @param options.log `() => {}` by default -- warning: default value will change to `console.error` in Otter v12. + * @param options.log `console.error` by default */ export function getResponseReviver( revivers: { [statusCode: number]: ReviverType | undefined } | undefined | ReviverType, @@ -124,7 +124,7 @@ export function getResponseReviver( options?: { disableFallback?: boolean; log?: (...args: any[]) => void } ): ReviverType | undefined { // eslint-disable-next-line no-console -- set as default value - const { disableFallback = false, log: logMsg = options ? () => {} : console.error } = options ?? {}; + const { disableFallback = false, log: logMsg = console.error } = options ?? {}; const logPrefix = `API status code error for ${endpoint || 'unknown'} endpoint`; if (!response || !response.ok) { return undefined; diff --git a/packages/@ama-sdk/schematics/README.md b/packages/@ama-sdk/schematics/README.md index 6ad2c945a1..e785549051 100644 --- a/packages/@ama-sdk/schematics/README.md +++ b/packages/@ama-sdk/schematics/README.md @@ -4,11 +4,7 @@ [![Bundle Size](https://img.shields.io/bundlephobia/min/@ama-sdk/schematics?color=green&style=for-the-badge)](https://www.npmjs.com/package/@ama-sdk/schematics) This package provides `schematics` generators to create an SDK based on an OpenAPI specifications. -There are two SDK generators in the Otter Framework: Typescript and Java. The Java generator is currently in maintenance -mode and only the Typescript generator is actively supported and will see future evolutions. - -- [Typescript SDK](#typescript-sdk) -- [Java SDK](#java-client-core-sdk) +The Otter framework provides a Typescript SDK generator. ## Typescript SDK @@ -287,21 +283,6 @@ For more information on the generated SDK and how the framework supports differe - [Generated SDK hierarchy and extension](https://github.com/AmadeusITGroup/otter/blob/main/docs/api-sdk/SDK_MODELS_HIERARCHY.md) - [Composition and Inheritance support](https://github.com/AmadeusITGroup/otter/blob/main/docs/api-sdk/COMPOSITION_INHERITANCE.md) -## Java Client Core SDK - -> [!WARNING] -> This feature is on maintenance mode and will see no future evolution - -Generate a Java Client Core SDK: - -Make sure to have a `./swagger-spec.yaml` file at the root of your project and run: - -```shell -yarn schematics @ama-sdk/schematics:java-client-core --spec-path ./swagger-spec.yaml --swagger-config-path ./swagger-codegen-config.json -``` - -[Default swagger config](schematics/java/client-core/swagger-codegen-java-client/config/swagger-codegen-config.json) will be used if `--swagger-config-path` is not provided. - ## Command Line Interface This package also comes with CLI scripts that can facilitate the upgrade and publication of an SDK. diff --git a/packages/@ama-sdk/schematics/collection.json b/packages/@ama-sdk/schematics/collection.json index a82ba3ccd7..6c68625a9c 100644 --- a/packages/@ama-sdk/schematics/collection.json +++ b/packages/@ama-sdk/schematics/collection.json @@ -31,11 +31,6 @@ "description": "Generate a typescript SDK repository shell", "factory": "./schematics/typescript/shell/index#ngGenerateTypescriptSDK", "schema": "./schematics/typescript/shell/schema.json" - }, - "java-client-core": { - "description": "[Deprecated - Removed in v12] Generate a Java SDK source code based on swagger specification", - "factory": "./schematics/java/client-core/index#ngGenerateJavaClientCore", - "schema": "./schematics/java/client-core/schema.json" } } } diff --git a/packages/@ama-sdk/schematics/package.json b/packages/@ama-sdk/schematics/package.json index c30ab460cd..d26b075f64 100644 --- a/packages/@ama-sdk/schematics/package.json +++ b/packages/@ama-sdk/schematics/package.json @@ -17,9 +17,8 @@ "postbuild": "patch-package-json-main", "build:builders": "tsc -b tsconfig.builders.json --pretty && yarn generate-cjs-manifest", "install-swagger-cli": "mvn install:install-file -DgroupId=io.swagger -DartifactId=swagger-codegen-cli -Dversion=2.4.0-AMADEUS -Dpackaging=jar -Dfile=./schematics/resources/swagger-codegen-cli.jar", - "build:swagger": "yarn install-swagger-cli && run-p 'build:swagger-*' 'build:openapi-*'", + "build:swagger": "yarn install-swagger-cli && run-p 'build:openapi-*'", "build:openapi-typescript-gen": "mvn clean package -f ./schematics/typescript/core/openapi-codegen-typescript/pom.xml", - "build:swagger-java-client-gen": "mvn clean package -f ./schematics/java/client-core/swagger-codegen-java-client/pom.xml", "build:cli": "tsc -b tsconfig.cli.json --pretty && yarn generate-cjs-manifest", "prepare:publish": "prepare-publish ./dist" }, @@ -70,6 +69,7 @@ "@o3r/schematics": "workspace:^", "@openapitools/openapi-generator-cli": "^2.15.0", "openapi-types": "^12.0.0", + "ts-node": "~10.9.2", "type-fest": "^4.10.2" }, "dependencies": { @@ -144,7 +144,7 @@ "@swc/helpers": "~0.5.0", "@commitlint/cli": "^19.0.0", "@commitlint/config-conventional": "^19.0.0", - "@typescript-eslint/eslint-plugin": "~8.17.0", + "@typescript-eslint/eslint-plugin": "~8.18.0", "jest-junit": "~16.0.0", "lint-staged": "^15.0.0", "minimist": "^1.2.6", diff --git a/packages/@ama-sdk/schematics/schematics/code-generator/swagger-java-generator/swagger-java.generator.ts b/packages/@ama-sdk/schematics/schematics/code-generator/swagger-java-generator/swagger-java.generator.ts deleted file mode 100644 index 2fbb38a08e..0000000000 --- a/packages/@ama-sdk/schematics/schematics/code-generator/swagger-java-generator/swagger-java.generator.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { - spawn, - SpawnOptions, -} from 'node:child_process'; -import * as path from 'node:path'; -import { - CodeGenerator, -} from '../code-generator'; -import { - defaultOptions, - JavaGeneratorTaskOptions, -} from './swagger-java.options'; - -/** - * Manage the schematic to generate a sdk using the Swagger 2 Generator - * Note: a working java setup compatible with Swagger 2 Generator is required to use this class - * @deprecated to be removed in v12 - */ -export class SwaggerJavaGenerator extends CodeGenerator { - /** @inheritDoc */ - protected generatorName = 'java-generator'; - - /** @inheritDoc */ - protected getDefaultOptions = () => defaultOptions; - /** @inheritDoc */ - protected runCodeGeneratorFactory(factoryOptions: { rootDirectory?: string } = {}) { - const rootDirectory = factoryOptions.rootDirectory || process.cwd(); - return async (generatorOptions?: JavaGeneratorTaskOptions) => { - if (!generatorOptions) { - return Promise.reject(new Error('Missing options')); - } - const spawnOptions = { - stdio: 'inherit', - shell: true, - cwd: rootDirectory - } as const satisfies SpawnOptions; - const codegenPath = path.join(generatorOptions.targetFolder, `${generatorOptions.codegenLanguage}-${generatorOptions.codegenFileName}`); - const cliPath = path.resolve(__dirname, '..', '..', 'resources', generatorOptions.cliFilename); - - const args = [ - '-cp', - codegenPath + path.delimiter + cliPath, - 'io.swagger.codegen.SwaggerCodegen', - 'generate', - '-l', - generatorOptions.codegenLanguage, - '-i', - generatorOptions.specPath, - '-o', - generatorOptions.outputPath - ]; - - if (!generatorOptions.apiTests) { - args.push('-DapiTests=false'); - } - - if (generatorOptions.specConfigPath) { - args.push(`-c=${generatorOptions.specConfigPath}`); - } - - return new Promise((resolve, reject) => { - spawn('java', args, spawnOptions) - .on('close', (code: number) => { - if (code === 0) { - resolve(); - } else { - reject(new Error(`Java generator failed with status ${code}`)); - } - }); - }); - }; - } -} diff --git a/packages/@ama-sdk/schematics/schematics/code-generator/swagger-java-generator/swagger-java.options.ts b/packages/@ama-sdk/schematics/schematics/code-generator/swagger-java-generator/swagger-java.options.ts deleted file mode 100644 index 56af474245..0000000000 --- a/packages/@ama-sdk/schematics/schematics/code-generator/swagger-java-generator/swagger-java.options.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { - CodegenTaskOptions, -} from '../code-generator'; - -/** - * Options for the generator-java task. - */ -export type JavaGeneratorTaskOptions = CodegenTaskOptions & { - targetFolder: string; - /** - * Enable API testing in Swagger Codegen - * @default true - */ - apiTests: boolean; - /** - * Path to the Swagger CLI - * @default 'swagger-codegen-cli.jar' - */ - cliFilename: string; - /** - * Path to the Swagger Codegen - * @default 'swagger-codegen.jar' - */ - codegenFileName: string; - /** - * Template language use for the codegen - * @default 'default' - */ - codegenLanguage: string; -}; - -/** - * Default options to generate a JAVA sdk using the Swagger 2 Generator - */ -export const defaultOptions: Readonly = { - apiTests: true, - targetFolder: './', - cliFilename: 'swagger-codegen-cli.jar', - codegenFileName: 'swagger-codegen.jar', - codegenLanguage: 'default', - specPath: 'swagger-spec.yaml', - outputPath: '.', - specConfigPath: '' -} as const; diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/index.spec.ts b/packages/@ama-sdk/schematics/schematics/java/client-core/index.spec.ts deleted file mode 100644 index 78988c116c..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/index.spec.ts +++ /dev/null @@ -1,20 +0,0 @@ -import * as path from 'node:path'; -import { - Tree, -} from '@angular-devkit/schematics'; -import { - SchematicTestRunner, -} from '@angular-devkit/schematics/testing'; - -const collectionPath = path.join(__dirname, '..', '..', '..', 'collection.json'); - -describe('Java Core Generator', () => { - it('should work correctly', async () => { - const runner = new SchematicTestRunner('@ama-sdk/schematics', collectionPath); - const tree = await runner.runSchematic('java-client-core', { - specPath: path.join(__dirname, '..', '..', '..', 'testing', 'MOCK_swagger.yaml') - }, Tree.empty()); - - expect(tree.files.length).toBeGreaterThan(0); - }); -}); diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/index.ts b/packages/@ama-sdk/schematics/schematics/java/client-core/index.ts deleted file mode 100644 index db8ad6ee4e..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/index.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { - promises as fs, -} from 'node:fs'; -import * as path from 'node:path'; -import { - chain, - Rule, - SchematicContext, - Tree, -} from '@angular-devkit/schematics'; -import { - SwaggerJavaGenerator, -} from '../../code-generator/swagger-java-generator/swagger-java.generator'; -import { - treeGlob, -} from '../../helpers/tree-glob'; -import { - NgGenerateJavaClientCoreSchematicsSchema, -} from './schema'; - -/** Base path where to find codegen jars */ -const jarBasePath = path.resolve(__dirname, 'swagger-codegen-java-client', 'target'); - -/** - * Generate a Java client SDK source code base on swagger specification - * @param options - */ -function ngGenerateJavaClientCoreFn(options: NgGenerateJavaClientCoreSchematicsSchema): Rule { - const specPath = path.resolve(process.cwd(), options.specPath); - /** - * rule to clear previous SDK generation - * @param tree - * @param context - */ - const clearGeneratedCode = async (tree: Tree, context: SchematicContext) => { - const swaggerConfig = options.specConfigPath ? JSON.parse(await fs.readFile(options.specConfigPath, { encoding: 'utf8' })) as Record : undefined; - if (swaggerConfig?.additionalProperties) { - const modelPackage = swaggerConfig.additionalProperties?.basePackage; - if (modelPackage) { - context.logger.info('Remove previously generated base models'); - treeGlob(tree, path.join('src', 'main', 'java', ...modelPackage.split('.'), '**', '*.java')).forEach((file) => tree.delete(file)); - } - - const apiInterfacesPackage = swaggerConfig.additionalProperties.endpointsPackage; - if (apiInterfacesPackage) { - context.logger.info('Remove previously generated API interfaces'); - treeGlob(tree, path.join('src', 'main', 'java', ...apiInterfacesPackage.split('.'), '**', '*.java')).forEach((file) => tree.delete(file)); - } - - const apiImplPackage = swaggerConfig.additionalProperties.endpointsImplPackage; - if (apiImplPackage) { - context.logger.info('Remove previously generated API implementations'); - treeGlob(tree, path.join('src', 'main', 'java', ...apiImplPackage.split('.'), '**', '*.java')).forEach((file) => tree.delete(file)); - } - } - - context.logger.info('Remove previously generated doc'); - treeGlob(tree, path.join('docs', '**')).forEach((file) => tree.delete(file)); - if (tree.exists('/README.md')) { - context.logger.info('Remove previously generated readme'); - tree.delete('/README.md'); - } - return () => tree; - }; - - /** - * rule to update readme and generate mandatory code source - * @param tree - */ - const generateSource = async (tree: Tree) => { - const specContent = await fs.readFile(path.resolve(process.cwd(), options.specPath), { encoding: 'utf8' }); - if (tree.exists('/swagger-spec.yaml')) { - tree.overwrite('/swagger-spec.yaml', specContent); - } else { - tree.create('/swagger-spec.yaml', specContent); - } - - return () => tree; - }; - - return chain([ - clearGeneratedCode, - generateSource, - (new SwaggerJavaGenerator()).getGeneratorRunSchematic({ - targetFolder: jarBasePath, - specPath, - codegenLanguage: 'javaClient', - apiTests: false, - specConfigPath: options.specConfigPath || undefined - }) - ]); -} - -/** - * Generate a Java client SDK source code base on swagger specification - * @deprecated Remove in otter v12 - * @param options - */ -export const ngGenerateJavaClientCore = (options: NgGenerateJavaClientCoreSchematicsSchema) => async () => { - const { createSchematicWithMetricsIfInstalled } = await import('@o3r/schematics'); - return createSchematicWithMetricsIfInstalled(ngGenerateJavaClientCoreFn)(options); -}; diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/schema.json b/packages/@ama-sdk/schematics/schematics/java/client-core/schema.json deleted file mode 100644 index 6cdd28ce65..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/schema.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema", - "$id": "NgGenerateJavaClientCoreSchematicsSchema", - "title": "Generate Java Client", - "description": "ng generate java-client-core", - "properties": { - "specPath": { - "type": "string", - "description": "Path to the swagger specification used to generate the SDK", - "x-prompt": "Swagger Spec file to generate the SDK", - "$default": { - "$source": "argv", - "index": 0 - } - }, - "specConfigPath": { - "type": "string", - "description": "Swagger config file\nMore info: https://openapi-generator.tech/docs/generators/java/#config-options" - } - }, - "additionalProperties": true, - "required": [ - "specPath" - ] -} diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/schema.ts b/packages/@ama-sdk/schematics/schematics/java/client-core/schema.ts deleted file mode 100644 index 04c2935877..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/schema.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { - SchematicOptionObject, -} from '@o3r/schematics'; - -export interface NgGenerateJavaClientCoreSchematicsSchema extends SchematicOptionObject { - /** Path to the swagger specification used to generate the SDK */ - specPath: string; - - /** Swagger config file */ - specConfigPath?: string | undefined; -} diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/.gitignore b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/.gitignore deleted file mode 100644 index 16c20927ab..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -# Output directory -/test-sdk -/~ - -# IDE -*.iml - -.classpath -.project -.factorypath -.settings diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/README.md b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/README.md deleted file mode 100644 index 7324a4b77a..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/README.md +++ /dev/null @@ -1,105 +0,0 @@ -# Swagger Codegen for the javaClient library [Deprecated] - -> [!WARN] -> This project is no longer maintained and is now fully deprecated. We intend to delete it from Otter v12 -> It is based on old version of the SwaggerCodegen tool which is not even compatible with today's standard. - -## Overview -This is a boilerplate project to generate your own client library with Swagger. Its goal is -to get you started with the basic plumbing so you can put in your own logic. It won't work without -your changes applied. - -## What's Swagger? -The goal of Swaggerâ„¢ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swagger removes the guesswork in calling the service. - - -Check out [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) for additional information about the Swagger project, including additional libraries with support for other languages and more. - -## How do I use this? -At this point, you've likely generated a client setup. It will include something along these lines: - -``` -. -|- README.md // this file -|- pom.xml // build script -|-- src -|--- main -|---- java -|----- com.amadeus.swagger.codegen.javaclient.CustomJavaClientCodegen.java // generator file -|---- resources -|----- javaClient // template files -|----- config -|------- swagger-codegen-config.json // language generation config file -|----- META-INF -|------ services -|------- io.swagger.codegen.CodegenConfig -``` - -You _will_ need to make changes in at least the following: - -`CustomJavaClientCodegen.java` - -Templates in this folder: - -`src/main/resources/javaClient` - -Once modified, you can run this: - -``` -mvn package -``` - -In your generator project. A single jar file will be produced in `target`. You can now use that with codegen: - -``` -java -cp /path/to/swagger-codegen-distribution:/path/to/your/jar io.swagger.codegen.Codegen -l javaClient -c "path/to/language/config/file/swagger-codegen-config.json" -o ./test-sdk -``` - -Now your templates are available to the client generator and you can write output values - -## But how do I modify this? -The `CustomJavaClientCodegen.java` has comments in it--lots of comments. There is no good substitute -for reading the code more, though. See how the `CustomJavaClientCodegen` implements `CodegenConfig`. -That class has the signature of all values that can be overridden. - -For the templates themselves, you have a number of values available to you for generation. -You can execute the `java` command from above while passing different debug flags to show -the object you have available during client generation: - -``` -# The following additional debug options are available for all codegen targets: -# -DdebugSwagger prints the OpenAPI Specification as interpreted by the codegen -# -DdebugModels prints models passed to the template engine -# -DdebugOperations prints operations passed to the template engine -# -DdebugSupportingFiles prints additional data passed to the template engine - -java -DdebugOperations -cp /path/to/swagger-codegen-distribution:/path/to/your/jar io.swagger.codegen.Codegen -l javaClient -c "path/to/language/config/file/swagger-codegen-config.json" -o ./test-sdk -``` - -Will, for example, output the debug info for operations. You can use this info -in the `api.mustache` file. - -### swagger-codegen-config.json - -Example of swagger-codegen-config.json -``` json -{ - "modelPackage" : "com.company.api", - "apiPackage" : "com.company.api", - "invokerPackage" : "com.company.api", - "generateApiTests": "false", - "groupId" : "com.company.api", - "artifactId" : "dapi-client-sdk", - "dateLibrary" : "java8", - "java8": true, - "hideGenerationTimestamp": true, - "additionalProperties": { - "endpointsImplPackage": "com.company.api.api.impl", - "endpointsPackage": "com.company.api.api.interfaces", - "basePackage": "com.company.api.model.base", - "corePackage": "com.company.api.model.core", - "sdkCorePackage": "com.company.sdk.core", - "sdkUtilsPackage": "com.company.sdk.utils" - } -} -``` diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/config/swagger-codegen-config.json b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/config/swagger-codegen-config.json deleted file mode 100644 index a301856963..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/config/swagger-codegen-config.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "modelPackage" : "com.amadeus.dapi", - "apiPackage" : "com.amadeus.dapi", - "invokerPackage" : "com.amadeus.dapi", - "generateApiTests": "false", - "groupId" : "com.amadeus.dapi", - "artifactId" : "dapi-client-sdk", - "dateLibrary" : "java8", - "java8": true, - "hideGenerationTimestamp": true, - "additionalProperties": { - "endpointsImplPackage": "com.amadeus.dapi.api.impl", - "endpointsPackage": "com.amadeus.dapi.api.interfaces", - "basePackage": "com.amadeus.dapi.model.base", - "corePackage": "com.amadeus.dapi.model.core", - "sdkCorePackage": "com.amadeus.des.sdk.core", - "sdkUtilsPackage": "com.amadeus.des.sdk.utils" - } -} diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/pom.xml b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/pom.xml deleted file mode 100644 index 600c19dbc0..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/pom.xml +++ /dev/null @@ -1,154 +0,0 @@ - - 4.0.0 - io.swagger - javaClient-swagger-codegen - jar - javaClient-swagger-codegen - ${project.version} - - 2.2.0 - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - unpack-templates - process-classes - - unpack - - - - - io.swagger - swagger-codegen-cli - 2.4.0-AMADEUS - jar - false - ${project.build.directory}/default-templates - Java/**/*.mustache - - - - - - - - org.apache.maven.plugins - maven-resources-plugin - - - copy-templates - process-classes - - copy-resources - - - ${project.build.directory}/classes/javaClient - false - - - ${project.build.directory}/default-templates/Java - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.2 - - - - loggerPath - conf/log4j.properties - - - -Xms512m -Xmx1500m - methods - pertest - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.6 - - - - jar - test-jar - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add_sources - generate-sources - - add-source - - - - src/main/java - - - - - add_test_sources - generate-test-sources - - add-test-source - - - - src/test/java - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.13.0 - - 1.8 - 1.8 - - - - - - - io.swagger - swagger-codegen-cli - ${swagger-codegen-version} - provided - - - - 2.4.0-AMADEUS - 1.0.0 - 4.8.1 - 1.0.0 - 0.0.0 - ${project.name} - - diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/java/com/amadeus/swagger/codegen/javaclient/CustomJavaClientCodegen.java b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/java/com/amadeus/swagger/codegen/javaclient/CustomJavaClientCodegen.java deleted file mode 100644 index 5d6f10b110..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/java/com/amadeus/swagger/codegen/javaclient/CustomJavaClientCodegen.java +++ /dev/null @@ -1,553 +0,0 @@ -package com.amadeus.swagger.codegen.javaclient; - -import java.io.IOException; -import java.nio.file.*; -import java.util.Arrays; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.stream.*; - -import com.google.common.base.CaseFormat; - -import io.swagger.codegen.CodegenModel; -import io.swagger.codegen.CodegenProperty; -import org.apache.commons.lang3.StringUtils; - -import io.swagger.codegen.CodegenConfig; -import io.swagger.codegen.CodegenOperation; -import io.swagger.codegen.CodegenParameter; -import io.swagger.codegen.SupportingFile; -import io.swagger.codegen.languages.JavaClientCodegen; -import io.swagger.models.HttpMethod; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.Operation; -import io.swagger.models.Path; -import io.swagger.models.Swagger; -import io.swagger.models.parameters.Parameter; -import io.swagger.models.properties.Property; - -public class CustomJavaClientCodegen extends JavaClientCodegen implements CodegenConfig { - - /** - * Extension of standard Java swagger code generator, to adhere to SOLID - * principles (https://en.wikipedia.org/wiki/SOLID_(object-oriented_design) - * - *

- * S: extract URL manipulations to a separate utility class URLUtils - *

- * I/D: create interfaces for APIs, to depend on abstractions. The APiClient - * implementation is renamed to DefaultApiClient. - */ - - public static final String FILE_SEPARATOR = java.nio.file.FileSystems.getDefault().getSeparator(); - - private LambdaHelper lambdaHelper = new LambdaHelper(); - - /** - * Operation vendor extension: wrapper model class simple name (ex: - * MyOperationRequest) - */ - private static final String X_REQUEST_WRAPPER_MODEL_TYPE = "x-request-wrapper-model-type"; - - /** - * Parameters vendor extension: value of parameter via calling getter on wrapper - * object (ex: request.getParam1()) - */ - private static final String X_REQUEST_UNWRAPPED_PARAM_VALUE = "x-request-unwrapped-param-value"; - - /** - * Parameters vendor extension: value of parameter in camel case - * ("parameterName" to "ParameterName") - */ - private static final String X_PARAM_NAME_IN_CAMEL_CASE = "x-param-name-in-camel-case"; - - public static final String SETTER_SUFFIX_FOR_ENUM_LISTS = "FromStrings"; - - public static final String ENDPOINTS_IMPL_PACKAGE = "endpointsImplPackage"; - protected String endpointsImplPackage = "com.amadeus.dapi.api.impl"; - - public static final String ENDPOINTS_PACKAGE = "endpointsPackage"; - protected String endpointsPackage = "com.amadeus.dapi.api.interfaces"; - - public static final String CORE_PACKAGE = "corePackage"; - protected String corePackage = "com.amadeus.dapi.model.core"; - - public static final String BASE_PACKAGE = "basePackage"; - protected String basePackage = "com.amadeus.dapi.model.base"; - - public static final String EXCLUDE_WRAPPED_INTERFACES = "excludeWrappedInterfaces"; - protected boolean shouldExcludeWrappedInterfaces = false; - - public static final String EXCLUDE_IMPL = "excludeImpl"; - protected boolean shouldExcludeImpl = false; - - private List postProcessConfigs; - - public CustomJavaClientCodegen() { - super(); - // Override the output folder and template location - setLibrary(null); - setOutputDir("generated-code/javaClient"); - setTemplateDir("javaClient"); - - embeddedTemplateDir = "javaClient"; - postProcessConfigs = new ArrayList<>(); - } - - /** - * {@inheritDoc} - */ - @Override - public String getName() { - return "javaClient"; - } - - /** - * {@inheritDoc} - */ - @Override - public String getHelp() { - return "Generates a Java client library."; - } - - /** - * Ignore the gradle-related files, and add new supporting files. - */ - @Override - public void processOpts() { - super.processOpts(); - - additionalProperties.put("uppercaseFirst", new LambdaHelper.UppercaseFirstLambda()); - additionalProperties.put("removeDuplicateLines", new LambdaHelper.RemoveDuplicateLinesLambda()); - additionalProperties.put("removeEmptyLines", new LambdaHelper.RemoveEmptyLines()); - additionalProperties.put("jackson", "true"); - additionalProperties.remove("gson"); - - if (additionalProperties.containsKey(ENDPOINTS_IMPL_PACKAGE)) { - this.setEndpointsImplPackage((String) additionalProperties.get(ENDPOINTS_IMPL_PACKAGE)); - } else { - // not set, use to be passed to template - additionalProperties.put(ENDPOINTS_IMPL_PACKAGE, endpointsImplPackage); - } - - if (additionalProperties.containsKey(ENDPOINTS_PACKAGE)) { - this.setEndpointsPackage((String) additionalProperties.get(ENDPOINTS_PACKAGE)); - } else { - // not set, use to be passed to template - additionalProperties.put(ENDPOINTS_PACKAGE, endpointsPackage); - } - - if (additionalProperties.containsKey(CORE_PACKAGE)) { - this.setCorePackage((String) additionalProperties.get(CORE_PACKAGE)); - } else { - // not set, use to be passed to template - additionalProperties.put(CORE_PACKAGE, corePackage); - } - - if (additionalProperties.containsKey(BASE_PACKAGE)) { - this.setBasePackage((String) additionalProperties.get(BASE_PACKAGE)); - } else { - // not set, use to be passed to template - additionalProperties.put(BASE_PACKAGE, basePackage); - } - - if (additionalProperties.containsKey(EXCLUDE_WRAPPED_INTERFACES)) { - setShouldExcludeWrappedInterfaces((Boolean)additionalProperties.get(EXCLUDE_WRAPPED_INTERFACES)); - } else { - additionalProperties.put(EXCLUDE_WRAPPED_INTERFACES, shouldExcludeWrappedInterfaces); - } - - if (additionalProperties.containsKey(EXCLUDE_IMPL)) { - setShouldExcludeImpl((Boolean)additionalProperties.get(EXCLUDE_IMPL)); - } else { - additionalProperties.put(EXCLUDE_IMPL, shouldExcludeImpl); - } - - supportingFiles.clear(); - modelTemplateFiles.clear(); - apiTemplateFiles.clear(); - apiTestTemplateFiles.clear(); - - modelTemplateFiles.put("model.mustache", "Private.java"); - modelTemplateFiles.put("coreModel.mustache", ".java"); - - // API: interface and implementation - apiTemplateFiles.put("api.mustache", "Api.java"); - - if (!shouldExcludeWrappedInterfaces) { - apiTemplateFiles.put("wrapped_api.mustache", "WrappedApi.java"); - } - - if (!shouldExcludeImpl) { - apiTemplateFiles.put("wrapped_api_impl.mustache", "WrappedApiImpl.java"); - } - - String patchFolder = sourceFolder + FILE_SEPARATOR + endpointsPackage.replace(".", FILE_SEPARATOR); - supportingFiles.add(new SupportingFile("PATCH.mustache", patchFolder, "PATCH.java")); - supportingFiles.add(new SupportingFile("settings.mustache", "settings.xml")); - supportingFiles.add(new SupportingFile("README.mustache", "README.md")); - - String baseModelPathString = packageToSrcFolder(basePackage); - String coreModelPathString = packageToSrcFolder(corePackage); - - // Manually manage the structure of the code generated by swagger codegen (models, api interfaces, api impl and api test) - postProcessConfigs.add(new FilePostProcessConfig(".*ApiTest[.]java$", packageToTestFolder(endpointsImplPackage), true)); - postProcessConfigs.add(new FilePostProcessConfig(".*ApiImpl[.]java$", packageToSrcFolder(endpointsImplPackage), true)); - postProcessConfigs.add(new FilePostProcessConfig(".*Api[.]java$", packageToSrcFolder(endpointsPackage), true)); - postProcessConfigs.add(new FilePostProcessConfig(".*Private[.]java$", baseModelPathString, true)); - postProcessConfigs.add(new FilePostProcessConfig(".*java$", coreModelPathString, false)); - - } - - @Override - public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { - super.postProcessModelProperty(model, property); - - if( property != null ) { - if (property.datatype.contains("BigDecimal") || property.datatype.contains("OffsetDateTime") || property.datatype.contains("LocalDate")) { - property.isPrimitiveType = true; - } - if (property.isContainer && (property.items.datatype.contains("BigDecimal") || property.items.datatype.contains("OffsetDateTime") || property.datatype.contains("LocalDate"))) { - property.items.isPrimitiveType = true; - } - - // Check that we have vendor extensions for dictionary - if (property.vendorExtensions.containsKey("x-dictionary-name")) { - // Add some imports needed when reviving object from dictionaries - model.imports.add("java.util.Map"); - model.imports.add("java.lang.reflect.InvocationTargetException"); - model.imports.add("com.fasterxml.jackson.annotation.JsonIgnore"); - - String type = (String)property.vendorExtensions.get("x-field-type"); - if (typeMapping.containsKey(type) || languageSpecificPrimitives.contains(type)) { - if (typeMapping.containsKey(type)) { - property.vendorExtensions.put("x-field-type", typeMapping.get(type)); - } - } else { - model.imports.add(type); - } - } - - if (property.vendorExtensions.containsKey("x-map-name") && !property.isListContainer) { - throw new IllegalArgumentException("error in " + property.baseName + ", x-map-name should only apply to a " + "list container."); - } - } - } - - /** - * Process models to identify API Root reply object and among them which ones declare dictionaries. - * These helpers are used to revive data model with dictionaries. - */ - @Override - public Map postProcessModels(Map objs) { - for (Map.Entry entry : objs.entrySet()) { - if( "models".equals(entry.getKey()) ) { - - for( HashMap _map : (List)entry.getValue() ) { - CodegenModel model = (CodegenModel) _map.get("model"); - boolean hasDictionaries = false; - for (CodegenProperty property : model.vars) { - hasDictionaries |= "dictionaries".equalsIgnoreCase(property.name); - } - if (model.classname.endsWith("Reply")) { - model.vendorExtensions.put("isReply", Boolean.TRUE); - if (hasDictionaries) { - model.vendorExtensions.put("isReplyWithDictionaries", Boolean.TRUE); - } - } - } - } - } - return super.postProcessModels(objs); - } - - /** - * Suffix all files with API - */ - @Override - public String apiFilename(String templateName, String tag) { - String suffix = apiTemplateFiles().get(templateName); - return apiFileFolder() + FILE_SEPARATOR + toApiFilename(tag) + suffix; - } - - public void setEndpointsImplPackage(String endpointsImplPackage) { - this.endpointsImplPackage = endpointsImplPackage; - } - - public void setEndpointsPackage(String endpointsPackage) { - this.endpointsPackage = endpointsPackage; - } - - public void setBasePackage(String basePackage) { - this.basePackage = basePackage; - } - - public void setCorePackage(String corePackage) { - this.corePackage = corePackage; - } - - private void setShouldExcludeWrappedInterfaces(boolean shouldExcludeWrappedInterfaces) { - this.shouldExcludeWrappedInterfaces = shouldExcludeWrappedInterfaces; - } - - private void setShouldExcludeImpl(boolean shouldExcludeImpl) { - this.shouldExcludeImpl = shouldExcludeImpl; - } - - /** - * Enum values are converted from camelCase to UPPER_SNAKE_CASE - */ - @Override - public String toEnumVarName(String value, String datatype) { - String upperSnakeCaseValue = value; - if (!StringUtils.isAllUpperCase(value)) { - upperSnakeCaseValue = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, value); - } - return super.toEnumVarName(upperSnakeCaseValue, datatype); - } - - /** - * Hook for altering the CodegenOperation data after it has been built from the - * swagger specification. - * - * New variables are passed to template via vendor extensions. - */ - @Override - public Map postProcessOperations(Map objs) { - Map newObjs = super.postProcessOperations(objs); - - List> imports = (List>) objs.get("imports"); - List operations = ((Map>) objs.get("operations")).get("operation"); - - for (CodegenOperation operation : operations) { - importRequestWrapper(operation, imports); - rewriteParamNames(operation); - } - - return newObjs; - } - - /** - * All the imports for the models will come from the 'core' package. Giving - * this, apply the "core" subpath to the model import - */ - @Override - public String toModelImport(String name) { - if ("".equals(modelPackage) || name.startsWith("java.") || name.startsWith("com.")) { - return name; - } else { - return corePackage + "." + name; - } - } - - /** - * Hook for altering the whole Swagger specification after it has been parsed. - */ - @Override - public void preprocessSwagger(Swagger swagger) { - super.preprocessSwagger(swagger); - - createRequestWrapperModel(swagger); - } - - /** - * Add Java imports for the new wrapper model type All the imports are done from - * the 'core' package - */ - private void importRequestWrapper(CodegenOperation operation, List> imports) { - String className = (String) operation.vendorExtensions.get(X_REQUEST_WRAPPER_MODEL_TYPE); - Map newImport = new HashMap(); - newImport.put("import", corePackage + "." + className); - imports.add(newImport); - } - - /** - * Compute the unwrapping for "paramName" into "request.getParamName()" or - * "request.isParamName()" if param is a boolean - * - * This is easier done here than in the template, due to camelization logic. - */ - private void rewriteParamNames(CodegenOperation operation) { - List params = new ArrayList(); - params.addAll(operation.allParams); - params.addAll(operation.queryParams); - params.addAll(operation.headerParams); - params.addAll(operation.formParams); - params.addAll(operation.pathParams); - for (CodegenParameter param : params) { - if (param.isEnum && param.isListContainer) { - param.vendorExtensions.put(X_PARAM_NAME_IN_CAMEL_CASE, - camelize(param.paramName) + SETTER_SUFFIX_FOR_ENUM_LISTS); - } else { - param.vendorExtensions.put(X_PARAM_NAME_IN_CAMEL_CASE, camelize(param.paramName)); - } - param.vendorExtensions.put(X_REQUEST_UNWRAPPED_PARAM_VALUE, - (param.isBoolean ? "request.is" : "request.get") + camelize(param.paramName) + "()"); - } - } - - /** - * Wraps parameters of each operation into a new wrapper model type - * Request - * - * To minimize the amount of code/template to override about parameter handling - * from the default Java behavior, it seems easier to not modify the signature - * of the operation in the specification, but rather do it in the template. - * - * However the new class definitions are added to the specification, so that - * they get generated in a standard way. - */ - private void createRequestWrapperModel(Swagger swagger) { - for (Path path : swagger.getPaths().values()) { - for (Operation operation : path.getOperations()) { - Model model = new ModelImpl(); - Map properties = new LinkedHashMap(); - for (Parameter parameter : operation.getParameters()) { - Property property = lambdaHelper.convertParameterToProperty(parameter); - if (property != null && property.getType() != null) { - properties.put(parameter.getName(), property); - } - } - - model.setProperties(properties); - String operationId = operation.getOperationId(); - if (StringUtils.isBlank(operationId)) { - String urlPath = getKey(path, swagger.getPaths()); - HttpMethod method = getKey(operation, path.getOperationMap()); - operationId = getOrGenerateOperationId(operation, urlPath, method.name()); - } - model.setDescription("Wrapper object for parameters of " + operationId + " operation"); - // Use 'Wrapped' Suffix to ensure that the new definition is not overriding an existing one - String className = camelize(operationId) + "WrappedRequest"; - - swagger.getDefinitions().put(className, model); - - // Link the wrapper into the operation metadata - operation.getVendorExtensions().put(X_REQUEST_WRAPPER_MODEL_TYPE, className); - } - } - } - - /** - * Get the key of a given value from a map - * - * @param value - * @param map - * @param - * @param - * @return - */ - private static K getKey(V value, Map map) { - K key = null; - if (map != null) { - for (Entry entry : map.entrySet()) { - if (value == entry.getValue()) { - key = entry.getKey(); - break; - } - } - } - return key; - } - - /** - * Output the API (class) name (capitalized). This overrides the - * {@link io.swagger.codegen.DefaultCodegen#toApiName(String)}, then removing - * the "Api" suffix. Return DefaultApi if name is empty - * - * @param name the name of the Api - * @return capitalized Api name - */ - @Override - public String toApiName(String name) { - if (name.length() == 0) { - return "Default"; - } - return initialCaps(name); - } - - /** - * Output the API as variable name, as camel case with first letter in lower - * case (e.g., AirCalendar -> airCalendar) - */ - @Override - public String toApiVarName(String name) { - if (name.length() == 0) { - return "default"; - } - return camelize(name, true); - } - - /** - * Override postProcessSupportingFileData - * This method will generate public and private models - * By default the models (public or private) will be generated inside modelPackage folder. - * This method will move the files as follows: - * The private models will be moved in 'modelPackage'/base. These models will be always generated (overwritten) - * The public models will be moved in 'modelPackage'/core. If a model is already existing in 'core' folder, this model will not be overwritten. - * If a core model already exists, the generated file in 'modelPackage' will be deleted - */ - @SuppressWarnings("static-method") - @Override - public Map postProcessSupportingFileData(Map objs) { - - for (FilePostProcessConfig config : postProcessConfigs) { - createOutFolder(config.getTargetFolder()); - } - - java.nio.file.Path pathToModels = java.nio.file.Paths.get(modelFileFolder()); - - try (Stream walk = Files.list(pathToModels)) { - walk.filter(Files::isRegularFile).forEach(filePath -> { - for (FilePostProcessConfig config : postProcessConfigs) { - String fileName = filePath.getFileName().toString(); - if (fileName.matches(config.getFilePattern())) { - try { - java.nio.file.Path destPath = java.nio.file.Paths.get(config.getTargetFolder()); - if (config.isForceReplace()) { - Files.move(filePath, destPath.resolve(filePath.getFileName()), StandardCopyOption.REPLACE_EXISTING); - } else { - try { - Files.move(filePath, destPath.resolve(filePath.getFileName())); - } catch (FileAlreadyExistsException e) { - Files.delete(filePath); - } - } - } catch (final IOException e) { - e.printStackTrace(); - } - break; - } - } - }); - } catch (IOException e) { - e.printStackTrace(); - } - return super.postProcessSupportingFileData(objs); - } - - private void createOutFolder(String pathString) { - java.nio.file.Path path = java.nio.file.Paths.get(pathString); - try { - if (!Files.exists(path)) { - Files.createDirectories(path); - } - } catch (IOException e) { - LambdaHelper.LOGGER.error("Unable to create base or core directory " + e); - } - } - - private String packageToSrcFolder(String packagePath) { - return this.outputFolder + FILE_SEPARATOR + this.sourceFolder + FILE_SEPARATOR + packagePath.replace(".", FILE_SEPARATOR); - } - - private String packageToTestFolder(String packagePath) { - return this.outputFolder + FILE_SEPARATOR + this.testFolder + FILE_SEPARATOR + packagePath.replace(".", FILE_SEPARATOR); - } -} diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/java/com/amadeus/swagger/codegen/javaclient/FilePostProcessConfig.java b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/java/com/amadeus/swagger/codegen/javaclient/FilePostProcessConfig.java deleted file mode 100644 index d2b78c9017..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/java/com/amadeus/swagger/codegen/javaclient/FilePostProcessConfig.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.amadeus.swagger.codegen.javaclient; - -public class FilePostProcessConfig { - - private String filePattern; - - private String targetFolder; - - private boolean forceReplace; - - public FilePostProcessConfig(String filePattern, String targetFolder, boolean forceReplace) { - this.filePattern = filePattern; - this.targetFolder = targetFolder; - this.forceReplace = forceReplace; - } - - public String getFilePattern() { - return filePattern; - } - - public String getTargetFolder() { - return targetFolder; - } - - public boolean isForceReplace() { - return forceReplace; - } - -} diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/java/com/amadeus/swagger/codegen/javaclient/LambdaHelper.java b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/java/com/amadeus/swagger/codegen/javaclient/LambdaHelper.java deleted file mode 100644 index 42f4a05966..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/java/com/amadeus/swagger/codegen/javaclient/LambdaHelper.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.amadeus.swagger.codegen.javaclient; - -import com.samskivert.mustache.Mustache; -import com.samskivert.mustache.Template; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import io.swagger.models.ArrayModel; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; -import io.swagger.models.parameters.BodyParameter; -import io.swagger.models.parameters.Parameter; -import io.swagger.models.parameters.SerializableParameter; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.Property; -import io.swagger.models.properties.PropertyBuilder; -import io.swagger.models.properties.RefProperty; - -import java.io.IOException; -import java.io.StringWriter; -import java.io.Writer; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.regex.Pattern; - -/** - * Helper around {@link io.swagger.models.Swagger} meta-model classes - */ -public class LambdaHelper { - - public static abstract class CustomLambda implements Mustache.Lambda { - - @Override - public void execute(Template.Fragment frag, Writer out) throws IOException { - final StringWriter tempWriter = new StringWriter(); - frag.execute(tempWriter); - out.write(formatFragment(tempWriter.toString())); - } - - public abstract String formatFragment(String fragment); - } - - public static class UppercaseFirstLambda extends CustomLambda { - - public UppercaseFirstLambda() {} - - @Override - public String formatFragment(String fragment) { - return fragment.substring(0, 1).toUpperCase() + fragment.substring(1); - } - } - - public static class RemoveDuplicateLinesLambda extends CustomLambda { - - public RemoveDuplicateLinesLambda() {} - - @Override - public String formatFragment(String fragment) { - Set uniqueLines = new HashSet<>(); - uniqueLines.addAll(Arrays.asList(fragment.split("\n"))); - return StringUtils.join(uniqueLines.toArray(), "\n"); - } - } - - /** - * Remove empty lines for the fragment - */ - public static class RemoveEmptyLines extends CustomLambda { - - public RemoveEmptyLines() { - } - - @Override public String formatFragment(String fragment) { - return Pattern.compile("^(?:[\\t ]*(?:\\r?\\n|\\r))+", Pattern.MULTILINE).matcher(fragment).replaceAll(""); - } - } - - public static final Logger LOGGER = LoggerFactory.getLogger(LambdaHelper.class); - - /** - * Converts a swagger operation parameter into a swagger model property - */ - public Property convertParameterToProperty(Parameter parameter) { - LOGGER.debug("Converting parameter " + parameter.getName()); - Property property = null; - - if (parameter instanceof SerializableParameter) { - property = convertParameterToProperty((SerializableParameter)parameter); - } - else if (parameter instanceof BodyParameter) { - property = convertParameterToProperty((BodyParameter)parameter); - } - else { - LOGGER.error("Unexpected class to convert " + parameter + " to a property"); - } - return property; - } - - private Property convertParameterToProperty(SerializableParameter parameter) { - Property property = PropertyBuilder.build(parameter.getType(), parameter.getFormat(), null); - if (property instanceof ArrayProperty) { - ((ArrayProperty)property).setItems(parameter.getItems()); - } - property.setName(parameter.getName()); - property.setDescription(parameter.getDescription()); - return property; - } - - private Property convertParameterToProperty(BodyParameter parameter) { - Property property = null; - Model schema = parameter.getSchema(); - if (schema instanceof ArrayModel) { - // ArrayModel#getReference() returns null, need to workaround - property = PropertyBuilder.build("array", null, null); - ((ArrayProperty)property).setItems(((ArrayModel)schema).getItems()); - } else if (schema instanceof ModelImpl) { - ModelImpl schemaImpl = (ModelImpl) schema; - property = PropertyBuilder.build(schemaImpl.getType(), schemaImpl.getFormat(), null); - } else { - property = new RefProperty(schema.getReference()); - } - property.setExample(parameter.getExamples()); - property.setName(parameter.getName()); - property.setDescription(parameter.getDescription()); - return property; - } -} diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig deleted file mode 100644 index 595a7bf3cf..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig +++ /dev/null @@ -1 +0,0 @@ -com.amadeus.swagger.codegen.javaclient.CustomJavaClientCodegen diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/PATCH.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/PATCH.mustache deleted file mode 100644 index 5107bae288..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/PATCH.mustache +++ /dev/null @@ -1,16 +0,0 @@ - -package {{endpointsPackage}}; - -import javax.ws.rs.HttpMethod; -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target({ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -@HttpMethod("PATCH") -@Documented -public @interface PATCH { -} diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/README.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/README.mustache deleted file mode 100644 index e33ca37698..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/README.mustache +++ /dev/null @@ -1,202 +0,0 @@ -# {{artifactId}} - -{{appName}} -- API version: {{appVersion}} -{{^hideGenerationTimestamp}} - - Build date: {{generatedDate}} -{{/hideGenerationTimestamp}} - -{{#appDescription}} -``` -{{{appDescription}}} -``` -{{/appDescription}} - -{{#infoUrl}} - For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) -{{/infoUrl}} - -*Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen)* -We don't support sdk generations with openapi 3 specs in input. If you want to generate an sdk based on an openapi 3 spec, you can use one of the [default generators](https://github.com/OpenAPITools/openapi-generator/tree/master/docs/generators). - -## Requirements - -Building the API client library requires: -1. Java 1.8+ -2. Maven - -## Installation - -To install the API client library to your local Maven repository, simply execute: - -```shell -mvn clean install -``` - -To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: - -```shell -mvn clean deploy -``` - -Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. - -### Maven users - -Add this dependency to your project's POM: - -```xml - - {{{groupId}}}{{#implementationLibraryName}}.{{implementationLibraryName}}{{/implementationLibraryName}} - {{{artifactId}}} - ARTIFACT_VERSION - -``` -Modify your settings.xml: - -```xml - - .... - - ... - - https://pkgs.dev.azure.com/AmadeusDigitalAirline/DES-SDKs/_packaging/des-sdks/maven/v1 - public-artifactory - External Repository of artifacts - public-artifactory - - - - ... - - public-artifactory - YOUR_USER - YOUR_PASSWORD - - - - - ... - - artifact-repository - - - public-artifactory - public-artifactory - https://pkgs.dev.azure.com/AmadeusDigitalAirline/DES-SDKs/_packaging/des-sdks/maven/v1 - - - - - - -``` - - -### Others - -At first generate the JAR by executing: - -```shell -mvn clean package -``` - -Then manually install the following JARs: - -* `target/{{{artifactId}}}-ARTIFACT_VERSION.jar` -* `target/lib/*.jar` - -## Getting Started - -Please follow the [installation](#installation) instruction and execute the following Java code: - -```java -{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} -import {{{invokerPackage}}}.*; -import {{{invokerPackage}}}.auth.*; -import {{{modelPackage}}}.*; -import {{{package}}}.{{{classname}}}; - -import java.io.File; -import java.util.*; - -public class {{{classname}}}Example { - - public static void main(String[] args) { - {{#hasAuthMethods}}ApiClient defaultClient = Configuration.getDefaultApiClient(); - {{#authMethods}}{{#isBasic}} - // Configure HTTP basic authorization: {{{name}}} - HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setUsername("YOUR USERNAME"); - {{{name}}}.setPassword("YOUR PASSWORD");{{/isBasic}}{{#isApiKey}} - // Configure API key authorization: {{{name}}} - ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} - // Configure OAuth2 access token for authorization: {{{name}}} - OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}} - {{/authMethods}} - {{/hasAuthMethods}} - - {{{classname}}} apiInstance = new {{{classname}}}(); - {{#allParams}} - {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} - {{/allParams}} - try { - {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} - System.out.println(result);{{/returnType}} - } catch (ApiException e) { - System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); - e.printStackTrace(); - } - } -} -{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} -``` - -## Documentation for API Endpoints - -All URIs are relative to *{{basePath}}* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} -{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} - -## Documentation for Models - -{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md) -{{/model}}{{/models}} - -## Documentation for Authorization - -{{^authMethods}}All endpoints do not require authorization. -{{/authMethods}}Authentication schemes defined for the API: -{{#authMethods}}### {{name}} - -{{#isApiKey}}- **Type**: API key -- **API key parameter name**: {{keyParamName}} -- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} -{{/isApiKey}} -{{#isBasic}}- **Type**: HTTP basic authentication -{{/isBasic}} -{{#isOAuth}}- **Type**: OAuth -- **Flow**: {{flow}} -- **Authorization URL**: {{authorizationUrl}} -- **Scopes**: {{^scopes}}N/A{{/scopes}} -{{#scopes}} - {{scope}}: {{description}} -{{/scopes}} -{{/isOAuth}} - -{{/authMethods}} - -## Recommendation - -It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. - -## Author - -{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} -{{/hasMore}}{{/apis}}{{/apiInfo}} diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/allowableValues.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/allowableValues.mustache deleted file mode 100644 index a48256d027..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/allowableValues.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#allowableValues}}allowableValues="{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}{{^values}}range=[{{#min}}{{.}}{{/min}}{{^min}}-infinity{{/min}}, {{#max}}{{.}}{{/max}}{{^max}}infinity{{/max}}]{{/values}}"{{/allowableValues}} \ No newline at end of file diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/api.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/api.mustache deleted file mode 100644 index 28efceab31..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/api.mustache +++ /dev/null @@ -1,54 +0,0 @@ -package {{package}}.api.interfaces; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.ApiResponse; - -import javax.ws.rs.*; -import javax.ws.rs.core.Response; - -{{#imports}}import {{import}}; -{{/imports}} - -{{^fullJavaUtil}} -import java.util.List; -import java.util.Map; -{{/fullJavaUtil}} - -{{>generatedAnnotation}} -@Path("{{^useAnnotatedBasePath}}/{{/useAnnotatedBasePath}}{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}") -@Api(value = "/", description = "{{description}}") -{{#addConsumesProducesJson}} - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) -{{/addConsumesProducesJson}} -{{#operations}} -public interface {{classname}}Api { - {{#operation}} - {{#summary}} - /** - * {{summary}} - * - {{#notes}} - * {{notes}} - * - {{/notes}} - */ - {{/summary}} - @{{httpMethod}}{{#path}} - @Path("{{{path}}}"){{/path}} - {{#hasConsumes}} - @Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }) - {{/hasConsumes}} - {{#hasProduces}} - @Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }) - {{/hasProduces}} - @ApiOperation(value = "{{{summary}}}", tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{#hasMore}}, {{/hasMore}}{{/vendorExtensions.x-tags}} }) - @ApiResponses(value = { {{#responses}} - @ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{^vendorExtensions.x-java-is-response-void}}, response = {{#baseType}}{{{baseType}}}.class{{/baseType}}{{^baseType}}Void.class{{/baseType}}{{#containerType}}, responseContainer = "{{{containerType}}}"{{/containerType}}{{/vendorExtensions.x-java-is-response-void}}){{#hasMore}},{{/hasMore}}{{/responses}} }) - Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); - {{/operation}} -} -{{/operations}} diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/api_test.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/api_test.mustache deleted file mode 100644 index 20abef2560..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/api_test.mustache +++ /dev/null @@ -1,49 +0,0 @@ -{{>licenseInfo}} - -package {{invokerPackage}}.api; - -import {{invokerPackage}}.ApiException; -import {{invokerPackage}}.api.{{classname}}WrappedApiImpl; - -import {{modelPackage}}.endpoints.{{classname}}WrappedApi; - -{{#imports}}import {{import}}; -{{/imports}} -import org.junit.Test; -import org.junit.Ignore; - -{{^fullJavaUtil}} -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -{{/fullJavaUtil}} - -/** - * API tests for {{classname}} - */ -@Ignore -public class {{classname}}WrappedApiTest { - - private final {{classname}}WrappedApi api = new {{classname}}WrappedApiImpl(); - - {{#operations}}{{#operation}} - /** - * {{summary}} - * - * {{notes}} - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void {{operationId}}Test() throws ApiException { - {{#vendorExtensions.x-request-wrapper-model-type}} - {{vendorExtensions.x-request-wrapper-model-type}} request = new {{vendorExtensions.x-request-wrapper-model-type}}(); - {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}(request); - {{/vendorExtensions.x-request-wrapper-model-type}} - - // TODO: test validations - } - {{/operation}}{{/operations}} -} diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/bodyParams.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/bodyParams.mustache deleted file mode 100644 index bb950caf52..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/bodyParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isBodyParam}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/coreModel.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/coreModel.mustache deleted file mode 100644 index 5793e2d603..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/coreModel.mustache +++ /dev/null @@ -1,8 +0,0 @@ -{{#models}}{{#model}} -package {{package}}.model.core; - -import {{package}}.model.base.{{classname}}Private; - -public class {{classname}} extends {{classname}}Private<{{classname}}> { -} -{{/model}}{{/models}} diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/formParams.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/formParams.mustache deleted file mode 100644 index c446b444fb..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/formParams.mustache +++ /dev/null @@ -1,3 +0,0 @@ -{{#isFormParam}}{{#notFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#vendorExtensions.x-multipart}}@FormDataParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{^vendorExtensions.x-multipart}} {{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{/notFile}}{{#isFile}} - @FormDataParam("{{baseName}}") InputStream {{paramName}}InputStream, - @FormDataParam("{{baseName}}") FormDataContentDisposition {{paramName}}Detail{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/headerParams.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/headerParams.mustache deleted file mode 100644 index f7445bbf48..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/headerParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isHeaderParam}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @HeaderParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/licenseInfo.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/licenseInfo.mustache deleted file mode 100644 index 4bb3a0d7d7..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/licenseInfo.mustache +++ /dev/null @@ -1,10 +0,0 @@ -/* - * {{{appName}}} - * {{{appDescription}}} - * - * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/model.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/model.mustache deleted file mode 100644 index 674ae3e59f..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/model.mustache +++ /dev/null @@ -1,48 +0,0 @@ -{{>licenseInfo}} - -{{#models}}{{#model}} -package {{package}}.model.base; -{{/model}}{{/models}} - -{{^supportJava6}} -import java.util.Objects; -import java.util.Arrays; -{{/supportJava6}} -{{#supportJava6}} -import org.apache.commons.lang3.ObjectUtils; -{{/supportJava6}} -{{#imports}} -import {{import}}; -{{/imports}} -{{#serializableModel}} -import java.io.Serializable; -{{/serializableModel}} -{{#jackson}} -{{#withXml}} -import com.fasterxml.jackson.dataformat.xml.annotation.*; -{{/withXml}} -{{/jackson}} -{{#withXml}} -import javax.xml.bind.annotation.*; -{{/withXml}} -{{#parcelableModel}} -import android.os.Parcelable; -import android.os.Parcel; -{{/parcelableModel}} -{{#useBeanValidation}} -import javax.validation.constraints.*; -import javax.validation.Valid; -{{/useBeanValidation}} -{{#models}} -{{#model}} -{{#discriminator}} -{{#children}} -import {{package}}.model.core.{{classname}}; -{{/children}} -{{/discriminator}} - -{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>pojo}}{{/isEnum}} -{{/model}} -{{/models}} - - diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/pathParams.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/pathParams.mustache deleted file mode 100644 index 07b59c682a..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/pathParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isPathParam}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @PathParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/pojo.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/pojo.mustache deleted file mode 100644 index 6b849f6a7e..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/pojo.mustache +++ /dev/null @@ -1,305 +0,0 @@ -/** - * {{#description}}{{.}}{{/description}}{{^description}}{{classname}}Private{{/description}} - */{{#description}} -@ApiModel(description = "{{{description}}}"){{/description}} -{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} -public abstract class {{classname}}Private {{#parent}}extends {{{parent}}} {{/parent}}{{#parcelableModel}}implements Parcelable {{#serializableModel}}, Serializable {{/serializableModel}}{{/parcelableModel}}{{^parcelableModel}}{{#serializableModel}}implements Serializable {{/serializableModel}}{{/parcelableModel}}{ -{{#serializableModel}} - private static final long serialVersionUID = 1L; - -{{/serializableModel}} - {{#vars}} - {{#isEnum}} - {{^isContainer}} -{{>modelInnerEnum}} - {{/isContainer}} - {{/isEnum}} - {{#items.isEnum}} - {{#items}} - {{^isContainer}} -{{>modelInnerEnum}} - {{/isContainer}} - {{/items}} - {{/items.isEnum}} - {{#jackson}} - @JsonProperty("{{baseName}}") - {{#withXml}} - {{^isContainer}} - @JacksonXmlProperty({{#isXmlAttribute}}isAttribute = true, {{/isXmlAttribute}}{{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/isContainer}} - {{#isContainer}} - {{#isXmlWrapped}} - // items.xmlName={{items.xmlName}} - @JacksonXmlElementWrapper(useWrapping = {{isXmlWrapped}}, {{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#items.xmlName}}{{items.xmlName}}{{/items.xmlName}}{{^items.xmlName}}{{items.baseName}}{{/items.xmlName}}") - {{/isXmlWrapped}} - {{/isContainer}} - {{/withXml}} - {{/jackson}} - {{#withXml}} - {{#isXmlAttribute}} - @XmlAttribute(name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/isXmlAttribute}} - {{^isXmlAttribute}} - {{^isContainer}} - @XmlElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/isContainer}} - {{#isContainer}} - // Is a container wrapped={{isXmlWrapped}} - {{#items}} - // items.name={{name}} items.baseName={{baseName}} items.xmlName={{xmlName}} items.xmlNamespace={{xmlNamespace}} - // items.example={{example}} items.type={{datatype}} - @XmlElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/items}} - {{#isXmlWrapped}} - @XmlElementWrapper({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") - {{/isXmlWrapped}} - {{/isContainer}} - {{/isXmlAttribute}} - {{/withXml}} - {{#gson}} - @SerializedName("{{baseName}}") - {{/gson}} - {{#isContainer}} - private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; - {{/isContainer}} - {{^isContainer}} - private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}}; - {{/isContainer}} - {{#vendorExtensions}}{{#x-field-name}} - private {{x-field-type}} {{x-field-name}} = null; - {{/x-field-name}}{{/vendorExtensions}} - {{/vars}} - {{#gson}} - {{#discriminator}} - public T() { - this.{{discriminator}} = this.getClass().getSimpleName(); - } - {{/discriminator}} - {{/gson}} - {{#vars}} - {{^isReadOnly}} - public T {{name}}({{{datatypeWithEnum}}} {{name}}) { - this.{{name}} = {{name}}; - return (T)this; - } - {{#isListContainer}} - - public T add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { - {{^required}} - if (this.{{name}} == null) { - this.{{name}} = {{{defaultValue}}}; - } - {{/required}} - this.{{name}}.add({{name}}Item); - return (T)this; - } - {{/isListContainer}} - {{#isMapContainer}} - - public T put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { - {{^required}} - if (this.{{name}} == null) { - this.{{name}} = {{{defaultValue}}}; - } - {{/required}} - this.{{name}}.put(key, {{name}}Item); - return (T)this; - } - {{/isMapContainer}} - - {{/isReadOnly}} - /** - {{#description}} - * {{description}} - {{/description}} - {{^description}} - * Get {{name}} - {{/description}} - {{#minimum}} - * minimum: {{minimum}} - {{/minimum}} - {{#maximum}} - * maximum: {{maximum}} - {{/maximum}} - * @return {{name}} - **/ -{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") -{{#vendorExtensions.extraAnnotation}} - {{{vendorExtensions.extraAnnotation}}} -{{/vendorExtensions.extraAnnotation}} - public {{{datatypeWithEnum}}} {{#isBoolean}}is{{/isBoolean}}{{getter}}() { - return {{name}}; - } - {{^isReadOnly}} - - public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { - this.{{name}} = {{name}}; - } - {{/isReadOnly}} - {{#vendorExtensions}}{{#x-field-name}} - @JsonIgnore - public {{x-field-type}} get{{#uppercaseFirst}}{{x-field-name}}{{/uppercaseFirst}}() { - return this.{{x-field-name}}; - } - - public void set{{#uppercaseFirst}}{{x-field-name}}{{/uppercaseFirst}}({{x-field-type}} value) { - this.{{x-field-name}} = value; - } - {{/x-field-name}}{{/vendorExtensions}} - {{/vars}} -{{#vendorExtensions}}{{#isReply}}{{#removeEmptyLines}} - public void revive() { -{{#isReplyWithDictionaries}} -{{#vars}}{{#isNotContainer}}{{^isPrimitiveType}} - if ({{name}} != null) { - {{name}}.revive(this.dictionaries); - } -{{/isPrimitiveType}}{{/isNotContainer}}{{/vars}} -{{#vars}}{{#isListContainer}}{{^items.isPrimitiveType}} - if ({{name}} != null) { - for ({{{items.datatypeWithEnum}}} {{name}}Item : {{name}}) { - {{name}}Item.revive(this.dictionaries); - } - } -{{/items.isPrimitiveType}}{{/isListContainer}}{{/vars}}{{/isReplyWithDictionaries}} - } -{{/removeEmptyLines}}{{/isReply}}{{/vendorExtensions}} -{{#vendorExtensions}}{{^isReply}}{{^isDictionary}}{{#removeEmptyLines}} - public void revive(Object dictionaries) { -{{#vars}}{{#vendorExtensions}}{{#x-field-name}} - try { - this.{{x-field-name}} = ((Map)dictionaries.getClass().getMethod("get{{#uppercaseFirst}}{{x-dictionary-name}}{{/uppercaseFirst}}").invoke(dictionaries)).get(this.{{name}}); - } catch (IllegalAccessException e) { - // - } catch (InvocationTargetException e) { - // - } catch (NoSuchMethodException e) { - // - } catch (NullPointerException e) { - // Fail silently in case a dictionary is missing (unfortunately it happens) - } -{{/x-field-name}}{{/vendorExtensions}} -{{#isListContainer}}{{^items.isPrimitiveType}} - if (this.{{name}} != null) { - for ({{{items.datatypeWithEnum}}} {{name}}Item : this.{{name}}) { - {{name}}Item.revive(dictionaries); - } - } -{{/items.isPrimitiveType}}{{/isListContainer}} -{{#isMapContainer}}{{^items.isPrimitiveType}} - if (this.{{name}} != null) { - for ({{{items.datatypeWithEnum}}} {{name}}Item : this.{{name}}.values()) { - {{name}}Item.revive(dictionaries); - } - } -{{/items.isPrimitiveType}}{{/isMapContainer}} -{{#isNotContainer}}{{^isPrimitiveType}} - if (this.{{name}} != null) { - this.{{name}}.revive(dictionaries); - } -{{/isPrimitiveType}}{{/isNotContainer}}{{/vars}} - } -{{/removeEmptyLines}}{{/isDictionary}}{{/isReply}}{{/vendorExtensions}} -{{^supportJava6}} - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - }{{#hasVars}} - T {{classVarName}} = (T) o; - return {{#vars}}{{#isByteArray}}Arrays{{/isByteArray}}{{#isBinary}}Arrays{{/isBinary}}{{^isByteArray}}{{^isBinary}}Objects{{/isBinary}}{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{#isBoolean}}is{{/isBoolean}}{{getter}}()){{#hasMore}} && - {{/hasMore}}{{/vars}}{{#parent}} && - super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} - return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}} - } - - @Override - public int hashCode() { - return Objects.hash({{#vars}}{{^isByteArray}}{{^isBinary}}{{name}}{{/isBinary}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{#isBinary}}Arrays.hashCode({{name}}){{/isBinary}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); - } - -{{/supportJava6}} -{{#supportJava6}} - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - }{{#hasVars}} - T {{classVarName}} = (T) o; - return {{#vars}}ObjectUtils.equals(this.{{name}}, {{classVarName}}.{{#isBoolean}}is{{/isBoolean}}{{getter}}()){{#hasMore}} && - {{/hasMore}}{{/vars}}{{#parent}} && - super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} - return true;{{/hasVars}} - } - - @Override - public int hashCode() { - return ObjectUtils.hashCodeMulti({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); - } - -{{/supportJava6}} - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class {{classname}} {\n"); - {{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}} - {{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); - {{/vars}}sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - {{#parcelableModel}} - public void writeToParcel(Parcel out, int flags) { - {{#parent}} super.writeToParcel(out, flags); {{/parent}} {{#vars}} - out.writeValue({{name}}); - {{/vars}} - } - - public T() { - super(); - } - - T(Parcel in) { - {{#parent}} super(in); {{/parent}} - {{#vars}} - {{#isPrimitiveType}} - {{name}} = ({{{datatypeWithEnum}}})in.readValue(null); - {{/isPrimitiveType}} - {{^isPrimitiveType}} - {{name}} = ({{{datatypeWithEnum}}})in.readValue({{complexType}}.class.getClassLoader()); - {{/isPrimitiveType}} - {{/vars}} - } - - public int describeContents() { - return 0; - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - public T createFromParcel(Parcel in) { - return new T(in); - } - public T[] newArray(int size) { - return new T[size]; - } - }; - {{/parcelableModel}} -} diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/pom.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/pom.mustache deleted file mode 100644 index cc3cb2d2fa..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/pom.mustache +++ /dev/null @@ -1,315 +0,0 @@ - - 4.0.0 - {{groupId}}{{#implementationLibraryName}}.{{implementationLibraryName}}{{/implementationLibraryName}} - {{artifactId}} - jar - {{artifactId}} - {{artifactVersion}} - - scm:git:git@github.com:swagger-api/swagger-mustache.git - scm:git:git@github.com:swagger-api/swagger-codegen.git - https://github.com/swagger-api/swagger-codegen - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.0.0-M1 - - - enforce-maven - - enforce - - - - - 2.2.0 - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.12 - - - - loggerPath - conf/log4j.properties - - - -Xms512m -Xmx1500m - methods - pertest - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory}/lib - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.6 - - - - jar - test-jar - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 1.10 - - - add_sources - generate-sources - - add-source - - - - - src/main/java - - - - - add_test_sources - generate-test-sources - - add-test-source - - - - - src/test/java - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.2 - - {{#java8}} - 1.8 - 1.8 - {{/java8}} - {{^java8}} - 1.7 - 1.7 - {{/java8}} - - - - - - - - public-artifactory - https://pkgs.dev.azure.com/AmadeusDigitalAirline/DES-SDKs/_packaging/des-sdks/maven/v1 - - true - - - true - - - - - - public-artifactory - https://pkgs.dev.azure.com/AmadeusDigitalAirline/DES-SDKs/_packaging/des-sdks/maven/v1 - - - - - - com.amadeus.des - java-client-sdk-core - 1.0.3 - - - - org.projectlombok - lombok - ${lombok-version} - - - - io.swagger - swagger-annotations - ${swagger-core-version} - - - - - com.fasterxml.jackson.core - jackson-core - ${jackson-version} - - - com.fasterxml.jackson.core - jackson-annotations - ${jackson-version} - - - com.fasterxml.jackson.core - jackson-databind - ${jackson-version} - - {{#withXml}} - - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson-version} - - - {{/withXml}} - {{#java8}} - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - ${jackson-version} - - {{/java8}} - {{^java8}} - - com.fasterxml.jackson.datatype - jackson-datatype-joda - ${jackson-version} - - - joda-time - joda-time - ${jodatime-version} - - - - - com.brsanthu - migbase64 - 2.2 - - {{/java8}} - - {{#supportJava6}} - - org.apache.commons - commons-lang3 - ${commons_lang3_version} - - - - commons-io - commons-io - ${commons_io_version} - - {{/supportJava6}} - - com.github.joschi.jackson - jackson-datatype-threetenbp - ${jackson-version} - - - - junit - junit - ${junit-version} - test - - - - org.mockito - mockito-core - 3.4.6 - test - - - - UTF-8 - 1.5.18 - 3.1.3.Final - 2.6.4 - {{^java8}} - 2.9.9 - {{/java8}} - {{#supportJava6}} - 2.5 - 3.6 - {{/supportJava6}} - 1.0.0 - 4.12 - 1.18.12 - - - - - release - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.2.0 - - -Xdoclint:none - - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.2.0 - - - attach-sources - - jar-no-fork - - - - - - - - - diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/queryParams.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/queryParams.mustache deleted file mode 100644 index bec45d8e6f..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/queryParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isQueryParam}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/returnTypes.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/returnTypes.mustache deleted file mode 100644 index c8f7a56938..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/returnTypes.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#returnContainer}}{{#isMapContainer}}Map{{/isMapContainer}}{{#isListContainer}}List<{{{returnType}}}>{{/isListContainer}}{{/returnContainer}}{{^returnContainer}}{{{returnType}}}{{/returnContainer}} \ No newline at end of file diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/settings.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/settings.mustache deleted file mode 100644 index 862ea9e2ee..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/settings.mustache +++ /dev/null @@ -1,19 +0,0 @@ - - - - - des-sdks - https://pkgs.dev.azure.com/AmadeusDigitalAirline/DES-SDKs/_packaging/des-sdks/maven/v1 - External Azure Artifact repository - des-sdks - - - - - des-sdks - AmadeusDigitalAirline - ${env.AZ_AR_PASSWORD} - - - diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/wrapped_api.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/wrapped_api.mustache deleted file mode 100644 index 4b2cd2db53..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/wrapped_api.mustache +++ /dev/null @@ -1,42 +0,0 @@ -package {{package}}.api.interfaces; - -import {{sdkCorePackage}}.ApiException; -import {{sdkCorePackage}}.ApiResponse; -import {{sdkCorePackage}}.Pair; -import {{sdkCorePackage}}.interfaces.ApiClient; - -{{#imports}}import {{import}}; -{{/imports}} - -{{^fullJavaUtil}} -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -{{/fullJavaUtil}} - -{{>generatedAnnotation}} -{{#operations}} -public interface {{classname}}WrappedApi { - {{#operation}} - /** - * {{summary}} - * {{notes}} - * @param request Wrapper of the parameters expected by this operation{{#returnType}} - * @return ApiResponse<{{{returnType}}}>{{/returnType}} - * @throws ApiException if fails to make API call - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - {{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation - {{/externalDocs}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}({{vendorExtensions.x-request-wrapper-model-type}} request) throws ApiException; - {{/operation}} -} -{{/operations}} diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/wrapped_api_impl.mustache b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/wrapped_api_impl.mustache deleted file mode 100644 index db528f97ae..0000000000 --- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/resources/javaClient/wrapped_api_impl.mustache +++ /dev/null @@ -1,99 +0,0 @@ -package {{package}}.api.impl; - -import lombok.Getter; - -import {{sdkCorePackage}}.ApiException; -import {{sdkCorePackage}}.ApiResponse; -import {{sdkCorePackage}}.Pair; -import {{sdkCorePackage}}.interfaces.ApiClient; -import {{sdkCorePackage}}.interfaces.ApiClientProvider; - -import {{sdkUtilsPackage}}.SdkUtils; - -import {{endpointsPackage}}.{{classname}}WrappedApi; - -{{#imports}}import {{import}}; -{{/imports}} - -{{^fullJavaUtil}} -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -{{/fullJavaUtil}} - -{{>generatedAnnotation}} -{{#operations}} -public class {{classname}}WrappedApiImpl implements {{classname}}WrappedApi { - @Getter - private final ApiClient {{localVariablePrefix}}apiClient; - - public {{classname}}WrappedApiImpl(ApiClientProvider apiClientProvider) { - this.{{localVariablePrefix}}apiClient = apiClientProvider.getApiClient(); - } - - {{#operation}} - /** - * {{summary}} - * {{notes}} - * @param request Wrapper of the parameters expected by this operation{{#returnType}} - * @return ApiResponse<{{{returnType}}}>{{/returnType}} - * @throws ApiException if fails to make API call - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - {{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation - {{/externalDocs}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - public ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}({{vendorExtensions.x-request-wrapper-model-type}} request) throws ApiException { - Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{vendorExtensions.x-request-unwrapped-param-value}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; - {{#allParams}}{{#required}} - // verify the required parameter '{{paramName}}' is set - if ({{vendorExtensions.x-request-unwrapped-param-value}} == null) { - throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}"); - } - {{/required}}{{/allParams}} - // create path and map variables - String {{localVariablePrefix}}localVarPath = "{{{path}}}".replaceAll("\\{format\\}","json"){{#pathParams}} - .replaceAll("\\{" + "{{baseName}}" + "\\}", SdkUtils.escapeStringForURL({{{vendorExtensions.x-request-unwrapped-param-value}}}.toString())){{/pathParams}}; - - // query params - {{javaUtilPrefix}}List {{localVariablePrefix}}localVarQueryParams = new {{javaUtilPrefix}}ArrayList(); - {{javaUtilPrefix}}Map {{localVariablePrefix}}localVarHeaderParams = new {{javaUtilPrefix}}HashMap(); - {{javaUtilPrefix}}Map {{localVariablePrefix}}localVarFormParams = new {{javaUtilPrefix}}HashMap(); - - {{#queryParams}} - {{localVariablePrefix}}localVarQueryParams.addAll(SdkUtils.parameterToPairs("{{#collectionFormat}}{{{collectionFormat}}}{{/collectionFormat}}", "{{baseName}}", {{vendorExtensions.x-request-unwrapped-param-value}}, {{localVariablePrefix}}apiClient.getDateFormat())); - {{/queryParams}} - - {{#headerParams}}if ({{vendorExtensions.x-request-unwrapped-param-value}} != null) - {{localVariablePrefix}}localVarHeaderParams.put("{{baseName}}", SdkUtils.parameterToString({{vendorExtensions.x-request-unwrapped-param-value}}, {{localVariablePrefix}}apiClient.getDateFormat())); - {{/headerParams}} - - {{#formParams}}if ({{vendorExtensions.x-request-unwrapped-param-value}} != null) - {{localVariablePrefix}}localVarFormParams.put("{{baseName}}", {{vendorExtensions.x-request-unwrapped-param-value}}); - {{/formParams}} - - final String[] {{localVariablePrefix}}localVarAccepts = { - {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} - }; - final String {{localVariablePrefix}}localVarAccept = SdkUtils.selectHeaderAccept({{localVariablePrefix}}localVarAccepts); - - final String[] {{localVariablePrefix}}localVarContentTypes = { - {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} - }; - final String {{localVariablePrefix}}localVarContentType = SdkUtils.selectHeaderContentType({{localVariablePrefix}}localVarContentTypes); - - String[] {{localVariablePrefix}}localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} }; - - Class<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{localVariablePrefix}}localVarReturnType = {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}.class; - return {{localVariablePrefix}}apiClient.invokeAPI({{localVariablePrefix}}localVarPath, "{{httpMethod}}", {{localVariablePrefix}}localVarQueryParams, {{localVariablePrefix}}localVarPostBody, {{localVariablePrefix}}localVarHeaderParams, {{localVariablePrefix}}localVarFormParams, {{localVariablePrefix}}localVarAccept, {{localVariablePrefix}}localVarContentType, {{localVariablePrefix}}localVarAuthNames, {{localVariablePrefix}}localVarReturnType); - } - {{/operation}} -} -{{/operations}} diff --git a/packages/@ama-sdk/schematics/schematics/ng-add/index.ts b/packages/@ama-sdk/schematics/schematics/ng-add/index.ts index 85cbf207b7..1e6b0492d4 100644 --- a/packages/@ama-sdk/schematics/schematics/ng-add/index.ts +++ b/packages/@ama-sdk/schematics/schematics/ng-add/index.ts @@ -55,12 +55,6 @@ export const updatePackageJsonScripts: Rule = (tree, context) => { (acc, [scriptName, cmd]) => { if (typeof cmd === 'string') { acc[scriptName] = cmd - .replace( - // Remove swagger config path if it is the default value - // eslint-disable-next-line @stylistic/max-len -- regexp cannot be splitted - / --(swagger-config-path|swaggerConfigPath)[ =]?(\.\/)?node_modules\/@ama-sdk\/generator-sdk\/src\/generators\/java-client-core\/templates\/swagger-codegen-java-client\/config\/swagger-codegen-config.json/, - '' - ) .replace(/\byo\b/g, 'schematics') // Migrate from yeoman to schematics .replace( // Change generator path to schematics collection:name @@ -71,10 +65,6 @@ export const updatePackageJsonScripts: Rule = (tree, context) => { /@ama-sdk\/generator-sdk\/(src\/)?generators/g, '@ama-sdk/schematics/schematics' ) // Change relative path for swaggerConfigPath - .replace( - /(@ama-sdk\/schematics\/schematics\/)java-client-core/g, - '$1java/client-core' - ) // Change java client core path .replace( /@ama-sdk\/(schematics|generator-sdk):(core|shell|create|mock)/g, '@ama-sdk/schematics:typescript-$2' diff --git a/packages/@ama-sdk/schematics/testing/EXPECTED_package.json b/packages/@ama-sdk/schematics/testing/EXPECTED_package.json index 56420ab26e..93e1d037b9 100644 --- a/packages/@ama-sdk/schematics/testing/EXPECTED_package.json +++ b/packages/@ama-sdk/schematics/testing/EXPECTED_package.json @@ -1,11 +1,9 @@ { "name": "fake-package", "scripts": { - "swagger:regen": "schematics @ama-sdk/schematics:java-client-core --spec-path ./swagger-spec.yaml --force", - "swagger:generate": "yarn schematics @ama-sdk/schematics:java-client-core --spec-path node_modules/@api-spec/core-private/dist/API_Private.yaml --force", "swagger:upgrade": "schematics @ama-sdk/schematics:typescript-core && yarn clear-index", - "swagger:regen2": "schematics @ama-sdk/schematics:typescript-core --spec-path ./swagger-spec.yaml --force && yarn clear-index", - "swagger:generate2": "schematics @ama-sdk/schematics:typescript-core --spec-path $(yarn resolve @api-spec/core-public/dist/API_Public.yaml) --force && yarn clear-index", + "swagger:regen": "schematics @ama-sdk/schematics:typescript-core --spec-path ./swagger-spec.yaml --force && yarn clear-index", + "swagger:generate": "schematics @ama-sdk/schematics:typescript-core --spec-path $(yarn resolve @api-spec/core-public/dist/API_Public.yaml) --force && yarn clear-index", "mock": "yarn ng g @ama-sdk/schematics:typescript-mock" } } diff --git a/packages/@ama-sdk/schematics/testing/MOCK_package.json b/packages/@ama-sdk/schematics/testing/MOCK_package.json index 7c6c7ba90a..d82f2d54ea 100644 --- a/packages/@ama-sdk/schematics/testing/MOCK_package.json +++ b/packages/@ama-sdk/schematics/testing/MOCK_package.json @@ -1,11 +1,9 @@ { "name": "fake-package", "scripts": { - "swagger:regen": "yo ./node_modules/@ama-sdk/generator-sdk/src/generators/java-client-core --swaggerSpecPath ./swagger-spec.yaml --swaggerConfigPath node_modules/@ama-sdk/generator-sdk/src/generators/java-client-core/templates/swagger-codegen-java-client/config/swagger-codegen-config.json --force", - "swagger:generate": "yarn yo ./node_modules/@ama-sdk/generator-sdk/src/generators/java-client-core --swaggerSpecPath node_modules/@api-spec/core-private/dist/API_Private.yaml --swaggerConfigPath ./node_modules/@ama-sdk/generator-sdk/src/generators/java-client-core/templates/swagger-codegen-java-client/config/swagger-codegen-config.json --force", "swagger:upgrade": "yo $(yarn resolve @ama-sdk/generator-sdk/src/generators/core) && yarn clear-index", - "swagger:regen2": "yo $(yarn resolve @ama-sdk/generator-sdk/src/generators/core) --swaggerSpecPath ./swagger-spec.yaml --force && yarn clear-index", - "swagger:generate2": "yo $(yarn resolve @ama-sdk/generator-sdk/generators/core) --swaggerSpecPath $(yarn resolve @api-spec/core-public/dist/API_Public.yaml) --force && yarn clear-index", + "swagger:regen": "yo $(yarn resolve @ama-sdk/generator-sdk/src/generators/core) --swaggerSpecPath ./swagger-spec.yaml --force && yarn clear-index", + "swagger:generate": "yo $(yarn resolve @ama-sdk/generator-sdk/generators/core) --swaggerSpecPath $(yarn resolve @api-spec/core-public/dist/API_Public.yaml) --force && yarn clear-index", "mock": "yarn ng g @ama-sdk/generator-sdk:mock" } } diff --git a/packages/@o3r-training/showcase-sdk/src/spec/api-mock.ts b/packages/@o3r-training/showcase-sdk/src/spec/api-mock.ts index 79ab1fe3bb..e2b33e84d8 100644 --- a/packages/@o3r-training/showcase-sdk/src/spec/api-mock.ts +++ b/packages/@o3r-training/showcase-sdk/src/spec/api-mock.ts @@ -1,6 +1,5 @@ import { ApiFetchClient, - BaseApiFetchClientConstructor, } from '@ama-sdk/client-fetch'; import { ApiClient, @@ -20,22 +19,6 @@ export interface Api { userApi: api.UserApi; } -/** - * Mock APIs - * @deprecated use `getMockedApi` with {@link ApiClient} instead, will be removed in v12. - */ -export const myApi: Api = { - petApi: new api.PetApi(MOCK_SERVER), - storeApi: new api.StoreApi(MOCK_SERVER), - userApi: new api.UserApi(MOCK_SERVER) -}; - -/** - * Retrieve mocked SDK Apis - * @param config configuration of the Api Client - * @deprecated use `getMockedApi` with {@link ApiClient} instead, will be removed in v12. - */ -export function getMockedApi(config?: string | BaseApiFetchClientConstructor): Api; /** * Retrieve mocked SDK Apis * @param apiClient Api Client instance @@ -46,23 +29,10 @@ export function getMockedApi(config?: string | BaseApiFetchClientConstructor): A * const mocks = getMockedApi(new ApiFetchClient({ basePath: MOCK_SERVER_BASE_PATH })); * ``` */ -export function getMockedApi(apiClient: ApiClient): Api; -/** - * Retrieve mocked SDK Apis - * @param config configuration of the Api Client - */ -export function getMockedApi(config?: string | BaseApiFetchClientConstructor | ApiClient): Api { - let apiConfigObj: ApiClient = MOCK_SERVER; - if (typeof config === 'string') { - apiConfigObj = new ApiFetchClient({ basePath: config }); - } else if (isApiClient(config)) { - apiConfigObj = config; - } else if (config) { - apiConfigObj = new ApiFetchClient(config); - } +export function getMockedApi(apiClient: ApiClient): Api { return { - petApi: new api.PetApi(apiConfigObj), - storeApi: new api.StoreApi(apiConfigObj), - userApi: new api.UserApi(apiConfigObj) + petApi: new api.PetApi(apiClient), + storeApi: new api.StoreApi(apiClient), + userApi: new api.UserApi(apiClient) }; } diff --git a/packages/@o3r/analytics/package.json b/packages/@o3r/analytics/package.json index 65d7035b08..4f416f6799 100644 --- a/packages/@o3r/analytics/package.json +++ b/packages/@o3r/analytics/package.json @@ -37,6 +37,7 @@ "@schematics/angular": "^18.2.0", "jasmine": "^5.0.0", "rxjs": "^7.8.1", + "ts-node": "~10.9.2", "typescript": "^5.5.4", "webpack": "^5.96.0" }, diff --git a/packages/@o3r/apis-manager/package.json b/packages/@o3r/apis-manager/package.json index 0f3ef53bae..0dc4d63acf 100644 --- a/packages/@o3r/apis-manager/package.json +++ b/packages/@o3r/apis-manager/package.json @@ -27,6 +27,7 @@ "@o3r/schematics": "workspace:^", "@schematics/angular": "^18.2.0", "rxjs": "^7.8.1", + "ts-node": "~10.9.2", "typescript": "^5.5.4" }, "peerDependenciesMeta": { diff --git a/packages/@o3r/application/package.json b/packages/@o3r/application/package.json index c6923bfbff..13f31bb319 100644 --- a/packages/@o3r/application/package.json +++ b/packages/@o3r/application/package.json @@ -34,6 +34,7 @@ "@o3r/testing": "workspace:^", "@schematics/angular": "^18.2.0", "rxjs": "^7.8.1", + "ts-node": "~10.9.2", "typescript": "^5.5.4" }, "peerDependenciesMeta": { diff --git a/packages/@o3r/artifactory-tools/package.json b/packages/@o3r/artifactory-tools/package.json index 5a054999bb..41bbaa7bd9 100644 --- a/packages/@o3r/artifactory-tools/package.json +++ b/packages/@o3r/artifactory-tools/package.json @@ -26,6 +26,7 @@ "dependencies": { "commander": "^12.0.0", "fs-extra": "^11.0.0", + "ts-node": "~10.9.2", "tslib": "^2.6.2", "winston": "^3.8.2" }, diff --git a/packages/@o3r/azure-tools/package.json b/packages/@o3r/azure-tools/package.json index 43ad8672ed..714df35899 100644 --- a/packages/@o3r/azure-tools/package.json +++ b/packages/@o3r/azure-tools/package.json @@ -25,6 +25,7 @@ "dependencies": { "azure-devops-node-api": "^13.0.0", "commander": "^12.0.0", + "ts-node": "~10.9.2", "tslib": "^2.6.2", "winston": "^3.8.2" }, diff --git a/packages/@o3r/components/package.json b/packages/@o3r/components/package.json index 70e539e2fc..7e80d4ace4 100644 --- a/packages/@o3r/components/package.json +++ b/packages/@o3r/components/package.json @@ -64,6 +64,7 @@ "jsonpath-plus": "^9.0.0 || ^10.0.0", "rxjs": "^7.8.1", "semver": "^7.5.2", + "ts-node": "~10.9.2", "typescript": "^5.5.4" }, "peerDependenciesMeta": { diff --git a/packages/@o3r/components/src/tools/pipes/capitalize/capitalize.module.ts b/packages/@o3r/components/src/tools/pipes/capitalize/capitalize.module.ts deleted file mode 100644 index d3ece0ac95..0000000000 --- a/packages/@o3r/components/src/tools/pipes/capitalize/capitalize.module.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { - NgModule, -} from '@angular/core'; -import { - CapitalizePipe, -} from './capitalize.pipe'; - -/** - * @deprecated please use O3rCapitalizePipe, will be removed in v12. - */ -@NgModule({ - declarations: [CapitalizePipe], - exports: [CapitalizePipe] -}) -export class CapitalizePipeModule {} diff --git a/packages/@o3r/components/src/tools/pipes/capitalize/capitalize.pipe.spec.ts b/packages/@o3r/components/src/tools/pipes/capitalize/capitalize.pipe.spec.ts index 4b1ef318ba..a9611c1a7d 100644 --- a/packages/@o3r/components/src/tools/pipes/capitalize/capitalize.pipe.spec.ts +++ b/packages/@o3r/components/src/tools/pipes/capitalize/capitalize.pipe.spec.ts @@ -1,31 +1,24 @@ import { - CapitalizePipe, O3rCapitalizePipe, } from './capitalize.pipe'; describe('CapitalizePipe', () => { const pipe = new O3rCapitalizePipe(); - const deprecatedPipe = new CapitalizePipe(); it('transforms "abc" to "Abc"', () => { expect(pipe.transform('abc')).toBe('Abc'); - expect(deprecatedPipe.transform('abc')).toBe('Abc'); }); it('transforms "abc def" to "Abc def"', () => { expect(pipe.transform('abc def')).toBe('Abc def'); - expect(deprecatedPipe.transform('abc def')).toBe('Abc def'); }); it('ignores whitespace', () => { expect(pipe.transform(' ')).toBe(' '); - expect(deprecatedPipe.transform(' ')).toBe(' '); }); it('does not break on empty values', () => { expect(pipe.transform()).toBe(undefined); - expect(deprecatedPipe.transform()).toBe(undefined); expect(pipe.transform(null)).toBe(null); - expect(deprecatedPipe.transform(null)).toBe(null); }); }); diff --git a/packages/@o3r/components/src/tools/pipes/capitalize/capitalize.pipe.ts b/packages/@o3r/components/src/tools/pipes/capitalize/capitalize.pipe.ts index 0fa7ee7d35..850394ae93 100644 --- a/packages/@o3r/components/src/tools/pipes/capitalize/capitalize.pipe.ts +++ b/packages/@o3r/components/src/tools/pipes/capitalize/capitalize.pipe.ts @@ -11,9 +11,3 @@ export class O3rCapitalizePipe implements PipeTransform { return firstLetter ? firstLetter.toUpperCase() + val!.slice(1) : value; } } - -/** - * @deprecated please use O3rCapitalizePipe, will be removed in v12. - */ -@Pipe({ name: 'capitalize' }) -export class CapitalizePipe extends O3rCapitalizePipe implements PipeTransform {} diff --git a/packages/@o3r/components/src/tools/pipes/capitalize/index.ts b/packages/@o3r/components/src/tools/pipes/capitalize/index.ts index 8ae359851e..b8725aa2a7 100644 --- a/packages/@o3r/components/src/tools/pipes/capitalize/index.ts +++ b/packages/@o3r/components/src/tools/pipes/capitalize/index.ts @@ -1,2 +1 @@ -export * from './capitalize.module'; export * from './capitalize.pipe'; diff --git a/packages/@o3r/components/src/tools/pipes/duration/duration.module.ts b/packages/@o3r/components/src/tools/pipes/duration/duration.module.ts deleted file mode 100644 index 4e55c092c5..0000000000 --- a/packages/@o3r/components/src/tools/pipes/duration/duration.module.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { - NgModule, -} from '@angular/core'; -import { - DurationPipe, -} from './duration.pipe'; - -/** - * @deprecated please use O3rDurationPipe, will be removed in v12. - */ -@NgModule({ - declarations: [DurationPipe], - exports: [DurationPipe] -}) -export class DurationPipeModule {} diff --git a/packages/@o3r/components/src/tools/pipes/duration/duration.pipe.spec.ts b/packages/@o3r/components/src/tools/pipes/duration/duration.pipe.spec.ts index f4c2fe15ae..67bf0a77d5 100644 --- a/packages/@o3r/components/src/tools/pipes/duration/duration.pipe.spec.ts +++ b/packages/@o3r/components/src/tools/pipes/duration/duration.pipe.spec.ts @@ -1,70 +1,56 @@ import { - DurationPipe, O3rDurationPipe, } from './duration.pipe'; describe('DurationPipe', () => { const pipe = new O3rDurationPipe(); - const deprecatedPipe = new DurationPipe(); it('transforms 120s to 0:02', () => { expect(pipe.transform(120)).toBe('0:02'); - expect(deprecatedPipe.transform(120)).toBe('0:02'); }); it('transforms 100s to 0:01', () => { expect(pipe.transform(100)).toBe('0:01'); - expect(deprecatedPipe.transform(100)).toBe('0:01'); }); it('transforms 3660 seconds to "1:01"', () => { expect(pipe.transform(3660)).toBe('1:01'); - expect(deprecatedPipe.transform(3660)).toBe('1:01'); }); it('transforms 90000s to "25:00" (duration exceeds 24 hours)', () => { expect(pipe.transform(90_000)).toBe('25:00'); - expect(deprecatedPipe.transform(90_000)).toBe('25:00'); }); it('transforms 360000s to "100:00" (hours are 3 digits long)', () => { expect(pipe.transform(360_000)).toBe('100:00'); - expect(deprecatedPipe.transform(360_000)).toBe('100:00'); }); it('transforms 120s to 0h02m', () => { expect(pipe.transform(120, '{h}h{mm}m')).toBe('0h02m'); - expect(deprecatedPipe.transform(120, '{h}h{mm}m')).toBe('0h02m'); }); it('transforms 120s to 00H02M', () => { expect(pipe.transform(120, '{hh}H{mm}M')).toBe('00H02M'); - expect(deprecatedPipe.transform(120, '{hh}H{mm}M')).toBe('00H02M'); }); it('transforms 3660s to 1h01', () => { expect(pipe.transform(3660, '{h}h{mm}')).toBe('1h01'); - expect(deprecatedPipe.transform(3660, '{h}h{mm}')).toBe('1h01'); }); it('transforms 86399s to 0d23h59m', () => { expect(pipe.transform(86_399, '{d}d{h}h{mm}m')).toBe('0d23h59m'); - expect(deprecatedPipe.transform(86_399, '{d}d{h}h{mm}m')).toBe('0d23h59m'); }); it('transforms 86399s to 0d86399s', () => { expect(pipe.transform(86_399, '{d}d{s}s')).toBe('0d86399s'); - expect(deprecatedPipe.transform(86_399, '{d}d{s}s')).toBe('0d86399s'); }); it('transforms 93675s to an object "{"d": 1, "h": 2, "m": 1, "s": 15}"', () => { expect(pipe.transform(93_675, '{"d": {d}, "h": {h}, "m": {m}, "s": {s}}')).toBe('{"d": 1, "h": 2, "m": 1, "s": 15}'); - expect(deprecatedPipe.transform(93_675, '{"d": {d}, "h": {h}, "m": {m}, "s": {s}}')).toBe('{"d": 1, "h": 2, "m": 1, "s": 15}'); }); it('returns pattern when regex not respected', () => { expect(pipe.transform(1234, 'hh:mm')).toBe('hh:mm'); - expect(deprecatedPipe.transform(1234, 'hh:mm')).toBe('hh:mm'); }); it('should work for custom unit times', () => { @@ -77,15 +63,6 @@ describe('DurationPipe', () => { divider: 25 } ])).toBe('57:1'); - expect(deprecatedPipe.transform(5725, '{t}:{k}', [ - { - formatCharacter: 't', - divider: 100 - }, { - formatCharacter: 'k', - divider: 25 - } - ])).toBe('57:1'); }); it('should work for unit times that are not present in the pattern', () => { @@ -102,18 +79,5 @@ describe('DurationPipe', () => { modulo: 25 } ])).toBe('57:0'); - expect(deprecatedPipe.transform(5725, '{t}:{k}', [ - { - formatCharacter: 't', - divider: 100 - }, { - formatCharacter: 'o', - divider: 25 - }, { - formatCharacter: 'k', - divider: 1, - modulo: 25 - } - ])).toBe('57:0'); }); }); diff --git a/packages/@o3r/components/src/tools/pipes/duration/duration.pipe.ts b/packages/@o3r/components/src/tools/pipes/duration/duration.pipe.ts index 2b73516987..e46df5d6f1 100644 --- a/packages/@o3r/components/src/tools/pipes/duration/duration.pipe.ts +++ b/packages/@o3r/components/src/tools/pipes/duration/duration.pipe.ts @@ -70,10 +70,3 @@ export class O3rDurationPipe implements PipeTransform { }, pattern); } } - -/** - * Converts a duration in seconds into the HH:mm format - * @deprecated please use O3rDurationPipe, will be removed in v12. - */ -@Pipe({ name: 'duration' }) -export class DurationPipe extends O3rDurationPipe implements PipeTransform {} diff --git a/packages/@o3r/components/src/tools/pipes/duration/index.ts b/packages/@o3r/components/src/tools/pipes/duration/index.ts index 968555b52a..026186e655 100644 --- a/packages/@o3r/components/src/tools/pipes/duration/index.ts +++ b/packages/@o3r/components/src/tools/pipes/duration/index.ts @@ -1,2 +1 @@ -export * from './duration.module'; export * from './duration.pipe'; diff --git a/packages/@o3r/components/src/tools/pipes/keep-white-space/index.ts b/packages/@o3r/components/src/tools/pipes/keep-white-space/index.ts index 2a51c3878f..f64a23c9e5 100644 --- a/packages/@o3r/components/src/tools/pipes/keep-white-space/index.ts +++ b/packages/@o3r/components/src/tools/pipes/keep-white-space/index.ts @@ -1,2 +1 @@ -export * from './keep-white-space.module'; export * from './keep-white-space.pipe'; diff --git a/packages/@o3r/components/src/tools/pipes/keep-white-space/keep-white-space.module.ts b/packages/@o3r/components/src/tools/pipes/keep-white-space/keep-white-space.module.ts deleted file mode 100644 index a2b370f43f..0000000000 --- a/packages/@o3r/components/src/tools/pipes/keep-white-space/keep-white-space.module.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { - NgModule, -} from '@angular/core'; -import { - KeepWhiteSpacePipe, -} from './keep-white-space.pipe'; - -/** - * @deprecated please use O3rKeepWhiteSpacePipe, will be removed in v12. - */ -@NgModule({ - declarations: [KeepWhiteSpacePipe], - exports: [KeepWhiteSpacePipe] -}) -export class KeepWhiteSpacePipeModule {} diff --git a/packages/@o3r/components/src/tools/pipes/keep-white-space/keep-white-space.pipe.spec.ts b/packages/@o3r/components/src/tools/pipes/keep-white-space/keep-white-space.pipe.spec.ts index 7138b582dd..e6d7209a43 100644 --- a/packages/@o3r/components/src/tools/pipes/keep-white-space/keep-white-space.pipe.spec.ts +++ b/packages/@o3r/components/src/tools/pipes/keep-white-space/keep-white-space.pipe.spec.ts @@ -1,29 +1,23 @@ import { - KeepWhiteSpacePipe, O3rKeepWhiteSpacePipe, } from './keep-white-space.pipe'; describe('Keep white space pipe', () => { let pipe: O3rKeepWhiteSpacePipe; - let deprecatedPipe: KeepWhiteSpacePipe; beforeEach(() => { pipe = new O3rKeepWhiteSpacePipe(); - deprecatedPipe = new KeepWhiteSpacePipe(); }); it('does nothing when no white spaces', () => { expect(pipe.transform('Guatemala')).toEqual('Guatemala'); - expect(deprecatedPipe.transform('Guatemala')).toEqual('Guatemala'); }); it('should work with space inside the word', () => { expect(pipe.transform('French Guiana')).toEqual('French Guiana'); - expect(deprecatedPipe.transform('French Guiana')).toEqual('French Guiana'); }); it('should do nothing when empty string', () => { expect(pipe.transform('')).toEqual(''); - expect(deprecatedPipe.transform('')).toEqual(''); }); }); diff --git a/packages/@o3r/components/src/tools/pipes/keep-white-space/keep-white-space.pipe.ts b/packages/@o3r/components/src/tools/pipes/keep-white-space/keep-white-space.pipe.ts index 6de7d556f3..34b3aa0e1a 100644 --- a/packages/@o3r/components/src/tools/pipes/keep-white-space/keep-white-space.pipe.ts +++ b/packages/@o3r/components/src/tools/pipes/keep-white-space/keep-white-space.pipe.ts @@ -11,11 +11,3 @@ export class O3rKeepWhiteSpacePipe implements PipeTransform { return value.replace(/\s/g, ' '); } } - -/** - * @deprecated please use O3rKeepWhiteSpacePipe, will be removed in v12. - */ -@Pipe({ - name: 'keepWhiteSpace' -}) -export class KeepWhiteSpacePipe extends O3rKeepWhiteSpacePipe implements PipeTransform {} diff --git a/packages/@o3r/components/src/tools/pipes/replace-with-bold/index.ts b/packages/@o3r/components/src/tools/pipes/replace-with-bold/index.ts index bead6ad185..80f7b7cd91 100644 --- a/packages/@o3r/components/src/tools/pipes/replace-with-bold/index.ts +++ b/packages/@o3r/components/src/tools/pipes/replace-with-bold/index.ts @@ -1,2 +1 @@ -export * from './replace-with-bold.module'; export * from './replace-with-bold.pipe'; diff --git a/packages/@o3r/components/src/tools/pipes/replace-with-bold/replace-with-bold.module.ts b/packages/@o3r/components/src/tools/pipes/replace-with-bold/replace-with-bold.module.ts deleted file mode 100644 index 3b56fc8cd9..0000000000 --- a/packages/@o3r/components/src/tools/pipes/replace-with-bold/replace-with-bold.module.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { - NgModule, -} from '@angular/core'; -import { - ReplaceWithBoldPipe, -} from './replace-with-bold.pipe'; - -/** - * @deprecated please use O3rReplaceWithBoldPipe, will be removed in v12. - */ -@NgModule({ - declarations: [ReplaceWithBoldPipe], - exports: [ReplaceWithBoldPipe] -}) -export class ReplaceWithBoldPipeModule {} diff --git a/packages/@o3r/components/src/tools/pipes/replace-with-bold/replace-with-bold.pipe.spec.ts b/packages/@o3r/components/src/tools/pipes/replace-with-bold/replace-with-bold.pipe.spec.ts index e1df14b1d2..b19d37f26e 100644 --- a/packages/@o3r/components/src/tools/pipes/replace-with-bold/replace-with-bold.pipe.spec.ts +++ b/packages/@o3r/components/src/tools/pipes/replace-with-bold/replace-with-bold.pipe.spec.ts @@ -1,49 +1,39 @@ import { O3rReplaceWithBoldPipe, - ReplaceWithBoldPipe, } from './replace-with-bold.pipe'; describe('Replace with bold pipe', () => { let pipe: O3rReplaceWithBoldPipe; - let deprecatedPipe: ReplaceWithBoldPipe; beforeEach(() => { pipe = new O3rReplaceWithBoldPipe(); - deprecatedPipe = new ReplaceWithBoldPipe(); }); it('search if the input match the label and change it to bold', () => { expect(pipe.transform('Guatemala', 'te')).toEqual('Guatemala'); - expect(deprecatedPipe.transform('Guatemala', 'te')).toEqual('Guatemala'); }); it('does nothing when no match', () => { expect(pipe.transform('Guatemala', 'sp')).toEqual('Guatemala'); - expect(deprecatedPipe.transform('Guatemala', 'sp')).toEqual('Guatemala'); }); it('should work with space inside the word', () => { expect(pipe.transform('French Guiana', 'g')).toEqual('French Guiana'); - expect(deprecatedPipe.transform('French Guiana', 'g')).toEqual('French Guiana'); }); it('search input match - special character test', () => { expect(pipe.transform('Finland (HEL)', '(H')).toEqual('Finland (HEL)'); - expect(deprecatedPipe.transform('Finland (HEL)', '(H')).toEqual('Finland (HEL)'); }); it('should ignore white spaces at the beginning', () => { expect(pipe.transform('Finland (HEL)', ' (H')).toEqual('Finland (HEL)'); - expect(deprecatedPipe.transform('Finland (HEL)', ' (H')).toEqual('Finland (HEL)'); }); it('should ignore white spaces', () => { expect(pipe.transform('Finland (HEL)', ' (H ')).toEqual('Finland (HEL)'); - expect(deprecatedPipe.transform('Finland (HEL)', ' (H ')).toEqual('Finland (HEL)'); }); it('should not ignore white spaces in the middle (no matches)', () => { expect(pipe.transform('Finland (HEL)', ' (H E')).toEqual('Finland (HEL)'); - expect(deprecatedPipe.transform('Finland (HEL)', ' (H E')).toEqual('Finland (HEL)'); }); }); diff --git a/packages/@o3r/components/src/tools/pipes/replace-with-bold/replace-with-bold.pipe.ts b/packages/@o3r/components/src/tools/pipes/replace-with-bold/replace-with-bold.pipe.ts index a7d7596628..3e26119e04 100644 --- a/packages/@o3r/components/src/tools/pipes/replace-with-bold/replace-with-bold.pipe.ts +++ b/packages/@o3r/components/src/tools/pipes/replace-with-bold/replace-with-bold.pipe.ts @@ -19,15 +19,3 @@ export class O3rReplaceWithBoldPipe implements PipeTransform { } } } - -/** - * @deprecated please use O3rReplaceWithBoldPipe, will be removed in v12. - */ -@Pipe({ - name: 'replaceWithBold' -}) -export class ReplaceWithBoldPipe extends O3rReplaceWithBoldPipe implements PipeTransform { - public escapeRegExp(str: string) { - return escapeRegExp(str); - } -} diff --git a/packages/@o3r/configuration/package.json b/packages/@o3r/configuration/package.json index c6064931fc..1b47cf91ee 100644 --- a/packages/@o3r/configuration/package.json +++ b/packages/@o3r/configuration/package.json @@ -46,6 +46,7 @@ "express-interceptor": "^1.2.0", "jasmine": "^5.0.0", "rxjs": "^7.8.1", + "ts-node": "~10.9.2", "typescript": "^5.5.4" }, "peerDependenciesMeta": { diff --git a/packages/@o3r/configuration/schematics/use-config-signal/index.spec.ts b/packages/@o3r/configuration/schematics/use-config-signal/index.spec.ts index 51b65f6d96..0ee60228a5 100644 --- a/packages/@o3r/configuration/schematics/use-config-signal/index.spec.ts +++ b/packages/@o3r/configuration/schematics/use-config-signal/index.spec.ts @@ -33,7 +33,7 @@ describe('Migrate to config signal-based', () => { /** Configuration stream based on the input and the stored configuration*/ public config$: Observable; - @ConfigObserver() + @O3rConfig() private readonly dynamicConfig$: ConfigurationObserver; /** Input configuration to override the default configuration of the component */ diff --git a/packages/@o3r/configuration/src/core/configuration.ts b/packages/@o3r/configuration/src/core/configuration.ts index d0bc0a94c7..3c6fc5fe5c 100644 --- a/packages/@o3r/configuration/src/core/configuration.ts +++ b/packages/@o3r/configuration/src/core/configuration.ts @@ -1,5 +1,4 @@ import { - computeItemIdentifier, deepFill, } from '@o3r/core'; import { @@ -31,16 +30,6 @@ export interface Identifiable { id: string; } -/** - * Get the configuration name - * @deprecated use {@link computeItemIdentifier} from @o3r/core. Will be removed in v12 - * @param componentName Name of the component to get the configuration - * @param libraryName Name of the library the component is coming from - */ -export function computeConfigurationName(componentName: string, libraryName?: string) { - return computeItemIdentifier(componentName, libraryName); -} - /** * Get the component and library's names based on the configuration name * @param configurationName Name of the component as found in the store diff --git a/packages/@o3r/configuration/src/devkit/configuration-devtools.console.service.ts b/packages/@o3r/configuration/src/devkit/configuration-devtools.console.service.ts index 03d097aea9..39db01b459 100644 --- a/packages/@o3r/configuration/src/devkit/configuration-devtools.console.service.ts +++ b/packages/@o3r/configuration/src/devkit/configuration-devtools.console.service.ts @@ -142,15 +142,6 @@ export class ConfigurationDevtoolsConsoleService implements DevtoolsServiceInter this.copyElementToClipboard(JSON.stringify(configs)); } - /** - * Load a json configuration - * @param configurations configurations to load - * @deprecated please use `updateConfigurations` instead, will be removed in Otter v12. - */ - public loadConfiguration(configurations: string | CustomConfig[]): void { - this.configurationDevtools.loadConfiguration(configurations); - } - /** * Replace N configurations in one shot * @param configurations array of configurations to update diff --git a/packages/@o3r/configuration/src/devkit/configuration-devtools.service.ts b/packages/@o3r/configuration/src/devkit/configuration-devtools.service.ts index 6b0c770bef..67e31877b1 100644 --- a/packages/@o3r/configuration/src/devkit/configuration-devtools.service.ts +++ b/packages/@o3r/configuration/src/devkit/configuration-devtools.service.ts @@ -9,6 +9,7 @@ import { Store, } from '@ngrx/store'; import { + computeItemIdentifier, Configuration, CustomConfig, } from '@o3r/core'; @@ -22,7 +23,6 @@ import { shareReplay, } from 'rxjs/operators'; import { - computeConfigurationName, parseConfigurationName, } from '../core'; import { @@ -78,12 +78,12 @@ export class OtterConfigurationDevtools { */ public getComponentConfigName(selector: string | { library?: string; componentName: string }, isFallbackName = false) { if (!isFallbackName) { - return typeof selector === 'string' ? selector : computeConfigurationName(selector.componentName, selector.library || this.options.defaultLibraryName); + return typeof selector === 'string' ? selector : computeItemIdentifier(selector.componentName, selector.library || this.options.defaultLibraryName); } return typeof selector === 'string' - ? computeConfigurationName(selector, this.options.defaultLibraryName || 'global') - : computeConfigurationName(selector.componentName, this.options.defaultLibraryName || 'global'); + ? computeItemIdentifier(selector, this.options.defaultLibraryName || 'global') + : computeItemIdentifier(selector.componentName, this.options.defaultLibraryName || 'global'); } /** diff --git a/packages/@o3r/configuration/src/tools/configuration.decorators.ts b/packages/@o3r/configuration/src/tools/configuration.decorators.ts index 4389a7d4bc..deb176f8fd 100644 --- a/packages/@o3r/configuration/src/tools/configuration.decorators.ts +++ b/packages/@o3r/configuration/src/tools/configuration.decorators.ts @@ -29,15 +29,6 @@ const decorator = (target: any, key: string) => { } }; -/** - * Decorator to identify the configuration observer - * @deprecated please use O3rConfig, will be removed in v12 - */ -// eslint-disable-next-line @typescript-eslint/naming-convention -- decorator should be PascalCase -export function ConfigObserver() { - return decorator; -} - /** * Decorator to identify the component's configuration */ diff --git a/packages/@o3r/configuration/src/tools/configuration.signal.ts b/packages/@o3r/configuration/src/tools/configuration.signal.ts index 8e4e3bd086..75a3531757 100644 --- a/packages/@o3r/configuration/src/tools/configuration.signal.ts +++ b/packages/@o3r/configuration/src/tools/configuration.signal.ts @@ -33,30 +33,8 @@ export function configSignal( configInput: InputSignal | undefined>, configId: string, defaultConfig: T -): ConfigurationSignal; -/** - * Get a configuration signal - * @param configInput - * @param configId - * @param defaultConfig - * @param configurationService - * @deprecated please do not provide `configurationService`, will be removed in v12 - */ -export function configSignal( - configInput: InputSignal | undefined>, - configId: string, - defaultConfig: T, - // eslint-disable-next-line @typescript-eslint/unified-signatures -- deprecated will be removed in v12 - configurationService?: ConfigurationBaseService | null -): ConfigurationSignal; -// eslint-disable-next-line jsdoc/require-jsdoc -- overload signature will be removed in v12 -export function configSignal( - configInput: InputSignal | undefined>, - configId: string, - defaultConfig: T, - configurationService?: ConfigurationBaseService | null ): ConfigurationSignal { - configurationService = configurationService ?? inject(ConfigurationBaseService, { optional: true }); + const configurationService = inject(ConfigurationBaseService, { optional: true }); if (configurationService) { configurationService.extendConfiguration(defaultConfig, configId); } diff --git a/packages/@o3r/core/package.json b/packages/@o3r/core/package.json index 7e167b9d63..51ccc19ed5 100644 --- a/packages/@o3r/core/package.json +++ b/packages/@o3r/core/package.json @@ -40,6 +40,7 @@ "chokidar": "^3.5.2", "globby": "^11.1.0", "rxjs": "^7.8.1", + "ts-node": "~10.9.2", "type-fest": "^4.10.2", "typescript": "^5.5.4" }, @@ -156,8 +157,8 @@ "@o3r/store-sync": "workspace:^", "@stylistic/eslint-plugin": "~2.7.0", "@types/jest": "~29.5.2", - "@typescript-eslint/eslint-plugin": "~8.17.0", - "@typescript-eslint/parser": "~8.17.0", + "@typescript-eslint/eslint-plugin": "~8.18.0", + "@typescript-eslint/parser": "~8.18.0", "angular-eslint": "~18.4.0", "cpy-cli": "^5.0.0", "eslint": "~9.14.0", @@ -176,7 +177,7 @@ "jest-preset-angular": "~14.2.0", "jsonc-eslint-parser": "~2.4.0", "nx": "~19.8.0", - "typescript-eslint": "~8.17.0", + "typescript-eslint": "~8.18.0", "zone.js": "~0.14.2" }, "engines": { diff --git a/packages/@o3r/design/package.json b/packages/@o3r/design/package.json index baf5ffbf65..a626aaf3c4 100644 --- a/packages/@o3r/design/package.json +++ b/packages/@o3r/design/package.json @@ -50,6 +50,7 @@ "jsonschema": "~1.4.1", "minimatch": "~9.0.3", "minimist": "^1.2.6", + "ts-node": "~10.9.2", "tslib": "^2.6.2" }, "peerDependencies": { diff --git a/packages/@o3r/dynamic-content/package.json b/packages/@o3r/dynamic-content/package.json index d0095ce9b2..b5ebdae4d5 100644 --- a/packages/@o3r/dynamic-content/package.json +++ b/packages/@o3r/dynamic-content/package.json @@ -41,7 +41,8 @@ "cheerio": "^1.0.0-rc.10", "express-interceptor": "^1.2.0", "jasmine": "^5.0.0", - "rxjs": "^7.8.1" + "rxjs": "^7.8.1", + "ts-node": "~10.9.2" }, "peerDependenciesMeta": { "@angular-devkit/schematics": { diff --git a/packages/@o3r/dynamic-content/src/services/dynamic-content/dynamic-content.module.ts b/packages/@o3r/dynamic-content/src/services/dynamic-content/dynamic-content.module.ts index e36c5e9688..6d5f1a16ec 100644 --- a/packages/@o3r/dynamic-content/src/services/dynamic-content/dynamic-content.module.ts +++ b/packages/@o3r/dynamic-content/src/services/dynamic-content/dynamic-content.module.ts @@ -3,7 +3,6 @@ import { NgModule, } from '@angular/core'; import { - DynamicContentPipe, O3rDynamicContentPipe, } from './dynamic-content.pipe'; import { @@ -30,7 +29,7 @@ export function getCmsAssets() { } @NgModule({ - declarations: [DynamicContentPipe, O3rDynamicContentPipe], + declarations: [O3rDynamicContentPipe], providers: [ { provide: DYNAMIC_CONTENT_BASE_PATH_TOKEN, @@ -42,7 +41,7 @@ export function getCmsAssets() { }, DynamicContentService ], - exports: [DynamicContentPipe, O3rDynamicContentPipe] + exports: [O3rDynamicContentPipe] }) /** * DynamicContent module diff --git a/packages/@o3r/dynamic-content/src/services/dynamic-content/dynamic-content.pipe.spec.ts b/packages/@o3r/dynamic-content/src/services/dynamic-content/dynamic-content.pipe.spec.ts index 364ae6dae6..8cf8bd4ccb 100644 --- a/packages/@o3r/dynamic-content/src/services/dynamic-content/dynamic-content.pipe.spec.ts +++ b/packages/@o3r/dynamic-content/src/services/dynamic-content/dynamic-content.pipe.spec.ts @@ -17,7 +17,6 @@ import { of, } from 'rxjs'; import { - DynamicContentPipe, O3rDynamicContentPipe, } from './dynamic-content.pipe'; import { @@ -31,7 +30,7 @@ const serviceMock: InterfaceOf = { }; @Component({ - template: `{{'assets.png' | o3rDynamicContent}}{{'deprecatedPipe.png' | dynamicContent}}` + template: `{{'assets.png' | o3rDynamicContent}}` }) class HostTestComponent {} @@ -44,7 +43,7 @@ describe('DynamicContentPipe', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [O3rDynamicContentPipe, DynamicContentPipe, HostTestComponent], + declarations: [O3rDynamicContentPipe, HostTestComponent], providers: [{ provide: DynamicContentService, useValue: serviceMock }] }).compileComponents(); @@ -55,6 +54,5 @@ describe('DynamicContentPipe', () => { fixture.detectChanges(); expect(serviceMock.getMediaPathStream).toHaveBeenCalledWith('assets.png'); - expect(serviceMock.getMediaPathStream).toHaveBeenCalledWith('deprecatedPipe.png'); }); }); diff --git a/packages/@o3r/dynamic-content/src/services/dynamic-content/dynamic-content.pipe.ts b/packages/@o3r/dynamic-content/src/services/dynamic-content/dynamic-content.pipe.ts index de9d690487..fae8fbaa9f 100644 --- a/packages/@o3r/dynamic-content/src/services/dynamic-content/dynamic-content.pipe.ts +++ b/packages/@o3r/dynamic-content/src/services/dynamic-content/dynamic-content.pipe.ts @@ -47,7 +47,3 @@ export class O3rDynamicContentPipe implements PipeTransform, OnDestroy { } } } - -/** @deprecated please use O3rDynamicContentPipe, will be removed in v12. */ -@Pipe({ name: 'dynamicContent', pure: false }) -export class DynamicContentPipe extends O3rDynamicContentPipe implements PipeTransform {} diff --git a/packages/@o3r/eslint-config-otter/package.json b/packages/@o3r/eslint-config-otter/package.json index 4590f93e7e..8f941da1de 100644 --- a/packages/@o3r/eslint-config-otter/package.json +++ b/packages/@o3r/eslint-config-otter/package.json @@ -70,12 +70,13 @@ "eslint-plugin-jsdoc": "^48.11.0 || ^49.0.0 || ^50.0.0", "eslint-plugin-prefer-arrow": "^1.2.2", "eslint-plugin-unicorn": "^54.0.0 || ^55.0.0 || ^56.0.0", + "ts-node": "~10.9.2", "typescript": "^5.5.4" }, "generatorDependencies": { - "@typescript-eslint/eslint-plugin": "~8.17.0", - "@typescript-eslint/parser": "~8.17.0", - "@typescript-eslint/utils": "~8.17.0", + "@typescript-eslint/eslint-plugin": "~8.18.0", + "@typescript-eslint/parser": "~8.18.0", + "@typescript-eslint/utils": "~8.18.0", "eslint": "~9.14.0", "eslint-plugin-jsdoc": "~50.2.0", "eslint-plugin-unicorn": "^56.0.0" diff --git a/packages/@o3r/eslint-plugin/package.json b/packages/@o3r/eslint-plugin/package.json index 3f986efa21..1e832a1842 100644 --- a/packages/@o3r/eslint-plugin/package.json +++ b/packages/@o3r/eslint-plugin/package.json @@ -28,6 +28,7 @@ "@typescript-eslint/utils": "~8.18.0", "globby": "^11.1.0", "semver": "^7.5.2", + "ts-node": "~10.9.2", "tslib": "^2.6.2", "type-fest": "^4.10.2" }, diff --git a/packages/@o3r/eslint-plugin/src/rules/typescript/matching-configuration-name/matching-configuration-name.spec.ts b/packages/@o3r/eslint-plugin/src/rules/typescript/matching-configuration-name/matching-configuration-name.spec.ts index 4fc18a347b..52d2f03032 100644 --- a/packages/@o3r/eslint-plugin/src/rules/typescript/matching-configuration-name/matching-configuration-name.spec.ts +++ b/packages/@o3r/eslint-plugin/src/rules/typescript/matching-configuration-name/matching-configuration-name.spec.ts @@ -9,25 +9,25 @@ ruleTester.run('matching-configuration-name', matchingConfigurationNameRule, { code: ` export interface MyFirstConfig extends Configuration {} - export const MY_CONFIG_ID = computeConfigurationName('MyFirstConfig', '@example/config'); + export const MY_CONFIG_ID = computeItemIdentifier('MyFirstConfig', '@example/config'); `.trim() }, { code: ` export interface MySecondConfig extends Configuration {} export interface MyThirdConfig extends Configuration {} - export const MY_CONFIG_ID = computeConfigurationName('MyThirdConfig', '@example/config'); + export const MY_CONFIG_ID = computeItemIdentifier('MyThirdConfig', '@example/config'); `.trim() }, { code: ` export interface MyFourthConfig extends Configuration {} export interface MyFifthConfig extends Configuration {} - export const MY_CONFIG_ID = computeConfigurationName('MyFourthConfig', '@example/config'); + export const MY_CONFIG_ID = computeItemIdentifier('MyFourthConfig', '@example/config'); `.trim() }, { code: ` - export const MY_CONFIG_ID = computeConfigurationName('MyConfig', '@example/config'); + export const MY_CONFIG_ID = computeItemIdentifier('MyConfig', '@example/config'); `.trim() } ], @@ -36,7 +36,7 @@ ruleTester.run('matching-configuration-name', matchingConfigurationNameRule, { code: ` export interface MyConfig extends Configuration {} -export const MY_CONFIG_ID = computeConfigurationName('InvalidName', '@example/config'); +export const MY_CONFIG_ID = computeItemIdentifier('InvalidName', '@example/config'); `.trim(), errors: [{ messageId: 'error', @@ -53,21 +53,21 @@ export const MY_CONFIG_ID = computeConfigurationName('InvalidName', '@example/co output: ` export interface MyConfig extends Configuration {} -export const MY_CONFIG_ID = computeConfigurationName('MyConfig', '@example/config'); +export const MY_CONFIG_ID = computeItemIdentifier('MyConfig', '@example/config'); `.trim() }] }], output: ` export interface MyConfig extends Configuration {} -export const MY_CONFIG_ID = computeConfigurationName('MyConfig', '@example/config'); +export const MY_CONFIG_ID = computeItemIdentifier('MyConfig', '@example/config'); `.trim() }, { code: ` export interface MyFirstConfig extends Configuration {} export interface MySecondConfig extends Configuration {} -export const MY_CONFIG_ID = computeConfigurationName('InvalidName', '@example/config'); +export const MY_CONFIG_ID = computeItemIdentifier('InvalidName', '@example/config'); `.trim(), errors: [{ messageId: 'error', @@ -86,7 +86,7 @@ export const MY_CONFIG_ID = computeConfigurationName('InvalidName', '@example/co export interface MyFirstConfig extends Configuration {} export interface MySecondConfig extends Configuration {} -export const MY_CONFIG_ID = computeConfigurationName('MyFirstConfig', '@example/config'); +export const MY_CONFIG_ID = computeItemIdentifier('MyFirstConfig', '@example/config'); `.trim() }, { @@ -99,7 +99,7 @@ export const MY_CONFIG_ID = computeConfigurationName('MyFirstConfig', '@example/ export interface MyFirstConfig extends Configuration {} export interface MySecondConfig extends Configuration {} -export const MY_CONFIG_ID = computeConfigurationName('MySecondConfig', '@example/config'); +export const MY_CONFIG_ID = computeItemIdentifier('MySecondConfig', '@example/config'); `.trim() } ] @@ -108,7 +108,7 @@ export const MY_CONFIG_ID = computeConfigurationName('MySecondConfig', '@example export interface MyFirstConfig extends Configuration {} export interface MySecondConfig extends Configuration {} -export const MY_CONFIG_ID = computeConfigurationName('MyFirstConfig', '@example/config'); +export const MY_CONFIG_ID = computeItemIdentifier('MyFirstConfig', '@example/config'); `.trim() } ] diff --git a/packages/@o3r/eslint-plugin/src/rules/typescript/matching-configuration-name/matching-configuration-name.ts b/packages/@o3r/eslint-plugin/src/rules/typescript/matching-configuration-name/matching-configuration-name.ts index 74f0c34f59..ae0ba738f5 100644 --- a/packages/@o3r/eslint-plugin/src/rules/typescript/matching-configuration-name/matching-configuration-name.ts +++ b/packages/@o3r/eslint-plugin/src/rules/typescript/matching-configuration-name/matching-configuration-name.ts @@ -5,7 +5,7 @@ import { createRule, } from '../../utils'; -const nameDeterminingFunctionNames = ['computeItemIdentifier', 'computeConfigurationName']; +const nameDeterminingFunctionNames = ['computeItemIdentifier']; export default createRule({ name: 'matching-configuration-name', @@ -15,7 +15,7 @@ export default createRule({ type: 'problem', docs: { description: 'Ensures that the configuration interface name matches the first parameter of `computeItemIdentifier`' - + ' (or `computeConfigurationName`) used beside the configuration interface to expose its ID (as generated by the configuration module).' + + ' used beside the configuration interface to expose its ID (as generated by the configuration module).' }, schema: [], messages: { diff --git a/packages/@o3r/extractors/package.json b/packages/@o3r/extractors/package.json index d58f0f14b0..326d7f93c0 100644 --- a/packages/@o3r/extractors/package.json +++ b/packages/@o3r/extractors/package.json @@ -36,6 +36,7 @@ "@yarnpkg/plugin-pack": "^4.0.0", "globby": "^11.1.0", "semver": "^7.5.2", + "ts-node": "~10.9.2", "type-fest": "^4.10.2", "typescript": "^5.5.4" }, diff --git a/packages/@o3r/forms/package.json b/packages/@o3r/forms/package.json index 03649b7f1f..51b5fc3fe1 100644 --- a/packages/@o3r/forms/package.json +++ b/packages/@o3r/forms/package.json @@ -29,7 +29,8 @@ "@o3r/core": "workspace:^", "@o3r/schematics": "workspace:^", "@schematics/angular": "^18.2.0", - "rxjs": "^7.8.1" + "rxjs": "^7.8.1", + "ts-node": "~10.9.2" }, "peerDependenciesMeta": { "@angular-devkit/schematics": { diff --git a/packages/@o3r/localization/package.json b/packages/@o3r/localization/package.json index 5943f8ec10..3872973cfd 100644 --- a/packages/@o3r/localization/package.json +++ b/packages/@o3r/localization/package.json @@ -58,6 +58,7 @@ "intl-messageformat": "^10.7.0", "rxjs": "^7.8.1", "semver": "^7.5.2", + "ts-node": "~10.9.2", "type-fest": "^4.10.2", "typescript": "^5.5.4" }, diff --git a/packages/@o3r/localization/src/tools/localization-translate.pipe.spec.ts b/packages/@o3r/localization/src/tools/localization-translate.pipe.spec.ts index bb8664f087..faac556490 100644 --- a/packages/@o3r/localization/src/tools/localization-translate.pipe.spec.ts +++ b/packages/@o3r/localization/src/tools/localization-translate.pipe.spec.ts @@ -19,7 +19,6 @@ import { of, } from 'rxjs'; import { - LocalizationTranslatePipe, O3rLocalizationTranslatePipe, } from './localization-translate.pipe'; import { @@ -62,7 +61,6 @@ describe('LocalizationTranslatePipe', () => { let localizationService: LocalizationService; let translate: TranslateService; let pipe: O3rLocalizationTranslatePipe; - let deprecatedPipe: LocalizationTranslatePipe; let ref: any; describe('enableTranslationDeactivation OFF', () => { @@ -83,7 +81,6 @@ describe('LocalizationTranslatePipe', () => { translate = TestBed.inject(TranslateService); ref = new FakeChangeDetectorRef(); pipe = new O3rLocalizationTranslatePipe(localizationService, translate, ref, TestBed.inject(LOCALIZATION_CONFIGURATION_TOKEN)); - deprecatedPipe = new LocalizationTranslatePipe(localizationService, translate, ref, TestBed.inject(LOCALIZATION_CONFIGURATION_TOKEN)); expect(() => localizationService.toggleShowKeys()).toThrow(); }); @@ -113,24 +110,19 @@ describe('LocalizationTranslatePipe', () => { translate = TestBed.inject(TranslateService); ref = new FakeChangeDetectorRef(); pipe = new O3rLocalizationTranslatePipe(localizationService, translate, ref, TestBed.inject(LOCALIZATION_CONFIGURATION_TOKEN)); - deprecatedPipe = new LocalizationTranslatePipe(localizationService, translate, ref, TestBed.inject(LOCALIZATION_CONFIGURATION_TOKEN)); }); it('Should not translate if ShowKeys is activated', () => { localizationService.toggleShowKeys(); expect(pipe.transform('test')).toEqual('test'); - expect(deprecatedPipe.transform('test')).toEqual('test'); expect(pipe.transform('testParams', '{param1: "with param-1", param2: "and param-2"}')).toEqual('testParams'); - expect(deprecatedPipe.transform('testParams', '{param1: "with param-1", param2: "and param-2"}')).toEqual('testParams'); }); it('Should translate if ShowKeys is no activated', () => { expect(pipe.transform('test')).toEqual('This is a test'); - expect(deprecatedPipe.transform('test')).toEqual('This is a test'); expect(pipe.transform('testParams', '{param1: "with param-1", param2: "and param-2"}')).toEqual('This is a test with param-1 and param-2'); - expect(deprecatedPipe.transform('testParams', '{param1: "with param-1", param2: "and param-2"}')).toEqual('This is a test with param-1 and param-2'); }); }); @@ -160,24 +152,19 @@ describe('LocalizationTranslatePipe', () => { translate = TestBed.inject(TranslateService); ref = new FakeChangeDetectorRef(); pipe = new O3rLocalizationTranslatePipe(localizationService, translate, ref, TestBed.inject(LOCALIZATION_CONFIGURATION_TOKEN)); - deprecatedPipe = new LocalizationTranslatePipe(localizationService, translate, ref, TestBed.inject(LOCALIZATION_CONFIGURATION_TOKEN)); }); it('Should not translate if ShowKeys is activated', () => { localizationService.toggleShowKeys(); expect(pipe.transform('test')).toEqual('test'); - expect(deprecatedPipe.transform('test')).toEqual('test'); expect(pipe.transform('testParams', '{param1: "with param-1", param2: "and param-2"}')).toEqual('testParams'); - expect(deprecatedPipe.transform('testParams', '{param1: "with param-1", param2: "and param-2"}')).toEqual('testParams'); }); it('Should display both key and value if ShowKeys is no activated', () => { expect(pipe.transform('test')).toEqual('test - This is a test'); - expect(deprecatedPipe.transform('test')).toEqual('test - This is a test'); expect(pipe.transform('testParams', '{param1: "with param-1", param2: "and param-2"}')).toEqual('testParams - This is a test with param-1 and param-2'); - expect(deprecatedPipe.transform('testParams', '{param1: "with param-1", param2: "and param-2"}')).toEqual('testParams - This is a test with param-1 and param-2'); }); }); }); diff --git a/packages/@o3r/localization/src/tools/localization-translate.pipe.ts b/packages/@o3r/localization/src/tools/localization-translate.pipe.ts index 947b30d6e9..84ca2976b8 100644 --- a/packages/@o3r/localization/src/tools/localization-translate.pipe.ts +++ b/packages/@o3r/localization/src/tools/localization-translate.pipe.ts @@ -103,10 +103,3 @@ export class O3rLocalizationTranslatePipe extends TranslatePipe implements PipeT } } } - -/** - * TranslatePipe class adding debug functionality - * @deprecated please use O3rLocalizationTranslatePipe, will be removed in v12. - */ -@Pipe({ name: 'translate', pure: false }) -export class LocalizationTranslatePipe extends O3rLocalizationTranslatePipe implements PipeTransform {} diff --git a/packages/@o3r/localization/src/tools/localization.module.ts b/packages/@o3r/localization/src/tools/localization.module.ts index e254ec4c65..6c0c353969 100644 --- a/packages/@o3r/localization/src/tools/localization.module.ts +++ b/packages/@o3r/localization/src/tools/localization.module.ts @@ -29,7 +29,6 @@ import { LocalizationTranslateDirective, } from './localization-translate.directive'; import { - LocalizationTranslatePipe, O3rLocalizationTranslatePipe, } from './localization-translate.pipe'; import { @@ -77,9 +76,9 @@ export function localeIdNgBridge(localizationService: LocalizationService) { export const CUSTOM_LOCALIZATION_CONFIGURATION_TOKEN = new InjectionToken>('Partial Localization configuration'); @NgModule({ - declarations: [O3rLocalizationTranslatePipe, LocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe], + declarations: [O3rLocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe], imports: [TranslateModule, BidiModule, DynamicContentModule, CommonModule], - exports: [TranslateModule, O3rLocalizationTranslatePipe, LocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe], + exports: [TranslateModule, O3rLocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe], providers: [ { provide: LOCALIZATION_CONFIGURATION_TOKEN, useFactory: createLocalizationConfiguration, deps: [[new Optional(), CUSTOM_LOCALIZATION_CONFIGURATION_TOKEN]] }, { provide: LOCALE_ID, useFactory: localeIdNgBridge, deps: [LocalizationService] }, diff --git a/packages/@o3r/logger/package.json b/packages/@o3r/logger/package.json index d2987591ff..03c1596836 100644 --- a/packages/@o3r/logger/package.json +++ b/packages/@o3r/logger/package.json @@ -31,7 +31,8 @@ "logrocket": "^8.1.0", "logrocket-ngrx": "^0.2.1", "rxjs": "^7.8.1", - "smartlook-client": "^9.0.0" + "smartlook-client": "^9.0.0", + "ts-node": "~10.9.2" }, "peerDependenciesMeta": { "@angular-devkit/schematics": { diff --git a/packages/@o3r/new-version/package.json b/packages/@o3r/new-version/package.json index a9f4d48999..641dc24a27 100644 --- a/packages/@o3r/new-version/package.json +++ b/packages/@o3r/new-version/package.json @@ -21,6 +21,7 @@ }, "dependencies": { "semver": "^7.5.2", + "ts-node": "~10.9.2", "tslib": "^2.6.2" }, "peerDependencies": { diff --git a/packages/@o3r/routing/package.json b/packages/@o3r/routing/package.json index 54ce36945d..65b16db430 100644 --- a/packages/@o3r/routing/package.json +++ b/packages/@o3r/routing/package.json @@ -37,7 +37,8 @@ "@o3r/schematics": "workspace:^", "@schematics/angular": "^18.2.0", "jasmine": "^5.0.0", - "rxjs": "^7.8.1" + "rxjs": "^7.8.1", + "ts-node": "~10.9.2" }, "peerDependenciesMeta": { "@angular-devkit/schematics": { diff --git a/packages/@o3r/rules-engine/package.json b/packages/@o3r/rules-engine/package.json index 89ff21484c..5d1f5271cf 100644 --- a/packages/@o3r/rules-engine/package.json +++ b/packages/@o3r/rules-engine/package.json @@ -52,6 +52,7 @@ "jasmine": "^5.0.0", "jsonpath-plus": "^9.0.0 || ^10.0.0", "rxjs": "^7.8.1", + "ts-node": "~10.9.2", "typescript": "^5.5.4", "typescript-json-schema": "^0.65.0" }, diff --git a/packages/@o3r/rules-engine/schemas/rulesets.schema.json b/packages/@o3r/rules-engine/schemas/rulesets.schema.json index 0de0dff846..08f184cda6 100644 --- a/packages/@o3r/rules-engine/schemas/rulesets.schema.json +++ b/packages/@o3r/rules-engine/schemas/rulesets.schema.json @@ -50,11 +50,6 @@ }, "additionalItems": false }, - "linkedComponent": { - "$ref": "#/definitions/LinkedComponent", - "description": "Component linked to the ruleset, if set it will disable the ruleset execution per default, waiting to a subscription", - "deprecated": true - }, "linkedComponents": { "type": "object", "description": "Components linked to the ruleset. If defined, the rulest is not active by default", diff --git a/packages/@o3r/rules-engine/src/components/rules-engine/ruleset-history/ruleset-history-pres.template.html b/packages/@o3r/rules-engine/src/components/rules-engine/ruleset-history/ruleset-history-pres.template.html index 53031a400e..5ef4c3074d 100644 --- a/packages/@o3r/rules-engine/src/components/rules-engine/ruleset-history/ruleset-history-pres.template.html +++ b/packages/@o3r/rules-engine/src/components/rules-engine/ruleset-history/ruleset-history-pres.template.html @@ -12,8 +12,8 @@

Ruleset Execution History

[class.error]="execution.type === 'RulesetExecutionError'" (click)="toggleExpansion(execution.executionId, 'ruleset')">
{{execution.executionCounter}} - {{execution.rulesetName | titlecase }} -
- +
+
{{lc.name}} {{lc.library}} OR
diff --git a/packages/@o3r/rules-engine/src/components/rules-engine/shared/fallback-to.pipe.ts b/packages/@o3r/rules-engine/src/components/rules-engine/shared/fallback-to.pipe.ts index d6c6678946..6008702d05 100644 --- a/packages/@o3r/rules-engine/src/components/rules-engine/shared/fallback-to.pipe.ts +++ b/packages/@o3r/rules-engine/src/components/rules-engine/shared/fallback-to.pipe.ts @@ -9,9 +9,3 @@ export class O3rFallbackToPipe implements PipeTransform { return value === undefined ? fallback : value; } } - -/** - * @deprecated please use O3rFallbackToPipe, will be removed in v12. - */ -@Pipe({ name: 'fallbackTo' }) -export class FallbackToPipe extends O3rFallbackToPipe implements PipeTransform {} diff --git a/packages/@o3r/rules-engine/src/engine/engine.interface.ts b/packages/@o3r/rules-engine/src/engine/engine.interface.ts index be253e3133..89a068c390 100644 --- a/packages/@o3r/rules-engine/src/engine/engine.interface.ts +++ b/packages/@o3r/rules-engine/src/engine/engine.interface.ts @@ -94,14 +94,8 @@ export interface EngineRuleset { /** * Components linked to the ruleset. If present the ruleset will not be active by default. * 'or' condition: If at least one component has subscribed, the ruleset will become active. - * If present, the {@link linkedComponent} property will not be taken into consideration */ linkedComponents?: { or: ItemIdentifier[] }; - /** - * Component linked to the ruleset, if set it will disable the ruleset execution per default, waiting to a subscription - * @deprecated It will be removed in v12, use {@link linkedComponents} instead - */ - linkedComponent?: ItemIdentifier; /** Unique id of the ruleset*/ id: string; /** Stores the result of each rules from the ruleset */ @@ -153,7 +147,7 @@ export interface RuleEvaluationOutput { error?: any; } -/** Base obeject resulted at the end of a ruleset execution */ +/** Base object resulted at the end of a ruleset execution */ export interface BaseRulesetExecution { /** Id of the ruleset execution */ executionId: string; @@ -165,7 +159,7 @@ export interface BaseRulesetExecution { executionCounter: number; /** All input facts affecting the ruleset */ inputFacts: { factName: string; value: Facts }[]; - /** Runtime facts used accros the ruleset */ + /** Runtime facts used across the ruleset */ temporaryFacts?: Record; /** Facts changes that triggered the execution of the ruleset */ triggers: Record>; diff --git a/packages/@o3r/rules-engine/src/engine/ruleset-executor.ts b/packages/@o3r/rules-engine/src/engine/ruleset-executor.ts index 3da48c50b6..d00d9a6e7d 100644 --- a/packages/@o3r/rules-engine/src/engine/ruleset-executor.ts +++ b/packages/@o3r/rules-engine/src/engine/ruleset-executor.ts @@ -349,7 +349,6 @@ export class RulesetExecutor { return { id: this.ruleset.id, validityRange: this.ruleset.validityRange, - linkedComponent: this.ruleset.linkedComponent, linkedComponents: this.ruleset.linkedComponents, rulesResultsSubject$: result$ } as EngineRuleset; diff --git a/packages/@o3r/rules-engine/src/engine/structure.ts b/packages/@o3r/rules-engine/src/engine/structure.ts index 287c8b3e54..5214a6c600 100644 --- a/packages/@o3r/rules-engine/src/engine/structure.ts +++ b/packages/@o3r/rules-engine/src/engine/structure.ts @@ -143,12 +143,6 @@ export interface Ruleset { /** * Components linked to the ruleset. If present the ruleset will not be active by default. * 'or' condition: If at least one component has subscribed, the ruleset will become active. - * If provided, the {@link linkedComponent} property will not be taken into consideration */ linkedComponents?: { or: ItemIdentifier[] }; - /** - * Component linked to the ruleset, if set it will disable the ruleset execution per default, waiting to a subscription - * @deprecated It will be removed in v12, use {@link linkedComponents} instead - */ - linkedComponent?: ItemIdentifier; } diff --git a/packages/@o3r/rules-engine/src/interfaces/action.interfaces.ts b/packages/@o3r/rules-engine/src/interfaces/action.interfaces.ts deleted file mode 100644 index 3a218e44f4..0000000000 --- a/packages/@o3r/rules-engine/src/interfaces/action.interfaces.ts +++ /dev/null @@ -1,54 +0,0 @@ -import type { - ActionBlock, -} from '../engine/index'; - -/** - * Content of action that updates the configuration - * @deprecated use the one exposed by `@o3r/configuration` module. Will be removed in Otter v12. - */ -export interface ActionUpdateConfigBlock extends ActionBlock { - actionType: 'UPDATE_CONFIG'; - library: string; - component: string; - property: string; -} - -/** - * Content of action that updates an asset - * @deprecated use the one exposed by `@o3r/dynamic-content` module. Will be removed in Otter v12. - */ -export interface ActionUpdateAssetBlock extends ActionBlock { - actionType: 'UPDATE_ASSET'; - asset: string; - value: string; -} - -/** - * Content of action that updates localization - * @deprecated use the one exposed by `@o3r/localization` module. Will be removed in Otter v12. - */ -export interface ActionUpdateLocalisationBlock extends ActionBlock { - actionType: 'UPDATE_LOCALISATION'; - key: string; - value: string; -} - -/** - * Content of action that updates a placeholder - * @deprecated use the one exposed by `@o3r/components` module. Will be removed in Otter v12. - */ -export interface ActionUpdatePlaceholderBlock extends ActionBlock { - actionType: 'UPDATE_PLACEHOLDER'; - placeholderId: string; - value: string; -} - -/** - * Type that regroups all different kind of actions - * @deprecated will be removed in Otter v12. - */ -export type ActionOverrideBlock = - ActionUpdateConfigBlock | - ActionUpdateAssetBlock | - ActionUpdateLocalisationBlock | - ActionUpdatePlaceholderBlock; diff --git a/packages/@o3r/rules-engine/src/stores/rulesets/rulesets.selectors.spec.ts b/packages/@o3r/rules-engine/src/stores/rulesets/rulesets.selectors.spec.ts index 92451be425..8e6235c378 100644 --- a/packages/@o3r/rules-engine/src/stores/rulesets/rulesets.selectors.spec.ts +++ b/packages/@o3r/rules-engine/src/stores/rulesets/rulesets.selectors.spec.ts @@ -31,9 +31,13 @@ describe('RuleSets Selector tests', () => { name: 'r2_name', rules: [], id: 'r2', - linkedComponent: { - library: '@mylibrary', - name: 'mycomponent' + linkedComponents: { + or: [ + { + library: '@mylibrary', + name: 'mycomponent' + } + ] } }; @@ -86,10 +90,6 @@ describe('RuleSets Selector tests', () => { from: beforeYesterday.toISOString(), to: afterTomorrow.toISOString() }, - linkedComponent: { - library: '@mylibrary', - name: 'thisComponentWillBeIgnored' - }, linkedComponents: { or: [ { @@ -111,10 +111,6 @@ describe('RuleSets Selector tests', () => { validityRange: { from: afterTomorrow.toISOString() }, - linkedComponent: { - library: '@mylibrary', - name: 'thisComponentWillBeIgnored' - }, linkedComponents: { or: [ { @@ -253,26 +249,6 @@ describe('RuleSets Selector tests', () => { expect(selectors.selectActiveRuleSets.projector(rulesetsInRange)).toEqual([]); }); - it('should select the linked components rulesets', () => { - const state: RulesetsState = { - ids: [r2.id, r4.id, r8.id], - entities: { - r2: r2, - r4: r4, - r8: r8 - }, - requestIds: [] - }; - const allRuleSetsArray = selectors.selectAllRulesets.projector(state); - const rulesetsInRange = selectors.selectRuleSetsInRange.projector(allRuleSetsArray); - - const componentsWithRulesets = { - [computeItemIdentifier('mycomponent', '@mylibrary')]: [r2.id, r8.id], - [computeItemIdentifier('mycomponent2', '@mylibrary')]: [r8.id] - }; - expect(selectors.selectRuleSetLinkComponents.projector(rulesetsInRange)).toEqual(componentsWithRulesets); - }); - it('should select the map of rulesets linked components', () => { const state: RulesetsState = { ids: [r2.id, r4.id, r8.id], @@ -297,20 +273,6 @@ describe('RuleSets Selector tests', () => { expect(selectors.selectComponentsLinkedToRuleset.projector(rulesetsInRange)).toEqual(componentsWithRulesets); }); - it('should filter out the linked components rulesets outside the validity range', () => { - const state: RulesetsState = { - ids: [r9.id], - entities: { - r9: r9 - }, - requestIds: [] - }; - const allRuleSetsArray = selectors.selectAllRulesets.projector(state); - const rulesetsInRange = selectors.selectRuleSetsInRange.projector(allRuleSetsArray); - - expect(selectors.selectRuleSetLinkComponents.projector(rulesetsInRange)).toEqual({}); - }); - it('should filter out the map of rulesets linked components outside the validity range', () => { const state: RulesetsState = { ids: [r9.id], diff --git a/packages/@o3r/rules-engine/src/stores/rulesets/rulesets.selectors.ts b/packages/@o3r/rules-engine/src/stores/rulesets/rulesets.selectors.ts index e01343c2b7..64c22a9b84 100644 --- a/packages/@o3r/rules-engine/src/stores/rulesets/rulesets.selectors.ts +++ b/packages/@o3r/rules-engine/src/stores/rulesets/rulesets.selectors.ts @@ -16,26 +16,17 @@ import { RulesetsState, } from './rulesets.state'; -const { selectIds, selectEntities, selectAll, selectTotal } = rulesetsAdapter.getSelectors(); +const { selectEntities, selectAll } = rulesetsAdapter.getSelectors(); /** Select Rulesets State */ export const selectRulesetsState = createFeatureSelector(RULESETS_STORE_NAME); -/** Select the array of Rulesets ids */ -export const selectRulesetsIds = createSelector(selectRulesetsState, selectIds); - /** Select the array of Rulesets */ export const selectAllRulesets = createSelector(selectRulesetsState, selectAll); /** Select the dictionary of Rulesets entities */ export const selectRulesetsEntities = createSelector(selectRulesetsState, selectEntities); -/** Select the total Rulesets count */ -export const selectRulesetsTotal = createSelector(selectRulesetsState, selectTotal); - -/** Select the store pending status */ -export const selectRulesetsStorePendingStatus = createSelector(selectRulesetsState, (state) => state.isPending || false); - /** * Check if the given value is a valid date * @param d @@ -77,23 +68,9 @@ export const selectRuleSetsInRange = createSelector( export const selectActiveRuleSets = createSelector( selectRuleSetsInRange, (ruleSets) => ruleSets - .filter((ruleSet: Ruleset) => (!(ruleSet.linkedComponents?.or?.length || ruleSet.linkedComponent))) + .filter((ruleSet: Ruleset) => (!ruleSet.linkedComponents?.or?.length)) .map((ruleSet: Ruleset) => ruleSet.id)); -/** - * Assign rulesetId to a component - * @deprecated It will be removed in v12 with the selector using it - * @param compName - * @param library - * @param ruleSetId - * @param acc - */ -function linkRulesetToComponent(compName: string, library: string, ruleSetId: string, acc: Record = {}) { - const configName = computeItemIdentifier(compName, library); - acc[configName] ||= []; - acc[configName].push(ruleSetId); -} - /** * Assign component to RulesetIds Map * @param compName @@ -107,31 +84,6 @@ function linkComponentToRuleset(compName: string, library: string, ruleSetId: st acc[ruleSetId].push(configName); } -/** - * Select the map of ruleSet to activate based on the component computed name - * @deprecated use {@link selectComponentsLinkedToRuleset} instead. It will be removed in v12 - */ -export const selectRuleSetLinkComponents = createSelector( - selectRuleSetsInRange, - (ruleSets) => - ruleSets - .reduce((acc: Record, ruleSet: Ruleset) => { - if ((!ruleSet.linkedComponents?.or || ruleSet.linkedComponents.or.length === 0) && !ruleSet.linkedComponent) { - return acc; - } - if (ruleSet.linkedComponents?.or?.length) { - ruleSet.linkedComponents.or.forEach((linkComp) => { - linkRulesetToComponent(linkComp.name, linkComp.library, ruleSet.id, acc); - }); - return acc; - } - if (ruleSet.linkedComponent) { - linkRulesetToComponent(ruleSet.linkedComponent.name, ruleSet.linkedComponent.library, ruleSet.id, acc); - } - return acc; - }, {}) -); - /** * Select the map of ruleSets to activate based on linked components */ @@ -140,7 +92,7 @@ export const selectComponentsLinkedToRuleset = createSelector( (ruleSets) => ruleSets .reduce((acc: { or: { [key: string]: string[] } }, ruleSet: Ruleset) => { - if ((!ruleSet.linkedComponents?.or || ruleSet.linkedComponents.or.length === 0) && !ruleSet.linkedComponent) { + if (!ruleSet.linkedComponents?.or || ruleSet.linkedComponents.or.length === 0) { return acc; } if (ruleSet.linkedComponents?.or?.length) { @@ -149,9 +101,6 @@ export const selectComponentsLinkedToRuleset = createSelector( }); return acc; } - if (ruleSet.linkedComponent) { - linkComponentToRuleset(ruleSet.linkedComponent.name, ruleSet.linkedComponent.library, ruleSet.id, acc.or); - } return acc; }, { or: {} }) ); diff --git a/packages/@o3r/schematics/package.json b/packages/@o3r/schematics/package.json index 47de885210..37ca9ebc63 100644 --- a/packages/@o3r/schematics/package.json +++ b/packages/@o3r/schematics/package.json @@ -34,6 +34,7 @@ "@schematics/angular": "^18.2.0", "eslint": "^9.14.0", "rxjs": "^7.8.1", + "ts-node": "~10.9.2", "type-fest": "^4.10.2", "typescript": "^5.5.4" }, diff --git a/packages/@o3r/schematics/src/rule-factories/ng-add/schematics-register.ts b/packages/@o3r/schematics/src/rule-factories/ng-add/schematics-register.ts index e4528dcd87..9dd90df32d 100644 --- a/packages/@o3r/schematics/src/rule-factories/ng-add/schematics-register.ts +++ b/packages/@o3r/schematics/src/rule-factories/ng-add/schematics-register.ts @@ -78,48 +78,3 @@ export function setupSchematicsParamsForProject(schematicsDefaultParams: Record< return writeAngularJson(tree, workspace); }; } - -/** - * Setup schematics default params in angular.json - * @deprecated will be removed in v12. Use {@link setupSchematicsParamsForProject} - * @param schematicsDefaultParams default params to setup by schematic - * @param overrideValue Define if the given value should override the one already defined in the workspace - * @param angularJsonFile Path to the Angular.json file. Will use the workspace root's angular.json if not specified - */ -export function setupSchematicsDefaultParams(schematicsDefaultParams: Record, overrideValue = false, angularJsonFile?: string): Rule { - return (tree, context) => { - const workspace = getWorkspaceConfig(tree, angularJsonFile); - if (!workspace) { - context.logger.error('No workspace found'); - return tree; - } - workspace.schematics ||= {}; - Object.entries(schematicsDefaultParams).forEach(([schematicName, defaultParams]) => { - workspace.schematics![schematicName] = overrideValue - ? { - ...workspace.schematics![schematicName], - ...defaultParams - } - : { - ...defaultParams, - ...workspace.schematics![schematicName] - }; - }); - Object.values(workspace.projects).forEach((project) => { - Object.entries(schematicsDefaultParams).forEach(([schematicName, defaultParams]) => { - if (project.schematics?.[schematicName]) { - project.schematics[schematicName] = overrideValue - ? { - ...project.schematics[schematicName], - ...defaultParams - } - : { - ...defaultParams, - ...project.schematics[schematicName] - }; - } - }); - }); - return writeAngularJson(tree, workspace, angularJsonFile); - }; -} diff --git a/packages/@o3r/schematics/src/rule-factories/update-imports/list-of-vars.ts b/packages/@o3r/schematics/src/rule-factories/update-imports/list-of-vars.ts index f0c9e655c2..05776a1296 100644 --- a/packages/@o3r/schematics/src/rule-factories/update-imports/list-of-vars.ts +++ b/packages/@o3r/schematics/src/rule-factories/update-imports/list-of-vars.ts @@ -14,7 +14,6 @@ export const listOfExposedElements: SassImportExposedElement[] = [ // utils { value: '$test-mode-enabled', type: 'var' }, { value: 'error', type: 'function' }, - { value: '$alternative-breakpoints-map', type: 'var' }, { value: 'get-mandatory', type: 'function' }, { value: 'multi-map-merge', type: 'function' }, { value: '$metadata-logging', type: 'var' }, diff --git a/packages/@o3r/schematics/src/utility/monorepo.ts b/packages/@o3r/schematics/src/utility/monorepo.ts index d38495760a..aa8cec36de 100644 --- a/packages/@o3r/schematics/src/utility/monorepo.ts +++ b/packages/@o3r/schematics/src/utility/monorepo.ts @@ -14,9 +14,6 @@ import type { import { getSchematicOptions, } from './collection'; -import { - getWorkspaceConfig, -} from './loaders'; /** * Find the relative path to a configuration file at the monorepo root @@ -41,16 +38,6 @@ export function isNxContext(tree: Tree) { return tree.exists('/nx.json'); } -/** - * Determine if a repository is standalone (not part of a monorepo) - * @deprecated no longer in use. Will be removed in V12 - * @param tree - */ -export function isStandaloneRepository(tree: Tree) { - const workspaceConfig = getWorkspaceConfig(tree); - return workspaceConfig && Object.keys(workspaceConfig.projects || {}).length === 1 && Object.values(workspaceConfig.projects)[0].root === ''; -} - /** * Determine if we are in a project with multi packages * @param tree diff --git a/packages/@o3r/store-sync/package.json b/packages/@o3r/store-sync/package.json index 0105ca7ae7..44599587dc 100644 --- a/packages/@o3r/store-sync/package.json +++ b/packages/@o3r/store-sync/package.json @@ -32,7 +32,8 @@ "@o3r/schematics": "workspace:^", "@schematics/angular": "^18.2.0", "fast-deep-equal": "^3.1.3", - "rxjs": "^7.8.1" + "rxjs": "^7.8.1", + "ts-node": "~10.9.2" }, "peerDependenciesMeta": { "@angular-devkit/core": { diff --git a/packages/@o3r/storybook/package.json b/packages/@o3r/storybook/package.json index 176688bc15..3d2ab81765 100644 --- a/packages/@o3r/storybook/package.json +++ b/packages/@o3r/storybook/package.json @@ -45,6 +45,7 @@ "color": "^4.2.3", "react": "^18.0.0", "react-dom": "^18.0.0", + "ts-node": "~10.9.2", "tslib": "^2.6.2" }, "peerDependencies": { diff --git a/packages/@o3r/stylelint-plugin/package.json b/packages/@o3r/stylelint-plugin/package.json index 9cffb95a64..6052ca1c12 100644 --- a/packages/@o3r/stylelint-plugin/package.json +++ b/packages/@o3r/stylelint-plugin/package.json @@ -24,6 +24,7 @@ "build:builders": "tsc -b tsconfig.builders.json --pretty && yarn generate-cjs-manifest" }, "dependencies": { + "ts-node": "~10.9.2", "tslib": "^2.6.2" }, "peerDependencies": { diff --git a/packages/@o3r/styling/package.json b/packages/@o3r/styling/package.json index ff2e9fd713..56b8e99157 100644 --- a/packages/@o3r/styling/package.json +++ b/packages/@o3r/styling/package.json @@ -59,6 +59,7 @@ "rxjs": "^7.8.1", "sass": "^1.81.0", "semver": "^7.5.2", + "ts-node": "~10.9.2", "typescript": "^5.5.4" }, "peerDependenciesMeta": { diff --git a/packages/@o3r/styling/scss/theming/_functions.scss b/packages/@o3r/styling/scss/theming/_functions.scss index 7a03e0983a..5f09d304a4 100644 --- a/packages/@o3r/styling/scss/theming/_functions.scss +++ b/packages/@o3r/styling/scss/theming/_functions.scss @@ -49,7 +49,7 @@ @each $key in $keys { @if (not $hasInvalid) { $isValidItem: false; - @each $valid in ('value', 'details', 'variable') { // 'variable' is deprecated and will be removed in v12 + @each $valid in ('value', 'details') { @if ($key == $valid) { $isValidItem: true; } diff --git a/packages/@o3r/styling/scss/theming/otter-theme/_functions.scss b/packages/@o3r/styling/scss/theming/otter-theme/_functions.scss index ab86348573..a980dab519 100644 --- a/packages/@o3r/styling/scss/theming/otter-theme/_functions.scss +++ b/packages/@o3r/styling/scss/theming/otter-theme/_functions.scss @@ -7,7 +7,6 @@ @function _meta-theme-to-otter($meta-theme, $root-name) { @if (meta.type-of($meta-theme) != map) { @return ( - variable: $root-name, // Deprecated, this is not used in the final theme calculation, will be removed in Otter v12 value: $meta-theme ); } diff --git a/packages/@o3r/styling/scss/utils/_variables.scss b/packages/@o3r/styling/scss/utils/_variables.scss index ef9db34a6c..e69de29bb2 100644 --- a/packages/@o3r/styling/scss/utils/_variables.scss +++ b/packages/@o3r/styling/scss/utils/_variables.scss @@ -1,13 +0,0 @@ -/// Map containing the list of possible alternatives for each breakpoint if the value is missing from a property -/// Ex. If there is no value for xxs on header-height property, the next alternative breakpoint is xs and if the latter -/// is not available, it will be sm etc. -/// @deprecate will be removed in v12 as not used anymore by material neither bootstrap -/// @type map -$alternative-breakpoints-map: ( - xxs: xxs, - xs: xs xxs, - sm: sm xs xxs, - md: md sm xs xxs, - lg: lg md sm xs xxs, - xl: xl lg md sm xs xxs, -); diff --git a/packages/@o3r/styling/src/breakpoints.ts b/packages/@o3r/styling/src/breakpoints.ts deleted file mode 100644 index a84b1fa510..0000000000 --- a/packages/@o3r/styling/src/breakpoints.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { - Breakpoints, -} from '@angular/cdk/layout'; - -/** - * Angular CDK Breakpoints to detect devices - * @deprecated use Breakpoints exported by @angular/cdk instead, will be removed in v12 - */ -export const deviceBreakpoints = { - mobile: [Breakpoints.HandsetLandscape, Breakpoints.HandsetPortrait], - tablet: [Breakpoints.TabletLandscape, Breakpoints.TabletPortrait] -}; diff --git a/packages/@o3r/styling/src/public_api.ts b/packages/@o3r/styling/src/public_api.ts index 6d7f4bad96..96ee21115d 100644 --- a/packages/@o3r/styling/src/public_api.ts +++ b/packages/@o3r/styling/src/public_api.ts @@ -1,4 +1,2 @@ -export * from './breakpoints'; export * from './core/index'; export * from './devkit/index'; -export * from './services/index'; diff --git a/packages/@o3r/styling/src/services/styling/style-lazy-loader.module.ts b/packages/@o3r/styling/src/services/styling/style-lazy-loader.module.ts deleted file mode 100644 index 8b209f4cc0..0000000000 --- a/packages/@o3r/styling/src/services/styling/style-lazy-loader.module.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { - NgModule, -} from '@angular/core'; -import { - DynamicContentModule, -} from '@o3r/dynamic-content'; - -/** - * @deprecated use StyleLazyLoaderModule exported by @o3r/dynamic-content instead, will be removed in v12 - */ -@NgModule({ - imports: [DynamicContentModule] -}) -export class StyleLazyLoaderModule {} diff --git a/packages/@o3r/styling/src/services/styling/style-lazy-loader.service.ts b/packages/@o3r/styling/src/services/styling/style-lazy-loader.service.ts deleted file mode 100644 index d40fc4b4e0..0000000000 --- a/packages/@o3r/styling/src/services/styling/style-lazy-loader.service.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { - Injectable, -} from '@angular/core'; -import { - DynamicContentService, -} from '@o3r/dynamic-content'; -import { - firstValueFrom, -} from 'rxjs'; -import { - StyleLazyLoaderModule, -} from './style-lazy-loader.module'; - -/** - * Interface to describe a style to lazy load from a url. - * @deprecated use StyleURL exported by @o3r/dynamic-content instead, will be removed in v12 - */ -export interface StyleURL { - /** url to file */ - href: string; - /** id of the HTML element */ - id?: string; - /** html integrity attribute to verify fetched resources */ - integrity?: string; - /** html crossOrigin attribute for CORS support. */ - crossOrigin?: 'anonymous' | 'use-credentials' | ''; -} - -/** - * Service to lazy load a CSS file - * @deprecated use StyleLazyLoader exported by @o3r/dynamic-content instead, will be removed in v12 - */ -@Injectable({ - providedIn: StyleLazyLoaderModule -}) -export class StyleLazyLoader { - private readonly DEFAULT_STYLE_ELEMENT_ID = 'external-theme'; - - constructor(private readonly dcService: DynamicContentService) {} - - /** - * Load a new CSS from an absolute URL, if we already HTML element exists with the url, otherwise - * @param styleUrlConfig object containing CSS File absolute URL to load, integrity and crossOrigin attributes - * and the styleId id of the dynamic style in the body tag. - */ - public loadStyleFromURL(styleUrlConfig: StyleURL) { - const elementId = styleUrlConfig.id || this.DEFAULT_STYLE_ELEMENT_ID; - let style = document.querySelector(`#${elementId}`); - - if (style === null) { - style = document.createElement('link'); - style.rel = 'stylesheet'; - style.type = 'text/css'; - const head = document.querySelectorAll('head')[0]; - head.append(style); - } - if (styleUrlConfig.integrity) { - style.integrity = styleUrlConfig.integrity; - } - if (styleUrlConfig.crossOrigin !== undefined) { - style.crossOrigin = styleUrlConfig.crossOrigin; - } - style.href = styleUrlConfig.href; - } - - /** - * Load a new CSS File - * @param styleUrlConfig CSS File config containing URL to load, integrity and crossOrigin attributes - * and the styleId id of the dynamic style in the body tag - */ - public async asyncLoadStyleFromDynamicContent(styleUrlConfig: StyleURL) { - const dynamicContentPath = await firstValueFrom( - this.dcService.getContentPathStream(styleUrlConfig.href) - ); - styleUrlConfig.href = dynamicContentPath; - this.loadStyleFromURL(styleUrlConfig); - } -} diff --git a/packages/@o3r/telemetry/package.json b/packages/@o3r/telemetry/package.json index 9d575c2962..ab36ca4a0f 100644 --- a/packages/@o3r/telemetry/package.json +++ b/packages/@o3r/telemetry/package.json @@ -18,6 +18,7 @@ }, "dependencies": { "minimist": "^1.2.6", + "ts-node": "~10.9.2", "tslib": "^2.6.2" }, "peerDependencies": { diff --git a/packages/@o3r/testing/package.json b/packages/@o3r/testing/package.json index 8d8cc6dd7c..b9f25a21c8 100644 --- a/packages/@o3r/testing/package.json +++ b/packages/@o3r/testing/package.json @@ -119,6 +119,7 @@ "protractor": "^7.0.0", "rxjs": "^7.8.1", "temporal-polyfill": "^0.2.0", + "ts-node": "~10.9.2", "type-fest": "^4.10.2", "typescript": "^5.5.4" }, diff --git a/packages/@o3r/testing/src/localization/localization-mock.ts b/packages/@o3r/testing/src/localization/localization-mock.ts index 95eec07471..a4bddaa6e2 100644 --- a/packages/@o3r/testing/src/localization/localization-mock.ts +++ b/packages/@o3r/testing/src/localization/localization-mock.ts @@ -12,7 +12,7 @@ import { import { LocalizationConfiguration, LocalizationModule, - LocalizationTranslatePipe, + O3rLocalizationTranslatePipe, } from '@o3r/localization'; import { of, @@ -47,7 +47,7 @@ export class LocalizationDependencyMocks { public static forTest(pipeWithPrefix = false): ModuleWithProviders { return { ngModule: LocalizationDependencyMocks, - providers: [{ provide: LocalizationTranslatePipe, useClass: pipeWithPrefix ? O3rTranslatePipeMock : TranslatePipeMock }] + providers: [{ provide: O3rLocalizationTranslatePipe, useClass: pipeWithPrefix ? O3rTranslatePipeMock : TranslatePipeMock }] }; } } diff --git a/packages/@o3r/workspace/package.json b/packages/@o3r/workspace/package.json index c9577bcdf1..b22d8f75a2 100644 --- a/packages/@o3r/workspace/package.json +++ b/packages/@o3r/workspace/package.json @@ -32,6 +32,7 @@ "@angular/core": "^18.2.0", "@o3r/telemetry": "workspace:^", "@schematics/angular": "^18.2.0", + "ts-node": "~10.9.2", "type-fest": "^4.10.2", "typescript": "^5.5.4" }, diff --git a/yarn.lock b/yarn.lock index 4fede349e0..fc0ebdd87a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -730,6 +730,7 @@ __metadata: "@o3r/schematics": "workspace:^" "@openapitools/openapi-generator-cli": ^2.15.0 openapi-types: ^12.0.0 + ts-node: ~10.9.2 type-fest: ^4.10.2 peerDependenciesMeta: "@ama-sdk/core": @@ -7591,6 +7592,7 @@ __metadata: "@schematics/angular": ^18.2.0 jasmine: ^5.0.0 rxjs: ^7.8.1 + ts-node: ~10.9.2 typescript: ^5.5.4 webpack: ^5.96.0 peerDependenciesMeta: @@ -7679,6 +7681,7 @@ __metadata: "@o3r/schematics": "workspace:^" "@schematics/angular": ^18.2.0 rxjs: ^7.8.1 + ts-node: ~10.9.2 typescript: ^5.5.4 peerDependenciesMeta: "@ama-sdk/client-fetch": @@ -7766,6 +7769,7 @@ __metadata: "@o3r/testing": "workspace:^" "@schematics/angular": ^18.2.0 rxjs: ^7.8.1 + ts-node: ~10.9.2 typescript: ^5.5.4 peerDependenciesMeta: "@angular-devkit/schematics": @@ -8143,6 +8147,7 @@ __metadata: jsonpath-plus: ^9.0.0 || ^10.0.0 rxjs: ^7.8.1 semver: ^7.5.2 + ts-node: ~10.9.2 typescript: ^5.5.4 peerDependenciesMeta: "@angular-devkit/core": @@ -8272,6 +8277,7 @@ __metadata: express-interceptor: ^1.2.0 jasmine: ^5.0.0 rxjs: ^7.8.1 + ts-node: ~10.9.2 typescript: ^5.5.4 peerDependenciesMeta: "@angular-devkit/schematics": @@ -8384,6 +8390,7 @@ __metadata: chokidar: ^3.5.2 globby: ^11.1.0 rxjs: ^7.8.1 + ts-node: ~10.9.2 type-fest: ^4.10.2 typescript: ^5.5.4 peerDependenciesMeta: @@ -8739,6 +8746,7 @@ __metadata: express-interceptor: ^1.2.0 jasmine: ^5.0.0 rxjs: ^7.8.1 + ts-node: ~10.9.2 peerDependenciesMeta: "@angular-devkit/schematics": optional: true @@ -8821,6 +8829,7 @@ __metadata: eslint-plugin-jsdoc: ^48.11.0 || ^49.0.0 || ^50.0.0 eslint-plugin-prefer-arrow: ^1.2.2 eslint-plugin-unicorn: ^54.0.0 || ^55.0.0 || ^56.0.0 + ts-node: ~10.9.2 typescript: ^5.5.4 peerDependenciesMeta: "@angular-devkit/schematics": @@ -8997,6 +9006,7 @@ __metadata: rimraf: "npm:^5.0.1" semver: "npm:^7.5.2" ts-jest: "npm:~29.2.0" + ts-node: "npm:~10.9.2" tslib: "npm:^2.6.2" type-fest: "npm:^4.10.2" typescript: "npm:~5.5.4" @@ -9117,6 +9127,7 @@ __metadata: "@yarnpkg/plugin-pack": ^4.0.0 globby: ^11.1.0 semver: ^7.5.2 + ts-node: ~10.9.2 type-fest: ^4.10.2 typescript: ^5.5.4 peerDependenciesMeta: @@ -9219,6 +9230,7 @@ __metadata: "@o3r/schematics": "workspace:^" "@schematics/angular": ^18.2.0 rxjs: ^7.8.1 + ts-node: ~10.9.2 peerDependenciesMeta: "@angular-devkit/schematics": optional: true @@ -9545,6 +9557,7 @@ __metadata: intl-messageformat: ^10.7.0 rxjs: ^7.8.1 semver: ^7.5.2 + ts-node: ~10.9.2 type-fest: ^4.10.2 typescript: ^5.5.4 peerDependenciesMeta: @@ -9661,6 +9674,7 @@ __metadata: logrocket-ngrx: ^0.2.1 rxjs: ^7.8.1 smartlook-client: ^9.0.0 + ts-node: ~10.9.2 peerDependenciesMeta: "@angular-devkit/schematics": optional: true @@ -9987,6 +10001,7 @@ __metadata: "@schematics/angular": ^18.2.0 jasmine: ^5.0.0 rxjs: ^7.8.1 + ts-node: ~10.9.2 peerDependenciesMeta: "@angular-devkit/schematics": optional: true @@ -10100,6 +10115,7 @@ __metadata: jasmine: ^5.0.0 jsonpath-plus: ^9.0.0 || ^10.0.0 rxjs: ^7.8.1 + ts-node: ~10.9.2 typescript: ^5.5.4 typescript-json-schema: ^0.65.0 peerDependenciesMeta: @@ -10198,6 +10214,7 @@ __metadata: "@schematics/angular": ^18.2.0 eslint: ^9.14.0 rxjs: ^7.8.1 + ts-node: ~10.9.2 type-fest: ^4.10.2 typescript: ^5.5.4 peerDependenciesMeta: @@ -10408,6 +10425,7 @@ __metadata: "@schematics/angular": ^18.2.0 fast-deep-equal: ^3.1.3 rxjs: ^7.8.1 + ts-node: ~10.9.2 peerDependenciesMeta: "@angular-devkit/core": optional: true @@ -10696,6 +10714,7 @@ __metadata: rxjs: ^7.8.1 sass: ^1.81.0 semver: ^7.5.2 + ts-node: ~10.9.2 typescript: ^5.5.4 peerDependenciesMeta: "@angular-devkit/architect": @@ -10964,6 +10983,7 @@ __metadata: protractor: ^7.0.0 rxjs: ^7.8.1 temporal-polyfill: ^0.2.0 + ts-node: ~10.9.2 type-fest: ^4.10.2 typescript: ^5.5.4 peerDependenciesMeta: @@ -11205,6 +11225,7 @@ __metadata: "@angular/core": ^18.2.0 "@o3r/telemetry": "workspace:^" "@schematics/angular": ^18.2.0 + ts-node: ~10.9.2 type-fest: ^4.10.2 typescript: ^5.5.4 peerDependenciesMeta: @@ -11874,13 +11895,13 @@ __metadata: linkType: hard "@radix-ui/react-dialog@npm:^1.0.5": - version: 1.1.3 - resolution: "@radix-ui/react-dialog@npm:1.1.3" + version: 1.1.4 + resolution: "@radix-ui/react-dialog@npm:1.1.4" dependencies: "@radix-ui/primitive": "npm:1.1.1" "@radix-ui/react-compose-refs": "npm:1.1.1" "@radix-ui/react-context": "npm:1.1.1" - "@radix-ui/react-dismissable-layer": "npm:1.1.2" + "@radix-ui/react-dismissable-layer": "npm:1.1.3" "@radix-ui/react-focus-guards": "npm:1.1.1" "@radix-ui/react-focus-scope": "npm:1.1.1" "@radix-ui/react-id": "npm:1.1.0" @@ -11890,7 +11911,7 @@ __metadata: "@radix-ui/react-slot": "npm:1.1.1" "@radix-ui/react-use-controllable-state": "npm:1.1.0" aria-hidden: "npm:^1.1.1" - react-remove-scroll: "npm:2.6.0" + react-remove-scroll: "npm:^2.6.1" peerDependencies: "@types/react": "*" "@types/react-dom": "*" @@ -11901,13 +11922,13 @@ __metadata: optional: true "@types/react-dom": optional: true - checksum: 10/70efa2688a599cb43f0b9d3b6730a5d44339bbe20446c16a98f2ae86b72fa1e2e4389e705d9eb1c368cefd4895b0e058a49d65d3b412d5436cac8a39545ff857 + checksum: 10/61edc875340a6e89228d9a42403456b2351e6c12e316bc372dfde1e616464f29d91cfed8cbda03fde634ef5b3d2046195173b20e623888ddf8316dd433aab28a languageName: node linkType: hard -"@radix-ui/react-dismissable-layer@npm:1.1.2": - version: 1.1.2 - resolution: "@radix-ui/react-dismissable-layer@npm:1.1.2" +"@radix-ui/react-dismissable-layer@npm:1.1.3": + version: 1.1.3 + resolution: "@radix-ui/react-dismissable-layer@npm:1.1.3" dependencies: "@radix-ui/primitive": "npm:1.1.1" "@radix-ui/react-compose-refs": "npm:1.1.1" @@ -11924,7 +11945,7 @@ __metadata: optional: true "@types/react-dom": optional: true - checksum: 10/cc67988d8341aaa870773486de689f22c1414ec15ee748baa4f2c16c900acc7f8d0a2c6f1b19c765d76da87b06d688c1c308241ae306f0ab72acd4fbfe26e717 + checksum: 10/9905ff3d8d630223fd40bf31cdd8027b6e750cecd31aa04c2a5912e6e628f72973e58032bb944a5f4685dd888256a306a1c296a6e18648187974455a9660d95f languageName: node linkType: hard @@ -14588,12 +14609,12 @@ __metadata: linkType: hard "@types/react@npm:^18.0.0, @types/react@npm:^18.0.37": - version: 18.3.16 - resolution: "@types/react@npm:18.3.16" + version: 18.3.17 + resolution: "@types/react@npm:18.3.17" dependencies: "@types/prop-types": "npm:*" csstype: "npm:^3.0.2" - checksum: 10/971b4f46af9aeda85326000ba4a78973db6a1f11e10665c014e1274a68ae801469f057b56d850512694cf04a69cc264c07e6a507b4613874e8bf6ab4df7904f1 + checksum: 10/5ee199d31077984f130c1b191c9498a0951e2c3e9129794ddf2555dca39d40d50b453a5768c5b466f39b8e52818c160e9869e930a78795636ed281f38327d32d languageName: node linkType: hard @@ -14892,24 +14913,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/parser@npm:~8.17.0": - version: 8.17.0 - resolution: "@typescript-eslint/parser@npm:8.17.0" - dependencies: - "@typescript-eslint/scope-manager": "npm:8.17.0" - "@typescript-eslint/types": "npm:8.17.0" - "@typescript-eslint/typescript-estree": "npm:8.17.0" - "@typescript-eslint/visitor-keys": "npm:8.17.0" - debug: "npm:^4.3.4" - peerDependencies: - eslint: ^8.57.0 || ^9.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 10/464981e1424e4a7849ca7253b54092a67d33130d28ecf492efd56d5ce69e640a876b7f84e59f1e368e763125432c34e7de28d78c0eef1bda4e9a9d52de0ccac5 - languageName: node - linkType: hard - "@typescript-eslint/rule-tester@npm:~8.18.0": version: 8.18.1 resolution: "@typescript-eslint/rule-tester@npm:8.18.1" @@ -14926,16 +14929,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:8.17.0": - version: 8.17.0 - resolution: "@typescript-eslint/scope-manager@npm:8.17.0" - dependencies: - "@typescript-eslint/types": "npm:8.17.0" - "@typescript-eslint/visitor-keys": "npm:8.17.0" - checksum: 10/fa934d9fd88070833c57a3e79c0f933d0b68884c00293a1d571889b882e5c9680ccfdc5c77a7160d5a4b8b46657f93db2468a4726a517fce4d3bc764b66f1995 - languageName: node - linkType: hard - "@typescript-eslint/scope-manager@npm:8.18.1": version: 8.18.1 resolution: "@typescript-eslint/scope-manager@npm:8.18.1" @@ -14961,13 +14954,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/types@npm:8.17.0": - version: 8.17.0 - resolution: "@typescript-eslint/types@npm:8.17.0" - checksum: 10/46baf69ab30dd814a390590b94ca64c407ac725cb0143590ddcaf72fa43c940cec180539752ce4af26ac7e0ae2f5f921cfd0d07b088ca680f8a28800d4d33a5f - languageName: node - linkType: hard - "@typescript-eslint/types@npm:8.18.1, @typescript-eslint/types@npm:^8.0.0": version: 8.18.1 resolution: "@typescript-eslint/types@npm:8.18.1" @@ -14975,25 +14961,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:8.17.0": - version: 8.17.0 - resolution: "@typescript-eslint/typescript-estree@npm:8.17.0" - dependencies: - "@typescript-eslint/types": "npm:8.17.0" - "@typescript-eslint/visitor-keys": "npm:8.17.0" - debug: "npm:^4.3.4" - fast-glob: "npm:^3.3.2" - is-glob: "npm:^4.0.3" - minimatch: "npm:^9.0.4" - semver: "npm:^7.6.0" - ts-api-utils: "npm:^1.3.0" - peerDependenciesMeta: - typescript: - optional: true - checksum: 10/8a1f8be767b82e75d41eedda7fdb5135787ceaab480671b6d9891b5f92ee3a13f19ad6f48d5abf5e4f2afc4dd3317c621c1935505ef098f22b67be2f9d01ab7b - languageName: node - linkType: hard - "@typescript-eslint/typescript-estree@npm:8.18.1": version: 8.18.1 resolution: "@typescript-eslint/typescript-estree@npm:8.18.1" @@ -15027,16 +14994,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:8.17.0": - version: 8.17.0 - resolution: "@typescript-eslint/visitor-keys@npm:8.17.0" - dependencies: - "@typescript-eslint/types": "npm:8.17.0" - eslint-visitor-keys: "npm:^4.2.0" - checksum: 10/e7a3c3b9430ecefb8e720f735f8a94f87901f055c75dc8eec60052dfdf90cc28dd33f03c11cd8244551dc988bf98d1db9bd09ef8fd3c51236912cab3680b9c6b - languageName: node - linkType: hard - "@typescript-eslint/visitor-keys@npm:8.18.1": version: 8.18.1 resolution: "@typescript-eslint/visitor-keys@npm:8.18.1" @@ -25444,7 +25401,7 @@ __metadata: languageName: node linkType: hard -"is-typed-array@npm:^1.1.13, is-typed-array@npm:^1.1.3": +"is-typed-array@npm:^1.1.13": version: 1.1.13 resolution: "is-typed-array@npm:1.1.13" dependencies: @@ -25453,6 +25410,15 @@ __metadata: languageName: node linkType: hard +"is-typed-array@npm:^1.1.3": + version: 1.1.14 + resolution: "is-typed-array@npm:1.1.14" + dependencies: + which-typed-array: "npm:^1.1.16" + checksum: 10/2d322492dea8bdf3290f4a3dd9ca7cd5bd9a0d6c7a608ffc4d2118d3f1aeac51ca0dff95b2c90b55319af53c54ee3db95cd942ae7fd7a2ef1aba05b2da4b197b + languageName: node + linkType: hard + "is-typedarray@npm:^1.0.0, is-typedarray@npm:~1.0.0": version: 1.0.0 resolution: "is-typedarray@npm:1.0.0" @@ -32101,7 +32067,7 @@ __metadata: languageName: node linkType: hard -"react-remove-scroll-bar@npm:^2.3.6": +"react-remove-scroll-bar@npm:^2.3.7": version: 2.3.8 resolution: "react-remove-scroll-bar@npm:2.3.8" dependencies: @@ -32117,22 +32083,22 @@ __metadata: languageName: node linkType: hard -"react-remove-scroll@npm:2.6.0": - version: 2.6.0 - resolution: "react-remove-scroll@npm:2.6.0" +"react-remove-scroll@npm:^2.6.1": + version: 2.6.2 + resolution: "react-remove-scroll@npm:2.6.2" dependencies: - react-remove-scroll-bar: "npm:^2.3.6" + react-remove-scroll-bar: "npm:^2.3.7" react-style-singleton: "npm:^2.2.1" tslib: "npm:^2.1.0" - use-callback-ref: "npm:^1.3.0" + use-callback-ref: "npm:^1.3.3" use-sidecar: "npm:^1.1.2" peerDependencies: - "@types/react": ^16.8.0 || ^17.0.0 || ^18.0.0 - react: ^16.8.0 || ^17.0.0 || ^18.0.0 + "@types/react": "*" + react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc peerDependenciesMeta: "@types/react": optional: true - checksum: 10/9fac79e1c2ed2c85729bfe82f61ef4ae5ce51f478736a13892a9a11e05cbd4e9599f9f0e012cb5fc0719e18dc1dd687ab61f516193228615df636db8b851245e + checksum: 10/e6d7e8c42793ae24c9d4a6cb3ebdf3499c1b413fb0c93c3fbf047d875396e944e88a0520dd7db3a20db37125ffadef45b1ce8cb77b74da44daf47c5eb2155c9a languageName: node linkType: hard @@ -36442,18 +36408,18 @@ __metadata: languageName: node linkType: hard -"use-callback-ref@npm:^1.3.0": - version: 1.3.2 - resolution: "use-callback-ref@npm:1.3.2" +"use-callback-ref@npm:^1.3.3": + version: 1.3.3 + resolution: "use-callback-ref@npm:1.3.3" dependencies: tslib: "npm:^2.0.0" peerDependencies: - "@types/react": ^16.8.0 || ^17.0.0 || ^18.0.0 - react: ^16.8.0 || ^17.0.0 || ^18.0.0 + "@types/react": "*" + react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc peerDependenciesMeta: "@types/react": optional: true - checksum: 10/3be76eae71b52ab233b4fde974eddeff72e67e6723100a0c0297df4b0d60daabedfa706ffb314d0a52645f2c1235e50fdbd53d99f374eb5df68c74d412e98a9b + checksum: 10/adf06a7b6a27d3651c325ac9b66d2b82ccacaed7450b85b211d123e91d9a23cb5a587fcc6db5b4fd07ac7233e5abf024d30cf02ddc2ec46bca712151c0836151 languageName: node linkType: hard