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.
Files changed (23) hide show
  1. package/dist/chunks/{assistant-chat-D95DtCj7.js → assistant-chat-B_tmsxEK.js} +2 -2
  2. package/dist/chunks/attribution-BvoKvhcj.js +32 -0
  3. package/dist/chunks/{card-filter-builder-B3bEPylu.js → card-filter-builder-CwnMUZU2.js} +1 -1
  4. package/dist/chunks/{dashboard-DdALjmc3.js → dashboard-BcIIBCTP.js} +1 -1
  5. package/dist/chunks/{dashboard-briefing-launcher-D2vevpyl.js → dashboard-briefing-launcher-BBpECqg2.js} +2 -2
  6. package/dist/chunks/{dashboard-controls-DxrsGK9A.js → dashboard-controls-CONzvjmO.js} +4 -4
  7. package/dist/chunks/{dashboard-json-rwds0HjB.js → dashboard-json-BF2chEVd.js} +1 -1
  8. package/dist/chunks/{edit-dashboard-visual-BCDz5HOb.js → edit-dashboard-visual-Bf-RcbuD.js} +596 -595
  9. package/dist/chunks/{report-preferences-dialog-D9nBczmk.js → report-preferences-dialog-RN4g9PEN.js} +5 -5
  10. package/dist/chunks/{semaphor-ready-indicator-BdOAS4Uw.js → semaphor-ready-indicator-DtivanBy.js} +18207 -18146
  11. package/dist/chunks/{shelf-drop-preview-context-B1goDUYE.js → shelf-drop-preview-context-BTjYxbHC.js} +1 -1
  12. package/dist/dashboard/index.js +1 -1
  13. package/dist/index.js +184 -183
  14. package/dist/surfboard/index.js +1 -1
  15. package/dist/types/shared/usage-events/attribution.d.ts +3 -3
  16. package/dist/types/shared/usage-events/catalog.d.ts +40 -13
  17. package/dist/types/shared/usage-events/details.d.ts +312 -0
  18. package/dist/types/shared/usage-events/envelope.d.ts +146 -0
  19. package/dist/types/shared/usage-events/index.d.ts +3 -0
  20. package/dist/types/shared/usage-events/validate.d.ts +12 -0
  21. package/dist/types/shared/usage-events/vocabulary.d.ts +14 -0
  22. package/dist/usage-events/index.js +244 -30
  23. package/package.json +1 -1
@@ -1,32 +1,246 @@
1
- import { z as t } from "zod";
2
- const r = [
3
- "card",
4
- "matrix_window",
5
- "filter_options",
6
- "control_options",
7
- "sql",
8
- "export"
9
- ], s = ["main", "row_count", "totals"], n = [
10
- "initial_load",
11
- "input_change",
12
- "click_filter",
13
- "drill",
14
- "page",
15
- "sort",
16
- "refresh"
17
- ], a = 128, c = 500, o = t.string().max(a).optional().catch(void 0), i = t.string().max(c).optional().catch(void 0), l = t.object({
18
- operationId: o,
19
- trigger: t.enum(n).optional().catch(void 0),
20
- dashboardId: o,
21
- dashboardTitle: i,
22
- sheetId: o,
23
- sheetTitle: i
24
- });
1
+ import { z as e } from "zod";
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 l = e.string().min(1).max(128), n = e.string().max(500), p = e.array(e.string().max(500)).max(500), i = e.number().int().nonnegative(), g = e.string().refine((o) => new TextEncoder().encode(o).length <= 16 * 1024), f = e.object({
5
+ token_type: e.enum(["dashboard", "project"]),
6
+ token_purpose: e.enum(["embed", "console"]).optional(),
7
+ ttl_s: e.number().int().nonnegative().optional(),
8
+ embed_origin: e.string().max(2048).optional(),
9
+ initial_dashboard_id: l.optional(),
10
+ dashboard_title: n.optional(),
11
+ project_name: n.optional(),
12
+ user_verified: e.boolean(),
13
+ user_email: n.optional(),
14
+ user_display_name: n.optional(),
15
+ tenant_name: n.optional(),
16
+ role: e.string().max(128).optional(),
17
+ user_provisioned: e.boolean().optional(),
18
+ domain_access_mode: e.enum(["all", "none", "include", "exclude"]).optional(),
19
+ domain_ids: e.array(l).max(500).optional(),
20
+ rls_policy_names: p.optional(),
21
+ cls_policy_names: p.optional(),
22
+ has_sls: e.boolean().optional(),
23
+ security_param_keys: p.optional(),
24
+ timezone: e.string().max(128).optional(),
25
+ mcp_scopes: e.array(e.string().max(128)).max(64).optional(),
26
+ mcp_sql: e.boolean().optional(),
27
+ mcp_live: e.boolean().optional()
28
+ }).strict(), x = e.object({
29
+ requested_version: e.number().int().optional(),
30
+ served: e.enum(["current", "version"]).optional(),
31
+ dashboard_title: n.optional(),
32
+ project_name: n.optional(),
33
+ sheet_count: i.optional(),
34
+ card_count: i.optional()
35
+ }).strict(), E = e.object({
36
+ statement: e.enum(h),
37
+ duration_ms: e.number().nonnegative(),
38
+ outcome: e.enum(["succeeded", "failed", "cancelled"]),
39
+ rows: i.optional()
40
+ }).strict(), S = e.object({
41
+ data_service_calls: i,
42
+ query_run_id: l,
43
+ parent_query_run_id: l.optional(),
44
+ query_kind: e.enum(y).optional(),
45
+ statements: e.array(E).max(64),
46
+ trigger: e.enum(b).optional(),
47
+ card_title: n.optional(),
48
+ card_type: e.string().max(128).optional(),
49
+ dashboard_title: n.optional(),
50
+ sheet_title: n.optional(),
51
+ project_name: n.optional(),
52
+ connection_name: n.optional(),
53
+ connection_type: e.string().max(128).optional(),
54
+ dialect: e.string().max(128).optional(),
55
+ dataset: n.optional(),
56
+ rows: i.optional(),
57
+ row_limit_exceeded: e.boolean().optional(),
58
+ sql_text: g.optional(),
59
+ sql_truncated: e.boolean().optional(),
60
+ sql_hash: e.string().regex(/^[0-9a-f]{64}$/).optional(),
61
+ input_ids_applied: e.array(l).max(500).optional(),
62
+ page: e.number().int().positive().optional(),
63
+ export_job_id: l.optional()
64
+ }).strict(), T = e.object({
65
+ tool: e.string().min(1).max(128),
66
+ args_json: g.optional(),
67
+ args_truncated: e.boolean().optional(),
68
+ arg_keys: e.array(e.string().max(128)).max(200),
69
+ user_agent: e.string().max(1024).optional(),
70
+ oauth_client: n.optional(),
71
+ credential: e.string().max(64).optional(),
72
+ access_mode: e.string().max(64).optional(),
73
+ scopes: e.array(e.string().max(128)).max(64).optional(),
74
+ response_bytes: i.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: l.optional(),
77
+ mechanism: e.enum(v),
78
+ format: e.enum(q),
79
+ scope: e.enum(A).optional(),
80
+ rows: i.optional(),
81
+ bytes: i.optional(),
82
+ chunks: i.optional(),
83
+ stage: e.enum(U).optional()
84
+ }).strict(), k = ["export", "briefing", "cache_refresh"], O = ["scheduled", "manual", "api"], j = e.object({
85
+ run_id: l,
86
+ rule_id: l,
87
+ rule_name: n.optional(),
88
+ kind: e.enum(k),
89
+ trigger_source: e.enum(O).optional(),
90
+ attempt: i.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 = {
100
+ token_issued: {
101
+ category: "usage",
102
+ version: 1,
103
+ emittedBy: "semaphor-app/src/lib/usage-events/token-issued.ts",
104
+ personalData: !0,
105
+ detailsSchema: f
106
+ },
107
+ dashboard_opened: {
108
+ category: "usage",
109
+ version: 1,
110
+ emittedBy: "semaphor-app/src/lib/usage-events/dashboard-opened.ts",
111
+ personalData: !1,
112
+ detailsSchema: x
113
+ },
114
+ query_executed: {
115
+ category: "runtime",
116
+ version: 1,
117
+ emittedBy: "semaphor-app/src/app/api/v1/query/query-run.ts",
118
+ // sql_text holds the filter and control values the app compiled in.
119
+ personalData: !0,
120
+ detailsSchema: S
121
+ },
122
+ tool_called: {
123
+ category: "agent",
124
+ version: 1,
125
+ emittedBy: "semaphor-app/src/lib/mcp/tool-telemetry.ts",
126
+ // args_json is what the agent sent.
127
+ personalData: !0,
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: j
144
+ }
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),
148
+ event_version: e.number().int().positive(),
149
+ category: e.enum(I),
150
+ occurred_at: e.string().regex(X),
151
+ producer: e.enum(M),
152
+ release: e.string().min(1).max(64),
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(),
168
+ duration_ms: e.number().nonnegative().nullable(),
169
+ error: e.object({
170
+ code: e.string().min(1).max(128),
171
+ message: e.string().refine((o) => new TextEncoder().encode(o).length <= w)
172
+ }).strict().nullable(),
173
+ details: e.unknown()
174
+ }).strict();
175
+ function F(o) {
176
+ const a = $.safeParse(o);
177
+ if (!a.success) return { ok: !1, issues: _(a.error.issues) };
178
+ const t = a.data, u = t.event_type, c = P[u], r = [];
179
+ t.event_version !== c.version && r.push("event_version: not the catalog version"), t.category !== c.category && r.push("category: not the catalog category");
180
+ const m = t.outcome === "failed" || t.outcome === "timed_out";
181
+ m && t.error === null && r.push("error: required when the outcome is failed or timed_out"), !m && t.error !== null && r.push("error: set only when the outcome is failed or timed_out"), t.org_id === null && !(u === "token_issued" && t.outcome === "failed") && r.push("org_id: null only on a refused token_issued"), r.push(...V[u](t));
182
+ const d = c.detailsSchema.safeParse(t.details);
183
+ return d.success || r.push(..._(d.error.issues, "details")), r.length > 0 ? { ok: !1, issues: r } : { ok: !0, event: { ...t, details: d.success ? d.data : t.details } };
184
+ }
185
+ const V = {
186
+ token_issued: (o) => {
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;
189
+ },
190
+ dashboard_opened: (o) => [
191
+ ...o.outcome === null ? ["outcome: required"] : [],
192
+ ...o.duration_ms === null ? ["duration_ms: required"] : [],
193
+ ...o.dashboard_id === null ? ["dashboard_id: required"] : []
194
+ ],
195
+ query_executed: (o) => [
196
+ ...o.outcome === null ? ["outcome: required"] : [],
197
+ ...o.duration_ms === null ? ["duration_ms: required"] : []
198
+ ],
199
+ tool_called: (o) => [
200
+ ...o.outcome === null ? ["outcome: required"] : [],
201
+ ...o.duration_ms === null ? ["duration_ms: required"] : [],
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"] : []
211
+ ]
212
+ };
213
+ function _(o, a) {
214
+ return o.map((t) => `${[a, ...t.path].filter((c) => c !== void 0).join(".") || "(root)"}: ${t.code}`);
215
+ }
25
216
  export {
26
- r as QUERY_KINDS,
27
- s as QUERY_STATEMENTS,
28
- n as QUERY_TRIGGERS,
29
- a as USAGE_ATTRIBUTION_ID_MAX_LENGTH,
30
- c as USAGE_ATTRIBUTION_TITLE_MAX_LENGTH,
31
- l as usageAttributionFieldsSchema
217
+ k as AUTOMATION_RUN_KINDS,
218
+ O 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,
225
+ b as QUERY_TRIGGERS,
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
+ j as automationRunCompletedDetailsSchema,
237
+ x as dashboardOpenedDetailsSchema,
238
+ R as exportCompletedDetailsSchema,
239
+ F as parseUsageEvent,
240
+ S as queryExecutedDetailsSchema,
241
+ E as queryStatementRecordSchema,
242
+ f as tokenIssuedDetailsSchema,
243
+ T as toolCalledDetailsSchema,
244
+ J as usageAttributionFieldsSchema,
245
+ $ as usageEventEnvelopeSchema
32
246
  };
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.574",
8
+ "version": "0.1.576",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",