@o3r/rules-engine 13.0.0-prerelease.2 → 13.0.0-prerelease.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/rules-engine",
3
- "version": "13.0.0-prerelease.2",
3
+ "version": "13.0.0-prerelease.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -26,13 +26,13 @@
26
26
  "types": "./index.d.ts",
27
27
  "default": "./fesm2022/o3r-rules-engine.mjs"
28
28
  },
29
- "./fixtures/jest": {
30
- "types": "./fixtures/jest/index.d.ts",
31
- "default": "./fesm2022/o3r-rules-engine-fixtures-jest.mjs"
32
- },
33
29
  "./fixtures/jasmine": {
34
30
  "types": "./fixtures/jasmine/index.d.ts",
35
31
  "default": "./fesm2022/o3r-rules-engine-fixtures-jasmine.mjs"
32
+ },
33
+ "./fixtures/jest": {
34
+ "types": "./fixtures/jest/index.d.ts",
35
+ "default": "./fesm2022/o3r-rules-engine-fixtures-jest.mjs"
36
36
  }
37
37
  },
38
38
  "generatorDependencies": {
@@ -50,10 +50,10 @@
50
50
  "@ngrx/entity": "^20.0.0",
51
51
  "@ngrx/store": "^20.0.0",
52
52
  "@ngx-translate/core": "^15.0.0 || ~16.0.4",
53
- "@o3r/core": "^13.0.0-prerelease.2",
54
- "@o3r/extractors": "^13.0.0-prerelease.2",
55
- "@o3r/logger": "^13.0.0-prerelease.2",
56
- "@o3r/schematics": "^13.0.0-prerelease.2",
53
+ "@o3r/core": "^13.0.0-prerelease.4",
54
+ "@o3r/extractors": "^13.0.0-prerelease.4",
55
+ "@o3r/logger": "^13.0.0-prerelease.4",
56
+ "@o3r/schematics": "^13.0.0-prerelease.4",
57
57
  "@schematics/angular": "^20.0.0",
58
58
  "@types/json-schema": "^7.0.15",
59
59
  "globby": "^11.1.0",
@@ -105,7 +105,7 @@
105
105
  }
106
106
  },
107
107
  "dependencies": {
108
- "@o3r/schematics": "^13.0.0-prerelease.2",
108
+ "@o3r/schematics": "^13.0.0-prerelease.4",
109
109
  "tslib": "^2.6.2"
110
110
  },
111
111
  "engines": {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,IAAI,EACV,MAAM,4BAA4B,CAAC;AA+BpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAqHlB;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,qBAAqB,SAA2C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,IAAI,EACV,MAAM,4BAA4B,CAAC;AAwBpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAkFlB;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,qBAAqB,SAA2C,CAAC"}
@@ -44,66 +44,36 @@ const updateAppModuleOrAppConfig = (projectName) => (tree, context) => {
44
44
  }
45
45
  return (0, utility_1.addRootImport)(projectName, ({ code, external }) => code `\n${external('RulesEngineRunnerModule', '@o3r/rules-engine')}.forRoot()`);
46
46
  };
47
+ const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
48
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf8' }));
47
49
  /**
48
50
  * Add Otter rules-engine to an Angular Project
49
51
  * @param options
50
52
  */
51
53
  function ngAddFn(options) {
54
+ const schematicsDefaultOptions = {
55
+ useRulesEngine: undefined
56
+ };
52
57
  /* ng add rules */
53
- return (tree, context) => {
54
- options = { ...(0, schematics_2.getDefaultOptionsForSchematic)((0, schematics_2.getWorkspaceConfig)(tree), '@o3r/rules-engine', 'ng-add', options), ...options };
55
- const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
56
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf8' }));
57
- const depsInfo = (0, schematics_2.getO3rPeerDeps)(packageJsonPath);
58
- if (options.enableMetadataExtract) {
59
- depsInfo.o3rPeerDeps = [...depsInfo.o3rPeerDeps, '@o3r/extractors'];
60
- }
61
- const workspaceProject = options.projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[options.projectName] : undefined;
62
- const projectDirectory = workspaceProject?.root || '.';
63
- const projectPackageJson = tree.readJson(path.posix.join(projectDirectory, 'package.json'));
64
- const dependencies = depsInfo.o3rPeerDeps.reduce((acc, dep) => {
65
- acc[dep] = {
66
- inManifest: [{
67
- range: `${options.exactO3rVersion ? '' : '~'}${depsInfo.packageVersion}`,
68
- types: (0, schematics_2.getProjectNewDependenciesTypes)(workspaceProject)
69
- }],
70
- ngAddOptions: { exactO3rVersion: options.exactO3rVersion }
71
- };
72
- return acc;
73
- }, (0, schematics_2.getPackageInstallConfig)(packageJsonPath, tree, options.projectName, false, !!options.exactO3rVersion));
74
- const externalDependenciesInfo = (0, schematics_2.getExternalDependenciesInfo)({
75
- devDependenciesToInstall,
58
+ return (0, schematics_1.chain)([
59
+ (_, context) => {
60
+ context.logger.info(`The package @o3r/rules-engine comes with a debug mechanism`);
61
+ context.logger.info('Get information on https://github.com/AmadeusITGroup/otter/tree/main/docs/rules-engine/how-to-use/debug.md');
62
+ },
63
+ (0, schematics_2.registerPackageCollectionSchematics)(packageJson),
64
+ (0, schematics_2.setupSchematicsParamsForProject)({
65
+ '@o3r/core:component': schematicsDefaultOptions,
66
+ '@o3r/core:component-container': schematicsDefaultOptions
67
+ }, options.projectName),
68
+ (0, schematics_2.ngAddDependenciesRule)(options, packageJsonPath, {
76
69
  dependenciesToInstall,
77
- projectType: workspaceProject?.projectType,
78
- projectPackageJson,
79
- o3rPackageJsonPath: packageJsonPath
80
- }, context.logger);
81
- const schematicsDefaultOptions = {
82
- useRulesEngine: undefined
83
- };
84
- const rule = (0, schematics_1.chain)([
85
- (0, schematics_2.registerPackageCollectionSchematics)(packageJson),
86
- (0, schematics_2.setupSchematicsParamsForProject)({
87
- '@o3r/core:component': schematicsDefaultOptions,
88
- '@o3r/core:component-container': schematicsDefaultOptions
89
- }, options.projectName),
90
- (0, schematics_2.removePackages)(['@otter/rules-engine', '@otter/rules-engine-core']),
91
- (0, schematics_2.setupDependencies)({
92
- projectName: options.projectName,
93
- dependencies: {
94
- ...dependencies,
95
- ...externalDependenciesInfo
96
- },
97
- ngAddToRun: depsInfo.o3rPeerDeps
98
- }),
99
- ...(options.enableMetadataExtract ? [(0, cms_adapter_1.updateCmsAdapter)(options)] : []),
100
- (0, devtools_registration_1.registerDevtools)(options),
101
- updateAppModuleOrAppConfig(options.projectName)
102
- ]);
103
- context.logger.info(`The package ${depsInfo.packageName} comes with a debug mechanism`);
104
- context.logger.info('Get information on https://github.com/AmadeusITGroup/otter/tree/main/docs/rules-engine/how-to-use/debug.md');
105
- return rule;
106
- };
70
+ devDependenciesToInstall,
71
+ additionalNgAddToRun: options.enableMetadataExtract ? ['@o3r/extractors'] : undefined
72
+ }),
73
+ ...(options.enableMetadataExtract ? [(0, cms_adapter_1.updateCmsAdapter)(options)] : []),
74
+ (0, devtools_registration_1.registerDevtools)(options),
75
+ updateAppModuleOrAppConfig(options.projectName)
76
+ ]);
107
77
  }
108
78
  /**
109
79
  * Add Otter rules-engine to an Angular Project
@@ -1,10 +1,6 @@
1
- import type { SchematicOptionObject } from '@o3r/schematics';
2
- export interface NgAddSchematicsSchema extends SchematicOptionObject {
3
- /** Project name */
4
- projectName?: string | undefined;
1
+ import type { NgAddOptions, SchematicOptionObject } from '@o3r/schematics';
2
+ export interface NgAddSchematicsSchema extends NgAddOptions, SchematicOptionObject {
5
3
  /** Activate metadata extraction */
6
4
  enableMetadataExtract: boolean;
7
- /** Use a pinned version for otter packages */
8
- exactO3rVersion?: boolean;
9
5
  }
10
6
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB;IAClE,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,mCAAmC;IACnC,qBAAqB,EAAE,OAAO,CAAC;IAE/B,8CAA8C;IAC9C,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,qBAAsB,SAAQ,YAAY,EAAE,qBAAqB;IAChF,mCAAmC;IACnC,qBAAqB,EAAE,OAAO,CAAC;CAChC"}