trickle-backend 0.1.67 → 0.1.68
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.
- package/dist/routes/codegen.js +11 -1
- package/package.json +1 -1
- package/src/routes/codegen.ts +12 -1
package/dist/routes/codegen.js
CHANGED
|
@@ -52,7 +52,17 @@ function collectFunctionTypes(opts) {
|
|
|
52
52
|
sampleOutput: snapshot.sample_output ? tryParseJson(snapshot.sample_output) : undefined,
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
// Deduplicate by function name — when the same endpoint is observed
|
|
56
|
+
// across different modules/languages/sessions, keep only the most
|
|
57
|
+
// recently observed entry to avoid duplicate declarations in codegen.
|
|
58
|
+
const deduped = new Map();
|
|
59
|
+
for (const entry of results) {
|
|
60
|
+
const existing = deduped.get(entry.name);
|
|
61
|
+
if (!existing || (entry.observedAt && (!existing.observedAt || entry.observedAt > existing.observedAt))) {
|
|
62
|
+
deduped.set(entry.name, entry);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return Array.from(deduped.values());
|
|
56
66
|
}
|
|
57
67
|
// GET / — generate types for all (or filtered) functions
|
|
58
68
|
router.get("/", (req, res) => {
|
package/package.json
CHANGED
package/src/routes/codegen.ts
CHANGED
|
@@ -72,7 +72,18 @@ function collectFunctionTypes(opts: {
|
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
// Deduplicate by function name — when the same endpoint is observed
|
|
76
|
+
// across different modules/languages/sessions, keep only the most
|
|
77
|
+
// recently observed entry to avoid duplicate declarations in codegen.
|
|
78
|
+
const deduped = new Map<string, FunctionTypeData>();
|
|
79
|
+
for (const entry of results) {
|
|
80
|
+
const existing = deduped.get(entry.name);
|
|
81
|
+
if (!existing || (entry.observedAt && (!existing.observedAt || entry.observedAt > existing.observedAt))) {
|
|
82
|
+
deduped.set(entry.name, entry);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return Array.from(deduped.values());
|
|
76
87
|
}
|
|
77
88
|
|
|
78
89
|
// GET / — generate types for all (or filtered) functions
|