@@ -5,6 +5,18 @@ OPTIONAL MATCH (class:TS:Class)-[:DECLARES]->(ts)
55 WITH *
66 //In case of a path like ".../moduleName/src/index.ts", the module name is extracted into sourceIndexModuleName.
77 ,reverse (split (reverse (nullif (split (ts .globalFqn , '/src/index.' )[0 ], ts .globalFqn )), '/' )[0 ]) AS sourceIndexModuleName
8+ WITH *
9+ //In case of a path like ".../moduleName/dist/types/index.d.ts", the module name is extracted into distTypesIndexModuleName.
10+ ,reverse (split (reverse (nullif (split (ts .globalFqn , '/dist/types/index.' )[0 ], ts .globalFqn )), '/' )[0 ]) AS distTypesIndexModuleName
11+ WITH *
12+ //In case of a path like ".../moduleName/types/index.d.ts", the module name is extracted into typesIndexModuleName.
13+ ,reverse (split (reverse (nullif (split (ts .globalFqn , '/types/index.' )[0 ], ts .globalFqn )), '/' )[0 ]) AS typesIndexModuleName
14+ WITH *
15+ //In case of a path like ".../moduleName/dist/types/src/index.d.ts", the module name is extracted into distTypesSourceIndexModuleName.
16+ ,reverse (split (reverse (nullif (split (ts .globalFqn , '/dist/types/src/index.' )[0 ], ts .globalFqn )), '/' )[0 ]) AS distTypesSourceIndexModuleName
17+ WITH *
18+ //Combine the cases above into "normalizedModuleName"
19+ ,coalesce (distTypesIndexModuleName , typesIndexModuleName , distTypesSourceIndexModuleName , sourceIndexModuleName ) AS normalizedModuleName
820 WITH *
921 ,replace (split (ts .globalFqn , '".' )[0 ],'"' , '' ) AS modulePathName
1022 ,reverse (split (reverse (replace (split (ts .globalFqn , '".' )[0 ],'"' , '' )), '/' )[0 ]) AS moduleName
@@ -24,7 +36,7 @@ OPTIONAL MATCH (class:TS:Class)-[:DECLARES]->(ts)
2436 SET ts .namespace = coalesce (nullif (namespaceNameWithAtPrefixed , '' ), ts .namespace , '' )
2537 ,ts .module = modulePathNameWithoutIndexAndDefault
2638 ,ts .moduleName = moduleName
27- ,ts .name = coalesce (sourceIndexModuleName , symbolNameWithoutClassName , indexAndExtensionOmittedName )
39+ ,ts .name = coalesce (symbolNameWithoutClassName , normalizedModuleName , indexAndExtensionOmittedName )
2840 ,ts .extensionExtended = moduleNameExtensionExtended
2941 ,ts .extension = moduleNameExtension
3042 ,ts .isNodeModule = isNodeModule
@@ -33,12 +45,18 @@ OPTIONAL MATCH (class:TS:Class)-[:DECLARES]->(ts)
3345 ,ts .packageName = packageName
3446RETURN count (* ) AS updatedModules
3547// For debugging
36- // RETURN namespaceNameWithAtPrefixed AS namespace
37- // ,modulePathName AS module
38- // ,moduleName AS moduleName
39- // ,coalesce(sourceIndexModuleName, symbolNameWithoutClassName, indexAndExtensionOmittedName) AS name
40- // ,moduleNameExtensionExtended AS extensionExtended
41- // ,moduleNameExtension AS extension
48+ // RETURN ts.globalFqn
49+ // ,namespaceNameWithAtPrefixed AS namespace
50+ // ,modulePathName AS module
51+ // ,moduleName AS moduleName
52+ // ,coalesce(symbolNameWithoutClassName, normalizedModuleName, indexAndExtensionOmittedName) AS name
53+ // ,moduleNameExtensionExtended AS extensionExtended
54+ // ,moduleNameExtension AS extension
55+ // ,modulePathNameWithoutIndexAndDefault
56+ // ,symbolName
57+ // ,optionalClassName
58+ // ,normalizedModuleName
59+ // ,symbolNameWithoutClassName
4260// ,isNodeModule AS isNodeModule
4361// ,isUnresolvedImport AS isUnresolvedImport
4462// ,isNodeModule OR isUnresolvedImport AS isExternalImport
0 commit comments