@capxul/observability 4.20.0-beta.4 → 4.20.0-beta.40
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/README.md +96 -0
- package/dist/devtools.d.mts +7 -0
- package/dist/devtools.mjs +72 -0
- package/dist/engineering.d.mts +31 -16
- package/dist/engineering.mjs +520 -304
- package/dist/index.d.mts +31007 -3491
- package/dist/index.mjs +2 -2
- package/dist/src-CyMiJfOK.mjs +10868 -0
- package/package.json +18 -10
- package/dist/src-CyMef9yy.mjs +0 -3078
package/dist/src-CyMef9yy.mjs
DELETED
|
@@ -1,3078 +0,0 @@
|
|
|
1
|
-
import { Effect, Schema, SchemaGetter } from "effect";
|
|
2
|
-
//#region ../errors/src/secret-material.ts
|
|
3
|
-
const CREDENTIAL_FIELDS = /* @__PURE__ */ new Set([
|
|
4
|
-
"password",
|
|
5
|
-
"passwd",
|
|
6
|
-
"pwd",
|
|
7
|
-
"pass",
|
|
8
|
-
"passphrase",
|
|
9
|
-
"currentpassword",
|
|
10
|
-
"newpassword",
|
|
11
|
-
"confirmpassword",
|
|
12
|
-
"passwordconfirmation",
|
|
13
|
-
"passwordhash",
|
|
14
|
-
"hashedpassword",
|
|
15
|
-
"pin",
|
|
16
|
-
"privatekey",
|
|
17
|
-
"walletprivatekey",
|
|
18
|
-
"secretkey",
|
|
19
|
-
"signingkey",
|
|
20
|
-
"signingsecret",
|
|
21
|
-
"seed",
|
|
22
|
-
"seedphrase",
|
|
23
|
-
"mnemonic",
|
|
24
|
-
"recoveryphrase",
|
|
25
|
-
"recovery",
|
|
26
|
-
"recoverycode",
|
|
27
|
-
"recoverycodes",
|
|
28
|
-
"keyshare",
|
|
29
|
-
"signingmaterial",
|
|
30
|
-
"recoverymaterial",
|
|
31
|
-
"privatekeybytes",
|
|
32
|
-
"signingprivatekey",
|
|
33
|
-
"encryptionkey",
|
|
34
|
-
"decryptionkey",
|
|
35
|
-
"authtoken",
|
|
36
|
-
"apitoken",
|
|
37
|
-
"bearertoken",
|
|
38
|
-
"oauthtoken",
|
|
39
|
-
"csrftoken",
|
|
40
|
-
"clientassertion",
|
|
41
|
-
"token",
|
|
42
|
-
"accesstoken",
|
|
43
|
-
"refreshtoken",
|
|
44
|
-
"idtoken",
|
|
45
|
-
"sessiontoken",
|
|
46
|
-
"session",
|
|
47
|
-
"sessionkey",
|
|
48
|
-
"sessionsecret",
|
|
49
|
-
"authsessionid",
|
|
50
|
-
"sessioncredential",
|
|
51
|
-
"sessioncredentials",
|
|
52
|
-
"sessioncookie",
|
|
53
|
-
"auth",
|
|
54
|
-
"authentication",
|
|
55
|
-
"authorization",
|
|
56
|
-
"proxyauthorization",
|
|
57
|
-
"cookie",
|
|
58
|
-
"cookies",
|
|
59
|
-
"setcookie",
|
|
60
|
-
"apikey",
|
|
61
|
-
"xapikey",
|
|
62
|
-
"xauthtoken",
|
|
63
|
-
"clientsecret",
|
|
64
|
-
"secret",
|
|
65
|
-
"secrets",
|
|
66
|
-
"credential",
|
|
67
|
-
"credentials",
|
|
68
|
-
"signature",
|
|
69
|
-
"otp",
|
|
70
|
-
"otpcode",
|
|
71
|
-
"totpsecret",
|
|
72
|
-
"onetimecode",
|
|
73
|
-
"onetimepassword",
|
|
74
|
-
"verificationcode",
|
|
75
|
-
"authcode",
|
|
76
|
-
"authorizationcode",
|
|
77
|
-
"oauthcode",
|
|
78
|
-
"codeverifier",
|
|
79
|
-
"devicecode",
|
|
80
|
-
"usercode",
|
|
81
|
-
"continuitytoken",
|
|
82
|
-
"refreshattemptid",
|
|
83
|
-
"revocationtoken"
|
|
84
|
-
]);
|
|
85
|
-
/** Match credential fields by meaning, without hiding token addresses or replay IDs. */
|
|
86
|
-
function isCredentialField(name, context) {
|
|
87
|
-
const normalized = name.toLowerCase().replace(/[^a-z0-9]/gu, "");
|
|
88
|
-
return CREDENTIAL_FIELDS.has(normalized) || /(?:password(?:hash)?|passwd|passphrase|privatekey|signingkey|apikey|clientsecret|accesstoken|refreshtoken|sessiontoken)$/u.test(normalized) || context === "authentication" && (normalized === "code" || normalized === "sessionid") || context === "header" && /(?:token|secret|apikey|privatekey|signingkey|password|authorization|cookie|session)$/u.test(normalized);
|
|
89
|
-
}
|
|
90
|
-
function decodeUrlComponent(text) {
|
|
91
|
-
try {
|
|
92
|
-
return decodeURIComponent(text);
|
|
93
|
-
} catch {
|
|
94
|
-
return text;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
/** Preserve URL diagnostics while removing credentials from their declared components. */
|
|
98
|
-
function redactUrlSecrets(value, source) {
|
|
99
|
-
try {
|
|
100
|
-
const absolute = /^[a-z][a-z0-9+.-]*:/iu.test(value);
|
|
101
|
-
const protocolRelative = value.startsWith("//");
|
|
102
|
-
const url = new URL(value, "https://redaction.invalid");
|
|
103
|
-
if (url.protocol !== "https:" && url.protocol !== "http:") return maskText(value);
|
|
104
|
-
let changed = url.username.length > 0 || url.password.length > 0;
|
|
105
|
-
const maskParams = (params) => new URLSearchParams(Array.from(params, ([name, entry]) => {
|
|
106
|
-
const safeName = maskText(name);
|
|
107
|
-
const safeEntry = isCredentialField(name) || /^(?:code|draft|__posthog)$/iu.test(name) ? "[REDACTED]" : maskText(entry);
|
|
108
|
-
changed ||= safeName !== name || safeEntry !== entry;
|
|
109
|
-
return [safeName, safeEntry];
|
|
110
|
-
})).toString();
|
|
111
|
-
const provider = source === "alchemy" || source === "infura" || /(?:^|\.)(?:alchemy\.com|alchemyapi\.io|infura\.io)$/iu.test(url.hostname);
|
|
112
|
-
const rawPath = absolute || protocolRelative ? url.pathname : value.split(/[?#]/u)[0] ?? "";
|
|
113
|
-
const segments = rawPath.split("/");
|
|
114
|
-
let path = segments.map((segment, index) => {
|
|
115
|
-
const decoded = decodeUrlComponent(segment);
|
|
116
|
-
const masked = provider && /^v[23]$/u.test(decodeUrlComponent(segments[index - 1] ?? "")) && decoded.length > 0 ? "[REDACTED]" : maskText(decoded);
|
|
117
|
-
changed ||= masked !== decoded;
|
|
118
|
-
return masked === decoded ? segment : encodeURIComponent(masked);
|
|
119
|
-
}).join("/");
|
|
120
|
-
if (source === "gateway" && rawPath.length > 0) {
|
|
121
|
-
path = `${rawPath.startsWith("/") ? "/" : ""}${encodeURIComponent("[REDACTED]")}`;
|
|
122
|
-
changed = true;
|
|
123
|
-
}
|
|
124
|
-
const query = maskParams(url.searchParams);
|
|
125
|
-
const fragment = url.hash.slice(1);
|
|
126
|
-
const decodedFragment = decodeUrlComponent(fragment);
|
|
127
|
-
const maskedFragment = maskText(decodedFragment);
|
|
128
|
-
changed ||= maskedFragment !== decodedFragment;
|
|
129
|
-
const fragmentQuery = fragment.indexOf("?");
|
|
130
|
-
const fragmentPath = fragment.slice(0, fragmentQuery);
|
|
131
|
-
const maskedFragmentPath = maskText(decodeUrlComponent(fragmentPath));
|
|
132
|
-
changed ||= maskedFragmentPath !== decodeUrlComponent(fragmentPath);
|
|
133
|
-
const hash = fragmentQuery >= 0 ? `${maskedFragmentPath === decodeUrlComponent(fragmentPath) ? fragmentPath : encodeURIComponent(maskedFragmentPath)}?${maskParams(new URLSearchParams(fragment.slice(fragmentQuery + 1)))}` : fragment.includes("=") ? maskParams(new URLSearchParams(fragment)) : maskedFragment === decodedFragment ? fragment : encodeURIComponent(maskedFragment);
|
|
134
|
-
const origin = absolute ? url.origin : protocolRelative ? `//${url.host}` : "";
|
|
135
|
-
if (!changed) return value;
|
|
136
|
-
return `${origin}${path}${query ? `?${query}` : ""}${hash ? `#${hash}` : ""}`;
|
|
137
|
-
} catch {
|
|
138
|
-
if (source === "gateway") return "[REDACTED]";
|
|
139
|
-
return maskText(value.replace(/(https?:\/\/)[^/\s@]+@/giu, "$1[REDACTED]@").replace(/([?&#])([^=&#]+)=([^&#]*)/gu, (whole, separator, name) => isCredentialField(decodeUrlComponent(name)) || /^(?:code|draft|__posthog)$/iu.test(decodeUrlComponent(name)) ? `${separator}${name}=[REDACTED]` : whole));
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
const JSON_FIELD = /("(?:[^"\\]|\\.)*")(\s*:\s*)("(?:[^"\\]|\\.)*"|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null)/gu;
|
|
143
|
-
const PROSE_FIELD = /(?=(\b([A-Za-z][A-Za-z0-9_-]*(?:[ \t]+[A-Za-z][A-Za-z0-9_-]*){0,3})\s*[:=]\s*((?:Bearer|Basic)[ \t]+[^\s,;"']+|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|[^\s,;&"']+)))/gu;
|
|
144
|
-
const EMBEDDED_URL = /(https?:\/\/[^\s"<>]*)/giu;
|
|
145
|
-
function isSecretLabel(name) {
|
|
146
|
-
return isCredentialField(name) || /^request[ _-]?body$/iu.test(name);
|
|
147
|
-
}
|
|
148
|
-
const JSON_ENCODING_MAX = 8;
|
|
149
|
-
const JSON_NESTING_MAX = 64;
|
|
150
|
-
const JSON_KEY = /("(?:[^"\\]|\\.)*")\s*:/gu;
|
|
151
|
-
const JSON_CONTAINER_START = /(?:\{\s*["}]|\[\s*[[\]{}"0-9tfn-])/uy;
|
|
152
|
-
function hasSecretJsonKey(value) {
|
|
153
|
-
for (const match of value.matchAll(JSON_KEY)) try {
|
|
154
|
-
if (match[1] !== void 0 && isSecretLabel(JSON.parse(match[1]))) return true;
|
|
155
|
-
} catch {}
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
/** Project a complete fragment once. Never retry all of its nested substrings. */
|
|
159
|
-
function projectJsonFragment(value, encodingDepth, overDepth) {
|
|
160
|
-
if (overDepth || encodingDepth >= JSON_ENCODING_MAX) return "[REDACTED]";
|
|
161
|
-
let parsed;
|
|
162
|
-
try {
|
|
163
|
-
parsed = JSON.parse(value);
|
|
164
|
-
} catch {
|
|
165
|
-
return hasSecretJsonKey(value) ? "[REDACTED]" : value;
|
|
166
|
-
}
|
|
167
|
-
try {
|
|
168
|
-
let changed = false;
|
|
169
|
-
const masked = JSON.stringify(parsed, (name, nested) => {
|
|
170
|
-
if (isSecretLabel(name)) {
|
|
171
|
-
changed ||= nested !== "[REDACTED]";
|
|
172
|
-
return "[REDACTED]";
|
|
173
|
-
}
|
|
174
|
-
if (typeof nested === "string") {
|
|
175
|
-
const projected = maskJsonFragments(nested, encodingDepth + 1);
|
|
176
|
-
changed ||= projected !== nested;
|
|
177
|
-
return projected;
|
|
178
|
-
}
|
|
179
|
-
return nested;
|
|
180
|
-
});
|
|
181
|
-
return changed ? masked : value;
|
|
182
|
-
} catch {
|
|
183
|
-
return "[REDACTED]";
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
/** Scan balanced object/array fragments once, respecting JSON quotes and escapes. */
|
|
187
|
-
function maskJsonFragments(value, encodingDepth = 0) {
|
|
188
|
-
if (value.trimStart().startsWith("\"")) try {
|
|
189
|
-
const decoded = JSON.parse(value);
|
|
190
|
-
if (typeof decoded === "string") {
|
|
191
|
-
if (encodingDepth >= JSON_ENCODING_MAX) return "\"[REDACTED]\"";
|
|
192
|
-
const masked = maskJsonFragments(decoded, encodingDepth + 1);
|
|
193
|
-
return masked === decoded ? value : JSON.stringify(masked);
|
|
194
|
-
}
|
|
195
|
-
} catch {}
|
|
196
|
-
let output = "";
|
|
197
|
-
let cursor = 0;
|
|
198
|
-
let start = -1;
|
|
199
|
-
let depth = 0;
|
|
200
|
-
let overDepth = false;
|
|
201
|
-
let quoted = false;
|
|
202
|
-
let escaped = false;
|
|
203
|
-
for (let index = 0; index < value.length; index++) {
|
|
204
|
-
const character = value[index];
|
|
205
|
-
if (start < 0) {
|
|
206
|
-
JSON_CONTAINER_START.lastIndex = index;
|
|
207
|
-
if (!JSON_CONTAINER_START.test(value)) continue;
|
|
208
|
-
start = index;
|
|
209
|
-
depth = 1;
|
|
210
|
-
overDepth = false;
|
|
211
|
-
continue;
|
|
212
|
-
}
|
|
213
|
-
if (quoted) {
|
|
214
|
-
if (escaped) escaped = false;
|
|
215
|
-
else if (character === "\\") escaped = true;
|
|
216
|
-
else if (character === "\"") quoted = false;
|
|
217
|
-
continue;
|
|
218
|
-
}
|
|
219
|
-
if (character === "\"") quoted = true;
|
|
220
|
-
else if (character === "{" || character === "[") {
|
|
221
|
-
depth++;
|
|
222
|
-
overDepth ||= depth > JSON_NESTING_MAX;
|
|
223
|
-
} else if (character === "}" || character === "]") {
|
|
224
|
-
depth--;
|
|
225
|
-
if (depth !== 0) continue;
|
|
226
|
-
output += value.slice(cursor, start) + projectJsonFragment(value.slice(start, index + 1), encodingDepth, overDepth);
|
|
227
|
-
cursor = index + 1;
|
|
228
|
-
start = -1;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
if (start >= 0) {
|
|
232
|
-
const fragment = value.slice(start);
|
|
233
|
-
output += value.slice(cursor, start) + (overDepth || hasSecretJsonKey(fragment) ? "[REDACTED]" : fragment);
|
|
234
|
-
cursor = value.length;
|
|
235
|
-
}
|
|
236
|
-
return output + value.slice(cursor);
|
|
237
|
-
}
|
|
238
|
-
function maskLabelledText(value) {
|
|
239
|
-
const jsonMasked = maskJsonFragments(value).replace(JSON_FIELD, (whole, quotedName, separator) => {
|
|
240
|
-
try {
|
|
241
|
-
return isSecretLabel(JSON.parse(quotedName)) ? `${quotedName}${separator}"[REDACTED]"` : whole;
|
|
242
|
-
} catch {
|
|
243
|
-
return whole;
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
let output = "";
|
|
247
|
-
let cursor = 0;
|
|
248
|
-
for (const match of jsonMasked.matchAll(PROSE_FIELD)) {
|
|
249
|
-
const [, whole, label, entry] = match;
|
|
250
|
-
if (whole === void 0 || label === void 0 || entry === void 0 || match.index < cursor || /^Bearer[ \t]+/iu.test(entry)) continue;
|
|
251
|
-
const words = label.split(/[ \t]+/u);
|
|
252
|
-
for (let index = 0; index < words.length; index++) {
|
|
253
|
-
const name = words.slice(index).join(" ");
|
|
254
|
-
if (isSecretLabel(name)) {
|
|
255
|
-
const prefix = words.slice(0, index).join(" ");
|
|
256
|
-
output += jsonMasked.slice(cursor, match.index) + `${prefix ? `${prefix} ` : ""}${name}=[REDACTED]`;
|
|
257
|
-
cursor = match.index + whole.length;
|
|
258
|
-
break;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
return output + jsonMasked.slice(cursor);
|
|
263
|
-
}
|
|
264
|
-
const TOKEN_MASKS = [
|
|
265
|
-
[/\bBearer\s+(?!(?:realm|error|error_description|scope|authorization_uri|resource|claims)\s*=)[^\s,;"']+/giu, "Bearer [REDACTED]"],
|
|
266
|
-
[/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/gu, "[REDACTED]"],
|
|
267
|
-
[/(^|[^a-fA-F0-9])(?<!0[xX])[a-fA-F0-9]{64}(?=$|[^a-fA-F0-9])/gu, "$1[REDACTED]"],
|
|
268
|
-
[/(?:(?:sk|pk|rk)_(?:live|test)|(?:phc|phx|ghp|gho|ghu|ghs|ghr|whsec)_|github_pat_|xox[baprs]-|AKIA[0-9A-Z]{16}|AIza)[A-Za-z0-9_-]*/giu, "[REDACTED]"]
|
|
269
|
-
];
|
|
270
|
-
/** URL components and malformed URLs use this non-recursive masking layer. */
|
|
271
|
-
function maskText(value) {
|
|
272
|
-
let text = maskLabelledText(value);
|
|
273
|
-
for (const [pattern, replacement] of TOKEN_MASKS) text = text.replace(pattern, replacement);
|
|
274
|
-
return text;
|
|
275
|
-
}
|
|
276
|
-
/** Mask credential fields and embedded URLs while preserving surrounding evidence. */
|
|
277
|
-
function redactSecrets(value, source) {
|
|
278
|
-
return maskLabelledText(value).split(EMBEDDED_URL).map((part, index) => index % 2 === 1 ? redactUrlSecrets(part, source).replaceAll("%5BREDACTED%5D", "[REDACTED]") : maskText(part)).join("");
|
|
279
|
-
}
|
|
280
|
-
//#endregion
|
|
281
|
-
//#region ../errors/src/chain-cause.ts
|
|
282
|
-
/**
|
|
283
|
-
* Why an operation failed — the one flat vocabulary. The first four are the
|
|
284
|
-
* auth/provider diagnoses that predate this file. The rest name the chain
|
|
285
|
-
* path. `FailureMode` is derived from this list so a runtime membership check
|
|
286
|
-
* (the SDK's `$exception` projection, the observability schema) and the type
|
|
287
|
-
* can never drift apart.
|
|
288
|
-
*/
|
|
289
|
-
const FAILURE_MODES = [
|
|
290
|
-
"auth-origin-mismatch",
|
|
291
|
-
"stale-openfort-cache",
|
|
292
|
-
"app-env-allowlist",
|
|
293
|
-
"no-secure-context",
|
|
294
|
-
"signer-not-ready",
|
|
295
|
-
"rate-limited",
|
|
296
|
-
"timeout",
|
|
297
|
-
"upstream-down",
|
|
298
|
-
"revert",
|
|
299
|
-
"insufficient-balance",
|
|
300
|
-
"insufficient-allowance",
|
|
301
|
-
"rejected",
|
|
302
|
-
"unauthorized",
|
|
303
|
-
"forbidden",
|
|
304
|
-
"bad-request",
|
|
305
|
-
"method-unsupported",
|
|
306
|
-
"unknown"
|
|
307
|
-
];
|
|
308
|
-
/** Who answered. `alto` is the bundler; `gateway` is the AA gateway's own logic. */
|
|
309
|
-
const CHAIN_UPSTREAMS = [
|
|
310
|
-
"alchemy",
|
|
311
|
-
"infura",
|
|
312
|
-
"public",
|
|
313
|
-
"alto",
|
|
314
|
-
"gateway"
|
|
315
|
-
];
|
|
316
|
-
//#endregion
|
|
317
|
-
//#region ../errors/src/errors.ts
|
|
318
|
-
const CAPXUL_ERROR_CODES = [
|
|
319
|
-
"NOT_AUTHENTICATED",
|
|
320
|
-
"EMAIL_DELIVERY_FAILED",
|
|
321
|
-
"PROFILE_NOT_FOUND",
|
|
322
|
-
"SMART_ACCOUNT_MISSING",
|
|
323
|
-
"PLAYER_NOT_FOUND",
|
|
324
|
-
"ACCOUNT_NOT_FOUND",
|
|
325
|
-
"ACCOUNT_CLAIMED_BY_OTHER_SIGNER",
|
|
326
|
-
"PROVIDER_ERROR",
|
|
327
|
-
"CAPABILITY_UNAVAILABLE",
|
|
328
|
-
"INVALID_INPUT",
|
|
329
|
-
"ENV_MISSING",
|
|
330
|
-
"NOT_IMPLEMENTED",
|
|
331
|
-
"VERIFICATION_REQUIRED",
|
|
332
|
-
"INSUFFICIENT_BALANCE",
|
|
333
|
-
"INVALID_RECIPIENT",
|
|
334
|
-
"ROLE_PERMISSION_DENIED",
|
|
335
|
-
"TRANSACTION_FAILED",
|
|
336
|
-
"RATE_LIMITED",
|
|
337
|
-
"NETWORK_ERROR",
|
|
338
|
-
"UNKNOWN",
|
|
339
|
-
"OTP_EXPIRED",
|
|
340
|
-
"SIGNER_REJECTED",
|
|
341
|
-
"CANCELLED",
|
|
342
|
-
"WRONG_STATE",
|
|
343
|
-
"STALE_EPOCH",
|
|
344
|
-
"SUPERSEDED",
|
|
345
|
-
"WORK_DIED",
|
|
346
|
-
"ACTOR_STOPPED"
|
|
347
|
-
];
|
|
348
|
-
new Set(CAPXUL_ERROR_CODES);
|
|
349
|
-
//#endregion
|
|
350
|
-
//#region ../types/src/index.ts
|
|
351
|
-
const EVM_ADDRESS_RE = /^0x[0-9a-f]{40}$/i;
|
|
352
|
-
const BYTES32_RE = /^0x[0-9a-f]{64}$/i;
|
|
353
|
-
`${"0".repeat(64)}`;
|
|
354
|
-
const SUPPORTED_CURRENCIES = [
|
|
355
|
-
{
|
|
356
|
-
code: "USD",
|
|
357
|
-
symbol: "$",
|
|
358
|
-
name: "US Dollar"
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
code: "NGN",
|
|
362
|
-
symbol: "NGN",
|
|
363
|
-
name: "Nigerian Naira"
|
|
364
|
-
},
|
|
365
|
-
{
|
|
366
|
-
code: "GHS",
|
|
367
|
-
symbol: "GHS",
|
|
368
|
-
name: "Ghanaian Cedi"
|
|
369
|
-
},
|
|
370
|
-
{
|
|
371
|
-
code: "KES",
|
|
372
|
-
symbol: "KSh",
|
|
373
|
-
name: "Kenyan Shilling"
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
code: "UGX",
|
|
377
|
-
symbol: "USh",
|
|
378
|
-
name: "Ugandan Shilling"
|
|
379
|
-
}
|
|
380
|
-
];
|
|
381
|
-
SUPPORTED_CURRENCIES.map((currency) => currency.code);
|
|
382
|
-
Object.fromEntries(SUPPORTED_CURRENCIES.map((currency) => [currency.code, currency.symbol]));
|
|
383
|
-
const APP_ID_RE = /^app_[0-7][0-9A-HJKMNP-TV-Z]{25}$/;
|
|
384
|
-
Math.floor(Number.MAX_SAFE_INTEGER / 1e3);
|
|
385
|
-
//#endregion
|
|
386
|
-
//#region src/operations.ts
|
|
387
|
-
const CAPXUL_OPERATIONS = {
|
|
388
|
-
account: {
|
|
389
|
-
addressBook: {
|
|
390
|
-
add: "account.addressBook.add",
|
|
391
|
-
get: "account.addressBook.get",
|
|
392
|
-
hide: "account.addressBook.hide",
|
|
393
|
-
label: "account.addressBook.label",
|
|
394
|
-
list: "account.addressBook.list",
|
|
395
|
-
unhide: "account.addressBook.unhide"
|
|
396
|
-
},
|
|
397
|
-
balance: "account.balance",
|
|
398
|
-
faucetMint: "account.faucetMint",
|
|
399
|
-
getLifecycle: "account.getLifecycle",
|
|
400
|
-
readBalance: "account.readBalance",
|
|
401
|
-
retrySetup: "account.retrySetup",
|
|
402
|
-
status: "account.status",
|
|
403
|
-
profile: {
|
|
404
|
-
depositInstructions: "account.profile.depositInstructions",
|
|
405
|
-
get: "account.profile.get"
|
|
406
|
-
},
|
|
407
|
-
inbox: {
|
|
408
|
-
approve: "account.inbox.approve",
|
|
409
|
-
decline: "account.inbox.decline",
|
|
410
|
-
list: "account.inbox.list"
|
|
411
|
-
},
|
|
412
|
-
requests: {
|
|
413
|
-
cancel: "account.requests.cancel",
|
|
414
|
-
get: "account.requests.get",
|
|
415
|
-
issue: "account.requests.issue",
|
|
416
|
-
list: "account.requests.list"
|
|
417
|
-
}
|
|
418
|
-
},
|
|
419
|
-
accounts: {
|
|
420
|
-
fund: "accounts.fund",
|
|
421
|
-
read: "accounts.read"
|
|
422
|
-
},
|
|
423
|
-
activity: {
|
|
424
|
-
annotate: "activity.annotate",
|
|
425
|
-
emitAnnotationSaved: "activity.emitAnnotationSaved",
|
|
426
|
-
get: "activity.get",
|
|
427
|
-
list: "activity.list",
|
|
428
|
-
/** The SDK's live Activity read over the indexer's SSE stream. */
|
|
429
|
-
subscribe: "activity.subscribe",
|
|
430
|
-
summary: "activity.summary"
|
|
431
|
-
},
|
|
432
|
-
addressBook: {
|
|
433
|
-
add: "addressBook.add",
|
|
434
|
-
emitRelationshipChanged: "addressBook.emitRelationshipChanged",
|
|
435
|
-
get: "addressBook.get",
|
|
436
|
-
hide: "addressBook.hide",
|
|
437
|
-
label: "addressBook.label",
|
|
438
|
-
list: "addressBook.list",
|
|
439
|
-
unhide: "addressBook.unhide"
|
|
440
|
-
},
|
|
441
|
-
applications: { create: "applications.create" },
|
|
442
|
-
auth: {
|
|
443
|
-
canSendOtp: "auth.canSendOtp",
|
|
444
|
-
getSession: "auth.getSession",
|
|
445
|
-
signIn: "auth.signIn",
|
|
446
|
-
signOut: "auth.signOut",
|
|
447
|
-
sendVerificationOtp: "auth.sendVerificationOTP",
|
|
448
|
-
verifyOtp: "auth.verifyOtp"
|
|
449
|
-
},
|
|
450
|
-
client: {
|
|
451
|
-
createOrg: "createOrg",
|
|
452
|
-
orgs: "orgs"
|
|
453
|
-
},
|
|
454
|
-
credentials: {
|
|
455
|
-
bootstrapClient: "credentials.bootstrapClient",
|
|
456
|
-
mintQuickstartKey: "credentials.mintQuickstartKey"
|
|
457
|
-
},
|
|
458
|
-
currentUser: { get: "currentUser.get" },
|
|
459
|
-
devIdentity: { seedFinancialOpsOrg: "devIdentity.seedFinancialOpsOrg" },
|
|
460
|
-
dev: { browserSeed: "dev.browserSeed" },
|
|
461
|
-
destinations: {
|
|
462
|
-
add: "destinations.add",
|
|
463
|
-
list: "destinations.list",
|
|
464
|
-
remove: "destinations.remove"
|
|
465
|
-
},
|
|
466
|
-
faucetSafe: { deploy: "FaucetSafe.deploy" },
|
|
467
|
-
financialOps: {
|
|
468
|
-
addDestination: "financialOps.addDestination",
|
|
469
|
-
approveRequest: "financialOps.approveRequest",
|
|
470
|
-
cancelRequest: "financialOps.cancelRequest",
|
|
471
|
-
createPayee: "financialOps.createPayee",
|
|
472
|
-
declineRequest: "financialOps.declineRequest",
|
|
473
|
-
emitInvoiceIssued: "financialOps.emitInvoiceIssued",
|
|
474
|
-
emitInvoiceRequestTransitioned: "financialOps.emitInvoiceRequestTransitioned",
|
|
475
|
-
emitPaymentWriterTelemetry: "financialOps.emitPaymentWriterTelemetry",
|
|
476
|
-
issueRequest: "financialOps.issueRequest",
|
|
477
|
-
migrateEvidenceIdentity: "financialOps.migrateEvidenceIdentity",
|
|
478
|
-
planEvidenceIdentity: "financialOps.planEvidenceIdentity",
|
|
479
|
-
recoverSettlementVerification: "financialOps.recoverSettlementVerification",
|
|
480
|
-
removeDestination: "financialOps.removeDestination",
|
|
481
|
-
verifySettlement: "financialOps.verifySettlement"
|
|
482
|
-
},
|
|
483
|
-
holdings: {
|
|
484
|
-
current: "holdings.current",
|
|
485
|
-
primary: "holdings.primary"
|
|
486
|
-
},
|
|
487
|
-
indexer: { reconcile: "indexer.reconcile" },
|
|
488
|
-
identity: {
|
|
489
|
-
accountAt: "identity.AccountAt",
|
|
490
|
-
accountClaimed: "identity.AccountClaimed",
|
|
491
|
-
accountClaiming: "identity.AccountClaiming",
|
|
492
|
-
accountDerived: "identity.AccountDerived",
|
|
493
|
-
accountFailed: "identity.AccountFailed",
|
|
494
|
-
attachOrganization: "identity.AttachOrganization",
|
|
495
|
-
claimAccount: "identity.ClaimAccount",
|
|
496
|
-
completeOnboarding: "identity.completeOnboarding",
|
|
497
|
-
completeProfile: "identity.completeProfile",
|
|
498
|
-
create: "identity.create",
|
|
499
|
-
createOrganization: "identity.CreateOrganization",
|
|
500
|
-
ensureAccount: "identity.EnsureAccount",
|
|
501
|
-
leaveOrganization: "identity.LeaveOrganization",
|
|
502
|
-
loadByAuthUserId: "identity.loadByAuthUserId",
|
|
503
|
-
loadCurrent: "identity.loadCurrent",
|
|
504
|
-
orgAt: "identity.OrgAt",
|
|
505
|
-
orgFailed: "identity.OrgFailed",
|
|
506
|
-
orgReady: "identity.OrgReady",
|
|
507
|
-
otpFailed: "identity.OtpFailed",
|
|
508
|
-
otpSent: "identity.OtpSent",
|
|
509
|
-
readSession: "identity.ReadSession",
|
|
510
|
-
requestOtp: "identity.RequestOtp",
|
|
511
|
-
reset: "identity.Reset",
|
|
512
|
-
restoreSession: "identity.RestoreSession",
|
|
513
|
-
resumeOtpEntry: "identity.ResumeOtpEntry",
|
|
514
|
-
retryAccount: "identity.RetryAccount",
|
|
515
|
-
retryOrganization: "identity.RetryOrganization",
|
|
516
|
-
sessionAbsent: "identity.SessionAbsent",
|
|
517
|
-
sessionRead: "identity.SessionRead",
|
|
518
|
-
sessionReadFailed: "identity.SessionReadFailed",
|
|
519
|
-
sessionRestored: "identity.SessionRestored",
|
|
520
|
-
signedOut: "identity.SignedOut",
|
|
521
|
-
signOut: "identity.SignOut",
|
|
522
|
-
signOutFailed: "identity.SignOutFailed",
|
|
523
|
-
update: "identity.update",
|
|
524
|
-
handleAvailable: "identity.handleAvailable",
|
|
525
|
-
verified: "identity.Verified",
|
|
526
|
-
verifyFailed: "identity.VerifyFailed",
|
|
527
|
-
verifyOtp: "identity.VerifyOtp"
|
|
528
|
-
},
|
|
529
|
-
media: {
|
|
530
|
-
generateUploadUrl: "media.generateUploadUrl",
|
|
531
|
-
setOrgLogo: "media.setOrgLogo",
|
|
532
|
-
setProfileImage: "media.setProfileImage",
|
|
533
|
-
uploadImage: "media.uploadImage"
|
|
534
|
-
},
|
|
535
|
-
me: {
|
|
536
|
-
depositInstructions: "me.depositInstructions",
|
|
537
|
-
get: "me.get"
|
|
538
|
-
},
|
|
539
|
-
moneyExecution: {
|
|
540
|
-
abandonPaymentExecution: "moneyExecution.abandonPaymentExecution",
|
|
541
|
-
prepareOrganizationPaymentExecution: "moneyExecution.prepareOrganizationPaymentExecution",
|
|
542
|
-
preparePaymentExecution: "moneyExecution.preparePaymentExecution",
|
|
543
|
-
preparePaymentLifecycleExecution: "moneyExecution.preparePaymentLifecycleExecution",
|
|
544
|
-
preparePermissionExecution: "moneyExecution.preparePermissionExecution",
|
|
545
|
-
recoverSubmissionClaims: "moneyExecution.recoverSubmissionClaims",
|
|
546
|
-
submit: "moneyExecution.submit",
|
|
547
|
-
submitPaymentCommandExecution: "moneyExecution.submitPaymentCommandExecution",
|
|
548
|
-
submitPaymentExecution: "moneyExecution.submitPaymentExecution",
|
|
549
|
-
submitPermissionExecution: "moneyExecution.submitPermissionExecution"
|
|
550
|
-
},
|
|
551
|
-
movement: {
|
|
552
|
-
emitDepositSettled: "movement.emitDepositSettled",
|
|
553
|
-
scan: "movement.scan"
|
|
554
|
-
},
|
|
555
|
-
inbox: {
|
|
556
|
-
approve: "inbox.approve",
|
|
557
|
-
decline: "inbox.decline",
|
|
558
|
-
list: "inbox.list"
|
|
559
|
-
},
|
|
560
|
-
offramp: {
|
|
561
|
-
quote: "offramp.quote",
|
|
562
|
-
status: "offramp.status"
|
|
563
|
-
},
|
|
564
|
-
onboarding: {
|
|
565
|
-
completeOrganization: "onboarding.completeOrganization",
|
|
566
|
-
completePerson: "onboarding.completePerson"
|
|
567
|
-
},
|
|
568
|
-
org: {
|
|
569
|
-
acceptInvitations: "org.acceptInvitations",
|
|
570
|
-
account: { get: "org.account.get" },
|
|
571
|
-
activateMember: "org.activateMember",
|
|
572
|
-
auditLog: "org.auditLog",
|
|
573
|
-
confirmBootstrap: "org.confirmBootstrap",
|
|
574
|
-
createOrg: "org.createOrg",
|
|
575
|
-
create: "org.create",
|
|
576
|
-
detectAndAcceptPendingInvitations: "org.detectAndAcceptPendingInvitations",
|
|
577
|
-
emitInviteProgressed: "org.emitInviteProgressed",
|
|
578
|
-
expireInvitations: "org.expireInvitations",
|
|
579
|
-
getLifecycle: "org.getLifecycle",
|
|
580
|
-
getProofReceipt: "org.getProofReceipt",
|
|
581
|
-
invite: "org.invite",
|
|
582
|
-
inviteMember: "org.inviteMember",
|
|
583
|
-
list: "org.list",
|
|
584
|
-
load: "org.load",
|
|
585
|
-
me: "org.me",
|
|
586
|
-
members: "org.members",
|
|
587
|
-
orgs: "org.orgs",
|
|
588
|
-
payment: "org.payment",
|
|
589
|
-
permissions: {
|
|
590
|
-
assign: "org.permissions.assign",
|
|
591
|
-
change: "org.permissions.change",
|
|
592
|
-
create: "org.permissions.create",
|
|
593
|
-
get: "org.permissions.get",
|
|
594
|
-
list: "org.permissions.list",
|
|
595
|
-
replace: "org.permissions.replace",
|
|
596
|
-
revoke: "org.permissions.revoke"
|
|
597
|
-
},
|
|
598
|
-
payments: {
|
|
599
|
-
pay: "org.payments.pay",
|
|
600
|
-
payBatch: "org.payments.payBatch"
|
|
601
|
-
},
|
|
602
|
-
payroll: {
|
|
603
|
-
authorizeRun: "org.payroll.authorizeRun",
|
|
604
|
-
groups: {
|
|
605
|
-
list: "org.payroll.groups.list",
|
|
606
|
-
remove: "org.payroll.groups.remove",
|
|
607
|
-
save: "org.payroll.groups.save"
|
|
608
|
-
},
|
|
609
|
-
runs: "org.payroll.runs",
|
|
610
|
-
terms: "org.payroll.terms"
|
|
611
|
-
},
|
|
612
|
-
addressBook: {
|
|
613
|
-
add: "org.addressBook.add",
|
|
614
|
-
get: "org.addressBook.get",
|
|
615
|
-
hide: "org.addressBook.hide",
|
|
616
|
-
label: "org.addressBook.label",
|
|
617
|
-
list: "org.addressBook.list",
|
|
618
|
-
unhide: "org.addressBook.unhide"
|
|
619
|
-
},
|
|
620
|
-
inbox: {
|
|
621
|
-
approve: "org.inbox.approve",
|
|
622
|
-
decline: "org.inbox.decline",
|
|
623
|
-
list: "org.inbox.list"
|
|
624
|
-
},
|
|
625
|
-
lifecycle: { startOrResume: "org.lifecycle.startOrResume" },
|
|
626
|
-
prepareBootstrap: "org.prepareBootstrap",
|
|
627
|
-
prepareFounderAccount: "org.prepareFounderAccount",
|
|
628
|
-
profile: {
|
|
629
|
-
depositInstructions: "org.profile.depositInstructions",
|
|
630
|
-
get: "org.profile.get"
|
|
631
|
-
},
|
|
632
|
-
readTreasury: "org.readTreasury",
|
|
633
|
-
requests: {
|
|
634
|
-
cancel: "org.requests.cancel",
|
|
635
|
-
get: "org.requests.get",
|
|
636
|
-
issue: "org.requests.issue",
|
|
637
|
-
list: "org.requests.list"
|
|
638
|
-
},
|
|
639
|
-
recordFailure: "org.recordFailure",
|
|
640
|
-
recordProgress: "org.recordProgress",
|
|
641
|
-
resendInviteToken: "org.resendInviteToken",
|
|
642
|
-
resumeBootstrapSubmission: "org.resumeBootstrapSubmission",
|
|
643
|
-
retry: "org.retry",
|
|
644
|
-
retrySetup: "org.retrySetup",
|
|
645
|
-
roles: "org.roles",
|
|
646
|
-
startOrResume: "org.startOrResume",
|
|
647
|
-
submitBootstrap: "org.submitBootstrap",
|
|
648
|
-
treasury: "org.treasury"
|
|
649
|
-
},
|
|
650
|
-
organization: { setup: "organization.setup" },
|
|
651
|
-
organizationPayments: {
|
|
652
|
-
pay: "organizationPayments.pay",
|
|
653
|
-
payBatch: "organizationPayments.payBatch",
|
|
654
|
-
prepareExecution: "organizationPayments.prepareExecution",
|
|
655
|
-
retry: "organizationPayments.retry"
|
|
656
|
-
},
|
|
657
|
-
organizationSetup: { getProofReceipt: "organizationSetup.getProofReceipt" },
|
|
658
|
-
organizations: { detectAndAcceptPendingInvitations: "orgs.detectAndAcceptPendingInvitations" },
|
|
659
|
-
payments: {
|
|
660
|
-
cancel: "payments.cancel",
|
|
661
|
-
claim: "payments.claim",
|
|
662
|
-
createCommitment: "payments.createCommitment",
|
|
663
|
-
get: "payments.get",
|
|
664
|
-
ledger: "payments",
|
|
665
|
-
list: "payments.list",
|
|
666
|
-
pay: "payments.pay",
|
|
667
|
-
prepareExecution: "payments.prepareExecution",
|
|
668
|
-
prepareLifecycleExecution: "payments.prepareLifecycleExecution",
|
|
669
|
-
redirect: "payments.redirect",
|
|
670
|
-
retry: "payments.retry",
|
|
671
|
-
submitCommandExecution: "payments.submitCommandExecution",
|
|
672
|
-
submitExecution: "payments.submitExecution"
|
|
673
|
-
},
|
|
674
|
-
paymentDocuments: {
|
|
675
|
-
render: "paymentDocuments.render",
|
|
676
|
-
verify: "paymentDocuments.verify"
|
|
677
|
-
},
|
|
678
|
-
recipient: { resolve: "recipient.resolve" },
|
|
679
|
-
payroll: {
|
|
680
|
-
authorizeRun: "payroll.authorizeRun",
|
|
681
|
-
emitGroupChanged: "payroll.emitGroupChanged",
|
|
682
|
-
emitRunTransitioned: "payroll.emitRunTransitioned",
|
|
683
|
-
groups: {
|
|
684
|
-
access: "payroll.groups",
|
|
685
|
-
list: "payroll.groups.list",
|
|
686
|
-
remove: "payroll.groups.remove",
|
|
687
|
-
save: "payroll.groups.save"
|
|
688
|
-
},
|
|
689
|
-
removeGroup: "payroll.removeGroup",
|
|
690
|
-
runs: "payroll.runs",
|
|
691
|
-
saveGroup: "payroll.saveGroup",
|
|
692
|
-
terms: "payroll.terms"
|
|
693
|
-
},
|
|
694
|
-
permission: {
|
|
695
|
-
command: "permission.command",
|
|
696
|
-
retryVerification: "permission.retryVerification",
|
|
697
|
-
verify: "permission.verify",
|
|
698
|
-
verifySubmitted: "permission.verifySubmitted"
|
|
699
|
-
},
|
|
700
|
-
permissions: {
|
|
701
|
-
assign: "permissions.assign",
|
|
702
|
-
change: "permissions.change",
|
|
703
|
-
create: "permissions.create",
|
|
704
|
-
get: "permissions.get",
|
|
705
|
-
list: "permissions.list",
|
|
706
|
-
prepareExecution: "permissions.prepareExecution",
|
|
707
|
-
replace: "permissions.replace",
|
|
708
|
-
revoke: "permissions.revoke",
|
|
709
|
-
submitExecution: "permissions.submitExecution"
|
|
710
|
-
},
|
|
711
|
-
publishableKeys: {
|
|
712
|
-
mint: "publishableKeys.mint",
|
|
713
|
-
revoke: "publishableKeys.revoke",
|
|
714
|
-
rotate: "publishableKeys.rotate"
|
|
715
|
-
},
|
|
716
|
-
requests: {
|
|
717
|
-
cancel: "requests.cancel",
|
|
718
|
-
get: "requests.get",
|
|
719
|
-
issue: "requests.issue",
|
|
720
|
-
list: "requests.list"
|
|
721
|
-
},
|
|
722
|
-
runtime: {
|
|
723
|
-
assign: "assign",
|
|
724
|
-
canSendOtp: "canSendOtp",
|
|
725
|
-
cancelCommitment: "cancel_commitment",
|
|
726
|
-
change: "change",
|
|
727
|
-
claimCommitment: "claim_commitment",
|
|
728
|
-
create: "create",
|
|
729
|
-
createCapxulClient: "createCapxulClient",
|
|
730
|
-
createCapxulClientWithOrgDeploymentSeams: "createCapxulClientWithOrgDeploymentSeams",
|
|
731
|
-
createCommitment: "create_commitment",
|
|
732
|
-
getConvexJwt: "getConvexJwt",
|
|
733
|
-
getSession: "getSession",
|
|
734
|
-
initialize: "initialize",
|
|
735
|
-
mutation: "mutation",
|
|
736
|
-
now: "now",
|
|
737
|
-
port: "port",
|
|
738
|
-
query: "query",
|
|
739
|
-
redirectCommitment: "redirect_commitment",
|
|
740
|
-
replace: "replace",
|
|
741
|
-
resolve: "resolve",
|
|
742
|
-
revoke: "revoke",
|
|
743
|
-
send: "send",
|
|
744
|
-
sendOtp: "sendOtp",
|
|
745
|
-
signIn: "signIn",
|
|
746
|
-
signOut: "signOut",
|
|
747
|
-
sleep: "sleep",
|
|
748
|
-
verifyOtp: "verifyOtp",
|
|
749
|
-
wallet: "wallet"
|
|
750
|
-
},
|
|
751
|
-
smartAccount: {
|
|
752
|
-
claim: "smartAccount.claim",
|
|
753
|
-
confirmDeployment: "smartAccount.confirmDeployment",
|
|
754
|
-
loadByAuthUserId: "smartAccount.loadByAuthUserId",
|
|
755
|
-
loadCurrent: "smartAccount.loadCurrent",
|
|
756
|
-
provision: "smartAccount.provision"
|
|
757
|
-
},
|
|
758
|
-
system: {
|
|
759
|
-
health: "system.health",
|
|
760
|
-
ping: "system.ping",
|
|
761
|
-
runtimeChain: "system.runtimeChain"
|
|
762
|
-
},
|
|
763
|
-
testUsdc: { mint: "TestUSDC.mint" },
|
|
764
|
-
_internal: {
|
|
765
|
-
accounts: { fund: "_internal.accounts.fund" },
|
|
766
|
-
close: "_internal.close",
|
|
767
|
-
identity: {
|
|
768
|
-
completeProfile: "_internal.identity.completeProfile",
|
|
769
|
-
runFacade: "_internal.identity.runFacade",
|
|
770
|
-
send: "_internal.identity.send"
|
|
771
|
-
},
|
|
772
|
-
organizationSetup: { getProofReceipt: "_internal.organizationSetup.getProofReceipt" }
|
|
773
|
-
},
|
|
774
|
-
tenancy: {
|
|
775
|
-
revokeBackendTenancyConsent: "tenancy.revokeBackendTenancyConsent",
|
|
776
|
-
seedBackendTenancy: "tenancy.seedBackendTenancy"
|
|
777
|
-
}
|
|
778
|
-
};
|
|
779
|
-
function collectOperations(tree) {
|
|
780
|
-
return Object.values(tree).flatMap((value) => typeof value === "string" ? [value] : collectOperations(value));
|
|
781
|
-
}
|
|
782
|
-
const operations = new Set(collectOperations(CAPXUL_OPERATIONS));
|
|
783
|
-
function isCapxulOperation(value) {
|
|
784
|
-
return typeof value === "string" && operations.has(value);
|
|
785
|
-
}
|
|
786
|
-
function normalizeCapxulOperation(value) {
|
|
787
|
-
return isCapxulOperation(value) ? value : "unknown";
|
|
788
|
-
}
|
|
789
|
-
//#endregion
|
|
790
|
-
//#region src/index.ts
|
|
791
|
-
const TELEMETRY_EVENT_NAMES = [
|
|
792
|
-
"auth_otp_requested",
|
|
793
|
-
"auth_otp_delivered",
|
|
794
|
-
"auth_otp_expired",
|
|
795
|
-
"auth_verified",
|
|
796
|
-
"auth_failed",
|
|
797
|
-
"identity_refused",
|
|
798
|
-
"auth_signed_out",
|
|
799
|
-
"onboarding_intent_selected",
|
|
800
|
-
"onboarding_profile_submitted",
|
|
801
|
-
"onboarding_organization_submitted",
|
|
802
|
-
"onboarding_dashboard_reached",
|
|
803
|
-
"provisioning_safe_created",
|
|
804
|
-
"provisioning_safe_confirmed",
|
|
805
|
-
"bootstrap_resolved",
|
|
806
|
-
"bootstrap_failed",
|
|
807
|
-
"member_activation_started",
|
|
808
|
-
"member_activation_ready",
|
|
809
|
-
"member_activation_failed",
|
|
810
|
-
"organization_creation_started",
|
|
811
|
-
"organization_creation_ready",
|
|
812
|
-
"organization_creation_failed",
|
|
813
|
-
"chain_upstream_fallback",
|
|
814
|
-
"bundler_error",
|
|
815
|
-
"receipt_pending",
|
|
816
|
-
"operation_retried",
|
|
817
|
-
"account_balance_read",
|
|
818
|
-
"account_balance_failed",
|
|
819
|
-
"faucet_requested",
|
|
820
|
-
"faucet_confirmed",
|
|
821
|
-
"faucet_failed",
|
|
822
|
-
"org_create_started",
|
|
823
|
-
"org_safe_created",
|
|
824
|
-
"org_safe_confirmed",
|
|
825
|
-
"org_roles_seeded",
|
|
826
|
-
"org_created",
|
|
827
|
-
"org_create_failed",
|
|
828
|
-
"org_invite_sent",
|
|
829
|
-
"org_invite_accepted",
|
|
830
|
-
"org_invite_expired",
|
|
831
|
-
"payment_initiated",
|
|
832
|
-
"payment_settled",
|
|
833
|
-
"payment_failed",
|
|
834
|
-
"payment_verification_retry",
|
|
835
|
-
"payment_lifecycle_transition",
|
|
836
|
-
"quick_pay_external_address_acknowledged",
|
|
837
|
-
"deposit_initiated",
|
|
838
|
-
"deposit_settled",
|
|
839
|
-
"permission_mirror_verification",
|
|
840
|
-
"movement_scan_window",
|
|
841
|
-
"movement_scan_checkpoint",
|
|
842
|
-
"movement_scan_incident",
|
|
843
|
-
"indexer_drift_corrected",
|
|
844
|
-
"activity_annotation_saved",
|
|
845
|
-
"ui_activity_action_completed",
|
|
846
|
-
"contact_relationship_changed",
|
|
847
|
-
"ui_contact_action_completed",
|
|
848
|
-
"access_recovery_completed",
|
|
849
|
-
"ui_access_step_completed",
|
|
850
|
-
"org_invite_progressed",
|
|
851
|
-
"invoice_issued",
|
|
852
|
-
"invoice_request_transitioned",
|
|
853
|
-
"ui_invoice_step_completed",
|
|
854
|
-
"ui_treasury_step_completed",
|
|
855
|
-
"ui_receive_step_completed",
|
|
856
|
-
"payroll_group_changed",
|
|
857
|
-
"payroll_run_transitioned",
|
|
858
|
-
"ui_payroll_action_completed",
|
|
859
|
-
"cli_diagnostic_completed",
|
|
860
|
-
"cli_first_used",
|
|
861
|
-
"cli_command_started",
|
|
862
|
-
"cli_command_completed"
|
|
863
|
-
];
|
|
864
|
-
const TELEMETRY_JOURNEYS = {
|
|
865
|
-
returning_user_login: {
|
|
866
|
-
type: "funnel",
|
|
867
|
-
steps: [
|
|
868
|
-
"auth_otp_requested",
|
|
869
|
-
"auth_otp_delivered",
|
|
870
|
-
"auth_verified"
|
|
871
|
-
],
|
|
872
|
-
drops_on: ["auth_otp_expired", "auth_failed"]
|
|
873
|
-
},
|
|
874
|
-
new_user_first_signin: {
|
|
875
|
-
type: "funnel",
|
|
876
|
-
steps: [
|
|
877
|
-
"auth_otp_requested",
|
|
878
|
-
"auth_otp_delivered",
|
|
879
|
-
"auth_verified",
|
|
880
|
-
"provisioning_safe_created",
|
|
881
|
-
"provisioning_safe_confirmed"
|
|
882
|
-
],
|
|
883
|
-
drops_on: ["auth_otp_expired", "auth_failed"]
|
|
884
|
-
},
|
|
885
|
-
sign_out_session_close: {
|
|
886
|
-
type: "point_event",
|
|
887
|
-
point_event: "auth_signed_out"
|
|
888
|
-
},
|
|
889
|
-
member_activation: {
|
|
890
|
-
type: "funnel",
|
|
891
|
-
steps: ["member_activation_started", "member_activation_ready"],
|
|
892
|
-
drops_on: ["member_activation_failed"]
|
|
893
|
-
},
|
|
894
|
-
organization_creation_lifecycle: {
|
|
895
|
-
type: "funnel",
|
|
896
|
-
steps: ["organization_creation_started", "organization_creation_ready"],
|
|
897
|
-
drops_on: ["organization_creation_failed"]
|
|
898
|
-
},
|
|
899
|
-
new_member_personal_dashboard: {
|
|
900
|
-
type: "funnel",
|
|
901
|
-
steps: [
|
|
902
|
-
"auth_verified",
|
|
903
|
-
"onboarding_intent_selected",
|
|
904
|
-
"onboarding_profile_submitted",
|
|
905
|
-
"member_activation_ready",
|
|
906
|
-
"onboarding_dashboard_reached"
|
|
907
|
-
],
|
|
908
|
-
step_filters: {
|
|
909
|
-
onboarding_intent_selected: [{
|
|
910
|
-
key: "intent",
|
|
911
|
-
value: ["personal"],
|
|
912
|
-
operator: "exact",
|
|
913
|
-
type: "event"
|
|
914
|
-
}, {
|
|
915
|
-
key: "entry_point",
|
|
916
|
-
value: ["signup"],
|
|
917
|
-
operator: "exact",
|
|
918
|
-
type: "event"
|
|
919
|
-
}],
|
|
920
|
-
onboarding_profile_submitted: [{
|
|
921
|
-
key: "intent",
|
|
922
|
-
value: ["personal"],
|
|
923
|
-
operator: "exact",
|
|
924
|
-
type: "event"
|
|
925
|
-
}],
|
|
926
|
-
onboarding_dashboard_reached: [{
|
|
927
|
-
key: "intent",
|
|
928
|
-
value: ["personal"],
|
|
929
|
-
operator: "exact",
|
|
930
|
-
type: "event"
|
|
931
|
-
}]
|
|
932
|
-
}
|
|
933
|
-
},
|
|
934
|
-
new_member_organization_dashboard: {
|
|
935
|
-
type: "funnel",
|
|
936
|
-
steps: [
|
|
937
|
-
"auth_verified",
|
|
938
|
-
"onboarding_intent_selected",
|
|
939
|
-
"onboarding_profile_submitted",
|
|
940
|
-
"onboarding_organization_submitted",
|
|
941
|
-
"member_activation_started",
|
|
942
|
-
"member_activation_ready",
|
|
943
|
-
"organization_creation_started",
|
|
944
|
-
"organization_creation_ready",
|
|
945
|
-
"onboarding_dashboard_reached"
|
|
946
|
-
],
|
|
947
|
-
step_filters: {
|
|
948
|
-
onboarding_intent_selected: [{
|
|
949
|
-
key: "intent",
|
|
950
|
-
value: ["organization"],
|
|
951
|
-
operator: "exact",
|
|
952
|
-
type: "event"
|
|
953
|
-
}, {
|
|
954
|
-
key: "entry_point",
|
|
955
|
-
value: ["signup"],
|
|
956
|
-
operator: "exact",
|
|
957
|
-
type: "event"
|
|
958
|
-
}],
|
|
959
|
-
onboarding_profile_submitted: [{
|
|
960
|
-
key: "intent",
|
|
961
|
-
value: ["organization"],
|
|
962
|
-
operator: "exact",
|
|
963
|
-
type: "event"
|
|
964
|
-
}],
|
|
965
|
-
onboarding_dashboard_reached: [{
|
|
966
|
-
key: "intent",
|
|
967
|
-
value: ["organization"],
|
|
968
|
-
operator: "exact",
|
|
969
|
-
type: "event"
|
|
970
|
-
}]
|
|
971
|
-
}
|
|
972
|
-
},
|
|
973
|
-
existing_member_organization_dashboard: {
|
|
974
|
-
type: "funnel",
|
|
975
|
-
steps: [
|
|
976
|
-
"onboarding_intent_selected",
|
|
977
|
-
"onboarding_organization_submitted",
|
|
978
|
-
"organization_creation_started",
|
|
979
|
-
"organization_creation_ready",
|
|
980
|
-
"onboarding_dashboard_reached"
|
|
981
|
-
],
|
|
982
|
-
step_filters: {
|
|
983
|
-
onboarding_intent_selected: [{
|
|
984
|
-
key: "intent",
|
|
985
|
-
value: ["organization"],
|
|
986
|
-
operator: "exact",
|
|
987
|
-
type: "event"
|
|
988
|
-
}, {
|
|
989
|
-
key: "entry_point",
|
|
990
|
-
value: ["dashboard"],
|
|
991
|
-
operator: "exact",
|
|
992
|
-
type: "event"
|
|
993
|
-
}],
|
|
994
|
-
onboarding_dashboard_reached: [{
|
|
995
|
-
key: "intent",
|
|
996
|
-
value: ["organization"],
|
|
997
|
-
operator: "exact",
|
|
998
|
-
type: "event"
|
|
999
|
-
}]
|
|
1000
|
-
}
|
|
1001
|
-
},
|
|
1002
|
-
money_on_screen: {
|
|
1003
|
-
type: "point_event",
|
|
1004
|
-
point_event: "account_balance_read"
|
|
1005
|
-
},
|
|
1006
|
-
fund_account: {
|
|
1007
|
-
type: "funnel",
|
|
1008
|
-
steps: ["faucet_requested", "faucet_confirmed"],
|
|
1009
|
-
drops_on: ["faucet_failed"]
|
|
1010
|
-
},
|
|
1011
|
-
org_creation: {
|
|
1012
|
-
type: "funnel",
|
|
1013
|
-
steps: [
|
|
1014
|
-
"org_create_started",
|
|
1015
|
-
"org_safe_created",
|
|
1016
|
-
"org_safe_confirmed",
|
|
1017
|
-
"org_roles_seeded",
|
|
1018
|
-
"org_created"
|
|
1019
|
-
],
|
|
1020
|
-
drops_on: ["org_create_failed"]
|
|
1021
|
-
},
|
|
1022
|
-
org_member_onboarding: {
|
|
1023
|
-
type: "funnel",
|
|
1024
|
-
steps: ["org_invite_sent", "org_invite_accepted"],
|
|
1025
|
-
drops_on: ["org_invite_expired"]
|
|
1026
|
-
},
|
|
1027
|
-
direct_payment: {
|
|
1028
|
-
type: "funnel",
|
|
1029
|
-
steps: ["payment_initiated", "payment_settled"],
|
|
1030
|
-
drops_on: ["payment_failed"]
|
|
1031
|
-
},
|
|
1032
|
-
deposit: {
|
|
1033
|
-
type: "funnel",
|
|
1034
|
-
steps: ["deposit_initiated", "deposit_settled"]
|
|
1035
|
-
}
|
|
1036
|
-
};
|
|
1037
|
-
const PII = Schema.String.pipe(Schema.brand("PII"));
|
|
1038
|
-
const OptionalString = Schema.optional(Schema.String);
|
|
1039
|
-
const AddressSchema = Schema.String.pipe(Schema.decodeTo(Schema.String, {
|
|
1040
|
-
decode: SchemaGetter.transform((value) => value.toLowerCase()),
|
|
1041
|
-
encode: SchemaGetter.transform((value) => value)
|
|
1042
|
-
}), Schema.refine((value) => EVM_ADDRESS_RE.test(value), { message: "must be 0x + 40 hex chars" }));
|
|
1043
|
-
const AppIdSchema = Schema.String.pipe(Schema.refine((value) => APP_ID_RE.test(value), { message: "must be app_ plus a ULID" }));
|
|
1044
|
-
const BlockNumberSchema = Schema.Number.pipe(Schema.refine((value) => Number.isSafeInteger(value) && value >= 0, { message: "must be a non-negative safe integer" }));
|
|
1045
|
-
const ChainIdSchema = Schema.Number.pipe(Schema.refine((value) => Number.isSafeInteger(value) && value > 0, { message: "must be a positive safe integer" }));
|
|
1046
|
-
const DurationMsSchema = Schema.Number.pipe(Schema.refine((value) => Number.isSafeInteger(value) && value >= 0, { message: "must be a non-negative safe integer" }));
|
|
1047
|
-
const EpochMsSchema = Schema.Number.pipe(Schema.refine((value) => Number.isSafeInteger(value) && value >= 0, { message: "must be a non-negative safe integer" }));
|
|
1048
|
-
const PublishableKeyIdSchema = Schema.String.pipe(Schema.refine((value) => value.length > 0, { message: "must be a non-empty string" }));
|
|
1049
|
-
const TxHashSchema = Schema.String.pipe(Schema.refine((value) => BYTES32_RE.test(value), { message: "must be 0x + 64 hex chars" }));
|
|
1050
|
-
const ACCOUNT_ID_TELEMETRY_RE = /^account_[0-9A-Za-z]+$/;
|
|
1051
|
-
const WEI_AMOUNT_TELEMETRY_RE = /^[0-9]+$/;
|
|
1052
|
-
const AccountIdSchema = Schema.String.pipe(Schema.refine((value) => ACCOUNT_ID_TELEMETRY_RE.test(value), { message: "must be account_ plus an alphanumeric id" }));
|
|
1053
|
-
const WeiAmountSchema = Schema.String.pipe(Schema.refine((value) => WEI_AMOUNT_TELEMETRY_RE.test(value), { message: "must be a non-negative integer string" }));
|
|
1054
|
-
const CurrencyCodeSchema = Schema.String.pipe(Schema.refine((value) => value.length > 0, { message: "must be a non-empty currency code" }));
|
|
1055
|
-
const BalanceBucketSchema = Schema.Literals(["zero", "nonzero"]);
|
|
1056
|
-
const OptionalAccountId = Schema.optional(AccountIdSchema);
|
|
1057
|
-
const OptionalWeiAmount = Schema.optional(WeiAmountSchema);
|
|
1058
|
-
const OptionalCurrencyCode = Schema.optional(CurrencyCodeSchema);
|
|
1059
|
-
const OptionalBalanceBucket = Schema.optional(BalanceBucketSchema);
|
|
1060
|
-
/** Which Safe a money record is about. Declared here so the money-domain
|
|
1061
|
-
* props below can name it as well as the UI-step props further down. */
|
|
1062
|
-
const AccountKindSchema = Schema.Literals(["personalSafe", "orgTreasury"]);
|
|
1063
|
-
const OptionalAccountKind = Schema.optional(AccountKindSchema);
|
|
1064
|
-
const OptionalAddress = Schema.optional(AddressSchema);
|
|
1065
|
-
const OptionalAppId = Schema.optional(AppIdSchema);
|
|
1066
|
-
const OptionalBlockNumber = Schema.optional(BlockNumberSchema);
|
|
1067
|
-
const OptionalChainId = Schema.optional(ChainIdSchema);
|
|
1068
|
-
const OptionalDurationMs = Schema.optional(DurationMsSchema);
|
|
1069
|
-
const OptionalEpochMs = Schema.optional(EpochMsSchema);
|
|
1070
|
-
const OptionalPublishableKeyId = Schema.optional(PublishableKeyIdSchema);
|
|
1071
|
-
const OptionalTxHash = Schema.optional(TxHashSchema);
|
|
1072
|
-
/**
|
|
1073
|
-
* Environment discriminator (ADR-0020 A1 amendment, 2026-08-07). PostHog
|
|
1074
|
-
* project 368736 is the SINGLE sink for every environment, so `capxul_env` —
|
|
1075
|
-
* not project isolation — is what keeps a production surface from reading dev
|
|
1076
|
-
* traffic. It is REQUIRED on every catalog event and every synced artifact
|
|
1077
|
-
* filters on it.
|
|
1078
|
-
*
|
|
1079
|
-
* `unknown` is a defect marker, not an environment: it means a producer
|
|
1080
|
-
* reached the transport without declaring where it runs. It is in the union so
|
|
1081
|
-
* the property is never ABSENT (an absent property is invisible to a filter,
|
|
1082
|
-
* a present `unknown` is loud), and sync v2 never synthesizes an artifact for
|
|
1083
|
-
* it.
|
|
1084
|
-
*/
|
|
1085
|
-
const CAPXUL_ENVS = [
|
|
1086
|
-
"development",
|
|
1087
|
-
"staging",
|
|
1088
|
-
"production",
|
|
1089
|
-
"unknown",
|
|
1090
|
-
"local"
|
|
1091
|
-
];
|
|
1092
|
-
/**
|
|
1093
|
-
* Environments a synced product surface may be built for. `unknown` and
|
|
1094
|
-
* `local` cannot. This list is deliberately narrower than `CAPXUL_ENVS`.
|
|
1095
|
-
*/
|
|
1096
|
-
const SYNCABLE_CAPXUL_ENVS = [
|
|
1097
|
-
"development",
|
|
1098
|
-
"staging",
|
|
1099
|
-
"production"
|
|
1100
|
-
];
|
|
1101
|
-
/**
|
|
1102
|
-
* Which half of the system emitted the event. REQUIRED alongside `capxul_env`
|
|
1103
|
-
* so a name that two halves can produce (settlement, auth) stays attributable.
|
|
1104
|
-
*/
|
|
1105
|
-
const TELEMETRY_PRODUCERS = [
|
|
1106
|
-
"server",
|
|
1107
|
-
"browser",
|
|
1108
|
-
"sdk",
|
|
1109
|
-
"mcp",
|
|
1110
|
-
"e2e"
|
|
1111
|
-
];
|
|
1112
|
-
/**
|
|
1113
|
-
* The canonical envelope (ADR-0020 A4): snake_case ONLY. `capxul_env` and
|
|
1114
|
-
* `producer` are REQUIRED — a boundary that forgets to stamp them fails schema
|
|
1115
|
-
* decode instead of silently shipping an unattributable event. Call sites do
|
|
1116
|
-
* not pass them: `stampTelemetryEnvelope` injects them at the emit boundary,
|
|
1117
|
-
* which is the only place that knows where the process runs.
|
|
1118
|
-
*/
|
|
1119
|
-
const TelemetryEnvelopeProps = {
|
|
1120
|
-
capxul_env: Schema.Literals(CAPXUL_ENVS),
|
|
1121
|
-
producer: Schema.Literals(TELEMETRY_PRODUCERS),
|
|
1122
|
-
journey_id: OptionalString,
|
|
1123
|
-
correlation_id: OptionalString,
|
|
1124
|
-
sdk_version: OptionalString
|
|
1125
|
-
};
|
|
1126
|
-
/**
|
|
1127
|
-
* The cause of a failure, flat (ADR-0023 R7–R8). `failure_mode` is the one
|
|
1128
|
-
* word from `@capxul/errors`; the `chain_*` keys are the `ChainCause` when the
|
|
1129
|
-
* failure came from the chain path. Spread into every failure event and posted
|
|
1130
|
-
* on `$exception`, so one PostHog filter finds a cause wherever it was seen.
|
|
1131
|
-
*/
|
|
1132
|
-
const FailureModeSchema = Schema.Literals(FAILURE_MODES);
|
|
1133
|
-
const ChainUpstreamSchema = Schema.Literals(CHAIN_UPSTREAMS);
|
|
1134
|
-
/**
|
|
1135
|
-
* The refusing upstream's response headers (#1818): exactly the names in
|
|
1136
|
-
* `RESPONSE_HEADER_ALLOWLIST`, each optional, so the catalog itself refuses a
|
|
1137
|
-
* `set-cookie` or `authorization` that a producer let through.
|
|
1138
|
-
*/
|
|
1139
|
-
const ResponseHeadersSchema = Schema.Struct({
|
|
1140
|
-
"retry-after": OptionalString,
|
|
1141
|
-
"www-authenticate": OptionalString,
|
|
1142
|
-
"content-type": OptionalString,
|
|
1143
|
-
"x-request-id": OptionalString,
|
|
1144
|
-
"cf-ray": OptionalString,
|
|
1145
|
-
"x-ratelimit-remaining": OptionalString,
|
|
1146
|
-
"x-ratelimit-reset": OptionalString,
|
|
1147
|
-
server: OptionalString
|
|
1148
|
-
});
|
|
1149
|
-
/** One upstream tried, flat (#1818): the `chain_attempts` entry on every producer's row. */
|
|
1150
|
-
const ChainAttemptSchema = Schema.Struct({
|
|
1151
|
-
upstream: ChainUpstreamSchema,
|
|
1152
|
-
failure_mode: FailureModeSchema,
|
|
1153
|
-
http_status: Schema.optional(Schema.Number),
|
|
1154
|
-
rpc_code: Schema.optional(Schema.Number),
|
|
1155
|
-
duration_ms: Schema.Number
|
|
1156
|
-
});
|
|
1157
|
-
const ChainCauseTelemetryProps = {
|
|
1158
|
-
failure_mode: Schema.optional(FailureModeSchema),
|
|
1159
|
-
chain_upstream: Schema.optional(ChainUpstreamSchema),
|
|
1160
|
-
chain_method: OptionalString,
|
|
1161
|
-
chain_retryable: Schema.optional(Schema.Boolean),
|
|
1162
|
-
chain_http_status: Schema.optional(Schema.Number),
|
|
1163
|
-
chain_rpc_code: Schema.optional(Schema.Number),
|
|
1164
|
-
chain_revert_name: OptionalString,
|
|
1165
|
-
chain_revert_selector: OptionalString,
|
|
1166
|
-
chain_revert_args: Schema.optional(Schema.Record(Schema.String, Schema.String)),
|
|
1167
|
-
chain_provider_message: OptionalString,
|
|
1168
|
-
chain_attempts: Schema.optional(Schema.Array(ChainAttemptSchema)),
|
|
1169
|
-
chain_response_headers: Schema.optional(ResponseHeadersSchema)
|
|
1170
|
-
};
|
|
1171
|
-
/**
|
|
1172
|
-
* Stamp the required envelope onto an event at its emit boundary. Call-site
|
|
1173
|
-
* props win on conflict: a relay that already knows the true producer (the
|
|
1174
|
-
* browser-failure relay stamps `browser` while running on the server) must not
|
|
1175
|
-
* be overwritten by the transport's own default.
|
|
1176
|
-
*/
|
|
1177
|
-
function stampTelemetryEnvelope(event, defaults) {
|
|
1178
|
-
return {
|
|
1179
|
-
name: event.name,
|
|
1180
|
-
props: {
|
|
1181
|
-
...defaults,
|
|
1182
|
-
...event.props
|
|
1183
|
-
}
|
|
1184
|
-
};
|
|
1185
|
-
}
|
|
1186
|
-
const AuthOtpRequestedProps = Schema.Struct({
|
|
1187
|
-
...TelemetryEnvelopeProps,
|
|
1188
|
-
email: Schema.optional(PII),
|
|
1189
|
-
email_domain: OptionalString
|
|
1190
|
-
});
|
|
1191
|
-
const AuthOtpDeliveredProps = Schema.Struct({
|
|
1192
|
-
...TelemetryEnvelopeProps,
|
|
1193
|
-
durationMs: OptionalDurationMs,
|
|
1194
|
-
email: Schema.optional(PII),
|
|
1195
|
-
email_domain: OptionalString,
|
|
1196
|
-
resendMessageId: OptionalString
|
|
1197
|
-
});
|
|
1198
|
-
const AuthOtpExpiredProps = Schema.Struct({
|
|
1199
|
-
...TelemetryEnvelopeProps,
|
|
1200
|
-
email: Schema.optional(PII),
|
|
1201
|
-
email_domain: OptionalString
|
|
1202
|
-
});
|
|
1203
|
-
const AuthVerifiedProps = Schema.Struct({
|
|
1204
|
-
...TelemetryEnvelopeProps,
|
|
1205
|
-
auth_type: OptionalString
|
|
1206
|
-
});
|
|
1207
|
-
const AuthFailedProps = Schema.Struct({
|
|
1208
|
-
...TelemetryEnvelopeProps,
|
|
1209
|
-
...ChainCauseTelemetryProps,
|
|
1210
|
-
email: Schema.optional(PII),
|
|
1211
|
-
auth_type: OptionalString,
|
|
1212
|
-
reason: OptionalString
|
|
1213
|
-
});
|
|
1214
|
-
const IdentityRefusedProps = Schema.Struct({
|
|
1215
|
-
...TelemetryEnvelopeProps,
|
|
1216
|
-
/** The refused identity event tag, for example CreateOrganization. */
|
|
1217
|
-
event: OptionalString,
|
|
1218
|
-
/** The machine's refusal code: WRONG_STATE, SUPERSEDED or STALE_EPOCH. */
|
|
1219
|
-
refusal_code: OptionalString,
|
|
1220
|
-
/** The machine slot the request targeted, for example identity:org. */
|
|
1221
|
-
slot: OptionalString,
|
|
1222
|
-
/** The machine state at refusal, for example authenticated:claiming. */
|
|
1223
|
-
state: OptionalString
|
|
1224
|
-
});
|
|
1225
|
-
const AuthSignedOutProps = Schema.Struct(TelemetryEnvelopeProps);
|
|
1226
|
-
const ProvisioningSafeCreatedProps = Schema.Struct({
|
|
1227
|
-
...TelemetryEnvelopeProps,
|
|
1228
|
-
safe_address: OptionalAddress
|
|
1229
|
-
});
|
|
1230
|
-
const ProvisioningSafeConfirmedProps = Schema.Struct({
|
|
1231
|
-
...TelemetryEnvelopeProps,
|
|
1232
|
-
chainId: OptionalChainId,
|
|
1233
|
-
deployedAt: OptionalEpochMs,
|
|
1234
|
-
deployedAtBlock: OptionalBlockNumber,
|
|
1235
|
-
deployTxHash: OptionalTxHash,
|
|
1236
|
-
durationMs: OptionalDurationMs,
|
|
1237
|
-
safe_address: OptionalAddress,
|
|
1238
|
-
userOpHash: OptionalTxHash
|
|
1239
|
-
});
|
|
1240
|
-
const BootstrapResolvedProps = Schema.Struct({
|
|
1241
|
-
...TelemetryEnvelopeProps,
|
|
1242
|
-
applicationId: OptionalAppId,
|
|
1243
|
-
durationMs: OptionalDurationMs,
|
|
1244
|
-
env: OptionalString,
|
|
1245
|
-
keyId: OptionalPublishableKeyId,
|
|
1246
|
-
origin: OptionalString
|
|
1247
|
-
});
|
|
1248
|
-
const BootstrapFailedProps = Schema.Struct({
|
|
1249
|
-
...TelemetryEnvelopeProps,
|
|
1250
|
-
...ChainCauseTelemetryProps,
|
|
1251
|
-
applicationId: OptionalAppId,
|
|
1252
|
-
durationMs: OptionalDurationMs,
|
|
1253
|
-
origin: OptionalString,
|
|
1254
|
-
provider: OptionalString,
|
|
1255
|
-
provider_operation: OptionalString,
|
|
1256
|
-
reason: OptionalString,
|
|
1257
|
-
target_host: OptionalString
|
|
1258
|
-
});
|
|
1259
|
-
/**
|
|
1260
|
-
* R08 (#1966): which Safe was read, on which chain, of which token. `currency`
|
|
1261
|
-
* is the DISPLAY code the surface shows ("USD"); it never says which ERC-20 the
|
|
1262
|
-
* `balanceOf` actually hit, so a reader could not tell a treasury read from a
|
|
1263
|
-
* personal one, nor USDX from any other dollar-labelled token. The producer
|
|
1264
|
-
* takes each of these from the authority that already decided it — the verified
|
|
1265
|
-
* Organization row's chain, the configured token address — never from a label.
|
|
1266
|
-
* The verified `organization_id` and its group arrive from the backend
|
|
1267
|
-
* attribution, so they are not repeated here.
|
|
1268
|
-
*/
|
|
1269
|
-
const AccountBalanceReadProps = Schema.Struct({
|
|
1270
|
-
...TelemetryEnvelopeProps,
|
|
1271
|
-
account_id: OptionalAccountId,
|
|
1272
|
-
account_kind: OptionalAccountKind,
|
|
1273
|
-
chain_id: OptionalChainId,
|
|
1274
|
-
token_address: OptionalAddress,
|
|
1275
|
-
currency: OptionalCurrencyCode,
|
|
1276
|
-
balance_bucket: OptionalBalanceBucket,
|
|
1277
|
-
durationMs: OptionalDurationMs
|
|
1278
|
-
});
|
|
1279
|
-
const AccountBalanceFailedProps = Schema.Struct({
|
|
1280
|
-
...TelemetryEnvelopeProps,
|
|
1281
|
-
...ChainCauseTelemetryProps,
|
|
1282
|
-
reason: OptionalString
|
|
1283
|
-
});
|
|
1284
|
-
const FaucetRequestedProps = Schema.Struct({
|
|
1285
|
-
...TelemetryEnvelopeProps,
|
|
1286
|
-
amount: OptionalWeiAmount,
|
|
1287
|
-
chainId: OptionalChainId
|
|
1288
|
-
});
|
|
1289
|
-
const FaucetConfirmedProps = Schema.Struct({
|
|
1290
|
-
...TelemetryEnvelopeProps,
|
|
1291
|
-
amount: OptionalWeiAmount,
|
|
1292
|
-
chainId: OptionalChainId,
|
|
1293
|
-
txHash: OptionalTxHash,
|
|
1294
|
-
durationMs: OptionalDurationMs
|
|
1295
|
-
});
|
|
1296
|
-
const FaucetFailedProps = Schema.Struct({
|
|
1297
|
-
...TelemetryEnvelopeProps,
|
|
1298
|
-
...ChainCauseTelemetryProps,
|
|
1299
|
-
reason: OptionalString
|
|
1300
|
-
});
|
|
1301
|
-
const ChainServiceSchema = Schema.Literals(["aa-gateway", "backend"]);
|
|
1302
|
-
const ChainUpstreamFallbackProps = Schema.Struct({
|
|
1303
|
-
...TelemetryEnvelopeProps,
|
|
1304
|
-
service: ChainServiceSchema,
|
|
1305
|
-
method: Schema.String,
|
|
1306
|
-
from_upstream: ChainUpstreamSchema,
|
|
1307
|
-
to_upstream: Schema.optional(ChainUpstreamSchema),
|
|
1308
|
-
failure_mode: FailureModeSchema,
|
|
1309
|
-
exhausted: Schema.Boolean,
|
|
1310
|
-
http_status: Schema.optional(Schema.Number),
|
|
1311
|
-
rpc_code: Schema.optional(Schema.Number),
|
|
1312
|
-
response_headers: Schema.optional(ResponseHeadersSchema)
|
|
1313
|
-
});
|
|
1314
|
-
const BundlerErrorProps = Schema.Struct({
|
|
1315
|
-
...TelemetryEnvelopeProps,
|
|
1316
|
-
method: Schema.String,
|
|
1317
|
-
failure_mode: FailureModeSchema,
|
|
1318
|
-
chain_upstream: ChainUpstreamSchema,
|
|
1319
|
-
chain_retryable: Schema.Boolean,
|
|
1320
|
-
http_status: Schema.optional(Schema.Number),
|
|
1321
|
-
rpc_code: Schema.optional(Schema.Number),
|
|
1322
|
-
chain_revert_name: OptionalString,
|
|
1323
|
-
chain_provider_message: OptionalString
|
|
1324
|
-
});
|
|
1325
|
-
const ReceiptPendingProps = Schema.Struct({
|
|
1326
|
-
...TelemetryEnvelopeProps,
|
|
1327
|
-
service: ChainServiceSchema,
|
|
1328
|
-
method: Schema.String,
|
|
1329
|
-
chain_upstream: ChainUpstreamSchema,
|
|
1330
|
-
reason: Schema.Literals(["zero_block_hash", "no_receipt"])
|
|
1331
|
-
});
|
|
1332
|
-
const OperationRetriedProps = Schema.Struct({
|
|
1333
|
-
...TelemetryEnvelopeProps,
|
|
1334
|
-
operation: Schema.String,
|
|
1335
|
-
failure_mode: FailureModeSchema,
|
|
1336
|
-
reason: Schema.optional(Schema.Literal("connection-lost-in-flight")),
|
|
1337
|
-
connection_id: OptionalString,
|
|
1338
|
-
connection_count: Schema.optional(Schema.Number),
|
|
1339
|
-
attempt: Schema.Number,
|
|
1340
|
-
delay_ms: DurationMsSchema
|
|
1341
|
-
});
|
|
1342
|
-
const ORG_ID_TELEMETRY_RE = /^org_[0-9A-Za-z]+$/;
|
|
1343
|
-
const OrgIdTelemetrySchema = Schema.String.pipe(Schema.refine((value) => ORG_ID_TELEMETRY_RE.test(value), { message: "must be org_ plus an alphanumeric id" }));
|
|
1344
|
-
const OptionalOrgId = Schema.optional(OrgIdTelemetrySchema);
|
|
1345
|
-
const AttemptNumberSchema = Schema.Number.pipe(Schema.refine((value) => Number.isSafeInteger(value) && value > 0, { message: "must be a positive safe integer" }));
|
|
1346
|
-
const OnboardingStageSchema = Schema.Literals([
|
|
1347
|
-
"profile",
|
|
1348
|
-
"accountProvisioning",
|
|
1349
|
-
"accountClaim",
|
|
1350
|
-
"preparingFounderAccount",
|
|
1351
|
-
"awaitingFounderAuthorization",
|
|
1352
|
-
"submittingBootstrap",
|
|
1353
|
-
"confirmingBootstrap"
|
|
1354
|
-
]);
|
|
1355
|
-
const MemberActivationStartedProps = Schema.Struct({
|
|
1356
|
-
...TelemetryEnvelopeProps,
|
|
1357
|
-
$insert_id: Schema.String
|
|
1358
|
-
});
|
|
1359
|
-
const MemberActivationReadyProps = Schema.Struct({
|
|
1360
|
-
...TelemetryEnvelopeProps,
|
|
1361
|
-
$insert_id: Schema.String,
|
|
1362
|
-
duration_ms: DurationMsSchema
|
|
1363
|
-
});
|
|
1364
|
-
const MemberActivationFailedProps = Schema.Struct({
|
|
1365
|
-
...TelemetryEnvelopeProps,
|
|
1366
|
-
...ChainCauseTelemetryProps,
|
|
1367
|
-
$insert_id: Schema.String,
|
|
1368
|
-
stage: OnboardingStageSchema,
|
|
1369
|
-
error_code: Schema.String,
|
|
1370
|
-
retryable: Schema.Boolean
|
|
1371
|
-
});
|
|
1372
|
-
const OrganizationCreationStartedProps = Schema.Struct({
|
|
1373
|
-
...TelemetryEnvelopeProps,
|
|
1374
|
-
$insert_id: Schema.String,
|
|
1375
|
-
organization_id: OrgIdTelemetrySchema,
|
|
1376
|
-
attempt_number: AttemptNumberSchema
|
|
1377
|
-
});
|
|
1378
|
-
const OrganizationCreationReadyProps = Schema.Struct({
|
|
1379
|
-
...TelemetryEnvelopeProps,
|
|
1380
|
-
$insert_id: Schema.String,
|
|
1381
|
-
organization_id: OrgIdTelemetrySchema,
|
|
1382
|
-
attempt_number: AttemptNumberSchema,
|
|
1383
|
-
duration_ms: DurationMsSchema
|
|
1384
|
-
});
|
|
1385
|
-
const OrganizationCreationFailedProps = Schema.Struct({
|
|
1386
|
-
...TelemetryEnvelopeProps,
|
|
1387
|
-
...ChainCauseTelemetryProps,
|
|
1388
|
-
$insert_id: Schema.String,
|
|
1389
|
-
organization_id: OrgIdTelemetrySchema,
|
|
1390
|
-
attempt_number: AttemptNumberSchema,
|
|
1391
|
-
stage: OnboardingStageSchema,
|
|
1392
|
-
error_code: Schema.String,
|
|
1393
|
-
retryable: Schema.Boolean,
|
|
1394
|
-
/** #1655: the SDK's backoff before this attempt. Absent on the first attempt. */
|
|
1395
|
-
backoff_ms: Schema.optional(DurationMsSchema),
|
|
1396
|
-
failure_reason: Schema.optional(Schema.Literals([
|
|
1397
|
-
"deterministic_address_mismatch",
|
|
1398
|
-
"receipt_provider_unavailable",
|
|
1399
|
-
"receipt_mismatch",
|
|
1400
|
-
"block_provider_unavailable",
|
|
1401
|
-
"authority_event_mismatch",
|
|
1402
|
-
"allowance_timestamp_mismatch",
|
|
1403
|
-
"receipt_identity_unavailable",
|
|
1404
|
-
"receipt_identity_mismatch",
|
|
1405
|
-
"contract_code_unavailable",
|
|
1406
|
-
"contract_state_mismatch",
|
|
1407
|
-
"permission_projection_mismatch"
|
|
1408
|
-
]))
|
|
1409
|
-
});
|
|
1410
|
-
const OnboardingIntentSchema = Schema.Literals(["personal", "organization"]);
|
|
1411
|
-
const OnboardingIntentSelectedProps = Schema.Struct({
|
|
1412
|
-
...TelemetryEnvelopeProps,
|
|
1413
|
-
journey_id: Schema.String,
|
|
1414
|
-
intent: OnboardingIntentSchema,
|
|
1415
|
-
entry_point: Schema.String
|
|
1416
|
-
});
|
|
1417
|
-
const OnboardingProfileSubmittedProps = Schema.Struct({
|
|
1418
|
-
...TelemetryEnvelopeProps,
|
|
1419
|
-
journey_id: Schema.String,
|
|
1420
|
-
intent: OnboardingIntentSchema
|
|
1421
|
-
});
|
|
1422
|
-
const OnboardingOrganizationSubmittedProps = Schema.Struct({
|
|
1423
|
-
...TelemetryEnvelopeProps,
|
|
1424
|
-
journey_id: Schema.String
|
|
1425
|
-
});
|
|
1426
|
-
const OnboardingDashboardReachedProps = Schema.Struct({
|
|
1427
|
-
...TelemetryEnvelopeProps,
|
|
1428
|
-
journey_id: Schema.String,
|
|
1429
|
-
intent: OnboardingIntentSchema,
|
|
1430
|
-
organization_id: Schema.optional(OrgIdTelemetrySchema)
|
|
1431
|
-
});
|
|
1432
|
-
const OrgCreateStartedProps = Schema.Struct({
|
|
1433
|
-
...TelemetryEnvelopeProps,
|
|
1434
|
-
org_id: OptionalOrgId,
|
|
1435
|
-
email_domain: OptionalString,
|
|
1436
|
-
template: OptionalString
|
|
1437
|
-
});
|
|
1438
|
-
const OrgSafeCreatedProps = Schema.Struct({
|
|
1439
|
-
...TelemetryEnvelopeProps,
|
|
1440
|
-
org_id: OptionalOrgId,
|
|
1441
|
-
chainId: OptionalChainId,
|
|
1442
|
-
safe_address: OptionalAddress
|
|
1443
|
-
});
|
|
1444
|
-
const OrgSafeConfirmedProps = Schema.Struct({
|
|
1445
|
-
...TelemetryEnvelopeProps,
|
|
1446
|
-
org_id: OptionalOrgId,
|
|
1447
|
-
chainId: OptionalChainId,
|
|
1448
|
-
safe_address: OptionalAddress,
|
|
1449
|
-
durationMs: OptionalDurationMs
|
|
1450
|
-
});
|
|
1451
|
-
const OrgRolesSeededProps = Schema.Struct({
|
|
1452
|
-
...TelemetryEnvelopeProps,
|
|
1453
|
-
org_id: OptionalOrgId,
|
|
1454
|
-
chainId: OptionalChainId,
|
|
1455
|
-
role: OptionalString,
|
|
1456
|
-
txHash: OptionalTxHash
|
|
1457
|
-
});
|
|
1458
|
-
const OrgCreatedProps = Schema.Struct({
|
|
1459
|
-
...TelemetryEnvelopeProps,
|
|
1460
|
-
org_id: OptionalOrgId,
|
|
1461
|
-
chainId: OptionalChainId,
|
|
1462
|
-
safe_address: OptionalAddress,
|
|
1463
|
-
durationMs: OptionalDurationMs
|
|
1464
|
-
});
|
|
1465
|
-
const OrgCreateFailedProps = Schema.Struct({
|
|
1466
|
-
...TelemetryEnvelopeProps,
|
|
1467
|
-
...ChainCauseTelemetryProps,
|
|
1468
|
-
org_id: OptionalOrgId,
|
|
1469
|
-
reason: OptionalString
|
|
1470
|
-
});
|
|
1471
|
-
const OrgInviteSentProps = Schema.Struct({
|
|
1472
|
-
...TelemetryEnvelopeProps,
|
|
1473
|
-
org_id: OptionalOrgId,
|
|
1474
|
-
email_domain: OptionalString,
|
|
1475
|
-
role: OptionalString,
|
|
1476
|
-
status: OptionalString
|
|
1477
|
-
});
|
|
1478
|
-
const OrgInviteAcceptedProps = Schema.Struct({
|
|
1479
|
-
...TelemetryEnvelopeProps,
|
|
1480
|
-
org_id: OptionalOrgId,
|
|
1481
|
-
role: OptionalString,
|
|
1482
|
-
status: OptionalString
|
|
1483
|
-
});
|
|
1484
|
-
const OrgInviteExpiredProps = Schema.Struct({
|
|
1485
|
-
...TelemetryEnvelopeProps,
|
|
1486
|
-
org_id: OptionalOrgId,
|
|
1487
|
-
email_domain: OptionalString,
|
|
1488
|
-
reason: OptionalString,
|
|
1489
|
-
role: OptionalString,
|
|
1490
|
-
status: OptionalString
|
|
1491
|
-
});
|
|
1492
|
-
const RecipientLocatorKindSchema = Schema.Literals([
|
|
1493
|
-
"handle",
|
|
1494
|
-
"email",
|
|
1495
|
-
"address",
|
|
1496
|
-
"party"
|
|
1497
|
-
]);
|
|
1498
|
-
const RecipientResolutionStatusSchema = Schema.Literals([
|
|
1499
|
-
"known_party",
|
|
1500
|
-
"new_email",
|
|
1501
|
-
"external_address"
|
|
1502
|
-
]);
|
|
1503
|
-
const RecipientPartyKindSchema = Schema.Literals([
|
|
1504
|
-
"person",
|
|
1505
|
-
"organization",
|
|
1506
|
-
"unresolved"
|
|
1507
|
-
]);
|
|
1508
|
-
const RecipientTelemetryProps = {
|
|
1509
|
-
recipient_locator_kind: Schema.optional(RecipientLocatorKindSchema),
|
|
1510
|
-
recipient_resolution_status: Schema.optional(RecipientResolutionStatusSchema),
|
|
1511
|
-
recipient_party_id: OptionalString,
|
|
1512
|
-
recipient_party_kind: Schema.optional(RecipientPartyKindSchema),
|
|
1513
|
-
recipient_is_capxul_account: Schema.optional(Schema.Boolean),
|
|
1514
|
-
recipient_handle: OptionalString,
|
|
1515
|
-
recipient_address: OptionalAddress,
|
|
1516
|
-
external_address_acknowledged: Schema.optional(Schema.Boolean)
|
|
1517
|
-
};
|
|
1518
|
-
const PaymentInitiatedProps = Schema.Struct({
|
|
1519
|
-
command_id: OptionalString,
|
|
1520
|
-
execution_id: OptionalString,
|
|
1521
|
-
payment_lifecycle_id: OptionalString,
|
|
1522
|
-
...TelemetryEnvelopeProps,
|
|
1523
|
-
...RecipientTelemetryProps,
|
|
1524
|
-
kind: Schema.String,
|
|
1525
|
-
payment_id: Schema.String
|
|
1526
|
-
});
|
|
1527
|
-
const PaymentLifecycleProps = {
|
|
1528
|
-
payment_state: OptionalString,
|
|
1529
|
-
execution_state: OptionalString,
|
|
1530
|
-
occurred_at: Schema.optional(Schema.Number),
|
|
1531
|
-
causal_sequence: Schema.optional(Schema.Number),
|
|
1532
|
-
sponsorship_valid_until: Schema.optional(Schema.Number),
|
|
1533
|
-
terminal_event_id: OptionalString
|
|
1534
|
-
};
|
|
1535
|
-
const PaymentSettledL2Props = Schema.Struct({
|
|
1536
|
-
...PaymentLifecycleProps,
|
|
1537
|
-
...TelemetryEnvelopeProps,
|
|
1538
|
-
...RecipientTelemetryProps,
|
|
1539
|
-
kind: Schema.String,
|
|
1540
|
-
chain_id: Schema.Number,
|
|
1541
|
-
settlement_id: Schema.String,
|
|
1542
|
-
payment_id: OptionalString,
|
|
1543
|
-
payment_ids: OptionalString,
|
|
1544
|
-
command_id: OptionalString,
|
|
1545
|
-
payment_lifecycle_id: OptionalString,
|
|
1546
|
-
execution_id: OptionalString,
|
|
1547
|
-
user_op_hash: OptionalString,
|
|
1548
|
-
transaction_hash: OptionalString
|
|
1549
|
-
});
|
|
1550
|
-
const PaymentFailedL2Props = Schema.Struct({
|
|
1551
|
-
...PaymentLifecycleProps,
|
|
1552
|
-
...TelemetryEnvelopeProps,
|
|
1553
|
-
...ChainCauseTelemetryProps,
|
|
1554
|
-
...RecipientTelemetryProps,
|
|
1555
|
-
kind: Schema.String,
|
|
1556
|
-
payment_id: Schema.String,
|
|
1557
|
-
payment_ids: OptionalString,
|
|
1558
|
-
reason_code: Schema.String,
|
|
1559
|
-
command_id: OptionalString,
|
|
1560
|
-
payment_lifecycle_id: OptionalString,
|
|
1561
|
-
execution_id: OptionalString,
|
|
1562
|
-
user_op_hash: OptionalString
|
|
1563
|
-
});
|
|
1564
|
-
const PaymentVerificationRetryProps = Schema.Struct({
|
|
1565
|
-
...PaymentLifecycleProps,
|
|
1566
|
-
...TelemetryEnvelopeProps,
|
|
1567
|
-
...RecipientTelemetryProps,
|
|
1568
|
-
command_id: Schema.String,
|
|
1569
|
-
payment_lifecycle_id: Schema.String,
|
|
1570
|
-
attempt: Schema.Number,
|
|
1571
|
-
reason_code: Schema.String,
|
|
1572
|
-
chain_id: Schema.Number,
|
|
1573
|
-
delay_ms: DurationMsSchema,
|
|
1574
|
-
outcome: Schema.Literals(["scheduled", "unresolved"]),
|
|
1575
|
-
payment_id: OptionalString,
|
|
1576
|
-
payment_ids: OptionalString,
|
|
1577
|
-
execution_id: OptionalString,
|
|
1578
|
-
user_op_hash: OptionalString
|
|
1579
|
-
});
|
|
1580
|
-
const PaymentLifecycleTransitionProps = Schema.Struct({
|
|
1581
|
-
...TelemetryEnvelopeProps,
|
|
1582
|
-
...RecipientTelemetryProps,
|
|
1583
|
-
payment_id: Schema.String,
|
|
1584
|
-
payment_lifecycle_id: Schema.String,
|
|
1585
|
-
command_id: Schema.String,
|
|
1586
|
-
payment_state: Schema.String,
|
|
1587
|
-
occurred_at: Schema.Number,
|
|
1588
|
-
causal_sequence: Schema.Number,
|
|
1589
|
-
execution_id: OptionalString,
|
|
1590
|
-
execution_state: OptionalString,
|
|
1591
|
-
user_op_hash: OptionalString,
|
|
1592
|
-
sponsorship_valid_until: Schema.optional(Schema.Number),
|
|
1593
|
-
reason_code: OptionalString
|
|
1594
|
-
});
|
|
1595
|
-
const QuickPayExternalAddressAcknowledgedProps = Schema.Struct({
|
|
1596
|
-
...TelemetryEnvelopeProps,
|
|
1597
|
-
recipient_locator_kind: Schema.Literal("address"),
|
|
1598
|
-
recipient_resolution_status: Schema.Literal("external_address"),
|
|
1599
|
-
recipient_address: AddressSchema,
|
|
1600
|
-
external_address_acknowledged: Schema.Literal(true),
|
|
1601
|
-
organization_id: OptionalOrgId
|
|
1602
|
-
});
|
|
1603
|
-
const DepositInitiatedProps = Schema.Struct({
|
|
1604
|
-
...TelemetryEnvelopeProps,
|
|
1605
|
-
scope_kind: Schema.optional(Schema.Literals(["account", "organization"])),
|
|
1606
|
-
account_kind: Schema.optional(Schema.Literals(["personalSafe", "orgTreasury"])),
|
|
1607
|
-
chain_id: Schema.optional(Schema.Number),
|
|
1608
|
-
network: Schema.optional(Schema.Literal("base-sepolia")),
|
|
1609
|
-
organization_id: OptionalOrgId,
|
|
1610
|
-
$groups: Schema.optional(Schema.Struct({ organization: OptionalOrgId })),
|
|
1611
|
-
actor_id: OptionalString,
|
|
1612
|
-
actor_kind: Schema.optional(Schema.Literal("authenticated")),
|
|
1613
|
-
distinct_id: OptionalString,
|
|
1614
|
-
trace_id: OptionalString,
|
|
1615
|
-
span_id: OptionalString
|
|
1616
|
-
});
|
|
1617
|
-
const DepositSettledProps = Schema.Struct({
|
|
1618
|
-
...TelemetryEnvelopeProps,
|
|
1619
|
-
chain_id: Schema.Number,
|
|
1620
|
-
tx_hash: Schema.String,
|
|
1621
|
-
log_index: Schema.Number
|
|
1622
|
-
});
|
|
1623
|
-
const PermissionMirrorVerificationProps = Schema.Struct({
|
|
1624
|
-
...TelemetryEnvelopeProps,
|
|
1625
|
-
/** The RECEIPT verification outcome. What the mirror then did is separate. */
|
|
1626
|
-
outcome: Schema.String,
|
|
1627
|
-
reason: Schema.String,
|
|
1628
|
-
chain_id: Schema.Number,
|
|
1629
|
-
retry_count: Schema.Number,
|
|
1630
|
-
/**
|
|
1631
|
-
* #1960 R02, consumed by R03. A verified receipt is not an applied Permission:
|
|
1632
|
-
* these two optional fields let the producer say what the applying mutation
|
|
1633
|
-
* actually returned, and which command it was, without either fact rewriting
|
|
1634
|
-
* the receipt outcome above. Absent when application has not happened yet.
|
|
1635
|
-
*/
|
|
1636
|
-
application_result: Schema.optional(Schema.Literals([
|
|
1637
|
-
"applied",
|
|
1638
|
-
"replayed",
|
|
1639
|
-
"conflicting_replay",
|
|
1640
|
-
"revision_mismatch"
|
|
1641
|
-
])),
|
|
1642
|
-
command_id: OptionalString,
|
|
1643
|
-
/**
|
|
1644
|
-
* #1961 R03. The authorized stored row names the Permission it changed; the
|
|
1645
|
-
* verified receipt names the chain facts that prove it. Every field is
|
|
1646
|
-
* optional because a pending or provider-failed verification has neither an
|
|
1647
|
-
* application result nor a receipt to report.
|
|
1648
|
-
*/
|
|
1649
|
-
permission_id: OptionalString,
|
|
1650
|
-
permission_assignment_id: OptionalString,
|
|
1651
|
-
permission_operation: Schema.optional(Schema.Literals([
|
|
1652
|
-
"create",
|
|
1653
|
-
"change",
|
|
1654
|
-
"assign",
|
|
1655
|
-
"revoke",
|
|
1656
|
-
"replace"
|
|
1657
|
-
])),
|
|
1658
|
-
revision: Schema.optional(Schema.Number),
|
|
1659
|
-
user_op_hash: OptionalString,
|
|
1660
|
-
transaction_hash: OptionalString,
|
|
1661
|
-
block_number: Schema.optional(Schema.Number),
|
|
1662
|
-
log_index: Schema.optional(Schema.Number)
|
|
1663
|
-
});
|
|
1664
|
-
const MovementScanWindowProps = Schema.Struct({
|
|
1665
|
-
...TelemetryEnvelopeProps,
|
|
1666
|
-
chain_id: Schema.Number,
|
|
1667
|
-
token_address: Schema.String,
|
|
1668
|
-
from_block: Schema.Number,
|
|
1669
|
-
to_block: Schema.Number,
|
|
1670
|
-
log_count: Schema.Number,
|
|
1671
|
-
request_count: Schema.Number,
|
|
1672
|
-
outcome: Schema.String
|
|
1673
|
-
});
|
|
1674
|
-
const MovementScanCheckpointProps = Schema.Struct({
|
|
1675
|
-
...TelemetryEnvelopeProps,
|
|
1676
|
-
chain_id: Schema.Number,
|
|
1677
|
-
token_address: Schema.String,
|
|
1678
|
-
next_block: Schema.Number,
|
|
1679
|
-
anchor_block_number: Schema.Number
|
|
1680
|
-
});
|
|
1681
|
-
const MovementScanIncidentProps = Schema.Struct({
|
|
1682
|
-
...TelemetryEnvelopeProps,
|
|
1683
|
-
chain_id: Schema.Number,
|
|
1684
|
-
token_address: Schema.String,
|
|
1685
|
-
incident_kind: Schema.String,
|
|
1686
|
-
anchor_block_number: Schema.Number
|
|
1687
|
-
});
|
|
1688
|
-
/**
|
|
1689
|
-
* One durable row the reconciliation job corrected against Ponder (SPEC D9).
|
|
1690
|
-
*
|
|
1691
|
-
* Both block fields are optional and for the same reason: a correction INTO
|
|
1692
|
-
* drift (a Payment settled in Convex whose Ponder fact a reorg removed) has no
|
|
1693
|
-
* current block, and a correction that confirms a later fact has one.
|
|
1694
|
-
*
|
|
1695
|
-
* `projection_kind` is closed. A later ticket that reconciles a deploy, a
|
|
1696
|
-
* bootstrap or a grant outcome adds its kind here in the same change; an
|
|
1697
|
-
* unknown kind must not decode.
|
|
1698
|
-
*/
|
|
1699
|
-
const IndexerDriftCorrectedProps = Schema.Struct({
|
|
1700
|
-
...TelemetryEnvelopeProps,
|
|
1701
|
-
projection_kind: Schema.Literals([
|
|
1702
|
-
"member_authority",
|
|
1703
|
-
"payment_settlement",
|
|
1704
|
-
"permission_assignment"
|
|
1705
|
-
]),
|
|
1706
|
-
previous_state: Schema.String,
|
|
1707
|
-
current_state: Schema.String,
|
|
1708
|
-
previous_block: Schema.optional(Schema.Number),
|
|
1709
|
-
current_block: Schema.optional(Schema.Number),
|
|
1710
|
-
logical_event_id: Schema.optional(Schema.String),
|
|
1711
|
-
scope_kind: Schema.optional(Schema.Literals(["account", "organization"])),
|
|
1712
|
-
account_id: OptionalAccountId,
|
|
1713
|
-
reference_id: OptionalString
|
|
1714
|
-
});
|
|
1715
|
-
const AuthOtpRequestedTelemetryEventSchema = Schema.Struct({
|
|
1716
|
-
name: Schema.Literal("auth_otp_requested"),
|
|
1717
|
-
props: AuthOtpRequestedProps
|
|
1718
|
-
});
|
|
1719
|
-
const AuthOtpDeliveredTelemetryEventSchema = Schema.Struct({
|
|
1720
|
-
name: Schema.Literal("auth_otp_delivered"),
|
|
1721
|
-
props: AuthOtpDeliveredProps
|
|
1722
|
-
});
|
|
1723
|
-
const AuthOtpExpiredTelemetryEventSchema = Schema.Struct({
|
|
1724
|
-
name: Schema.Literal("auth_otp_expired"),
|
|
1725
|
-
props: AuthOtpExpiredProps
|
|
1726
|
-
});
|
|
1727
|
-
const AuthVerifiedTelemetryEventSchema = Schema.Struct({
|
|
1728
|
-
name: Schema.Literal("auth_verified"),
|
|
1729
|
-
props: AuthVerifiedProps
|
|
1730
|
-
});
|
|
1731
|
-
const AuthFailedTelemetryEventSchema = Schema.Struct({
|
|
1732
|
-
name: Schema.Literal("auth_failed"),
|
|
1733
|
-
props: AuthFailedProps
|
|
1734
|
-
});
|
|
1735
|
-
const IdentityRefusedTelemetryEventSchema = Schema.Struct({
|
|
1736
|
-
name: Schema.Literal("identity_refused"),
|
|
1737
|
-
props: IdentityRefusedProps
|
|
1738
|
-
});
|
|
1739
|
-
const AuthSignedOutTelemetryEventSchema = Schema.Struct({
|
|
1740
|
-
name: Schema.Literal("auth_signed_out"),
|
|
1741
|
-
props: AuthSignedOutProps
|
|
1742
|
-
});
|
|
1743
|
-
const OnboardingIntentSelectedTelemetryEventSchema = Schema.Struct({
|
|
1744
|
-
name: Schema.Literal("onboarding_intent_selected"),
|
|
1745
|
-
props: OnboardingIntentSelectedProps
|
|
1746
|
-
});
|
|
1747
|
-
const OnboardingProfileSubmittedTelemetryEventSchema = Schema.Struct({
|
|
1748
|
-
name: Schema.Literal("onboarding_profile_submitted"),
|
|
1749
|
-
props: OnboardingProfileSubmittedProps
|
|
1750
|
-
});
|
|
1751
|
-
const OnboardingOrganizationSubmittedTelemetryEventSchema = Schema.Struct({
|
|
1752
|
-
name: Schema.Literal("onboarding_organization_submitted"),
|
|
1753
|
-
props: OnboardingOrganizationSubmittedProps
|
|
1754
|
-
});
|
|
1755
|
-
const OnboardingDashboardReachedTelemetryEventSchema = Schema.Struct({
|
|
1756
|
-
name: Schema.Literal("onboarding_dashboard_reached"),
|
|
1757
|
-
props: OnboardingDashboardReachedProps
|
|
1758
|
-
});
|
|
1759
|
-
const ProvisioningSafeCreatedTelemetryEventSchema = Schema.Struct({
|
|
1760
|
-
name: Schema.Literal("provisioning_safe_created"),
|
|
1761
|
-
props: ProvisioningSafeCreatedProps
|
|
1762
|
-
});
|
|
1763
|
-
const ProvisioningSafeConfirmedTelemetryEventSchema = Schema.Struct({
|
|
1764
|
-
name: Schema.Literal("provisioning_safe_confirmed"),
|
|
1765
|
-
props: ProvisioningSafeConfirmedProps
|
|
1766
|
-
});
|
|
1767
|
-
const BootstrapResolvedTelemetryEventSchema = Schema.Struct({
|
|
1768
|
-
name: Schema.Literal("bootstrap_resolved"),
|
|
1769
|
-
props: BootstrapResolvedProps
|
|
1770
|
-
});
|
|
1771
|
-
const BootstrapFailedTelemetryEventSchema = Schema.Struct({
|
|
1772
|
-
name: Schema.Literal("bootstrap_failed"),
|
|
1773
|
-
props: BootstrapFailedProps
|
|
1774
|
-
});
|
|
1775
|
-
const MemberActivationStartedTelemetryEventSchema = Schema.Struct({
|
|
1776
|
-
name: Schema.Literal("member_activation_started"),
|
|
1777
|
-
props: MemberActivationStartedProps
|
|
1778
|
-
});
|
|
1779
|
-
const MemberActivationReadyTelemetryEventSchema = Schema.Struct({
|
|
1780
|
-
name: Schema.Literal("member_activation_ready"),
|
|
1781
|
-
props: MemberActivationReadyProps
|
|
1782
|
-
});
|
|
1783
|
-
const MemberActivationFailedTelemetryEventSchema = Schema.Struct({
|
|
1784
|
-
name: Schema.Literal("member_activation_failed"),
|
|
1785
|
-
props: MemberActivationFailedProps
|
|
1786
|
-
});
|
|
1787
|
-
const OrganizationCreationStartedTelemetryEventSchema = Schema.Struct({
|
|
1788
|
-
name: Schema.Literal("organization_creation_started"),
|
|
1789
|
-
props: OrganizationCreationStartedProps
|
|
1790
|
-
});
|
|
1791
|
-
const OrganizationCreationReadyTelemetryEventSchema = Schema.Struct({
|
|
1792
|
-
name: Schema.Literal("organization_creation_ready"),
|
|
1793
|
-
props: OrganizationCreationReadyProps
|
|
1794
|
-
});
|
|
1795
|
-
const OrganizationCreationFailedTelemetryEventSchema = Schema.Struct({
|
|
1796
|
-
name: Schema.Literal("organization_creation_failed"),
|
|
1797
|
-
props: OrganizationCreationFailedProps
|
|
1798
|
-
});
|
|
1799
|
-
const AccountBalanceReadTelemetryEventSchema = Schema.Struct({
|
|
1800
|
-
name: Schema.Literal("account_balance_read"),
|
|
1801
|
-
props: AccountBalanceReadProps
|
|
1802
|
-
});
|
|
1803
|
-
const AccountBalanceFailedTelemetryEventSchema = Schema.Struct({
|
|
1804
|
-
name: Schema.Literal("account_balance_failed"),
|
|
1805
|
-
props: AccountBalanceFailedProps
|
|
1806
|
-
});
|
|
1807
|
-
const FaucetRequestedTelemetryEventSchema = Schema.Struct({
|
|
1808
|
-
name: Schema.Literal("faucet_requested"),
|
|
1809
|
-
props: FaucetRequestedProps
|
|
1810
|
-
});
|
|
1811
|
-
const FaucetConfirmedTelemetryEventSchema = Schema.Struct({
|
|
1812
|
-
name: Schema.Literal("faucet_confirmed"),
|
|
1813
|
-
props: FaucetConfirmedProps
|
|
1814
|
-
});
|
|
1815
|
-
const FaucetFailedTelemetryEventSchema = Schema.Struct({
|
|
1816
|
-
name: Schema.Literal("faucet_failed"),
|
|
1817
|
-
props: FaucetFailedProps
|
|
1818
|
-
});
|
|
1819
|
-
const ChainUpstreamFallbackTelemetryEventSchema = Schema.Struct({
|
|
1820
|
-
name: Schema.Literal("chain_upstream_fallback"),
|
|
1821
|
-
props: ChainUpstreamFallbackProps
|
|
1822
|
-
});
|
|
1823
|
-
const BundlerErrorTelemetryEventSchema = Schema.Struct({
|
|
1824
|
-
name: Schema.Literal("bundler_error"),
|
|
1825
|
-
props: BundlerErrorProps
|
|
1826
|
-
});
|
|
1827
|
-
const ReceiptPendingTelemetryEventSchema = Schema.Struct({
|
|
1828
|
-
name: Schema.Literal("receipt_pending"),
|
|
1829
|
-
props: ReceiptPendingProps
|
|
1830
|
-
});
|
|
1831
|
-
const OperationRetriedTelemetryEventSchema = Schema.Struct({
|
|
1832
|
-
name: Schema.Literal("operation_retried"),
|
|
1833
|
-
props: OperationRetriedProps
|
|
1834
|
-
});
|
|
1835
|
-
const OrgCreateStartedTelemetryEventSchema = Schema.Struct({
|
|
1836
|
-
name: Schema.Literal("org_create_started"),
|
|
1837
|
-
props: OrgCreateStartedProps
|
|
1838
|
-
});
|
|
1839
|
-
const OrgSafeCreatedTelemetryEventSchema = Schema.Struct({
|
|
1840
|
-
name: Schema.Literal("org_safe_created"),
|
|
1841
|
-
props: OrgSafeCreatedProps
|
|
1842
|
-
});
|
|
1843
|
-
const OrgSafeConfirmedTelemetryEventSchema = Schema.Struct({
|
|
1844
|
-
name: Schema.Literal("org_safe_confirmed"),
|
|
1845
|
-
props: OrgSafeConfirmedProps
|
|
1846
|
-
});
|
|
1847
|
-
const OrgRolesSeededTelemetryEventSchema = Schema.Struct({
|
|
1848
|
-
name: Schema.Literal("org_roles_seeded"),
|
|
1849
|
-
props: OrgRolesSeededProps
|
|
1850
|
-
});
|
|
1851
|
-
const OrgCreatedTelemetryEventSchema = Schema.Struct({
|
|
1852
|
-
name: Schema.Literal("org_created"),
|
|
1853
|
-
props: OrgCreatedProps
|
|
1854
|
-
});
|
|
1855
|
-
const OrgCreateFailedTelemetryEventSchema = Schema.Struct({
|
|
1856
|
-
name: Schema.Literal("org_create_failed"),
|
|
1857
|
-
props: OrgCreateFailedProps
|
|
1858
|
-
});
|
|
1859
|
-
const OrgInviteSentTelemetryEventSchema = Schema.Struct({
|
|
1860
|
-
name: Schema.Literal("org_invite_sent"),
|
|
1861
|
-
props: OrgInviteSentProps
|
|
1862
|
-
});
|
|
1863
|
-
const OrgInviteAcceptedTelemetryEventSchema = Schema.Struct({
|
|
1864
|
-
name: Schema.Literal("org_invite_accepted"),
|
|
1865
|
-
props: OrgInviteAcceptedProps
|
|
1866
|
-
});
|
|
1867
|
-
const OrgInviteExpiredTelemetryEventSchema = Schema.Struct({
|
|
1868
|
-
name: Schema.Literal("org_invite_expired"),
|
|
1869
|
-
props: OrgInviteExpiredProps
|
|
1870
|
-
});
|
|
1871
|
-
const PaymentInitiatedTelemetryEventSchema = Schema.Struct({
|
|
1872
|
-
name: Schema.Literal("payment_initiated"),
|
|
1873
|
-
props: PaymentInitiatedProps
|
|
1874
|
-
});
|
|
1875
|
-
const PaymentSettledTelemetryEventSchema = Schema.Struct({
|
|
1876
|
-
name: Schema.Literal("payment_settled"),
|
|
1877
|
-
props: PaymentSettledL2Props
|
|
1878
|
-
});
|
|
1879
|
-
const PaymentFailedTelemetryEventSchema = Schema.Struct({
|
|
1880
|
-
name: Schema.Literal("payment_failed"),
|
|
1881
|
-
props: PaymentFailedL2Props
|
|
1882
|
-
});
|
|
1883
|
-
const PaymentVerificationRetryTelemetryEventSchema = Schema.Struct({
|
|
1884
|
-
name: Schema.Literal("payment_verification_retry"),
|
|
1885
|
-
props: PaymentVerificationRetryProps
|
|
1886
|
-
});
|
|
1887
|
-
const PaymentLifecycleTransitionTelemetryEventSchema = Schema.Struct({
|
|
1888
|
-
name: Schema.Literal("payment_lifecycle_transition"),
|
|
1889
|
-
props: PaymentLifecycleTransitionProps
|
|
1890
|
-
});
|
|
1891
|
-
const QuickPayExternalAddressAcknowledgedTelemetryEventSchema = Schema.Struct({
|
|
1892
|
-
name: Schema.Literal("quick_pay_external_address_acknowledged"),
|
|
1893
|
-
props: QuickPayExternalAddressAcknowledgedProps
|
|
1894
|
-
});
|
|
1895
|
-
const DepositInitiatedTelemetryEventSchema = Schema.Struct({
|
|
1896
|
-
name: Schema.Literal("deposit_initiated"),
|
|
1897
|
-
props: DepositInitiatedProps
|
|
1898
|
-
});
|
|
1899
|
-
const DepositSettledTelemetryEventSchema = Schema.Struct({
|
|
1900
|
-
name: Schema.Literal("deposit_settled"),
|
|
1901
|
-
props: DepositSettledProps
|
|
1902
|
-
});
|
|
1903
|
-
const PermissionMirrorVerificationTelemetryEventSchema = Schema.Struct({
|
|
1904
|
-
name: Schema.Literal("permission_mirror_verification"),
|
|
1905
|
-
props: PermissionMirrorVerificationProps
|
|
1906
|
-
});
|
|
1907
|
-
const MovementScanWindowTelemetryEventSchema = Schema.Struct({
|
|
1908
|
-
name: Schema.Literal("movement_scan_window"),
|
|
1909
|
-
props: MovementScanWindowProps
|
|
1910
|
-
});
|
|
1911
|
-
const MovementScanCheckpointTelemetryEventSchema = Schema.Struct({
|
|
1912
|
-
name: Schema.Literal("movement_scan_checkpoint"),
|
|
1913
|
-
props: MovementScanCheckpointProps
|
|
1914
|
-
});
|
|
1915
|
-
const MovementScanIncidentTelemetryEventSchema = Schema.Struct({
|
|
1916
|
-
name: Schema.Literal("movement_scan_incident"),
|
|
1917
|
-
props: MovementScanIncidentProps
|
|
1918
|
-
});
|
|
1919
|
-
const IndexerDriftCorrectedTelemetryEventSchema = Schema.Struct({
|
|
1920
|
-
name: Schema.Literal("indexer_drift_corrected"),
|
|
1921
|
-
props: IndexerDriftCorrectedProps
|
|
1922
|
-
});
|
|
1923
|
-
/** The one spelling of "whose scope did this happen in" across every surface. */
|
|
1924
|
-
const ScopeKindSchema = Schema.Literals(["account", "organization"]);
|
|
1925
|
-
const OptionalReasonCode = Schema.optional(Schema.Literals(CAPXUL_ERROR_CODES));
|
|
1926
|
-
const ActivityReferenceProps = {
|
|
1927
|
-
reference_kind: Schema.Literals(["payment", "movement"]),
|
|
1928
|
-
reference_id: Schema.String
|
|
1929
|
-
};
|
|
1930
|
-
const ActivityFilterProps = {
|
|
1931
|
-
filter_kind: Schema.optional(Schema.Literals([
|
|
1932
|
-
"all",
|
|
1933
|
-
"payment",
|
|
1934
|
-
"movement"
|
|
1935
|
-
])),
|
|
1936
|
-
filter_direction: Schema.optional(Schema.Literals([
|
|
1937
|
-
"all",
|
|
1938
|
-
"in",
|
|
1939
|
-
"out",
|
|
1940
|
-
"self"
|
|
1941
|
-
])),
|
|
1942
|
-
filter_status: Schema.optional(Schema.Array(Schema.Literals([
|
|
1943
|
-
"pending",
|
|
1944
|
-
"settling",
|
|
1945
|
-
"unresolved",
|
|
1946
|
-
"pending_claim",
|
|
1947
|
-
"scheduled",
|
|
1948
|
-
"streaming",
|
|
1949
|
-
"settled",
|
|
1950
|
-
"cancelled",
|
|
1951
|
-
"failed"
|
|
1952
|
-
])))
|
|
1953
|
-
};
|
|
1954
|
-
const ActivityActionProps = {
|
|
1955
|
-
...TelemetryEnvelopeProps,
|
|
1956
|
-
scope_kind: ScopeKindSchema,
|
|
1957
|
-
reason_code: OptionalReasonCode
|
|
1958
|
-
};
|
|
1959
|
-
const ContactRelationshipChangedTelemetryEventSchema = Schema.Struct({
|
|
1960
|
-
name: Schema.Literal("contact_relationship_changed"),
|
|
1961
|
-
props: Schema.Struct({
|
|
1962
|
-
...TelemetryEnvelopeProps,
|
|
1963
|
-
change: Schema.Literals([
|
|
1964
|
-
"added",
|
|
1965
|
-
"renamed",
|
|
1966
|
-
"hidden",
|
|
1967
|
-
"restored"
|
|
1968
|
-
]),
|
|
1969
|
-
scope_kind: ScopeKindSchema,
|
|
1970
|
-
scope_id: Schema.String,
|
|
1971
|
-
owner_party_id: Schema.String,
|
|
1972
|
-
party_id: Schema.String,
|
|
1973
|
-
hidden: Schema.Boolean,
|
|
1974
|
-
occurred_at: Schema.Number,
|
|
1975
|
-
operation: Schema.Literals([
|
|
1976
|
-
CAPXUL_OPERATIONS.addressBook.add,
|
|
1977
|
-
CAPXUL_OPERATIONS.addressBook.label,
|
|
1978
|
-
CAPXUL_OPERATIONS.addressBook.hide,
|
|
1979
|
-
CAPXUL_OPERATIONS.addressBook.unhide
|
|
1980
|
-
])
|
|
1981
|
-
})
|
|
1982
|
-
});
|
|
1983
|
-
const ContactActionProps = {
|
|
1984
|
-
...TelemetryEnvelopeProps,
|
|
1985
|
-
scope_kind: ScopeKindSchema,
|
|
1986
|
-
party_id: OptionalString,
|
|
1987
|
-
reason_code: OptionalReasonCode
|
|
1988
|
-
};
|
|
1989
|
-
/** One completed online CLI diagnostic. No command input or provider text. */
|
|
1990
|
-
const CLI_COMMAND_NAMES = [
|
|
1991
|
-
"capxul",
|
|
1992
|
-
"doctor",
|
|
1993
|
-
"telemetry",
|
|
1994
|
-
"telemetry.status",
|
|
1995
|
-
"telemetry.enable",
|
|
1996
|
-
"telemetry.disable",
|
|
1997
|
-
"unknown"
|
|
1998
|
-
];
|
|
1999
|
-
const CLI_CAPABILITIES = [
|
|
2000
|
-
"cli",
|
|
2001
|
-
"diagnostics",
|
|
2002
|
-
"collection"
|
|
2003
|
-
];
|
|
2004
|
-
const CLI_INVOCATION_KINDS = [
|
|
2005
|
-
"command",
|
|
2006
|
-
"help",
|
|
2007
|
-
"version",
|
|
2008
|
-
"completion",
|
|
2009
|
-
"parse_refusal",
|
|
2010
|
-
"collection_control"
|
|
2011
|
-
];
|
|
2012
|
-
const CliRelease = Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/u));
|
|
2013
|
-
const CliInvocationProps = {
|
|
2014
|
-
...TelemetryEnvelopeProps,
|
|
2015
|
-
schema_version: Schema.Literal(1),
|
|
2016
|
-
command: Schema.Literals(CLI_COMMAND_NAMES),
|
|
2017
|
-
capability: Schema.Literals(CLI_CAPABILITIES),
|
|
2018
|
-
invocation_kind: Schema.Literals(CLI_INVOCATION_KINDS),
|
|
2019
|
-
invocation_id: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/u)),
|
|
2020
|
-
cli_identity_kind: Schema.optional(Schema.Literal("anonymous")),
|
|
2021
|
-
anonymous_id: Schema.optional(Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/u))),
|
|
2022
|
-
occurred_at: Schema.Number,
|
|
2023
|
-
cli_version: CliRelease,
|
|
2024
|
-
sdk_version: CliRelease,
|
|
2025
|
-
release: CliRelease,
|
|
2026
|
-
platform: Schema.Literals([
|
|
2027
|
-
"darwin",
|
|
2028
|
-
"linux",
|
|
2029
|
-
"unknown"
|
|
2030
|
-
]),
|
|
2031
|
-
architecture: Schema.Literals([
|
|
2032
|
-
"arm64",
|
|
2033
|
-
"x64",
|
|
2034
|
-
"unknown"
|
|
2035
|
-
]),
|
|
2036
|
-
ci: Schema.Boolean,
|
|
2037
|
-
tty: Schema.Boolean,
|
|
2038
|
-
output_mode: Schema.Literals(["human", "json"])
|
|
2039
|
-
};
|
|
2040
|
-
const CliFirstUsedTelemetryEventSchema = Schema.Struct({
|
|
2041
|
-
name: Schema.Literal("cli_first_used"),
|
|
2042
|
-
props: Schema.Struct(CliInvocationProps)
|
|
2043
|
-
});
|
|
2044
|
-
const CliCommandStartedTelemetryEventSchema = Schema.Struct({
|
|
2045
|
-
name: Schema.Literal("cli_command_started"),
|
|
2046
|
-
props: Schema.Struct({
|
|
2047
|
-
...CliInvocationProps,
|
|
2048
|
-
invocation_kind: Schema.Literals([
|
|
2049
|
-
"command",
|
|
2050
|
-
"help",
|
|
2051
|
-
"version"
|
|
2052
|
-
])
|
|
2053
|
-
})
|
|
2054
|
-
});
|
|
2055
|
-
const CliCommandCompletedTelemetryEventSchema = Schema.Struct({
|
|
2056
|
-
name: Schema.Literal("cli_command_completed"),
|
|
2057
|
-
props: Schema.Struct({
|
|
2058
|
-
...CliInvocationProps,
|
|
2059
|
-
outcome: Schema.Literals([
|
|
2060
|
-
"succeeded",
|
|
2061
|
-
"refused",
|
|
2062
|
-
"failed",
|
|
2063
|
-
"cancelled"
|
|
2064
|
-
]),
|
|
2065
|
-
duration_ms: Schema.Number,
|
|
2066
|
-
error_code: Schema.optional(Schema.Literals([
|
|
2067
|
-
...CAPXUL_ERROR_CODES,
|
|
2068
|
-
"CLI_USAGE",
|
|
2069
|
-
"CLI_CONFIG",
|
|
2070
|
-
"CLI_STORAGE",
|
|
2071
|
-
"CLI_DEFECT"
|
|
2072
|
-
]))
|
|
2073
|
-
})
|
|
2074
|
-
});
|
|
2075
|
-
const CliDiagnosticCompletedTelemetryEventSchema = Schema.Struct({
|
|
2076
|
-
name: Schema.Literal("cli_diagnostic_completed"),
|
|
2077
|
-
props: Schema.Struct({
|
|
2078
|
-
...TelemetryEnvelopeProps,
|
|
2079
|
-
outcome: Schema.Literals([
|
|
2080
|
-
"succeeded",
|
|
2081
|
-
"refused",
|
|
2082
|
-
"failed",
|
|
2083
|
-
"cancelled"
|
|
2084
|
-
]),
|
|
2085
|
-
invocation_id: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/u)),
|
|
2086
|
-
cli_version: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/u))
|
|
2087
|
-
})
|
|
2088
|
-
});
|
|
2089
|
-
const UiContactActionCompletedTelemetryEventSchema = Schema.Struct({
|
|
2090
|
-
name: Schema.Literal("ui_contact_action_completed"),
|
|
2091
|
-
props: Schema.Union([
|
|
2092
|
-
Schema.Struct({
|
|
2093
|
-
...ContactActionProps,
|
|
2094
|
-
action: Schema.Literal("add"),
|
|
2095
|
-
outcome: Schema.Literals(["opened", "cancelled"])
|
|
2096
|
-
}),
|
|
2097
|
-
Schema.Struct({
|
|
2098
|
-
...ContactActionProps,
|
|
2099
|
-
action: Schema.Literal("refusal"),
|
|
2100
|
-
outcome: Schema.Literal("displayed")
|
|
2101
|
-
}),
|
|
2102
|
-
Schema.Struct({
|
|
2103
|
-
...ContactActionProps,
|
|
2104
|
-
action: Schema.Literal("retry"),
|
|
2105
|
-
outcome: Schema.Literal("requested")
|
|
2106
|
-
})
|
|
2107
|
-
])
|
|
2108
|
-
});
|
|
2109
|
-
const ActivityAnnotationSavedTelemetryEventSchema = Schema.Struct({
|
|
2110
|
-
name: Schema.Literal("activity_annotation_saved"),
|
|
2111
|
-
props: Schema.Struct({
|
|
2112
|
-
...TelemetryEnvelopeProps,
|
|
2113
|
-
...ActivityReferenceProps,
|
|
2114
|
-
scope_kind: ScopeKindSchema,
|
|
2115
|
-
scope_id: Schema.String,
|
|
2116
|
-
occurred_at: Schema.Number
|
|
2117
|
-
})
|
|
2118
|
-
});
|
|
2119
|
-
const UiActivityActionCompletedTelemetryEventSchema = Schema.Struct({
|
|
2120
|
-
name: Schema.Literal("ui_activity_action_completed"),
|
|
2121
|
-
props: Schema.Union([
|
|
2122
|
-
Schema.Struct({
|
|
2123
|
-
...ActivityActionProps,
|
|
2124
|
-
action: Schema.Literal("read"),
|
|
2125
|
-
outcome: Schema.Literals(["partial_displayed", "recovered"]),
|
|
2126
|
-
surface: Schema.Literals([
|
|
2127
|
-
"transactions",
|
|
2128
|
-
"recent",
|
|
2129
|
-
"summary"
|
|
2130
|
-
])
|
|
2131
|
-
}),
|
|
2132
|
-
Schema.Struct({
|
|
2133
|
-
...ActivityActionProps,
|
|
2134
|
-
...ActivityFilterProps,
|
|
2135
|
-
action: Schema.Literal("filter"),
|
|
2136
|
-
outcome: Schema.Literal("committed")
|
|
2137
|
-
}),
|
|
2138
|
-
Schema.Struct({
|
|
2139
|
-
...ActivityActionProps,
|
|
2140
|
-
action: Schema.Literal("refusal"),
|
|
2141
|
-
outcome: Schema.Literal("displayed")
|
|
2142
|
-
}),
|
|
2143
|
-
Schema.Struct({
|
|
2144
|
-
...ActivityActionProps,
|
|
2145
|
-
action: Schema.Literal("retry"),
|
|
2146
|
-
outcome: Schema.Literal("requested")
|
|
2147
|
-
}),
|
|
2148
|
-
Schema.Struct({
|
|
2149
|
-
...ActivityActionProps,
|
|
2150
|
-
...ActivityReferenceProps,
|
|
2151
|
-
action: Schema.Literal("detail"),
|
|
2152
|
-
outcome: Schema.Literals(["opened", "failed"])
|
|
2153
|
-
}),
|
|
2154
|
-
Schema.Struct({
|
|
2155
|
-
...ActivityActionProps,
|
|
2156
|
-
...ActivityReferenceProps,
|
|
2157
|
-
action: Schema.Literal("receipt"),
|
|
2158
|
-
outcome: Schema.Literals([
|
|
2159
|
-
"document_rendered",
|
|
2160
|
-
"explorer_opened",
|
|
2161
|
-
"popup_blocked",
|
|
2162
|
-
"failed"
|
|
2163
|
-
])
|
|
2164
|
-
}),
|
|
2165
|
-
Schema.Struct({
|
|
2166
|
-
...ActivityActionProps,
|
|
2167
|
-
...ActivityFilterProps,
|
|
2168
|
-
action: Schema.Literal("export"),
|
|
2169
|
-
outcome: Schema.Literals([
|
|
2170
|
-
"completed",
|
|
2171
|
-
"partial",
|
|
2172
|
-
"failed"
|
|
2173
|
-
]),
|
|
2174
|
-
row_count: Schema.optional(Schema.Number),
|
|
2175
|
-
truncated: Schema.optional(Schema.Boolean)
|
|
2176
|
-
})
|
|
2177
|
-
])
|
|
2178
|
-
});
|
|
2179
|
-
/**
|
|
2180
|
-
* Reliability closeout (#1960 R02) — the shape every explicit UI observation
|
|
2181
|
-
* below shares. `scope_kind` says whose surface the person was looking at,
|
|
2182
|
-
* `organization_id` is the verified Organization the producer resolved (absent
|
|
2183
|
-
* on a personal action), and `reason_code` is a catalog error code, never copy.
|
|
2184
|
-
*/
|
|
2185
|
-
const UiStepProps = {
|
|
2186
|
-
...TelemetryEnvelopeProps,
|
|
2187
|
-
scope_kind: ScopeKindSchema,
|
|
2188
|
-
organization_id: OptionalOrgId,
|
|
2189
|
-
reason_code: OptionalReasonCode
|
|
2190
|
-
};
|
|
2191
|
-
const AccessRecoveryCompletedProps = Schema.Union([Schema.Struct({
|
|
2192
|
-
...TelemetryEnvelopeProps,
|
|
2193
|
-
recovery: Schema.Literal("session_restoration"),
|
|
2194
|
-
outcome: Schema.Literals([
|
|
2195
|
-
"restored",
|
|
2196
|
-
"absent",
|
|
2197
|
-
"failed"
|
|
2198
|
-
]),
|
|
2199
|
-
reason_code: OptionalReasonCode,
|
|
2200
|
-
organization_id: OptionalOrgId
|
|
2201
|
-
}), Schema.Struct({
|
|
2202
|
-
...TelemetryEnvelopeProps,
|
|
2203
|
-
recovery: Schema.Literal("signer_readiness"),
|
|
2204
|
-
outcome: Schema.Literals(["ready", "unavailable"]),
|
|
2205
|
-
reason_code: OptionalReasonCode,
|
|
2206
|
-
organization_id: OptionalOrgId
|
|
2207
|
-
})]);
|
|
2208
|
-
const AccessRecoveryCompletedTelemetryEventSchema = Schema.Struct({
|
|
2209
|
-
name: Schema.Literal("access_recovery_completed"),
|
|
2210
|
-
props: AccessRecoveryCompletedProps
|
|
2211
|
-
});
|
|
2212
|
-
/**
|
|
2213
|
-
* R05 (#1963) wired three of these steps at the app's dashboard Access
|
|
2214
|
-
* boundary: `dashboard_granted` on the commit of the granted content,
|
|
2215
|
-
* `gate_error_displayed` on the mounted error surface, and `retry_selected` on
|
|
2216
|
-
* the actual selection. `redirect_completed` stays RESERVED and unproduced —
|
|
2217
|
-
* asking for a navigation is not arriving, and the destination page's own
|
|
2218
|
-
* normalized pageview already carries the arrival on the same journey, so a
|
|
2219
|
-
* second event would add no fact. `capability_refusal_displayed` and
|
|
2220
|
-
* `signer_refusal_displayed` belong to the screens that draw those refusals
|
|
2221
|
-
* (Recipients, Invoice, Payroll, Quick Pay); Access publishes the contract and
|
|
2222
|
-
* the `CanReason` those owners report, and produces neither itself.
|
|
2223
|
-
*/
|
|
2224
|
-
const UiAccessStepCompletedTelemetryEventSchema = Schema.Struct({
|
|
2225
|
-
name: Schema.Literal("ui_access_step_completed"),
|
|
2226
|
-
props: Schema.Struct({
|
|
2227
|
-
...UiStepProps,
|
|
2228
|
-
step: Schema.Literals([
|
|
2229
|
-
"dashboard_granted",
|
|
2230
|
-
"redirect_completed",
|
|
2231
|
-
"gate_error_displayed",
|
|
2232
|
-
"retry_selected",
|
|
2233
|
-
"capability_refusal_displayed",
|
|
2234
|
-
"signer_refusal_displayed"
|
|
2235
|
-
]),
|
|
2236
|
-
capability: Schema.optional(Schema.Literals(["spend", "managePeople"])),
|
|
2237
|
-
probe: Schema.optional(Schema.Literals([
|
|
2238
|
-
"session",
|
|
2239
|
-
"membership",
|
|
2240
|
-
"lifecycle"
|
|
2241
|
-
])),
|
|
2242
|
-
reason: Schema.optional(Schema.Literals([
|
|
2243
|
-
"loading",
|
|
2244
|
-
"no-permission",
|
|
2245
|
-
"org-unavailable"
|
|
2246
|
-
]))
|
|
2247
|
-
})
|
|
2248
|
-
});
|
|
2249
|
-
/**
|
|
2250
|
-
* R06 (#1964) wired three of the four progress words to the durable writer that
|
|
2251
|
-
* commits each one. `account_ready` comes from `org/memberLifecycle.ts`, for
|
|
2252
|
-
* every membership row a claimed personal Account actually advanced.
|
|
2253
|
-
* `permission_applied` and `membership_activated` come from
|
|
2254
|
-
* `permission/mirror.ts`: the first only when the mirror wrote a NEW Permission
|
|
2255
|
-
* state, the second only when that call flipped a `pending_grant` row to
|
|
2256
|
-
* `active`. A replay of an applied command writes neither, so it reports
|
|
2257
|
-
* neither. `revoked` stays RESERVED and unproduced — no writer revokes a
|
|
2258
|
-
* membership yet, and #1459 owns that ceremony.
|
|
2259
|
-
*/
|
|
2260
|
-
const OrgInviteProgressedTelemetryEventSchema = Schema.Struct({
|
|
2261
|
-
name: Schema.Literal("org_invite_progressed"),
|
|
2262
|
-
props: Schema.Struct({
|
|
2263
|
-
...TelemetryEnvelopeProps,
|
|
2264
|
-
organization_id: OrgIdTelemetrySchema,
|
|
2265
|
-
progress: Schema.Literals([
|
|
2266
|
-
"account_ready",
|
|
2267
|
-
"permission_applied",
|
|
2268
|
-
"membership_activated",
|
|
2269
|
-
"revoked"
|
|
2270
|
-
]),
|
|
2271
|
-
/** The invited Party. The initiating actor stays on the envelope's identity. */
|
|
2272
|
-
member_party_id: Schema.String,
|
|
2273
|
-
occurred_at: Schema.Number
|
|
2274
|
-
})
|
|
2275
|
-
});
|
|
2276
|
-
const InvoiceIssuedTelemetryEventSchema = Schema.Struct({
|
|
2277
|
-
name: Schema.Literal("invoice_issued"),
|
|
2278
|
-
props: Schema.Struct({
|
|
2279
|
-
...TelemetryEnvelopeProps,
|
|
2280
|
-
request_id: Schema.String,
|
|
2281
|
-
issuer_scope_kind: ScopeKindSchema,
|
|
2282
|
-
issuer_scope_id: Schema.String,
|
|
2283
|
-
payer_party_id: OptionalString,
|
|
2284
|
-
occurred_at: Schema.Number
|
|
2285
|
-
})
|
|
2286
|
-
});
|
|
2287
|
-
const InvoiceRequestTransitionedTelemetryEventSchema = Schema.Struct({
|
|
2288
|
-
name: Schema.Literal("invoice_request_transitioned"),
|
|
2289
|
-
props: Schema.Struct({
|
|
2290
|
-
...TelemetryEnvelopeProps,
|
|
2291
|
-
request_id: Schema.String,
|
|
2292
|
-
transition: Schema.Literals([
|
|
2293
|
-
"approval_prepared",
|
|
2294
|
-
"declined",
|
|
2295
|
-
"cancelled"
|
|
2296
|
-
]),
|
|
2297
|
-
actor_scope_kind: ScopeKindSchema,
|
|
2298
|
-
actor_scope_id: Schema.String,
|
|
2299
|
-
occurred_at: Schema.Number
|
|
2300
|
-
})
|
|
2301
|
-
});
|
|
2302
|
-
const UiInvoiceStepCompletedTelemetryEventSchema = Schema.Struct({
|
|
2303
|
-
name: Schema.Literal("ui_invoice_step_completed"),
|
|
2304
|
-
props: Schema.Struct({
|
|
2305
|
-
...UiStepProps,
|
|
2306
|
-
step: Schema.Literals([
|
|
2307
|
-
"opened",
|
|
2308
|
-
"previewed",
|
|
2309
|
-
"dismissed",
|
|
2310
|
-
"submitted",
|
|
2311
|
-
"result_displayed",
|
|
2312
|
-
"refusal_displayed",
|
|
2313
|
-
"retry_selected"
|
|
2314
|
-
]),
|
|
2315
|
-
request_id: OptionalString
|
|
2316
|
-
})
|
|
2317
|
-
});
|
|
2318
|
-
const UiTreasuryStepCompletedTelemetryEventSchema = Schema.Struct({
|
|
2319
|
-
name: Schema.Literal("ui_treasury_step_completed"),
|
|
2320
|
-
props: Schema.Struct({
|
|
2321
|
-
...UiStepProps,
|
|
2322
|
-
step: Schema.Literals([
|
|
2323
|
-
"balance_displayed",
|
|
2324
|
-
"read_refusal_displayed",
|
|
2325
|
-
"retry_selected",
|
|
2326
|
-
"recovery_completed"
|
|
2327
|
-
]),
|
|
2328
|
-
account_kind: Schema.optional(AccountKindSchema)
|
|
2329
|
-
})
|
|
2330
|
-
});
|
|
2331
|
-
const UiReceiveStepCompletedTelemetryEventSchema = Schema.Struct({
|
|
2332
|
-
name: Schema.Literal("ui_receive_step_completed"),
|
|
2333
|
-
props: Schema.Struct({
|
|
2334
|
-
...UiStepProps,
|
|
2335
|
-
step: Schema.Literals([
|
|
2336
|
-
"instructions_displayed",
|
|
2337
|
-
"address_copied",
|
|
2338
|
-
"copy_failed",
|
|
2339
|
-
"refusal_displayed",
|
|
2340
|
-
"retry_selected"
|
|
2341
|
-
]),
|
|
2342
|
-
account_kind: Schema.optional(AccountKindSchema)
|
|
2343
|
-
})
|
|
2344
|
-
});
|
|
2345
|
-
const PayrollGroupChangedTelemetryEventSchema = Schema.Struct({
|
|
2346
|
-
name: Schema.Literal("payroll_group_changed"),
|
|
2347
|
-
props: Schema.Struct({
|
|
2348
|
-
...TelemetryEnvelopeProps,
|
|
2349
|
-
organization_id: OrgIdTelemetrySchema,
|
|
2350
|
-
change: Schema.Literals([
|
|
2351
|
-
"created",
|
|
2352
|
-
"updated",
|
|
2353
|
-
"deleted"
|
|
2354
|
-
]),
|
|
2355
|
-
group_id: Schema.String,
|
|
2356
|
-
member_count: Schema.Number,
|
|
2357
|
-
occurred_at: Schema.Number
|
|
2358
|
-
})
|
|
2359
|
-
});
|
|
2360
|
-
const PayrollRunTransitionedTelemetryEventSchema = Schema.Struct({
|
|
2361
|
-
name: Schema.Literal("payroll_run_transitioned"),
|
|
2362
|
-
props: Schema.Struct({
|
|
2363
|
-
...TelemetryEnvelopeProps,
|
|
2364
|
-
organization_id: OrgIdTelemetrySchema,
|
|
2365
|
-
transition: Schema.Literals([
|
|
2366
|
-
"prepared",
|
|
2367
|
-
"authorized",
|
|
2368
|
-
"settled"
|
|
2369
|
-
]),
|
|
2370
|
-
run_id: Schema.String,
|
|
2371
|
-
/**
|
|
2372
|
-
* The `paymentCommands` row at `payrollRuns.batchRef` — the durable owner of
|
|
2373
|
-
* this run's Payment membership. `payment_count` counts THAT command's
|
|
2374
|
-
* `paymentIds`, so an unrelated Payment quoting the run id changes neither.
|
|
2375
|
-
*/
|
|
2376
|
-
command_id: OptionalString,
|
|
2377
|
-
payment_count: Schema.optional(Schema.Number),
|
|
2378
|
-
occurred_at: Schema.Number
|
|
2379
|
-
})
|
|
2380
|
-
});
|
|
2381
|
-
const UiPayrollActionCompletedTelemetryEventSchema = Schema.Struct({
|
|
2382
|
-
name: Schema.Literal("ui_payroll_action_completed"),
|
|
2383
|
-
props: Schema.Struct({
|
|
2384
|
-
...UiStepProps,
|
|
2385
|
-
action: Schema.Literals([
|
|
2386
|
-
"opened",
|
|
2387
|
-
"refusal_displayed",
|
|
2388
|
-
"recovery_completed",
|
|
2389
|
-
"cancelled",
|
|
2390
|
-
"submitted_displayed"
|
|
2391
|
-
]),
|
|
2392
|
-
run_id: OptionalString
|
|
2393
|
-
})
|
|
2394
|
-
});
|
|
2395
|
-
const TELEMETRY_EVENT_SCHEMAS = {
|
|
2396
|
-
contact_relationship_changed: ContactRelationshipChangedTelemetryEventSchema,
|
|
2397
|
-
access_recovery_completed: AccessRecoveryCompletedTelemetryEventSchema,
|
|
2398
|
-
ui_access_step_completed: UiAccessStepCompletedTelemetryEventSchema,
|
|
2399
|
-
org_invite_progressed: OrgInviteProgressedTelemetryEventSchema,
|
|
2400
|
-
invoice_issued: InvoiceIssuedTelemetryEventSchema,
|
|
2401
|
-
invoice_request_transitioned: InvoiceRequestTransitionedTelemetryEventSchema,
|
|
2402
|
-
ui_invoice_step_completed: UiInvoiceStepCompletedTelemetryEventSchema,
|
|
2403
|
-
ui_treasury_step_completed: UiTreasuryStepCompletedTelemetryEventSchema,
|
|
2404
|
-
ui_receive_step_completed: UiReceiveStepCompletedTelemetryEventSchema,
|
|
2405
|
-
payroll_group_changed: PayrollGroupChangedTelemetryEventSchema,
|
|
2406
|
-
payroll_run_transitioned: PayrollRunTransitionedTelemetryEventSchema,
|
|
2407
|
-
ui_payroll_action_completed: UiPayrollActionCompletedTelemetryEventSchema,
|
|
2408
|
-
ui_contact_action_completed: UiContactActionCompletedTelemetryEventSchema,
|
|
2409
|
-
cli_diagnostic_completed: CliDiagnosticCompletedTelemetryEventSchema,
|
|
2410
|
-
cli_first_used: CliFirstUsedTelemetryEventSchema,
|
|
2411
|
-
cli_command_started: CliCommandStartedTelemetryEventSchema,
|
|
2412
|
-
cli_command_completed: CliCommandCompletedTelemetryEventSchema,
|
|
2413
|
-
activity_annotation_saved: ActivityAnnotationSavedTelemetryEventSchema,
|
|
2414
|
-
ui_activity_action_completed: UiActivityActionCompletedTelemetryEventSchema,
|
|
2415
|
-
auth_otp_requested: AuthOtpRequestedTelemetryEventSchema,
|
|
2416
|
-
auth_otp_delivered: AuthOtpDeliveredTelemetryEventSchema,
|
|
2417
|
-
auth_otp_expired: AuthOtpExpiredTelemetryEventSchema,
|
|
2418
|
-
auth_verified: AuthVerifiedTelemetryEventSchema,
|
|
2419
|
-
auth_failed: AuthFailedTelemetryEventSchema,
|
|
2420
|
-
identity_refused: IdentityRefusedTelemetryEventSchema,
|
|
2421
|
-
auth_signed_out: AuthSignedOutTelemetryEventSchema,
|
|
2422
|
-
onboarding_intent_selected: OnboardingIntentSelectedTelemetryEventSchema,
|
|
2423
|
-
onboarding_profile_submitted: OnboardingProfileSubmittedTelemetryEventSchema,
|
|
2424
|
-
onboarding_organization_submitted: OnboardingOrganizationSubmittedTelemetryEventSchema,
|
|
2425
|
-
onboarding_dashboard_reached: OnboardingDashboardReachedTelemetryEventSchema,
|
|
2426
|
-
provisioning_safe_created: ProvisioningSafeCreatedTelemetryEventSchema,
|
|
2427
|
-
provisioning_safe_confirmed: ProvisioningSafeConfirmedTelemetryEventSchema,
|
|
2428
|
-
bootstrap_resolved: BootstrapResolvedTelemetryEventSchema,
|
|
2429
|
-
bootstrap_failed: BootstrapFailedTelemetryEventSchema,
|
|
2430
|
-
member_activation_started: MemberActivationStartedTelemetryEventSchema,
|
|
2431
|
-
member_activation_ready: MemberActivationReadyTelemetryEventSchema,
|
|
2432
|
-
member_activation_failed: MemberActivationFailedTelemetryEventSchema,
|
|
2433
|
-
organization_creation_started: OrganizationCreationStartedTelemetryEventSchema,
|
|
2434
|
-
organization_creation_ready: OrganizationCreationReadyTelemetryEventSchema,
|
|
2435
|
-
organization_creation_failed: OrganizationCreationFailedTelemetryEventSchema,
|
|
2436
|
-
account_balance_read: AccountBalanceReadTelemetryEventSchema,
|
|
2437
|
-
account_balance_failed: AccountBalanceFailedTelemetryEventSchema,
|
|
2438
|
-
faucet_requested: FaucetRequestedTelemetryEventSchema,
|
|
2439
|
-
faucet_confirmed: FaucetConfirmedTelemetryEventSchema,
|
|
2440
|
-
faucet_failed: FaucetFailedTelemetryEventSchema,
|
|
2441
|
-
chain_upstream_fallback: ChainUpstreamFallbackTelemetryEventSchema,
|
|
2442
|
-
bundler_error: BundlerErrorTelemetryEventSchema,
|
|
2443
|
-
receipt_pending: ReceiptPendingTelemetryEventSchema,
|
|
2444
|
-
operation_retried: OperationRetriedTelemetryEventSchema,
|
|
2445
|
-
org_create_started: OrgCreateStartedTelemetryEventSchema,
|
|
2446
|
-
org_safe_created: OrgSafeCreatedTelemetryEventSchema,
|
|
2447
|
-
org_safe_confirmed: OrgSafeConfirmedTelemetryEventSchema,
|
|
2448
|
-
org_roles_seeded: OrgRolesSeededTelemetryEventSchema,
|
|
2449
|
-
org_created: OrgCreatedTelemetryEventSchema,
|
|
2450
|
-
org_create_failed: OrgCreateFailedTelemetryEventSchema,
|
|
2451
|
-
org_invite_sent: OrgInviteSentTelemetryEventSchema,
|
|
2452
|
-
org_invite_accepted: OrgInviteAcceptedTelemetryEventSchema,
|
|
2453
|
-
org_invite_expired: OrgInviteExpiredTelemetryEventSchema,
|
|
2454
|
-
payment_initiated: PaymentInitiatedTelemetryEventSchema,
|
|
2455
|
-
payment_settled: PaymentSettledTelemetryEventSchema,
|
|
2456
|
-
payment_failed: PaymentFailedTelemetryEventSchema,
|
|
2457
|
-
payment_verification_retry: PaymentVerificationRetryTelemetryEventSchema,
|
|
2458
|
-
payment_lifecycle_transition: PaymentLifecycleTransitionTelemetryEventSchema,
|
|
2459
|
-
quick_pay_external_address_acknowledged: QuickPayExternalAddressAcknowledgedTelemetryEventSchema,
|
|
2460
|
-
deposit_initiated: DepositInitiatedTelemetryEventSchema,
|
|
2461
|
-
deposit_settled: DepositSettledTelemetryEventSchema,
|
|
2462
|
-
permission_mirror_verification: PermissionMirrorVerificationTelemetryEventSchema,
|
|
2463
|
-
movement_scan_window: MovementScanWindowTelemetryEventSchema,
|
|
2464
|
-
movement_scan_checkpoint: MovementScanCheckpointTelemetryEventSchema,
|
|
2465
|
-
movement_scan_incident: MovementScanIncidentTelemetryEventSchema,
|
|
2466
|
-
indexer_drift_corrected: IndexerDriftCorrectedTelemetryEventSchema
|
|
2467
|
-
};
|
|
2468
|
-
const FINANCIAL_OPS_TARGET_TELEMETRY_PRODUCERS = [];
|
|
2469
|
-
/**
|
|
2470
|
-
* Contract-first events whose producer is owned by a later domain node.
|
|
2471
|
-
*
|
|
2472
|
-
* A domain node removes its entry when it adds the producer. The telemetry
|
|
2473
|
-
* gate rejects an entry that has a producer.
|
|
2474
|
-
*/
|
|
2475
|
-
const CONTRACT_FIRST_TELEMETRY_EVENTS = [];
|
|
2476
|
-
/**
|
|
2477
|
-
* Catalog events whose product mapper remains gated on the #1150 frontend
|
|
2478
|
-
* adoption. L1 S1 removes their retired SDK-flow producers without inventing
|
|
2479
|
-
* replacements inside the identity actor. The telemetry-spine gate enforces
|
|
2480
|
-
* planned-XOR-wired: a name must leave this list in the same change that adds
|
|
2481
|
-
* its real product-boundary producer.
|
|
2482
|
-
*/
|
|
2483
|
-
const PRODUCT_MAPPER_GATED_TELEMETRY_EVENTS = ["auth_otp_expired"];
|
|
2484
|
-
/** Catalogued browser observations whose producers remain owned by app adoption. */
|
|
2485
|
-
const BROWSER_GATED_TELEMETRY_EVENTS = [
|
|
2486
|
-
"onboarding_intent_selected",
|
|
2487
|
-
"onboarding_profile_submitted",
|
|
2488
|
-
"onboarding_organization_submitted",
|
|
2489
|
-
"onboarding_dashboard_reached",
|
|
2490
|
-
"ui_activity_action_completed",
|
|
2491
|
-
"ui_contact_action_completed",
|
|
2492
|
-
"ui_access_step_completed",
|
|
2493
|
-
"ui_invoice_step_completed",
|
|
2494
|
-
"ui_treasury_step_completed",
|
|
2495
|
-
"ui_receive_step_completed",
|
|
2496
|
-
"ui_payroll_action_completed"
|
|
2497
|
-
];
|
|
2498
|
-
let trackHandler = () => {};
|
|
2499
|
-
function setTrackHandler(handler) {
|
|
2500
|
-
const previous = trackHandler;
|
|
2501
|
-
trackHandler = handler;
|
|
2502
|
-
return previous;
|
|
2503
|
-
}
|
|
2504
|
-
function getTrackHandler() {
|
|
2505
|
-
return trackHandler;
|
|
2506
|
-
}
|
|
2507
|
-
function track(name, props) {
|
|
2508
|
-
trackHandler(name, props);
|
|
2509
|
-
}
|
|
2510
|
-
function redactTelemetryEvent(event, options = {}) {
|
|
2511
|
-
const props = redactTelemetryProps(event.name, event.props, options);
|
|
2512
|
-
return props === void 0 ? { name: event.name } : {
|
|
2513
|
-
name: event.name,
|
|
2514
|
-
props
|
|
2515
|
-
};
|
|
2516
|
-
}
|
|
2517
|
-
function redactTelemetryProps(name, props, options = {}) {
|
|
2518
|
-
if (props === void 0) return void 0;
|
|
2519
|
-
const clone = cloneProps(props);
|
|
2520
|
-
if (options.rawMode === true) return clone;
|
|
2521
|
-
for (const key of PII_PROP_KEYS_BY_EVENT[name] ?? []) redactProperty(clone, key);
|
|
2522
|
-
return clone;
|
|
2523
|
-
}
|
|
2524
|
-
/**
|
|
2525
|
-
* Remove query strings and fragments from every PostHog URL/referrer/path
|
|
2526
|
-
* property before transport. Browser applications may carry emails, draft ids,
|
|
2527
|
-
* or other capabilities in the URL; those values must never leave the origin.
|
|
2528
|
-
*
|
|
2529
|
-
* The callback replaces the event's data with a sanitized copy. Nested values
|
|
2530
|
-
* can refer to live clients or configuration; observation must never mutate them.
|
|
2531
|
-
*/
|
|
2532
|
-
function sanitizePostHogBrowserEvent(event, urlPolicy = "path-only") {
|
|
2533
|
-
if (event === null) return event;
|
|
2534
|
-
const transportToken = event.properties.token;
|
|
2535
|
-
const seen = /* @__PURE__ */ new WeakMap();
|
|
2536
|
-
event.properties = sanitizePostHogBrowserValue(event.properties, seen, urlPolicy);
|
|
2537
|
-
if (transportToken !== void 0) event.properties.token = transportToken;
|
|
2538
|
-
if (event.$set !== void 0) event.$set = sanitizePostHogBrowserValue(event.$set, seen, urlPolicy);
|
|
2539
|
-
if (event.$set_once !== void 0) event.$set_once = sanitizePostHogBrowserValue(event.$set_once, seen, urlPolicy);
|
|
2540
|
-
return event;
|
|
2541
|
-
}
|
|
2542
|
-
/**
|
|
2543
|
-
* Drop local events before transport. Sanitize and stamp every other browser
|
|
2544
|
-
* event with `capxul_env` and `producer: "browser"`.
|
|
2545
|
-
*/
|
|
2546
|
-
function createCapxulBeforeSend(capxulEnv, urlPolicy = "path-only") {
|
|
2547
|
-
return (event) => {
|
|
2548
|
-
if (capxulEnv === "local") return null;
|
|
2549
|
-
const sanitized = sanitizePostHogBrowserEvent(event, urlPolicy);
|
|
2550
|
-
if (sanitized === null) return sanitized;
|
|
2551
|
-
sanitized.properties.capxul_env = capxulEnv;
|
|
2552
|
-
sanitized.properties.producer ??= "browser";
|
|
2553
|
-
return sanitized;
|
|
2554
|
-
};
|
|
2555
|
-
}
|
|
2556
|
-
function utilityAppAnalytics(input) {
|
|
2557
|
-
return {
|
|
2558
|
-
api_host: input.host,
|
|
2559
|
-
defaults: "2026-01-30",
|
|
2560
|
-
autocapture: false,
|
|
2561
|
-
capture_pageview: false,
|
|
2562
|
-
capture_pageleave: true,
|
|
2563
|
-
disable_session_recording: true,
|
|
2564
|
-
disable_persistence: true,
|
|
2565
|
-
capture_heatmaps: false,
|
|
2566
|
-
capture_exceptions: false,
|
|
2567
|
-
capture_performance: false,
|
|
2568
|
-
disable_surveys: true,
|
|
2569
|
-
disable_web_experiments: true,
|
|
2570
|
-
disable_product_tours: true,
|
|
2571
|
-
disable_conversations: true,
|
|
2572
|
-
disable_external_dependency_loading: true,
|
|
2573
|
-
person_profiles: "identified_only",
|
|
2574
|
-
advanced_disable_flags: true,
|
|
2575
|
-
save_campaign_params: false,
|
|
2576
|
-
save_referrer: false,
|
|
2577
|
-
before_send: createCapxulBeforeSend(input.capxulEnv)
|
|
2578
|
-
};
|
|
2579
|
-
}
|
|
2580
|
-
/** In unstructured bodies, preserve text around explicitly named credentials. */
|
|
2581
|
-
const NETWORK_FIELD = /((?:"?)([A-Za-z_][A-Za-z0-9_.-]*)(?:"?)\s*[:=]\s*)("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|[^\s,;&}]+)/gu;
|
|
2582
|
-
function maskNetworkText(text, context) {
|
|
2583
|
-
return redactSecrets(text).replace(NETWORK_FIELD, (whole, prefix, name, value) => {
|
|
2584
|
-
if (!isCredentialField(name, context)) return whole;
|
|
2585
|
-
const quote = value.startsWith("\"") ? "\"" : value.startsWith("'") ? "'" : "";
|
|
2586
|
-
return `${prefix}${quote}[REDACTED]${quote}`;
|
|
2587
|
-
});
|
|
2588
|
-
}
|
|
2589
|
-
function maskNetworkHeaders(headers) {
|
|
2590
|
-
if (headers === void 0) return void 0;
|
|
2591
|
-
const masked = {};
|
|
2592
|
-
for (const [name, value] of Object.entries(headers)) masked[name] = isCredentialField(name, "header") ? "[REDACTED]" : /^(?:location|content-location|referer)$/iu.test(name) ? redactUrlSecrets(value) : maskNetworkText(value);
|
|
2593
|
-
return masked;
|
|
2594
|
-
}
|
|
2595
|
-
function maskJsonValue(value, depth = 0, context) {
|
|
2596
|
-
if (typeof value === "function" || typeof value === "symbol") return "[UNREADABLE]";
|
|
2597
|
-
if (typeof value === "string") return maskNetworkText(value, context);
|
|
2598
|
-
if (typeof value !== "object" || value === null) return value;
|
|
2599
|
-
if (depth >= 16) return "[REDACTED]";
|
|
2600
|
-
if (Array.isArray(value)) return value.map((item) => maskJsonValue(item, depth + 1, context));
|
|
2601
|
-
const masked = Object.create(null);
|
|
2602
|
-
for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(value))) {
|
|
2603
|
-
if (!descriptor.enumerable) continue;
|
|
2604
|
-
masked[key] = isCredentialField(key, context) ? "[REDACTED]" : !("value" in descriptor) ? "[UNREADABLE]" : typeof descriptor.value === "string" && isPostHogUrlProperty(key) ? redactUrlSecrets(descriptor.value) : maskJsonValue(descriptor.value, depth + 1, context);
|
|
2605
|
-
}
|
|
2606
|
-
return masked;
|
|
2607
|
-
}
|
|
2608
|
-
function maskNetworkBody(body, context) {
|
|
2609
|
-
try {
|
|
2610
|
-
if (typeof body !== "string") return maskJsonValue(body, 0, context);
|
|
2611
|
-
let parsed;
|
|
2612
|
-
try {
|
|
2613
|
-
parsed = JSON.parse(body);
|
|
2614
|
-
} catch {
|
|
2615
|
-
if (/^[^=&\s]+=[\s\S]*$/u.test(body)) return new URLSearchParams(Array.from(new URLSearchParams(body), ([name, value]) => [name, isCredentialField(name, context) ? "[REDACTED]" : maskNetworkText(value)])).toString();
|
|
2616
|
-
return maskNetworkText(body, context);
|
|
2617
|
-
}
|
|
2618
|
-
return JSON.stringify(maskJsonValue(parsed, 0, context));
|
|
2619
|
-
} catch {
|
|
2620
|
-
return "[UNREADABLE]";
|
|
2621
|
-
}
|
|
2622
|
-
}
|
|
2623
|
-
/** Keep request evidence while masking credential values at the browser boundary. */
|
|
2624
|
-
function maskCapturedNetworkRequest(request) {
|
|
2625
|
-
const requestUrl = request.name ?? request.url ?? "";
|
|
2626
|
-
let context;
|
|
2627
|
-
try {
|
|
2628
|
-
const path = new URL(requestUrl, "https://capxul.invalid").pathname;
|
|
2629
|
-
if (/\/(?:auth|oauth|sign-in|signin|login|verify-otp|verify-email)(?:\/|$)/iu.test(path)) context = "authentication";
|
|
2630
|
-
} catch {}
|
|
2631
|
-
return {
|
|
2632
|
-
...request,
|
|
2633
|
-
...request.name === void 0 ? {} : { name: redactUrlSecrets(request.name) },
|
|
2634
|
-
...request.url === void 0 ? {} : { url: redactUrlSecrets(request.url) },
|
|
2635
|
-
requestHeaders: maskNetworkHeaders(request.requestHeaders),
|
|
2636
|
-
responseHeaders: maskNetworkHeaders(request.responseHeaders),
|
|
2637
|
-
requestBody: maskNetworkBody(request.requestBody, context),
|
|
2638
|
-
responseBody: maskNetworkBody(request.responseBody)
|
|
2639
|
-
};
|
|
2640
|
-
}
|
|
2641
|
-
function productAppAnalytics(input) {
|
|
2642
|
-
return {
|
|
2643
|
-
api_host: input.host,
|
|
2644
|
-
defaults: "2026-01-30",
|
|
2645
|
-
autocapture: false,
|
|
2646
|
-
capture_pageview: false,
|
|
2647
|
-
capture_pageleave: true,
|
|
2648
|
-
disable_session_recording: false,
|
|
2649
|
-
disable_persistence: false,
|
|
2650
|
-
capture_heatmaps: false,
|
|
2651
|
-
capture_exceptions: true,
|
|
2652
|
-
capture_performance: {
|
|
2653
|
-
network_timing: true,
|
|
2654
|
-
web_vitals: false
|
|
2655
|
-
},
|
|
2656
|
-
disable_surveys: true,
|
|
2657
|
-
disable_web_experiments: true,
|
|
2658
|
-
disable_product_tours: true,
|
|
2659
|
-
disable_conversations: true,
|
|
2660
|
-
disable_external_dependency_loading: false,
|
|
2661
|
-
person_profiles: "identified_only",
|
|
2662
|
-
advanced_disable_flags: false,
|
|
2663
|
-
save_campaign_params: false,
|
|
2664
|
-
save_referrer: false,
|
|
2665
|
-
session_recording: {
|
|
2666
|
-
maskAllInputs: true,
|
|
2667
|
-
maskInputFn: (text, element) => {
|
|
2668
|
-
const autocomplete = element?.getAttribute("autocomplete")?.toLowerCase().split(/\s+/u) ?? [];
|
|
2669
|
-
return element?.getAttribute("type")?.toLowerCase() === "password" || autocomplete.some((value) => [
|
|
2670
|
-
"one-time-code",
|
|
2671
|
-
"current-password",
|
|
2672
|
-
"new-password"
|
|
2673
|
-
].includes(value)) || isCredentialField(element?.getAttribute("name") ?? "") || isCredentialField(element?.getAttribute("id") ?? "") ? "*".repeat(text.length) : maskNetworkText(text);
|
|
2674
|
-
},
|
|
2675
|
-
captureCanvas: { recordCanvas: false },
|
|
2676
|
-
recordHeaders: true,
|
|
2677
|
-
recordBody: true,
|
|
2678
|
-
maskCapturedNetworkRequestFn: maskCapturedNetworkRequest
|
|
2679
|
-
},
|
|
2680
|
-
before_send: createCapxulBeforeSend(input.capxulEnv, "diagnostic")
|
|
2681
|
-
};
|
|
2682
|
-
}
|
|
2683
|
-
/**
|
|
2684
|
-
* Apply a named privacy profile before an application-owned PostHog client
|
|
2685
|
-
* initializes. Hosts still own the vendor client and lifecycle; this helper
|
|
2686
|
-
* centralizes the security-relevant options and the missing-key opt-out (no
|
|
2687
|
-
* key ⇒ no client ⇒ no network call).
|
|
2688
|
-
*/
|
|
2689
|
-
function initializeCapxulBrowserAnalytics(profile, input, initialize) {
|
|
2690
|
-
const key = input.key?.trim();
|
|
2691
|
-
if (key === void 0 || key.length === 0) return void 0;
|
|
2692
|
-
try {
|
|
2693
|
-
const options = profile(input);
|
|
2694
|
-
const client = initialize(key, options);
|
|
2695
|
-
warnWhenReplayHasNoRecorder(options, client);
|
|
2696
|
-
return client;
|
|
2697
|
-
} catch {
|
|
2698
|
-
return;
|
|
2699
|
-
}
|
|
2700
|
-
}
|
|
2701
|
-
let replayRecorderWarned = false;
|
|
2702
|
-
/**
|
|
2703
|
-
* #1709: `posthog-js/dist/module.slim` never registers the session recording
|
|
2704
|
-
* manager, so a profile that enables replay records nothing with it. The
|
|
2705
|
-
* client exposes the manager as `sessionRecording` once `init` ran on the
|
|
2706
|
-
* standard build. Warn once per page so the missing build is visible.
|
|
2707
|
-
*/
|
|
2708
|
-
function warnWhenReplayHasNoRecorder(options, client) {
|
|
2709
|
-
if (replayRecorderWarned) return;
|
|
2710
|
-
const replayEnabled = typeof options === "object" && options !== null && options.disable_session_recording === false;
|
|
2711
|
-
const recorderMissing = typeof client === "object" && client !== null && client.sessionRecording === void 0;
|
|
2712
|
-
if (!replayEnabled || !recorderMissing) return;
|
|
2713
|
-
replayRecorderWarned = true;
|
|
2714
|
-
console.warn("@capxul/observability: session replay is enabled but the PostHog client has no session recording manager. Import the standard `posthog-js` build; `posthog-js/dist/module.slim` records nothing.");
|
|
2715
|
-
}
|
|
2716
|
-
/** The utility profile, pre-bound — the shape ADR-0016's consumers already use. */
|
|
2717
|
-
function initializePostHogBrowserAnalytics(input, initialize) {
|
|
2718
|
-
return initializeCapxulBrowserAnalytics(utilityAppAnalytics, input, initialize);
|
|
2719
|
-
}
|
|
2720
|
-
/**
|
|
2721
|
-
* Build an explicit SPA pageview sink for toolbar-free PostHog clients. The
|
|
2722
|
-
* pathname-only input avoids query capabilities, repeated pathnames are
|
|
2723
|
-
* deduplicated, and vendor failures remain best-effort.
|
|
2724
|
-
*/
|
|
2725
|
-
function createPostHogBrowserPageviewTracker(client) {
|
|
2726
|
-
let previousPathname;
|
|
2727
|
-
return (pathname) => {
|
|
2728
|
-
if (client === null || client === void 0) return;
|
|
2729
|
-
const safePathname = stripUrlQueryAndFragment(pathname);
|
|
2730
|
-
if (safePathname === previousPathname) return;
|
|
2731
|
-
try {
|
|
2732
|
-
Promise.resolve(client.capture("$pageview", { $pathname: safePathname })).catch(() => {});
|
|
2733
|
-
previousPathname = safePathname;
|
|
2734
|
-
} catch {}
|
|
2735
|
-
};
|
|
2736
|
-
}
|
|
2737
|
-
function sanitizePostHogBrowserValue(value, seen, urlPolicy) {
|
|
2738
|
-
if (typeof value !== "object" || value === null || value instanceof Date) return value;
|
|
2739
|
-
if (seen.has(value)) return seen.get(value);
|
|
2740
|
-
if (Array.isArray(value)) {
|
|
2741
|
-
const copy = [];
|
|
2742
|
-
seen.set(value, copy);
|
|
2743
|
-
for (let index = 0; index < value.length; index++) {
|
|
2744
|
-
const item = value[index];
|
|
2745
|
-
copy[index] = typeof item === "string" ? maskNetworkText(item) : sanitizePostHogBrowserValue(item, seen, urlPolicy);
|
|
2746
|
-
}
|
|
2747
|
-
return copy;
|
|
2748
|
-
}
|
|
2749
|
-
const properties = Object.create(null);
|
|
2750
|
-
seen.set(value, properties);
|
|
2751
|
-
for (const [key, nestedValue] of Object.entries(value)) {
|
|
2752
|
-
if (isPostHogQueryDerivedProperty(key)) continue;
|
|
2753
|
-
if (isCredentialField(key)) {
|
|
2754
|
-
properties[key] = "[REDACTED]";
|
|
2755
|
-
continue;
|
|
2756
|
-
}
|
|
2757
|
-
if (typeof nestedValue === "string") {
|
|
2758
|
-
properties[key] = isPostHogUrlProperty(key) ? urlPolicy === "path-only" ? stripUrlQueryAndFragment(nestedValue) : redactUrlSecrets(nestedValue) : maskNetworkText(nestedValue);
|
|
2759
|
-
continue;
|
|
2760
|
-
}
|
|
2761
|
-
properties[key] = sanitizePostHogBrowserValue(nestedValue, seen, urlPolicy);
|
|
2762
|
-
}
|
|
2763
|
-
return properties;
|
|
2764
|
-
}
|
|
2765
|
-
const POSTHOG_QUERY_DERIVED_PROPERTY_NAMES = [
|
|
2766
|
-
"utm_source",
|
|
2767
|
-
"utm_medium",
|
|
2768
|
-
"utm_campaign",
|
|
2769
|
-
"utm_content",
|
|
2770
|
-
"utm_term",
|
|
2771
|
-
"gad_source",
|
|
2772
|
-
"mc_cid",
|
|
2773
|
-
"gclid",
|
|
2774
|
-
"gclsrc",
|
|
2775
|
-
"dclid",
|
|
2776
|
-
"gbraid",
|
|
2777
|
-
"wbraid",
|
|
2778
|
-
"fbclid",
|
|
2779
|
-
"msclkid",
|
|
2780
|
-
"twclid",
|
|
2781
|
-
"li_fat_id",
|
|
2782
|
-
"igshid",
|
|
2783
|
-
"ttclid",
|
|
2784
|
-
"rdt_cid",
|
|
2785
|
-
"epik",
|
|
2786
|
-
"qclid",
|
|
2787
|
-
"sccid",
|
|
2788
|
-
"irclid",
|
|
2789
|
-
"_kx",
|
|
2790
|
-
"ph_keyword"
|
|
2791
|
-
];
|
|
2792
|
-
function isPostHogQueryDerivedProperty(key) {
|
|
2793
|
-
const normalized = key.toLowerCase();
|
|
2794
|
-
return POSTHOG_QUERY_DERIVED_PROPERTY_NAMES.some((propertyName) => normalized === propertyName || normalized.endsWith(`_${propertyName}`) || normalized.endsWith(`$${propertyName}`));
|
|
2795
|
-
}
|
|
2796
|
-
function isPostHogUrlProperty(key) {
|
|
2797
|
-
const normalized = key.toLowerCase();
|
|
2798
|
-
return normalized.includes("url") || normalized.includes("referrer") || normalized.includes("path") || normalized.includes("filename");
|
|
2799
|
-
}
|
|
2800
|
-
function stripUrlQueryAndFragment(value) {
|
|
2801
|
-
const queryIndex = value.indexOf("?");
|
|
2802
|
-
const fragmentIndex = value.indexOf("#");
|
|
2803
|
-
if (queryIndex === -1 && fragmentIndex === -1) return value;
|
|
2804
|
-
if (queryIndex === -1) return value.slice(0, fragmentIndex);
|
|
2805
|
-
if (fragmentIndex === -1) return value.slice(0, queryIndex);
|
|
2806
|
-
return value.slice(0, Math.min(queryIndex, fragmentIndex));
|
|
2807
|
-
}
|
|
2808
|
-
var RecordingTelemetryAdapter = class {
|
|
2809
|
-
#events = [];
|
|
2810
|
-
#rawMode;
|
|
2811
|
-
constructor(options = {}) {
|
|
2812
|
-
this.#rawMode = options.rawMode === true;
|
|
2813
|
-
}
|
|
2814
|
-
get events() {
|
|
2815
|
-
return this.#events.map((event) => cloneEvent(event));
|
|
2816
|
-
}
|
|
2817
|
-
emit(event) {
|
|
2818
|
-
return Effect.sync(() => {
|
|
2819
|
-
this.#events.push(redactTelemetryEvent(event, { rawMode: this.#rawMode }));
|
|
2820
|
-
});
|
|
2821
|
-
}
|
|
2822
|
-
identify(_input) {
|
|
2823
|
-
return Effect.void;
|
|
2824
|
-
}
|
|
2825
|
-
group(_input) {
|
|
2826
|
-
return Effect.void;
|
|
2827
|
-
}
|
|
2828
|
-
reset() {
|
|
2829
|
-
return Effect.void;
|
|
2830
|
-
}
|
|
2831
|
-
reportHandledError(_error, _context) {
|
|
2832
|
-
return Effect.void;
|
|
2833
|
-
}
|
|
2834
|
-
clear() {
|
|
2835
|
-
this.#events.length = 0;
|
|
2836
|
-
}
|
|
2837
|
-
};
|
|
2838
|
-
var PostHogTelemetryAdapter = class {
|
|
2839
|
-
#capture;
|
|
2840
|
-
constructor(deps) {
|
|
2841
|
-
this.#capture = deps.capture;
|
|
2842
|
-
}
|
|
2843
|
-
emit(event) {
|
|
2844
|
-
return Effect.sync(() => {
|
|
2845
|
-
try {
|
|
2846
|
-
Promise.resolve(this.#capture(event.name, redactTelemetryProps(event.name, event.props))).catch(() => {});
|
|
2847
|
-
} catch {}
|
|
2848
|
-
});
|
|
2849
|
-
}
|
|
2850
|
-
identify(_input) {
|
|
2851
|
-
return Effect.void;
|
|
2852
|
-
}
|
|
2853
|
-
group(_input) {
|
|
2854
|
-
return Effect.void;
|
|
2855
|
-
}
|
|
2856
|
-
reset() {
|
|
2857
|
-
return Effect.void;
|
|
2858
|
-
}
|
|
2859
|
-
reportHandledError(_error, _context) {
|
|
2860
|
-
return Effect.void;
|
|
2861
|
-
}
|
|
2862
|
-
};
|
|
2863
|
-
var InMemoryTelemetryBusAdapter = class {
|
|
2864
|
-
#subscribers = /* @__PURE__ */ new Set();
|
|
2865
|
-
#rawMode;
|
|
2866
|
-
constructor(options = {}) {
|
|
2867
|
-
this.#rawMode = options.rawMode === true;
|
|
2868
|
-
}
|
|
2869
|
-
subscribe(handler) {
|
|
2870
|
-
this.#subscribers.add(handler);
|
|
2871
|
-
return () => {
|
|
2872
|
-
this.#subscribers.delete(handler);
|
|
2873
|
-
};
|
|
2874
|
-
}
|
|
2875
|
-
emit(event) {
|
|
2876
|
-
return Effect.sync(() => {
|
|
2877
|
-
const delivered = redactTelemetryEvent(event, { rawMode: this.#rawMode });
|
|
2878
|
-
for (const handler of this.#subscribers) try {
|
|
2879
|
-
handler(cloneEvent(delivered));
|
|
2880
|
-
} catch {}
|
|
2881
|
-
});
|
|
2882
|
-
}
|
|
2883
|
-
identify(_input) {
|
|
2884
|
-
return Effect.void;
|
|
2885
|
-
}
|
|
2886
|
-
group(_input) {
|
|
2887
|
-
return Effect.void;
|
|
2888
|
-
}
|
|
2889
|
-
reset() {
|
|
2890
|
-
return Effect.void;
|
|
2891
|
-
}
|
|
2892
|
-
reportHandledError(_error, _context) {
|
|
2893
|
-
return Effect.void;
|
|
2894
|
-
}
|
|
2895
|
-
};
|
|
2896
|
-
const PII_PROP_KEYS_BY_EVENT = {
|
|
2897
|
-
auth_otp_requested: ["email"],
|
|
2898
|
-
auth_otp_delivered: ["email"],
|
|
2899
|
-
auth_otp_expired: ["email"],
|
|
2900
|
-
auth_failed: ["email"]
|
|
2901
|
-
};
|
|
2902
|
-
function redactProperty(props, key) {
|
|
2903
|
-
const value = props[key];
|
|
2904
|
-
if (typeof value === "string") props[key] = sha256Hex(value).slice(0, 12);
|
|
2905
|
-
}
|
|
2906
|
-
function cloneEvent(event) {
|
|
2907
|
-
if (event.props === void 0) return { name: event.name };
|
|
2908
|
-
return {
|
|
2909
|
-
name: event.name,
|
|
2910
|
-
props: cloneProps(event.props)
|
|
2911
|
-
};
|
|
2912
|
-
}
|
|
2913
|
-
function cloneProps(props) {
|
|
2914
|
-
const cloned = {};
|
|
2915
|
-
for (const [key, value] of Object.entries(props)) cloned[key] = cloneTelemetryValue(value);
|
|
2916
|
-
return cloned;
|
|
2917
|
-
}
|
|
2918
|
-
function cloneTelemetryValue(value) {
|
|
2919
|
-
if (Array.isArray(value)) return value.map(cloneTelemetryValue);
|
|
2920
|
-
if (value === null || typeof value !== "object") return value;
|
|
2921
|
-
if (Object.getPrototypeOf(value) !== Object.prototype) return value;
|
|
2922
|
-
const cloned = {};
|
|
2923
|
-
for (const [key, nested] of Object.entries(value)) cloned[key] = cloneTelemetryValue(nested);
|
|
2924
|
-
return cloned;
|
|
2925
|
-
}
|
|
2926
|
-
const SHA256_INITIAL_HASH = [
|
|
2927
|
-
1779033703,
|
|
2928
|
-
3144134277,
|
|
2929
|
-
1013904242,
|
|
2930
|
-
2773480762,
|
|
2931
|
-
1359893119,
|
|
2932
|
-
2600822924,
|
|
2933
|
-
528734635,
|
|
2934
|
-
1541459225
|
|
2935
|
-
];
|
|
2936
|
-
const SHA256_K = [
|
|
2937
|
-
1116352408,
|
|
2938
|
-
1899447441,
|
|
2939
|
-
3049323471,
|
|
2940
|
-
3921009573,
|
|
2941
|
-
961987163,
|
|
2942
|
-
1508970993,
|
|
2943
|
-
2453635748,
|
|
2944
|
-
2870763221,
|
|
2945
|
-
3624381080,
|
|
2946
|
-
310598401,
|
|
2947
|
-
607225278,
|
|
2948
|
-
1426881987,
|
|
2949
|
-
1925078388,
|
|
2950
|
-
2162078206,
|
|
2951
|
-
2614888103,
|
|
2952
|
-
3248222580,
|
|
2953
|
-
3835390401,
|
|
2954
|
-
4022224774,
|
|
2955
|
-
264347078,
|
|
2956
|
-
604807628,
|
|
2957
|
-
770255983,
|
|
2958
|
-
1249150122,
|
|
2959
|
-
1555081692,
|
|
2960
|
-
1996064986,
|
|
2961
|
-
2554220882,
|
|
2962
|
-
2821834349,
|
|
2963
|
-
2952996808,
|
|
2964
|
-
3210313671,
|
|
2965
|
-
3336571891,
|
|
2966
|
-
3584528711,
|
|
2967
|
-
113926993,
|
|
2968
|
-
338241895,
|
|
2969
|
-
666307205,
|
|
2970
|
-
773529912,
|
|
2971
|
-
1294757372,
|
|
2972
|
-
1396182291,
|
|
2973
|
-
1695183700,
|
|
2974
|
-
1986661051,
|
|
2975
|
-
2177026350,
|
|
2976
|
-
2456956037,
|
|
2977
|
-
2730485921,
|
|
2978
|
-
2820302411,
|
|
2979
|
-
3259730800,
|
|
2980
|
-
3345764771,
|
|
2981
|
-
3516065817,
|
|
2982
|
-
3600352804,
|
|
2983
|
-
4094571909,
|
|
2984
|
-
275423344,
|
|
2985
|
-
430227734,
|
|
2986
|
-
506948616,
|
|
2987
|
-
659060556,
|
|
2988
|
-
883997877,
|
|
2989
|
-
958139571,
|
|
2990
|
-
1322822218,
|
|
2991
|
-
1537002063,
|
|
2992
|
-
1747873779,
|
|
2993
|
-
1955562222,
|
|
2994
|
-
2024104815,
|
|
2995
|
-
2227730452,
|
|
2996
|
-
2361852424,
|
|
2997
|
-
2428436474,
|
|
2998
|
-
2756734187,
|
|
2999
|
-
3204031479,
|
|
3000
|
-
3329325298
|
|
3001
|
-
];
|
|
3002
|
-
function sha256Hex(input) {
|
|
3003
|
-
const padded = padSha256Message(new TextEncoder().encode(input));
|
|
3004
|
-
const view = new DataView(padded.buffer, padded.byteOffset, padded.byteLength);
|
|
3005
|
-
const words = /* @__PURE__ */ new Uint32Array(64);
|
|
3006
|
-
let h0 = SHA256_INITIAL_HASH[0];
|
|
3007
|
-
let h1 = SHA256_INITIAL_HASH[1];
|
|
3008
|
-
let h2 = SHA256_INITIAL_HASH[2];
|
|
3009
|
-
let h3 = SHA256_INITIAL_HASH[3];
|
|
3010
|
-
let h4 = SHA256_INITIAL_HASH[4];
|
|
3011
|
-
let h5 = SHA256_INITIAL_HASH[5];
|
|
3012
|
-
let h6 = SHA256_INITIAL_HASH[6];
|
|
3013
|
-
let h7 = SHA256_INITIAL_HASH[7];
|
|
3014
|
-
for (let offset = 0; offset < padded.byteLength; offset += 64) {
|
|
3015
|
-
for (let i = 0; i < 16; i++) words[i] = view.getUint32(offset + i * 4);
|
|
3016
|
-
for (let i = 16; i < 64; i++) {
|
|
3017
|
-
const s0 = rotr(words[i - 15], 7) ^ rotr(words[i - 15], 18) ^ words[i - 15] >>> 3;
|
|
3018
|
-
const s1 = rotr(words[i - 2], 17) ^ rotr(words[i - 2], 19) ^ words[i - 2] >>> 10;
|
|
3019
|
-
words[i] = words[i - 16] + s0 + words[i - 7] + s1 >>> 0;
|
|
3020
|
-
}
|
|
3021
|
-
let a = h0;
|
|
3022
|
-
let b = h1;
|
|
3023
|
-
let c = h2;
|
|
3024
|
-
let d = h3;
|
|
3025
|
-
let e = h4;
|
|
3026
|
-
let f = h5;
|
|
3027
|
-
let g = h6;
|
|
3028
|
-
let h = h7;
|
|
3029
|
-
for (let i = 0; i < 64; i++) {
|
|
3030
|
-
const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
3031
|
-
const ch = e & f ^ ~e & g;
|
|
3032
|
-
const temp1 = h + s1 + ch + SHA256_K[i] + words[i] >>> 0;
|
|
3033
|
-
const temp2 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) + (a & b ^ a & c ^ b & c) >>> 0;
|
|
3034
|
-
h = g;
|
|
3035
|
-
g = f;
|
|
3036
|
-
f = e;
|
|
3037
|
-
e = d + temp1 >>> 0;
|
|
3038
|
-
d = c;
|
|
3039
|
-
c = b;
|
|
3040
|
-
b = a;
|
|
3041
|
-
a = temp1 + temp2 >>> 0;
|
|
3042
|
-
}
|
|
3043
|
-
h0 = h0 + a >>> 0;
|
|
3044
|
-
h1 = h1 + b >>> 0;
|
|
3045
|
-
h2 = h2 + c >>> 0;
|
|
3046
|
-
h3 = h3 + d >>> 0;
|
|
3047
|
-
h4 = h4 + e >>> 0;
|
|
3048
|
-
h5 = h5 + f >>> 0;
|
|
3049
|
-
h6 = h6 + g >>> 0;
|
|
3050
|
-
h7 = h7 + h >>> 0;
|
|
3051
|
-
}
|
|
3052
|
-
return [
|
|
3053
|
-
h0,
|
|
3054
|
-
h1,
|
|
3055
|
-
h2,
|
|
3056
|
-
h3,
|
|
3057
|
-
h4,
|
|
3058
|
-
h5,
|
|
3059
|
-
h6,
|
|
3060
|
-
h7
|
|
3061
|
-
].map((word) => word.toString(16).padStart(8, "0")).join("");
|
|
3062
|
-
}
|
|
3063
|
-
function padSha256Message(bytes) {
|
|
3064
|
-
const bitLength = bytes.byteLength * 8;
|
|
3065
|
-
const zeroPadLength = (64 - (bytes.byteLength + 1 + 8) % 64) % 64;
|
|
3066
|
-
const output = new Uint8Array(bytes.byteLength + 1 + zeroPadLength + 8);
|
|
3067
|
-
output.set(bytes);
|
|
3068
|
-
output[bytes.byteLength] = 128;
|
|
3069
|
-
const view = new DataView(output.buffer);
|
|
3070
|
-
view.setUint32(output.byteLength - 8, Math.floor(bitLength / 4294967296));
|
|
3071
|
-
view.setUint32(output.byteLength - 4, bitLength >>> 0);
|
|
3072
|
-
return output;
|
|
3073
|
-
}
|
|
3074
|
-
function rotr(value, bits) {
|
|
3075
|
-
return value >>> bits | value << 32 - bits;
|
|
3076
|
-
}
|
|
3077
|
-
//#endregion
|
|
3078
|
-
export { OrgCreatedTelemetryEventSchema as $, CAPXUL_OPERATIONS as $t, FINANCIAL_OPS_TARGET_TELEMETRY_PRODUCERS as A, TELEMETRY_JOURNEYS as At, MemberActivationFailedTelemetryEventSchema as B, createPostHogBrowserPageviewTracker as Bt, CliCommandCompletedTelemetryEventSchema as C, QuickPayExternalAddressAcknowledgedTelemetryEventSchema as Ct, ContactRelationshipChangedTelemetryEventSchema as D, SYNCABLE_CAPXUL_ENVS as Dt, CliFirstUsedTelemetryEventSchema as E, ResponseHeadersSchema as Et, IdentityRefusedTelemetryEventSchema as F, UiInvoiceStepCompletedTelemetryEventSchema as Ft, MovementScanWindowTelemetryEventSchema as G, productAppAnalytics as Gt, MemberActivationStartedTelemetryEventSchema as H, initializeCapxulBrowserAnalytics as Ht, InMemoryTelemetryBusAdapter as I, UiPayrollActionCompletedTelemetryEventSchema as It, OnboardingOrganizationSubmittedTelemetryEventSchema as J, sanitizePostHogBrowserEvent as Jt, OnboardingDashboardReachedTelemetryEventSchema as K, redactTelemetryEvent as Kt, IndexerDriftCorrectedTelemetryEventSchema as L, UiReceiveStepCompletedTelemetryEventSchema as Lt, FaucetConfirmedTelemetryEventSchema as M, UiAccessStepCompletedTelemetryEventSchema as Mt, FaucetFailedTelemetryEventSchema as N, UiActivityActionCompletedTelemetryEventSchema as Nt, DepositInitiatedTelemetryEventSchema as O, TELEMETRY_EVENT_NAMES as Ot, FaucetRequestedTelemetryEventSchema as P, UiContactActionCompletedTelemetryEventSchema as Pt, OrgCreateStartedTelemetryEventSchema as Q, utilityAppAnalytics as Qt, InvoiceIssuedTelemetryEventSchema as R, UiTreasuryStepCompletedTelemetryEventSchema as Rt, ChainUpstreamSchema as S, ProvisioningSafeCreatedTelemetryEventSchema as St, CliDiagnosticCompletedTelemetryEventSchema as T, RecordingTelemetryAdapter as Tt, MovementScanCheckpointTelemetryEventSchema as U, initializePostHogBrowserAnalytics as Ut, MemberActivationReadyTelemetryEventSchema as V, getTrackHandler as Vt, MovementScanIncidentTelemetryEventSchema as W, maskCapturedNetworkRequest as Wt, OperationRetriedTelemetryEventSchema as X, stampTelemetryEnvelope as Xt, OnboardingProfileSubmittedTelemetryEventSchema as Y, setTrackHandler as Yt, OrgCreateFailedTelemetryEventSchema as Z, track as Zt, CLI_COMMAND_NAMES as _, PayrollGroupChangedTelemetryEventSchema as _t, AuthFailedTelemetryEventSchema as a, redactSecrets as an, OrgSafeConfirmedTelemetryEventSchema as at, ChainAttemptSchema as b, PostHogTelemetryAdapter as bt, AuthOtpRequestedTelemetryEventSchema as c, OrganizationCreationReadyTelemetryEventSchema as ct, BROWSER_GATED_TELEMETRY_EVENTS as d, PRODUCT_MAPPER_GATED_TELEMETRY_EVENTS as dt, isCapxulOperation as en, OrgInviteAcceptedTelemetryEventSchema as et, BootstrapFailedTelemetryEventSchema as f, PaymentFailedTelemetryEventSchema as ft, CLI_CAPABILITIES as g, PaymentVerificationRetryTelemetryEventSchema as gt, CAPXUL_ENVS as h, PaymentSettledTelemetryEventSchema as ht, ActivityAnnotationSavedTelemetryEventSchema as i, isCredentialField as in, OrgRolesSeededTelemetryEventSchema as it, FailureModeSchema as j, TELEMETRY_PRODUCERS as jt, DepositSettledTelemetryEventSchema as k, TELEMETRY_EVENT_SCHEMAS as kt, AuthSignedOutTelemetryEventSchema as l, OrganizationCreationStartedTelemetryEventSchema as lt, BundlerErrorTelemetryEventSchema as m, PaymentLifecycleTransitionTelemetryEventSchema as mt, AccountBalanceFailedTelemetryEventSchema as n, CAPXUL_ERROR_CODES as nn, OrgInviteProgressedTelemetryEventSchema as nt, AuthOtpDeliveredTelemetryEventSchema as o, redactUrlSecrets as on, OrgSafeCreatedTelemetryEventSchema as ot, BootstrapResolvedTelemetryEventSchema as p, PaymentInitiatedTelemetryEventSchema as pt, OnboardingIntentSelectedTelemetryEventSchema as q, redactTelemetryProps as qt, AccountBalanceReadTelemetryEventSchema as r, FAILURE_MODES as rn, OrgInviteSentTelemetryEventSchema as rt, AuthOtpExpiredTelemetryEventSchema as s, OrganizationCreationFailedTelemetryEventSchema as st, AccessRecoveryCompletedTelemetryEventSchema as t, normalizeCapxulOperation as tn, OrgInviteExpiredTelemetryEventSchema as tt, AuthVerifiedTelemetryEventSchema as u, PII as ut, CLI_INVOCATION_KINDS as v, PayrollRunTransitionedTelemetryEventSchema as vt, CliCommandStartedTelemetryEventSchema as w, ReceiptPendingTelemetryEventSchema as wt, ChainUpstreamFallbackTelemetryEventSchema as x, ProvisioningSafeConfirmedTelemetryEventSchema as xt, CONTRACT_FIRST_TELEMETRY_EVENTS as y, PermissionMirrorVerificationTelemetryEventSchema as yt, InvoiceRequestTransitionedTelemetryEventSchema as z, createCapxulBeforeSend as zt };
|