Files
fangke/sdk/src/types.ts
T
2026-09-18 23:47:44 +08:00

24 lines
877 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** 事件归属四元组:入队时冻结,flush 不再重读(spec §1.1) */
export interface Attribution {
site_id: string;
visitor_id: string;
session_id: string;
page_id: string;
seq: number;
purpose?: null; // V1.1 预留
epoch?: null; // V1.1 预留
grant_ref?: null; // V1.1 预留
}
export const SDK_VERSION = "0.2.1"; // 与 package.json 同步手维护
export const SCHEMA_VERSION = 2;
export const CONFIG_VERSION = "1";
// build_id 由 esbuild/vitest define 注入的全局常量(ambient 声明,
// 不能用模块级 export declare——esbuild 打包时会被擦除导致引用悬空)
declare global {
// eslint-disable-next-line no-var
var __BUILD_ID__: string | undefined;
}
/** 运行时兜底读取(build 注入缺失时降级 "unknown",绝不抛) */
export const BUILD_ID: string = globalThis.__BUILD_ID__ ?? "unknown";