@q9labsai/chalk-client 5.2.4 → 5.2.5
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/dist/access/grant.d.ts +2 -1
- package/dist/access/manager.d.ts +1 -0
- package/dist/{chunk-LDPC2JZB.js → chunk-BUNSEDXL.js} +664 -175
- package/dist/{chunk-3ASKGMD3.js → chunk-FD25AMLG.js} +322 -211
- package/dist/{chunk-SYUGRHZ5.js → chunk-LKNT6XFD.js} +1 -1
- package/dist/{chunk-AZONR3Q3.js → chunk-UMAE5GCV.js} +101 -7
- package/dist/client.d.ts +73 -2
- package/dist/connection/dependencies.d.ts +4 -1
- package/dist/connection/diagnostics.d.ts +4 -0
- package/dist/connection/episode-status.d.ts +7 -0
- package/dist/connection/index.d.ts +2 -0
- package/dist/connection/lifecycle.d.ts +2 -0
- package/dist/effect.js +19 -3
- package/dist/generated/http-api.d.ts +72 -2
- package/dist/generated/schemas.d.ts +125 -4
- package/dist/index.js +4 -4
- package/dist/media/client.d.ts +1 -1
- package/dist/media/failure-diagnostics.d.ts +10 -0
- package/dist/media/index.js +1 -1
- package/dist/media/plane.d.ts +1 -0
- package/dist/media/types.d.ts +2 -1
- package/dist/public-invites/index.js +2 -2
- package/dist/server/access-refresh.d.cts +1 -1
- package/dist/server/access-refresh.d.ts +1 -1
- package/dist/server/index.cjs +15 -5
- package/dist/server/index.js +15 -5
- package/dist/server/types.d.cts +2 -1
- package/dist/server/types.d.ts +2 -1
- package/dist/space-client/media-projection-monitor.d.ts +26 -0
- package/dist/space-client/types.d.ts +4 -0
- package/dist/transport-diagnostics.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1037,6 +1037,7 @@ declare const ChalkApi_base: HttpApi.HttpApi<"ChalkApi", HttpApiGroup.HttpApiGro
|
|
|
1037
1037
|
readonly tenant_id: import("effect/Schema").brand<import("effect/Schema").String, "TenantId">;
|
|
1038
1038
|
}>>, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
1039
1039
|
readonly current_media_token: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
1040
|
+
readonly expected_media_connection_id: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
1040
1041
|
readonly participant_generation: import("effect/Schema").Number;
|
|
1041
1042
|
readonly replace_media_connection: import("effect/Schema").Boolean;
|
|
1042
1043
|
}>>, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
@@ -1158,6 +1159,11 @@ declare const ChalkApi_base: HttpApi.HttpApi<"ChalkApi", HttpApiGroup.HttpApiGro
|
|
|
1158
1159
|
readonly code: import("effect/Schema").Literal<"participant.invalid_id">;
|
|
1159
1160
|
readonly message: import("effect/Schema").String;
|
|
1160
1161
|
}>;
|
|
1162
|
+
}>, never, never> | import("effect/Schema").decodeTo<typeof S.ParticipantMediaReplacementPendingError, import("effect/Schema").Struct<{
|
|
1163
|
+
readonly error: import("effect/Schema").Struct<{
|
|
1164
|
+
readonly code: import("effect/Schema").Literal<"participant.media_replacement_pending">;
|
|
1165
|
+
readonly message: import("effect/Schema").String;
|
|
1166
|
+
}>;
|
|
1161
1167
|
}>, never, never> | import("effect/Schema").decodeTo<typeof S.ParticipantNotFoundError, import("effect/Schema").Struct<{
|
|
1162
1168
|
readonly error: import("effect/Schema").Struct<{
|
|
1163
1169
|
readonly code: import("effect/Schema").Literal<"participant.not_found">;
|
|
@@ -1735,15 +1741,22 @@ declare const ChalkApi_base: HttpApi.HttpApi<"ChalkApi", HttpApiGroup.HttpApiGro
|
|
|
1735
1741
|
readonly code: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["invalid_state", "invalid_access", "access_unavailable", "permission_denied", "device_not_found", "device_busy", "device_constraint_invalid", "media_capture_failed", "sync_start_failed", "state_digest_recovery_failed", "sync_hello_timeout", "media_start_failed", "join_cleanup_unconfirmed", "sync_recovery_exhausted", "media_recovery_exhausted", "command_rejected", "leave_unconfirmed", "episode_ended", "unsupported_environment", "internal_error", "collaboration_unavailable", "chat_cursor_reset_required", "rate_limited", "invalid_payload"]>>;
|
|
1736
1742
|
readonly duration_ms: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").Number>>;
|
|
1737
1743
|
readonly elapsed_ms: import("effect/Schema").Number;
|
|
1738
|
-
readonly event: import("effect/Schema").Literals<readonly ["space_join_span", "state_changed", "connection_failed", "sync_connect_failed", "sync_dial_timeout", "access_refreshed", "access_refresh_failed", "recovery_attempt", "recovery_succeeded", "recovery_exhausted", "cleanup_completed", "cleanup_unconfirmed", "sync_socket_open", "sync_socket_close", "sync_heartbeat_gap", "media_state", "media_http_error"]>;
|
|
1744
|
+
readonly event: import("effect/Schema").Literals<readonly ["space_join_span", "state_changed", "connection_failed", "sync_connect_failed", "sync_dial_timeout", "access_refreshed", "access_refresh_failed", "recovery_attempt", "recovery_succeeded", "recovery_exhausted", "cleanup_completed", "cleanup_unconfirmed", "sync_socket_open", "sync_socket_close", "sync_heartbeat_gap", "media_state", "media_http_error", "media_projection_mismatch"]>;
|
|
1745
|
+
readonly granted_audio: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["granted", "not_granted", "unknown"]>>;
|
|
1746
|
+
readonly granted_video: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["granted", "not_granted", "unknown"]>>;
|
|
1739
1747
|
readonly heartbeat_gap_ms: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").Number>>;
|
|
1740
1748
|
readonly http_status: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").Number>>;
|
|
1749
|
+
readonly media_error_kind: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["NotAllowedError", "NotReadableError", "NotFoundError", "OverconstrainedError", "AbortError", "SecurityError", "InvalidStateError", "OperationError", "NotSupportedError", "CloudflareSFUError", "network", "timeout", "unknown"]>>;
|
|
1750
|
+
readonly media_error_step: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["local_capture", "peer_connection", "access_refresh", "sfu_tracks", "sfu_close_tracks", "sfu_renegotiate", "sfu_publications"]>>;
|
|
1741
1751
|
readonly outcome: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["started", "succeeded", "failed", "cancelled"]>>;
|
|
1742
1752
|
readonly phase: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["idle", "connecting", "live", "recovering", "failed", "stopped", "new", "connected", "disconnected", "closed"]>>;
|
|
1753
|
+
readonly projection_state: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["on", "off"]>>;
|
|
1754
|
+
readonly publication_state: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["on", "off"]>>;
|
|
1755
|
+
readonly source: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["microphone", "camera"]>>;
|
|
1743
1756
|
readonly state: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["idle", "joining", "live", "reconnecting", "leaving", "left", "failed"]>>;
|
|
1744
1757
|
readonly step: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["join", "acquire_initial_media", "access_initialize", "create_media_client", "create_sync_client", "start_media", "start_sync", "wait_for_sync_live", "confirm_entered"]>>;
|
|
1745
1758
|
}>>;
|
|
1746
|
-
readonly trigger: import("effect/Schema").Literals<readonly ["join_failed", "connection_lost", "recovery_exhausted"]>;
|
|
1759
|
+
readonly trigger: import("effect/Schema").Literals<readonly ["join_failed", "connection_lost", "recovery_exhausted", "media_projection_mismatch"]>;
|
|
1747
1760
|
readonly version: import("effect/Schema").Literal<1>;
|
|
1748
1761
|
}>>, never, import("effect/Schema").toCodecJson<import("effect/Schema").Void>, import("effect/Schema").toCodecJson<import("effect/Schema").decodeTo<typeof S.AccessForbiddenError, import("effect/Schema").Struct<{
|
|
1749
1762
|
readonly error: import("effect/Schema").Struct<{
|
|
@@ -2930,6 +2943,63 @@ declare const ChalkApi_base: HttpApi.HttpApi<"ChalkApi", HttpApiGroup.HttpApiGro
|
|
|
2930
2943
|
readonly code: import("effect/Schema").Literal<"tenant.invalid_id">;
|
|
2931
2944
|
readonly message: import("effect/Schema").String;
|
|
2932
2945
|
}>;
|
|
2946
|
+
}>, never, never>>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getParticipantEpisodeStatus", "GET", "/v1/tenants/:tenant_id/spaces/:space_id/episodes/:episode_id/participants/:participant_id/episode-status", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
2947
|
+
readonly episode_id: import("effect/Schema").brand<import("effect/Schema").String, "EpisodeId">;
|
|
2948
|
+
readonly participant_id: import("effect/Schema").brand<import("effect/Schema").String, "ParticipantId">;
|
|
2949
|
+
readonly space_id: import("effect/Schema").brand<import("effect/Schema").String, "SpaceId">;
|
|
2950
|
+
readonly tenant_id: import("effect/Schema").brand<import("effect/Schema").String, "TenantId">;
|
|
2951
|
+
}>>, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
2952
|
+
readonly status: import("effect/Schema").Literals<readonly ["active", "ending", "ended"]>;
|
|
2953
|
+
}>>, import("effect/Schema").toCodecJson<import("effect/Schema").decodeTo<typeof S.AccessForbiddenError, import("effect/Schema").Struct<{
|
|
2954
|
+
readonly error: import("effect/Schema").Struct<{
|
|
2955
|
+
readonly code: import("effect/Schema").Literal<"access.forbidden">;
|
|
2956
|
+
readonly message: import("effect/Schema").String;
|
|
2957
|
+
}>;
|
|
2958
|
+
}>, never, never> | import("effect/Schema").decodeTo<typeof S.AccessUnauthenticatedError, import("effect/Schema").Struct<{
|
|
2959
|
+
readonly error: import("effect/Schema").Struct<{
|
|
2960
|
+
readonly code: import("effect/Schema").Literal<"access.unauthenticated">;
|
|
2961
|
+
readonly message: import("effect/Schema").String;
|
|
2962
|
+
}>;
|
|
2963
|
+
}>, never, never> | import("effect/Schema").decodeTo<typeof S.EpisodeInvalidIdError, import("effect/Schema").Struct<{
|
|
2964
|
+
readonly error: import("effect/Schema").Struct<{
|
|
2965
|
+
readonly code: import("effect/Schema").Literal<"episode.invalid_id">;
|
|
2966
|
+
readonly message: import("effect/Schema").String;
|
|
2967
|
+
}>;
|
|
2968
|
+
}>, never, never> | import("effect/Schema").decodeTo<typeof S.EpisodeNotFoundError, import("effect/Schema").Struct<{
|
|
2969
|
+
readonly error: import("effect/Schema").Struct<{
|
|
2970
|
+
readonly code: import("effect/Schema").Literal<"episode.not_found">;
|
|
2971
|
+
readonly message: import("effect/Schema").String;
|
|
2972
|
+
}>;
|
|
2973
|
+
}>, never, never> | import("effect/Schema").decodeTo<typeof S.ParticipantInvalidIdError, import("effect/Schema").Struct<{
|
|
2974
|
+
readonly error: import("effect/Schema").Struct<{
|
|
2975
|
+
readonly code: import("effect/Schema").Literal<"participant.invalid_id">;
|
|
2976
|
+
readonly message: import("effect/Schema").String;
|
|
2977
|
+
}>;
|
|
2978
|
+
}>, never, never> | import("effect/Schema").decodeTo<typeof S.RequestRateLimitedError, import("effect/Schema").Struct<{
|
|
2979
|
+
readonly error: import("effect/Schema").Struct<{
|
|
2980
|
+
readonly code: import("effect/Schema").Literal<"request.rate_limited">;
|
|
2981
|
+
readonly message: import("effect/Schema").String;
|
|
2982
|
+
}>;
|
|
2983
|
+
}>, never, never> | import("effect/Schema").decodeTo<typeof S.ServiceInternalError, import("effect/Schema").Struct<{
|
|
2984
|
+
readonly error: import("effect/Schema").Struct<{
|
|
2985
|
+
readonly code: import("effect/Schema").Literal<"service.internal_error">;
|
|
2986
|
+
readonly message: import("effect/Schema").String;
|
|
2987
|
+
}>;
|
|
2988
|
+
}>, never, never> | import("effect/Schema").decodeTo<typeof S.ServiceUnavailableError, import("effect/Schema").Struct<{
|
|
2989
|
+
readonly error: import("effect/Schema").Struct<{
|
|
2990
|
+
readonly code: import("effect/Schema").Literal<"service.unavailable">;
|
|
2991
|
+
readonly message: import("effect/Schema").String;
|
|
2992
|
+
}>;
|
|
2993
|
+
}>, never, never> | import("effect/Schema").decodeTo<typeof S.SpaceInvalidIdError, import("effect/Schema").Struct<{
|
|
2994
|
+
readonly error: import("effect/Schema").Struct<{
|
|
2995
|
+
readonly code: import("effect/Schema").Literal<"space.invalid_id">;
|
|
2996
|
+
readonly message: import("effect/Schema").String;
|
|
2997
|
+
}>;
|
|
2998
|
+
}>, never, never> | import("effect/Schema").decodeTo<typeof S.TenantInvalidIdError, import("effect/Schema").Struct<{
|
|
2999
|
+
readonly error: import("effect/Schema").Struct<{
|
|
3000
|
+
readonly code: import("effect/Schema").Literal<"tenant.invalid_id">;
|
|
3001
|
+
readonly message: import("effect/Schema").String;
|
|
3002
|
+
}>;
|
|
2933
3003
|
}>, never, never>>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"issueEpisodeParticipantSyncToken", "POST", "/v1/tenants/:tenant_id/spaces/:space_id/episodes/:episode_id/participants/:participant_id/sync-token", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
2934
3004
|
readonly episode_id: import("effect/Schema").brand<import("effect/Schema").String, "EpisodeId">;
|
|
2935
3005
|
readonly participant_id: import("effect/Schema").brand<import("effect/Schema").String, "ParticipantId">;
|
|
@@ -226,15 +226,22 @@ export declare const ConnectionReportRequestSchema: Schema.Struct<{
|
|
|
226
226
|
readonly code: Schema.optional<Schema.Literals<readonly ["invalid_state", "invalid_access", "access_unavailable", "permission_denied", "device_not_found", "device_busy", "device_constraint_invalid", "media_capture_failed", "sync_start_failed", "state_digest_recovery_failed", "sync_hello_timeout", "media_start_failed", "join_cleanup_unconfirmed", "sync_recovery_exhausted", "media_recovery_exhausted", "command_rejected", "leave_unconfirmed", "episode_ended", "unsupported_environment", "internal_error", "collaboration_unavailable", "chat_cursor_reset_required", "rate_limited", "invalid_payload"]>>;
|
|
227
227
|
readonly duration_ms: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
228
228
|
readonly elapsed_ms: Schema.Number;
|
|
229
|
-
readonly event: Schema.Literals<readonly ["space_join_span", "state_changed", "connection_failed", "sync_connect_failed", "sync_dial_timeout", "access_refreshed", "access_refresh_failed", "recovery_attempt", "recovery_succeeded", "recovery_exhausted", "cleanup_completed", "cleanup_unconfirmed", "sync_socket_open", "sync_socket_close", "sync_heartbeat_gap", "media_state", "media_http_error"]>;
|
|
229
|
+
readonly event: Schema.Literals<readonly ["space_join_span", "state_changed", "connection_failed", "sync_connect_failed", "sync_dial_timeout", "access_refreshed", "access_refresh_failed", "recovery_attempt", "recovery_succeeded", "recovery_exhausted", "cleanup_completed", "cleanup_unconfirmed", "sync_socket_open", "sync_socket_close", "sync_heartbeat_gap", "media_state", "media_http_error", "media_projection_mismatch"]>;
|
|
230
|
+
readonly granted_audio: Schema.optional<Schema.Literals<readonly ["granted", "not_granted", "unknown"]>>;
|
|
231
|
+
readonly granted_video: Schema.optional<Schema.Literals<readonly ["granted", "not_granted", "unknown"]>>;
|
|
230
232
|
readonly heartbeat_gap_ms: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
231
233
|
readonly http_status: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
234
|
+
readonly media_error_kind: Schema.optional<Schema.Literals<readonly ["NotAllowedError", "NotReadableError", "NotFoundError", "OverconstrainedError", "AbortError", "SecurityError", "InvalidStateError", "OperationError", "NotSupportedError", "CloudflareSFUError", "network", "timeout", "unknown"]>>;
|
|
235
|
+
readonly media_error_step: Schema.optional<Schema.Literals<readonly ["local_capture", "peer_connection", "access_refresh", "sfu_tracks", "sfu_close_tracks", "sfu_renegotiate", "sfu_publications"]>>;
|
|
232
236
|
readonly outcome: Schema.optional<Schema.Literals<readonly ["started", "succeeded", "failed", "cancelled"]>>;
|
|
233
237
|
readonly phase: Schema.optional<Schema.Literals<readonly ["idle", "connecting", "live", "recovering", "failed", "stopped", "new", "connected", "disconnected", "closed"]>>;
|
|
238
|
+
readonly projection_state: Schema.optional<Schema.Literals<readonly ["on", "off"]>>;
|
|
239
|
+
readonly publication_state: Schema.optional<Schema.Literals<readonly ["on", "off"]>>;
|
|
240
|
+
readonly source: Schema.optional<Schema.Literals<readonly ["microphone", "camera"]>>;
|
|
234
241
|
readonly state: Schema.optional<Schema.Literals<readonly ["idle", "joining", "live", "reconnecting", "leaving", "left", "failed"]>>;
|
|
235
242
|
readonly step: Schema.optional<Schema.Literals<readonly ["join", "acquire_initial_media", "access_initialize", "create_media_client", "create_sync_client", "start_media", "start_sync", "wait_for_sync_live", "confirm_entered"]>>;
|
|
236
243
|
}>>;
|
|
237
|
-
readonly trigger: Schema.Literals<readonly ["join_failed", "connection_lost", "recovery_exhausted"]>;
|
|
244
|
+
readonly trigger: Schema.Literals<readonly ["join_failed", "connection_lost", "recovery_exhausted", "media_projection_mismatch"]>;
|
|
238
245
|
readonly version: Schema.Literal<1>;
|
|
239
246
|
}>;
|
|
240
247
|
export type ConnectionReportRequest = typeof ConnectionReportRequestSchema.Type;
|
|
@@ -443,6 +450,7 @@ export declare const IntegrationServiceIdSchema: Schema.brand<Schema.String, "In
|
|
|
443
450
|
export type IntegrationServiceId = typeof IntegrationServiceIdSchema.Type;
|
|
444
451
|
export declare const IssueAccessGrantRequestSchema: Schema.Struct<{
|
|
445
452
|
readonly current_media_token: Schema.optional<Schema.String>;
|
|
453
|
+
readonly expected_media_connection_id: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
446
454
|
readonly participant_generation: Schema.Number;
|
|
447
455
|
readonly replace_media_connection: Schema.Boolean;
|
|
448
456
|
}>;
|
|
@@ -478,6 +486,10 @@ export declare const MembershipListSchema: Schema.Struct<{
|
|
|
478
486
|
}>;
|
|
479
487
|
}>;
|
|
480
488
|
export type MembershipList = typeof MembershipListSchema.Type;
|
|
489
|
+
export declare const ParticipantEpisodeStatusSchema: Schema.Struct<{
|
|
490
|
+
readonly status: Schema.Literals<readonly ["active", "ending", "ended"]>;
|
|
491
|
+
}>;
|
|
492
|
+
export type ParticipantEpisodeStatus = typeof ParticipantEpisodeStatusSchema.Type;
|
|
481
493
|
export declare const ParticipantJoinCancellationSchema: Schema.Struct<{
|
|
482
494
|
readonly cancelled: Schema.Boolean;
|
|
483
495
|
}>;
|
|
@@ -2235,6 +2247,23 @@ export declare const GetEpisodeAttendance429ResponseHeadersSchema: Schema.Struct
|
|
|
2235
2247
|
readonly "X-RateLimit-Remaining": Schema.NumberFromString;
|
|
2236
2248
|
}>;
|
|
2237
2249
|
export type GetEpisodeAttendance429ResponseHeaders = typeof GetEpisodeAttendance429ResponseHeadersSchema.Type;
|
|
2250
|
+
export declare const GetParticipantEpisodeStatusPathParamsSchema: Schema.Struct<{
|
|
2251
|
+
readonly episode_id: Schema.brand<Schema.String, "EpisodeId">;
|
|
2252
|
+
readonly participant_id: Schema.brand<Schema.String, "ParticipantId">;
|
|
2253
|
+
readonly space_id: Schema.brand<Schema.String, "SpaceId">;
|
|
2254
|
+
readonly tenant_id: Schema.brand<Schema.String, "TenantId">;
|
|
2255
|
+
}>;
|
|
2256
|
+
export type GetParticipantEpisodeStatusPathParams = typeof GetParticipantEpisodeStatusPathParamsSchema.Type;
|
|
2257
|
+
export declare const GetParticipantEpisodeStatusResponseSchema: Schema.Struct<{
|
|
2258
|
+
readonly status: Schema.Literals<readonly ["active", "ending", "ended"]>;
|
|
2259
|
+
}>;
|
|
2260
|
+
export type GetParticipantEpisodeStatusResponse = typeof GetParticipantEpisodeStatusResponseSchema.Type;
|
|
2261
|
+
export declare const GetParticipantEpisodeStatus429ResponseHeadersSchema: Schema.Struct<{
|
|
2262
|
+
readonly "Retry-After": Schema.NumberFromString;
|
|
2263
|
+
readonly "X-RateLimit-Limit": Schema.NumberFromString;
|
|
2264
|
+
readonly "X-RateLimit-Remaining": Schema.NumberFromString;
|
|
2265
|
+
}>;
|
|
2266
|
+
export type GetParticipantEpisodeStatus429ResponseHeaders = typeof GetParticipantEpisodeStatus429ResponseHeadersSchema.Type;
|
|
2238
2267
|
export declare const GetProblemReportAvailabilityPathParamsSchema: Schema.Struct<{
|
|
2239
2268
|
readonly tenant_id: Schema.brand<Schema.String, "TenantId">;
|
|
2240
2269
|
}>;
|
|
@@ -2599,6 +2628,7 @@ export declare const IssueAccessGrantPathParamsSchema: Schema.Struct<{
|
|
|
2599
2628
|
export type IssueAccessGrantPathParams = typeof IssueAccessGrantPathParamsSchema.Type;
|
|
2600
2629
|
export declare const IssueAccessGrantRequestBodySchema: Schema.Struct<{
|
|
2601
2630
|
readonly current_media_token: Schema.optional<Schema.String>;
|
|
2631
|
+
readonly expected_media_connection_id: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
2602
2632
|
readonly participant_generation: Schema.Number;
|
|
2603
2633
|
readonly replace_media_connection: Schema.Boolean;
|
|
2604
2634
|
}>;
|
|
@@ -3314,15 +3344,22 @@ export declare const ReportConnectionFailureRequestBodySchema: Schema.Struct<{
|
|
|
3314
3344
|
readonly code: Schema.optional<Schema.Literals<readonly ["invalid_state", "invalid_access", "access_unavailable", "permission_denied", "device_not_found", "device_busy", "device_constraint_invalid", "media_capture_failed", "sync_start_failed", "state_digest_recovery_failed", "sync_hello_timeout", "media_start_failed", "join_cleanup_unconfirmed", "sync_recovery_exhausted", "media_recovery_exhausted", "command_rejected", "leave_unconfirmed", "episode_ended", "unsupported_environment", "internal_error", "collaboration_unavailable", "chat_cursor_reset_required", "rate_limited", "invalid_payload"]>>;
|
|
3315
3345
|
readonly duration_ms: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
3316
3346
|
readonly elapsed_ms: Schema.Number;
|
|
3317
|
-
readonly event: Schema.Literals<readonly ["space_join_span", "state_changed", "connection_failed", "sync_connect_failed", "sync_dial_timeout", "access_refreshed", "access_refresh_failed", "recovery_attempt", "recovery_succeeded", "recovery_exhausted", "cleanup_completed", "cleanup_unconfirmed", "sync_socket_open", "sync_socket_close", "sync_heartbeat_gap", "media_state", "media_http_error"]>;
|
|
3347
|
+
readonly event: Schema.Literals<readonly ["space_join_span", "state_changed", "connection_failed", "sync_connect_failed", "sync_dial_timeout", "access_refreshed", "access_refresh_failed", "recovery_attempt", "recovery_succeeded", "recovery_exhausted", "cleanup_completed", "cleanup_unconfirmed", "sync_socket_open", "sync_socket_close", "sync_heartbeat_gap", "media_state", "media_http_error", "media_projection_mismatch"]>;
|
|
3348
|
+
readonly granted_audio: Schema.optional<Schema.Literals<readonly ["granted", "not_granted", "unknown"]>>;
|
|
3349
|
+
readonly granted_video: Schema.optional<Schema.Literals<readonly ["granted", "not_granted", "unknown"]>>;
|
|
3318
3350
|
readonly heartbeat_gap_ms: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
3319
3351
|
readonly http_status: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
3352
|
+
readonly media_error_kind: Schema.optional<Schema.Literals<readonly ["NotAllowedError", "NotReadableError", "NotFoundError", "OverconstrainedError", "AbortError", "SecurityError", "InvalidStateError", "OperationError", "NotSupportedError", "CloudflareSFUError", "network", "timeout", "unknown"]>>;
|
|
3353
|
+
readonly media_error_step: Schema.optional<Schema.Literals<readonly ["local_capture", "peer_connection", "access_refresh", "sfu_tracks", "sfu_close_tracks", "sfu_renegotiate", "sfu_publications"]>>;
|
|
3320
3354
|
readonly outcome: Schema.optional<Schema.Literals<readonly ["started", "succeeded", "failed", "cancelled"]>>;
|
|
3321
3355
|
readonly phase: Schema.optional<Schema.Literals<readonly ["idle", "connecting", "live", "recovering", "failed", "stopped", "new", "connected", "disconnected", "closed"]>>;
|
|
3356
|
+
readonly projection_state: Schema.optional<Schema.Literals<readonly ["on", "off"]>>;
|
|
3357
|
+
readonly publication_state: Schema.optional<Schema.Literals<readonly ["on", "off"]>>;
|
|
3358
|
+
readonly source: Schema.optional<Schema.Literals<readonly ["microphone", "camera"]>>;
|
|
3322
3359
|
readonly state: Schema.optional<Schema.Literals<readonly ["idle", "joining", "live", "reconnecting", "leaving", "left", "failed"]>>;
|
|
3323
3360
|
readonly step: Schema.optional<Schema.Literals<readonly ["join", "acquire_initial_media", "access_initialize", "create_media_client", "create_sync_client", "start_media", "start_sync", "wait_for_sync_live", "confirm_entered"]>>;
|
|
3324
3361
|
}>>;
|
|
3325
|
-
readonly trigger: Schema.Literals<readonly ["join_failed", "connection_lost", "recovery_exhausted"]>;
|
|
3362
|
+
readonly trigger: Schema.Literals<readonly ["join_failed", "connection_lost", "recovery_exhausted", "media_projection_mismatch"]>;
|
|
3326
3363
|
readonly version: Schema.Literal<1>;
|
|
3327
3364
|
}>;
|
|
3328
3365
|
export type ReportConnectionFailureRequestBody = typeof ReportConnectionFailureRequestBodySchema.Type;
|
|
@@ -4862,6 +4899,26 @@ export declare const ParticipantInvalidIdErrorSchema: Schema.decodeTo<typeof Par
|
|
|
4862
4899
|
readonly message: Schema.String;
|
|
4863
4900
|
}>;
|
|
4864
4901
|
}>, never, never>;
|
|
4902
|
+
declare const ParticipantMediaReplacementPendingError_base: Schema.Class<ParticipantMediaReplacementPendingError, Schema.TaggedStruct<"ParticipantMediaReplacementPendingError", {
|
|
4903
|
+
readonly error: Schema.Struct<{
|
|
4904
|
+
readonly code: Schema.Literal<"participant.media_replacement_pending">;
|
|
4905
|
+
readonly message: Schema.String;
|
|
4906
|
+
}>;
|
|
4907
|
+
}>, import("effect/Cause").YieldableError>;
|
|
4908
|
+
export declare class ParticipantMediaReplacementPendingError extends ParticipantMediaReplacementPendingError_base {
|
|
4909
|
+
}
|
|
4910
|
+
export declare const ParticipantMediaReplacementPendingErrorWireSchema: Schema.Struct<{
|
|
4911
|
+
readonly error: Schema.Struct<{
|
|
4912
|
+
readonly code: Schema.Literal<"participant.media_replacement_pending">;
|
|
4913
|
+
readonly message: Schema.String;
|
|
4914
|
+
}>;
|
|
4915
|
+
}>;
|
|
4916
|
+
export declare const ParticipantMediaReplacementPendingErrorSchema: Schema.decodeTo<typeof ParticipantMediaReplacementPendingError, Schema.Struct<{
|
|
4917
|
+
readonly error: Schema.Struct<{
|
|
4918
|
+
readonly code: Schema.Literal<"participant.media_replacement_pending">;
|
|
4919
|
+
readonly message: Schema.String;
|
|
4920
|
+
}>;
|
|
4921
|
+
}>, never, never>;
|
|
4865
4922
|
declare const ParticipantNotActiveError_base: Schema.Class<ParticipantNotActiveError, Schema.TaggedStruct<"ParticipantNotActiveError", {
|
|
4866
4923
|
readonly error: Schema.Struct<{
|
|
4867
4924
|
readonly code: Schema.Literal<"participant.not_active">;
|
|
@@ -7869,6 +7926,58 @@ export declare const GetEpisodeErrorSchema: Schema.Union<readonly [Schema.decode
|
|
|
7869
7926
|
}>;
|
|
7870
7927
|
}>, never, never>]>;
|
|
7871
7928
|
export type GetEpisodeError = typeof GetEpisodeErrorSchema.Type;
|
|
7929
|
+
export declare const GetParticipantEpisodeStatusErrorSchema: Schema.Union<readonly [Schema.decodeTo<typeof AccessForbiddenError, Schema.Struct<{
|
|
7930
|
+
readonly error: Schema.Struct<{
|
|
7931
|
+
readonly code: Schema.Literal<"access.forbidden">;
|
|
7932
|
+
readonly message: Schema.String;
|
|
7933
|
+
}>;
|
|
7934
|
+
}>, never, never>, Schema.decodeTo<typeof AccessUnauthenticatedError, Schema.Struct<{
|
|
7935
|
+
readonly error: Schema.Struct<{
|
|
7936
|
+
readonly code: Schema.Literal<"access.unauthenticated">;
|
|
7937
|
+
readonly message: Schema.String;
|
|
7938
|
+
}>;
|
|
7939
|
+
}>, never, never>, Schema.decodeTo<typeof EpisodeInvalidIdError, Schema.Struct<{
|
|
7940
|
+
readonly error: Schema.Struct<{
|
|
7941
|
+
readonly code: Schema.Literal<"episode.invalid_id">;
|
|
7942
|
+
readonly message: Schema.String;
|
|
7943
|
+
}>;
|
|
7944
|
+
}>, never, never>, Schema.decodeTo<typeof EpisodeNotFoundError, Schema.Struct<{
|
|
7945
|
+
readonly error: Schema.Struct<{
|
|
7946
|
+
readonly code: Schema.Literal<"episode.not_found">;
|
|
7947
|
+
readonly message: Schema.String;
|
|
7948
|
+
}>;
|
|
7949
|
+
}>, never, never>, Schema.decodeTo<typeof ParticipantInvalidIdError, Schema.Struct<{
|
|
7950
|
+
readonly error: Schema.Struct<{
|
|
7951
|
+
readonly code: Schema.Literal<"participant.invalid_id">;
|
|
7952
|
+
readonly message: Schema.String;
|
|
7953
|
+
}>;
|
|
7954
|
+
}>, never, never>, Schema.decodeTo<typeof RequestRateLimitedError, Schema.Struct<{
|
|
7955
|
+
readonly error: Schema.Struct<{
|
|
7956
|
+
readonly code: Schema.Literal<"request.rate_limited">;
|
|
7957
|
+
readonly message: Schema.String;
|
|
7958
|
+
}>;
|
|
7959
|
+
}>, never, never>, Schema.decodeTo<typeof ServiceInternalError, Schema.Struct<{
|
|
7960
|
+
readonly error: Schema.Struct<{
|
|
7961
|
+
readonly code: Schema.Literal<"service.internal_error">;
|
|
7962
|
+
readonly message: Schema.String;
|
|
7963
|
+
}>;
|
|
7964
|
+
}>, never, never>, Schema.decodeTo<typeof ServiceUnavailableError, Schema.Struct<{
|
|
7965
|
+
readonly error: Schema.Struct<{
|
|
7966
|
+
readonly code: Schema.Literal<"service.unavailable">;
|
|
7967
|
+
readonly message: Schema.String;
|
|
7968
|
+
}>;
|
|
7969
|
+
}>, never, never>, Schema.decodeTo<typeof SpaceInvalidIdError, Schema.Struct<{
|
|
7970
|
+
readonly error: Schema.Struct<{
|
|
7971
|
+
readonly code: Schema.Literal<"space.invalid_id">;
|
|
7972
|
+
readonly message: Schema.String;
|
|
7973
|
+
}>;
|
|
7974
|
+
}>, never, never>, Schema.decodeTo<typeof TenantInvalidIdError, Schema.Struct<{
|
|
7975
|
+
readonly error: Schema.Struct<{
|
|
7976
|
+
readonly code: Schema.Literal<"tenant.invalid_id">;
|
|
7977
|
+
readonly message: Schema.String;
|
|
7978
|
+
}>;
|
|
7979
|
+
}>, never, never>]>;
|
|
7980
|
+
export type GetParticipantEpisodeStatusError = typeof GetParticipantEpisodeStatusErrorSchema.Type;
|
|
7872
7981
|
export declare const GetProblemReportAvailabilityErrorSchema: Schema.decodeTo<typeof TenantInvalidIdError, Schema.Struct<{
|
|
7873
7982
|
readonly error: Schema.Struct<{
|
|
7874
7983
|
readonly code: Schema.Literal<"tenant.invalid_id">;
|
|
@@ -8585,6 +8694,11 @@ export declare const IssueAccessGrantErrorSchema: Schema.Union<readonly [Schema.
|
|
|
8585
8694
|
readonly code: Schema.Literal<"participant.invalid_id">;
|
|
8586
8695
|
readonly message: Schema.String;
|
|
8587
8696
|
}>;
|
|
8697
|
+
}>, never, never>, Schema.decodeTo<typeof ParticipantMediaReplacementPendingError, Schema.Struct<{
|
|
8698
|
+
readonly error: Schema.Struct<{
|
|
8699
|
+
readonly code: Schema.Literal<"participant.media_replacement_pending">;
|
|
8700
|
+
readonly message: Schema.String;
|
|
8701
|
+
}>;
|
|
8588
8702
|
}>, never, never>, Schema.decodeTo<typeof ParticipantNotFoundError, Schema.Struct<{
|
|
8589
8703
|
readonly error: Schema.Struct<{
|
|
8590
8704
|
readonly code: Schema.Literal<"participant.not_found">;
|
|
@@ -11268,6 +11382,13 @@ export declare const ChalkOperationPolicies: {
|
|
|
11268
11382
|
readonly windowSeconds: 60;
|
|
11269
11383
|
};
|
|
11270
11384
|
};
|
|
11385
|
+
readonly getParticipantEpisodeStatus: {
|
|
11386
|
+
readonly rateLimit: {
|
|
11387
|
+
readonly limit: 300;
|
|
11388
|
+
readonly policy: "v1.authenticated.read";
|
|
11389
|
+
readonly windowSeconds: 60;
|
|
11390
|
+
};
|
|
11391
|
+
};
|
|
11271
11392
|
readonly getSpacePublicInvite: {
|
|
11272
11393
|
readonly rateLimit: {
|
|
11273
11394
|
readonly limit: 300;
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
createSpaceClient,
|
|
16
16
|
decodeWhiteboardV1ServerFrame,
|
|
17
17
|
encodeWhiteboardV1ClientFrame
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-BUNSEDXL.js";
|
|
19
19
|
import {
|
|
20
20
|
CloudflareSFUClient,
|
|
21
21
|
CloudflareSFUError,
|
|
@@ -28,19 +28,19 @@ import {
|
|
|
28
28
|
requireSFUDescription,
|
|
29
29
|
validatePublicationSnapshot,
|
|
30
30
|
waitFor
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-FD25AMLG.js";
|
|
32
32
|
import {
|
|
33
33
|
createChalkPublicClient,
|
|
34
34
|
createChalkPublicInviteClient,
|
|
35
35
|
parseInviteCode
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-LKNT6XFD.js";
|
|
37
37
|
import {
|
|
38
38
|
ArrivalInvalidHandleError,
|
|
39
39
|
ArrivalUnavailableError,
|
|
40
40
|
SpacePublicInviteUnavailableError,
|
|
41
41
|
parseParsedAccessGrant,
|
|
42
42
|
requireAccessGrant
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-UMAE5GCV.js";
|
|
44
44
|
import {
|
|
45
45
|
AsyncStorageV1PendingTargetStore,
|
|
46
46
|
InMemoryV1PendingTargetStore,
|
package/dist/media/client.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare class CloudflareSFUClient implements ClientMediaPlane {
|
|
|
15
15
|
start(localMedia: MediaStream): Promise<void>;
|
|
16
16
|
refreshRemotePublications(): Promise<void>;
|
|
17
17
|
setLocalPublicationTarget(target: MediaPlaneTarget): Promise<MediaPlaneResult>;
|
|
18
|
-
setLocalSourceIntent(source: MediaPublicationSource, enabled: boolean): void
|
|
18
|
+
setLocalSourceIntent(source: MediaPublicationSource, enabled: boolean): Promise<void>;
|
|
19
19
|
closeForcedLocalPublication(source: MediaPublicationSource): Promise<void>;
|
|
20
20
|
observeLocalPublications(listener: (publications: readonly MediaPublication[]) => void): () => void;
|
|
21
21
|
observeRemotePublications(listener: (publications: readonly MediaPublication[]) => void): () => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ConnectionReport } from "../transport-diagnostics";
|
|
2
|
+
type ReportEvent = ConnectionReport["events"][number];
|
|
3
|
+
export type MediaFailureDiagnostic = Required<Pick<ReportEvent, "media_error_kind" | "media_error_step">> & Pick<ReportEvent, "http_status">;
|
|
4
|
+
export type GrantedMedia = Required<Pick<ReportEvent, "granted_audio" | "granted_video">>;
|
|
5
|
+
type MediaFailureStep = NonNullable<ReportEvent["media_error_step"]>;
|
|
6
|
+
export declare function grantedMediaFromStream(stream: MediaStream): GrantedMedia;
|
|
7
|
+
export declare function markMediaFetchFailure(error: unknown): void;
|
|
8
|
+
export declare function markMediaFailure(error: unknown, step: MediaFailureStep): void;
|
|
9
|
+
export declare function classifyMediaFailure(cause: unknown, fallbackStep: MediaFailureStep): MediaFailureDiagnostic;
|
|
10
|
+
export {};
|
package/dist/media/index.js
CHANGED
package/dist/media/plane.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export type ConnectionMediaSnapshot = {
|
|
|
38
38
|
readonly failure: {
|
|
39
39
|
readonly code: string;
|
|
40
40
|
readonly recoverable: boolean;
|
|
41
|
+
readonly diagnostic?: import("./failure-diagnostics").MediaFailureDiagnostic;
|
|
41
42
|
} | null;
|
|
42
43
|
};
|
|
43
44
|
export type MediaPlaneOutcome = "confirmed" | "satisfied" | "retryable_failure" | "terminal_failure" | "ambiguous";
|
package/dist/media/types.d.ts
CHANGED
|
@@ -90,6 +90,7 @@ export type CloudflareSFUSnapshot = {
|
|
|
90
90
|
readonly failure: {
|
|
91
91
|
readonly code: CloudflareSFUFailureCode;
|
|
92
92
|
readonly recoverable: boolean;
|
|
93
|
+
readonly diagnostic?: import("./failure-diagnostics").MediaFailureDiagnostic;
|
|
93
94
|
} | null;
|
|
94
95
|
};
|
|
95
96
|
export type CloudflareSFUClientOptions = {
|
|
@@ -98,7 +99,7 @@ export type CloudflareSFUClientOptions = {
|
|
|
98
99
|
readonly transport: CloudflareSFUSignalingTransport;
|
|
99
100
|
readonly replaceMediaConnection?: () => Promise<CloudflareSFUBootstrap>;
|
|
100
101
|
readonly pollIntervalMs?: number;
|
|
101
|
-
readonly onError?: (error: unknown) => void;
|
|
102
|
+
readonly onError?: (error: unknown, mediaConnectionId: string) => void;
|
|
102
103
|
readonly onRemoteTrack?: (publication: CloudflareSFURemoteTrack) => void;
|
|
103
104
|
readonly onScreenEnded?: () => void;
|
|
104
105
|
readonly peerConnectionFactory?: (configuration: RTCConfiguration) => RTCPeerConnection;
|
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
createChalkPublicClient,
|
|
3
3
|
createChalkPublicInviteClient,
|
|
4
4
|
parseInviteCode
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-LKNT6XFD.js";
|
|
6
6
|
import {
|
|
7
7
|
ArrivalInvalidHandleError,
|
|
8
8
|
ArrivalUnavailableError,
|
|
9
9
|
SpacePublicInviteUnavailableError
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-UMAE5GCV.js";
|
|
11
11
|
export {
|
|
12
12
|
ArrivalInvalidHandleError,
|
|
13
13
|
ArrivalUnavailableError,
|
|
@@ -2,7 +2,7 @@ import type { AccessContext } from "../space-client/types.cjs";
|
|
|
2
2
|
import type { IssueAccessGrantInput } from "./types.cjs";
|
|
3
3
|
import { type AccessGrant, type ParticipantMediaCredential } from "../access/grant.cjs";
|
|
4
4
|
/** Forward the browser request unchanged; only Chalk decides whether media needs replacing. */
|
|
5
|
-
export type AccessRefreshRequest = Pick<AccessContext, "replaceMediaConnection">;
|
|
5
|
+
export type AccessRefreshRequest = Pick<AccessContext, "replaceMediaConnection" | "expectedMediaConnectionId" | "currentMediaToken">;
|
|
6
6
|
/** Keep this on your backend, scoped to the authenticated Participant. Never send it to a browser or log it. */
|
|
7
7
|
export type AccessRefreshState = {
|
|
8
8
|
readonly participantGeneration: number;
|
|
@@ -2,7 +2,7 @@ import type { AccessContext } from "../space-client/types.js";
|
|
|
2
2
|
import type { IssueAccessGrantInput } from "./types.js";
|
|
3
3
|
import { type AccessGrant, type ParticipantMediaCredential } from "../access/grant.js";
|
|
4
4
|
/** Forward the browser request unchanged; only Chalk decides whether media needs replacing. */
|
|
5
|
-
export type AccessRefreshRequest = Pick<AccessContext, "replaceMediaConnection">;
|
|
5
|
+
export type AccessRefreshRequest = Pick<AccessContext, "replaceMediaConnection" | "expectedMediaConnectionId" | "currentMediaToken">;
|
|
6
6
|
/** Keep this on your backend, scoped to the authenticated Participant. Never send it to a browser or log it. */
|
|
7
7
|
export type AccessRefreshState = {
|
|
8
8
|
readonly participantGeneration: number;
|
package/dist/server/index.cjs
CHANGED
|
@@ -38,11 +38,13 @@ function decodeBase64Url(value) {
|
|
|
38
38
|
// src/access/grant.ts
|
|
39
39
|
var accessGrantBrand = /* @__PURE__ */ Symbol("AccessGrant");
|
|
40
40
|
var AccessGrantError = class extends TypeError {
|
|
41
|
-
|
|
42
|
-
constructor(message = "Access grant is invalid") {
|
|
41
|
+
constructor(message = "Access grant is invalid", reason) {
|
|
43
42
|
super(message);
|
|
43
|
+
this.reason = reason;
|
|
44
44
|
this.name = "AccessGrantError";
|
|
45
45
|
}
|
|
46
|
+
reason;
|
|
47
|
+
code = "access.invalid";
|
|
46
48
|
};
|
|
47
49
|
function parseParsedAccessGrant(value) {
|
|
48
50
|
if (!isRecord(value)) throw new AccessGrantError();
|
|
@@ -165,7 +167,12 @@ function getAccessRefreshState(access) {
|
|
|
165
167
|
});
|
|
166
168
|
}
|
|
167
169
|
function accessRefreshInput(state, request) {
|
|
168
|
-
if (request?.replaceMediaConnection === true)
|
|
170
|
+
if (request?.replaceMediaConnection === true)
|
|
171
|
+
return {
|
|
172
|
+
participantGeneration: state.participantGeneration,
|
|
173
|
+
replaceMediaConnection: true,
|
|
174
|
+
...request.expectedMediaConnectionId === void 0 ? {} : { expectedMediaConnectionId: request.expectedMediaConnectionId, ...request.currentMediaToken === void 0 ? {} : { currentMediaToken: request.currentMediaToken } }
|
|
175
|
+
};
|
|
169
176
|
return state;
|
|
170
177
|
}
|
|
171
178
|
|
|
@@ -326,7 +333,9 @@ function setOptionalHeader(headers, name, value) {
|
|
|
326
333
|
if (value !== void 0) headers.set(name, value);
|
|
327
334
|
}
|
|
328
335
|
async function responseError(response, retryable) {
|
|
329
|
-
|
|
336
|
+
const code = errorCode(await errorBody(response));
|
|
337
|
+
const pendingReplacement = response.status === 409 && code === "participant.media_replacement_pending";
|
|
338
|
+
return new ChalkAPIError({ code, requestId: requestId(response.headers), retryable: pendingReplacement || retryable && retryableStatuses.has(response.status), status: response.status });
|
|
330
339
|
}
|
|
331
340
|
async function errorBody(response) {
|
|
332
341
|
try {
|
|
@@ -601,7 +610,8 @@ function accessGrantRequest(input) {
|
|
|
601
610
|
return {
|
|
602
611
|
participant_generation: input.participantGeneration,
|
|
603
612
|
replace_media_connection: input.replaceMediaConnection ?? false,
|
|
604
|
-
...input.currentMediaToken ? { current_media_token: input.currentMediaToken } : {}
|
|
613
|
+
...input.currentMediaToken ? { current_media_token: input.currentMediaToken } : {},
|
|
614
|
+
...input.replaceMediaConnection && input.expectedMediaConnectionId !== void 0 ? { expected_media_connection_id: input.expectedMediaConnectionId } : {}
|
|
605
615
|
};
|
|
606
616
|
}
|
|
607
617
|
function participantRemovalRequest(input) {
|
package/dist/server/index.js
CHANGED
|
@@ -16,11 +16,13 @@ function decodeBase64Url(value) {
|
|
|
16
16
|
// src/access/grant.ts
|
|
17
17
|
var accessGrantBrand = /* @__PURE__ */ Symbol("AccessGrant");
|
|
18
18
|
var AccessGrantError = class extends TypeError {
|
|
19
|
-
|
|
20
|
-
constructor(message = "Access grant is invalid") {
|
|
19
|
+
constructor(message = "Access grant is invalid", reason) {
|
|
21
20
|
super(message);
|
|
21
|
+
this.reason = reason;
|
|
22
22
|
this.name = "AccessGrantError";
|
|
23
23
|
}
|
|
24
|
+
reason;
|
|
25
|
+
code = "access.invalid";
|
|
24
26
|
};
|
|
25
27
|
function parseParsedAccessGrant(value) {
|
|
26
28
|
if (!isRecord(value)) throw new AccessGrantError();
|
|
@@ -143,7 +145,12 @@ function getAccessRefreshState(access) {
|
|
|
143
145
|
});
|
|
144
146
|
}
|
|
145
147
|
function accessRefreshInput(state, request) {
|
|
146
|
-
if (request?.replaceMediaConnection === true)
|
|
148
|
+
if (request?.replaceMediaConnection === true)
|
|
149
|
+
return {
|
|
150
|
+
participantGeneration: state.participantGeneration,
|
|
151
|
+
replaceMediaConnection: true,
|
|
152
|
+
...request.expectedMediaConnectionId === void 0 ? {} : { expectedMediaConnectionId: request.expectedMediaConnectionId, ...request.currentMediaToken === void 0 ? {} : { currentMediaToken: request.currentMediaToken } }
|
|
153
|
+
};
|
|
147
154
|
return state;
|
|
148
155
|
}
|
|
149
156
|
|
|
@@ -228,7 +235,9 @@ function setOptionalHeader(headers, name, value) {
|
|
|
228
235
|
if (value !== void 0) headers.set(name, value);
|
|
229
236
|
}
|
|
230
237
|
async function responseError(response, retryable) {
|
|
231
|
-
|
|
238
|
+
const code = errorCode(await errorBody(response));
|
|
239
|
+
const pendingReplacement = response.status === 409 && code === "participant.media_replacement_pending";
|
|
240
|
+
return new ChalkAPIError({ code, requestId: requestId(response.headers), retryable: pendingReplacement || retryable && retryableStatuses.has(response.status), status: response.status });
|
|
232
241
|
}
|
|
233
242
|
async function errorBody(response) {
|
|
234
243
|
try {
|
|
@@ -503,7 +512,8 @@ function accessGrantRequest(input) {
|
|
|
503
512
|
return {
|
|
504
513
|
participant_generation: input.participantGeneration,
|
|
505
514
|
replace_media_connection: input.replaceMediaConnection ?? false,
|
|
506
|
-
...input.currentMediaToken ? { current_media_token: input.currentMediaToken } : {}
|
|
515
|
+
...input.currentMediaToken ? { current_media_token: input.currentMediaToken } : {},
|
|
516
|
+
...input.replaceMediaConnection && input.expectedMediaConnectionId !== void 0 ? { expected_media_connection_id: input.expectedMediaConnectionId } : {}
|
|
507
517
|
};
|
|
508
518
|
}
|
|
509
519
|
function participantRemovalRequest(input) {
|
package/dist/server/types.d.cts
CHANGED
|
@@ -158,8 +158,9 @@ export type IssueAccessGrantInput = {
|
|
|
158
158
|
readonly replaceMediaConnection?: false;
|
|
159
159
|
} | {
|
|
160
160
|
readonly participantGeneration: number;
|
|
161
|
-
readonly currentMediaToken?:
|
|
161
|
+
readonly currentMediaToken?: string;
|
|
162
162
|
readonly replaceMediaConnection: true;
|
|
163
|
+
readonly expectedMediaConnectionId?: string;
|
|
163
164
|
};
|
|
164
165
|
export type APIKey = {
|
|
165
166
|
readonly created_at: string;
|
package/dist/server/types.d.ts
CHANGED
|
@@ -158,8 +158,9 @@ export type IssueAccessGrantInput = {
|
|
|
158
158
|
readonly replaceMediaConnection?: false;
|
|
159
159
|
} | {
|
|
160
160
|
readonly participantGeneration: number;
|
|
161
|
-
readonly currentMediaToken?:
|
|
161
|
+
readonly currentMediaToken?: string;
|
|
162
162
|
readonly replaceMediaConnection: true;
|
|
163
|
+
readonly expectedMediaConnectionId?: string;
|
|
163
164
|
};
|
|
164
165
|
export type APIKey = {
|
|
165
166
|
readonly created_at: string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ConnectionReportTransportEvent } from "../transport-diagnostics";
|
|
2
|
+
type Source = "microphone" | "camera";
|
|
3
|
+
type Observation = {
|
|
4
|
+
readonly revision: number;
|
|
5
|
+
readonly publicationId: string | null;
|
|
6
|
+
readonly enabled: boolean;
|
|
7
|
+
readonly projectedEnabled: boolean;
|
|
8
|
+
readonly projectedPublicationId: string | null;
|
|
9
|
+
};
|
|
10
|
+
type Options = {
|
|
11
|
+
readonly now: () => number;
|
|
12
|
+
readonly schedule: (callback: () => void, milliseconds: number) => unknown;
|
|
13
|
+
readonly cancel: (timer: unknown) => void;
|
|
14
|
+
readonly report: (event: ConnectionReportTransportEvent) => void;
|
|
15
|
+
readonly pause: (source: Source, revision: number) => void;
|
|
16
|
+
readonly changed: () => void;
|
|
17
|
+
};
|
|
18
|
+
/** Observes authority without sending targets that could affect another client. */
|
|
19
|
+
export declare class MediaProjectionMonitor {
|
|
20
|
+
#private;
|
|
21
|
+
constructor(options: Options);
|
|
22
|
+
observe(source: Source, observation: Observation): void;
|
|
23
|
+
state(source: Source): "requesting" | "failed" | null;
|
|
24
|
+
reset(): void;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -17,6 +17,10 @@ export type AccessContext = {
|
|
|
17
17
|
readonly reason: AccessReason;
|
|
18
18
|
/** Forward to the access endpoint so media recovery can obtain a fresh connection. */
|
|
19
19
|
readonly replaceMediaConnection: boolean;
|
|
20
|
+
/** Automatic replacement succeeds only while this media binding is current. Omit for explicit takeover. */
|
|
21
|
+
readonly expectedMediaConnectionId?: string;
|
|
22
|
+
/** Forward unchanged for replay-safe recovery. Never log credentials. */
|
|
23
|
+
readonly currentMediaToken?: string;
|
|
20
24
|
readonly signal?: AbortSignal;
|
|
21
25
|
};
|
|
22
26
|
/**
|