UNPKG

3.44 kBTypeScriptView Raw
1import type { Primitive } from './misc';
2import type { SpanOrigin } from './span';
3export type Context = Record<string, unknown>;
4export interface Contexts extends Record<string, Context | undefined> {
5 app?: AppContext;
6 device?: DeviceContext;
7 os?: OsContext;
8 culture?: CultureContext;
9 response?: ResponseContext;
10 trace?: TraceContext;
11 cloud_resource?: CloudResourceContext;
12 state?: StateContext;
13 profile?: ProfileContext;
14}
15export interface StateContext extends Record<string, unknown> {
16 state: {
17 type: string;
18 value: Record<string, unknown>;
19 };
20}
21export interface AppContext extends Record<string, unknown> {
22 app_name?: string;
23 app_start_time?: string;
24 app_version?: string;
25 app_identifier?: string;
26 build_type?: string;
27 app_memory?: number;
28 free_memory?: number;
29}
30export interface DeviceContext extends Record<string, unknown> {
31 name?: string;
32 family?: string;
33 model?: string;
34 model_id?: string;
35 arch?: string;
36 battery_level?: number;
37 orientation?: 'portrait' | 'landscape';
38 manufacturer?: string;
39 brand?: string;
40 screen_resolution?: string;
41 screen_height_pixels?: number;
42 screen_width_pixels?: number;
43 screen_density?: number;
44 screen_dpi?: number;
45 online?: boolean;
46 charging?: boolean;
47 low_memory?: boolean;
48 simulator?: boolean;
49 memory_size?: number;
50 free_memory?: number;
51 usable_memory?: number;
52 storage_size?: number;
53 free_storage?: number;
54 external_storage_size?: number;
55 external_free_storage?: number;
56 boot_time?: string;
57 processor_count?: number;
58 cpu_description?: string;
59 processor_frequency?: number;
60 device_type?: string;
61 battery_status?: string;
62 device_unique_identifier?: string;
63 supports_vibration?: boolean;
64 supports_accelerometer?: boolean;
65 supports_gyroscope?: boolean;
66 supports_audio?: boolean;
67 supports_location_service?: boolean;
68}
69export interface OsContext extends Record<string, unknown> {
70 name?: string;
71 version?: string;
72 build?: string;
73 kernel_version?: string;
74}
75export interface CultureContext extends Record<string, unknown> {
76 calendar?: string;
77 display_name?: string;
78 locale?: string;
79 is_24_hour_format?: boolean;
80 timezone?: string;
81}
82export interface ResponseContext extends Record<string, unknown> {
83 type?: string;
84 cookies?: string[][] | Record<string, string>;
85 headers?: Record<string, string>;
86 status_code?: number;
87 body_size?: number;
88}
89export interface TraceContext extends Record<string, unknown> {
90 data?: {
91 [key: string]: any;
92 };
93 op?: string;
94 parent_span_id?: string;
95 span_id: string;
96 status?: string;
97 tags?: {
98 [key: string]: Primitive;
99 };
100 trace_id: string;
101 origin?: SpanOrigin;
102}
103export interface CloudResourceContext extends Record<string, unknown> {
104 ['cloud.provider']?: string;
105 ['cloud.account.id']?: string;
106 ['cloud.region']?: string;
107 ['cloud.availability_zone']?: string;
108 ['cloud.platform']?: string;
109 ['host.id']?: string;
110 ['host.type']?: string;
111}
112export interface ProfileContext extends Record<string, unknown> {
113 profile_id: string;
114}
115export interface MissingInstrumentationContext extends Record<string, unknown> {
116 package: string;
117 ['javascript.is_cjs']?: boolean;
118}
119//# sourceMappingURL=context.d.ts.map
\No newline at end of file