@reactor-team/js-sdk 2.12.0 → 2.12.1
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/README.md +1 -1
- package/dist/index.d.mts +70 -10
- package/dist/index.d.ts +70 -10
- package/dist/index.js +78 -639
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -624
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -219,7 +219,7 @@ For models with a published typed SDK, prefer [`@reactor-models/<name>`](https:/
|
|
|
219
219
|
| Surface | Where it lives |
|
|
220
220
|
| -------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
|
|
221
221
|
| `Reactor` | [Reactor class](https://docs.reactor.inc/api-reference/reactor-class) |
|
|
222
|
-
| `<ReactorProvider>`, `<ReactorView>`, `<WebcamStream
|
|
222
|
+
| `<ReactorProvider>`, `<ReactorView>`, `<WebcamStream>` | [React components](https://docs.reactor.inc/api-reference/react-components) |
|
|
223
223
|
| `useReactor`, `useReactorMessage`, `useStats` | [React hooks](https://docs.reactor.inc/api-reference/react-hooks) |
|
|
224
224
|
| `<ClipPlayer>`, `<ClipDownloadButton>`, `useClipDownload`, `RecordingClient`, `RecordingError`, `fetchPlaylist`, `parsePlaylist` | [Recordings](https://docs.reactor.inc/concepts/recordings) |
|
|
225
225
|
|
package/dist/index.d.mts
CHANGED
|
@@ -85,6 +85,52 @@ type TrackCapability = z.infer<typeof TrackCapabilitySchema>;
|
|
|
85
85
|
type CommandCapability = z.infer<typeof CommandCapabilitySchema>;
|
|
86
86
|
type SessionResponse = z.infer<typeof SessionResponseSchema>;
|
|
87
87
|
type Capabilities = z.infer<typeof CapabilitiesSchema>;
|
|
88
|
+
/** One OpenAPI operation (the `post` of an event/webhook path item). */
|
|
89
|
+
interface ModelSchemaOperation {
|
|
90
|
+
operationId?: string;
|
|
91
|
+
summary?: string;
|
|
92
|
+
description?: string;
|
|
93
|
+
requestBody?: {
|
|
94
|
+
required?: boolean;
|
|
95
|
+
content?: Record<string, {
|
|
96
|
+
schema?: Record<string, unknown>;
|
|
97
|
+
}>;
|
|
98
|
+
};
|
|
99
|
+
responses?: Record<string, unknown>;
|
|
100
|
+
[key: string]: unknown;
|
|
101
|
+
}
|
|
102
|
+
/** An OpenAPI path item; the runtime only populates `post`. */
|
|
103
|
+
interface ModelSchemaPathItem {
|
|
104
|
+
post?: ModelSchemaOperation;
|
|
105
|
+
[key: string]: unknown;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The model's OpenAPI 3.1 schema, returned by the runtime in response to a
|
|
109
|
+
* `requestSchema` runtime-channel command. This is a pass-through of the
|
|
110
|
+
* runtime's document, not a shape the SDK reshapes: client-triggerable
|
|
111
|
+
* events live under `paths` as `POST /events/<name>` operations, outbound
|
|
112
|
+
* model messages under `webhooks`, and media tracks under `x-reactor.tracks`.
|
|
113
|
+
* Read the parts you need.
|
|
114
|
+
*/
|
|
115
|
+
interface ModelSchema {
|
|
116
|
+
openapi: string;
|
|
117
|
+
info: {
|
|
118
|
+
title: string;
|
|
119
|
+
version: string;
|
|
120
|
+
description?: string;
|
|
121
|
+
};
|
|
122
|
+
paths?: Record<string, ModelSchemaPathItem>;
|
|
123
|
+
webhooks?: Record<string, ModelSchemaPathItem>;
|
|
124
|
+
"x-reactor"?: {
|
|
125
|
+
tracks?: Array<{
|
|
126
|
+
name: string;
|
|
127
|
+
kind: string;
|
|
128
|
+
direction: string;
|
|
129
|
+
}>;
|
|
130
|
+
};
|
|
131
|
+
components?: Record<string, unknown>;
|
|
132
|
+
[key: string]: unknown;
|
|
133
|
+
}
|
|
88
134
|
|
|
89
135
|
/**
|
|
90
136
|
* Reference to an uploaded file, returned by {@link Reactor.uploadFile}.
|
|
@@ -205,7 +251,7 @@ interface ConnectionStats {
|
|
|
205
251
|
connectionTimings?: ConnectionTimings;
|
|
206
252
|
timestamp: number;
|
|
207
253
|
}
|
|
208
|
-
type ReactorEvent = "statusChanged" | "sessionIdChanged" | "message" | "runtimeMessage" | "trackReceived" | "error" | "sessionExpirationChanged" | "
|
|
254
|
+
type ReactorEvent = "statusChanged" | "sessionIdChanged" | "message" | "runtimeMessage" | "trackReceived" | "error" | "sessionExpirationChanged" | "schemaReceived" | "statsUpdate";
|
|
209
255
|
/**
|
|
210
256
|
* Severity tier of a content moderation event delivered as the inner
|
|
211
257
|
* payload of a `runtimeMessage` with `type === "moderation"`.
|
|
@@ -674,7 +720,7 @@ declare class Reactor {
|
|
|
674
720
|
private createdSession;
|
|
675
721
|
private connectStartTime?;
|
|
676
722
|
private connectionTimings?;
|
|
677
|
-
private
|
|
723
|
+
private schema?;
|
|
678
724
|
private tracks;
|
|
679
725
|
private presetTracks?;
|
|
680
726
|
private autoResumeTracks;
|
|
@@ -782,9 +828,16 @@ declare class Reactor {
|
|
|
782
828
|
getStatus(): ReactorStatus;
|
|
783
829
|
getState(): ReactorState$1;
|
|
784
830
|
getLastError(): ReactorError | undefined;
|
|
785
|
-
|
|
831
|
+
/**
|
|
832
|
+
* The model's OpenAPI schema (events, outbound messages, tracks),
|
|
833
|
+
* received over the runtime channel shortly after the session becomes
|
|
834
|
+
* ready. `undefined` until the `schemaReceived` event has fired.
|
|
835
|
+
*/
|
|
836
|
+
getSchema(): ModelSchema | undefined;
|
|
786
837
|
getSessionInfo(): SessionResponse | undefined;
|
|
787
838
|
getStats(): ConnectionStats | undefined;
|
|
839
|
+
/** Timing breakdown from the most recent connect() handshake. */
|
|
840
|
+
getConnectionTimings(): ConnectionTimings | undefined;
|
|
788
841
|
private setSessionId;
|
|
789
842
|
private setStatus;
|
|
790
843
|
private setSessionExpiration;
|
|
@@ -826,6 +879,19 @@ interface ReactorActions {
|
|
|
826
879
|
disconnect(recoverable?: boolean): Promise<void>;
|
|
827
880
|
publish(name: string, track: MediaStreamTrack): Promise<void>;
|
|
828
881
|
unpublish(name: string): Promise<void>;
|
|
882
|
+
/**
|
|
883
|
+
* Ask the runtime to stop processing a recvonly track. Top-level
|
|
884
|
+
* alias for `internal.reactor.pauseTrack(…)` — lifted onto the store
|
|
885
|
+
* so consumers don't have to reach through `internal.reactor`. See
|
|
886
|
+
* {@link Reactor.pauseTrack}.
|
|
887
|
+
*/
|
|
888
|
+
pauseTrack(name: string): void;
|
|
889
|
+
/**
|
|
890
|
+
* Ask the runtime to resume a previously paused recvonly track.
|
|
891
|
+
* Top-level alias for `internal.reactor.resumeTrack(…)`. See
|
|
892
|
+
* {@link Reactor.resumeTrack}.
|
|
893
|
+
*/
|
|
894
|
+
resumeTrack(name: string): void;
|
|
829
895
|
reconnect(options?: ConnectOptions): Promise<void>;
|
|
830
896
|
uploadFile(file: File | Blob, options?: {
|
|
831
897
|
name?: string;
|
|
@@ -921,12 +987,6 @@ interface ReactorViewProps {
|
|
|
921
987
|
}
|
|
922
988
|
declare function ReactorView({ track, audioTrack, width, height, className, style, videoObjectFit, muted, }: ReactorViewProps): react_jsx_runtime.JSX.Element;
|
|
923
989
|
|
|
924
|
-
interface ReactorControllerProps {
|
|
925
|
-
className?: string;
|
|
926
|
-
style?: React.CSSProperties;
|
|
927
|
-
}
|
|
928
|
-
declare function ReactorController({ className, style, }: ReactorControllerProps): react_jsx_runtime.JSX.Element;
|
|
929
|
-
|
|
930
990
|
interface WebcamStreamProps {
|
|
931
991
|
/**
|
|
932
992
|
* The name of the sendonly **video** track to publish the webcam to.
|
|
@@ -1266,4 +1326,4 @@ declare function useReactorInternalMessage(handler: (message: any) => void): voi
|
|
|
1266
1326
|
*/
|
|
1267
1327
|
declare function useStats(): ConnectionStats | undefined;
|
|
1268
1328
|
|
|
1269
|
-
export { AbortError, type Capabilities, type Clip, ClipDownloadButton, type ClipDownloadButtonProps, type ClipDownloadState, type ClipFailedPayload, type ClipKind, ClipPlayer, type ClipPlayerProps, type ClipReadyPayload, type CommandCapability, ConflictError, type ConnectOptions, type ConnectionStats, type ConnectionTimings, DEFAULT_BASE_URL, DEFAULT_CLIP_REQUEST_TIMEOUT_MS, DEFAULT_PLAYLIST_POLL_SLACK_MS, type DownloadClipOptions, type FetchPlaylistOptions, FileRef, type JwtResolver, type JwtSource, type MessageScope, type ModerationAction, type ModerationEvent, type Options, type ParseClipOptions, Reactor, type ReactorConnectOptions,
|
|
1329
|
+
export { AbortError, type Capabilities, type Clip, ClipDownloadButton, type ClipDownloadButtonProps, type ClipDownloadState, type ClipFailedPayload, type ClipKind, ClipPlayer, type ClipPlayerProps, type ClipReadyPayload, type CommandCapability, ConflictError, type ConnectOptions, type ConnectionStats, type ConnectionTimings, DEFAULT_BASE_URL, DEFAULT_CLIP_REQUEST_TIMEOUT_MS, DEFAULT_PLAYLIST_POLL_SLACK_MS, type DownloadClipOptions, type FetchPlaylistOptions, FileRef, type JwtResolver, type JwtSource, type MessageScope, type ModelSchema, type ModelSchemaOperation, type ModelSchemaPathItem, type ModerationAction, type ModerationEvent, type Options, type ParseClipOptions, Reactor, type ReactorConnectOptions, type ReactorError, type ReactorEvent, ReactorProvider, type ReactorState$1 as ReactorState, type ReactorStatus, type ReactorStore, ReactorView, type ReactorViewProps, RecordingClient, type RecordingClientHost, RecordingError, RuntimeRecordingMessageType, type SessionResponse, type TrackCapability, type UseClipDownloadOptions, type UseClipDownloadResult, WebcamStream, type WebcamStreamProps, clipFromPayload, createPlayableManifestUrl, downloadClipAsFile, fetchPlaylist, isAbortError, normalizeJwtSource, parsePlaylist, rewriteUrlHost, useClipDownload, useReactor, useReactorInternalMessage, useReactorMessage, useReactorStore, useStats };
|
package/dist/index.d.ts
CHANGED
|
@@ -85,6 +85,52 @@ type TrackCapability = z.infer<typeof TrackCapabilitySchema>;
|
|
|
85
85
|
type CommandCapability = z.infer<typeof CommandCapabilitySchema>;
|
|
86
86
|
type SessionResponse = z.infer<typeof SessionResponseSchema>;
|
|
87
87
|
type Capabilities = z.infer<typeof CapabilitiesSchema>;
|
|
88
|
+
/** One OpenAPI operation (the `post` of an event/webhook path item). */
|
|
89
|
+
interface ModelSchemaOperation {
|
|
90
|
+
operationId?: string;
|
|
91
|
+
summary?: string;
|
|
92
|
+
description?: string;
|
|
93
|
+
requestBody?: {
|
|
94
|
+
required?: boolean;
|
|
95
|
+
content?: Record<string, {
|
|
96
|
+
schema?: Record<string, unknown>;
|
|
97
|
+
}>;
|
|
98
|
+
};
|
|
99
|
+
responses?: Record<string, unknown>;
|
|
100
|
+
[key: string]: unknown;
|
|
101
|
+
}
|
|
102
|
+
/** An OpenAPI path item; the runtime only populates `post`. */
|
|
103
|
+
interface ModelSchemaPathItem {
|
|
104
|
+
post?: ModelSchemaOperation;
|
|
105
|
+
[key: string]: unknown;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The model's OpenAPI 3.1 schema, returned by the runtime in response to a
|
|
109
|
+
* `requestSchema` runtime-channel command. This is a pass-through of the
|
|
110
|
+
* runtime's document, not a shape the SDK reshapes: client-triggerable
|
|
111
|
+
* events live under `paths` as `POST /events/<name>` operations, outbound
|
|
112
|
+
* model messages under `webhooks`, and media tracks under `x-reactor.tracks`.
|
|
113
|
+
* Read the parts you need.
|
|
114
|
+
*/
|
|
115
|
+
interface ModelSchema {
|
|
116
|
+
openapi: string;
|
|
117
|
+
info: {
|
|
118
|
+
title: string;
|
|
119
|
+
version: string;
|
|
120
|
+
description?: string;
|
|
121
|
+
};
|
|
122
|
+
paths?: Record<string, ModelSchemaPathItem>;
|
|
123
|
+
webhooks?: Record<string, ModelSchemaPathItem>;
|
|
124
|
+
"x-reactor"?: {
|
|
125
|
+
tracks?: Array<{
|
|
126
|
+
name: string;
|
|
127
|
+
kind: string;
|
|
128
|
+
direction: string;
|
|
129
|
+
}>;
|
|
130
|
+
};
|
|
131
|
+
components?: Record<string, unknown>;
|
|
132
|
+
[key: string]: unknown;
|
|
133
|
+
}
|
|
88
134
|
|
|
89
135
|
/**
|
|
90
136
|
* Reference to an uploaded file, returned by {@link Reactor.uploadFile}.
|
|
@@ -205,7 +251,7 @@ interface ConnectionStats {
|
|
|
205
251
|
connectionTimings?: ConnectionTimings;
|
|
206
252
|
timestamp: number;
|
|
207
253
|
}
|
|
208
|
-
type ReactorEvent = "statusChanged" | "sessionIdChanged" | "message" | "runtimeMessage" | "trackReceived" | "error" | "sessionExpirationChanged" | "
|
|
254
|
+
type ReactorEvent = "statusChanged" | "sessionIdChanged" | "message" | "runtimeMessage" | "trackReceived" | "error" | "sessionExpirationChanged" | "schemaReceived" | "statsUpdate";
|
|
209
255
|
/**
|
|
210
256
|
* Severity tier of a content moderation event delivered as the inner
|
|
211
257
|
* payload of a `runtimeMessage` with `type === "moderation"`.
|
|
@@ -674,7 +720,7 @@ declare class Reactor {
|
|
|
674
720
|
private createdSession;
|
|
675
721
|
private connectStartTime?;
|
|
676
722
|
private connectionTimings?;
|
|
677
|
-
private
|
|
723
|
+
private schema?;
|
|
678
724
|
private tracks;
|
|
679
725
|
private presetTracks?;
|
|
680
726
|
private autoResumeTracks;
|
|
@@ -782,9 +828,16 @@ declare class Reactor {
|
|
|
782
828
|
getStatus(): ReactorStatus;
|
|
783
829
|
getState(): ReactorState$1;
|
|
784
830
|
getLastError(): ReactorError | undefined;
|
|
785
|
-
|
|
831
|
+
/**
|
|
832
|
+
* The model's OpenAPI schema (events, outbound messages, tracks),
|
|
833
|
+
* received over the runtime channel shortly after the session becomes
|
|
834
|
+
* ready. `undefined` until the `schemaReceived` event has fired.
|
|
835
|
+
*/
|
|
836
|
+
getSchema(): ModelSchema | undefined;
|
|
786
837
|
getSessionInfo(): SessionResponse | undefined;
|
|
787
838
|
getStats(): ConnectionStats | undefined;
|
|
839
|
+
/** Timing breakdown from the most recent connect() handshake. */
|
|
840
|
+
getConnectionTimings(): ConnectionTimings | undefined;
|
|
788
841
|
private setSessionId;
|
|
789
842
|
private setStatus;
|
|
790
843
|
private setSessionExpiration;
|
|
@@ -826,6 +879,19 @@ interface ReactorActions {
|
|
|
826
879
|
disconnect(recoverable?: boolean): Promise<void>;
|
|
827
880
|
publish(name: string, track: MediaStreamTrack): Promise<void>;
|
|
828
881
|
unpublish(name: string): Promise<void>;
|
|
882
|
+
/**
|
|
883
|
+
* Ask the runtime to stop processing a recvonly track. Top-level
|
|
884
|
+
* alias for `internal.reactor.pauseTrack(…)` — lifted onto the store
|
|
885
|
+
* so consumers don't have to reach through `internal.reactor`. See
|
|
886
|
+
* {@link Reactor.pauseTrack}.
|
|
887
|
+
*/
|
|
888
|
+
pauseTrack(name: string): void;
|
|
889
|
+
/**
|
|
890
|
+
* Ask the runtime to resume a previously paused recvonly track.
|
|
891
|
+
* Top-level alias for `internal.reactor.resumeTrack(…)`. See
|
|
892
|
+
* {@link Reactor.resumeTrack}.
|
|
893
|
+
*/
|
|
894
|
+
resumeTrack(name: string): void;
|
|
829
895
|
reconnect(options?: ConnectOptions): Promise<void>;
|
|
830
896
|
uploadFile(file: File | Blob, options?: {
|
|
831
897
|
name?: string;
|
|
@@ -921,12 +987,6 @@ interface ReactorViewProps {
|
|
|
921
987
|
}
|
|
922
988
|
declare function ReactorView({ track, audioTrack, width, height, className, style, videoObjectFit, muted, }: ReactorViewProps): react_jsx_runtime.JSX.Element;
|
|
923
989
|
|
|
924
|
-
interface ReactorControllerProps {
|
|
925
|
-
className?: string;
|
|
926
|
-
style?: React.CSSProperties;
|
|
927
|
-
}
|
|
928
|
-
declare function ReactorController({ className, style, }: ReactorControllerProps): react_jsx_runtime.JSX.Element;
|
|
929
|
-
|
|
930
990
|
interface WebcamStreamProps {
|
|
931
991
|
/**
|
|
932
992
|
* The name of the sendonly **video** track to publish the webcam to.
|
|
@@ -1266,4 +1326,4 @@ declare function useReactorInternalMessage(handler: (message: any) => void): voi
|
|
|
1266
1326
|
*/
|
|
1267
1327
|
declare function useStats(): ConnectionStats | undefined;
|
|
1268
1328
|
|
|
1269
|
-
export { AbortError, type Capabilities, type Clip, ClipDownloadButton, type ClipDownloadButtonProps, type ClipDownloadState, type ClipFailedPayload, type ClipKind, ClipPlayer, type ClipPlayerProps, type ClipReadyPayload, type CommandCapability, ConflictError, type ConnectOptions, type ConnectionStats, type ConnectionTimings, DEFAULT_BASE_URL, DEFAULT_CLIP_REQUEST_TIMEOUT_MS, DEFAULT_PLAYLIST_POLL_SLACK_MS, type DownloadClipOptions, type FetchPlaylistOptions, FileRef, type JwtResolver, type JwtSource, type MessageScope, type ModerationAction, type ModerationEvent, type Options, type ParseClipOptions, Reactor, type ReactorConnectOptions,
|
|
1329
|
+
export { AbortError, type Capabilities, type Clip, ClipDownloadButton, type ClipDownloadButtonProps, type ClipDownloadState, type ClipFailedPayload, type ClipKind, ClipPlayer, type ClipPlayerProps, type ClipReadyPayload, type CommandCapability, ConflictError, type ConnectOptions, type ConnectionStats, type ConnectionTimings, DEFAULT_BASE_URL, DEFAULT_CLIP_REQUEST_TIMEOUT_MS, DEFAULT_PLAYLIST_POLL_SLACK_MS, type DownloadClipOptions, type FetchPlaylistOptions, FileRef, type JwtResolver, type JwtSource, type MessageScope, type ModelSchema, type ModelSchemaOperation, type ModelSchemaPathItem, type ModerationAction, type ModerationEvent, type Options, type ParseClipOptions, Reactor, type ReactorConnectOptions, type ReactorError, type ReactorEvent, ReactorProvider, type ReactorState$1 as ReactorState, type ReactorStatus, type ReactorStore, ReactorView, type ReactorViewProps, RecordingClient, type RecordingClientHost, RecordingError, RuntimeRecordingMessageType, type SessionResponse, type TrackCapability, type UseClipDownloadOptions, type UseClipDownloadResult, WebcamStream, type WebcamStreamProps, clipFromPayload, createPlayableManifestUrl, downloadClipAsFile, fetchPlaylist, isAbortError, normalizeJwtSource, parsePlaylist, rewriteUrlHost, useClipDownload, useReactor, useReactorInternalMessage, useReactorMessage, useReactorStore, useStats };
|