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.
@@ -1,102 +1,115 @@
1
1
  import { z as e } from "zod";
2
- const f = [
3
- "card",
4
- "matrix_window",
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: r.optional(),
23
- dashboard_title: s.optional(),
24
- project_name: s.optional(),
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: s.optional(),
27
- user_display_name: s.optional(),
28
- tenant_name: s.optional(),
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(r).max(500).optional(),
33
- rls_policy_names: _.optional(),
34
- cls_policy_names: _.optional(),
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: _.optional(),
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(), S = e.object({
28
+ }).strict(), f = e.object({
42
29
  requested_version: e.number().int().optional(),
43
30
  served: e.enum(["current", "version"]).optional(),
44
- dashboard_title: s.optional(),
45
- project_name: s.optional(),
46
- sheet_count: l.optional(),
47
- card_count: l.optional()
48
- }).strict(), T = e.object({
49
- statement: e.enum(x),
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: l.optional()
53
- }).strict(), v = e.object({
54
- data_service_calls: l,
55
- query_run_id: r,
56
- parent_query_run_id: r.optional(),
57
- query_kind: e.enum(f).optional(),
58
- statements: e.array(T).max(64),
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: s.optional(),
47
+ card_title: t.optional(),
61
48
  card_type: e.string().max(128).optional(),
62
- project_name: s.optional(),
63
- connection_name: s.optional(),
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: s.optional(),
67
- rows: l.optional(),
55
+ dataset: t.optional(),
56
+ rows: r.optional(),
68
57
  row_limit_exceeded: e.boolean().optional(),
69
- sql_text: y.optional(),
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(r).max(500).optional(),
61
+ input_ids_applied: e.array(i).max(500).optional(),
73
62
  page: e.number().int().positive().optional(),
74
- export_job_id: r.optional()
75
- }).strict(), q = e.object({
63
+ export_job_id: i.optional()
64
+ }).strict(), T = e.object({
76
65
  tool: e.string().min(1).max(128),
77
- args_json: y.optional(),
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: s.optional(),
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: l.optional()
86
- }).strict(), A = ["token_issued", "dashboard_opened", "query_executed", "tool_called"], U = ["usage", "runtime", "agent", "delivery"], k = ["org_user", "tenant_user", "tenant", "api_key", "system", "anonymous"], j = ["console", "embed", "public_link", "mcp", "api", "scheduler", "pdf_renderer"], I = ["succeeded", "failed", "cancelled", "timed_out"], G = ["app", "scheduler"], R = {
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: E
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: S
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: v
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: q
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
- }, D = 128, w = 500, p = e.string().max(D).optional().catch(void 0), g = e.string().max(w).optional().catch(void 0), P = e.object({
118
- operationId: p,
119
- trigger: e.enum(b).optional().catch(void 0),
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(U),
129
- occurred_at: e.string().regex(C),
130
- producer: e.enum(G),
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: a,
133
- project_id: a,
134
- tenant_id: a,
135
- actor_type: e.enum(k),
136
- org_user_id: a,
137
- tenant_user_id: a,
138
- surface: e.enum(j),
139
- session_id: a,
140
- operation_id: a,
141
- dashboard_id: a,
142
- sheet_id: a,
143
- card_id: a,
144
- connection_id: a,
145
- domain_id: a,
146
- outcome: e.enum(I).nullable(),
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 <= N)
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 V(o) {
155
- const n = Y.safeParse(o);
156
- if (!n.success) return { ok: !1, issues: h(n.error.issues) };
157
- const t = n.data, d = t.event_type, c = R[d], i = [];
158
- t.event_version !== c.version && i.push("event_version: not the catalog version"), t.category !== c.category && i.push("category: not the catalog category");
159
- const m = t.outcome === "failed" || t.outcome === "timed_out";
160
- m && t.error === null && i.push("error: required when the outcome is failed or timed_out"), !m && t.error !== null && i.push("error: set only when the outcome is failed or timed_out"), t.org_id === null && !(d === "token_issued" && t.outcome === "failed") && i.push("org_id: null only on a refused token_issued"), i.push(...$[d](t));
161
- const u = c.detailsSchema.safeParse(t.details);
162
- return u.success || i.push(...h(u.error.issues, "details")), i.length > 0 ? { ok: !1, issues: i } : { ok: !0, event: { ...t, details: u.success ? u.data : t.details } };
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 n = [];
167
- return ["org_user", "tenant_user", "tenant", "anonymous"].includes(o.actor_type) || n.push("actor_type: not a token_issued actor"), ["embed", "console", "mcp"].includes(o.surface) || n.push("surface: not a token_issued surface"), o.outcome === null && n.push("outcome: required"), o.outcome === "succeeded" && (o.session_id === null && n.push("session_id: required on success"), o.project_id === null && n.push("project_id: required on success")), n;
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 h(o, n) {
185
- return o.map((t) => `${[n, ...t.path].filter((c) => c !== void 0).join(".") || "(root)"}: ${t.code}`);
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
- f as QUERY_KINDS,
189
- x as QUERY_STATEMENTS,
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
- k as USAGE_ACTOR_TYPES,
192
- D as USAGE_ATTRIBUTION_ID_MAX_LENGTH,
193
- w as USAGE_ATTRIBUTION_TITLE_MAX_LENGTH,
194
- R as USAGE_EVENT_CATALOG,
195
- U as USAGE_EVENT_CATEGORIES,
196
- N as USAGE_EVENT_TEXT_MAX_BYTES,
197
- A as USAGE_EVENT_TYPES,
198
- I as USAGE_OUTCOMES,
199
- G as USAGE_PRODUCERS,
200
- j as USAGE_SURFACES,
201
- S as dashboardOpenedDetailsSchema,
202
- V as parseUsageEvent,
203
- v as queryExecutedDetailsSchema,
204
- T as queryStatementRecordSchema,
205
- E as tokenIssuedDetailsSchema,
206
- q as toolCalledDetailsSchema,
207
- P as usageAttributionFieldsSchema,
208
- Y as usageEventEnvelopeSchema
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
  };
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.575",
8
+ "version": "0.1.577",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",