@capxul/sdk 4.1.3 → 4.1.4

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.
@@ -1576,6 +1576,7 @@ const ActivityFilterProps = {
1576
1576
  filter_status: Schema.optional(Schema.Array(Schema.Literals([
1577
1577
  "pending",
1578
1578
  "settling",
1579
+ "unresolved",
1579
1580
  "pending_claim",
1580
1581
  "scheduled",
1581
1582
  "streaming",
@@ -4358,6 +4359,7 @@ function verifiedOperationFields(attributes) {
4358
4359
  /** Observe a public Effect that already uses the canonical CapxulError channel. */
4359
4360
  async function runCapxulEffect(effect, controls, operation = CAPXUL_OPERATIONS.runtime.port, runPromise = Effect.runPromise) {
4360
4361
  const invocation = readInvocationObservation(controls);
4362
+ let owningSpan;
4361
4363
  const correlationId = safeEngineeringIdentifier(invocation?.context?.correlationId ?? controls?.correlation_id);
4362
4364
  const context = invocation?.active === false ? void 0 : sanitizeObservationContext(invocation?.context);
4363
4365
  const fields = {
@@ -4384,6 +4386,10 @@ async function runCapxulEffect(effect, controls, operation = CAPXUL_OPERATIONS.r
4384
4386
  const failure = error instanceof CapxulError ? error : void 0;
4385
4387
  const outcome = Exit.isSuccess(exit) ? "succeeded" : failure?.code === "CANCELLED" ? "cancelled" : failure !== void 0 && EXPECTED_OPERATION_OUTCOMES.has(failure.code) ? "refused" : "failed";
4386
4388
  const span = yield* Effect.currentSpan.pipe(Effect.orDie);
4389
+ if (Exit.isFailure(exit) && invocation?.active === true) owningSpan = Object.freeze({
4390
+ traceId: span.traceId,
4391
+ spanId: span.spanId
4392
+ });
4387
4393
  const completion = {
4388
4394
  ...fields,
4389
4395
  ...verifiedOperationFields(span.attributes),
@@ -4397,7 +4403,10 @@ async function runCapxulEffect(effect, controls, operation = CAPXUL_OPERATIONS.r
4397
4403
  yield* (outcome === "failed" ? Effect.logError("capxul_sdk_operation") : Effect.logInfo("capxul_sdk_operation")).pipe(Effect.annotateLogs(completion), Effect.catchCause(() => Effect.void));
4398
4404
  return yield* Exit.isSuccess(exit) ? Effect.succeed(exit.value) : Effect.failCause(exit.cause);
4399
4405
  }).pipe(Effect.withSpan(operation)), controls));
4400
- return !result.ok && invocation !== void 0 ? markFailureInvocationSnapshot(result, invocation) : result;
4406
+ return !result.ok && invocation !== void 0 ? markFailureInvocationSnapshot(result, {
4407
+ ...invocation,
4408
+ ...owningSpan === void 0 ? {} : { owningSpan }
4409
+ }) : result;
4401
4410
  }
4402
4411
  /** Map machine-internal failure state onto the public SDK error vocabulary. */
4403
4412
  function publicIdentityFailure(failure) {
@@ -5219,7 +5228,7 @@ const moneyExecutionContract = {
5219
5228
  };
5220
5229
  //#endregion
5221
5230
  //#region package.json
5222
- var version = "4.1.3";
5231
+ var version = "4.1.4";
5223
5232
  //#endregion
5224
5233
  //#region src/telemetry/exception-projection.ts
5225
5234
  /** Fixed fallback for failures that have no safe message. */
@@ -5277,8 +5286,13 @@ function postHogFailureObservation(policy, fixedSnapshot) {
5277
5286
  const safeFailure = sanitizeFailureObservation(failure);
5278
5287
  const directContext = callStartSnapshot?.context ?? directSnapshot?.context;
5279
5288
  const actorId = callStartSnapshot?.actorId;
5289
+ const span = callStartSnapshot?.owningSpan;
5280
5290
  return [safeFailure, {
5281
5291
  ...postHogProperties(safeFailure, directContext),
5292
+ ...span !== void 0 && /^(?!0+$)[0-9a-f]{32}$/u.test(span.traceId) && /^(?!0+$)[0-9a-f]{16}$/u.test(span.spanId) ? {
5293
+ trace_id: span.traceId,
5294
+ span_id: span.spanId
5295
+ } : {},
5282
5296
  ...actorId !== void 0 && /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u.test(actorId) ? {
5283
5297
  actor_id: actorId,
5284
5298
  actor_kind: "authenticated",
@@ -5449,7 +5463,8 @@ function report(adapter, kind, operation, cause, invocation, origin, authoritati
5449
5463
  }, {
5450
5464
  active: invocation.active,
5451
5465
  ...invocation.actorId === void 0 ? {} : { actorId: invocation.actorId },
5452
- ...context === void 0 ? {} : { context }
5466
+ ...context === void 0 ? {} : { context },
5467
+ ...invocation.owningSpan === void 0 ? {} : { owningSpan: invocation.owningSpan }
5453
5468
  });
5454
5469
  try {
5455
5470
  ignoreDeliveryFailure(kind === "operation" ? adapter.captureOperationFailure(failure) : adapter.captureException(failure));
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as stampTelemetryEnvelope, A as safeExceptionLabel, B as resolveFailureMode, C as observeFailedResult, D as normalizeExceptionErrorKind, E as SDK_VERSION$1, F as causeChain, G as sanitizeObservationContext, H as readInvocationObservation, I as injectedWalletSigner, J as CAPXUL_FUNCTIONS, K as PAYMENT_DIRECTIONS, L as isSignerNotReadySignal, M as fromWei, N as isSettingUpLifecycle, O as normalizeExceptionOperation, P as formatTraceparent, Q as redactTelemetryProps, R as openfortSignerNotReadyCode, S as observationContextProps, T as EXCEPTION_MESSAGE, U as OBSERVATION_CONTEXT_HEADER, V as copyInvocationObservation, W as encodeObservationContextHeader, X as EngineeringTelemetryBootstrapPolicy, Y as BootstrapEnvelope, _ as fingerprintPaymentIntent, a as AccountReadPortTag, at as isRestoring, b as failureDetail, c as retryIdempotentRead, d as IdentityPortTag, et as CAPXUL_OPERATIONS, f as identityErrorFromCapxul, g as bootstrapErrorFromCapxul, h as BootstrapPortTag, i as smartAccountErrorFromCapxul, it as isClaimed, j as version, k as projectSdkException, l as PRODUCT_INVOCATION, m as convexCallErrorFromCapxul, n as detectAuthCacheAdapter, nt as normalizeCapxulOperation, o as accountReadErrorFromCapxul, p as ConvexCallPortTag, q as PAYMENT_STATUSES, r as SmartAccountPortTag, rt as destination, s as TelemetryPortTag, t as assembleCapxulClient, tt as isCapxulOperation, u as wireChainId, v as toWei, w as postHogFailureObservation, x as failureEvidenceProps, y as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, z as signerFailure } from "./create-capxul-client-CipLFLcJ.mjs";
1
+ import { $ as stampTelemetryEnvelope, A as safeExceptionLabel, B as resolveFailureMode, C as observeFailedResult, D as normalizeExceptionErrorKind, E as SDK_VERSION$1, F as causeChain, G as sanitizeObservationContext, H as readInvocationObservation, I as injectedWalletSigner, J as CAPXUL_FUNCTIONS, K as PAYMENT_DIRECTIONS, L as isSignerNotReadySignal, M as fromWei, N as isSettingUpLifecycle, O as normalizeExceptionOperation, P as formatTraceparent, Q as redactTelemetryProps, R as openfortSignerNotReadyCode, S as observationContextProps, T as EXCEPTION_MESSAGE, U as OBSERVATION_CONTEXT_HEADER, V as copyInvocationObservation, W as encodeObservationContextHeader, X as EngineeringTelemetryBootstrapPolicy, Y as BootstrapEnvelope, _ as fingerprintPaymentIntent, a as AccountReadPortTag, at as isRestoring, b as failureDetail, c as retryIdempotentRead, d as IdentityPortTag, et as CAPXUL_OPERATIONS, f as identityErrorFromCapxul, g as bootstrapErrorFromCapxul, h as BootstrapPortTag, i as smartAccountErrorFromCapxul, it as isClaimed, j as version, k as projectSdkException, l as PRODUCT_INVOCATION, m as convexCallErrorFromCapxul, n as detectAuthCacheAdapter, nt as normalizeCapxulOperation, o as accountReadErrorFromCapxul, p as ConvexCallPortTag, q as PAYMENT_STATUSES, r as SmartAccountPortTag, rt as destination, s as TelemetryPortTag, t as assembleCapxulClient, tt as isCapxulOperation, u as wireChainId, v as toWei, w as postHogFailureObservation, x as failureEvidenceProps, y as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, z as signerFailure } from "./create-capxul-client-B3ET402J.mjs";
2
2
  import { $ as CapxulError, A as toAuthUserId, B as toJwtToken, D as toAddress, E as toAccountId, F as toDurationMs, H as toOrgId, I as toEmail, J as toSessionToken, K as toPublishableKey, L as toEpochMs, M as toChainId, N as toCountryCode, O as toAllowedOrigin, P as toCurrencyCode, Q as CAPXUL_ERROR_CODES, R as toEpochSeconds, T as currencySymbolFor, U as toPartyId, V as toKycTier, X as HANDLE_RE, Y as toTesterKind, Z as decodeConvexError, d as AuthClientError, f as AuthClientPortTag, g as BASE_SEPOLIA_CHAIN_ID, h as normalizeBindingEmail, it as FAILURE_MODES, l as ClockPortTag, m as CAPXUL_PAYMENTS_V2_ADDRESS, nt as isCapxulError, q as toRoleKey, rt as CHAIN_UPSTREAMS, s as AuthCachePortTag, tt as Errors, u as authClientPortFromPromiseAdapter, x as EVM_ADDRESS_RE, z as toHandle } from "./clock-C2AUlq1V.mjs";
3
3
  import { n as SystemClockLayer } from "./OAuthBearerAuthClient-BHvDR8_0.mjs";
4
4
  import { Cause, Context, Data, Duration, Effect, Exit, Layer, Result, Schedule, SchemaIssue, SchemaParser, Scope, Tracer } from "effect";
@@ -1,4 +1,4 @@
1
- import { M as fromWei, Z as redactTelemetryEvent, f as identityErrorFromCapxul, g as bootstrapErrorFromCapxul, i as smartAccountErrorFromCapxul, m as convexCallErrorFromCapxul, o as accountReadErrorFromCapxul, t as assembleCapxulClient, u as wireChainId, v as toWei } from "../create-capxul-client-CipLFLcJ.mjs";
1
+ import { M as fromWei, Z as redactTelemetryEvent, f as identityErrorFromCapxul, g as bootstrapErrorFromCapxul, i as smartAccountErrorFromCapxul, m as convexCallErrorFromCapxul, o as accountReadErrorFromCapxul, t as assembleCapxulClient, u as wireChainId, v as toWei } from "../create-capxul-client-B3ET402J.mjs";
2
2
  import { $ as CapxulError, A as toAuthUserId, B as toJwtToken, D as toAddress, E as toAccountId, F as toDurationMs, I as toEmail, J as toSessionToken, K as toPublishableKey, L as toEpochMs, M as toChainId, N as toCountryCode, O as toAllowedOrigin, R as toEpochSeconds, V as toKycTier, _ as deriveCapxulSafeAddress, k as toAppId, n as InMemoryAuthCacheAdapter, t as readClockNow, tt as Errors, u as authClientPortFromPromiseAdapter, v as validateHandle, z as toHandle } from "../clock-C2AUlq1V.mjs";
3
3
  import { Effect, Result, Semaphore } from "effect";
4
4
  import { keccak256 } from "viem";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/sdk",
3
- "version": "4.1.3",
3
+ "version": "4.1.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Xelmar-tech/infrastructure.git",
@@ -47,10 +47,10 @@
47
47
  "vite": "npm:@voidzero-dev/vite-plus-core@0.3.0",
48
48
  "vite-plus": "0.3.0",
49
49
  "vitest": "4.1.11",
50
- "@capxul/config": "0.3.0",
51
50
  "@capxul/errors": "0.3.0",
51
+ "@capxul/observability": "4.1.4",
52
52
  "@capxul/types": "0.3.0",
53
- "@capxul/observability": "4.1.3",
53
+ "@capxul/config": "0.3.0",
54
54
  "@capxul/typescript-config": "0.0.0",
55
55
  "@capxul/wire": "0.7.0"
56
56
  },