@eventra_dev/eventra-cli 0.1.10 → 0.1.11

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.
@@ -70,6 +70,7 @@ function resolveNodeValue(node, checker, paramMap, seen = new Set()) {
70
70
  if (s.flags & typescript_1.default.SymbolFlags.Alias) {
71
71
  s = checker.getAliasedSymbol(s);
72
72
  }
73
+ // ENUM support
73
74
  for (const decl of s.getDeclarations() ?? []) {
74
75
  if (typescript_1.default.isEnumMember(decl) && decl.initializer) {
75
76
  if (typescript_1.default.isStringLiteral(decl.initializer)) {
@@ -81,6 +82,26 @@ function resolveNodeValue(node, checker, paramMap, seen = new Set()) {
81
82
  }
82
83
  }
83
84
  }
85
+ // OBJECT support
86
+ if (typescript_1.default.isIdentifier(node.expression)) {
87
+ const objSymbol = checker.getSymbolAtLocation(node.expression);
88
+ if (objSymbol) {
89
+ for (const decl of objSymbol.getDeclarations() ?? []) {
90
+ if (typescript_1.default.isVariableDeclaration(decl) &&
91
+ decl.initializer &&
92
+ typescript_1.default.isObjectLiteralExpression(decl.initializer)) {
93
+ for (const prop of decl.initializer.properties) {
94
+ if (!typescript_1.default.isPropertyAssignment(prop))
95
+ continue;
96
+ const name = prop.name.getText();
97
+ if (name === node.name.text) {
98
+ return resolveNodeValue(prop.initializer, checker, paramMap, seen);
99
+ }
100
+ }
101
+ }
102
+ }
103
+ }
104
+ }
84
105
  }
85
106
  if (typescript_1.default.isObjectLiteralExpression(node)) {
86
107
  const values = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eventra_dev/eventra-cli",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Eventra CLI",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -107,6 +107,7 @@ export function resolveNodeValue(
107
107
  s = checker.getAliasedSymbol(s);
108
108
  }
109
109
 
110
+ // ENUM support
110
111
  for (const decl of s.getDeclarations() ?? []) {
111
112
  if (ts.isEnumMember(decl) && decl.initializer) {
112
113
  if (ts.isStringLiteral(decl.initializer)) {
@@ -118,6 +119,36 @@ export function resolveNodeValue(
118
119
  }
119
120
  }
120
121
  }
122
+
123
+ // OBJECT support
124
+ if (ts.isIdentifier(node.expression)) {
125
+ const objSymbol = checker.getSymbolAtLocation(node.expression);
126
+
127
+ if (objSymbol) {
128
+ for (const decl of objSymbol.getDeclarations() ?? []) {
129
+ if (
130
+ ts.isVariableDeclaration(decl) &&
131
+ decl.initializer &&
132
+ ts.isObjectLiteralExpression(decl.initializer)
133
+ ) {
134
+ for (const prop of decl.initializer.properties) {
135
+ if (!ts.isPropertyAssignment(prop)) continue;
136
+
137
+ const name = prop.name.getText();
138
+
139
+ if (name === node.name.text) {
140
+ return resolveNodeValue(
141
+ prop.initializer,
142
+ checker,
143
+ paramMap,
144
+ seen
145
+ );
146
+ }
147
+ }
148
+ }
149
+ }
150
+ }
151
+ }
121
152
  }
122
153
 
123
154
  if (ts.isObjectLiteralExpression(node)) {