moonflower 1.4.9 → 1.5.0

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