@experteam-mx/ngx-services 20.8.6 → 20.8.9
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.
package/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { InjectionToken, ModuleWithProviders, EnvironmentProviders } from '@angular/core';
|
|
3
3
|
import { Observable, BehaviorSubject } from 'rxjs';
|
|
4
4
|
import { HttpResponse, HttpRequest, HttpHandlerFn, HttpEvent, HttpParams, HttpHeaders } from '@angular/common/http';
|
|
5
|
-
import { Channel } from 'pusher-js';
|
|
5
|
+
import Pusher, { Channel } from 'pusher-js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Represents the configuration settings for the application's environment.
|
|
@@ -18,7 +18,6 @@ import { Channel } from 'pusher-js';
|
|
|
18
18
|
* - authCookie: The name of the authentication cookie used for user sessions.
|
|
19
19
|
* - cacheTtl: Optional. Specifies the time-to-live (TTL) for cached items.
|
|
20
20
|
* - printUrl: Optional. The URL used for generating or downloading printable documents.
|
|
21
|
-
* - secretKey: A secret key used for authentication or other secure operations.
|
|
22
21
|
*/
|
|
23
22
|
type Environment = {
|
|
24
23
|
apiBillingCO?: string;
|
|
@@ -52,9 +51,7 @@ type Environment = {
|
|
|
52
51
|
authCookie?: string;
|
|
53
52
|
cacheTtl?: number;
|
|
54
53
|
printUrl?: string;
|
|
55
|
-
secretKey?: string;
|
|
56
54
|
sockets?: {
|
|
57
|
-
app_key: string;
|
|
58
55
|
debug?: boolean;
|
|
59
56
|
port: number;
|
|
60
57
|
url: string;
|
|
@@ -9424,8 +9421,35 @@ declare enum PaymentTypeCode {
|
|
|
9424
9421
|
|
|
9425
9422
|
declare class WebSocketsService {
|
|
9426
9423
|
private pusher;
|
|
9424
|
+
private appKey;
|
|
9425
|
+
private connectPromise;
|
|
9427
9426
|
private environments;
|
|
9428
|
-
|
|
9427
|
+
private getAuthToken;
|
|
9428
|
+
private readonly channelAuthHeaders;
|
|
9429
|
+
/**
|
|
9430
|
+
* Stores the Pusher/Soketi application key without opening a connection.
|
|
9431
|
+
* The first `channelSub` / `eventBind` opens Pusher via `ensureConnected`.
|
|
9432
|
+
*
|
|
9433
|
+
* @param {string} appKey - The Pusher/Soketi application key.
|
|
9434
|
+
*/
|
|
9435
|
+
setAppKey(appKey: string): void;
|
|
9436
|
+
/**
|
|
9437
|
+
* Registers a live token provider used when authorizing private/presence channels.
|
|
9438
|
+
* The provider is called at subscribe/authorize time; the token is not snapshotted here.
|
|
9439
|
+
*
|
|
9440
|
+
* @param {() => string | null} getToken - Returns the current session token, or null.
|
|
9441
|
+
*/
|
|
9442
|
+
setAuthTokenProvider(getToken: () => string | null): void;
|
|
9443
|
+
/**
|
|
9444
|
+
* Connects to Pusher using the given app key and env `sockets` url/port/debug.
|
|
9445
|
+
* No-ops if already connected with the same key; reconnects if the key changed.
|
|
9446
|
+
* Resolves false when `sockets` is missing from the environment.
|
|
9447
|
+
* Apps should store the key with `setAppKey` and let subscribe open the client.
|
|
9448
|
+
*
|
|
9449
|
+
* @param {string} appKey - The Pusher/Soketi application key.
|
|
9450
|
+
* @return {Promise<Pusher | false>} The Pusher instance, or false when sockets are not configured.
|
|
9451
|
+
*/
|
|
9452
|
+
connect(appKey: string): Promise<Pusher | false>;
|
|
9429
9453
|
/**
|
|
9430
9454
|
* Publishes an event to the specified channel with the given data.
|
|
9431
9455
|
*
|
|
@@ -9462,16 +9486,16 @@ declare class WebSocketsService {
|
|
|
9462
9486
|
* @return {Observable<T>} An observable that emits data from the unbound event callback.
|
|
9463
9487
|
*/
|
|
9464
9488
|
eventUnbind<T>(channel: Channel, event: string): Observable<unknown>;
|
|
9465
|
-
private
|
|
9489
|
+
private ensureConnected;
|
|
9490
|
+
private refreshChannelAuthHeader;
|
|
9466
9491
|
private wait;
|
|
9467
9492
|
static ɵfac: i0.ɵɵFactoryDeclaration<WebSocketsService, never>;
|
|
9468
9493
|
static ɵprov: i0.ɵɵInjectableDeclaration<WebSocketsService>;
|
|
9469
9494
|
}
|
|
9470
9495
|
|
|
9471
9496
|
declare class CryptoService {
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
decryptAES(payload: string): Promise<string>;
|
|
9497
|
+
encryptAES(plaintext: string, secretKey: string): Promise<string>;
|
|
9498
|
+
decryptAES(payload: string, secretKey: string): Promise<string>;
|
|
9475
9499
|
private loadKey;
|
|
9476
9500
|
private uint8ArrayToBase64;
|
|
9477
9501
|
private base64ToUint8Array;
|