react-semaphor 0.1.575 → 0.1.577
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 +2 -2
- package/dist/types/shared/usage-events/catalog.d.ts +5 -3
- package/dist/types/shared/usage-events/details.d.ts +69 -0
- package/dist/types/shared/usage-events/envelope.d.ts +4 -4
- package/dist/usage-events/index.js +157 -120
- package/package.json +1 -1
|
@@ -1,102 +1,115 @@
|
|
|
1
1
|
import { z as e } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"filter_options",
|
|
6
|
-
"control_options",
|
|
7
|
-
"sql",
|
|
8
|
-
"export"
|
|
9
|
-
], x = ["main", "row_count", "totals"], b = [
|
|
10
|
-
"initial_load",
|
|
11
|
-
"input_change",
|
|
12
|
-
"click_filter",
|
|
13
|
-
"drill",
|
|
14
|
-
"page",
|
|
15
|
-
"sort",
|
|
16
|
-
"refresh"
|
|
17
|
-
], r = e.string().min(1).max(128), s = e.string().max(500), _ = e.array(e.string().max(500)).max(500), l = e.number().int().nonnegative(), y = e.string().refine((o) => new TextEncoder().encode(o).length <= 16 * 1024), E = e.object({
|
|
2
|
+
import { Q as h, a as b, b as y } from "../chunks/attribution-BvoKvhcj.js";
|
|
3
|
+
import { U as K, c as Z, u as J } from "../chunks/attribution-BvoKvhcj.js";
|
|
4
|
+
const i = e.string().min(1).max(128), t = e.string().max(500), p = e.array(e.string().max(500)).max(500), r = e.number().int().nonnegative(), g = e.string().refine((o) => new TextEncoder().encode(o).length <= 16 * 1024), x = e.object({
|
|
18
5
|
token_type: e.enum(["dashboard", "project"]),
|
|
19
6
|
token_purpose: e.enum(["embed", "console"]).optional(),
|
|
20
7
|
ttl_s: e.number().int().nonnegative().optional(),
|
|
21
8
|
embed_origin: e.string().max(2048).optional(),
|
|
22
|
-
initial_dashboard_id:
|
|
23
|
-
dashboard_title:
|
|
24
|
-
project_name:
|
|
9
|
+
initial_dashboard_id: i.optional(),
|
|
10
|
+
dashboard_title: t.optional(),
|
|
11
|
+
project_name: t.optional(),
|
|
25
12
|
user_verified: e.boolean(),
|
|
26
|
-
user_email:
|
|
27
|
-
user_display_name:
|
|
28
|
-
tenant_name:
|
|
13
|
+
user_email: t.optional(),
|
|
14
|
+
user_display_name: t.optional(),
|
|
15
|
+
tenant_name: t.optional(),
|
|
29
16
|
role: e.string().max(128).optional(),
|
|
30
17
|
user_provisioned: e.boolean().optional(),
|
|
31
18
|
domain_access_mode: e.enum(["all", "none", "include", "exclude"]).optional(),
|
|
32
|
-
domain_ids: e.array(
|
|
33
|
-
rls_policy_names:
|
|
34
|
-
cls_policy_names:
|
|
19
|
+
domain_ids: e.array(i).max(500).optional(),
|
|
20
|
+
rls_policy_names: p.optional(),
|
|
21
|
+
cls_policy_names: p.optional(),
|
|
35
22
|
has_sls: e.boolean().optional(),
|
|
36
|
-
security_param_keys:
|
|
23
|
+
security_param_keys: p.optional(),
|
|
37
24
|
timezone: e.string().max(128).optional(),
|
|
38
25
|
mcp_scopes: e.array(e.string().max(128)).max(64).optional(),
|
|
39
26
|
mcp_sql: e.boolean().optional(),
|
|
40
27
|
mcp_live: e.boolean().optional()
|
|
41
|
-
}).strict(),
|
|
28
|
+
}).strict(), f = e.object({
|
|
42
29
|
requested_version: e.number().int().optional(),
|
|
43
30
|
served: e.enum(["current", "version"]).optional(),
|
|
44
|
-
dashboard_title:
|
|
45
|
-
project_name:
|
|
46
|
-
sheet_count:
|
|
47
|
-
card_count:
|
|
48
|
-
}).strict(),
|
|
49
|
-
statement: e.enum(
|
|
31
|
+
dashboard_title: t.optional(),
|
|
32
|
+
project_name: t.optional(),
|
|
33
|
+
sheet_count: r.optional(),
|
|
34
|
+
card_count: r.optional()
|
|
35
|
+
}).strict(), E = e.object({
|
|
36
|
+
statement: e.enum(h),
|
|
50
37
|
duration_ms: e.number().nonnegative(),
|
|
51
38
|
outcome: e.enum(["succeeded", "failed", "cancelled"]),
|
|
52
|
-
rows:
|
|
53
|
-
}).strict(),
|
|
54
|
-
data_service_calls:
|
|
55
|
-
query_run_id:
|
|
56
|
-
parent_query_run_id:
|
|
57
|
-
query_kind: e.enum(
|
|
58
|
-
statements: e.array(
|
|
39
|
+
rows: r.optional()
|
|
40
|
+
}).strict(), S = e.object({
|
|
41
|
+
data_service_calls: r,
|
|
42
|
+
query_run_id: i,
|
|
43
|
+
parent_query_run_id: i.optional(),
|
|
44
|
+
query_kind: e.enum(y).optional(),
|
|
45
|
+
statements: e.array(E).max(64),
|
|
59
46
|
trigger: e.enum(b).optional(),
|
|
60
|
-
card_title:
|
|
47
|
+
card_title: t.optional(),
|
|
61
48
|
card_type: e.string().max(128).optional(),
|
|
62
|
-
|
|
63
|
-
|
|
49
|
+
dashboard_title: t.optional(),
|
|
50
|
+
sheet_title: t.optional(),
|
|
51
|
+
project_name: t.optional(),
|
|
52
|
+
connection_name: t.optional(),
|
|
64
53
|
connection_type: e.string().max(128).optional(),
|
|
65
54
|
dialect: e.string().max(128).optional(),
|
|
66
|
-
dataset:
|
|
67
|
-
rows:
|
|
55
|
+
dataset: t.optional(),
|
|
56
|
+
rows: r.optional(),
|
|
68
57
|
row_limit_exceeded: e.boolean().optional(),
|
|
69
|
-
sql_text:
|
|
58
|
+
sql_text: g.optional(),
|
|
70
59
|
sql_truncated: e.boolean().optional(),
|
|
71
60
|
sql_hash: e.string().regex(/^[0-9a-f]{64}$/).optional(),
|
|
72
|
-
input_ids_applied: e.array(
|
|
61
|
+
input_ids_applied: e.array(i).max(500).optional(),
|
|
73
62
|
page: e.number().int().positive().optional(),
|
|
74
|
-
export_job_id:
|
|
75
|
-
}).strict(),
|
|
63
|
+
export_job_id: i.optional()
|
|
64
|
+
}).strict(), T = e.object({
|
|
76
65
|
tool: e.string().min(1).max(128),
|
|
77
|
-
args_json:
|
|
66
|
+
args_json: g.optional(),
|
|
78
67
|
args_truncated: e.boolean().optional(),
|
|
79
68
|
arg_keys: e.array(e.string().max(128)).max(200),
|
|
80
69
|
user_agent: e.string().max(1024).optional(),
|
|
81
|
-
oauth_client:
|
|
70
|
+
oauth_client: t.optional(),
|
|
82
71
|
credential: e.string().max(64).optional(),
|
|
83
72
|
access_mode: e.string().max(64).optional(),
|
|
84
73
|
scopes: e.array(e.string().max(128)).max(64).optional(),
|
|
85
|
-
response_bytes:
|
|
86
|
-
}).strict(),
|
|
74
|
+
response_bytes: r.optional()
|
|
75
|
+
}).strict(), v = ["job", "matrix_direct", "rendered"], q = ["csv", "xlsx", "pdf", "png"], A = ["visual", "card", "dashboard"], U = ["create", "acquire", "deadline", "render"], R = e.object({
|
|
76
|
+
export_id: i.optional(),
|
|
77
|
+
mechanism: e.enum(v),
|
|
78
|
+
format: e.enum(q),
|
|
79
|
+
scope: e.enum(A).optional(),
|
|
80
|
+
rows: r.optional(),
|
|
81
|
+
bytes: r.optional(),
|
|
82
|
+
chunks: r.optional(),
|
|
83
|
+
stage: e.enum(U).optional()
|
|
84
|
+
}).strict(), O = ["export", "briefing", "cache_refresh"], j = ["scheduled", "manual", "api"], k = e.object({
|
|
85
|
+
run_id: i,
|
|
86
|
+
rule_id: i,
|
|
87
|
+
rule_name: t.optional(),
|
|
88
|
+
kind: e.enum(O),
|
|
89
|
+
trigger_source: e.enum(j).optional(),
|
|
90
|
+
attempt: r.optional(),
|
|
91
|
+
scheduled_for: e.string().datetime({ offset: !0 }).optional()
|
|
92
|
+
}).strict(), G = [
|
|
93
|
+
"token_issued",
|
|
94
|
+
"dashboard_opened",
|
|
95
|
+
"query_executed",
|
|
96
|
+
"tool_called",
|
|
97
|
+
"export_completed",
|
|
98
|
+
"automation_run_completed"
|
|
99
|
+
], I = ["usage", "runtime", "agent", "delivery"], D = ["org_user", "tenant_user", "tenant", "api_key", "system", "anonymous"], N = ["console", "embed", "public_link", "mcp", "api", "scheduler", "pdf_renderer"], C = ["succeeded", "failed", "cancelled", "timed_out"], M = ["app", "scheduler"], P = {
|
|
87
100
|
token_issued: {
|
|
88
101
|
category: "usage",
|
|
89
102
|
version: 1,
|
|
90
103
|
emittedBy: "semaphor-app/src/lib/usage-events/token-issued.ts",
|
|
91
104
|
personalData: !0,
|
|
92
|
-
detailsSchema:
|
|
105
|
+
detailsSchema: x
|
|
93
106
|
},
|
|
94
107
|
dashboard_opened: {
|
|
95
108
|
category: "usage",
|
|
96
109
|
version: 1,
|
|
97
110
|
emittedBy: "semaphor-app/src/lib/usage-events/dashboard-opened.ts",
|
|
98
111
|
personalData: !1,
|
|
99
|
-
detailsSchema:
|
|
112
|
+
detailsSchema: f
|
|
100
113
|
},
|
|
101
114
|
query_executed: {
|
|
102
115
|
category: "runtime",
|
|
@@ -104,7 +117,7 @@ const f = [
|
|
|
104
117
|
emittedBy: "semaphor-app/src/app/api/v1/query/query-run.ts",
|
|
105
118
|
// sql_text holds the filter and control values the app compiled in.
|
|
106
119
|
personalData: !0,
|
|
107
|
-
detailsSchema:
|
|
120
|
+
detailsSchema: S
|
|
108
121
|
},
|
|
109
122
|
tool_called: {
|
|
110
123
|
category: "agent",
|
|
@@ -112,59 +125,67 @@ const f = [
|
|
|
112
125
|
emittedBy: "semaphor-app/src/lib/mcp/tool-telemetry.ts",
|
|
113
126
|
// args_json is what the agent sent.
|
|
114
127
|
personalData: !0,
|
|
115
|
-
detailsSchema:
|
|
128
|
+
detailsSchema: T
|
|
129
|
+
},
|
|
130
|
+
export_completed: {
|
|
131
|
+
category: "delivery",
|
|
132
|
+
version: 1,
|
|
133
|
+
emittedBy: "semaphor-app/src/lib/usage-events/export-completed.ts",
|
|
134
|
+
personalData: !1,
|
|
135
|
+
detailsSchema: R
|
|
136
|
+
},
|
|
137
|
+
automation_run_completed: {
|
|
138
|
+
category: "delivery",
|
|
139
|
+
version: 1,
|
|
140
|
+
emittedBy: "semaphor-app/src/lib/usage-events/automation-run-completed.ts",
|
|
141
|
+
// rule_name is what its author typed; error.message is the run's own error text.
|
|
142
|
+
personalData: !0,
|
|
143
|
+
detailsSchema: k
|
|
116
144
|
}
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
dashboardId: p,
|
|
121
|
-
dashboardTitle: g,
|
|
122
|
-
sheetId: p,
|
|
123
|
-
sheetTitle: g
|
|
124
|
-
}), N = 16 * 1024, O = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/, C = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,9})?Z$/, B = e.string().min(1).max(128), a = B.nullable(), Y = e.object({
|
|
125
|
-
event_id: e.string().regex(O),
|
|
126
|
-
event_type: e.enum(A),
|
|
145
|
+
}, w = 16 * 1024, B = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/, X = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,9})?Z$/, Y = e.string().min(1).max(128), s = Y.nullable(), $ = e.object({
|
|
146
|
+
event_id: e.string().regex(B),
|
|
147
|
+
event_type: e.enum(G),
|
|
127
148
|
event_version: e.number().int().positive(),
|
|
128
|
-
category: e.enum(
|
|
129
|
-
occurred_at: e.string().regex(
|
|
130
|
-
producer: e.enum(
|
|
149
|
+
category: e.enum(I),
|
|
150
|
+
occurred_at: e.string().regex(X),
|
|
151
|
+
producer: e.enum(M),
|
|
131
152
|
release: e.string().min(1).max(64),
|
|
132
|
-
org_id:
|
|
133
|
-
project_id:
|
|
134
|
-
tenant_id:
|
|
135
|
-
actor_type: e.enum(
|
|
136
|
-
org_user_id:
|
|
137
|
-
tenant_user_id:
|
|
138
|
-
surface: e.enum(
|
|
139
|
-
session_id:
|
|
140
|
-
operation_id:
|
|
141
|
-
dashboard_id:
|
|
142
|
-
sheet_id:
|
|
143
|
-
card_id:
|
|
144
|
-
connection_id:
|
|
145
|
-
domain_id:
|
|
146
|
-
outcome: e.enum(
|
|
153
|
+
org_id: s,
|
|
154
|
+
project_id: s,
|
|
155
|
+
tenant_id: s,
|
|
156
|
+
actor_type: e.enum(D),
|
|
157
|
+
org_user_id: s,
|
|
158
|
+
tenant_user_id: s,
|
|
159
|
+
surface: e.enum(N),
|
|
160
|
+
session_id: s,
|
|
161
|
+
operation_id: s,
|
|
162
|
+
dashboard_id: s,
|
|
163
|
+
sheet_id: s,
|
|
164
|
+
card_id: s,
|
|
165
|
+
connection_id: s,
|
|
166
|
+
domain_id: s,
|
|
167
|
+
outcome: e.enum(C).nullable(),
|
|
147
168
|
duration_ms: e.number().nonnegative().nullable(),
|
|
148
169
|
error: e.object({
|
|
149
170
|
code: e.string().min(1).max(128),
|
|
150
|
-
message: e.string().refine((o) => new TextEncoder().encode(o).length <=
|
|
171
|
+
message: e.string().refine((o) => new TextEncoder().encode(o).length <= w)
|
|
151
172
|
}).strict().nullable(),
|
|
152
173
|
details: e.unknown()
|
|
153
174
|
}).strict();
|
|
154
|
-
function
|
|
155
|
-
const
|
|
156
|
-
if (!
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
const m =
|
|
160
|
-
m &&
|
|
161
|
-
const u = c.detailsSchema.safeParse(
|
|
162
|
-
return u.success ||
|
|
175
|
+
function F(o) {
|
|
176
|
+
const a = $.safeParse(o);
|
|
177
|
+
if (!a.success) return { ok: !1, issues: _(a.error.issues) };
|
|
178
|
+
const n = a.data, d = n.event_type, c = P[d], l = [];
|
|
179
|
+
n.event_version !== c.version && l.push("event_version: not the catalog version"), n.category !== c.category && l.push("category: not the catalog category");
|
|
180
|
+
const m = n.outcome === "failed" || n.outcome === "timed_out";
|
|
181
|
+
m && n.error === null && l.push("error: required when the outcome is failed or timed_out"), !m && n.error !== null && l.push("error: set only when the outcome is failed or timed_out"), l.push(...V[d](n));
|
|
182
|
+
const u = c.detailsSchema.safeParse(n.details);
|
|
183
|
+
return u.success || l.push(..._(u.error.issues, "details")), l.length > 0 ? { ok: !1, issues: l } : { ok: !0, event: { ...n, details: u.success ? u.data : n.details } };
|
|
163
184
|
}
|
|
164
|
-
const
|
|
185
|
+
const V = {
|
|
165
186
|
token_issued: (o) => {
|
|
166
|
-
const
|
|
167
|
-
return ["org_user", "tenant_user", "tenant", "anonymous"].includes(o.actor_type) ||
|
|
187
|
+
const a = [];
|
|
188
|
+
return ["org_user", "tenant_user", "tenant", "anonymous"].includes(o.actor_type) || a.push("actor_type: not a token_issued actor"), ["embed", "console", "mcp"].includes(o.surface) || a.push("surface: not a token_issued surface"), o.outcome === null && a.push("outcome: required"), o.outcome === "succeeded" && (o.session_id === null && a.push("session_id: required on success"), o.project_id === null && a.push("project_id: required on success")), a;
|
|
168
189
|
},
|
|
169
190
|
dashboard_opened: (o) => [
|
|
170
191
|
...o.outcome === null ? ["outcome: required"] : [],
|
|
@@ -179,31 +200,47 @@ const $ = {
|
|
|
179
200
|
...o.outcome === null ? ["outcome: required"] : [],
|
|
180
201
|
...o.duration_ms === null ? ["duration_ms: required"] : [],
|
|
181
202
|
...o.operation_id === null ? ["operation_id: required"] : []
|
|
203
|
+
],
|
|
204
|
+
export_completed: (o) => [
|
|
205
|
+
...o.outcome === null ? ["outcome: required"] : [],
|
|
206
|
+
...o.duration_ms === null ? ["duration_ms: required"] : []
|
|
207
|
+
],
|
|
208
|
+
automation_run_completed: (o) => [
|
|
209
|
+
...o.outcome === null ? ["outcome: required"] : [],
|
|
210
|
+
...o.duration_ms === null ? ["duration_ms: required"] : []
|
|
182
211
|
]
|
|
183
212
|
};
|
|
184
|
-
function
|
|
185
|
-
return o.map((
|
|
213
|
+
function _(o, a) {
|
|
214
|
+
return o.map((n) => `${[a, ...n.path].filter((c) => c !== void 0).join(".") || "(root)"}: ${n.code}`);
|
|
186
215
|
}
|
|
187
216
|
export {
|
|
188
|
-
|
|
189
|
-
|
|
217
|
+
O as AUTOMATION_RUN_KINDS,
|
|
218
|
+
j as AUTOMATION_TRIGGER_SOURCES,
|
|
219
|
+
q as EXPORT_FORMATS,
|
|
220
|
+
v as EXPORT_MECHANISMS,
|
|
221
|
+
A as EXPORT_SCOPES,
|
|
222
|
+
U as EXPORT_STAGES,
|
|
223
|
+
y as QUERY_KINDS,
|
|
224
|
+
h as QUERY_STATEMENTS,
|
|
190
225
|
b as QUERY_TRIGGERS,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
226
|
+
D as USAGE_ACTOR_TYPES,
|
|
227
|
+
K as USAGE_ATTRIBUTION_ID_MAX_LENGTH,
|
|
228
|
+
Z as USAGE_ATTRIBUTION_TITLE_MAX_LENGTH,
|
|
229
|
+
P as USAGE_EVENT_CATALOG,
|
|
230
|
+
I as USAGE_EVENT_CATEGORIES,
|
|
231
|
+
w as USAGE_EVENT_TEXT_MAX_BYTES,
|
|
232
|
+
G as USAGE_EVENT_TYPES,
|
|
233
|
+
C as USAGE_OUTCOMES,
|
|
234
|
+
M as USAGE_PRODUCERS,
|
|
235
|
+
N as USAGE_SURFACES,
|
|
236
|
+
k as automationRunCompletedDetailsSchema,
|
|
237
|
+
f as dashboardOpenedDetailsSchema,
|
|
238
|
+
R as exportCompletedDetailsSchema,
|
|
239
|
+
F as parseUsageEvent,
|
|
240
|
+
S as queryExecutedDetailsSchema,
|
|
241
|
+
E as queryStatementRecordSchema,
|
|
242
|
+
x as tokenIssuedDetailsSchema,
|
|
243
|
+
T as toolCalledDetailsSchema,
|
|
244
|
+
J as usageAttributionFieldsSchema,
|
|
245
|
+
$ as usageEventEnvelopeSchema
|
|
209
246
|
};
|