react-semaphor 0.1.574 → 0.1.576
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/dist/chunks/{assistant-chat-D95DtCj7.js → assistant-chat-B_tmsxEK.js} +2 -2
- package/dist/chunks/attribution-BvoKvhcj.js +32 -0
- package/dist/chunks/{card-filter-builder-B3bEPylu.js → card-filter-builder-CwnMUZU2.js} +1 -1
- package/dist/chunks/{dashboard-DdALjmc3.js → dashboard-BcIIBCTP.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-D2vevpyl.js → dashboard-briefing-launcher-BBpECqg2.js} +2 -2
- package/dist/chunks/{dashboard-controls-DxrsGK9A.js → dashboard-controls-CONzvjmO.js} +4 -4
- package/dist/chunks/{dashboard-json-rwds0HjB.js → dashboard-json-BF2chEVd.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-BCDz5HOb.js → edit-dashboard-visual-Bf-RcbuD.js} +596 -595
- package/dist/chunks/{report-preferences-dialog-D9nBczmk.js → report-preferences-dialog-RN4g9PEN.js} +5 -5
- package/dist/chunks/{semaphor-ready-indicator-BdOAS4Uw.js → semaphor-ready-indicator-DtivanBy.js} +18207 -18146
- package/dist/chunks/{shelf-drop-preview-context-B1goDUYE.js → shelf-drop-preview-context-BTjYxbHC.js} +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.js +184 -183
- package/dist/surfboard/index.js +1 -1
- package/dist/types/shared/usage-events/attribution.d.ts +3 -3
- package/dist/types/shared/usage-events/catalog.d.ts +40 -13
- package/dist/types/shared/usage-events/details.d.ts +312 -0
- package/dist/types/shared/usage-events/envelope.d.ts +146 -0
- package/dist/types/shared/usage-events/index.d.ts +3 -0
- package/dist/types/shared/usage-events/validate.d.ts +12 -0
- package/dist/types/shared/usage-events/vocabulary.d.ts +14 -0
- package/dist/usage-events/index.js +244 -30
- package/package.json +1 -1
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const tokenIssuedDetailsSchema: z.ZodObject<{
|
|
3
|
+
token_type: z.ZodEnum<["dashboard", "project"]>;
|
|
4
|
+
token_purpose: z.ZodOptional<z.ZodEnum<["embed", "console"]>>;
|
|
5
|
+
ttl_s: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
embed_origin: z.ZodOptional<z.ZodString>;
|
|
7
|
+
initial_dashboard_id: z.ZodOptional<z.ZodString>;
|
|
8
|
+
dashboard_title: z.ZodOptional<z.ZodString>;
|
|
9
|
+
project_name: z.ZodOptional<z.ZodString>;
|
|
10
|
+
user_verified: z.ZodBoolean;
|
|
11
|
+
user_email: z.ZodOptional<z.ZodString>;
|
|
12
|
+
user_display_name: z.ZodOptional<z.ZodString>;
|
|
13
|
+
tenant_name: z.ZodOptional<z.ZodString>;
|
|
14
|
+
role: z.ZodOptional<z.ZodString>;
|
|
15
|
+
user_provisioned: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
+
domain_access_mode: z.ZodOptional<z.ZodEnum<["all", "none", "include", "exclude"]>>;
|
|
17
|
+
domain_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
18
|
+
rls_policy_names: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
19
|
+
cls_policy_names: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
20
|
+
has_sls: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
security_param_keys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
22
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
23
|
+
mcp_scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
24
|
+
mcp_sql: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
mcp_live: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
}, "strict", z.ZodTypeAny, {
|
|
27
|
+
token_type: "dashboard" | "project";
|
|
28
|
+
user_verified: boolean;
|
|
29
|
+
timezone?: string | undefined;
|
|
30
|
+
role?: string | undefined;
|
|
31
|
+
token_purpose?: "embed" | "console" | undefined;
|
|
32
|
+
ttl_s?: number | undefined;
|
|
33
|
+
embed_origin?: string | undefined;
|
|
34
|
+
initial_dashboard_id?: string | undefined;
|
|
35
|
+
dashboard_title?: string | undefined;
|
|
36
|
+
project_name?: string | undefined;
|
|
37
|
+
user_email?: string | undefined;
|
|
38
|
+
user_display_name?: string | undefined;
|
|
39
|
+
tenant_name?: string | undefined;
|
|
40
|
+
user_provisioned?: boolean | undefined;
|
|
41
|
+
domain_access_mode?: "none" | "all" | "include" | "exclude" | undefined;
|
|
42
|
+
domain_ids?: string[] | undefined;
|
|
43
|
+
rls_policy_names?: string[] | undefined;
|
|
44
|
+
cls_policy_names?: string[] | undefined;
|
|
45
|
+
has_sls?: boolean | undefined;
|
|
46
|
+
security_param_keys?: string[] | undefined;
|
|
47
|
+
mcp_scopes?: string[] | undefined;
|
|
48
|
+
mcp_sql?: boolean | undefined;
|
|
49
|
+
mcp_live?: boolean | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
token_type: "dashboard" | "project";
|
|
52
|
+
user_verified: boolean;
|
|
53
|
+
timezone?: string | undefined;
|
|
54
|
+
role?: string | undefined;
|
|
55
|
+
token_purpose?: "embed" | "console" | undefined;
|
|
56
|
+
ttl_s?: number | undefined;
|
|
57
|
+
embed_origin?: string | undefined;
|
|
58
|
+
initial_dashboard_id?: string | undefined;
|
|
59
|
+
dashboard_title?: string | undefined;
|
|
60
|
+
project_name?: string | undefined;
|
|
61
|
+
user_email?: string | undefined;
|
|
62
|
+
user_display_name?: string | undefined;
|
|
63
|
+
tenant_name?: string | undefined;
|
|
64
|
+
user_provisioned?: boolean | undefined;
|
|
65
|
+
domain_access_mode?: "none" | "all" | "include" | "exclude" | undefined;
|
|
66
|
+
domain_ids?: string[] | undefined;
|
|
67
|
+
rls_policy_names?: string[] | undefined;
|
|
68
|
+
cls_policy_names?: string[] | undefined;
|
|
69
|
+
has_sls?: boolean | undefined;
|
|
70
|
+
security_param_keys?: string[] | undefined;
|
|
71
|
+
mcp_scopes?: string[] | undefined;
|
|
72
|
+
mcp_sql?: boolean | undefined;
|
|
73
|
+
mcp_live?: boolean | undefined;
|
|
74
|
+
}>;
|
|
75
|
+
export type TokenIssuedDetails = z.infer<typeof tokenIssuedDetailsSchema>;
|
|
76
|
+
export declare const dashboardOpenedDetailsSchema: z.ZodObject<{
|
|
77
|
+
requested_version: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
served: z.ZodOptional<z.ZodEnum<["current", "version"]>>;
|
|
79
|
+
dashboard_title: z.ZodOptional<z.ZodString>;
|
|
80
|
+
project_name: z.ZodOptional<z.ZodString>;
|
|
81
|
+
sheet_count: z.ZodOptional<z.ZodNumber>;
|
|
82
|
+
card_count: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
}, "strict", z.ZodTypeAny, {
|
|
84
|
+
dashboard_title?: string | undefined;
|
|
85
|
+
project_name?: string | undefined;
|
|
86
|
+
requested_version?: number | undefined;
|
|
87
|
+
served?: "version" | "current" | undefined;
|
|
88
|
+
sheet_count?: number | undefined;
|
|
89
|
+
card_count?: number | undefined;
|
|
90
|
+
}, {
|
|
91
|
+
dashboard_title?: string | undefined;
|
|
92
|
+
project_name?: string | undefined;
|
|
93
|
+
requested_version?: number | undefined;
|
|
94
|
+
served?: "version" | "current" | undefined;
|
|
95
|
+
sheet_count?: number | undefined;
|
|
96
|
+
card_count?: number | undefined;
|
|
97
|
+
}>;
|
|
98
|
+
export type DashboardOpenedDetails = z.infer<typeof dashboardOpenedDetailsSchema>;
|
|
99
|
+
/** One data-service call inside a query run. */
|
|
100
|
+
export declare const queryStatementRecordSchema: z.ZodObject<{
|
|
101
|
+
statement: z.ZodEnum<["main", "row_count", "totals"]>;
|
|
102
|
+
duration_ms: z.ZodNumber;
|
|
103
|
+
outcome: z.ZodEnum<["succeeded", "failed", "cancelled"]>;
|
|
104
|
+
rows: z.ZodOptional<z.ZodNumber>;
|
|
105
|
+
}, "strict", z.ZodTypeAny, {
|
|
106
|
+
outcome: "cancelled" | "failed" | "succeeded";
|
|
107
|
+
statement: "totals" | "main" | "row_count";
|
|
108
|
+
duration_ms: number;
|
|
109
|
+
rows?: number | undefined;
|
|
110
|
+
}, {
|
|
111
|
+
outcome: "cancelled" | "failed" | "succeeded";
|
|
112
|
+
statement: "totals" | "main" | "row_count";
|
|
113
|
+
duration_ms: number;
|
|
114
|
+
rows?: number | undefined;
|
|
115
|
+
}>;
|
|
116
|
+
export declare const queryExecutedDetailsSchema: z.ZodObject<{
|
|
117
|
+
data_service_calls: z.ZodNumber;
|
|
118
|
+
query_run_id: z.ZodString;
|
|
119
|
+
parent_query_run_id: z.ZodOptional<z.ZodString>;
|
|
120
|
+
query_kind: z.ZodOptional<z.ZodEnum<["card", "matrix_window", "filter_options", "control_options", "sql", "export"]>>;
|
|
121
|
+
statements: z.ZodArray<z.ZodObject<{
|
|
122
|
+
statement: z.ZodEnum<["main", "row_count", "totals"]>;
|
|
123
|
+
duration_ms: z.ZodNumber;
|
|
124
|
+
outcome: z.ZodEnum<["succeeded", "failed", "cancelled"]>;
|
|
125
|
+
rows: z.ZodOptional<z.ZodNumber>;
|
|
126
|
+
}, "strict", z.ZodTypeAny, {
|
|
127
|
+
outcome: "cancelled" | "failed" | "succeeded";
|
|
128
|
+
statement: "totals" | "main" | "row_count";
|
|
129
|
+
duration_ms: number;
|
|
130
|
+
rows?: number | undefined;
|
|
131
|
+
}, {
|
|
132
|
+
outcome: "cancelled" | "failed" | "succeeded";
|
|
133
|
+
statement: "totals" | "main" | "row_count";
|
|
134
|
+
duration_ms: number;
|
|
135
|
+
rows?: number | undefined;
|
|
136
|
+
}>, "many">;
|
|
137
|
+
trigger: z.ZodOptional<z.ZodEnum<["initial_load", "input_change", "click_filter", "drill", "page", "sort", "refresh"]>>;
|
|
138
|
+
card_title: z.ZodOptional<z.ZodString>;
|
|
139
|
+
card_type: z.ZodOptional<z.ZodString>;
|
|
140
|
+
dashboard_title: z.ZodOptional<z.ZodString>;
|
|
141
|
+
sheet_title: z.ZodOptional<z.ZodString>;
|
|
142
|
+
project_name: z.ZodOptional<z.ZodString>;
|
|
143
|
+
connection_name: z.ZodOptional<z.ZodString>;
|
|
144
|
+
connection_type: z.ZodOptional<z.ZodString>;
|
|
145
|
+
dialect: z.ZodOptional<z.ZodString>;
|
|
146
|
+
dataset: z.ZodOptional<z.ZodString>;
|
|
147
|
+
rows: z.ZodOptional<z.ZodNumber>;
|
|
148
|
+
row_limit_exceeded: z.ZodOptional<z.ZodBoolean>;
|
|
149
|
+
sql_text: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
150
|
+
sql_truncated: z.ZodOptional<z.ZodBoolean>;
|
|
151
|
+
sql_hash: z.ZodOptional<z.ZodString>;
|
|
152
|
+
input_ids_applied: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
153
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
154
|
+
export_job_id: z.ZodOptional<z.ZodString>;
|
|
155
|
+
}, "strict", z.ZodTypeAny, {
|
|
156
|
+
data_service_calls: number;
|
|
157
|
+
query_run_id: string;
|
|
158
|
+
statements: {
|
|
159
|
+
outcome: "cancelled" | "failed" | "succeeded";
|
|
160
|
+
statement: "totals" | "main" | "row_count";
|
|
161
|
+
duration_ms: number;
|
|
162
|
+
rows?: number | undefined;
|
|
163
|
+
}[];
|
|
164
|
+
dialect?: string | undefined;
|
|
165
|
+
page?: number | undefined;
|
|
166
|
+
rows?: number | undefined;
|
|
167
|
+
dataset?: string | undefined;
|
|
168
|
+
trigger?: "sort" | "page" | "refresh" | "drill" | "initial_load" | "input_change" | "click_filter" | undefined;
|
|
169
|
+
dashboard_title?: string | undefined;
|
|
170
|
+
project_name?: string | undefined;
|
|
171
|
+
parent_query_run_id?: string | undefined;
|
|
172
|
+
query_kind?: "card" | "sql" | "export" | "matrix_window" | "filter_options" | "control_options" | undefined;
|
|
173
|
+
card_title?: string | undefined;
|
|
174
|
+
card_type?: string | undefined;
|
|
175
|
+
sheet_title?: string | undefined;
|
|
176
|
+
connection_name?: string | undefined;
|
|
177
|
+
connection_type?: string | undefined;
|
|
178
|
+
row_limit_exceeded?: boolean | undefined;
|
|
179
|
+
sql_text?: string | undefined;
|
|
180
|
+
sql_truncated?: boolean | undefined;
|
|
181
|
+
sql_hash?: string | undefined;
|
|
182
|
+
input_ids_applied?: string[] | undefined;
|
|
183
|
+
export_job_id?: string | undefined;
|
|
184
|
+
}, {
|
|
185
|
+
data_service_calls: number;
|
|
186
|
+
query_run_id: string;
|
|
187
|
+
statements: {
|
|
188
|
+
outcome: "cancelled" | "failed" | "succeeded";
|
|
189
|
+
statement: "totals" | "main" | "row_count";
|
|
190
|
+
duration_ms: number;
|
|
191
|
+
rows?: number | undefined;
|
|
192
|
+
}[];
|
|
193
|
+
dialect?: string | undefined;
|
|
194
|
+
page?: number | undefined;
|
|
195
|
+
rows?: number | undefined;
|
|
196
|
+
dataset?: string | undefined;
|
|
197
|
+
trigger?: "sort" | "page" | "refresh" | "drill" | "initial_load" | "input_change" | "click_filter" | undefined;
|
|
198
|
+
dashboard_title?: string | undefined;
|
|
199
|
+
project_name?: string | undefined;
|
|
200
|
+
parent_query_run_id?: string | undefined;
|
|
201
|
+
query_kind?: "card" | "sql" | "export" | "matrix_window" | "filter_options" | "control_options" | undefined;
|
|
202
|
+
card_title?: string | undefined;
|
|
203
|
+
card_type?: string | undefined;
|
|
204
|
+
sheet_title?: string | undefined;
|
|
205
|
+
connection_name?: string | undefined;
|
|
206
|
+
connection_type?: string | undefined;
|
|
207
|
+
row_limit_exceeded?: boolean | undefined;
|
|
208
|
+
sql_text?: string | undefined;
|
|
209
|
+
sql_truncated?: boolean | undefined;
|
|
210
|
+
sql_hash?: string | undefined;
|
|
211
|
+
input_ids_applied?: string[] | undefined;
|
|
212
|
+
export_job_id?: string | undefined;
|
|
213
|
+
}>;
|
|
214
|
+
export type QueryExecutedDetails = z.infer<typeof queryExecutedDetailsSchema>;
|
|
215
|
+
export declare const toolCalledDetailsSchema: z.ZodObject<{
|
|
216
|
+
tool: z.ZodString;
|
|
217
|
+
args_json: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
218
|
+
args_truncated: z.ZodOptional<z.ZodBoolean>;
|
|
219
|
+
arg_keys: z.ZodArray<z.ZodString, "many">;
|
|
220
|
+
user_agent: z.ZodOptional<z.ZodString>;
|
|
221
|
+
oauth_client: z.ZodOptional<z.ZodString>;
|
|
222
|
+
credential: z.ZodOptional<z.ZodString>;
|
|
223
|
+
access_mode: z.ZodOptional<z.ZodString>;
|
|
224
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
225
|
+
response_bytes: z.ZodOptional<z.ZodNumber>;
|
|
226
|
+
}, "strict", z.ZodTypeAny, {
|
|
227
|
+
tool: string;
|
|
228
|
+
arg_keys: string[];
|
|
229
|
+
args_json?: string | undefined;
|
|
230
|
+
args_truncated?: boolean | undefined;
|
|
231
|
+
user_agent?: string | undefined;
|
|
232
|
+
oauth_client?: string | undefined;
|
|
233
|
+
credential?: string | undefined;
|
|
234
|
+
access_mode?: string | undefined;
|
|
235
|
+
scopes?: string[] | undefined;
|
|
236
|
+
response_bytes?: number | undefined;
|
|
237
|
+
}, {
|
|
238
|
+
tool: string;
|
|
239
|
+
arg_keys: string[];
|
|
240
|
+
args_json?: string | undefined;
|
|
241
|
+
args_truncated?: boolean | undefined;
|
|
242
|
+
user_agent?: string | undefined;
|
|
243
|
+
oauth_client?: string | undefined;
|
|
244
|
+
credential?: string | undefined;
|
|
245
|
+
access_mode?: string | undefined;
|
|
246
|
+
scopes?: string[] | undefined;
|
|
247
|
+
response_bytes?: number | undefined;
|
|
248
|
+
}>;
|
|
249
|
+
export type ToolCalledDetails = z.infer<typeof toolCalledDetailsSchema>;
|
|
250
|
+
/** How an export was made (Phase 6). */
|
|
251
|
+
export declare const EXPORT_MECHANISMS: readonly ["job", "matrix_direct", "rendered"];
|
|
252
|
+
export declare const EXPORT_FORMATS: readonly ["csv", "xlsx", "pdf", "png"];
|
|
253
|
+
export declare const EXPORT_SCOPES: readonly ["visual", "card", "dashboard"];
|
|
254
|
+
/** Where a failed export stopped: refused before a job, its deadline, any other job failure, the renderer. */
|
|
255
|
+
export declare const EXPORT_STAGES: readonly ["create", "acquire", "deadline", "render"];
|
|
256
|
+
export declare const exportCompletedDetailsSchema: z.ZodObject<{
|
|
257
|
+
export_id: z.ZodOptional<z.ZodString>;
|
|
258
|
+
mechanism: z.ZodEnum<["job", "matrix_direct", "rendered"]>;
|
|
259
|
+
format: z.ZodEnum<["csv", "xlsx", "pdf", "png"]>;
|
|
260
|
+
scope: z.ZodOptional<z.ZodEnum<["visual", "card", "dashboard"]>>;
|
|
261
|
+
rows: z.ZodOptional<z.ZodNumber>;
|
|
262
|
+
bytes: z.ZodOptional<z.ZodNumber>;
|
|
263
|
+
chunks: z.ZodOptional<z.ZodNumber>;
|
|
264
|
+
stage: z.ZodOptional<z.ZodEnum<["create", "acquire", "deadline", "render"]>>;
|
|
265
|
+
}, "strict", z.ZodTypeAny, {
|
|
266
|
+
format: "csv" | "xlsx" | "pdf" | "png";
|
|
267
|
+
mechanism: "rendered" | "job" | "matrix_direct";
|
|
268
|
+
scope?: "dashboard" | "card" | "visual" | undefined;
|
|
269
|
+
rows?: number | undefined;
|
|
270
|
+
chunks?: number | undefined;
|
|
271
|
+
bytes?: number | undefined;
|
|
272
|
+
stage?: "create" | "acquire" | "deadline" | "render" | undefined;
|
|
273
|
+
export_id?: string | undefined;
|
|
274
|
+
}, {
|
|
275
|
+
format: "csv" | "xlsx" | "pdf" | "png";
|
|
276
|
+
mechanism: "rendered" | "job" | "matrix_direct";
|
|
277
|
+
scope?: "dashboard" | "card" | "visual" | undefined;
|
|
278
|
+
rows?: number | undefined;
|
|
279
|
+
chunks?: number | undefined;
|
|
280
|
+
bytes?: number | undefined;
|
|
281
|
+
stage?: "create" | "acquire" | "deadline" | "render" | undefined;
|
|
282
|
+
export_id?: string | undefined;
|
|
283
|
+
}>;
|
|
284
|
+
export type ExportCompletedDetails = z.infer<typeof exportCompletedDetailsSchema>;
|
|
285
|
+
export declare const AUTOMATION_RUN_KINDS: readonly ["export", "briefing", "cache_refresh"];
|
|
286
|
+
export declare const AUTOMATION_TRIGGER_SOURCES: readonly ["scheduled", "manual", "api"];
|
|
287
|
+
export declare const automationRunCompletedDetailsSchema: z.ZodObject<{
|
|
288
|
+
run_id: z.ZodString;
|
|
289
|
+
rule_id: z.ZodString;
|
|
290
|
+
rule_name: z.ZodOptional<z.ZodString>;
|
|
291
|
+
kind: z.ZodEnum<["export", "briefing", "cache_refresh"]>;
|
|
292
|
+
trigger_source: z.ZodOptional<z.ZodEnum<["scheduled", "manual", "api"]>>;
|
|
293
|
+
attempt: z.ZodOptional<z.ZodNumber>;
|
|
294
|
+
scheduled_for: z.ZodOptional<z.ZodString>;
|
|
295
|
+
}, "strict", z.ZodTypeAny, {
|
|
296
|
+
kind: "export" | "briefing" | "cache_refresh";
|
|
297
|
+
run_id: string;
|
|
298
|
+
rule_id: string;
|
|
299
|
+
attempt?: number | undefined;
|
|
300
|
+
rule_name?: string | undefined;
|
|
301
|
+
trigger_source?: "api" | "manual" | "scheduled" | undefined;
|
|
302
|
+
scheduled_for?: string | undefined;
|
|
303
|
+
}, {
|
|
304
|
+
kind: "export" | "briefing" | "cache_refresh";
|
|
305
|
+
run_id: string;
|
|
306
|
+
rule_id: string;
|
|
307
|
+
attempt?: number | undefined;
|
|
308
|
+
rule_name?: string | undefined;
|
|
309
|
+
trigger_source?: "api" | "manual" | "scheduled" | undefined;
|
|
310
|
+
scheduled_for?: string | undefined;
|
|
311
|
+
}>;
|
|
312
|
+
export type AutomationRunCompletedDetails = z.infer<typeof automationRunCompletedDetailsSchema>;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UsageActorType, UsageEventCategory, UsageEventDetailsByType, UsageEventType, UsageOutcome, UsageProducer, UsageSurface } from './catalog.js';
|
|
3
|
+
/**
|
|
4
|
+
* Every event has exactly these keys, nullable where marked (usage-events
|
|
5
|
+
* TECH-SPEC §2.1). Customer-facing keys are snake_case.
|
|
6
|
+
*/
|
|
7
|
+
export type UsageEventEnvelope = {
|
|
8
|
+
/** UUIDv7, minted by emitUsageEvent; the dedupe key. */
|
|
9
|
+
event_id: string;
|
|
10
|
+
event_type: UsageEventType;
|
|
11
|
+
/** The catalog entry's version. */
|
|
12
|
+
event_version: number;
|
|
13
|
+
/** The catalog entry's category. */
|
|
14
|
+
category: UsageEventCategory;
|
|
15
|
+
/** ISO 8601 UTC, producer clock. */
|
|
16
|
+
occurred_at: string;
|
|
17
|
+
producer: UsageProducer;
|
|
18
|
+
/** The producer's package version. */
|
|
19
|
+
release: string;
|
|
20
|
+
/** Null only when no org is known (a refused token request). */
|
|
21
|
+
org_id: string | null;
|
|
22
|
+
project_id: string | null;
|
|
23
|
+
tenant_id: string | null;
|
|
24
|
+
actor_type: UsageActorType;
|
|
25
|
+
org_user_id: string | null;
|
|
26
|
+
/** The token's endUserId, as the token carries it. */
|
|
27
|
+
tenant_user_id: string | null;
|
|
28
|
+
surface: UsageSurface;
|
|
29
|
+
/** The token's `sid` claim. */
|
|
30
|
+
session_id: string | null;
|
|
31
|
+
operation_id: string | null;
|
|
32
|
+
dashboard_id: string | null;
|
|
33
|
+
sheet_id: string | null;
|
|
34
|
+
card_id: string | null;
|
|
35
|
+
connection_id: string | null;
|
|
36
|
+
domain_id: string | null;
|
|
37
|
+
outcome: UsageOutcome | null;
|
|
38
|
+
duration_ms: number | null;
|
|
39
|
+
/** Set exactly when outcome is 'failed' or 'timed_out'. */
|
|
40
|
+
error: {
|
|
41
|
+
code: string;
|
|
42
|
+
message: string;
|
|
43
|
+
} | null;
|
|
44
|
+
};
|
|
45
|
+
export type UsageEvent<T extends UsageEventType = UsageEventType> = {
|
|
46
|
+
[K in T]: UsageEventEnvelope & {
|
|
47
|
+
event_type: K;
|
|
48
|
+
details: UsageEventDetailsByType[K];
|
|
49
|
+
};
|
|
50
|
+
}[T];
|
|
51
|
+
/** The longest `error.message`, in UTF-8 bytes; producers cut to it. */
|
|
52
|
+
export declare const USAGE_EVENT_TEXT_MAX_BYTES: number;
|
|
53
|
+
export declare const usageEventEnvelopeSchema: z.ZodObject<{
|
|
54
|
+
event_id: z.ZodString;
|
|
55
|
+
event_type: z.ZodEnum<["token_issued", "dashboard_opened", "query_executed", "tool_called", "export_completed", "automation_run_completed"]>;
|
|
56
|
+
event_version: z.ZodNumber;
|
|
57
|
+
category: z.ZodEnum<["usage", "runtime", "agent", "delivery"]>;
|
|
58
|
+
occurred_at: z.ZodString;
|
|
59
|
+
producer: z.ZodEnum<["app", "scheduler"]>;
|
|
60
|
+
release: z.ZodString;
|
|
61
|
+
org_id: z.ZodNullable<z.ZodString>;
|
|
62
|
+
project_id: z.ZodNullable<z.ZodString>;
|
|
63
|
+
tenant_id: z.ZodNullable<z.ZodString>;
|
|
64
|
+
actor_type: z.ZodEnum<["org_user", "tenant_user", "tenant", "api_key", "system", "anonymous"]>;
|
|
65
|
+
org_user_id: z.ZodNullable<z.ZodString>;
|
|
66
|
+
tenant_user_id: z.ZodNullable<z.ZodString>;
|
|
67
|
+
surface: z.ZodEnum<["console", "embed", "public_link", "mcp", "api", "scheduler", "pdf_renderer"]>;
|
|
68
|
+
session_id: z.ZodNullable<z.ZodString>;
|
|
69
|
+
operation_id: z.ZodNullable<z.ZodString>;
|
|
70
|
+
dashboard_id: z.ZodNullable<z.ZodString>;
|
|
71
|
+
sheet_id: z.ZodNullable<z.ZodString>;
|
|
72
|
+
card_id: z.ZodNullable<z.ZodString>;
|
|
73
|
+
connection_id: z.ZodNullable<z.ZodString>;
|
|
74
|
+
domain_id: z.ZodNullable<z.ZodString>;
|
|
75
|
+
outcome: z.ZodNullable<z.ZodEnum<["succeeded", "failed", "cancelled", "timed_out"]>>;
|
|
76
|
+
duration_ms: z.ZodNullable<z.ZodNumber>;
|
|
77
|
+
error: z.ZodNullable<z.ZodObject<{
|
|
78
|
+
code: z.ZodString;
|
|
79
|
+
message: z.ZodEffects<z.ZodString, string, string>;
|
|
80
|
+
}, "strict", z.ZodTypeAny, {
|
|
81
|
+
code: string;
|
|
82
|
+
message: string;
|
|
83
|
+
}, {
|
|
84
|
+
code: string;
|
|
85
|
+
message: string;
|
|
86
|
+
}>>;
|
|
87
|
+
details: z.ZodUnknown;
|
|
88
|
+
}, "strict", z.ZodTypeAny, {
|
|
89
|
+
error: {
|
|
90
|
+
code: string;
|
|
91
|
+
message: string;
|
|
92
|
+
} | null;
|
|
93
|
+
surface: "api" | "embed" | "console" | "public_link" | "mcp" | "scheduler" | "pdf_renderer";
|
|
94
|
+
category: "usage" | "runtime" | "delivery" | "agent";
|
|
95
|
+
connection_id: string | null;
|
|
96
|
+
card_id: string | null;
|
|
97
|
+
sheet_id: string | null;
|
|
98
|
+
outcome: "cancelled" | "failed" | "timed_out" | "succeeded" | null;
|
|
99
|
+
domain_id: string | null;
|
|
100
|
+
project_id: string | null;
|
|
101
|
+
dashboard_id: string | null;
|
|
102
|
+
duration_ms: number | null;
|
|
103
|
+
event_id: string;
|
|
104
|
+
event_type: "token_issued" | "dashboard_opened" | "query_executed" | "tool_called" | "export_completed" | "automation_run_completed";
|
|
105
|
+
event_version: number;
|
|
106
|
+
occurred_at: string;
|
|
107
|
+
producer: "scheduler" | "app";
|
|
108
|
+
release: string;
|
|
109
|
+
org_id: string | null;
|
|
110
|
+
tenant_id: string | null;
|
|
111
|
+
actor_type: "system" | "tenant" | "tenant_user" | "org_user" | "anonymous" | "api_key";
|
|
112
|
+
org_user_id: string | null;
|
|
113
|
+
tenant_user_id: string | null;
|
|
114
|
+
session_id: string | null;
|
|
115
|
+
operation_id: string | null;
|
|
116
|
+
details?: unknown;
|
|
117
|
+
}, {
|
|
118
|
+
error: {
|
|
119
|
+
code: string;
|
|
120
|
+
message: string;
|
|
121
|
+
} | null;
|
|
122
|
+
surface: "api" | "embed" | "console" | "public_link" | "mcp" | "scheduler" | "pdf_renderer";
|
|
123
|
+
category: "usage" | "runtime" | "delivery" | "agent";
|
|
124
|
+
connection_id: string | null;
|
|
125
|
+
card_id: string | null;
|
|
126
|
+
sheet_id: string | null;
|
|
127
|
+
outcome: "cancelled" | "failed" | "timed_out" | "succeeded" | null;
|
|
128
|
+
domain_id: string | null;
|
|
129
|
+
project_id: string | null;
|
|
130
|
+
dashboard_id: string | null;
|
|
131
|
+
duration_ms: number | null;
|
|
132
|
+
event_id: string;
|
|
133
|
+
event_type: "token_issued" | "dashboard_opened" | "query_executed" | "tool_called" | "export_completed" | "automation_run_completed";
|
|
134
|
+
event_version: number;
|
|
135
|
+
occurred_at: string;
|
|
136
|
+
producer: "scheduler" | "app";
|
|
137
|
+
release: string;
|
|
138
|
+
org_id: string | null;
|
|
139
|
+
tenant_id: string | null;
|
|
140
|
+
actor_type: "system" | "tenant" | "tenant_user" | "org_user" | "anonymous" | "api_key";
|
|
141
|
+
org_user_id: string | null;
|
|
142
|
+
tenant_user_id: string | null;
|
|
143
|
+
session_id: string | null;
|
|
144
|
+
operation_id: string | null;
|
|
145
|
+
details?: unknown;
|
|
146
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UsageEvent } from './envelope.js';
|
|
2
|
+
/**
|
|
3
|
+
* Every event passes this before it leaves its producer (AL-INV-3). Issues
|
|
4
|
+
* name the path and the rule broken, never a value, so they can be logged.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseUsageEvent(value: unknown): {
|
|
7
|
+
ok: true;
|
|
8
|
+
event: UsageEvent;
|
|
9
|
+
} | {
|
|
10
|
+
ok: false;
|
|
11
|
+
issues: string[];
|
|
12
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The query vocabulary (usage-events TECH-SPEC 2.1), shared by the query
|
|
3
|
+
* tags (Phase Q), the attribution schema and `query_executed` (Phase 2). Its
|
|
4
|
+
* own module so `details.ts` can use it without importing the catalog.
|
|
5
|
+
*/
|
|
6
|
+
/** What a query run was for, derived on the server from its own inputs. */
|
|
7
|
+
export declare const QUERY_KINDS: readonly ["card", "matrix_window", "filter_options", "control_options", "sql", "export"];
|
|
8
|
+
export type QueryKind = (typeof QUERY_KINDS)[number];
|
|
9
|
+
/** One data-service call inside a query run. */
|
|
10
|
+
export declare const QUERY_STATEMENTS: readonly ["main", "row_count", "totals"];
|
|
11
|
+
export type QueryStatement = (typeof QUERY_STATEMENTS)[number];
|
|
12
|
+
/** The gesture the browser says a query followed (Phase 3 sends it). */
|
|
13
|
+
export declare const QUERY_TRIGGERS: readonly ["initial_load", "input_change", "click_filter", "drill", "page", "sort", "refresh"];
|
|
14
|
+
export type QueryTrigger = (typeof QUERY_TRIGGERS)[number];
|