@capxul/observability 2.6.1 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
1
  import { Layer, Tracer } from "effect";
2
2
  import { OtlpExporter } from "effect/unstable/observability";
3
-
4
3
  //#region src/engineering.d.ts
5
4
  type EngineeringProducer = "browser" | "server";
6
5
  declare const ENGINEERING_CAPXUL_ENVS: readonly ["development", "staging", "production", "local"];
@@ -31,7 +31,7 @@ const postHogOtlpEndpoints = (host) => {
31
31
  };
32
32
  };
33
33
  const ENGINEERING_CAPXUL_ENV_SET = new Set(ENGINEERING_CAPXUL_ENVS);
34
- const ENGINEERING_PRODUCERS = new Set(["browser", "server"]);
34
+ const ENGINEERING_PRODUCERS = /* @__PURE__ */ new Set(["browser", "server"]);
35
35
  const PUBLIC_POSTHOG_AUTHORIZATION = /^Bearer phc_[A-Za-z0-9_-]{1,191}$/u;
36
36
  const SAFE_RESOURCE_VALUE = /^[A-Za-z0-9][A-Za-z0-9._+@/-]{0,127}$/u;
37
37
  const validateEngineeringTelemetryConfig = (config) => {
package/dist/index.d.mts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Effect, Schema } from "effect";
2
-
3
2
  //#region ../errors/src/chain-cause.d.ts
4
3
  /**
5
4
  * Why an operation failed — the one flat vocabulary. The first four are the
@@ -8,7 +7,33 @@ import { Effect, Schema } from "effect";
8
7
  * (the SDK's `$exception` projection, the observability schema) and the type
9
8
  * can never drift apart.
10
9
  */
11
- declare const FAILURE_MODES: readonly [/** OTP cookies live on `localhost:PORT` but OpenFort hits the Convex host. */"auth-origin-mismatch", /** An old `userId` in scoped storage makes the SDK skip re-auth → 401. */"stale-openfort-cache", /** The selected app/deployment origin is not allowlisted → 401. */"app-env-allowlist", /** Sandboxed/headless browser with no Web Crypto. */"no-secure-context", /** One upstream answered HTTP 429 or JSON-RPC -32005. Retryable. */"rate-limited", /** No answer inside the budget. Retryable. */"timeout", /** HTTP 5xx, a connection failure, or a malformed envelope. Retryable. */"upstream-down", /** Simulation or execution reverted; `chain.revert` names it when decodable. */"revert", /** A balance pre-flight shortfall or a decoded `ERC20InsufficientBalance`. */"insufficient-balance", /** A decoded `ERC20InsufficientAllowance`. */"insufficient-allowance", /** The bundler's validation refused the operation (AA2x/AA3x); its text is carried. */"rejected", /** The gateway refused the token. */"unauthorized", /** No cause could be determined. */"unknown"];
10
+ declare const FAILURE_MODES: readonly [
11
+ /** OTP cookies live on `localhost:PORT` but OpenFort hits the Convex host. */
12
+ "auth-origin-mismatch",
13
+ /** An old `userId` in scoped storage makes the SDK skip re-auth → 401. */
14
+ "stale-openfort-cache",
15
+ /** The selected app/deployment origin is not allowlisted → 401. */
16
+ "app-env-allowlist",
17
+ /** Sandboxed/headless browser with no Web Crypto. */
18
+ "no-secure-context",
19
+ /** One upstream answered HTTP 429 or JSON-RPC -32005. Retryable. */
20
+ "rate-limited",
21
+ /** No answer inside the budget. Retryable. */
22
+ "timeout",
23
+ /** HTTP 5xx, a connection failure, or a malformed envelope. Retryable. */
24
+ "upstream-down",
25
+ /** Simulation or execution reverted; `chain.revert` names it when decodable. */
26
+ "revert",
27
+ /** A balance pre-flight shortfall or a decoded `ERC20InsufficientBalance`. */
28
+ "insufficient-balance",
29
+ /** A decoded `ERC20InsufficientAllowance`. */
30
+ "insufficient-allowance",
31
+ /** The bundler's validation refused the operation (AA2x/AA3x); its text is carried. */
32
+ "rejected",
33
+ /** The gateway refused the token. */
34
+ "unauthorized",
35
+ /** No cause could be determined. */
36
+ "unknown"];
12
37
  type FailureMode = (typeof FAILURE_MODES)[number];
13
38
  /** Who answered. `alto` is the bundler; `gateway` is the AA gateway's own logic. */
14
39
  declare const CHAIN_UPSTREAMS: readonly ["alchemy", "infura", "public", "alto", "gateway"];
@@ -631,7 +656,8 @@ declare const OrganizationCreationFailedTelemetryEventSchema: Schema.Struct<{
631
656
  readonly attempt_number: Schema.refine<number, Schema.Number>;
632
657
  readonly stage: Schema.Literals<readonly ["profile", "accountProvisioning", "accountClaim", "preparingFounderAccount", "awaitingFounderAuthorization", "submittingBootstrap", "confirmingBootstrap"]>;
633
658
  readonly error_code: Schema.String;
634
- readonly retryable: Schema.Boolean; /** #1655: the SDK's backoff before this attempt. Absent on the first attempt. */
659
+ readonly retryable: Schema.Boolean;
660
+ /** #1655: the SDK's backoff before this attempt. Absent on the first attempt. */
635
661
  readonly backoff_ms: Schema.optional<Schema.Codec<DurationMs, number, never, never>>;
636
662
  readonly failure_reason: Schema.optional<Schema.Literals<readonly ["deterministic_address_mismatch", "receipt_provider_unavailable", "receipt_mismatch", "block_provider_unavailable", "authority_event_mismatch", "allowance_timestamp_mismatch", "receipt_identity_unavailable", "receipt_identity_mismatch", "contract_code_unavailable", "contract_state_mismatch", "permission_projection_mismatch"]>>;
637
663
  }>;
@@ -1350,7 +1376,8 @@ declare const TELEMETRY_EVENT_SCHEMAS: {
1350
1376
  readonly attempt_number: Schema.refine<number, Schema.Number>;
1351
1377
  readonly stage: Schema.Literals<readonly ["profile", "accountProvisioning", "accountClaim", "preparingFounderAccount", "awaitingFounderAuthorization", "submittingBootstrap", "confirmingBootstrap"]>;
1352
1378
  readonly error_code: Schema.String;
1353
- readonly retryable: Schema.Boolean; /** #1655: the SDK's backoff before this attempt. Absent on the first attempt. */
1379
+ readonly retryable: Schema.Boolean;
1380
+ /** #1655: the SDK's backoff before this attempt. Absent on the first attempt. */
1354
1381
  readonly backoff_ms: Schema.optional<Schema.Codec<DurationMs, number, never, never>>;
1355
1382
  readonly failure_reason: Schema.optional<Schema.Literals<readonly ["deterministic_address_mismatch", "receipt_provider_unavailable", "receipt_mismatch", "block_provider_unavailable", "authority_event_mismatch", "allowance_timestamp_mismatch", "receipt_identity_unavailable", "receipt_identity_mismatch", "contract_code_unavailable", "contract_state_mismatch", "permission_projection_mismatch"]>>;
1356
1383
  }>;
@@ -1931,7 +1958,8 @@ interface PostHogProductAppOptions {
1931
1958
  readonly recordCanvas: false;
1932
1959
  };
1933
1960
  readonly recordHeaders: true;
1934
- readonly recordBody: true; /** Drops credential headers and masks secrets and OTP codes in bodies. */
1961
+ readonly recordBody: true;
1962
+ /** Drops credential headers and masks secrets and OTP codes in bodies. */
1935
1963
  readonly maskCapturedNetworkRequestFn: <T extends CapturedNetworkRequestLike>(request: T) => T;
1936
1964
  };
1937
1965
  readonly before_send: PostHogBeforeSend;
package/dist/index.mjs CHANGED
@@ -30,35 +30,6 @@ const CHAIN_UPSTREAMS = [
30
30
  "alto",
31
31
  "gateway"
32
32
  ];
33
- new Set([
34
- "NOT_AUTHENTICATED",
35
- "EMAIL_DELIVERY_FAILED",
36
- "PROFILE_NOT_FOUND",
37
- "SMART_ACCOUNT_MISSING",
38
- "PLAYER_NOT_FOUND",
39
- "ACCOUNT_NOT_FOUND",
40
- "PROVIDER_ERROR",
41
- "CAPABILITY_UNAVAILABLE",
42
- "INVALID_INPUT",
43
- "ENV_MISSING",
44
- "NOT_IMPLEMENTED",
45
- "VERIFICATION_REQUIRED",
46
- "INSUFFICIENT_BALANCE",
47
- "INVALID_RECIPIENT",
48
- "ROLE_PERMISSION_DENIED",
49
- "TRANSACTION_FAILED",
50
- "RATE_LIMITED",
51
- "NETWORK_ERROR",
52
- "UNKNOWN",
53
- "OTP_EXPIRED",
54
- "SIGNER_REJECTED",
55
- "CANCELLED",
56
- "WRONG_STATE",
57
- "STALE_EPOCH",
58
- "SUPERSEDED",
59
- "WORK_DIED",
60
- "ACTOR_STOPPED"
61
- ]);
62
33
  //#endregion
63
34
  //#region ../types/src/index.ts
64
35
  const EVM_ADDRESS_RE = /^0x[0-9a-f]{40}$/i;
@@ -1123,7 +1094,7 @@ function utilityAppAnalytics(input) {
1123
1094
  before_send: createCapxulBeforeSend(input.capxulEnv)
1124
1095
  };
1125
1096
  }
1126
- const CREDENTIAL_HEADERS = new Set([
1097
+ const CREDENTIAL_HEADERS = /* @__PURE__ */ new Set([
1127
1098
  "authorization",
1128
1099
  "proxy-authorization",
1129
1100
  "proxy-authenticate",
@@ -1536,7 +1507,7 @@ const SHA256_K = [
1536
1507
  function sha256Hex(input) {
1537
1508
  const padded = padSha256Message(new TextEncoder().encode(input));
1538
1509
  const view = new DataView(padded.buffer, padded.byteOffset, padded.byteLength);
1539
- const words = new Uint32Array(64);
1510
+ const words = /* @__PURE__ */ new Uint32Array(64);
1540
1511
  let h0 = SHA256_INITIAL_HASH[0];
1541
1512
  let h1 = SHA256_INITIAL_HASH[1];
1542
1513
  let h2 = SHA256_INITIAL_HASH[2];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/observability",
3
- "version": "2.6.1",
3
+ "version": "2.7.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,18 +31,19 @@
31
31
  },
32
32
  "devDependencies": {
33
33
  "@typescript/native": "npm:typescript@7.0.2",
34
- "@vitest/coverage-v8": "4.1.7",
34
+ "@vitest/coverage-v8": "4.1.11",
35
35
  "jsdom": "^29.1.1",
36
36
  "posthog-js": "^1.418.10",
37
- "vite-plus": "0.1.23",
38
- "vitest": "npm:@voidzero-dev/vite-plus-test@0.1.23",
37
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.3.0",
38
+ "vite-plus": "0.3.0",
39
+ "vitest": "4.1.11",
39
40
  "@capxul/errors": "0.0.2",
40
41
  "@capxul/types": "0.2.1",
41
42
  "@capxul/typescript-config": "0.0.0"
42
43
  },
43
44
  "scripts": {
44
45
  "check-types": "vp exec ../../node_modules/@typescript/native/bin/tsc -p tsconfig.json --noEmit",
45
- "lint": "oxlint -c ../../.oxlintrc.json . --deny-warnings",
46
+ "lint": "vp lint -c ../../.oxlintrc.json . --deny-warnings",
46
47
  "build": "NODE_OPTIONS=--max-old-space-size=8192 vp pack",
47
48
  "_vp-tasks-allowed": "vp-allowed: `test` + `test:coverage` are vp tasks in vite.config.ts so vitest self-writes don't bust cache (#205)."
48
49
  }