@capxul/sdk 4.20.0-beta.26 → 4.20.0-beta.27

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.
@@ -4823,10 +4823,19 @@ const ApprovalNetworkSchema = Schema.Struct({
4823
4823
  name: Schema.String,
4824
4824
  explorerUrl: Schema.String
4825
4825
  });
4826
+ /**
4827
+ * Whose money the operation moves: the person's own, or an Organization's,
4828
+ * which a reader follows through that Organization's scope.
4829
+ */
4830
+ const ApprovalActorSchema = Schema.Union([Schema.Struct({ kind: Schema.Literal("personal") }), Schema.Struct({
4831
+ kind: Schema.Literal("organization"),
4832
+ orgId: Schema.NonEmptyString
4833
+ })]);
4826
4834
  /** What the person reads before they sign. */
4827
4835
  const ApprovalSummarySchema = Schema.Struct({
4828
4836
  title: Schema.String,
4829
4837
  from: Schema.Struct({
4838
+ kind: Schema.Literals(["personal", "organization"]),
4830
4839
  label: Schema.String,
4831
4840
  address: AddressSchema$1
4832
4841
  }),
@@ -4848,6 +4857,7 @@ const ApprovalSchema = Schema.Struct({
4848
4857
  url: Schema.String,
4849
4858
  kind: Schema.Literals(APPROVAL_KINDS),
4850
4859
  state: Schema.Literals(APPROVAL_STATES),
4860
+ actor: ApprovalActorSchema,
4851
4861
  summary: ApprovalSummarySchema,
4852
4862
  operation: ApprovalOperationSchema,
4853
4863
  /** Who must sign: the owner key of the paying Safe. */
@@ -9135,7 +9145,11 @@ const ORGANIZATION_OPERATIONS = {
9135
9145
  seedNativeReadiness: "operator.fixtures.seedNativeReadiness",
9136
9146
  seedPrerequisites: "operator.fixtures.seedPrerequisites"
9137
9147
  },
9138
- identities: { purgeByEmail: "operator.identities.purgeByEmail" }
9148
+ identities: {
9149
+ purgeByEmail: "operator.identities.purgeByEmail",
9150
+ /** One Account and every row that refers to it, unless it has Payments or an Organization tie. */
9151
+ purgeAccount: "operator.identities.purgeAccount"
9152
+ }
9139
9153
  },
9140
9154
  /** Organizations' internal functions; its public rows join from `OPERATIONS`. */
9141
9155
  organizations: {
@@ -9385,7 +9399,11 @@ const PLATFORM_OPERATIONS = {
9385
9399
  recordUse: "applications.bootstraps.recordUse",
9386
9400
  resolve: "applications.bootstraps.resolve"
9387
9401
  },
9388
- keys: { issue: "applications.keys.issue" },
9402
+ keys: {
9403
+ issue: "applications.keys.issue",
9404
+ /** Operator-only: revoke one key by its id, whoever owns it. */
9405
+ revokeById: "applications.keys.revokeById"
9406
+ },
9389
9407
  quickstarts: {
9390
9408
  claim: "applications.quickstarts.claim",
9391
9409
  mint: "applications.quickstarts.mint"
@@ -12549,7 +12567,7 @@ function mapAccountLifecycle(input) {
12549
12567
  }
12550
12568
  //#endregion
12551
12569
  //#region package.json
12552
- var version = "4.20.0-beta.26";
12570
+ var version = "4.20.0-beta.27";
12553
12571
  //#endregion
12554
12572
  //#region src/observability/telemetry/exception-projection.ts
12555
12573
  /** Fixed fallback for failures that have no safe message. */
@@ -16750,6 +16768,13 @@ function subscribeFreshQuery(deps, args, listener, operation, projection, option
16750
16768
  }
16751
16769
  //#endregion
16752
16770
  //#region src/payments/lifecycle-execution.ts
16771
+ /**
16772
+ * The prepared command is this lifecycle intent; a retry also names the
16773
+ * original birth command of the scope it was asked for.
16774
+ */
16775
+ const lifecycleCommandCheck = (intent, expectedOrganizationId) => async (request, evidence) => await matchesIntent(intent)(request, evidence) && (intent.kind !== "retry" || (expectedOrganizationId === void 0 ? evidence.sourceCommand?.kind === "birth" && evidence.sourceCommand.actor.kind === "account" : evidence.sourceCommand?.kind === "birth" && evidence.sourceCommand.actor.kind === "organization" && evidence.sourceCommand.actor.orgId === expectedOrganizationId));
16776
+ /** The prepared command pays exactly the request the payer confirmed. */
16777
+ const requestPaymentCheck = (confirmation) => async (request) => "kind" in request && request.kind === "payment_request" && canonicalJson(request.confirmation) === canonicalJson(confirmation);
16753
16778
  function executePaymentLifecycle(deps, intent, signal, controls, expectedOrganizationId, onPrepared) {
16754
16779
  return executePrepared(deps, (signerAddress) => runIfActive(signal, CAPXUL_OPERATIONS.payments.prepareLifecycleExecution, () => withInvocationParentSpan(Effect.suspend(() => callOperation(deps.convexCall, lifecycles.prepareScoped, copyInvocationObservation(controls, {
16755
16780
  signerAddress,
@@ -16758,13 +16783,13 @@ function executePaymentLifecycle(deps, intent, signal, controls, expectedOrganiz
16758
16783
  kind: "organization",
16759
16784
  orgId: expectedOrganizationId
16760
16785
  }
16761
- })).pipe(Effect.mapError((publicError) => ({ publicError })))), controls), deps.runPromise), async (request, evidence) => await matchesIntent(intent)(request, evidence) && (intent.kind !== "retry" || (expectedOrganizationId === void 0 ? evidence.sourceCommand?.kind === "birth" && evidence.sourceCommand.actor.kind === "account" : evidence.sourceCommand?.kind === "birth" && evidence.sourceCommand.actor.kind === "organization" && evidence.sourceCommand.actor.orgId === expectedOrganizationId)), false, void 0, signal, controls, onPrepared);
16786
+ })).pipe(Effect.mapError((publicError) => ({ publicError })))), controls), deps.runPromise), lifecycleCommandCheck(intent, expectedOrganizationId), false, void 0, signal, controls, onPrepared);
16762
16787
  }
16763
16788
  function executeRequestPayment(deps, confirmation, controls, onPrepared) {
16764
16789
  return executePrepared(deps, (signerAddress) => runIfActive(controls?.signal, commands$1.prepareRequest.name, () => withInvocationParentSpan(Effect.suspend(() => callOperation(deps.convexCall, commands$1.prepareRequest, copyInvocationObservation(controls, {
16765
16790
  confirmation,
16766
16791
  signerAddress
16767
- })).pipe(Effect.mapError((publicError) => ({ publicError })))), controls), deps.runPromise), async (request) => "kind" in request && request.kind === "payment_request" && canonicalJson(request.confirmation) === canonicalJson(confirmation), false, void 0, controls?.signal, controls, onPrepared);
16792
+ })).pipe(Effect.mapError((publicError) => ({ publicError })))), controls), deps.runPromise), requestPaymentCheck(confirmation), false, void 0, controls?.signal, controls, onPrepared);
16768
16793
  }
16769
16794
  function executeOrganizationPayment(deps, input, signal, onPreparedClosed, controls, onPrepared) {
16770
16795
  return executePrepared(deps, (signerAddress) => runIfActive(signal, CAPXUL_OPERATIONS.organizationPayments.prepareExecution, () => withInvocationParentSpan(Effect.suspend(() => callOperation(deps.convexCall, commands$1.prepareOrganization, copyInvocationObservation(controls, {
@@ -18366,7 +18391,7 @@ function makeOrganizationPaymentReadMethods(deps, orgId) {
18366
18391
  }
18367
18392
  //#endregion
18368
18393
  //#region src/payments/organization-flights.ts
18369
- function executionDependencies(input) {
18394
+ function executionDependencies$1(input) {
18370
18395
  return input.actor === void 0 || input.chainId === void 0 || input.signer === void 0 ? null : {
18371
18396
  actor: input.actor,
18372
18397
  chainId: input.chainId,
@@ -18387,7 +18412,7 @@ async function executeOrganizationBatch(scope, input, signal, operation, control
18387
18412
  };
18388
18413
  const intent = organizationPaymentIntent(scope.orgId, input);
18389
18414
  if (!intent.ok) return intent;
18390
- const execution = executionDependencies(scope.deps);
18415
+ const execution = executionDependencies$1(scope.deps);
18391
18416
  if (execution === null) return {
18392
18417
  ok: false,
18393
18418
  error: Errors.notImplemented("organizationPayments", "executionComposition")
@@ -18511,7 +18536,7 @@ function makeOrganizationPaymentsMethods(deps, orgId) {
18511
18536
  const parent = yield* Effect.currentSpan.pipe(Effect.orDie);
18512
18537
  const captured = carryInvocationParentSpan(controls, parent);
18513
18538
  return yield* awaitCapxulResult(async () => {
18514
- const execution = executionDependencies(deps);
18539
+ const execution = executionDependencies$1(deps);
18515
18540
  if (execution === null) return {
18516
18541
  ok: false,
18517
18542
  error: Errors.notImplemented("organizationPayments", "executionComposition")
@@ -19275,6 +19300,524 @@ function sleep(ms, signal) {
19275
19300
  });
19276
19301
  }
19277
19302
  //#endregion
19303
+ //#region ../protocol/src/payroll/model.ts
19304
+ function toPayrollRunId(raw) {
19305
+ return toNonEmptyStringBrand(raw, "payrollRunId", (value) => isNonEmptyString(value));
19306
+ }
19307
+ function toPayrollGroupId(raw) {
19308
+ return toNonEmptyStringBrand(raw, "payrollGroupId", (value) => isNonEmptyString(value));
19309
+ }
19310
+ //#endregion
19311
+ //#region src/payroll/run-checks.ts
19312
+ /** Match the caller's compensation to the committed V3 Payslip. */
19313
+ function payslipIdentityMatches(message, item, index, runId, period) {
19314
+ return message.runId === runId && message.itemIndex === index && message.employeeRef === item.partyId && message.periodStart === period.start && message.periodEnd === period.end && message.adjustmentsHash === hashAdjustmentsV3(item.adjustments);
19315
+ }
19316
+ function payslipAmountMatches(message, item) {
19317
+ const exact = toExactAssetAmount(item.amount, CONFIGURED_MONEY_ASSETS);
19318
+ return message.gross.asset === exact.asset && message.gross.minorUnits === item.gross && message.gross.decimals === exact.decimals && message.net.asset === exact.asset && message.net.minorUnits === item.net && message.net.decimals === exact.decimals;
19319
+ }
19320
+ function isRunItem(prepared, item, evidence, index, runId, period) {
19321
+ if (prepared === void 0) return false;
19322
+ const bundle = evidence.preparedCommand?.documentBundles?.[index];
19323
+ const preparedItem = evidence.preparedCommand?.items[index];
19324
+ const payslip = bundle?.envelope;
19325
+ if (bundle === void 0 || payslip?.primaryType !== "Payslip") return false;
19326
+ return canonicalJson(prepared.to) === canonicalJson(item.to) && prepared.paymentType === "payroll" && canonicalJson(prepared.amount) === canonicalJson(item.amount) && bundle.adjustments !== void 0 && canonicalJson(bundle.adjustments) === canonicalJson(item.adjustments) && payslipIdentityMatches(payslip.message, item, index, runId, period) && payslipAmountMatches(payslip.message, item) && (preparedItem?.operation === "send" || preparedItem?.operation === "create_commitment") && preparedItem.documentHash === evidence.preparedCommand?.instructionDocuments?.[index]?.documentHash;
19327
+ }
19328
+ /**
19329
+ * The batch the backend derived from a payroll intent must be the batch this
19330
+ * caller asked for, checked before the digest is signed.
19331
+ *
19332
+ * The payslip envelope on each item is server-built and carries the run row's
19333
+ * own `issuedAt`, so the batch cannot be fingerprinted against a local copy
19334
+ * (`matchesIntent` is unavailable here). What CAN be verified is every field
19335
+ * the caller supplied — the org, the Budget, the request key, and per item the
19336
+ * recipient, the amount and the payslip figures — plus the lineage binding the
19337
+ * batch to the run just written. A prepared command that pays a different
19338
+ * person, a different amount, from a different Budget, or under a different
19339
+ * run never reaches the signer.
19340
+ */
19341
+ function isRunBatch(input) {
19342
+ return (batch, evidence) => Promise.resolve(!("kind" in batch) && batch.orgId === input.orgId && batch.permissionId === input.permissionId && batch.requestKey === input.requestKey && batch.lineage?.kind === "payroll" && batch.lineage.runId === input.runId && batch.items.length === input.items.length && batch.items.every((item) => item.amount.asset === input.asset) && input.items.every((item, index) => isRunItem(batch.items[index], item, evidence, index, input.runId, input.period)));
19343
+ }
19344
+ /**
19345
+ * The batch is `isRunBatch` for the run the backend just wrote, and that run
19346
+ * is the period the caller asked for: the payslip's `period` is a
19347
+ * server-formatted label, so the stored run is where the caller's own two
19348
+ * numbers are checkable.
19349
+ */
19350
+ function isAuthorizedRunBatch(input, run) {
19351
+ return (request, evidence) => run === void 0 || run.periodStart !== input.period.start || run.periodEnd !== input.period.end ? Promise.resolve(false) : isRunBatch({
19352
+ ...input,
19353
+ runId: run.id
19354
+ })(request, evidence);
19355
+ }
19356
+ /** A decoded detail is the run asked for, whole: its scope, membership and quantities agree. */
19357
+ function checkPayrollRunDetail(value, orgId, runId) {
19358
+ if (value === null) return {
19359
+ ok: true,
19360
+ value: null
19361
+ };
19362
+ if (value.orgId !== orgId || value.run.id !== runId || value.items.length === 0 || value.items.length !== value.run.recipientCount || new Set(value.items.map((item) => item.payment.id)).size !== value.items.length || value.items.some((item, index) => item.itemIndex !== index || item.amount.asset !== value.run.total.asset || item.payment.amount.asset !== item.amount.asset || item.payment.paymentType !== "payroll")) return {
19363
+ ok: false,
19364
+ error: Errors.invalidInput("run", "Payroll run scope or membership does not match")
19365
+ };
19366
+ try {
19367
+ const total = toExactAssetAmount(value.run.total, CONFIGURED_MONEY_ASSETS);
19368
+ let rawTotal = 0n;
19369
+ for (const item of value.items) {
19370
+ const amount = toExactAssetAmount(item.amount, CONFIGURED_MONEY_ASSETS);
19371
+ const payment = toExactAssetAmount(item.payment.amount, CONFIGURED_MONEY_ASSETS);
19372
+ if (amount.minorUnits !== payment.minorUnits) return {
19373
+ ok: false,
19374
+ error: Errors.invalidInput("run", "Payroll item quantity does not match its Payment")
19375
+ };
19376
+ rawTotal += BigInt(amount.minorUnits);
19377
+ }
19378
+ if (rawTotal !== BigInt(total.minorUnits)) return {
19379
+ ok: false,
19380
+ error: Errors.invalidInput("run", "Payroll run total does not match its items")
19381
+ };
19382
+ } catch {
19383
+ return {
19384
+ ok: false,
19385
+ error: Errors.invalidInput("run", "Payroll run quantities are invalid")
19386
+ };
19387
+ }
19388
+ return {
19389
+ ok: true,
19390
+ value
19391
+ };
19392
+ }
19393
+ //#endregion
19394
+ //#region src/payroll/run-decoding.ts
19395
+ function toPayrollRun(wire) {
19396
+ return {
19397
+ id: toPayrollRunId(wire.id),
19398
+ status: wire.status,
19399
+ periodStart: wire.periodStart,
19400
+ periodEnd: wire.periodEnd,
19401
+ total: wire.total,
19402
+ recipientCount: wire.recipientCount
19403
+ };
19404
+ }
19405
+ function toPayrollRuns(wire) {
19406
+ return {
19407
+ ...mapPage(wire, toPayrollRun),
19408
+ settledThisMonth: wire.settledThisMonth
19409
+ };
19410
+ }
19411
+ function toPayrollGroup(wire) {
19412
+ return {
19413
+ id: toPayrollGroupId(wire.id),
19414
+ name: wire.name,
19415
+ tone: wire.tone,
19416
+ members: wire.members.map((member) => ({
19417
+ partyId: member.partyId,
19418
+ amount: member.amount,
19419
+ currency: member.currency
19420
+ }))
19421
+ };
19422
+ }
19423
+ function validateRunItems(input) {
19424
+ for (const [index, item] of input.items.entries()) {
19425
+ if (Schema.decodeResult(PayrollRunItemInputSchema, { onExcessProperty: "error" })(item)._tag === "Failure") return Errors.invalidInput(`items.${index}`, "invalid Payroll item");
19426
+ try {
19427
+ const exact = toExactAssetAmount(item.amount, CONFIGURED_MONEY_ASSETS);
19428
+ const net = BigInt(item.net);
19429
+ const gross = BigInt(item.gross);
19430
+ const adjustments = item.adjustments.reduce((sum, row) => sum + BigInt(row.amount), 0n);
19431
+ if (item.amount.asset !== input.asset || item.net !== exact.minorUnits || gross + adjustments !== net) return Errors.invalidInput(`items.${index}`, "invalid Payroll units");
19432
+ } catch {
19433
+ return Errors.invalidInput(`items.${index}`, "invalid Payroll units");
19434
+ }
19435
+ }
19436
+ return null;
19437
+ }
19438
+ const RunInputSchema = Schema.Struct({
19439
+ permissionId: AuthorizePayrollRunExecutionInputSchema.fields.permissionId,
19440
+ asset: AuthorizePayrollRunExecutionInputSchema.fields.asset,
19441
+ period: AuthorizePayrollRunExecutionInputSchema.fields.period,
19442
+ items: AuthorizePayrollRunExecutionInputSchema.fields.items,
19443
+ requestKey: Schema.optional(AuthorizePayrollRunExecutionInputSchema.fields.requestKey)
19444
+ });
19445
+ /** Decode caller input before session or signer work. Keep routing outside the input. */
19446
+ function decodePayrollRunInput(value) {
19447
+ try {
19448
+ const decoded = Schema.decodeUnknownSync(RunInputSchema, { onExcessProperty: "error" })(value);
19449
+ const input = {
19450
+ permissionId: decoded.permissionId,
19451
+ asset: decoded.asset,
19452
+ period: decoded.period,
19453
+ ...decoded.requestKey === void 0 ? {} : { requestKey: decoded.requestKey },
19454
+ items: decoded.items.map((item) => ({
19455
+ amount: item.amount,
19456
+ gross: item.gross,
19457
+ net: item.net,
19458
+ adjustments: item.adjustments,
19459
+ partyId: toPartyId(item.partyId),
19460
+ to: item.to.kind === "party" ? {
19461
+ kind: "party",
19462
+ partyId: toPartyId(item.to.partyId)
19463
+ } : item.to.kind === "address" ? {
19464
+ kind: "address",
19465
+ address: toAddress(item.to.address)
19466
+ } : item.to
19467
+ }))
19468
+ };
19469
+ if (input.items.length === 0 || input.period.start > input.period.end) throw Errors.invalidInput("input", "Payroll requires items and an ordered period");
19470
+ const error = validateRunItems(input);
19471
+ if (error !== null) throw error;
19472
+ return input;
19473
+ } catch (cause) {
19474
+ throw cause instanceof CapxulError ? cause : Errors.invalidInput("input", "Invalid Payroll input");
19475
+ }
19476
+ }
19477
+ /** Read only the exact backend prepare receipt, never an arbitrary signer failure. */
19478
+ function payrollResolution(error, requestKey) {
19479
+ const details = error.details;
19480
+ if (error.code !== "WRONG_STATE" || details?.method !== runs.authorize.name || details.requestKey !== requestKey || typeof details.commandId !== "string" || typeof details.runId !== "string") return void 0;
19481
+ return details.payrollResolution === "failed" || details.payrollResolution === "settled" ? details.payrollResolution : void 0;
19482
+ }
19483
+ function validatePayrollRunLookup(orgId, runId) {
19484
+ return !Schema.is(PayrollRunIdSchema)(runId) || orgId.length === 0 ? {
19485
+ ok: false,
19486
+ error: Errors.invalidInput("runId", "Organization and run ID must be valid")
19487
+ } : {
19488
+ ok: true,
19489
+ value: void 0
19490
+ };
19491
+ }
19492
+ /** Strict saved detail decoder shared by the read and fresh stream. */
19493
+ function decodePayrollRunDetail(raw, orgId, runId) {
19494
+ const decoded = Schema.decodeUnknownResult(Schema.NullOr(PayrollRunDetailSchema), { onExcessProperty: "error" })(raw);
19495
+ if (decoded._tag === "Failure") return {
19496
+ ok: false,
19497
+ error: Errors.invalidInput("run", "Invalid Payroll run detail")
19498
+ };
19499
+ return checkPayrollRunDetail(decoded.success, orgId, runId);
19500
+ }
19501
+ //#endregion
19502
+ //#region src/payroll/run-subscription.ts
19503
+ function detailValue(result) {
19504
+ if (!result.ok) throw result.error;
19505
+ return result.value;
19506
+ }
19507
+ function subscribePayrollRun(deps, orgId, runId, listener, options) {
19508
+ const operation = CAPXUL_OPERATIONS.org.payroll.subscribeRun;
19509
+ const valid = deps.validate(orgId, runId);
19510
+ if (!valid.ok) return runCapxulEffect(Effect.fail(valid.error), observationOnlyControls(deps.invocationControls?.(options) ?? options), operation, deps.runPromise);
19511
+ const decode = (raw) => detailValue(deps.decode(raw, orgId, runId));
19512
+ return subscribeFreshQuery(deps, {
19513
+ orgId,
19514
+ runId
19515
+ }, listener, operation, {
19516
+ decode,
19517
+ validateCached: (raw) => {
19518
+ decode(raw);
19519
+ },
19520
+ invalidValue: (cause) => isCapxulError(cause) ? cause : Errors.invalidInput("run", "Invalid Payroll run detail"),
19521
+ invalidScope: () => Errors.invalidInput("run", "Payroll run subscription scope does not match"),
19522
+ lostValue: () => Errors.invalidInput("run", "Payroll run is no longer readable"),
19523
+ unavailable: () => Errors.notImplemented("payroll", "subscribeRun")
19524
+ }, options);
19525
+ }
19526
+ //#endregion
19527
+ //#region src/payroll/run-authorization.ts
19528
+ /**
19529
+ * Authorize one payroll run: a stable request key, the prepared batch checked
19530
+ * against the run the caller asked for, the signature, and the submission.
19531
+ */
19532
+ async function authorizePayrollRun(scope, input, controls, onRequestKey, onResolved) {
19533
+ const { deps, orgId, requestKeyScope } = scope;
19534
+ const signal = controls?.signal;
19535
+ const execution = executionDependencies(deps);
19536
+ if (execution === null) return {
19537
+ ok: false,
19538
+ error: Errors.notImplemented("payroll", "executionComposition")
19539
+ };
19540
+ try {
19541
+ input = decodePayrollRunInput(input);
19542
+ } catch (cause) {
19543
+ return {
19544
+ ok: false,
19545
+ error: asCapxulError(cause)
19546
+ };
19547
+ }
19548
+ const { requestKey: provided, ...canonicalInput } = input;
19549
+ const actorId = onRequestKey === void 0 ? void 0 : execution.actor.authSession()?.authUserId;
19550
+ if (onRequestKey !== void 0 && actorId === void 0) return {
19551
+ ok: false,
19552
+ error: Errors.notAuthenticated()
19553
+ };
19554
+ const requestKey = await paymentRequestKeyLifecycle(`${requestKeyScope}:${AUTHORIZE_RUN}`, onRequestKey === void 0 ? {
19555
+ orgId,
19556
+ input
19557
+ } : {
19558
+ actorId,
19559
+ orgId,
19560
+ input: canonicalInput
19561
+ }, provided, onRequestKey === void 0 ? void 0 : { manageProvidedKey: true });
19562
+ try {
19563
+ await onRequestKey?.(requestKey.key);
19564
+ if (onRequestKey !== void 0 && execution.actor.authSession()?.authUserId !== actorId) {
19565
+ await requestKey.finish(false).catch(() => void 0);
19566
+ return {
19567
+ ok: false,
19568
+ error: Errors.notAuthenticated()
19569
+ };
19570
+ }
19571
+ } catch (cause) {
19572
+ await requestKey.finish(false).catch(() => void 0);
19573
+ return {
19574
+ ok: false,
19575
+ error: asCapxulError(cause)
19576
+ };
19577
+ }
19578
+ let authorized;
19579
+ let acceptedReplay;
19580
+ let preparedClosed = false;
19581
+ let terminalReplay;
19582
+ const submitted = await executePrepared(execution, async (signerAddress) => {
19583
+ const prepared = await runIfActive(signal, AUTHORIZE_RUN, () => withInvocationParentSpan(Effect.suspend(() => callOperation(deps.convexCall, runs.authorize, copyInvocationObservation(controls, {
19584
+ orgId,
19585
+ permissionId: input.permissionId,
19586
+ asset: input.asset,
19587
+ requestKey: requestKey.key,
19588
+ signerAddress,
19589
+ period: input.period,
19590
+ items: input.items
19591
+ }))).pipe(Effect.mapError((publicError) => ({ publicError }))), controls), deps.runPromise);
19592
+ if (!prepared.ok) {
19593
+ terminalReplay = payrollResolution(prepared.error, requestKey.key);
19594
+ return prepared;
19595
+ }
19596
+ authorized = prepared.value.run;
19597
+ acceptedReplay = prepared.value.replay.kind === "accepted" ? prepared.value.replay.submission : void 0;
19598
+ return {
19599
+ ok: true,
19600
+ value: prepared.value.execution
19601
+ };
19602
+ }, (request, evidence) => isAuthorizedRunBatch({
19603
+ orgId,
19604
+ permissionId: input.permissionId,
19605
+ requestKey: requestKey.key,
19606
+ asset: input.asset,
19607
+ period: input.period,
19608
+ items: input.items
19609
+ }, authorized)(request, evidence), true, () => preparedClosed = true, signal, controls, void 0, () => acceptedReplay);
19610
+ const resolution = preparedClosed ? "failed" : terminalReplay;
19611
+ if (resolution !== void 0) try {
19612
+ await onResolved?.(resolution);
19613
+ } catch {}
19614
+ try {
19615
+ await requestKey.finish(submitted.ok || resolution !== void 0);
19616
+ } catch {}
19617
+ if (!submitted.ok) return submitted;
19618
+ return authorized === void 0 ? {
19619
+ ok: false,
19620
+ error: Errors.unknown()
19621
+ } : {
19622
+ ok: true,
19623
+ value: toPayrollRun(authorized)
19624
+ };
19625
+ }
19626
+ const AUTHORIZE_RUN = runs.authorize.name;
19627
+ function executionDependencies(deps) {
19628
+ return deps.actor === void 0 || deps.chainId === void 0 || deps.signer === void 0 ? null : {
19629
+ actor: deps.actor,
19630
+ chainId: deps.chainId,
19631
+ convexCall: deps.convexCall,
19632
+ runPromise: deps.runPromise,
19633
+ signer: deps.signer,
19634
+ ...deps.telemetry === void 0 ? {} : { telemetry: deps.telemetry }
19635
+ };
19636
+ }
19637
+ //#endregion
19638
+ //#region src/payroll/runs.ts
19639
+ function makePayrollMethods(deps, orgId) {
19640
+ const requestKeyScope = deps.requestKeyScope ?? `client-${crypto.randomUUID()}`;
19641
+ /** One observed call of one payroll row, its reply projected inside the call, under the row's name. */
19642
+ const call = (row, args, options, project) => {
19643
+ const controls = deps.invocationControls?.(options) ?? options;
19644
+ return runPortEffect(callOperation(deps.convexCall, row, copyInvocationObservation(controls, args)).pipe(Effect.map(project), Effect.mapError((publicError) => ({ publicError }))), controls, row.name, deps.runPromise);
19645
+ };
19646
+ return {
19647
+ subscribeRun: (runId, listener, options) => subscribePayrollRun({
19648
+ actor: deps.actor,
19649
+ convexCall: deps.convexCall,
19650
+ query: reference(runs.get),
19651
+ runPromise: deps.runPromise,
19652
+ invocationControls: deps.invocationControls,
19653
+ decode: decodePayrollRunDetail,
19654
+ validate: validatePayrollRunLookup
19655
+ }, orgId, runId, listener, options),
19656
+ getRun: (runId, options) => {
19657
+ const controls = deps.invocationControls?.(options) ?? options;
19658
+ const lifetime = deps.actor?.authLifetime();
19659
+ const operation = runs.get.name;
19660
+ return runCapxulEffect(Effect.gen(function* () {
19661
+ const lookup = validatePayrollRunLookup(orgId, runId);
19662
+ if (!lookup.ok) return yield* Effect.fail(lookup.error);
19663
+ if (lifetime === void 0 || lifetime.authUserId === null || deps.actor === void 0) return yield* Effect.fail(Errors.notAuthenticated());
19664
+ const current = () => deps.actor?.matchesAuthLifetime(lifetime, lifetime.authUserId) === true;
19665
+ if (!current()) return yield* Effect.fail(Errors.notAuthenticated());
19666
+ const parent = yield* Effect.currentSpan.pipe(Effect.orDie);
19667
+ const captured = carryInvocationParentSpan(controls, parent);
19668
+ const run = yield* awaitCapxulResult(() => runIfActive(controls?.signal, operation, () => withInvocationParentSpan(Effect.suspend(() => callOperation(deps.convexCall, runs.get, copyInvocationObservation(captured, {
19669
+ orgId,
19670
+ runId
19671
+ }))).pipe(Effect.mapError((publicError) => ({ publicError }))), captured), deps.runPromise));
19672
+ if (!current()) return yield* Effect.fail(Errors.cancelled({ operation }));
19673
+ const checked = checkPayrollRunDetail(run, orgId, runId);
19674
+ return yield* checked.ok ? Effect.succeed(checked.value) : Effect.fail(checked.error);
19675
+ }), observationOnlyControls(controls), operation, deps.runPromise);
19676
+ },
19677
+ runs: (options) => call(runs.list, { orgId }, options, toPayrollRuns),
19678
+ authorizeRun: (input, options) => {
19679
+ const controls = deps.invocationControls?.(options) ?? options;
19680
+ return runCapxulEffect(Effect.gen(function* () {
19681
+ if (controls?.signal?.aborted === true) return yield* Effect.fail(Errors.cancelled({ operation: AUTHORIZE_RUN }));
19682
+ const parent = yield* Effect.currentSpan.pipe(Effect.orDie);
19683
+ return yield* awaitCapxulResult(() => authorizePayrollRun({
19684
+ deps,
19685
+ orgId,
19686
+ requestKeyScope
19687
+ }, input, carryInvocationParentSpan(controls, parent), options?.onRequestKey, options?.onResolved));
19688
+ }), observationOnlyControls(controls), AUTHORIZE_RUN, deps.runPromise);
19689
+ },
19690
+ terms: (options) => call(terms.list, { orgId }, options, (rates) => rates),
19691
+ groups: {
19692
+ list: (options) => call(groups.list, { orgId }, options, (saved) => mapPage(saved, toPayrollGroup)),
19693
+ save: (input, options) => call(groups.save, {
19694
+ orgId,
19695
+ ...input.id === void 0 ? {} : { id: String(input.id) },
19696
+ name: input.name,
19697
+ tone: input.tone,
19698
+ members: input.members
19699
+ }, options, toPayrollGroup),
19700
+ remove: (id, options) => call(groups.remove, {
19701
+ orgId,
19702
+ id
19703
+ }, options, () => void 0)
19704
+ }
19705
+ };
19706
+ }
19707
+ const payrollUnavailable = () => Promise.resolve({
19708
+ ok: false,
19709
+ error: Errors.notImplemented("payroll", "executionComposition")
19710
+ });
19711
+ /** The bundle an unconfigured client exposes — every verb refuses, none throws. */
19712
+ function makeUnavailablePayrollMethods() {
19713
+ return {
19714
+ getRun: payrollUnavailable,
19715
+ subscribeRun: payrollUnavailable,
19716
+ runs: payrollUnavailable,
19717
+ authorizeRun: payrollUnavailable,
19718
+ terms: payrollUnavailable,
19719
+ groups: {
19720
+ list: payrollUnavailable,
19721
+ save: payrollUnavailable,
19722
+ remove: payrollUnavailable
19723
+ }
19724
+ };
19725
+ }
19726
+ //#endregion
19727
+ //#region src/accounts/command-approvals.ts
19728
+ /**
19729
+ * Keep a prepared command only when it is the one asked for and its operation
19730
+ * is the person's own. A mismatch is closed unsent when `close`, as the signed
19731
+ * path closes a new Payment; a retry or a request keeps its Payment open.
19732
+ */
19733
+ async function checked(deps, signerAddress, prepared, expected, close) {
19734
+ if (!prepared.ok) return prepared;
19735
+ const session = deps.actor?.authSession() ?? null;
19736
+ if (session === null || deps.chainId === void 0) return {
19737
+ ok: false,
19738
+ error: Errors.notAuthenticated()
19739
+ };
19740
+ const evidence = prepared.value;
19741
+ if (await expected(evidence.request, evidence) && await verifiedPreparedCommand(evidence, session.email, signerAddress, deps.chainId)) return prepared;
19742
+ const refused = {
19743
+ ok: false,
19744
+ error: Errors.invalidInput("execution", "prepared command mismatch")
19745
+ };
19746
+ return close ? abandonPrepared(deps, evidence.executionId, "prepared_mismatch", refused) : refused;
19747
+ }
19748
+ /** A retry, a request payment or a payroll run, rather than a new Payment. */
19749
+ const isCommandApproval = (input) => "retry" in input || "request" in input || "payrollRun" in input;
19750
+ /** Prepare a retry, a request payment or a payroll run for `signerAddress`, checked. */
19751
+ function prepareVerifiedCommand(deps, input, signerAddress, signal) {
19752
+ if ("retry" in input) return prepareVerifiedRetry(deps, input, signerAddress, signal);
19753
+ if ("request" in input) return prepareVerifiedRequestPayment(deps, input, signerAddress, signal);
19754
+ return prepareVerifiedPayrollRun(deps, input, signerAddress, signal);
19755
+ }
19756
+ /** The retry of one Payment, prepared in the scope that paid it. */
19757
+ async function prepareVerifiedRetry(deps, input, signerAddress, signal) {
19758
+ const intent = {
19759
+ kind: "retry",
19760
+ paymentId: input.retry
19761
+ };
19762
+ return checked(deps, signerAddress, await runIfActive(signal, CAPXUL_OPERATIONS.payments.prepareLifecycleExecution, () => callOperation(deps.convexCall, lifecycles.prepareScoped, {
19763
+ signerAddress,
19764
+ intent,
19765
+ expectedScope: input.organizationId === void 0 ? { kind: "account" } : {
19766
+ kind: "organization",
19767
+ orgId: input.organizationId
19768
+ }
19769
+ }).pipe(Effect.mapError((publicError) => ({ publicError }))), deps.runPromise), lifecycleCommandCheck(intent, input.organizationId), false);
19770
+ }
19771
+ /** The Payment of one request, exactly as the request froze it. */
19772
+ async function prepareVerifiedRequestPayment(deps, input, signerAddress, signal) {
19773
+ const decoded = Schema.decodeResult(RequestPaymentConfirmationSchema, { onExcessProperty: "error" })(input.request);
19774
+ if (decoded._tag === "Failure") return {
19775
+ ok: false,
19776
+ error: Errors.invalidInput("confirmation", "invalid request confirmation")
19777
+ };
19778
+ const confirmation = decoded.success;
19779
+ return checked(deps, signerAddress, await runIfActive(signal, commands$1.prepareRequest.name, () => callOperation(deps.convexCall, commands$1.prepareRequest, {
19780
+ confirmation,
19781
+ signerAddress
19782
+ }).pipe(Effect.mapError((publicError) => ({ publicError }))), deps.runPromise), requestPaymentCheck(confirmation), false);
19783
+ }
19784
+ /** One payroll run: the run the backend writes and the batch that pays it, checked together. */
19785
+ async function prepareVerifiedPayrollRun(deps, input, signerAddress, signal) {
19786
+ let run;
19787
+ try {
19788
+ run = decodePayrollRunInput(input.payrollRun);
19789
+ } catch (cause) {
19790
+ return {
19791
+ ok: false,
19792
+ error: asCapxulError(cause)
19793
+ };
19794
+ }
19795
+ const orgId = input.organizationId;
19796
+ const requestKey = run.requestKey ?? `payroll_${crypto.randomUUID()}`;
19797
+ const { permissionId, asset, period, items } = run;
19798
+ const authorized = await runIfActive(signal, runs.authorize.name, () => callOperation(deps.convexCall, runs.authorize, {
19799
+ orgId,
19800
+ permissionId,
19801
+ asset,
19802
+ requestKey,
19803
+ signerAddress,
19804
+ period,
19805
+ items
19806
+ }).pipe(Effect.mapError((publicError) => ({ publicError }))), deps.runPromise);
19807
+ if (!authorized.ok) return authorized;
19808
+ return checked(deps, signerAddress, {
19809
+ ok: true,
19810
+ value: authorized.value.execution
19811
+ }, isAuthorizedRunBatch({
19812
+ orgId,
19813
+ permissionId,
19814
+ requestKey,
19815
+ asset,
19816
+ period,
19817
+ items
19818
+ }, authorized.value.run), authorized.value.replay.kind !== "accepted");
19819
+ }
19820
+ //#endregion
19278
19821
  //#region src/accounts/organization-approvals.ts
19279
19822
  /** The Organization Payment prepared for `signerAddress` and checked, before any approval. */
19280
19823
  async function prepareVerifiedOrganizationPayment(deps, input, signerAddress, signal) {
@@ -19381,6 +19924,7 @@ function makeApprovalsMethods(deps) {
19381
19924
  };
19382
19925
  const prepare = async (input, options) => {
19383
19926
  const signal = options?.signal;
19927
+ if (isCommandApproval(input)) return openApproval(signal, (signerAddress) => prepareVerifiedCommand(deps, input, signerAddress, signal));
19384
19928
  if ("organizationId" in input) return openApproval(signal, (signerAddress) => prepareVerifiedOrganizationPayment(deps, input, signerAddress, signal));
19385
19929
  const intent = paymentExecutionIntent(input);
19386
19930
  if (!intent.ok) return intent;
@@ -19473,7 +20017,7 @@ function makeApprovalsMethods(deps) {
19473
20017
  ok: true,
19474
20018
  value: null
19475
20019
  };
19476
- const payments = await readApprovalPayments(deps, approval.operation.paymentIds, organizationId, signal);
20020
+ const payments = await readApprovalPayments(deps, approval.operation.paymentIds, organizationId ?? (approval.actor.kind === "organization" ? approval.actor.orgId : void 0), signal);
19477
20021
  if (!payments.ok) return payments;
19478
20022
  if (unsent(approval, payments.value)) {
19479
20023
  const sent = await submit(approvalId);
@@ -22402,4 +22946,4 @@ function executeIdentityProductObservation(telemetry, record, state) {
22402
22946
  return ignoreTransportFailure(() => invocationTelemetry.emit(mapped), "emit", mapped.name).pipe(Effect.andThen(ignoreTransportFailure(after, mapped.name === "auth_signed_out" ? "reset" : "identify", mapped.name)));
22403
22947
  }
22404
22948
  //#endregion
22405
- export { toRaw as $, workspaces as $n, formatTraceparent as $r, version as $t, registerProductTelemetryInvocation as A, parseAuthSession as Ai, details as An, toAssetId as Ar, safe4337MultiSendUserOpCallData as At, paymentRequestKeyLifecycle as B, toNonEmptyStringBrand as Bi, terms as Bn, makeAuthMethods as Br, failureEvidenceProps as Bt, AccountReadPortTag as C, authClientPortFromPromiseAdapter as Ci, CLI_INVOCATION_KINDS as Cn, EpochMsSchema$1 as Cr, CAPXUL_PAYMENTS_V2_ADDRESS as Ct, convexCallErrorFromCapxul as D, globalLocalStorage as Di, isCapxulOperation as Dn, toRoleKey as Dr, deriveCapxulSafeAddress as Dt, ConvexCallPortTag as E, detectAuthCacheAdapter as Ei, CAPXUL_OPERATIONS as En, toPermissionId as Er, TOKENS as Et, logDroppedEvent as F, toAuthUserId as Fi, replacements as Fn, toAddress as Fr, callOperation as Ft, makeTargetsMethods as G, isFailureMode as Gi, PayrollRunIdSchema as Gn, sessionFromActor as Gr, observationContextProps as Gt, makeActorRelationshipMethods as H, CapxulError as Hi, PayrollGroupIdSchema as Hn, publicIdentityFailure as Hr, postHogFailureObservation as Ht, makeOrganizationPaymentsMethods as I, toEmail as Ii, PreparedPermissionExecutionSchema as In, toChainId as Ir, asCapxulError as It, assetAmountFromRaw as J, AuthCacheError as Ji, invitations as Jn, withVerifiedOrganizationScope as Jr, SDK_VERSION as Jt, subscribeFreshQuery as K, isRecord as Ki, PayrollRunItemInputSchema as Kn, observationOnlyControls as Kr, withCapturedAttemptContext as Kt, makeOfframpMethods as L, toJwtToken as Li, PermissionCommandViewSchema as Ln, toWeiAmount as Lr, mapPage as Lt, makeApprovalsMethods as M, toDurationMs as Mi, authorities as Mn, toExactAssetAmount as Mr, BASE_SEPOLIA_CHAIN_ID as Mt, makeAccountMethods as N, toEpochMs as Ni, commands as Nn, EVM_ADDRESS_RE$1 as Nr, MULTI_SEND_CALL_ONLY as Nt, retryIdempotentRead as O, InMemoryAuthCacheAdapter as Oi, normalizeCapxulOperation as On, ChainIdSchema$1 as Or, normalizeSafeSaltEmail as Ot, emitDepositInitiated as P, toEpochSeconds as Pi, configurations as Pn, isEvmAddress as Pr, SAFE_SENTINEL_OWNERS as Pt, requireAsset as Q, treasuries as Qn, toCapxulResult as Qr, safeExceptionLabel as Qt, makePaymentsMethods as R, toSessionToken as Ri, groups as Rn, absurd as Rr, toPublicError$1 as Rt, valueIn as S, toPublishableKey as Si, CLI_COMMAND_NAMES as Sn, DurationMsSchema$1 as Sr, SEND_SIGNATURE as St, TelemetryPortTag as T, AuthClientPortTag as Ti, stampTelemetryEnvelope as Tn, toPermissionAssignmentId as Tr, CONFIGURED_MONEY_ASSETS as Tt, makeCheckoutMethods as U, isCapxulError as Ui, PayrollGroupInputSchema as Un, runIdentityFacade as Ur, observeFailedResult as Ut, makeDestinationsMethods as V, Errors as Vi, AuthorizePayrollRunExecutionInputSchema as Vn, askIdentity as Vr, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT as Vt, isCheckoutSettlementConsumed as W, FAILURE_MODES$1 as Wi, PayrollRunDetailSchema as Wn, runPortEffect as Wr, observeSdkClient as Wt, formatAssetAmount as X, roles as Xn, defectAsCapxulError as Xr, normalizeExceptionOperation as Xt, assetSymbolFor as Y, AuthCachePortTag as Yi, members as Yn, awaitCapxulResult as Yr, normalizeExceptionErrorKind as Yt, parseAssetAmount as Z, setups as Zn, runIfActive as Zr, projectSdkException as Zt, accountFromAccountPositions as _, redactSecrets as _i, toPartyId as _n, toLowerAddress as _r, ROLES_SET_TRANSACTION_UNWRAPPER_ABI as _t, paymentPhase as a, oauthBearerAuthClient as ai, isSignerNotReadySignal as an, toOrgId as ar, ORG_BUDGET_ACTIONS as at, MONEY_READ_RATES as b, toAllowedOrigin as bi, redactTelemetryProps as bn, PAYMENT_DIRECTIONS as br, SAFE_ENABLE_MODULE_ABI as bt, makePaymentDocumentsMethods as c, ClockPortTag as ci, signerFailure as cn, decodePermissionIntent as cr, resolveOrgPermissionIdentity as ct, SmartAccountPortTag as d, BetterAuthBrowserLayer as di, makeClientRequestMethods as dn, AppIdSchema$1 as dr, MULTI_SEND_SELECTOR as dt, CAPXUL_ERROR_CODES as ei, isSettingUpLifecycle as en, OrganizationSetupSchema as er, isMoneyParseError as et, smartAccountErrorFromCapxul as f, observationRequestHeaders as fi, toCountryCode as fn, images as fr, OPERATOR as ft, ConvexAccountLayer as g, sanitizeObservationContext as gi, toHandle as gn, toExactHex as gr, ROLES_SET_ALLOWANCE_ABI as gt, makeAccountsMethods as h, readInvocationObservation as hi, HANDLE_RE as hn, isBytes32 as hr, ROLES_EXEC_TRANSACTION_WITH_ROLE_ABI as ht, inboxPhase as i, withInvocationParentSpan as ii, isEcdsaSignatureHex as in, decodeChainCause as ir, moneySafeOpDigest as it, wireChainId as j, parseCachedJwt as ji, onboardings as jn, toCurrencyCode as jr, buildSafeMultiSendExecTransactionCall as jt, bindProductTelemetryInvocation as k, BrowserAuthCacheAdapter as ki, OPERATIONS as kn, currencySymbolFor as kr, safe4337ExecuteUserOpCallData as kt, makeSmartAccountMethods as l, readClockNow as li, resolveFailureMode as ln, CurrentPolicySchema as lr, CREATE_COMMITMENT_SIGNATURE as lt, PonderIndexerAdapter as m, copyInvocationObservation as mi, toTesterKind as mn, PaymentDocumentOptionsSchema as mr, ROLES_ASSIGN_ROLES_ABI as mt, bootIdentityFlow as n, ActorFailure as ni, causeChain as nn, ORGANIZATION_SETUP_STATUSES as nr, canonicalJson as nt, requestPhase as o, SystemClockLayer as oi, openfortSignerNotReadyCode as on, InvitationViewSchema as or, roleKeyForPermission as ot, makeHoldingsMethods as p, attachInvocationObservation as pi, toKycTier as pn, toAccountId as pr, PARAMETER_TYPE as pt, executePrepared as q, readField as qi, FixedOfferDraftSchema as qn, runCapxulEffect as qr, EXCEPTION_MESSAGE as qt, makeMeMethods as r, carryInvocationParentSpan as ri, injectedWalletSigner as rn, CHAIN_UPSTREAMS as rr, fingerprintPaymentIntent as rt, makeActivityMethods as s, ClockError as si, recoverRawDigestSigner as sn, hashPermissionReplacementPreview as sr, ZODIAC_MODULE_PROXY_FACTORY as st, executeIdentityProductObservation as t, EXPECTED_OPERATION_OUTCOMES as ti, UNOBSERVABLE_SIGNER_STATUS as tn, ORGANIZATION_SETUP_REASONS as tr, parseMoney as tt, ConvexSmartAccountLayer as u, BetterAuthNodeLayer as ui, makeCurrentUserMethods as un, diagnostics as ur, MODULE_PROXY_FACTORY_ABI as ut, accountPositionsFromWire as v, redactUrlSecrets as vi, validateHandle as vn, toLowerBytes32 as vr, ROLES_SET_UP_ABI as vt, accountReadErrorFromCapxul as w, AuthClientError as wi, EXCEPTION_EVENT_NAME as wn, toBudgetId as wr, hashAdjustmentsV3 as wt, valueActivitySummary as x, toAppId as xi, CLI_CAPABILITIES as xn, PAYMENT_STATUSES as xr, SEND_BATCH_SIGNATURE as xt, positionPeg as y, isCredentialField as yi, redactTelemetryEvent as yn, toLowerHex as yr, ROLE_MANAGEMENT_SIGNATURES as yt, waitForPaymentSubmission as z, isNonEmptyString as zi, runs as zn, reference as zr, failureDetail as zt };
22949
+ export { parseAssetAmount as $, InvitationViewSchema as $n, SystemClockLayer as $r, version as $t, registerProductTelemetryInvocation as A, toJwtToken as Ai, details as An, toWeiAmount as Ar, safe4337ExecuteUserOpCallData as At, makeOrganizationPaymentsMethods as B, AuthCachePortTag as Bi, FixedOfferDraftSchema as Bn, runCapxulEffect as Br, failureEvidenceProps as Bt, AccountReadPortTag as C, parseAuthSession as Ci, CLI_INVOCATION_KINDS as Cn, toAssetId as Cr, SEND_BATCH_SIGNATURE as Ct, convexCallErrorFromCapxul as D, toEpochSeconds as Di, isCapxulOperation as Dn, isEvmAddress as Dr, TOKENS as Dt, ConvexCallPortTag as E, toEpochMs as Ei, CAPXUL_OPERATIONS as En, EVM_ADDRESS_RE$1 as Er, CONFIGURED_MONEY_ASSETS as Et, decodePayrollRunInput as F, FAILURE_MODES$1 as Fi, replacements as Fn, publicIdentityFailure as Fr, SAFE_SENTINEL_OWNERS as Ft, makeActorRelationshipMethods as G, treasuries as Gn, toCapxulResult as Gr, observationContextProps as Gt, makePaymentsMethods as H, members as Hn, awaitCapxulResult as Hr, postHogFailureObservation as Ht, toPayrollGroupId as I, isFailureMode as Ii, PreparedPermissionExecutionSchema as In, runIdentityFacade as Ir, callOperation as It, makeTargetsMethods as J, ORGANIZATION_SETUP_REASONS as Jn, EXPECTED_OPERATION_OUTCOMES as Jr, SDK_VERSION as Jt, makeCheckoutMethods as K, workspaces as Kn, formatTraceparent as Kr, withCapturedAttemptContext as Kt, makeAccountMethods as L, isRecord as Li, PermissionCommandViewSchema as Ln, runPortEffect as Lr, asCapxulError as Lt, makeApprovalsMethods as M, Errors as Mi, authorities as Mn, reference as Mr, buildSafeMultiSendExecTransactionCall as Mt, makePayrollMethods as N, CapxulError as Ni, commands as Nn, makeAuthMethods as Nr, BASE_SEPOLIA_CHAIN_ID as Nt, retryIdempotentRead as O, toAuthUserId as Oi, normalizeCapxulOperation as On, toAddress as Or, deriveCapxulSafeAddress as Ot, makeUnavailablePayrollMethods as P, isCapxulError as Pi, configurations as Pn, askIdentity as Pr, MULTI_SEND_CALL_ONLY as Pt, formatAssetAmount as Q, toOrgId as Qn, oauthBearerAuthClient as Qr, safeExceptionLabel as Qt, emitDepositInitiated as R, readField as Ri, PayrollGroupIdSchema as Rn, sessionFromActor as Rr, toPublicError$1 as Rt, valueIn as S, BrowserAuthCacheAdapter as Si, CLI_COMMAND_NAMES as Sn, currencySymbolFor as Sr, SAFE_ENABLE_MODULE_ABI as St, TelemetryPortTag as T, toDurationMs as Ti, stampTelemetryEnvelope as Tn, toExactAssetAmount as Tr, CAPXUL_PAYMENTS_V2_ADDRESS as Tt, waitForPaymentSubmission as U, roles as Un, defectAsCapxulError as Ur, observeFailedResult as Ut, makeOfframpMethods as V, invitations as Vn, withVerifiedOrganizationScope as Vr, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT as Vt, makeDestinationsMethods as W, setups as Wn, runIfActive as Wr, observeSdkClient as Wt, assetAmountFromRaw as X, CHAIN_UPSTREAMS as Xn, carryInvocationParentSpan as Xr, normalizeExceptionOperation as Xt, subscribeFreshQuery as Y, ORGANIZATION_SETUP_STATUSES as Yn, ActorFailure as Yr, normalizeExceptionErrorKind as Yt, assetSymbolFor as Z, decodeChainCause as Zn, withInvocationParentSpan as Zr, projectSdkException as Zt, accountFromAccountPositions as _, AuthClientError as _i, toPartyId as _n, toBudgetId as _r, ROLES_EXEC_TRANSACTION_WITH_ROLE_ABI as _t, paymentPhase as a, observationRequestHeaders as ai, isSignerNotReadySignal as an, images as ar, fingerprintPaymentIntent as at, MONEY_READ_RATES as b, globalLocalStorage as bi, redactTelemetryProps as bn, toRoleKey as br, ROLES_SET_UP_ABI as bt, makePaymentDocumentsMethods as c, readInvocationObservation as ci, signerFailure as cn, isBytes32 as cr, roleKeyForPermission as ct, SmartAccountPortTag as d, redactUrlSecrets as di, makeClientRequestMethods as dn, toLowerBytes32 as dr, CREATE_COMMITMENT_SIGNATURE as dt, ClockError as ei, isSettingUpLifecycle as en, hashPermissionReplacementPreview as er, requireAsset as et, smartAccountErrorFromCapxul as f, isCredentialField as fi, toCountryCode as fn, toLowerHex as fr, MODULE_PROXY_FACTORY_ABI as ft, ConvexAccountLayer as g, authClientPortFromPromiseAdapter as gi, toHandle as gn, EpochMsSchema$1 as gr, ROLES_ASSIGN_ROLES_ABI as gt, makeAccountsMethods as h, toPublishableKey as hi, HANDLE_RE as hn, DurationMsSchema$1 as hr, PARAMETER_TYPE as ht, inboxPhase as i, BetterAuthBrowserLayer as ii, isEcdsaSignatureHex as in, AppIdSchema$1 as ir, canonicalJson as it, wireChainId as j, toSessionToken as ji, onboardings as jn, absurd as jr, safe4337MultiSendUserOpCallData as jt, bindProductTelemetryInvocation as k, toEmail as ki, OPERATIONS as kn, toChainId as kr, normalizeSafeSaltEmail as kt, makeSmartAccountMethods as l, sanitizeObservationContext as li, resolveFailureMode as ln, toExactHex as lr, ZODIAC_MODULE_PROXY_FACTORY as lt, PonderIndexerAdapter as m, toAppId as mi, toTesterKind as mn, PAYMENT_STATUSES as mr, OPERATOR as mt, bootIdentityFlow as n, readClockNow as ni, causeChain as nn, CurrentPolicySchema as nr, isMoneyParseError as nt, requestPhase as o, attachInvocationObservation as oi, openfortSignerNotReadyCode as on, toAccountId as or, moneySafeOpDigest as ot, makeHoldingsMethods as p, toAllowedOrigin as pi, toKycTier as pn, PAYMENT_DIRECTIONS as pr, MULTI_SEND_SELECTOR as pt, isCheckoutSettlementConsumed as q, OrganizationSetupSchema as qn, CAPXUL_ERROR_CODES as qr, EXCEPTION_MESSAGE as qt, makeMeMethods as r, BetterAuthNodeLayer as ri, injectedWalletSigner as rn, diagnostics as rr, parseMoney as rt, makeActivityMethods as s, copyInvocationObservation as si, recoverRawDigestSigner as sn, PaymentDocumentOptionsSchema as sr, ORG_BUDGET_ACTIONS as st, executeIdentityProductObservation as t, ClockPortTag as ti, UNOBSERVABLE_SIGNER_STATUS as tn, decodePermissionIntent as tr, toRaw as tt, ConvexSmartAccountLayer as u, redactSecrets as ui, makeCurrentUserMethods as un, toLowerAddress as ur, resolveOrgPermissionIdentity as ut, accountPositionsFromWire as v, AuthClientPortTag as vi, validateHandle as vn, toPermissionAssignmentId as vr, ROLES_SET_ALLOWANCE_ABI as vt, accountReadErrorFromCapxul as w, parseCachedJwt as wi, EXCEPTION_EVENT_NAME as wn, toCurrencyCode as wr, SEND_SIGNATURE as wt, valueActivitySummary as x, InMemoryAuthCacheAdapter as xi, CLI_CAPABILITIES as xn, ChainIdSchema$1 as xr, ROLE_MANAGEMENT_SIGNATURES as xt, positionPeg as y, detectAuthCacheAdapter as yi, redactTelemetryEvent as yn, toPermissionId as yr, ROLES_SET_TRANSACTION_UNWRAPPER_ABI as yt, logDroppedEvent as z, AuthCacheError as zi, PayrollGroupInputSchema as zn, observationOnlyControls as zr, failureDetail as zt };