@formant/realtime-sdk 0.0.19 → 1.0.0

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 (103) hide show
  1. package/LICENSE.txt +19 -0
  2. package/README.md +43 -0
  3. package/dist/{common → client}/Credentials.d.ts +1 -1
  4. package/dist/common/BaseClient.d.ts +4 -3
  5. package/dist/common/LogReporter.d.ts +1 -3
  6. package/dist/common/LruCache.d.ts +1 -1
  7. package/dist/common/PromiseLruCache.d.ts +1 -1
  8. package/dist/common/ResponseError.d.ts +3 -2
  9. package/dist/common/StatsManager.d.ts +1 -1
  10. package/dist/common/StatsReporter.d.ts +7 -6
  11. package/dist/common/config/index.d.ts +2 -0
  12. package/dist/common/defined.d.ts +3 -0
  13. package/dist/common/isErrorType.d.ts +1 -0
  14. package/dist/common/narrowError.d.ts +1 -1
  15. package/dist/common/redact.d.ts +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/model/AnnotationAreaType.d.ts +2 -0
  18. package/dist/model/CognitoRegion.d.ts +2 -0
  19. package/dist/model/Feature.d.ts +2 -2
  20. package/dist/model/HealthStatus.d.ts +2 -0
  21. package/dist/model/HexRgbColor.d.ts +1 -0
  22. package/dist/model/IAnnotationAreaTypeMap.d.ts +4 -0
  23. package/dist/model/IBattery.d.ts +6 -0
  24. package/dist/model/IBitset.d.ts +4 -0
  25. package/dist/model/IBoundingBox.d.ts +6 -0
  26. package/dist/model/IDictionary.d.ts +3 -0
  27. package/dist/model/IFile.d.ts +6 -0
  28. package/dist/model/IFilter.d.ts +10 -0
  29. package/dist/model/IGoal.d.ts +5 -0
  30. package/dist/model/IHealth.d.ts +5 -0
  31. package/dist/model/IImage.d.ts +6 -0
  32. package/dist/model/IImageAnnotation.d.ts +9 -0
  33. package/dist/model/ILocalization.d.ts +14 -0
  34. package/dist/model/ILocation.d.ts +6 -0
  35. package/dist/model/IMap.d.ts +10 -0
  36. package/dist/model/INumericSetEntry.d.ts +5 -0
  37. package/dist/model/IOdometry.d.ts +7 -0
  38. package/dist/model/IPath.d.ts +5 -0
  39. package/dist/model/IPoint.d.ts +1 -1
  40. package/dist/model/IPointCloud.d.ts +6 -0
  41. package/dist/model/IRtcSession.d.ts +1 -1
  42. package/dist/model/IRtcStream.d.ts +1 -0
  43. package/dist/model/IScopeFilter.d.ts +6 -0
  44. package/dist/model/IStreamTypeMap.d.ts +27 -0
  45. package/dist/model/ITagSets.d.ts +3 -0
  46. package/dist/model/ITags.d.ts +2 -3
  47. package/dist/model/ITransformNode.d.ts +8 -0
  48. package/dist/model/IUser.d.ts +18 -4
  49. package/dist/model/IUserScope.d.ts +16 -0
  50. package/dist/model/IVideo.d.ts +7 -0
  51. package/dist/model/IsoDate.d.ts +1 -1
  52. package/dist/model/LanguageType.d.ts +2 -0
  53. package/dist/model/LogLevel.d.ts +1 -1
  54. package/dist/model/Marker3DAction.d.ts +1 -1
  55. package/dist/model/Marker3DType.d.ts +1 -1
  56. package/dist/model/OrganizationPlan.d.ts +1 -1
  57. package/dist/model/RequireKeys.d.ts +3 -0
  58. package/dist/model/RtcConnectionStatus.d.ts +1 -1
  59. package/dist/model/RtcIceServerProtocol.d.ts +1 -1
  60. package/dist/model/RtcIceTransportPolicy.d.ts +1 -1
  61. package/dist/model/RtcStreamType.d.ts +2 -2
  62. package/dist/model/SmsOptInStatus.d.ts +2 -0
  63. package/dist/model/StreamType.d.ts +2 -0
  64. package/dist/model/Timeout.d.ts +1 -1
  65. package/dist/model/Timestamp.d.ts +1 -1
  66. package/dist/model/Uuid.d.ts +1 -1
  67. package/dist/model/VideoMimeType.d.ts +2 -0
  68. package/dist/model/cognitoRegions.d.ts +1 -0
  69. package/dist/model/features.d.ts +1 -1
  70. package/dist/model/healthStatuses.d.ts +5 -0
  71. package/dist/model/languageTypes.d.ts +1 -0
  72. package/dist/model/rtcStreamTypes.d.ts +2 -1
  73. package/dist/model/smsOptInStatuses.d.ts +1 -0
  74. package/dist/model/videoMimeTypes.d.ts +1 -0
  75. package/dist/protos/api/signaling/v1/signaling_grpc_web_pb.d.ts +106 -120
  76. package/dist/protos/api/signaling/v1/signaling_grpc_web_pb.js +27 -175
  77. package/dist/protos/api/signaling/v1/signaling_pb.js +7 -1
  78. package/dist/realtime-sdk/src/index.d.ts +10 -10
  79. package/dist/rtc-client/DeadlineEnforcer.d.ts +4 -0
  80. package/dist/rtc-client/DeadlineReachedError.d.ts +3 -0
  81. package/dist/rtc-client/IHasPeerConnection.d.ts +3 -0
  82. package/dist/rtc-client/IHasRemoteDeviceId.d.ts +4 -0
  83. package/dist/rtc-client/RtcClient.d.ts +3 -0
  84. package/dist/rtc-client/RtcClientV1.d.ts +1 -0
  85. package/dist/rtc-client/RtcConnection.d.ts +18 -14
  86. package/dist/rtc-client/RtcConnectionV1.d.ts +2 -1
  87. package/dist/rtc-client/RtcSessionMetrics.d.ts +5 -4
  88. package/dist/rtc-client/RtcSessionMetricsV1.d.ts +8 -6
  89. package/dist/rtc-client/gatherPingMetrics.d.ts +2 -2
  90. package/dist/rtc-client/models/IIceMode.d.ts +1 -1
  91. package/dist/rtc-client/models/IRtcClientConfiguration.d.ts +1 -1
  92. package/dist/rtc-client/models/IRtcConnectionConfiguration.d.ts +1 -1
  93. package/dist/rtc-client/models/IRtcStreamPayload.d.ts +2 -0
  94. package/dist/rtc-client/models/IStreamControl.d.ts +1 -1
  95. package/dist/rtc-client/models/RtcChannelLabel.d.ts +1 -1
  96. package/dist/rtc-client/models/RtcCommunicationType.d.ts +1 -1
  97. package/dist/rtc-client/utils/assertHasPeerConnection.d.ts +1 -0
  98. package/dist/rtc-client/utils/garbageCollect.d.ts +1 -0
  99. package/dist/rtc-client/utils/getErrorMessage.d.ts +1 -0
  100. package/dist/rtc-client/utils/partition.d.ts +1 -0
  101. package/dist/ui/utils/browser.d.ts +1 -1
  102. package/package.json +3 -3
  103. package/dist/protos/api/signaling/v1/signaling_grpc_pb.js +0 -276
package/LICENSE.txt ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2023 Formant
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Formant Realtime SDK
2
+
3
+ A library for accessing realtime connections your Formant devices/fleet.
4
+
5
+ ## Get Started
6
+
7
+ ```bash
8
+ $ npm install --save @formant/realtime-sdk@latest
9
+
10
+ # or with
11
+
12
+ $ yarn add @formant/realtime-sdk@latest
13
+ ```
14
+
15
+ ## License
16
+
17
+ Distributed under the MIT License. See LICENSE.txt for more information.
18
+
19
+ ## Changelog
20
+
21
+ ### **1.0.0** - 2023-07-19
22
+
23
+ #### Added
24
+ - Odometry over teleop
25
+ - Add support for eventing on all event trigger types
26
+
27
+ #### Changed
28
+ - Reduce ICE gathering timeout to 3s
29
+
30
+ #### Fixed
31
+ - Workaround for lack of getConfiguration method on RTCPeerConnection
32
+ - Project de-cycling
33
+ - Fix Odom
34
+ - Use previously implemented util for detecting STUN vs TURN
35
+ - Partition connections in a single step…
36
+ - Immediately eject a disconnected connection from the connection set
37
+ - More cleanup on rtcClient shutdown
38
+ - Record RTC connection type metric (host, relay, etc)
39
+ - Make best-effort to *release* the RtcPeerConnection on close
40
+ - `isConnectionInitiator` never gets cleared, keeping RtcConnections alive
41
+ - Add prettier plugin to deterministically sort import ordering
42
+ - Dependency updates
43
+ - Resolve realtime-sdk build warnings about re-exporting types
@@ -1,4 +1,4 @@
1
- import { AuthClient } from "../client/AuthClient";
1
+ import { AuthClient } from "./AuthClient";
2
2
  export declare class Credentials {
3
3
  private authClient;
4
4
  private email;
@@ -1,10 +1,9 @@
1
+ import { IDictionary } from "../model/IDictionary";
1
2
  import { IValidation } from "../model/IValidation";
2
3
  import { ResponseError } from "./ResponseError";
3
4
  export interface IRequestInit {
4
5
  method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
5
- headers?: {
6
- [key: string]: string;
7
- };
6
+ headers?: IDictionary;
8
7
  body?: any;
9
8
  token?: string;
10
9
  allowUnsafeRetries?: boolean;
@@ -24,12 +23,14 @@ export declare abstract class BaseClient {
24
23
  private configuredRetries;
25
24
  private timeoutMs?;
26
25
  private maxBackoffDelayMs;
26
+ private json;
27
27
  constructor(endpoint: string | undefined, options?: {
28
28
  validateHeaders?: (headers: Headers) => IValidation;
29
29
  verbose?: boolean;
30
30
  retries?: number;
31
31
  timeoutMs?: number;
32
32
  maxBackoffDelayMs?: number;
33
+ json?: boolean;
33
34
  });
34
35
  protected getRetries(): number;
35
36
  protected getHeaders(): {
@@ -1,7 +1,5 @@
1
1
  import { IStatEntry, StatsReporter } from "./StatsReporter";
2
- export declare class LogReporter implements StatsReporter<"simple"> {
3
- name: string;
4
- type: "simple";
2
+ export declare class LogReporter extends StatsReporter<"simple"> {
5
3
  private message;
6
4
  constructor(message: string);
7
5
  send(values: IStatEntry[]): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import BaseLruCache from "lru-cache";
2
- export declare type CacheOptions<V> = BaseLruCache.Options<string, V> & {
2
+ export type CacheOptions<V> = BaseLruCache.Options<string, V> & {
3
3
  name: string;
4
4
  fastStringify?: boolean;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { CacheOptions, LruCache } from "./LruCache";
2
- export declare type PromiseCacheOptions<V> = CacheOptions<Promise<V>> & {
2
+ export type PromiseCacheOptions<V> = CacheOptions<Promise<V>> & {
3
3
  expireRejectedPromiseValues?: boolean;
4
4
  rejectedPromiseValueTtl?: number;
5
5
  };
@@ -2,9 +2,10 @@ import { IValidation } from "../model/IValidation";
2
2
  export declare class ResponseError extends Error {
3
3
  method: string;
4
4
  url: string;
5
+ requestBody: any;
5
6
  statusCode: number;
7
+ headers: any;
6
8
  body: any;
7
9
  validationErrors: IValidation;
8
- headers?: any;
9
- constructor(method: string, url: string, statusCode: number, body: any, validationErrors?: IValidation, headers?: any);
10
+ constructor(method: string, url: string, requestBody: any, statusCode: number, headers: any, body: any, validationErrors?: IValidation);
10
11
  }
@@ -2,7 +2,7 @@ import { IStat } from "../model/IStat";
2
2
  import { ITags } from "../model/ITags";
3
3
  import { StatsReporter } from "./StatsReporter";
4
4
  export declare class StatsManager {
5
- private samplePeriodSeconds;
5
+ static readonly samplePeriodMs: number;
6
6
  private buffer;
7
7
  private reporters;
8
8
  private flushInterval;
@@ -4,13 +4,14 @@ export interface IEntryTypeMap {
4
4
  simple: IStatEntry;
5
5
  tagged: ITaggedStatEntry;
6
6
  }
7
- export declare type StatsReporterType = keyof IEntryTypeMap;
8
- export declare type IStatEntry = Omit<IMetric, "tags">;
9
- export declare type ITaggedStatEntry = IStatEntry & {
7
+ export type StatsReporterType = keyof IEntryTypeMap;
8
+ export type IStatEntry = Omit<IMetric, "tags">;
9
+ export type ITaggedStatEntry = IStatEntry & {
10
10
  tags: ITags;
11
11
  };
12
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>;
13
+ readonly type: T;
14
+ readonly name: string;
15
+ constructor(type: T, name: string);
16
+ abstract send(values: IEntryTypeMap[T][], intervalMs: number): Promise<void>;
16
17
  }
@@ -18,3 +18,5 @@ export declare const jestWorkerId: string | undefined;
18
18
  export declare const sheetExportMaxRowCount: number;
19
19
  export declare const logToFile: boolean;
20
20
  export declare const enableSelfServe: boolean;
21
+ export type UsageMetricsAggregateLevel = "day" | "hour" | "minute";
22
+ export declare const aggregateLevel: UsageMetricsAggregateLevel;
@@ -1,3 +1,6 @@
1
+ export declare function assertsDefined<T>(value: T | undefined, message?: string): asserts value is T;
2
+ export declare function assertsNotNull<T>(value: T | null, message?: string): asserts value is T;
3
+ export declare function assertsDefinedAndNotNull<T>(value: T | undefined | null, message?: string): asserts value is T;
1
4
  export declare function defined<T>(value: T | undefined): T;
2
5
  export declare function notNull<T>(value: T | null): T;
3
6
  export declare function definedAndNotNull<T>(value: T | undefined | null): T;
@@ -0,0 +1 @@
1
+ export declare function isErrorType<T extends Error>(error: unknown, constructor: new (...x: any[]) => T, predicate?: (t: T) => boolean): error is T;
@@ -1 +1 @@
1
- export declare function narrowError<T>(error: unknown, constructor: new (...x: any[]) => T, predicate?: (t: T) => boolean): T;
1
+ export declare function narrowError<T extends Error>(error: unknown, constructor: new (...x: any[]) => T, predicate?: (t: T) => boolean): T;
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Returns a copy of an object with sensitive information redacted.
3
3
  */
4
- export declare function redact(object: any, visited?: Set<any>): any;
4
+ export declare function redact(object: unknown, visited?: WeakSet<any>): any;