@autobe/benchmark 0.27.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.
- package/LICENSE +661 -0
- package/lib/example/AutoBeExampleStorage.d.ts +39 -0
- package/lib/example/AutoBeExampleStorage.js +169 -0
- package/lib/example/AutoBeExampleStorage.js.map +1 -0
- package/lib/example/index.d.ts +1 -0
- package/lib/example/index.js +18 -0
- package/lib/example/index.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +19 -0
- package/lib/index.js.map +1 -0
- package/lib/replay/AutoBeReplayComputer.d.ts +7 -0
- package/lib/replay/AutoBeReplayComputer.js +109 -0
- package/lib/replay/AutoBeReplayComputer.js.map +1 -0
- package/lib/replay/AutoBeReplayDocumentation.d.ts +4 -0
- package/lib/replay/AutoBeReplayDocumentation.js +146 -0
- package/lib/replay/AutoBeReplayDocumentation.js.map +1 -0
- package/lib/replay/AutoBeReplayStorage.d.ts +8 -0
- package/lib/replay/AutoBeReplayStorage.js +72 -0
- package/lib/replay/AutoBeReplayStorage.js.map +1 -0
- package/lib/replay/index.d.ts +3 -0
- package/lib/replay/index.js +20 -0
- package/lib/replay/index.js.map +1 -0
- package/package.json +47 -0
- package/src/example/AutoBeExampleStorage.ts +213 -0
- package/src/example/index.ts +1 -0
- package/src/index.ts +2 -0
- package/src/replay/AutoBeReplayComputer.ts +189 -0
- package/src/replay/AutoBeReplayDocumentation.ts +173 -0
- package/src/replay/AutoBeReplayStorage.ts +80 -0
- package/src/replay/index.ts +3 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AutoBeEventSnapshot,
|
|
3
|
+
AutoBeExampleProject,
|
|
4
|
+
AutoBeHistory,
|
|
5
|
+
AutoBePhase,
|
|
6
|
+
IAutoBePlaygroundReplay,
|
|
7
|
+
} from "@autobe/interface";
|
|
8
|
+
import typia from "typia";
|
|
9
|
+
|
|
10
|
+
import { AutoBeExampleStorage } from "../example/AutoBeExampleStorage";
|
|
11
|
+
|
|
12
|
+
export namespace AutoBeReplayStorage {
|
|
13
|
+
export const getAll = async (
|
|
14
|
+
vendor: string,
|
|
15
|
+
projectFilter?: (project: AutoBeExampleProject) => boolean,
|
|
16
|
+
): Promise<IAutoBePlaygroundReplay[]> => {
|
|
17
|
+
const projects: AutoBeExampleProject[] = typia.misc
|
|
18
|
+
.literals<AutoBeExampleProject>()
|
|
19
|
+
.filter(projectFilter ?? (() => true));
|
|
20
|
+
const replays: Array<IAutoBePlaygroundReplay | null> = await Promise.all(
|
|
21
|
+
projects.map((p) =>
|
|
22
|
+
AutoBeReplayStorage.get({
|
|
23
|
+
vendor,
|
|
24
|
+
project: p,
|
|
25
|
+
}),
|
|
26
|
+
),
|
|
27
|
+
);
|
|
28
|
+
return replays.filter((r) => r !== null);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const get = async (props: {
|
|
32
|
+
vendor: string;
|
|
33
|
+
project: AutoBeExampleProject;
|
|
34
|
+
}): Promise<IAutoBePlaygroundReplay | null> => {
|
|
35
|
+
const histories: AutoBeHistory[] | null = await getHistories(props);
|
|
36
|
+
if (histories === null) return null;
|
|
37
|
+
|
|
38
|
+
const snapshots = async (
|
|
39
|
+
phase: AutoBePhase,
|
|
40
|
+
): Promise<AutoBeEventSnapshot[] | null> => {
|
|
41
|
+
try {
|
|
42
|
+
return await AutoBeExampleStorage.getSnapshots({
|
|
43
|
+
vendor: props.vendor,
|
|
44
|
+
project: props.project,
|
|
45
|
+
phase,
|
|
46
|
+
});
|
|
47
|
+
} catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
return {
|
|
52
|
+
vendor: props.vendor,
|
|
53
|
+
project: props.project,
|
|
54
|
+
histories,
|
|
55
|
+
analyze: await snapshots("analyze"),
|
|
56
|
+
prisma: await snapshots("prisma"),
|
|
57
|
+
interface: await snapshots("interface"),
|
|
58
|
+
test: await snapshots("test"),
|
|
59
|
+
realize: await snapshots("realize"),
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const getHistories = async (props: {
|
|
64
|
+
vendor: string;
|
|
65
|
+
project: AutoBeExampleProject;
|
|
66
|
+
}): Promise<AutoBeHistory[] | null> => {
|
|
67
|
+
for (const phase of SEQUENCE) {
|
|
68
|
+
try {
|
|
69
|
+
return await AutoBeExampleStorage.getHistories({
|
|
70
|
+
vendor: props.vendor,
|
|
71
|
+
project: props.project,
|
|
72
|
+
phase,
|
|
73
|
+
});
|
|
74
|
+
} catch {}
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const SEQUENCE = ["realize", "test", "interface", "prisma", "analyze"] as const;
|