@formant/realtime-sdk 0.0.14 → 0.0.16

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.
Files changed (57) hide show
  1. package/dist/common/BaseClient.d.ts +3 -4
  2. package/dist/common/FormantBaseClient.d.ts +4 -1
  3. package/dist/common/LogApiTransport.d.ts +4 -2
  4. package/dist/common/LogClient.d.ts +1 -0
  5. package/dist/common/LogReporter.d.ts +8 -0
  6. package/dist/common/LruCache.d.ts +7 -2
  7. package/dist/common/StatsManager.d.ts +17 -15
  8. package/dist/common/StatsReporter.d.ts +16 -0
  9. package/dist/common/assertUnreachable.d.ts +1 -0
  10. package/dist/common/config/index.d.ts +2 -0
  11. package/dist/common/delay.d.ts +1 -1
  12. package/dist/common/filterIceServers.d.ts +8 -0
  13. package/dist/common/instanceId.d.ts +1 -0
  14. package/dist/common/isValidTagString.d.ts +1 -0
  15. package/dist/common/logger.d.ts +1 -1
  16. package/dist/common/stats.d.ts +1 -1
  17. package/dist/date-fns/parseIsoDate.d.ts +1 -0
  18. package/dist/index.js +1 -1
  19. package/dist/model/IAdminSignupRequest.d.ts +1 -0
  20. package/dist/model/ILoginResult.d.ts +1 -0
  21. package/dist/model/IMetric.d.ts +7 -0
  22. package/dist/model/IRtcCreateSessionRequest.d.ts +1 -1
  23. package/dist/model/IRtcIceServer.d.ts +5 -0
  24. package/dist/model/IRtcInfo.d.ts +7 -0
  25. package/dist/model/IRtcSession.d.ts +2 -2
  26. package/dist/model/IStat.d.ts +1 -2
  27. package/dist/model/IUser.d.ts +1 -0
  28. package/dist/model/organizationPlans.d.ts +1 -1
  29. package/dist/model/rtcStreamTypes.d.ts +3 -1
  30. package/dist/protos/api/signaling/v1/signaling.proto +7 -0
  31. package/dist/protos/api/signaling/v1/signaling_grpc_pb.js +33 -0
  32. package/dist/protos/api/signaling/v1/signaling_grpc_web_pb.d.ts +12 -0
  33. package/dist/protos/api/signaling/v1/signaling_grpc_web_pb.js +80 -0
  34. package/dist/protos/api/signaling/v1/signaling_pb.d.ts +32 -0
  35. package/dist/protos/api/signaling/v1/signaling_pb.js +275 -0
  36. package/dist/realtime-sdk/src/index.d.ts +2 -2
  37. package/dist/rtc-client/RtcClient.d.ts +4 -2
  38. package/dist/rtc-client/RtcClientV1.d.ts +51 -0
  39. package/dist/rtc-client/RtcConnection.d.ts +10 -0
  40. package/dist/rtc-client/RtcConnectionV1.d.ts +72 -0
  41. package/dist/rtc-client/RtcSessionMetricsV1.d.ts +12 -0
  42. package/dist/rtc-client/gatherPingMetrics.d.ts +17 -0
  43. package/dist/rtc-client/models/IPingInfo.d.ts +10 -0
  44. package/dist/rtc-client/models/IPingPayload.d.ts +6 -0
  45. package/dist/rtc-client/models/IRtcClientConfiguration.d.ts +5 -5
  46. package/dist/rtc-client/models/IRtcStreamPayload.d.ts +3 -0
  47. package/dist/rtc-client/models-v1/IRtcClientConfigurationV1.d.ts +11 -0
  48. package/dist/rtc-client/models-v1/IRtcConnectionConfigurationV1.d.ts +12 -0
  49. package/dist/rtc-client/utils/createRtcStreamMessage.d.ts +1 -2
  50. package/dist/rtc-client/utils/encodeStreamId.d.ts +3 -0
  51. package/dist/rtc-client/utils/streamIsEqual.d.ts +2 -0
  52. package/dist/ui/utils/browser.d.ts +2 -0
  53. package/package.json +10 -4
  54. package/dist/common/LoggerReporter.d.ts +0 -9
  55. package/dist/model/IStatsReporter.d.ts +0 -6
  56. package/dist/rtc-client/models/IRtcConnectConfiguration.d.ts +0 -8
  57. package/dist/rtc-client/utils/getStreamId.d.ts +0 -2
@@ -20,22 +20,21 @@ export declare abstract class BaseClient {
20
20
  static waitForConnectivity: () => Promise<void>;
21
21
  static onResponseError: (error: ResponseError) => Promise<void>;
22
22
  private validateHeaders;
23
- private headers;
24
23
  private verbose;
25
24
  private configuredRetries;
26
25
  private timeoutMs?;
27
26
  private maxBackoffDelayMs;
28
27
  constructor(endpoint: string | undefined, options?: {
29
28
  validateHeaders?: (headers: Headers) => IValidation;
30
- headers?: {
31
- [_: string]: string;
32
- };
33
29
  verbose?: boolean;
34
30
  retries?: number;
35
31
  timeoutMs?: number;
36
32
  maxBackoffDelayMs?: number;
37
33
  });
38
34
  protected getRetries(): number;
35
+ protected getHeaders(): {
36
+ [_: string]: string;
37
+ };
39
38
  protected fetch<T>(path: string, extendedInit?: IRequestInit): Promise<T>;
40
39
  protected fetchVerbose<T>(path: string, extendedInit?: IRequestInit): Promise<IResponse<T>>;
41
40
  private doFetch;
@@ -1,4 +1,4 @@
1
- import { BaseClient } from "../common/BaseClient";
1
+ import { BaseClient } from "./BaseClient";
2
2
  export declare abstract class FormantBaseClient extends BaseClient {
3
3
  protected endpoint: string;
4
4
  static headers: {
@@ -7,4 +7,7 @@ export declare abstract class FormantBaseClient extends BaseClient {
7
7
  constructor(endpoint: string, options?: {
8
8
  timeoutMs?: number;
9
9
  });
10
+ protected getHeaders(): {
11
+ [_: string]: string;
12
+ };
10
13
  }
@@ -1,9 +1,11 @@
1
1
  import Transport from "winston-transport";
2
2
  export declare class LogApiTransport extends Transport {
3
3
  private endpoint;
4
- private meta;
4
+ private metadata;
5
5
  private logClient;
6
- constructor(endpoint: string, meta: () => any);
6
+ constructor(endpoint: string, metadata: {
7
+ [_: string]: string;
8
+ });
7
9
  private getLogClient;
8
10
  log(info: any, callback: () => void): Promise<void>;
9
11
  }
@@ -1,5 +1,6 @@
1
1
  import { ILogLine } from "../model/ILogLine";
2
2
  import { FormantBaseClient } from "./FormantBaseClient";
3
3
  export declare class LogClient extends FormantBaseClient {
4
+ static token?: string;
4
5
  log(lines: ILogLine[]): Promise<void>;
5
6
  }
@@ -0,0 +1,8 @@
1
+ import { IStatEntry, StatsReporter } from "./StatsReporter";
2
+ export declare class LogReporter implements StatsReporter<"simple"> {
3
+ name: string;
4
+ type: "simple";
5
+ private message;
6
+ constructor(message: string);
7
+ send(values: IStatEntry[]): Promise<void>;
8
+ }
@@ -1,15 +1,20 @@
1
1
  import BaseLruCache from "lru-cache";
2
2
  export declare type CacheOptions<V> = BaseLruCache.Options<string, V> & {
3
+ name: string;
3
4
  fastStringify?: boolean;
4
5
  };
5
6
  export declare class LruCache<K, V> {
6
- protected cache: BaseLruCache<string, V>;
7
- protected stringify: (_: K) => string;
7
+ private options;
8
+ private cache;
9
+ private stringify;
8
10
  constructor(options: CacheOptions<V>);
9
11
  set(key: K, value: V, ttl?: number): void;
10
12
  get(key: K): V | undefined;
11
13
  delete(key: K): void;
14
+ peek(key: K): V | undefined;
12
15
  size(): number;
13
16
  clear(): void;
14
17
  forEach(callback: (value: V) => void): void;
18
+ purgeStale(): boolean;
19
+ private updateStats;
15
20
  }
@@ -1,37 +1,39 @@
1
- import { IStatsReporter } from "../model/IStatsReporter";
1
+ import { IStat } from "../model/IStat";
2
+ import { ITags } from "../model/ITags";
3
+ import { StatsReporter } from "./StatsReporter";
2
4
  export declare class StatsManager {
5
+ private samplePeriodSeconds;
3
6
  private buffer;
4
- private metrics;
5
7
  private reporters;
6
8
  private flushInterval;
7
- constructor(samplePeriodSeconds?: number);
9
+ private tags;
10
+ constructor(config?: {
11
+ tags?: ITags;
12
+ });
8
13
  shutdown(): Promise<void>;
9
14
  /**
10
15
  * Aggregates a value into the IStat record at key.
11
16
  */
12
- aggregate(key: string, value: number): void;
17
+ aggregate(metric: string, value: number | IStat, tags?: ITags): void;
13
18
  /**
14
19
  * Aggregates 1 into the IStat record at key.
15
20
  */
16
- increment(key: string): void;
21
+ increment(metric: string, tags?: ITags): void;
17
22
  /**
18
23
  * Times a function call and the promise it produces.
19
24
  * The timing statistic is only recorded if the function
20
25
  * returns without an exception.
21
26
  */
22
- timer<T>(key: string, f: () => Promise<T>): Promise<T>;
23
- /**
24
- * Registered a function that produces a metric value.
25
- * The function is called on a timer to write metrics.
26
- */
27
- metric(key: string, f: () => number): void;
27
+ timer<T>(metric: string, f: () => Promise<T>, tags?: ITags): Promise<T>;
28
28
  /**
29
29
  * Register a reporter.
30
30
  */
31
- registerStatsReporter(statsReporter: IStatsReporter): void;
32
- /**
33
- * Output all stats to destinations.
34
- */
31
+ registerStatsReporter(statsReporter: StatsReporter): void;
32
+ setTag(key: string, value: string): void;
33
+ private addToBuffer;
35
34
  private write;
36
35
  private flushStats;
36
+ private encodeKey;
37
+ private decodeKey;
38
+ private filterTags;
37
39
  }
@@ -0,0 +1,16 @@
1
+ import { IMetric } from "../model/IMetric";
2
+ import { ITags } from "../model/ITags";
3
+ export interface IEntryTypeMap {
4
+ simple: IStatEntry;
5
+ tagged: ITaggedStatEntry;
6
+ }
7
+ export declare type StatsReporterType = keyof IEntryTypeMap;
8
+ export declare type IStatEntry = Omit<IMetric, "tags">;
9
+ export declare type ITaggedStatEntry = IStatEntry & {
10
+ tags: ITags;
11
+ };
12
+ export declare abstract class StatsReporter<T extends StatsReporterType = StatsReporterType> {
13
+ name: string;
14
+ type: T;
15
+ abstract send(values: IEntryTypeMap[T][], intervalSeconds: number): Promise<void>;
16
+ }
@@ -0,0 +1 @@
1
+ export declare function assertUnreachable(_: never): never;
@@ -7,6 +7,7 @@ export declare const version: string;
7
7
  export declare const buildTag: string;
8
8
  export declare const gitCommit: string;
9
9
  export declare const enableSentry: boolean;
10
+ export declare const enableSentryProfiling: boolean;
10
11
  export declare const sentryDsn: string;
11
12
  export declare const logLevel: string;
12
13
  export declare const logJson: boolean;
@@ -16,3 +17,4 @@ export declare const logApiEndpoint: string | undefined;
16
17
  export declare const jestWorkerId: string | undefined;
17
18
  export declare const sheetExportMaxRowCount: number;
18
19
  export declare const logToFile: boolean;
20
+ export declare const enableSelfServe: boolean;
@@ -1 +1 @@
1
- export declare const delay: (time?: number | undefined) => Promise<unknown>;
1
+ export declare const delay: (time?: number) => Promise<unknown>;
@@ -0,0 +1,8 @@
1
+ import { IRtcIceServer } from "../model/IRtcIceServer";
2
+ import { IRtcInfo } from "../model/IRtcInfo";
3
+ import { RtcIceServerProtocol } from "../model/RtcIceServerProtocol";
4
+ import { RtcIceTransportPolicy } from "../model/RtcIceTransportPolicy";
5
+ import { Uuid } from "../model/Uuid";
6
+ export declare function filterIceServers(iceServers: IRtcIceServer[], rtcInfo: IRtcInfo | undefined, organizationId?: Uuid): IRtcIceServer[];
7
+ export declare function isPolicy(url: string, policy: RtcIceTransportPolicy): boolean;
8
+ export declare function isProtocol(url: string, protocol: RtcIceServerProtocol): boolean;
@@ -0,0 +1 @@
1
+ export declare const instanceId: string;
@@ -0,0 +1 @@
1
+ export declare function isValidTagString(keyOrValue: string): boolean;
@@ -1,2 +1,2 @@
1
- export declare function addLogMeta(values: object): void;
1
+ export declare function setLogMetadata(key: string, value: string): void;
2
2
  export declare const logger: import("winston").Logger;
@@ -1,2 +1,2 @@
1
- import { StatsManager } from "../common/StatsManager";
1
+ import { StatsManager } from "./StatsManager";
2
2
  export declare const stats: StatsManager;
@@ -0,0 +1 @@
1
+ export declare function parseIsoDate(timestamp: string): Date;