@o3r/core 10.2.0-prerelease.9 → 10.3.0-prerelease.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,6 +5,9 @@
5
5
 
6
6
  ## Description
7
7
 
8
+ [![Stable Version](https://img.shields.io/npm/v/@o3r/core?style=for-the-badge)](https://www.npmjs.com/package/@o3r/core)
9
+ [![Bundle Size](https://img.shields.io/bundlephobia/min/@o3r/core?color=green&style=for-the-badge)](https://www.npmjs.com/package/@o3r/core)
10
+
8
11
  This module gathers the core of the [Otter Framework](https://github.com/AmadeusITGroup/otter).
9
12
  It is the foundation for all the packages (interfaces, core helpers) and contains schematics to generate your components/services etc.
10
13
 
@@ -1 +1 @@
1
- {"version":3,"file":"component.decorator.d.ts","sourceRoot":"","sources":["../../../src/core/metadata/component.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAE/C,wBAAwB;AACxB,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,MAAM,GAAG,kBAAkB,GAAG,WAAW,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,wBAAwB;IACxB,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,2BAA2B;IACrE,uBAAuB;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,qBAAqB;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,eAAO,MAAM,8BAA8B,mBAAmB,CAAC;AAE/D;;;;GAIG;AAEH,wBAAgB,YAAY,CAAC,IAAI,EAAE,2BAA2B,4BAC5B,GAAG,EAAE,KAAK,MAAM,uBAKjD"}
1
+ {"version":3,"file":"component.decorator.d.ts","sourceRoot":"","sources":["../../../src/core/metadata/component.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAE/C,wBAAwB;AACxB,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,MAAM,GAAG,kBAAkB,GAAG,WAAW,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,wBAAwB;IACxB,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,2BAA2B;IACrE,uBAAuB;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,qBAAqB;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,eAAO,MAAM,8BAA8B,mBAAmB,CAAC;AAE/D;;;;GAIG;AAEH,wBAAgB,YAAY,CAAC,IAAI,EAAE,2BAA2B,4BAC5B,GAAG,EAAE,KAAK,MAAM,eAAe,CAAC,OAKjE"}
@@ -4,7 +4,7 @@ import { ContentMessageData, FilterMessageToApplication, OtterMessage, OtterMess
4
4
  * Determine if a message should be handle by the application
5
5
  * @param message Message to analyze
6
6
  */
7
- export declare const isToAppOtterMessage: <T extends OtterMessage<OtterMessageContent<string>, string | undefined>>(message?: T | undefined) => message is FilterMessageToApplication<T & {
7
+ export declare const isToAppOtterMessage: <T extends OtterMessage<OtterMessageContent<string>, string | undefined>>(message?: T) => message is FilterMessageToApplication<T & {
8
8
  to: 'app';
9
9
  }>;
10
10
  /**
@@ -18,7 +18,7 @@ export declare const isOtterMessage: <T extends OtterMessageContent<string>>(mes
18
18
  * @param content content of the message
19
19
  * @param preStringify determine if the message should JSON.stringify before being send (will use the default mechanism otherwise)
20
20
  */
21
- export declare const sendOtterMessage: <T extends OtterMessageContent<string>>(dataType: T["dataType"], content: ContentMessageData<T>, preStringify?: boolean) => void;
21
+ export declare const sendOtterMessage: <T extends OtterMessageContent<string>>(dataType: T['dataType'], content: ContentMessageData<T>, preStringify?: boolean) => void;
22
22
  export declare function filterMessageContent<T extends Event | MessageEvent>(): (source$: Observable<T>) => Observable<OtterMessageContent<string>>;
23
23
  export declare function filterMessageContent<T extends Event | MessageEvent, S extends OtterMessageContent>(predicate: (message: any) => message is S): (source$: Observable<T>) => Observable<S>;
24
24
  //# sourceMappingURL=message.helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"message.helpers.d.ts","sourceRoot":"","sources":["../../src/messages/message.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,UAAU,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAA4B,kBAAkB,EAAE,0BAA0B,EAAE,YAAY,EAAE,mBAAmB,EAAoB,MAAM,sBAAsB,CAAC;AAErK;;;GAGG;AACH,eAAO,MAAM,mBAAmB;QAAyF,KAAK;EAE7H,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,mDAA4C,GAAG,mDAEzE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,kIAS5B,CAAC;AAGF,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,KAAK,GAAG,YAAY,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;AAC5I,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,KAAK,GAAG,YAAY,EAAE,CAAC,SAAS,mBAAmB,EAAE,SAAS,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"message.helpers.d.ts","sourceRoot":"","sources":["../../src/messages/message.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,UAAU,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAA4B,kBAAkB,EAAE,0BAA0B,EAAE,YAAY,EAAE,mBAAmB,EAAoB,MAAM,sBAAsB,CAAC;AAErK;;;GAGG;AACH,eAAO,MAAM,mBAAmB,sFAAsC,CAAC;QAAkD,KAAK;EAE7H,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,mDAA4C,GAAG,mDAEzE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,oDAA6C,CAAC,CAAC,UAAU,CAAC,WAAW,mBAAmB,CAAC,CAAC,iCAStH,CAAC;AAGF,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,KAAK,GAAG,YAAY,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;AAC5I,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,KAAK,GAAG,YAAY,EAAE,CAAC,SAAS,mBAAmB,EAAE,SAAS,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/core",
3
- "version": "10.2.0-prerelease.9",
3
+ "version": "10.3.0-prerelease.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -12,27 +12,27 @@
12
12
  "default": "./src/public_api.js",
13
13
  "types": "./src/public_api.d.ts",
14
14
  "peerDependencies": {
15
- "@angular-devkit/architect": "~0.1702.0",
16
- "@angular-devkit/core": "~17.2.0",
17
- "@angular-devkit/schematics": "~17.2.0",
18
- "@angular/cli": "~17.2.0",
19
- "@angular/common": "~17.2.0",
20
- "@angular/compiler-cli": "~17.2.0",
21
- "@angular/core": "~17.2.0",
22
- "@angular/forms": "~17.2.0",
23
- "@angular/platform-browser-dynamic": "~17.2.0",
24
- "@angular/router": "~17.2.0",
15
+ "@angular-devkit/architect": "~0.1703.0",
16
+ "@angular-devkit/core": "~17.3.0",
17
+ "@angular-devkit/schematics": "~17.3.0",
18
+ "@angular/cli": "~17.3.0",
19
+ "@angular/common": "~17.3.0",
20
+ "@angular/compiler-cli": "~17.3.0",
21
+ "@angular/core": "~17.3.0",
22
+ "@angular/forms": "~17.3.0",
23
+ "@angular/platform-browser-dynamic": "~17.3.0",
24
+ "@angular/router": "~17.3.0",
25
25
  "@ngrx/entity": "~17.1.0",
26
26
  "@ngrx/store": "~17.1.0",
27
- "@nrwl/devkit": "~18.0.2",
28
- "@nx/angular": "~18.0.2",
29
- "@o3r/telemetry": "^10.2.0-prerelease.9",
30
- "@schematics/angular": "~17.2.0",
27
+ "@nrwl/devkit": "~18.2.0",
28
+ "@nx/angular": "~18.2.0",
29
+ "@o3r/telemetry": "^10.3.0-prerelease.0",
30
+ "@schematics/angular": "~17.3.0",
31
31
  "chokidar": "^3.5.2",
32
32
  "globby": "^11.1.0",
33
33
  "rxjs": "^7.8.1",
34
34
  "semver": "^7.5.2",
35
- "typescript": "~5.3.3"
35
+ "typescript": "~5.4.2"
36
36
  },
37
37
  "peerDependenciesMeta": {
38
38
  "@angular/cli": {
@@ -64,33 +64,33 @@
64
64
  }
65
65
  },
66
66
  "dependencies": {
67
- "@o3r/schematics": "^10.2.0-prerelease.9",
68
- "tslib": "^2.5.3",
67
+ "@o3r/schematics": "^10.3.0-prerelease.0",
68
+ "tslib": "^2.6.2",
69
69
  "uuid": "^9.0.0"
70
70
  },
71
71
  "generatorDependencies": {
72
- "@angular-eslint/eslint-plugin": "~17.2.0",
73
- "@angular/material": "~17.2.0",
72
+ "@angular-eslint/eslint-plugin": "~17.3.0",
73
+ "@angular/material": "~17.3.0",
74
74
  "@ngrx/router-store": "~17.1.0",
75
75
  "@ngrx/effects": "~17.1.0",
76
76
  "@ngrx/store-devtools": "~17.1.0",
77
- "@o3r/store-sync": "^10.2.0-prerelease.9",
77
+ "@o3r/store-sync": "^10.3.0-prerelease.0",
78
78
  "@types/jest": "~29.5.2",
79
- "nx": "~18.0.2",
80
- "@typescript-eslint/parser": "^7.0.1",
79
+ "nx": "~18.2.0",
80
+ "@typescript-eslint/parser": "^7.2.0",
81
81
  "@stylistic/eslint-plugin-ts": "^1.5.4",
82
82
  "cpy-cli": "^5.0.0",
83
- "eslint": "^8.42.0",
84
- "@nx/eslint-plugin": "~18.0.2",
83
+ "eslint": "^8.57.0",
84
+ "@nx/eslint-plugin": "~18.2.0",
85
85
  "jsonc-eslint-parser": "~2.4.0",
86
- "eslint-import-resolver-node": "^0.3.4",
86
+ "eslint-import-resolver-node": "^0.3.9",
87
87
  "eslint-plugin-jest": "~27.9.0",
88
- "eslint-plugin-jsdoc": "~48.2.0",
88
+ "eslint-plugin-jsdoc": "~48.2.1",
89
89
  "eslint-plugin-prefer-arrow": "~1.2.3",
90
- "eslint-plugin-unicorn": "^51.0.0",
90
+ "eslint-plugin-unicorn": "^51.0.1",
91
91
  "jest": "~29.7.0",
92
92
  "jest-junit": "~16.0.0",
93
- "jest-preset-angular": "~14.0.0",
93
+ "jest-preset-angular": "~14.0.3",
94
94
  "zone.js": "~0.14.2"
95
95
  },
96
96
  "engines": {
@@ -1,7 +1,6 @@
1
1
  import { Rule } from '@angular-devkit/schematics';
2
2
  /**
3
3
  * Update component file with new decorators for otter devtools
4
- *
5
4
  * @param tree Tree
6
5
  */
7
6
  export declare const updateComponentDecorators: Rule;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/component-decorator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAQ,MAAM,4BAA4B,CAAC;AA0BxD;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,IA6DvC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/component-decorator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAQ,MAAM,4BAA4B,CAAC;AAyBxD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,IA8DvC,CAAC"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateComponentDecorators = void 0;
4
- const schematics_1 = require("@o3r/schematics");
5
4
  const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
6
5
  const change_1 = require("@schematics/angular/utility/change");
7
6
  const ts = require("typescript");
@@ -16,11 +15,11 @@ const removeImport = (source, symbolName, fileName) => {
16
15
  };
17
16
  /**
18
17
  * Update component file with new decorators for otter devtools
19
- *
20
18
  * @param tree Tree
21
19
  */
22
- const updateComponentDecorators = (tree) => {
23
- const componentFiles = new Set((0, schematics_1.getFilesInFolderFromWorkspaceProjectsInTree)(tree, '', 'component.ts'));
20
+ const updateComponentDecorators = async (tree) => {
21
+ const { getFilesInFolderFromWorkspaceProjectsInTree } = await Promise.resolve().then(() => require('@o3r/schematics'));
22
+ const componentFiles = new Set(getFilesInFolderFromWorkspaceProjectsInTree(tree, '', 'component.ts'));
24
23
  componentFiles.forEach((filePath) => {
25
24
  const source = ts.createSourceFile(filePath, tree.readText(filePath), ts.ScriptTarget.ES2015, true);
26
25
  const recorder = tree.beginUpdate(filePath);
@@ -1,7 +1,7 @@
1
1
  import { chain, noop, Rule } from '@angular-devkit/schematics';
2
2
  import type { NgAddSchematicsSchema } from './schema';
3
3
  import * as path from 'node:path';
4
- import { type DependencyToAdd } from '@o3r/schematics';
4
+ import type { DependencyToAdd } from '@o3r/schematics';
5
5
 
6
6
  const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
7
7
 
@@ -18,6 +18,13 @@ const dependenciesToNgAdd = [
18
18
  // Add the dependencies to install with NgAdd here
19
19
  ];
20
20
 
21
+ const reportMissingSchematicsDep = (logger: { error: (message: string) => any }) => (reason: any) => {
22
+ logger.error(`[ERROR]: Adding <%= featureName %> has failed.
23
+ If the error is related to missing @o3r dependencies you need to install '@o3r/core' to be able to use the <%= featureName %> package. Please run 'ng add @o3r/core' .
24
+ Otherwise, use the error message as guidance.`);
25
+ throw reason;
26
+ };
27
+
21
28
  /**
22
29
  * Add Otter <%= featureName %> to an Otter Project
23
30
  *
@@ -25,37 +32,38 @@ const dependenciesToNgAdd = [
25
32
  */
26
33
  function ngAddFn(options: NgAddSchematicsSchema): Rule {
27
34
  return async (tree, context) => {
28
- try {
29
- // use dynamic import to properly raise an exception if it is not an Otter project.
30
- const { getProjectNewDependenciesTypes, getPackageInstallConfig, applyEsLintFix, install } = await import('@o3r/schematics');
31
- // current package version
32
- const version = JSON.stringify(fs.readFileSync(packageJsonPath)).version;
33
- const dependencies = [...dependenciesToInstall, ...dependenciesToNgAdd].reduce((acc, dep) => {
34
- acc[dep] = {
35
- inManifest: [{
36
- range: `~${version}`,
37
- types: getProjectNewDependenciesTypes(workspaceProject)
38
- }]
39
- };
40
- return acc;
41
- }, getPackageInstallConfig(packageJsonPath, tree, options.projectName));
42
- return chain([
43
- // optional custom action dedicated to this module
44
- doCustomAction,
45
- options.skipLinter ? noop() : applyEsLintFix(),
46
- setupDependencies({
47
- projectName: options.projectName,
48
- dependencies,
49
- ngAddToRun: dependenciesToNgAdd,
50
- skipInstall: options.skipInstall
51
- })
52
- ]);
53
- } catch (e) {
54
- // If the installation is initialized in a non-Otter application, mandatory packages will be missing. We need to notify the user
55
- context.logger.error(`[ERROR]: Adding <%= featureName %> has failed.
56
- If the error is related to missing @o3r dependencies you need to install '@o3r/core' to be able to use the <%= featureName %> package. Please run 'ng add @o3r/core' .
57
- Otherwise, use the error message as guidance.`);
58
- throw (e);
59
- }
35
+ // use dynamic import to properly raise an exception if it is not an Otter project.
36
+ const { getProjectNewDependenciesTypes, getPackageInstallConfig, applyEsLintFix, install } = await import('@o3r/schematics');
37
+ // current package version
38
+ const version = JSON.stringify(fs.readFileSync(packageJsonPath)).version;
39
+ const dependencies = [...dependenciesToInstall, ...dependenciesToNgAdd].reduce((acc, dep) => {
40
+ acc[dep] = {
41
+ inManifest: [{
42
+ range: `~${version}`,
43
+ types: getProjectNewDependenciesTypes(workspaceProject)
44
+ }]
45
+ };
46
+ return acc;
47
+ }, getPackageInstallConfig(packageJsonPath, tree, options.projectName));
48
+ return chain([
49
+ // optional custom action dedicated to this module
50
+ doCustomAction,
51
+ options.skipLinter ? noop() : applyEsLintFix(),
52
+ setupDependencies({
53
+ projectName: options.projectName,
54
+ dependencies,
55
+ ngAddToRun: dependenciesToNgAdd,
56
+ skipInstall: options.skipInstall
57
+ })
58
+ ]);
60
59
  };
61
60
  }
61
+
62
+ /**
63
+ * Add module to an Angular Project
64
+ * @param options ng add options
65
+ */
66
+ export const ngAdd = (options: NgAddSchematicsSchema): Rule => async (_, { logger }) => {
67
+ const { createSchematicWithMetricsIfInstalled } = await import('@o3r/schematics').catch(reportMissingSchematicsDep(logger));
68
+ return createSchematicWithMetricsIfInstalled(ngAddFn)(options);
69
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"async.props.d.ts","sourceRoot":"","sources":["../../../src/store/async/async.props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAIhD;;;GAGG;AAEH,eAAO,MAAM,UAAU,wDAEtB,CAAC"}
1
+ {"version":3,"file":"async.props.d.ts","sourceRoot":"","sources":["../../../src/store/async/async.props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAIhD;;;GAGG;AAEH,eAAO,MAAM,UAAU,0BAAyB,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,YAEjE,CAAC"}