Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
715 changes: 387 additions & 328 deletions packages/appkit/src/type-generator/index.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ ${entries};
`;
}

// Build the full metric.d.ts file from a list of metric schemas.
// Build the full metric-views.d.ts file from a list of metric schemas.
export function generateMetricTypeDeclarations(
schemas: MetricSchema[],
): string {
Expand Down
10 changes: 5 additions & 5 deletions packages/appkit/src/type-generator/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ describe("generateFromEntryPoint — metric-view emission", () => {
const queryFolder = path.join(metricsDir, "queries");
const outFile = path.join(metricsDir, "generated", "analytics.d.ts");
// Defaults: metric artifacts are siblings of `outFile`.
const metricFile = path.join(metricsDir, "generated", "metric.d.ts");
const metricFile = path.join(metricsDir, "generated", "metric-views.d.ts");
const metadataFile = path.join(
metricsDir,
"generated",
"metrics.metadata.json",
"metric-views.metadata.json",
);

const describeResponse: DatabricksStatementExecutionResponse = {
Expand Down Expand Up @@ -330,7 +330,7 @@ describe("generateFromEntryPoint — metric-view emission", () => {
fs.rmSync(metricsDir, { recursive: true, force: true });
});

test("writes metric.d.ts and metrics.metadata.json when metric-views.json exists", async () => {
test("writes metric-views.d.ts and metric-views.metadata.json when metric-views.json exists", async () => {
writeMetricConfig();

await expect(
Expand Down Expand Up @@ -998,11 +998,11 @@ describe("generateFromEntryPoint — metric cache section", () => {
const cacheTestDir = path.join(__dirname, "__output_metric_cache__");
const queryFolder = path.join(cacheTestDir, "queries");
const outFile = path.join(cacheTestDir, "generated", "analytics.d.ts");
const metricFile = path.join(cacheTestDir, "generated", "metric.d.ts");
const metricFile = path.join(cacheTestDir, "generated", "metric-views.d.ts");
const metadataFile = path.join(
cacheTestDir,
"generated",
"metrics.metadata.json",
"metric-views.metadata.json",
);

const describeResponseFor = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2135,7 +2135,7 @@ describe("buildMetricsMetadataBundle", () => {
expect(Object.hasOwn(bundle, "__proto__")).toBe(true);
expect(Object.hasOwn(bundle, "revenue")).toBe(true);

// The emitted metrics.metadata.json carries both as own enumerable
// The emitted metric-views.metadata.json carries both as own enumerable
// properties (JSON.parse creates own data properties for __proto__).
const parsed = JSON.parse(generateMetricsMetadataJson(schemas));
expect(Object.keys(parsed)).toEqual(["__proto__", "revenue"]);
Expand Down Expand Up @@ -2264,7 +2264,7 @@ describe("generateMetricsMetadataJson — snapshot", () => {
// collation would interleave mixed-case keys ("ARPU", "churn", "Revenue")
// and could vary by machine/locale, drifting the .d.ts from the bundle.
describe("artifact key-order determinism", () => {
test("mixed-case keys order identically (code-unit) in metric.d.ts and metrics.metadata.json", async () => {
test("mixed-case keys order identically (code-unit) in metric-views.d.ts and metric-views.metadata.json", async () => {
const resolution = resolveMetricConfig({
metricViews: {
Revenue: { source: "a.b.r" },
Expand Down
Loading
Loading