react-semaphor 0.1.576 → 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.
|
@@ -17,7 +17,7 @@ export type UsageEventEnvelope = {
|
|
|
17
17
|
producer: UsageProducer;
|
|
18
18
|
/** The producer's package version. */
|
|
19
19
|
release: string;
|
|
20
|
-
/** Null
|
|
20
|
+
/** Null when no org is known: a refused token request, or a project with no organization of its own or through its creator (AL-D42). Stored as `_none`. */
|
|
21
21
|
org_id: string | null;
|
|
22
22
|
project_id: string | null;
|
|
23
23
|
tenant_id: string | null;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { z as e } from "zod";
|
|
2
2
|
import { Q as h, a as b, b as y } from "../chunks/attribution-BvoKvhcj.js";
|
|
3
3
|
import { U as K, c as Z, u as J } from "../chunks/attribution-BvoKvhcj.js";
|
|
4
|
-
const
|
|
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({
|
|
5
5
|
token_type: e.enum(["dashboard", "project"]),
|
|
6
6
|
token_purpose: e.enum(["embed", "console"]).optional(),
|
|
7
7
|
ttl_s: e.number().int().nonnegative().optional(),
|
|
8
8
|
embed_origin: e.string().max(2048).optional(),
|
|
9
|
-
initial_dashboard_id:
|
|
10
|
-
dashboard_title:
|
|
11
|
-
project_name:
|
|
9
|
+
initial_dashboard_id: i.optional(),
|
|
10
|
+
dashboard_title: t.optional(),
|
|
11
|
+
project_name: t.optional(),
|
|
12
12
|
user_verified: e.boolean(),
|
|
13
|
-
user_email:
|
|
14
|
-
user_display_name:
|
|
15
|
-
tenant_name:
|
|
13
|
+
user_email: t.optional(),
|
|
14
|
+
user_display_name: t.optional(),
|
|
15
|
+
tenant_name: t.optional(),
|
|
16
16
|
role: e.string().max(128).optional(),
|
|
17
17
|
user_provisioned: e.boolean().optional(),
|
|
18
18
|
domain_access_mode: e.enum(["all", "none", "include", "exclude"]).optional(),
|
|
19
|
-
domain_ids: e.array(
|
|
19
|
+
domain_ids: e.array(i).max(500).optional(),
|
|
20
20
|
rls_policy_names: p.optional(),
|
|
21
21
|
cls_policy_names: p.optional(),
|
|
22
22
|
has_sls: e.boolean().optional(),
|
|
@@ -25,69 +25,69 @@ const l = e.string().min(1).max(128), n = e.string().max(500), p = e.array(e.str
|
|
|
25
25
|
mcp_scopes: e.array(e.string().max(128)).max(64).optional(),
|
|
26
26
|
mcp_sql: e.boolean().optional(),
|
|
27
27
|
mcp_live: e.boolean().optional()
|
|
28
|
-
}).strict(),
|
|
28
|
+
}).strict(), f = e.object({
|
|
29
29
|
requested_version: e.number().int().optional(),
|
|
30
30
|
served: e.enum(["current", "version"]).optional(),
|
|
31
|
-
dashboard_title:
|
|
32
|
-
project_name:
|
|
33
|
-
sheet_count:
|
|
34
|
-
card_count:
|
|
31
|
+
dashboard_title: t.optional(),
|
|
32
|
+
project_name: t.optional(),
|
|
33
|
+
sheet_count: r.optional(),
|
|
34
|
+
card_count: r.optional()
|
|
35
35
|
}).strict(), E = e.object({
|
|
36
36
|
statement: e.enum(h),
|
|
37
37
|
duration_ms: e.number().nonnegative(),
|
|
38
38
|
outcome: e.enum(["succeeded", "failed", "cancelled"]),
|
|
39
|
-
rows:
|
|
39
|
+
rows: r.optional()
|
|
40
40
|
}).strict(), S = e.object({
|
|
41
|
-
data_service_calls:
|
|
42
|
-
query_run_id:
|
|
43
|
-
parent_query_run_id:
|
|
41
|
+
data_service_calls: r,
|
|
42
|
+
query_run_id: i,
|
|
43
|
+
parent_query_run_id: i.optional(),
|
|
44
44
|
query_kind: e.enum(y).optional(),
|
|
45
45
|
statements: e.array(E).max(64),
|
|
46
46
|
trigger: e.enum(b).optional(),
|
|
47
|
-
card_title:
|
|
47
|
+
card_title: t.optional(),
|
|
48
48
|
card_type: e.string().max(128).optional(),
|
|
49
|
-
dashboard_title:
|
|
50
|
-
sheet_title:
|
|
51
|
-
project_name:
|
|
52
|
-
connection_name:
|
|
49
|
+
dashboard_title: t.optional(),
|
|
50
|
+
sheet_title: t.optional(),
|
|
51
|
+
project_name: t.optional(),
|
|
52
|
+
connection_name: t.optional(),
|
|
53
53
|
connection_type: e.string().max(128).optional(),
|
|
54
54
|
dialect: e.string().max(128).optional(),
|
|
55
|
-
dataset:
|
|
56
|
-
rows:
|
|
55
|
+
dataset: t.optional(),
|
|
56
|
+
rows: r.optional(),
|
|
57
57
|
row_limit_exceeded: e.boolean().optional(),
|
|
58
58
|
sql_text: g.optional(),
|
|
59
59
|
sql_truncated: e.boolean().optional(),
|
|
60
60
|
sql_hash: e.string().regex(/^[0-9a-f]{64}$/).optional(),
|
|
61
|
-
input_ids_applied: e.array(
|
|
61
|
+
input_ids_applied: e.array(i).max(500).optional(),
|
|
62
62
|
page: e.number().int().positive().optional(),
|
|
63
|
-
export_job_id:
|
|
63
|
+
export_job_id: i.optional()
|
|
64
64
|
}).strict(), T = e.object({
|
|
65
65
|
tool: e.string().min(1).max(128),
|
|
66
66
|
args_json: g.optional(),
|
|
67
67
|
args_truncated: e.boolean().optional(),
|
|
68
68
|
arg_keys: e.array(e.string().max(128)).max(200),
|
|
69
69
|
user_agent: e.string().max(1024).optional(),
|
|
70
|
-
oauth_client:
|
|
70
|
+
oauth_client: t.optional(),
|
|
71
71
|
credential: e.string().max(64).optional(),
|
|
72
72
|
access_mode: e.string().max(64).optional(),
|
|
73
73
|
scopes: e.array(e.string().max(128)).max(64).optional(),
|
|
74
|
-
response_bytes:
|
|
74
|
+
response_bytes: r.optional()
|
|
75
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:
|
|
76
|
+
export_id: i.optional(),
|
|
77
77
|
mechanism: e.enum(v),
|
|
78
78
|
format: e.enum(q),
|
|
79
79
|
scope: e.enum(A).optional(),
|
|
80
|
-
rows:
|
|
81
|
-
bytes:
|
|
82
|
-
chunks:
|
|
80
|
+
rows: r.optional(),
|
|
81
|
+
bytes: r.optional(),
|
|
82
|
+
chunks: r.optional(),
|
|
83
83
|
stage: e.enum(U).optional()
|
|
84
|
-
}).strict(),
|
|
85
|
-
run_id:
|
|
86
|
-
rule_id:
|
|
87
|
-
rule_name:
|
|
88
|
-
kind: e.enum(
|
|
89
|
-
trigger_source: e.enum(
|
|
90
|
-
attempt:
|
|
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
91
|
scheduled_for: e.string().datetime({ offset: !0 }).optional()
|
|
92
92
|
}).strict(), G = [
|
|
93
93
|
"token_issued",
|
|
@@ -102,14 +102,14 @@ const l = e.string().min(1).max(128), n = e.string().max(500), p = e.array(e.str
|
|
|
102
102
|
version: 1,
|
|
103
103
|
emittedBy: "semaphor-app/src/lib/usage-events/token-issued.ts",
|
|
104
104
|
personalData: !0,
|
|
105
|
-
detailsSchema:
|
|
105
|
+
detailsSchema: x
|
|
106
106
|
},
|
|
107
107
|
dashboard_opened: {
|
|
108
108
|
category: "usage",
|
|
109
109
|
version: 1,
|
|
110
110
|
emittedBy: "semaphor-app/src/lib/usage-events/dashboard-opened.ts",
|
|
111
111
|
personalData: !1,
|
|
112
|
-
detailsSchema:
|
|
112
|
+
detailsSchema: f
|
|
113
113
|
},
|
|
114
114
|
query_executed: {
|
|
115
115
|
category: "runtime",
|
|
@@ -140,7 +140,7 @@ const l = e.string().min(1).max(128), n = e.string().max(500), p = e.array(e.str
|
|
|
140
140
|
emittedBy: "semaphor-app/src/lib/usage-events/automation-run-completed.ts",
|
|
141
141
|
// rule_name is what its author typed; error.message is the run's own error text.
|
|
142
142
|
personalData: !0,
|
|
143
|
-
detailsSchema:
|
|
143
|
+
detailsSchema: k
|
|
144
144
|
}
|
|
145
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
146
|
event_id: e.string().regex(B),
|
|
@@ -175,12 +175,12 @@ const l = e.string().min(1).max(128), n = e.string().max(500), p = e.array(e.str
|
|
|
175
175
|
function F(o) {
|
|
176
176
|
const a = $.safeParse(o);
|
|
177
177
|
if (!a.success) return { ok: !1, issues: _(a.error.issues) };
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
const m =
|
|
181
|
-
m &&
|
|
182
|
-
const
|
|
183
|
-
return
|
|
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 } };
|
|
184
184
|
}
|
|
185
185
|
const V = {
|
|
186
186
|
token_issued: (o) => {
|
|
@@ -211,11 +211,11 @@ const V = {
|
|
|
211
211
|
]
|
|
212
212
|
};
|
|
213
213
|
function _(o, a) {
|
|
214
|
-
return o.map((
|
|
214
|
+
return o.map((n) => `${[a, ...n.path].filter((c) => c !== void 0).join(".") || "(root)"}: ${n.code}`);
|
|
215
215
|
}
|
|
216
216
|
export {
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
O as AUTOMATION_RUN_KINDS,
|
|
218
|
+
j as AUTOMATION_TRIGGER_SOURCES,
|
|
219
219
|
q as EXPORT_FORMATS,
|
|
220
220
|
v as EXPORT_MECHANISMS,
|
|
221
221
|
A as EXPORT_SCOPES,
|
|
@@ -233,13 +233,13 @@ export {
|
|
|
233
233
|
C as USAGE_OUTCOMES,
|
|
234
234
|
M as USAGE_PRODUCERS,
|
|
235
235
|
N as USAGE_SURFACES,
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
k as automationRunCompletedDetailsSchema,
|
|
237
|
+
f as dashboardOpenedDetailsSchema,
|
|
238
238
|
R as exportCompletedDetailsSchema,
|
|
239
239
|
F as parseUsageEvent,
|
|
240
240
|
S as queryExecutedDetailsSchema,
|
|
241
241
|
E as queryStatementRecordSchema,
|
|
242
|
-
|
|
242
|
+
x as tokenIssuedDetailsSchema,
|
|
243
243
|
T as toolCalledDetailsSchema,
|
|
244
244
|
J as usageAttributionFieldsSchema,
|
|
245
245
|
$ as usageEventEnvelopeSchema
|