moonflower 1.6.0 → 1.6.2

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 (28) hide show
  1. package/dist/openapi/analyzerModule/analyzerModule.cjs +1 -1
  2. package/dist/openapi/analyzerModule/analyzerModule.cjs.map +1 -1
  3. package/dist/openapi/analyzerModule/analyzerModule.d.ts.map +1 -1
  4. package/dist/openapi/analyzerModule/analyzerModule.mjs +21 -21
  5. package/dist/openapi/analyzerModule/analyzerModule.mjs.map +1 -1
  6. package/dist/openapi/analyzerModule/getSourceFileTimestamp.cjs +1 -1
  7. package/dist/openapi/analyzerModule/getSourceFileTimestamp.cjs.map +1 -1
  8. package/dist/openapi/analyzerModule/getSourceFileTimestamp.d.ts +1 -1
  9. package/dist/openapi/analyzerModule/getSourceFileTimestamp.d.ts.map +1 -1
  10. package/dist/openapi/analyzerModule/getSourceFileTimestamp.mjs +43 -32
  11. package/dist/openapi/analyzerModule/getSourceFileTimestamp.mjs.map +1 -1
  12. package/dist/openapi/analyzerModule/nodeParsers.cjs +1 -1
  13. package/dist/openapi/analyzerModule/nodeParsers.cjs.map +1 -1
  14. package/dist/openapi/analyzerModule/nodeParsers.d.ts.map +1 -1
  15. package/dist/openapi/analyzerModule/nodeParsers.mjs +241 -222
  16. package/dist/openapi/analyzerModule/nodeParsers.mjs.map +1 -1
  17. package/dist/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.cjs +1 -1
  18. package/dist/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.cjs.map +1 -1
  19. package/dist/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.d.ts +4 -2
  20. package/dist/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.d.ts.map +1 -1
  21. package/dist/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.mjs +10 -14
  22. package/dist/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.mjs.map +1 -1
  23. package/package.json +1 -1
  24. package/src/openapi/analyzerModule/analyzerModule.ts +1 -3
  25. package/src/openapi/analyzerModule/getSourceFileTimestamp.ts +52 -37
  26. package/src/openapi/analyzerModule/nodeParsers.ts +57 -22
  27. package/src/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.spec.ts +12 -3
  28. package/src/openapi/discoveryModule/discoverRouterFiles/discoverRouterFiles.ts +2 -7
@@ -1,158 +1,175 @@
1
1
  import { SyntaxKind as t } from "ts-morph";
2
2
  import { Logger as m } from "../../utils/logger.mjs";
3
- import { OpenApiManager as V } from "../manager/OpenApiManager.mjs";
4
- const S = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakMap(), f = (e) => {
5
- const i = S.get(e);
6
- if (i)
7
- return i;
3
+ import { OpenApiManager as R } from "../manager/OpenApiManager.mjs";
4
+ const S = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakMap(), W = (e) => {
5
+ const n = e.getSymbol();
6
+ if (n)
7
+ return (n.getAliasedSymbol() ?? n).compilerSymbol;
8
+ }, f = (e) => {
9
+ const n = S.get(e);
10
+ if (n)
11
+ return n;
8
12
  if (e.getKind() === t.Identifier) {
9
- const n = e.asKind(t.Identifier).getImplementations()[0]?.getNode();
10
- if (n) {
11
- const l = n.getParent().getLastChild();
12
- if (l === e)
13
- throw new Error("Recursive implementation found");
14
- const p = f(l);
15
- return S.set(e, p), p;
16
- }
17
- const s = e.asKind(t.Identifier).getDefinitions()[0]?.getNode();
18
- if (s) {
19
- const l = s.getParent().getLastChild();
20
- if (l === e)
21
- throw new Error("Recursive implementation found");
22
- const p = f(l);
23
- return S.set(e, p), p;
13
+ const i = W(e);
14
+ if (i) {
15
+ const d = U.get(i);
16
+ if (d)
17
+ return S.set(e, d), d;
24
18
  }
25
- throw new Error("No implementation nor definition available");
19
+ const s = (() => {
20
+ const d = e.asKind(t.Identifier).getImplementations()[0]?.getNode();
21
+ if (d) {
22
+ const a = d.getParent().getLastChild();
23
+ if (a === e)
24
+ throw new Error("Recursive implementation found");
25
+ return f(a);
26
+ }
27
+ const c = e.asKind(t.Identifier).getDefinitions()[0]?.getNode();
28
+ if (c) {
29
+ const a = c.getParent().getLastChild();
30
+ if (a === e)
31
+ throw new Error("Recursive implementation found");
32
+ return f(a);
33
+ }
34
+ throw new Error("No implementation nor definition available");
35
+ })();
36
+ return i && U.set(i, s), S.set(e, s), s;
26
37
  }
27
38
  return S.set(e, e), e;
28
39
  }, T = (e) => {
29
- const i = e.getChildrenOfKind(t.Identifier);
30
- return i.length === 2 ? f(i[1]) : e.getChildren().reverse().find(
31
- (s) => s.getKind() !== t.GreaterThanToken && s.getKind() !== t.CommaToken && s.getKind() !== t.SemicolonToken
40
+ const n = e.getChildrenOfKind(t.Identifier);
41
+ return n.length === 2 ? f(n[1]) : e.getChildren().reverse().find(
42
+ (l) => l.getKind() !== t.GreaterThanToken && l.getKind() !== t.CommaToken && l.getKind() !== t.SemicolonToken
32
43
  );
33
44
  }, w = (e) => {
34
- const i = e.getFirstChildByKind(t.SyntaxList);
35
- return i.isKind(t.SyntaxList) ? y(i.getFirstChild()) : y(i);
45
+ const n = e.getFirstChildByKind(t.SyntaxList);
46
+ return n.isKind(t.SyntaxList) ? y(n.getFirstChild()) : y(n);
36
47
  }, y = (e) => {
37
- const i = v.get(e);
38
- if (i !== void 0)
39
- return i;
40
- const n = $(e);
41
- return v.set(e, n), n;
42
- }, $ = (e) => {
43
- const i = e.getSymbol()?.getName();
44
- if (i && V.getInstance().hasExposedModel(i))
48
+ const n = O.get(e);
49
+ if (n !== void 0)
50
+ return n;
51
+ const i = Q(e);
52
+ return O.set(e, i), i;
53
+ }, Q = (e) => {
54
+ const n = e.getSymbol()?.getName();
55
+ if (n && R.getInstance().hasExposedModel(n))
45
56
  return [
46
57
  {
47
58
  role: "ref",
48
- shape: i,
59
+ shape: n,
49
60
  optional: !1
50
61
  }
51
62
  ];
52
- const n = f(e);
53
- if (n.asKind(t.UndefinedKeyword))
63
+ const i = f(e);
64
+ if (i.asKind(t.UndefinedKeyword))
54
65
  return "undefined";
55
- const o = n.asKind(t.LiteralType);
56
- if (o) {
57
- if (o.getFirstChildByKind(t.TrueKeyword))
66
+ const s = i.asKind(t.LiteralType);
67
+ if (s) {
68
+ if (s.getFirstChildByKind(t.TrueKeyword))
58
69
  return "true";
59
- if (o.getFirstChildByKind(t.FalseKeyword))
70
+ if (s.getFirstChildByKind(t.FalseKeyword))
60
71
  return "false";
61
72
  }
62
- if (n.asKind(t.BooleanKeyword) || n.asKind(t.TrueKeyword) || n.asKind(t.FalseKeyword))
73
+ if (i.asKind(t.BooleanKeyword) || i.asKind(t.TrueKeyword) || i.asKind(t.FalseKeyword))
63
74
  return "boolean";
64
- if (n.asKind(t.StringKeyword) || n.asKind(t.StringLiteral))
75
+ if (i.asKind(t.StringKeyword) || i.asKind(t.StringLiteral))
65
76
  return "string";
66
- if (n.asKind(t.NumberKeyword) || n.asKind(t.NumericLiteral))
77
+ if (i.asKind(t.NumberKeyword) || i.asKind(t.NumericLiteral))
67
78
  return "number";
68
- if (n.asKind(t.BigIntKeyword) || n.asKind(t.BigIntLiteral))
79
+ if (i.asKind(t.BigIntKeyword) || i.asKind(t.BigIntLiteral))
69
80
  return "bigint";
70
- const r = n.asKind(t.TypeLiteral);
81
+ const r = i.asKind(t.TypeLiteral);
71
82
  if (r)
72
- return r.getFirstChildByKind(t.SyntaxList).getChildrenOfKind(t.PropertySignature).map((B) => {
73
- const I = B.getFirstChildByKind(t.Identifier), k = T(B), _ = I.getNextSiblingIfKind(t.QuestionToken);
83
+ return r.getFirstChildByKind(t.SyntaxList).getChildrenOfKind(t.PropertySignature).map((I) => {
84
+ const k = I.getFirstChildByKind(t.Identifier), v = T(I), j = k.getNextSiblingIfKind(t.QuestionToken);
74
85
  return {
75
86
  role: "property",
76
- identifier: I.getText(),
77
- shape: y(k),
78
- optional: k.getType().isNullable() || !!_
87
+ identifier: k.getText(),
88
+ shape: y(v),
89
+ optional: v.getType().isNullable() || !!j
79
90
  };
80
91
  });
81
- const g = n.asKind(t.TypeReference);
92
+ const g = i.asKind(t.TypeReference);
82
93
  if (g)
83
94
  return y(g.getFirstChild());
84
- if (n.asKind(t.PropertyAccessExpression)) {
85
- const b = f(n.getLastChild());
86
- return c(b.asKind(t.CallExpression).getReturnType(), b);
95
+ if (i.asKind(t.PropertyAccessExpression)) {
96
+ const F = f(i.getLastChild());
97
+ return p(F.asKind(t.CallExpression).getReturnType(), F);
87
98
  }
88
- const h = n.asKind(t.UnionType);
99
+ const h = i.asKind(t.UnionType);
89
100
  if (h)
90
- return c(h.getType(), n);
91
- const x = n.asKind(t.TypeQuery);
101
+ return p(h.getType(), i);
102
+ const x = i.asKind(t.TypeQuery);
92
103
  if (x)
93
104
  return y(x.getLastChild());
94
- const C = n.asKind(t.QualifiedName);
105
+ const C = i.asKind(t.QualifiedName);
95
106
  if (C)
96
107
  return y(C.getLastChild());
97
- const K = n.asKind(t.CallExpression);
108
+ const K = i.asKind(t.CallExpression);
98
109
  if (K)
99
- return c(K.getReturnType(), K);
100
- const P = n.asKind(t.AwaitExpression);
101
- if (P)
102
- return y(P.getChildAtIndex(1));
103
- const E = n.asKind(t.AsExpression);
110
+ return p(K.getReturnType(), K);
111
+ const B = i.asKind(t.AwaitExpression);
112
+ if (B)
113
+ return y(B.getChildAtIndex(1));
114
+ const E = i.asKind(t.AsExpression);
104
115
  if (E)
105
116
  return y(E.getChildAtIndex(2));
106
- const D = n.getSourceFile().getFilePath().split("/").pop();
107
- return m.warn(`[${D}] Unknown node type: ${n.getKindName()}`), "unknown_1";
108
- }, z = (e) => e.getFirstDescendantByKind(t.SyntaxList).getChildrenOfKind(t.PropertyAssignment).map((o) => {
109
- const l = o.getFirstChild(), p = (() => {
110
- if (l.isKind(t.Identifier))
111
- return l.getText();
112
- if (l.isKind(t.StringLiteral))
113
- return l.getLiteralText();
114
- const r = o.getSourceFile().getFilePath().split("/").pop();
115
- return m.warn(`[${r}] Unknown identifier name: ${l.getText()}`), "unknown_30";
116
- })(), a = o.getLastChild(), d = f(a);
117
+ const $ = i.getSourceFile().getFilePath().split("/").pop();
118
+ return m.warn(`[${$}] Unknown node type: ${i.getKindName()}`), "unknown_1";
119
+ }, Y = (e) => e.getFirstDescendantByKind(t.SyntaxList).getChildrenOfKind(t.PropertyAssignment).map((s) => {
120
+ const d = s.getFirstChild(), c = (() => {
121
+ if (d.isKind(t.Identifier))
122
+ return d.getText();
123
+ if (d.isKind(t.StringLiteral))
124
+ return d.getLiteralText();
125
+ const r = s.getSourceFile().getFilePath().split("/").pop();
126
+ return m.warn(`[${r}] Unknown identifier name: ${d.getText()}`), "unknown_30";
127
+ })(), o = s.getLastChild(), a = f(o);
117
128
  return {
118
129
  role: "property",
119
- identifier: p,
120
- shape: A(d),
121
- optional: R(d),
122
- description: N(d, "description"),
123
- errorMessage: N(d, "errorMessage")
130
+ identifier: c,
131
+ shape: A(a),
132
+ optional: _(a),
133
+ description: N(a, "description"),
134
+ errorMessage: N(a, "errorMessage")
124
135
  };
125
- }) || [], L = (e) => {
126
- const i = e.asKind(t.CallExpression);
127
- return i ? (i.getReturnType().getSymbol()?.getName() ?? "").startsWith("Zod") : !1;
128
- }, j = (e) => {
129
- const i = e.asKind(t.CallExpression), n = i.getReturnType(), s = n.getProperty("_output");
130
- if (s)
131
- return c(s.getTypeAtLocation(i), i);
132
- const o = e.getSourceFile().getFilePath().split("/").pop(), l = n.getSymbol()?.getName() ?? "";
133
- return m.warn(`[${o}] Unknown zod type: ${l}`), "unknown_zod";
136
+ }) || [], D = /* @__PURE__ */ new WeakMap(), L = (e) => {
137
+ const n = D.get(e);
138
+ if (n)
139
+ return n;
140
+ const i = e.asKindOrThrow(t.CallExpression).getReturnType();
141
+ return D.set(e, i), i;
142
+ }, P = (e) => {
143
+ const n = e.asKind(t.CallExpression);
144
+ return n ? (L(n).getSymbol()?.getName() ?? "").startsWith("Zod") : !1;
145
+ }, Z = (e) => {
146
+ const n = e.asKind(t.CallExpression), i = L(n), l = i.getProperty("_output");
147
+ if (l)
148
+ return p(l.getTypeAtLocation(n), n);
149
+ const s = e.getSourceFile().getFilePath().split("/").pop(), d = i.getSymbol()?.getName() ?? "";
150
+ return m.warn(`[${s}] Unknown zod type: ${d}`), "unknown_zod";
134
151
  }, A = (e) => {
135
- if (L(e))
136
- return j(e);
137
- const i = e.getParent().getFirstChildByKind(t.AsExpression);
138
- if (i) {
139
- const r = i.getLastChildByKind(t.TypeReference);
152
+ if (P(e))
153
+ return Z(e);
154
+ const n = e.getParent().getFirstChildByKind(t.AsExpression);
155
+ if (n) {
156
+ const r = n.getLastChildByKind(t.TypeReference);
140
157
  return w(r);
141
158
  }
142
- const n = e.getParent().getFirstChildByKind(t.TypeReference);
143
- if (n)
144
- return w(n);
159
+ const i = e.getParent().getFirstChildByKind(t.TypeReference);
160
+ if (i)
161
+ return w(i);
145
162
  if (e.getParent().getChildrenOfKind(t.SyntaxList).length >= 2) {
146
163
  const r = e.getParent().getFirstChildByKind(t.SyntaxList).getFirstChild();
147
164
  return y(r);
148
165
  }
149
- const s = e.getParent().getFirstChildByKind(t.CallExpression);
150
- if (s) {
166
+ const l = e.getParent().getFirstChildByKind(t.CallExpression);
167
+ if (l) {
151
168
  const r = f(
152
- s.getFirstChildByKind(t.SyntaxList).getFirstChild()
169
+ l.getFirstChildByKind(t.SyntaxList).getFirstChild()
153
170
  ), g = r.getParent().getFirstChildByKind(t.TypeReference);
154
171
  if (g)
155
- return c(g.getType(), g, []);
172
+ return p(g.getType(), g, []);
156
173
  const u = r.getParent().getFirstChildByKind(t.ObjectLiteralExpression);
157
174
  if (u)
158
175
  return A(u);
@@ -161,93 +178,95 @@ const S = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), O =
161
178
  const h = e.getSourceFile().getFilePath().split("/").pop();
162
179
  return m.warn(`[${h}] Unknown call expression argument: ${r.getKindName()}`), "unknown_3";
163
180
  }
164
- const l = e.getFirstChildByKind(t.SyntaxList).getChildrenOfKind(t.PropertyAssignment).find((r) => r.getFirstChildByKind(t.Identifier)?.getText() === "parse");
165
- if (l) {
166
- const r = T(l).asKind(t.ArrowFunction).getReturnType();
167
- return c(r, l);
181
+ const d = e.getFirstChildByKind(t.SyntaxList).getChildrenOfKind(t.PropertyAssignment).find((r) => r.getFirstChildByKind(t.Identifier)?.getText() === "parse");
182
+ if (d) {
183
+ const r = T(d).asKind(t.ArrowFunction).getReturnType();
184
+ return p(r, d);
168
185
  }
169
- const p = e.getFirstChildByKind(t.SyntaxList)?.getFirstChildByKind(t.ImportType);
170
- if (p) {
171
- const r = p.getLastChildByKind(t.GreaterThanToken).getChildIndex(), g = p.getChildAtIndex(r - 1);
186
+ const c = e.getFirstChildByKind(t.SyntaxList)?.getFirstChildByKind(t.ImportType);
187
+ if (c) {
188
+ const r = c.getLastChildByKind(t.GreaterThanToken).getChildIndex(), g = c.getChildAtIndex(r - 1);
172
189
  return y(g.getFirstChild());
173
190
  }
174
- const a = e.isKind(t.IntersectionType) ? e : e.getParent()?.isKind(t.VariableDeclaration) ? e.getParent()?.getFirstChildByKind(t.IntersectionType) : null;
175
- if (a) {
176
- const r = a.getFirstChildByKind(t.TypeReference);
191
+ const o = e.isKind(t.IntersectionType) ? e : e.getParent()?.isKind(t.VariableDeclaration) ? e.getParent()?.getFirstChildByKind(t.IntersectionType) : null;
192
+ if (o) {
193
+ const r = o.getFirstChildByKind(t.TypeReference);
177
194
  if (r)
178
195
  return w(r);
179
196
  }
180
- const d = e.getSourceFile().getFilePath().split("/").pop();
181
- return m.warn(`[${d}] Unknown import type node`), "unknown_2";
182
- }, R = (e) => {
183
- if (L(e))
184
- return (e.asKind(t.CallExpression).getReturnType().getSymbol()?.getName() ?? "") === "ZodOptional";
185
- const i = e.asKind(t.CallExpression);
186
- if (i) {
187
- const o = i.getFirstChildByKind(t.Identifier);
188
- if (o?.getText() === "OptionalParam")
197
+ const a = e.getSourceFile().getFilePath().split("/").pop();
198
+ return m.warn(`[${a}] Unknown import type node`), "unknown_2";
199
+ }, _ = (e) => {
200
+ if (P(e)) {
201
+ const s = e.asKind(t.CallExpression);
202
+ return (L(s).getSymbol()?.getName() ?? "") === "ZodOptional";
203
+ }
204
+ const n = e.asKind(t.CallExpression);
205
+ if (n) {
206
+ const s = n.getFirstChildByKind(t.Identifier);
207
+ if (s?.getText() === "OptionalParam")
189
208
  return !0;
190
- if (o?.getText() === "RequiredParam")
209
+ if (s?.getText() === "RequiredParam")
191
210
  return !1;
192
- const l = i.getFirstChildByKind(t.SyntaxList), p = f(l.getFirstChild());
193
- return R(p);
211
+ const d = n.getFirstChildByKind(t.SyntaxList), c = f(d.getFirstChild());
212
+ return _(c);
194
213
  }
195
- return e.getFirstDescendantByKind(t.SyntaxList).getChildrenOfKind(t.PropertyAssignment).some((o) => o.getFirstDescendantByKind(t.Identifier).getText() === "optional" ? T(o).getKind() === t.TrueKeyword : !1);
196
- }, N = (e, i) => {
197
- if (L(e))
214
+ return e.getFirstDescendantByKind(t.SyntaxList).getChildrenOfKind(t.PropertyAssignment).some((s) => s.getFirstDescendantByKind(t.Identifier).getText() === "optional" ? T(s).getKind() === t.TrueKeyword : !1);
215
+ }, N = (e, n) => {
216
+ if (P(e))
198
217
  return "";
199
- const n = f(e), s = n.asKind(t.CallExpression);
200
- if (s) {
201
- const g = s.getLastChildByKind(t.SyntaxList);
202
- return N(g, i);
203
- }
204
- const o = n.asKind(t.SyntaxList);
205
- if (o)
206
- return o.getChildren().map((u) => N(u, i)).find((u) => !!u && u !== "unknown_25") || "";
207
- const l = n.asKind(t.ObjectLiteralExpression);
218
+ const i = f(e), l = i.asKind(t.CallExpression);
208
219
  if (l) {
209
- const u = U(l).find((h) => h.identifier === i);
220
+ const g = l.getLastChildByKind(t.SyntaxList);
221
+ return N(g, n);
222
+ }
223
+ const s = i.asKind(t.SyntaxList);
224
+ if (s)
225
+ return s.getChildren().map((u) => N(u, n)).find((u) => !!u && u !== "unknown_25") || "";
226
+ const d = i.asKind(t.ObjectLiteralExpression);
227
+ if (d) {
228
+ const u = M(d).find((h) => h.identifier === n);
210
229
  return u ? Array.isArray(u.value) ? "array" : u.value || "" : "";
211
230
  }
212
- const p = n.asKind(t.IntersectionType);
213
- if (p)
214
- return p.getTypeNodes().flatMap((g) => N(g, i)).filter((g) => !!g && g !== "unknown_25")[0] || "unknown_27";
215
- const a = n.asKind(t.TypeLiteral);
216
- if (a)
217
- return N(a.getFirstChildByKind(t.SyntaxList), i);
218
- const d = n.asKind(t.PropertySignature);
219
- if (d && n.getFirstDescendantByKind(t.Identifier).getText() === i)
220
- return T(d).getFirstDescendantByKind(
231
+ const c = i.asKind(t.IntersectionType);
232
+ if (c)
233
+ return c.getTypeNodes().flatMap((g) => N(g, n)).filter((g) => !!g && g !== "unknown_25")[0] || "unknown_27";
234
+ const o = i.asKind(t.TypeLiteral);
235
+ if (o)
236
+ return N(o.getFirstChildByKind(t.SyntaxList), n);
237
+ const a = i.asKind(t.PropertySignature);
238
+ if (a && i.getFirstDescendantByKind(t.Identifier).getText() === n)
239
+ return T(a).getFirstDescendantByKind(
221
240
  t.StringLiteral
222
241
  ).getLiteralText();
223
- const r = n.getSourceFile().getFilePath().split("/").pop();
224
- return m.dev(`[${r}] Unknown property string value node ${n.getKindName()}`), "unknown_25";
225
- }, M = (e) => {
226
- const i = e.getSymbol();
227
- if (!e.isObject() || !i)
242
+ const r = i.getSourceFile().getFilePath().split("/").pop();
243
+ return m.dev(`[${r}] Unknown property string value node ${i.getKindName()}`), "unknown_25";
244
+ }, q = (e) => {
245
+ const n = e.getSymbol();
246
+ if (!e.isObject() || !n)
228
247
  return !1;
229
- const n = e.getTypeArguments();
230
- return i.getName() === "Promise" && n.length === 1;
231
- }, c = (e, i, n = []) => {
232
- const s = e.getAliasSymbol()?.getName();
233
- if (s && V.getInstance().hasExposedModel(s))
248
+ const i = e.getTypeArguments();
249
+ return n.getName() === "Promise" && i.length === 1;
250
+ }, p = (e, n, i = []) => {
251
+ const l = e.getAliasSymbol()?.getName();
252
+ if (l && R.getInstance().hasExposedModel(l))
234
253
  return [
235
254
  {
236
255
  role: "ref",
237
- shape: s,
256
+ shape: l,
238
257
  optional: !1
239
258
  }
240
259
  ];
241
- const o = M(e) ? e.getTypeArguments()[0] : e;
242
- if (n.some((d) => d === o))
260
+ const s = q(e) ? e.getTypeArguments()[0] : e;
261
+ if (i.some((a) => a === s))
243
262
  return "circular";
244
- const l = o.compilerType, p = O.get(l);
245
- if (p !== void 0)
246
- return p;
247
- const a = Q(o, i, n);
248
- return O.set(l, a), a;
249
- }, Q = (e, i, n) => {
250
- const s = n.concat(e);
263
+ const d = s.compilerType, c = V.get(d);
264
+ if (c !== void 0)
265
+ return c;
266
+ const o = G(s, n, i);
267
+ return V.set(d, o), o;
268
+ }, G = (e, n, i) => {
269
+ const l = i.concat(e);
251
270
  if (e.getText() === "void")
252
271
  return "void";
253
272
  if (e.isAny())
@@ -286,9 +305,9 @@ const S = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), O =
286
305
  return [
287
306
  {
288
307
  role: "tuple",
289
- shape: e.getTupleElements().map((a) => ({
308
+ shape: e.getTupleElements().map((o) => ({
290
309
  role: "tuple_entry",
291
- shape: c(a, i, s),
310
+ shape: p(o, n, l),
292
311
  optional: !1
293
312
  })),
294
313
  optional: !1
@@ -298,26 +317,26 @@ const S = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), O =
298
317
  return [
299
318
  {
300
319
  role: "array",
301
- shape: c(e.getArrayElementType(), i, s),
320
+ shape: p(e.getArrayElementType(), n, l),
302
321
  optional: !1
303
322
  }
304
323
  ];
305
324
  if (e.isObject()) {
306
- const a = e.getNumberIndexType(), r = e.getBaseTypes()?.find((g) => g.isArray());
325
+ const o = e.getNumberIndexType(), r = e.getBaseTypes()?.find((g) => g.isArray());
307
326
  if (r)
308
327
  return [
309
328
  {
310
329
  role: "array",
311
- shape: c(
312
- r.getArrayElementType() ?? a,
313
- i,
314
- s
330
+ shape: p(
331
+ r.getArrayElementType() ?? o,
332
+ n,
333
+ l
315
334
  ),
316
335
  optional: !1
317
336
  }
318
337
  ];
319
338
  }
320
- const o = e.getSymbol()?.getName(), l = /* @__PURE__ */ new Set([
339
+ const s = e.getSymbol()?.getName(), d = /* @__PURE__ */ new Set([
321
340
  "Buffer",
322
341
  "Uint8Array",
323
342
  "Int8Array",
@@ -334,7 +353,7 @@ const S = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), O =
334
353
  "SharedArrayBuffer",
335
354
  "ReadableStream"
336
355
  ]);
337
- if (e.isObject() && o && l.has(o))
356
+ if (e.isObject() && s && d.has(s))
338
357
  return [
339
358
  {
340
359
  role: "buffer",
@@ -342,72 +361,72 @@ const S = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), O =
342
361
  optional: !1
343
362
  }
344
363
  ];
345
- if (e.isObject() && o === "RegExp")
364
+ if (e.isObject() && s === "RegExp")
346
365
  return "string";
347
- if (e.isObject() && o === "Map") {
348
- const d = e.getTypeArguments()[1];
366
+ if (e.isObject() && s === "Map") {
367
+ const a = e.getTypeArguments()[1];
349
368
  return [
350
369
  {
351
370
  role: "record",
352
- shape: d ? c(d, i, s) : "unknown",
371
+ shape: a ? p(a, n, l) : "unknown",
353
372
  optional: !1
354
373
  }
355
374
  ];
356
375
  }
357
- if (e.isObject() && o === "Set") {
358
- const d = e.getTypeArguments()[0];
376
+ if (e.isObject() && s === "Set") {
377
+ const a = e.getTypeArguments()[0];
359
378
  return [
360
379
  {
361
380
  role: "array",
362
- shape: d ? c(d, i, s) : "unknown",
381
+ shape: a ? p(a, n, l) : "unknown",
363
382
  optional: !1
364
383
  }
365
384
  ];
366
385
  }
367
386
  if (e.isObject() && e.getProperties().length === 0) {
368
- const a = e.getAliasTypeArguments()[1] ?? e.getStringIndexType();
369
- if (a)
387
+ const o = e.getAliasTypeArguments()[1] ?? e.getStringIndexType();
388
+ if (o)
370
389
  return [
371
390
  {
372
391
  role: "record",
373
- shape: c(a, i, s),
392
+ shape: p(o, n, l),
374
393
  optional: !1
375
394
  }
376
395
  ];
377
396
  }
378
397
  if (e.isObject())
379
- return o === "Date" || e.getText() === "Date" ? "Date" : e.getProperties().map((a) => {
380
- const d = a.getValueDeclaration() || a.getDeclarations()[0], r = c(a.getTypeAtLocation(i), i, s);
381
- if (!d)
398
+ return s === "Date" || e.getText() === "Date" ? "Date" : e.getProperties().map((o) => {
399
+ const a = o.getValueDeclaration() || o.getDeclarations()[0], r = p(o.getTypeAtLocation(n), n, l);
400
+ if (!a)
382
401
  return {
383
402
  role: "property",
384
- identifier: a.getName(),
403
+ identifier: o.getName(),
385
404
  shape: r,
386
405
  optional: !1
387
406
  };
388
- if (!(d.asKind(t.PropertySignature) || d.asKind(t.PropertyAssignment) || d.asKind(t.ShorthandPropertyAssignment)))
407
+ if (!(a.asKind(t.PropertySignature) || a.asKind(t.PropertyAssignment) || a.asKind(t.ShorthandPropertyAssignment)))
389
408
  return {
390
409
  role: "property",
391
- identifier: a.getName(),
410
+ identifier: o.getName(),
392
411
  shape: r,
393
412
  optional: !1
394
413
  };
395
- const u = a.getTypeAtLocation(i).isNullable();
414
+ const u = o.getTypeAtLocation(n).isNullable();
396
415
  return {
397
416
  role: "property",
398
- identifier: a.getName(),
417
+ identifier: o.getName(),
399
418
  shape: r,
400
419
  optional: u
401
420
  };
402
- }).filter((a) => a.shape !== "undefined");
421
+ }).filter((o) => o.shape !== "undefined");
403
422
  if (e.isUnion()) {
404
- const d = e.getUnionTypes().map((u) => ({
423
+ const a = e.getUnionTypes().map((u) => ({
405
424
  role: "union_entry",
406
- shape: c(u, i, s),
425
+ shape: p(u, n, l),
407
426
  optional: !1
408
427
  })).filter(
409
428
  (u, h, x) => !x.find((C, K) => C.shape === u.shape && K > h)
410
- ), r = d.some((u) => u.shape === "undefined"), g = d.filter((u) => u.shape !== "undefined");
429
+ ), r = a.some((u) => u.shape === "undefined"), g = a.filter((u) => u.shape !== "undefined");
411
430
  return g.length === 1 ? g[0].shape : [
412
431
  {
413
432
  role: "union",
@@ -417,47 +436,47 @@ const S = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), O =
417
436
  ];
418
437
  }
419
438
  if (e.isIntersection())
420
- return e.getIntersectionTypes().map((r) => c(r, i, s)).filter((r) => typeof r != "string").reduce((r, g) => [...r, ...g], []);
421
- const p = i.getSourceFile().getFilePath().split("/").pop();
422
- return m.warn(`[${p}] Unknown type shape node ${e.getText()}`), "unknown_5";
423
- }, F = (e) => {
439
+ return e.getIntersectionTypes().map((r) => p(r, n, l)).filter((r) => typeof r != "string").reduce((r, g) => [...r, ...g], []);
440
+ const c = n.getSourceFile().getFilePath().split("/").pop();
441
+ return m.warn(`[${c}] Unknown type shape node ${e.getText()}`), "unknown_5";
442
+ }, b = (e) => {
424
443
  if (e.isKind(t.Identifier))
425
- return F(f(e));
444
+ return b(f(e));
426
445
  if (e.isKind(t.StringLiteral))
427
446
  return e.getLiteralValue();
428
447
  if (e.isKind(t.ArrayLiteralExpression))
429
- return e.forEachChildAsArray().map((n) => F(n));
448
+ return e.forEachChildAsArray().map((i) => b(i));
430
449
  if (e.isKind(t.PropertyAccessExpression))
431
- return F(T(e));
450
+ return b(T(e));
432
451
  if (e.isKind(t.ObjectLiteralExpression))
433
- return U(e);
434
- const i = e.getSourceFile().getFilePath().split("/").pop();
435
- return m.dev(`[${i}] Unknown literal value node ${e.getKindName()}`), "unknown_6";
436
- }, H = (e) => {
437
- const i = e.getFirstDescendantByKind(t.CallExpression);
438
- if (!i) return null;
439
- const n = i.getArguments()[0];
452
+ return M(e);
453
+ const n = e.getSourceFile().getFilePath().split("/").pop();
454
+ return m.dev(`[${n}] Unknown literal value node ${e.getKindName()}`), "unknown_6";
455
+ }, ee = (e) => {
456
+ const n = e.getFirstDescendantByKind(t.CallExpression);
440
457
  if (!n) return null;
441
- const s = n.getType();
442
- return s.isStringLiteral() ? s.getLiteralValue() : null;
443
- }, U = (e) => e.getFirstDescendantByKind(t.SyntaxList).getChildrenOfKind(t.PropertyAssignment).map((o) => {
444
- const p = o.getFirstDescendantByKind(t.Identifier).getText(), a = o.getLastChild(), d = f(a), r = F(d);
458
+ const i = n.getArguments()[0];
459
+ if (!i) return null;
460
+ const l = i.getType();
461
+ return l.isStringLiteral() ? l.getLiteralValue() : null;
462
+ }, M = (e) => e.getFirstDescendantByKind(t.SyntaxList).getChildrenOfKind(t.PropertyAssignment).map((s) => {
463
+ const c = s.getFirstDescendantByKind(t.Identifier).getText(), o = s.getLastChild(), a = f(o), r = b(a);
445
464
  return {
446
- identifier: p,
465
+ identifier: c,
447
466
  value: r
448
467
  };
449
468
  }) || [];
450
469
  export {
451
470
  f as findNodeImplementation,
452
471
  T as findPropertyAssignmentValueNode,
453
- c as getProperTypeShape,
472
+ p as getProperTypeShape,
454
473
  y as getRecursiveNodeShape,
455
- z as getShapeOfValidatorLiteral,
474
+ Y as getShapeOfValidatorLiteral,
456
475
  w as getTypeReferenceShape,
457
- R as getValidatorPropertyOptionality,
476
+ _ as getValidatorPropertyOptionality,
458
477
  A as getValidatorPropertyShape,
459
478
  N as getValidatorPropertyStringValue,
460
- U as getValuesOfObjectLiteral,
461
- H as resolveEndpointPath
479
+ M as getValuesOfObjectLiteral,
480
+ ee as resolveEndpointPath
462
481
  };
463
482
  //# sourceMappingURL=nodeParsers.mjs.map