@zauthx402/sdk 0.1.12 → 0.1.14

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.
@@ -4045,6 +4045,14 @@ var ZauthClient = class {
4045
4045
  * Queue an event for batched submission
4046
4046
  */
4047
4047
  queueEvent(event) {
4048
+ const MAX_QUEUE_SIZE = 500;
4049
+ if (this.eventQueue.length >= MAX_QUEUE_SIZE) {
4050
+ this.log("Event queue full, dropping oldest event", { queueSize: this.eventQueue.length });
4051
+ this.eventQueue.shift();
4052
+ }
4053
+ if ("body" in event && event.body && JSON.stringify(event.body).length > 1e4) {
4054
+ event.body = { _truncated: true, _originalSize: JSON.stringify(event.body).length };
4055
+ }
4048
4056
  this.eventQueue.push(event);
4049
4057
  this.log("Event queued", { type: event.type, eventId: event.eventId, queueSize: this.eventQueue.length });
4050
4058
  if (this.eventQueue.length >= this.config.batching.maxBatchSize) {
@@ -4080,9 +4088,13 @@ var ZauthClient = class {
4080
4088
  try {
4081
4089
  await this.submitBatch(events);
4082
4090
  } catch (error) {
4083
- if (this.config.batching.retry) {
4091
+ const errorMsg = error.message || "";
4092
+ const isPayloadTooLarge = errorMsg.includes("413");
4093
+ if (this.config.batching.retry && !isPayloadTooLarge) {
4084
4094
  this.log("Batch failed, re-queuing events", { count: events.length });
4085
4095
  this.eventQueue.unshift(...events);
4096
+ } else if (isPayloadTooLarge) {
4097
+ this.log("Batch payload too large, dropping events", { count: events.length });
4086
4098
  }
4087
4099
  } finally {
4088
4100
  this.isFlushing = false;
@@ -4791,8 +4803,8 @@ var RefundExecutor = class {
4791
4803
  this.log("Refund executor not enabled");
4792
4804
  return;
4793
4805
  }
4794
- if (!this.config.signer && !this.config.privateKey) {
4795
- this.log("Refund executor requires signer or privateKey");
4806
+ if (!this.config.signer && !this.config.privateKey && !this.config.solanaPrivateKey) {
4807
+ this.log("Refund executor requires signer, privateKey, or solanaPrivateKey");
4796
4808
  return;
4797
4809
  }
4798
4810
  this.log("Starting refund executor (WebSocket mode)", {
@@ -5281,7 +5293,7 @@ function createZauthMiddleware(options) {
5281
5293
  const includePatterns = options.includeRoutes?.map((p) => new RegExp(p)) || [];
5282
5294
  const excludePatterns = options.excludeRoutes?.map((p) => new RegExp(p)) || [];
5283
5295
  let refundExecutor;
5284
- if (config.refund.enabled && (config.refund.signer || config.refund.privateKey)) {
5296
+ if (config.refund.enabled && (config.refund.signer || config.refund.privateKey || config.refund.solanaPrivateKey)) {
5285
5297
  refundExecutor = createRefundExecutor(client, config.refund, config.debug);
5286
5298
  refundExecutor.start();
5287
5299
  if (config.debug) {