@schematichq/schematic-js 1.2.8 → 1.2.10

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.
@@ -378,12 +378,31 @@ export declare class Schematic {
378
378
  private wsReconnectAttempts;
379
379
  private wsReconnectTimer;
380
380
  private wsIntentionalDisconnect;
381
+ private currentWebSocket;
382
+ private isConnecting;
381
383
  private maxEventQueueSize;
382
384
  private maxEventRetries;
383
385
  private eventRetryInitialDelay;
384
386
  private eventRetryMaxDelay;
385
387
  private retryTimer;
388
+ private flagValueDefaults;
389
+ private flagCheckDefaults;
386
390
  constructor(apiKey: string, options?: SchematicOptions);
391
+ /**
392
+ * Resolve fallback value according to priority order:
393
+ * 1. Callsite fallback value (if provided)
394
+ * 2. Initialization fallback value (flagValueDefaults)
395
+ * 3. Default to false
396
+ */
397
+ private resolveFallbackValue;
398
+ /**
399
+ * Resolve complete CheckFlagReturn object according to priority order:
400
+ * 1. Use callsite fallback for boolean value, construct CheckFlagReturn
401
+ * 2. Use flagCheckDefaults if available for this flag
402
+ * 3. Use flagValueDefaults if available for this flag, construct CheckFlagReturn
403
+ * 4. Default CheckFlagReturn with value: false
404
+ */
405
+ private resolveFallbackCheckFlagReturn;
387
406
  /**
388
407
  * Get value for a single flag.
389
408
  * In WebSocket mode, returns cached values if connection is active, otherwise establishes
@@ -396,7 +415,11 @@ export declare class Schematic {
396
415
  * Helper function to log debug messages
397
416
  * Only logs if debug mode is enabled
398
417
  */
399
- private debug;
418
+ debug(message: string, ...args: unknown[]): void;
419
+ /**
420
+ * Create a persistent message handler for websocket flag updates
421
+ */
422
+ private createPersistentMessageHandler;
400
423
  /**
401
424
  * Helper function to check if client is in offline mode
402
425
  */
@@ -483,7 +506,6 @@ export declare class Schematic {
483
506
  */
484
507
  private attemptReconnect;
485
508
  private wsConnect;
486
- private wsSendContextAfterReconnection;
487
509
  private wsSendMessage;
488
510
  /**
489
511
  * State management
@@ -547,6 +569,10 @@ export declare type SchematicOptions = {
547
569
  eventRetryInitialDelay?: number;
548
570
  /** Maximum retry delay in milliseconds for failed events (default: 30000) */
549
571
  eventRetryMaxDelay?: number;
572
+ /** Default boolean values for flags when Schematic API cannot be reached and no callsite fallback is provided */
573
+ flagValueDefaults?: Record<string, boolean>;
574
+ /** Default CheckFlagReturn objects for flags when Schematic API cannot be reached and no callsite fallback is provided */
575
+ flagCheckDefaults?: Record<string, CheckFlagReturn>;
550
576
  };
551
577
 
552
578
  /** Optional type for implementing custom client-side storage */