@forgeax/engine-profiler 0.1.4 → 0.1.7
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/README.md +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/browser-user-timing.d.ts.map +1 -1
- package/dist/browser-user-timing.mjs +1 -6
- package/dist/browser-user-timing.mjs.map +1 -1
- package/dist/cli.d.ts +2 -14
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.mjs +1 -14
- package/dist/cli.mjs.map +1 -1
- package/dist/compare.d.ts.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +14 -51
- package/dist/index.mjs.map +1 -1
- package/dist/recorder.d.ts.map +1 -1
- package/package.json +1 -1
- package/scripts/generate-profile-types.mjs +3 -12
- package/src/__tests__/cli-input-errors.test.ts +0 -39
- package/src/__tests__/cli-process.integration.test.ts +1 -28
- package/src/browser-user-timing.ts +3 -11
- package/src/cli.ts +6 -21
- package/src/clock.ts +1 -1
- package/src/compare.ts +1 -4
- package/src/index.ts +0 -6
- package/src/recorder.ts +15 -16
- package/dist/__tests__/browser-profile-detail-owner.test-d.d.ts +0 -2
- package/dist/__tests__/browser-profile-detail-owner.test-d.d.ts.map +0 -1
- package/dist/__tests__/browser-user-timing.test.d.ts +0 -2
- package/dist/__tests__/browser-user-timing.test.d.ts.map +0 -1
- package/dist/__tests__/comparison-side-owner.test-d.d.ts +0 -2
- package/dist/__tests__/comparison-side-owner.test-d.d.ts.map +0 -1
- package/dist/__tests__/schema-derived-union-owner.test.d.ts +0 -2
- package/dist/__tests__/schema-derived-union-owner.test.d.ts.map +0 -1
- package/dist/tool-preview-profile.d.ts +0 -33
- package/dist/tool-preview-profile.d.ts.map +0 -1
- package/src/__tests__/browser-profile-detail-owner.test-d.ts +0 -26
- package/src/__tests__/browser-user-timing.test.ts +0 -127
- package/src/__tests__/comparison-side-owner.test-d.ts +0 -28
- package/src/__tests__/schema-derived-union-owner.test.ts +0 -57
- package/src/tool-preview-profile.ts +0 -67
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { type ProfileCapture, validateProfileCapture } from './index.js';
|
|
2
|
-
|
|
3
|
-
export interface ToolPreviewProfileRef {
|
|
4
|
-
readonly kind: 'profile-capture';
|
|
5
|
-
readonly digest: string;
|
|
6
|
-
readonly uri: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface ToolPreviewProfileManifest {
|
|
10
|
-
readonly runId: string;
|
|
11
|
-
readonly captureId: string;
|
|
12
|
-
readonly profileDigest: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type ToolPreviewProfileResult =
|
|
16
|
-
| {
|
|
17
|
-
readonly ok: true;
|
|
18
|
-
readonly value: {
|
|
19
|
-
readonly runId: string;
|
|
20
|
-
readonly captureId: string;
|
|
21
|
-
readonly profile: ProfileCapture;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
| {
|
|
25
|
-
readonly ok: false;
|
|
26
|
-
readonly error: {
|
|
27
|
-
readonly code: string;
|
|
28
|
-
readonly expected: string;
|
|
29
|
-
readonly hint: string;
|
|
30
|
-
readonly detail: unknown;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export function consumeToolPreviewProfile(input: {
|
|
35
|
-
readonly manifest: ToolPreviewProfileManifest;
|
|
36
|
-
readonly profile: unknown;
|
|
37
|
-
readonly ref: ToolPreviewProfileRef;
|
|
38
|
-
}): ToolPreviewProfileResult {
|
|
39
|
-
if (input.ref.digest !== input.manifest.profileDigest) {
|
|
40
|
-
return fail('profile digest matches manifest identity');
|
|
41
|
-
}
|
|
42
|
-
const profileResult = validateProfileCapture(input.profile);
|
|
43
|
-
if (!profileResult.ok) return fail(profileResult.error.expected);
|
|
44
|
-
if (profileResult.value.captureId !== input.manifest.captureId) {
|
|
45
|
-
return fail('ProfileCapture.captureId matches manifest captureId');
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
48
|
-
ok: true,
|
|
49
|
-
value: {
|
|
50
|
-
runId: input.manifest.runId,
|
|
51
|
-
captureId: input.manifest.captureId,
|
|
52
|
-
profile: profileResult.value,
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function fail(expected: string): Extract<ToolPreviewProfileResult, { readonly ok: false }> {
|
|
58
|
-
return {
|
|
59
|
-
ok: false,
|
|
60
|
-
error: {
|
|
61
|
-
code: 'tool-preview-profile-mismatch',
|
|
62
|
-
expected,
|
|
63
|
-
hint: 'read the ProfileCapture through its owner schema and regenerate the manifest join',
|
|
64
|
-
detail: { expected },
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
}
|