ts2famix 2.0.1 → 2.1.0-beta.1

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.
Files changed (190) hide show
  1. package/.eslintrc.json +24 -24
  2. package/.vscode/settings.json +4 -0
  3. package/LICENSE +24 -24
  4. package/README.md +78 -78
  5. package/TODO +1 -0
  6. package/arwea-fix.json +1 -0
  7. package/bogus.ts +3 -0
  8. package/class-diagram.puml +792 -0
  9. package/debug.txt +13332 -0
  10. package/debuglog.txt +12073 -0
  11. package/dist/analyze.js +2 -2
  12. package/dist/analyze_functions/process_functions.js +84 -64
  13. package/dist/famix2puml.js +126 -0
  14. package/dist/famix_functions/EntityDictionary.js +865 -503
  15. package/dist/famix_functions/helpers_creation.js +1 -1
  16. package/dist/fqn.js +44 -11
  17. package/dist/getClasses-arrow-body.js +43 -0
  18. package/dist/lib/famix/famix_JSON_exporter.js +1 -1
  19. package/dist/lib/famix/famix_base_element.js +1 -1
  20. package/dist/lib/famix/famix_repository.js +57 -2
  21. package/dist/lib/famix/index.js +1 -1
  22. package/dist/lib/famix/model/famix/access.js +1 -1
  23. package/dist/lib/famix/model/famix/accessor.js +1 -1
  24. package/dist/lib/famix/model/famix/alias.js +1 -1
  25. package/dist/lib/famix/model/famix/arrow_function.js +1 -1
  26. package/dist/lib/famix/model/famix/behavioral_entity.js +1 -1
  27. package/dist/lib/famix/model/famix/class.js +1 -1
  28. package/dist/lib/famix/model/famix/comment.js +1 -1
  29. package/dist/lib/famix/model/famix/concretisation.js +1 -1
  30. package/dist/lib/famix/model/famix/container_entity.js +1 -1
  31. package/dist/lib/famix/model/famix/decorator.js +1 -1
  32. package/dist/lib/famix/model/famix/entity.js +1 -1
  33. package/dist/lib/famix/model/famix/enum.js +1 -1
  34. package/dist/lib/famix/model/famix/enum_value.js +1 -1
  35. package/dist/lib/famix/model/famix/function.js +1 -1
  36. package/dist/lib/famix/model/famix/import_clause.js +1 -1
  37. package/dist/lib/famix/model/famix/index.js +1 -1
  38. package/dist/lib/famix/model/famix/indexed_file_anchor.js +1 -1
  39. package/dist/lib/famix/model/famix/inheritance.js +1 -1
  40. package/dist/lib/famix/model/famix/interface.js +1 -1
  41. package/dist/lib/famix/model/famix/invocation.js +1 -1
  42. package/dist/lib/famix/model/famix/method.js +1 -1
  43. package/dist/lib/famix/model/famix/module.js +1 -1
  44. package/dist/lib/famix/model/famix/named_entity.js +1 -1
  45. package/dist/lib/famix/model/famix/parameter.js +1 -1
  46. package/dist/lib/famix/model/famix/parameter_concretisation.js +1 -1
  47. package/dist/lib/famix/model/famix/parameter_type.js +1 -1
  48. package/dist/lib/famix/model/famix/parametric_arrow_function.js +1 -1
  49. package/dist/lib/famix/model/famix/parametric_class.js +1 -1
  50. package/dist/lib/famix/model/famix/parametric_function.js +1 -1
  51. package/dist/lib/famix/model/famix/parametric_interface.js +1 -1
  52. package/dist/lib/famix/model/famix/parametric_method.js +1 -1
  53. package/dist/lib/famix/model/famix/primitive_type.js +1 -1
  54. package/dist/lib/famix/model/famix/property.js +1 -1
  55. package/dist/lib/famix/model/famix/reference.js +1 -1
  56. package/dist/lib/famix/model/famix/scoping_entity.js +1 -1
  57. package/dist/lib/famix/model/famix/script_entity.js +1 -1
  58. package/dist/lib/famix/model/famix/source_anchor.js +1 -1
  59. package/dist/lib/famix/model/famix/source_language.js +1 -1
  60. package/dist/lib/famix/model/famix/sourced_entity.js +1 -1
  61. package/dist/lib/famix/model/famix/structural_entity.js +1 -1
  62. package/dist/lib/famix/model/famix/type.js +1 -1
  63. package/dist/lib/famix/model/famix/variable.js +1 -1
  64. package/dist/lib/famix/src/famix_JSON_exporter.js +55 -0
  65. package/dist/lib/famix/src/famix_base_element.js +18 -0
  66. package/dist/lib/famix/src/famix_repository.js +224 -0
  67. package/dist/lib/famix/src/index.js +31 -0
  68. package/dist/lib/famix/src/model/famix/access.js +40 -0
  69. package/dist/lib/famix/src/model/famix/accessor.js +17 -0
  70. package/dist/lib/famix/src/model/famix/alias.js +33 -0
  71. package/dist/lib/famix/src/model/famix/arrowFunction.js +17 -0
  72. package/dist/lib/famix/src/model/famix/arrow_function.js +17 -0
  73. package/dist/lib/famix/src/model/famix/behavioral_entity.js +79 -0
  74. package/dist/lib/famix/src/model/famix/class.js +71 -0
  75. package/dist/lib/famix/src/model/famix/comment.js +39 -0
  76. package/dist/lib/famix/src/model/famix/concretisation.js +31 -0
  77. package/dist/lib/famix/src/model/famix/container_entity.js +126 -0
  78. package/dist/lib/famix/src/model/famix/decorator.js +32 -0
  79. package/dist/lib/famix/src/model/famix/entity.js +17 -0
  80. package/dist/lib/famix/src/model/famix/enum.js +31 -0
  81. package/dist/lib/famix/src/model/famix/enum_value.js +25 -0
  82. package/dist/lib/famix/src/model/famix/function.js +17 -0
  83. package/dist/lib/famix/src/model/famix/implicit_variable.js +17 -0
  84. package/dist/lib/famix/src/model/famix/import_clause.js +41 -0
  85. package/dist/lib/famix/src/model/famix/index.js +86 -0
  86. package/dist/lib/famix/src/model/famix/indexed_file_anchor.js +38 -0
  87. package/dist/lib/famix/src/model/famix/inheritance.js +33 -0
  88. package/dist/lib/famix/src/model/famix/interface.js +64 -0
  89. package/dist/lib/famix/src/model/famix/invocation.js +54 -0
  90. package/dist/lib/famix/src/model/famix/method.js +67 -0
  91. package/dist/lib/famix/src/model/famix/module.js +60 -0
  92. package/dist/lib/famix/src/model/famix/named_entity.js +78 -0
  93. package/dist/lib/famix/src/model/famix/parameter.js +25 -0
  94. package/dist/lib/famix/src/model/famix/parameterConcretisation.js +44 -0
  95. package/dist/lib/famix/src/model/famix/parameter_concretisation.js +44 -0
  96. package/dist/lib/famix/src/model/famix/parameter_type.js +45 -0
  97. package/dist/lib/famix/src/model/famix/parametricArrowFunction.js +29 -0
  98. package/dist/lib/famix/src/model/famix/parametric_arrow_function.js +31 -0
  99. package/dist/lib/famix/src/model/famix/parametric_class.js +44 -0
  100. package/dist/lib/famix/src/model/famix/parametric_function.js +31 -0
  101. package/dist/lib/famix/src/model/famix/parametric_interface.js +44 -0
  102. package/dist/lib/famix/src/model/famix/parametric_method.js +31 -0
  103. package/dist/lib/famix/src/model/famix/primitive_type.js +17 -0
  104. package/dist/lib/famix/src/model/famix/property.js +73 -0
  105. package/dist/lib/famix/src/model/famix/reference.js +33 -0
  106. package/dist/lib/famix/src/model/famix/scoping_entity.js +36 -0
  107. package/dist/lib/famix/src/model/famix/script_entity.js +29 -0
  108. package/dist/lib/famix/src/model/famix/source_anchor.js +27 -0
  109. package/dist/lib/famix/src/model/famix/source_language.js +35 -0
  110. package/dist/lib/famix/src/model/famix/sourced_entity.js +60 -0
  111. package/dist/lib/famix/src/model/famix/structural_entity.js +39 -0
  112. package/dist/lib/famix/src/model/famix/text_anchor.js +38 -0
  113. package/dist/lib/famix/src/model/famix/type.js +73 -0
  114. package/dist/lib/famix/src/model/famix/variable.js +24 -0
  115. package/dist/lib/ts-complex/cyclomatic-service.js +1 -1
  116. package/dist/refactorer/refactor-getter-setter.js +1 -1
  117. package/dist/ts2famix-cli-wrapper.js +1 -1
  118. package/dist/ts2famix-cli.js +1 -1
  119. package/doc-uml/famix-typescript-model.puml +607 -607
  120. package/eslint.config.mjs +28 -0
  121. package/fqn-model.json +1 -0
  122. package/iterateGenericTypes.ts +69 -0
  123. package/out/class-diagram/class-diagram.svg +1 -0
  124. package/package.json +70 -50
  125. package/sample.json +1 -0
  126. package/sample.ts +1 -0
  127. package/src/analyze.ts +120 -120
  128. package/src/analyze_functions/process_functions.ts +1040 -1019
  129. package/src/famix_functions/EntityDictionary.ts +2016 -1593
  130. package/src/famix_functions/helpers_creation.ts +135 -135
  131. package/src/fqn.ts +50 -16
  132. package/src/generate_uml.sh +20 -20
  133. package/src/lib/famix/License.md +22 -22
  134. package/src/lib/famix/famix_JSON_exporter.ts +56 -56
  135. package/src/lib/famix/famix_base_element.ts +22 -22
  136. package/src/lib/famix/famix_repository.ts +278 -243
  137. package/src/lib/famix/index.ts +8 -8
  138. package/src/lib/famix/model/famix/access.ts +50 -50
  139. package/src/lib/famix/model/famix/accessor.ts +15 -15
  140. package/src/lib/famix/model/famix/alias.ts +39 -39
  141. package/src/lib/famix/model/famix/arrow_function.ts +15 -15
  142. package/src/lib/famix/model/famix/behavioral_entity.ts +97 -97
  143. package/src/lib/famix/model/famix/class.ts +85 -85
  144. package/src/lib/famix/model/famix/comment.ts +47 -47
  145. package/src/lib/famix/model/famix/concretisation.ts +40 -40
  146. package/src/lib/famix/model/famix/container_entity.ts +160 -160
  147. package/src/lib/famix/model/famix/decorator.ts +37 -37
  148. package/src/lib/famix/model/famix/entity.ts +15 -15
  149. package/src/lib/famix/model/famix/enum.ts +30 -30
  150. package/src/lib/famix/model/famix/enum_value.ts +28 -28
  151. package/src/lib/famix/model/famix/function.ts +15 -15
  152. package/src/lib/famix/model/famix/import_clause.ts +51 -51
  153. package/src/lib/famix/model/famix/index.ts +41 -41
  154. package/src/lib/famix/model/famix/indexed_file_anchor.ts +46 -46
  155. package/src/lib/famix/model/famix/inheritance.ts +40 -40
  156. package/src/lib/famix/model/famix/interface.ts +75 -75
  157. package/src/lib/famix/model/famix/invocation.ts +65 -65
  158. package/src/lib/famix/model/famix/method.ts +89 -89
  159. package/src/lib/famix/model/famix/module.ts +71 -71
  160. package/src/lib/famix/model/famix/named_entity.ts +95 -95
  161. package/src/lib/famix/model/famix/parameter.ts +28 -28
  162. package/src/lib/famix/model/famix/parameter_concretisation.ts +51 -51
  163. package/src/lib/famix/model/famix/parameter_type.ts +58 -58
  164. package/src/lib/famix/model/famix/parametric_arrow_function.ts +32 -32
  165. package/src/lib/famix/model/famix/parametric_class.ts +49 -49
  166. package/src/lib/famix/model/famix/parametric_function.ts +32 -32
  167. package/src/lib/famix/model/famix/parametric_interface.ts +49 -49
  168. package/src/lib/famix/model/famix/parametric_method.ts +32 -32
  169. package/src/lib/famix/model/famix/primitive_type.ts +15 -15
  170. package/src/lib/famix/model/famix/property.ts +94 -94
  171. package/src/lib/famix/model/famix/reference.ts +40 -40
  172. package/src/lib/famix/model/famix/scoping_entity.ts +35 -35
  173. package/src/lib/famix/model/famix/script_entity.ts +34 -34
  174. package/src/lib/famix/model/famix/source_anchor.ts +30 -30
  175. package/src/lib/famix/model/famix/source_language.ts +35 -35
  176. package/src/lib/famix/model/famix/sourced_entity.ts +70 -70
  177. package/src/lib/famix/model/famix/structural_entity.ts +43 -43
  178. package/src/lib/famix/model/famix/type.ts +87 -87
  179. package/src/lib/famix/model/famix/variable.ts +27 -27
  180. package/src/lib/famix/package.json +28 -28
  181. package/src/lib/ts-complex/cyclomatic-service.ts +83 -83
  182. package/src/refactorer/refactor-getter-setter.ts +140 -140
  183. package/src/ts2famix-cli-wrapper.ts +21 -21
  184. package/src/ts2famix-cli.ts +60 -60
  185. package/stats.txt +3091 -0
  186. package/tabby-debug-output.txt +19433 -0
  187. package/ts2famix.log +22656 -0
  188. package/tsconfig.check-tests.json +14 -14
  189. package/tsconfig.json +72 -72
  190. package/validate-references.js +103 -0
@@ -1,14 +1,14 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "commonjs",
5
- "strict": false,
6
- "esModuleInterop": true,
7
- "skipLibCheck": true,
8
- "forceConsistentCasingInFileNames": true,
9
- "noEmit": true
10
- },
11
- "include": [
12
- "test/**/*.ts"
13
- ]
14
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "commonjs",
5
+ "strict": false,
6
+ "esModuleInterop": true,
7
+ "skipLibCheck": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "noEmit": true
10
+ },
11
+ "include": [
12
+ "test/**/*.ts"
13
+ ]
14
+ }
package/tsconfig.json CHANGED
@@ -1,72 +1,72 @@
1
- {
2
- "compilerOptions": {
3
- /* Basic Options */
4
- "target": "ES2020", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
5
- "module": "CommonJS", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
6
- // "lib": [], /* Specify library files to be included in the compilation. */
7
- // "allowJs": true, /* Allow javascript files to be compiled. */
8
- // "checkJs": true, /* Report errors in .js files. */
9
- // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
10
- // "declaration": true, /* Generates corresponding '.d.ts' file. */
11
- // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
12
- // "sourceMap": true, /* Generates corresponding '.map' file. */
13
- // "outFile": "./", /* Concatenate and emit output to single file. */
14
- "outDir": "./dist", /* Redirect output structure to the directory. */
15
- "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
16
- // "composite": true, /* Enable project compilation */
17
- // "incremental": true, /* Enable incremental compilation */
18
- // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
19
- // "removeComments": true, /* Do not emit comments to output. */
20
- // "noEmit": true, /* Do not emit outputs. */
21
- // "importHelpers": true, /* Import emit helpers from 'tslib'. */
22
- // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
23
- // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
24
- /* Strict Type-Checking Options */
25
- "strict": true, /* Enable all strict type-checking options. */
26
- // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
27
- // "strictNullChecks": true, /* Enable strict null checks. */
28
- // "strictFunctionTypes": true, /* Enable strict checking of function types. */
29
- // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
30
- // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
31
- // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
32
- // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
33
- /* Additional Checks */
34
- // "noUnusedLocals": true, /* Report errors on unused locals. */
35
- // "noUnusedParameters": true, /* Report errors on unused parameters. */
36
- // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
37
- // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
38
- /* Module Resolution Options */
39
- // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
40
- "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
41
- // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
42
- // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
43
- // "typeRoots": [], /* List of folders to include type definitions from. */
44
- // "types": [], /* Type declaration files to be included in compilation. */
45
- "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
46
- "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
47
- // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
48
- /* Source Map Options */
49
- // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
50
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
51
- "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
52
- "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
53
- /* Experimental Options */
54
- // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
55
- // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
56
- },
57
- "include": [
58
- "src/**/*.ts",
59
- ],
60
- "exclude": [
61
- "node_modules",
62
- "**/*.spec.ts",
63
- ],
64
- "typedocOptions": {
65
- "entryPoints": [
66
- "src/*"
67
- ],
68
- "entryPointStrategy": "expand",
69
- "out": "docs",
70
- "githubPages": false
71
- }
72
- }
1
+ {
2
+ "compilerOptions": {
3
+ /* Basic Options */
4
+ "target": "ES2020", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
5
+ "module": "CommonJS", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
6
+ // "lib": [], /* Specify library files to be included in the compilation. */
7
+ // "allowJs": true, /* Allow javascript files to be compiled. */
8
+ // "checkJs": true, /* Report errors in .js files. */
9
+ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
10
+ // "declaration": true, /* Generates corresponding '.d.ts' file. */
11
+ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
12
+ // "sourceMap": true, /* Generates corresponding '.map' file. */
13
+ // "outFile": "./", /* Concatenate and emit output to single file. */
14
+ "outDir": "./dist", /* Redirect output structure to the directory. */
15
+ "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
16
+ // "composite": true, /* Enable project compilation */
17
+ // "incremental": true, /* Enable incremental compilation */
18
+ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
19
+ // "removeComments": true, /* Do not emit comments to output. */
20
+ // "noEmit": true, /* Do not emit outputs. */
21
+ // "importHelpers": true, /* Import emit helpers from 'tslib'. */
22
+ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
23
+ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
24
+ /* Strict Type-Checking Options */
25
+ "strict": true, /* Enable all strict type-checking options. */
26
+ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
27
+ // "strictNullChecks": true, /* Enable strict null checks. */
28
+ // "strictFunctionTypes": true, /* Enable strict checking of function types. */
29
+ // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
30
+ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
31
+ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
32
+ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
33
+ /* Additional Checks */
34
+ // "noUnusedLocals": true, /* Report errors on unused locals. */
35
+ // "noUnusedParameters": true, /* Report errors on unused parameters. */
36
+ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
37
+ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
38
+ /* Module Resolution Options */
39
+ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
40
+ "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
41
+ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
42
+ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
43
+ // "typeRoots": [], /* List of folders to include type definitions from. */
44
+ // "types": [], /* Type declaration files to be included in compilation. */
45
+ "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
46
+ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
47
+ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
48
+ /* Source Map Options */
49
+ // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
50
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
51
+ "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
52
+ "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
53
+ /* Experimental Options */
54
+ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
55
+ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
56
+ },
57
+ "include": [
58
+ "src/**/*.ts",
59
+ ],
60
+ "exclude": [
61
+ "node_modules",
62
+ "**/*.spec.ts",
63
+ ],
64
+ "typedocOptions": {
65
+ "entryPoints": [
66
+ "src/*"
67
+ ],
68
+ "entryPointStrategy": "expand",
69
+ "out": "docs",
70
+ "githubPages": false
71
+ }
72
+ }
@@ -0,0 +1,103 @@
1
+ /* eslint-disable */
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+
5
+ // Load and parse the JSON file
6
+ const filePath = path.join(__dirname, 'arwea-fix.json');
7
+ const jsonData = JSON.parse(fs.readFileSync(filePath, 'utf8'));
8
+
9
+ // Extract all entity IDs and count entity types
10
+ const entityIds = new Set();
11
+ const entityTypeCounts = {};
12
+ const referenceCounts = {};
13
+ const accessDetails = [];
14
+ const invocationDetails = [];
15
+
16
+ jsonData.forEach(entity => {
17
+ if (entity.id !== undefined) {
18
+ entityIds.add(entity.id);
19
+ referenceCounts[entity.id] = 0;
20
+ }
21
+ if (entity.FM3 !== undefined) {
22
+ entityTypeCounts[entity.FM3] = (entityTypeCounts[entity.FM3] || 0) + 1;
23
+ }
24
+ });
25
+
26
+ // Validate references and count references
27
+ const validateReferences = (obj) => {
28
+ for (const key in obj) {
29
+ if (obj.hasOwnProperty(key)) {
30
+ if (key === 'ref') {
31
+ if (!entityIds.has(obj[key])) {
32
+ console.log(`Invalid reference found: ref:${obj[key]} does not have a corresponding entity id.`);
33
+ } else {
34
+ referenceCounts[obj[key]] = (referenceCounts[obj[key]] || 0) + 1;
35
+ }
36
+ } else if (typeof obj[key] === 'object') {
37
+ validateReferences(obj[key]);
38
+ }
39
+ }
40
+ }
41
+ };
42
+
43
+ // Extract details for Access entities
44
+ const extractAccessDetails = (entity) => {
45
+ if (entity.FM3 === 'FamixTypeScript.Access') {
46
+ const accessor = jsonData.find(e => e.id === entity.accessor?.ref);
47
+ const variable = jsonData.find(e => e.id === entity.variable?.ref);
48
+ accessDetails.push({
49
+ id: entity.id,
50
+ accessorId: accessor?.id || 'unknown',
51
+ accessorName: accessor?.name || 'unknown',
52
+ variableId: variable?.id || 'unknown',
53
+ variableName: variable?.name || 'unknown'
54
+ });
55
+ }
56
+ };
57
+
58
+ // Extract details for Invocation entities
59
+ const extractInvocationDetails = (entity) => {
60
+ if (entity.FM3 === 'FamixTypeScript.Invocation') {
61
+ const invoker = jsonData.find(e => e.id === entity.sender?.ref);
62
+ const invokedMethod = jsonData.find(e => e.id === entity.receiver?.ref);
63
+ invocationDetails.push({
64
+ id: entity.id,
65
+ invokerId: invoker?.id || 'unknown',
66
+ invokerName: invoker?.name || 'unknown',
67
+ invokedMethodId: invokedMethod?.id || 'unknown',
68
+ invokedMethodName: invokedMethod?.name || 'unknown'
69
+ });
70
+ }
71
+ };
72
+
73
+ // Validate all entities and extract details
74
+ jsonData.forEach(entity => {
75
+ validateReferences(entity);
76
+ extractAccessDetails(entity);
77
+ extractInvocationDetails(entity);
78
+ });
79
+
80
+ // Print statistics
81
+ console.log('Entity Type Counts:');
82
+ for (const [type, count] of Object.entries(entityTypeCounts)) {
83
+ console.log(`${type}: ${count}`);
84
+ }
85
+
86
+ console.log('\nReference Counts:');
87
+ for (const [id, count] of Object.entries(referenceCounts)) {
88
+ console.log(`Entity ID ${id}: ${count} references`);
89
+ }
90
+
91
+ // Print Access details
92
+ console.log('\nAccess Details:');
93
+ accessDetails.forEach(detail => {
94
+ console.log(`Access ID ${detail.id}: accessor (ID: ${detail.accessorId}, Name: ${detail.accessorName}) to variable (ID: ${detail.variableId}, Name: ${detail.variableName})`);
95
+ });
96
+
97
+ // Print Invocation details
98
+ console.log('\nInvocation Details:');
99
+ invocationDetails.forEach(detail => {
100
+ console.log(`Invocation ID ${detail.id}: invoker (ID: ${detail.invokerId}, Name: ${detail.invokerName}) to method (ID: ${detail.invokedMethodId}, Name: ${detail.invokedMethodName})`);
101
+ });
102
+
103
+ console.log('Validation complete.');