livekit-server-sdk 2.13.3 → 2.14.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/dist/AccessToken.cjs +7 -0
- package/dist/AccessToken.cjs.map +1 -1
- package/dist/AccessToken.d.cts +6 -1
- package/dist/AccessToken.d.ts +6 -1
- package/dist/AccessToken.d.ts.map +1 -1
- package/dist/AccessToken.js +7 -0
- package/dist/AccessToken.js.map +1 -1
- package/dist/AgentDispatchClient.cjs +4 -2
- package/dist/AgentDispatchClient.cjs.map +1 -1
- package/dist/AgentDispatchClient.d.cts +3 -1
- package/dist/AgentDispatchClient.d.ts +3 -1
- package/dist/AgentDispatchClient.d.ts.map +1 -1
- package/dist/AgentDispatchClient.js +4 -2
- package/dist/AgentDispatchClient.js.map +1 -1
- package/dist/ClientOptions.cjs +17 -0
- package/dist/ClientOptions.cjs.map +1 -0
- package/dist/ClientOptions.d.cts +11 -0
- package/dist/ClientOptions.d.ts +10 -0
- package/dist/ClientOptions.d.ts.map +1 -0
- package/dist/ClientOptions.js +1 -0
- package/dist/ClientOptions.js.map +1 -0
- package/dist/EgressClient.cjs +4 -2
- package/dist/EgressClient.cjs.map +1 -1
- package/dist/EgressClient.d.cts +3 -1
- package/dist/EgressClient.d.ts +3 -1
- package/dist/EgressClient.d.ts.map +1 -1
- package/dist/EgressClient.js +4 -2
- package/dist/EgressClient.js.map +1 -1
- package/dist/IngressClient.cjs +4 -2
- package/dist/IngressClient.cjs.map +1 -1
- package/dist/IngressClient.d.cts +3 -1
- package/dist/IngressClient.d.ts +3 -1
- package/dist/IngressClient.d.ts.map +1 -1
- package/dist/IngressClient.js +4 -2
- package/dist/IngressClient.js.map +1 -1
- package/dist/RoomServiceClient.cjs +4 -2
- package/dist/RoomServiceClient.cjs.map +1 -1
- package/dist/RoomServiceClient.d.cts +8 -2
- package/dist/RoomServiceClient.d.ts +8 -2
- package/dist/RoomServiceClient.d.ts.map +1 -1
- package/dist/RoomServiceClient.js +4 -2
- package/dist/RoomServiceClient.js.map +1 -1
- package/dist/SipClient.cjs +8 -3
- package/dist/SipClient.cjs.map +1 -1
- package/dist/SipClient.d.cts +8 -3
- package/dist/SipClient.d.ts +8 -3
- package/dist/SipClient.d.ts.map +1 -1
- package/dist/SipClient.js +9 -3
- package/dist/SipClient.js.map +1 -1
- package/dist/TwirpRPC.cjs +5 -3
- package/dist/TwirpRPC.cjs.map +1 -1
- package/dist/TwirpRPC.d.cts +8 -1
- package/dist/TwirpRPC.d.ts +9 -1
- package/dist/TwirpRPC.d.ts.map +1 -1
- package/dist/TwirpRPC.js +5 -3
- package/dist/TwirpRPC.js.map +1 -1
- package/dist/grants.cjs.map +1 -1
- package/dist/grants.d.cts +6 -1
- package/dist/grants.d.ts +5 -0
- package/dist/grants.d.ts.map +1 -1
- package/dist/grants.js.map +1 -1
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/AccessToken.ts +15 -1
- package/src/AgentDispatchClient.ts +7 -2
- package/src/ClientOptions.ts +13 -0
- package/src/EgressClient.ts +7 -2
- package/src/IngressClient.ts +7 -2
- package/src/RoomServiceClient.ts +13 -3
- package/src/SipClient.ts +14 -2
- package/src/TwirpRPC.ts +14 -3
- package/src/grants.test.ts +13 -1
- package/src/grants.ts +6 -0
- package/src/index.ts +1 -0
package/dist/SipClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/SipClient.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { Duration } from '@bufbuild/protobuf';\nimport type {\n ListUpdate,\n Pagination,\n RoomConfiguration,\n SIPHeaderOptions,\n} from '@livekit/protocol';\nimport {\n CreateSIPDispatchRuleRequest,\n CreateSIPInboundTrunkRequest,\n CreateSIPOutboundTrunkRequest,\n CreateSIPParticipantRequest,\n CreateSIPTrunkRequest,\n DeleteSIPDispatchRuleRequest,\n DeleteSIPTrunkRequest,\n ListSIPDispatchRuleRequest,\n ListSIPDispatchRuleResponse,\n ListSIPInboundTrunkRequest,\n ListSIPInboundTrunkResponse,\n ListSIPOutboundTrunkRequest,\n ListSIPOutboundTrunkResponse,\n ListSIPTrunkRequest,\n ListSIPTrunkResponse,\n SIPDispatchRule,\n SIPDispatchRuleDirect,\n SIPDispatchRuleIndividual,\n SIPDispatchRuleInfo,\n SIPInboundTrunkInfo,\n SIPOutboundTrunkInfo,\n SIPParticipantInfo,\n SIPTransport,\n SIPTrunkInfo,\n TransferSIPParticipantRequest,\n UpdateSIPDispatchRuleRequest,\n UpdateSIPInboundTrunkRequest,\n UpdateSIPOutboundTrunkRequest,\n} from '@livekit/protocol';\nimport { ServiceBase } from './ServiceBase.js';\nimport type { Rpc } from './TwirpRPC.js';\nimport { TwirpRpc, livekitPackage } from './TwirpRPC.js';\n\nconst svc = 'SIP';\n\n/**\n * @deprecated use CreateSipInboundTrunkOptions or CreateSipOutboundTrunkOptions\n */\nexport interface CreateSipTrunkOptions {\n name?: string;\n metadata?: string;\n inbound_addresses?: string[];\n inbound_numbers?: string[];\n inbound_username?: string;\n inbound_password?: string;\n outbound_address?: string;\n outbound_username?: string;\n outbound_password?: string;\n}\nexport interface CreateSipInboundTrunkOptions {\n metadata?: string;\n /** @deprecated - use `allowedAddresses` instead */\n allowed_addresses?: string[];\n allowedAddresses?: string[];\n /** @deprecated - use `allowedNumbers` instead */\n allowed_numbers?: string[];\n allowedNumbers?: string[];\n /** @deprecated - use `authUsername` instead */\n auth_username?: string;\n authUsername?: string;\n /** @deprecated - use `authPassword` instead */\n auth_password?: string;\n authPassword?: string;\n headers?: { [key: string]: string };\n headersToAttributes?: { [key: string]: string };\n // Map SIP response headers from INVITE to sip.h.* participant attributes automatically.\n includeHeaders?: SIPHeaderOptions;\n krispEnabled?: boolean;\n}\nexport interface CreateSipOutboundTrunkOptions {\n metadata?: string;\n transport: SIPTransport;\n destinationCountry?: string;\n /** @deprecated - use `authUsername` instead */\n auth_username?: string;\n authUsername?: string;\n /** @deprecated - use `authPassword` instead */\n auth_password?: string;\n authPassword?: string;\n headers?: { [key: string]: string };\n headersToAttributes?: { [key: string]: string };\n // Map SIP response headers from INVITE to sip.h.* participant attributes automatically.\n includeHeaders?: SIPHeaderOptions;\n}\n\nexport interface SipDispatchRuleDirect {\n type: 'direct';\n roomName: string;\n pin?: string;\n}\n\nexport interface SipDispatchRuleIndividual {\n type: 'individual';\n roomPrefix: string;\n pin?: string;\n}\n\nexport interface CreateSipDispatchRuleOptions {\n name?: string;\n metadata?: string;\n trunkIds?: string[];\n hidePhoneNumber?: boolean;\n attributes?: { [key: string]: string };\n roomPreset?: string;\n roomConfig?: RoomConfiguration;\n}\n\nexport interface CreateSipParticipantOptions {\n /** Optional SIP From number to use. If empty, trunk number is used. */\n fromNumber?: string;\n /** Optional identity of the SIP participant */\n participantIdentity?: string;\n /** Optional name of the participant */\n participantName?: string;\n /** Optional metadata to attach to the participant */\n participantMetadata?: string;\n /** Optional attributes to attach to the participant */\n participantAttributes?: { [key: string]: string };\n /** Optionally send following DTMF digits (extension codes) when making a call.\n * Character 'w' can be used to add a 0.5 sec delay. */\n dtmf?: string;\n /** @deprecated use `playDialtone` instead */\n playRingtone?: boolean;\n /** If `true`, the SIP Participant plays a dial tone to the room until the phone is picked up. */\n playDialtone?: boolean;\n /** These headers are sent as-is and may help identify this call as coming from LiveKit for the other SIP endpoint. */\n headers?: { [key: string]: string };\n /** Map SIP response headers from INVITE to sip.h.* participant attributes automatically. */\n includeHeaders?: SIPHeaderOptions;\n hidePhoneNumber?: boolean;\n /** Maximum time for the call to ring in seconds. */\n ringingTimeout?: number;\n /** Maximum call duration in seconds. */\n maxCallDuration?: number;\n /** If `true`, Krisp noise cancellation will be enabled for the caller. */\n krispEnabled?: boolean;\n /** If `true`, this will wait until the call is answered before returning. */\n waitUntilAnswered?: boolean;\n /** Optional request timeout in seconds. default 60 seconds if waitUntilAnswered is true, otherwise 10 seconds */\n timeout?: number;\n}\n\nexport interface ListSipDispatchRuleOptions {\n /** Pagination options. */\n page?: Pagination;\n /** Rule IDs to list. If this option is set, the response will contains rules in the same order. If any of the rules is missing, a nil item in that position will be sent in the response. */\n dispatchRuleIds?: string[];\n /** Only list rules that contain one of the Trunk IDs, including wildcard rules. */\n trunkIds?: string[];\n}\n\nexport interface ListSipTrunkOptions {\n /** Pagination options. */\n page?: Pagination;\n /** Trunk IDs to list. If this option is set, the response will contains trunks in the same order. If any of the trunks is missing, a nil item in that position will be sent in the response. */\n trunkIds?: string[];\n /** Only list trunks that contain one of the numbers, including wildcard trunks. */\n numbers?: string[];\n}\n\nexport interface SipDispatchRuleUpdateOptions {\n trunkIds?: ListUpdate;\n rule?: SIPDispatchRule;\n name?: string;\n metadata?: string;\n attributes?: { [key: string]: string };\n}\n\nexport interface SipInboundTrunkUpdateOptions {\n numbers?: ListUpdate;\n allowedAddresses?: ListUpdate;\n allowedNumbers?: ListUpdate;\n authUsername?: string;\n authPassword?: string;\n name?: string;\n metadata?: string;\n}\n\nexport interface SipOutboundTrunkUpdateOptions {\n numbers?: ListUpdate;\n allowedAddresses?: ListUpdate;\n allowedNumbers?: ListUpdate;\n authUsername?: string;\n authPassword?: string;\n destinationCountry?: string;\n name?: string;\n metadata?: string;\n}\n\nexport interface TransferSipParticipantOptions {\n playDialtone?: boolean;\n headers?: { [key: string]: string };\n}\n\n/**\n * Client to access Egress APIs\n */\nexport class SipClient extends ServiceBase {\n private readonly rpc: Rpc;\n\n /**\n * @param host - hostname including protocol. i.e. 'https://<project>.livekit.cloud'\n * @param apiKey - API Key, can be set in env var LIVEKIT_API_KEY\n * @param secret - API Secret, can be set in env var LIVEKIT_API_SECRET\n */\n constructor(host: string, apiKey?: string, secret?: string) {\n super(apiKey, secret);\n this.rpc = new TwirpRpc(host, livekitPackage);\n }\n\n /**\n * @param number - phone number of the trunk\n * @param opts - CreateSipTrunkOptions\n * @deprecated use `createSipInboundTrunk` or `createSipOutboundTrunk`\n */\n async createSipTrunk(number: string, opts?: CreateSipTrunkOptions): Promise<SIPTrunkInfo> {\n let inboundAddresses: string[] | undefined;\n let inboundNumbers: string[] | undefined;\n let inboundUsername: string = '';\n let inboundPassword: string = '';\n let outboundAddress: string = '';\n let outboundUsername: string = '';\n let outboundPassword: string = '';\n let name: string = '';\n let metadata: string = '';\n\n if (opts !== undefined) {\n inboundAddresses = opts.inbound_addresses;\n inboundNumbers = opts.inbound_numbers;\n inboundUsername = opts.inbound_username || '';\n inboundPassword = opts.inbound_password || '';\n outboundAddress = opts.outbound_address || '';\n outboundUsername = opts.outbound_username || '';\n outboundPassword = opts.outbound_password || '';\n name = opts.name || '';\n metadata = opts.metadata || '';\n }\n\n const req = new CreateSIPTrunkRequest({\n name: name,\n metadata: metadata,\n inboundAddresses: inboundAddresses,\n inboundNumbers: inboundNumbers,\n inboundUsername: inboundUsername,\n inboundPassword: inboundPassword,\n outboundNumber: number,\n outboundAddress: outboundAddress,\n outboundUsername: outboundUsername,\n outboundPassword: outboundPassword,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return SIPTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Create a new SIP inbound trunk.\n *\n * @param name - human-readable name of the trunk\n * @param numbers - phone numbers of the trunk\n * @param opts - CreateSipTrunkOptions\n * @returns Created SIP inbound trunk\n */\n async createSipInboundTrunk(\n name: string,\n numbers: string[],\n opts?: CreateSipInboundTrunkOptions,\n ): Promise<SIPInboundTrunkInfo> {\n if (opts === undefined) {\n opts = {};\n }\n const req = new CreateSIPInboundTrunkRequest({\n trunk: new SIPInboundTrunkInfo({\n name: name,\n numbers: numbers,\n metadata: opts?.metadata,\n allowedAddresses: opts.allowedAddresses ?? opts.allowed_addresses,\n allowedNumbers: opts.allowedNumbers ?? opts.allowed_numbers,\n authUsername: opts.authUsername ?? opts.auth_username,\n authPassword: opts.authPassword ?? opts.auth_password,\n headers: opts.headers,\n headersToAttributes: opts.headersToAttributes,\n includeHeaders: opts.includeHeaders,\n krispEnabled: opts.krispEnabled,\n }),\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPInboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return SIPInboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Create a new SIP outbound trunk.\n *\n * @param name - human-readable name of the trunk\n * @param address - hostname and port of the SIP server to dial\n * @param numbers - phone numbers of the trunk\n * @param opts - CreateSipTrunkOptions\n * @returns Created SIP outbound trunk\n */\n async createSipOutboundTrunk(\n name: string,\n address: string,\n numbers: string[],\n opts?: CreateSipOutboundTrunkOptions,\n ): Promise<SIPOutboundTrunkInfo> {\n if (opts === undefined) {\n opts = {\n transport: SIPTransport.SIP_TRANSPORT_AUTO,\n };\n }\n\n const req = new CreateSIPOutboundTrunkRequest({\n trunk: new SIPOutboundTrunkInfo({\n name: name,\n address: address,\n numbers: numbers,\n metadata: opts.metadata,\n transport: opts.transport,\n authUsername: opts.authUsername ?? opts.auth_username,\n authPassword: opts.authPassword ?? opts.auth_password,\n headers: opts.headers,\n headersToAttributes: opts.headersToAttributes,\n includeHeaders: opts.includeHeaders,\n destinationCountry: opts.destinationCountry,\n }),\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPOutboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return SIPOutboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * @deprecated use `listSipInboundTrunk` or `listSipOutboundTrunk`\n */\n async listSipTrunk(): Promise<Array<SIPTrunkInfo>> {\n const req: Partial<ListSIPTrunkRequest> = {};\n const data = await this.rpc.request(\n svc,\n 'ListSIPTrunk',\n new ListSIPTrunkRequest(req).toJson(),\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n /**\n * List SIP inbound trunks with optional filtering.\n *\n * @param list - Request with optional filtering parameters\n * @returns Response containing list of SIP inbound trunks\n */\n async listSipInboundTrunk(list: ListSipTrunkOptions = {}): Promise<Array<SIPInboundTrunkInfo>> {\n const req = new ListSIPInboundTrunkRequest(list).toJson();\n const data = await this.rpc.request(\n svc,\n 'ListSIPInboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPInboundTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n /**\n * List SIP outbound trunks with optional filtering.\n *\n * @param list - Request with optional filtering parameters\n * @returns Response containing list of SIP outbound trunks\n */\n async listSipOutboundTrunk(list: ListSipTrunkOptions = {}): Promise<Array<SIPOutboundTrunkInfo>> {\n const req = new ListSIPOutboundTrunkRequest(list).toJson();\n const data = await this.rpc.request(\n svc,\n 'ListSIPOutboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPOutboundTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n /**\n * Delete a SIP trunk.\n *\n * @param sipTrunkId - ID of the SIP trunk to delete\n * @returns Deleted trunk information\n */\n async deleteSipTrunk(sipTrunkId: string): Promise<SIPTrunkInfo> {\n const data = await this.rpc.request(\n svc,\n 'DeleteSIPTrunk',\n new DeleteSIPTrunkRequest({ sipTrunkId }).toJson(),\n await this.authHeader({}, { admin: true }),\n );\n return SIPTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Create a new SIP dispatch rule.\n *\n * @param rule - SIP dispatch rule to create\n * @param opts - CreateSipDispatchRuleOptions\n * @returns Created SIP dispatch rule\n */\n async createSipDispatchRule(\n rule: SipDispatchRuleDirect | SipDispatchRuleIndividual,\n opts?: CreateSipDispatchRuleOptions,\n ): Promise<SIPDispatchRuleInfo> {\n if (opts === undefined) {\n opts = {};\n }\n let ruleProto: SIPDispatchRule | undefined = undefined;\n if (rule.type == 'direct') {\n ruleProto = new SIPDispatchRule({\n rule: {\n case: 'dispatchRuleDirect',\n value: new SIPDispatchRuleDirect({\n roomName: rule.roomName,\n pin: rule.pin || '',\n }),\n },\n });\n } else if (rule.type == 'individual') {\n ruleProto = new SIPDispatchRule({\n rule: {\n case: 'dispatchRuleIndividual',\n value: new SIPDispatchRuleIndividual({\n roomPrefix: rule.roomPrefix,\n pin: rule.pin || '',\n }),\n },\n });\n }\n\n const req = new CreateSIPDispatchRuleRequest({\n rule: ruleProto,\n trunkIds: opts.trunkIds,\n hidePhoneNumber: opts.hidePhoneNumber,\n name: opts.name,\n metadata: opts.metadata,\n attributes: opts.attributes,\n roomPreset: opts.roomPreset,\n roomConfig: opts.roomConfig,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPDispatchRule',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates an existing SIP dispatch rule by replacing it entirely.\n *\n * @param sipDispatchRuleId - ID of the SIP dispatch rule to update\n * @param rule - new SIP dispatch rule\n * @returns Updated SIP dispatch rule\n */\n async updateSipDispatchRule(\n sipDispatchRuleId: string,\n rule: SIPDispatchRuleInfo,\n ): Promise<SIPDispatchRuleInfo> {\n const req = new UpdateSIPDispatchRuleRequest({\n sipDispatchRuleId: sipDispatchRuleId,\n action: {\n case: 'replace',\n value: rule,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPDispatchRule',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates specific fields of an existing SIP dispatch rule.\n * Only provided fields will be updated.\n *\n * @param sipDispatchRuleId - ID of the SIP dispatch rule to update\n * @param fields - Fields of the dispatch rule to update\n * @returns Updated SIP dispatch rule\n */\n async updateSipDispatchRuleFields(\n sipDispatchRuleId: string,\n fields: SipDispatchRuleUpdateOptions = {},\n ): Promise<SIPDispatchRuleInfo> {\n const req = new UpdateSIPDispatchRuleRequest({\n sipDispatchRuleId: sipDispatchRuleId,\n action: {\n case: 'update',\n value: fields,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPDispatchRule',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates an existing SIP inbound trunk by replacing it entirely.\n *\n * @param sipTrunkId - ID of the SIP inbound trunk to update\n * @param trunk - SIP inbound trunk to update with\n * @returns Updated SIP inbound trunk\n */\n async updateSipInboundTrunk(\n sipTrunkId: string,\n trunk: SIPInboundTrunkInfo,\n ): Promise<SIPInboundTrunkInfo> {\n const req = new UpdateSIPInboundTrunkRequest({\n sipTrunkId,\n action: {\n case: 'replace',\n value: trunk,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPInboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPInboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates specific fields of an existing SIP inbound trunk.\n * Only provided fields will be updated.\n *\n * @param sipTrunkId - ID of the SIP inbound trunk to update\n * @param fields - Fields of the inbound trunk to update\n * @returns Updated SIP inbound trunk\n */\n async updateSipInboundTrunkFields(\n sipTrunkId: string,\n fields: SipInboundTrunkUpdateOptions,\n ): Promise<SIPInboundTrunkInfo> {\n const req = new UpdateSIPInboundTrunkRequest({\n sipTrunkId,\n action: {\n case: 'update',\n value: fields,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPInboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPInboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates an existing SIP outbound trunk by replacing it entirely.\n *\n * @param sipTrunkId - ID of the SIP outbound trunk to update\n * @param trunk - SIP outbound trunk to update with\n * @returns Updated SIP outbound trunk\n */\n async updateSipOutboundTrunk(\n sipTrunkId: string,\n trunk: SIPOutboundTrunkInfo,\n ): Promise<SIPOutboundTrunkInfo> {\n const req = new UpdateSIPOutboundTrunkRequest({\n sipTrunkId,\n action: {\n case: 'replace',\n value: trunk,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPOutboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPOutboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates specific fields of an existing SIP outbound trunk.\n * Only provided fields will be updated.\n *\n * @param sipTrunkId - ID of the SIP outbound trunk to update\n * @param fields - Fields of the outbound trunk to update\n * @returns Updated SIP outbound trunk\n */\n async updateSipOutboundTrunkFields(\n sipTrunkId: string,\n fields: SipOutboundTrunkUpdateOptions,\n ): Promise<SIPOutboundTrunkInfo> {\n const req = new UpdateSIPOutboundTrunkRequest({\n sipTrunkId,\n action: {\n case: 'update',\n value: fields,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPOutboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPOutboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * List SIP dispatch rules with optional filtering.\n *\n * @param list - Request with optional filtering parameters\n * @returns Response containing list of SIP dispatch rules\n */\n async listSipDispatchRule(\n list: ListSipDispatchRuleOptions = {},\n ): Promise<Array<SIPDispatchRuleInfo>> {\n const req = new ListSIPDispatchRuleRequest(list).toJson();\n const data = await this.rpc.request(\n svc,\n 'ListSIPDispatchRule',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPDispatchRuleResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n /**\n * Delete a SIP dispatch rule.\n *\n * @param sipDispatchRuleId - ID of the SIP dispatch rule to delete\n * @returns Deleted rule information\n */\n async deleteSipDispatchRule(sipDispatchRuleId: string): Promise<SIPDispatchRuleInfo> {\n const data = await this.rpc.request(\n svc,\n 'DeleteSIPDispatchRule',\n new DeleteSIPDispatchRuleRequest({ sipDispatchRuleId }).toJson(),\n await this.authHeader({}, { admin: true }),\n );\n return SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Create a new SIP participant.\n *\n * @param sipTrunkId - sip trunk to use for the call\n * @param number - number to dial\n * @param roomName - room to attach the call to\n * @param opts - CreateSipParticipantOptions\n * @returns Created SIP participant\n */\n async createSipParticipant(\n sipTrunkId: string,\n number: string,\n roomName: string,\n opts?: CreateSipParticipantOptions,\n ): Promise<SIPParticipantInfo> {\n if (opts === undefined) {\n opts = {};\n }\n\n if (opts.timeout === undefined) {\n opts.timeout = opts.waitUntilAnswered ? 60 : 10;\n }\n\n const req = new CreateSIPParticipantRequest({\n sipTrunkId: sipTrunkId,\n sipCallTo: number,\n sipNumber: opts.fromNumber,\n roomName: roomName,\n participantIdentity: opts.participantIdentity || 'sip-participant',\n participantName: opts.participantName,\n participantMetadata: opts.participantMetadata,\n participantAttributes: opts.participantAttributes,\n dtmf: opts.dtmf,\n playDialtone: opts.playDialtone ?? opts.playRingtone,\n headers: opts.headers,\n hidePhoneNumber: opts.hidePhoneNumber,\n includeHeaders: opts.includeHeaders,\n ringingTimeout: opts.ringingTimeout\n ? new Duration({ seconds: BigInt(opts.ringingTimeout) })\n : undefined,\n maxCallDuration: opts.maxCallDuration\n ? new Duration({ seconds: BigInt(opts.maxCallDuration) })\n : undefined,\n krispEnabled: opts.krispEnabled,\n waitUntilAnswered: opts.waitUntilAnswered,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPParticipant',\n req,\n await this.authHeader({}, { call: true }),\n opts.timeout,\n );\n return SIPParticipantInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Transfer a SIP participant to a different room.\n *\n * @param roomName - room the SIP participant to transfer is connectd to\n * @param participantIdentity - identity of the SIP participant to transfer\n * @param transferTo - SIP URL to transfer the participant to\n * @param opts - TransferSipParticipantOptions\n */\n async transferSipParticipant(\n roomName: string,\n participantIdentity: string,\n transferTo: string,\n opts?: TransferSipParticipantOptions,\n ): Promise<void> {\n if (opts === undefined) {\n opts = {};\n }\n\n const req = new TransferSIPParticipantRequest({\n participantIdentity: participantIdentity,\n roomName: roomName,\n transferTo: transferTo,\n playDialtone: opts.playDialtone,\n headers: opts.headers,\n }).toJson();\n\n await this.rpc.request(\n svc,\n 'TransferSIPParticipant',\n req,\n await this.authHeader({ roomAdmin: true, room: roomName }, { call: true }),\n );\n }\n}\n"],"mappings":"AAGA,SAAS,gBAAgB;AAOzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAE5B,SAAS,UAAU,sBAAsB;AAEzC,MAAM,MAAM;AAoKL,MAAM,kBAAkB,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQzC,YAAY,MAAc,QAAiB,QAAiB;AAC1D,UAAM,QAAQ,MAAM;AACpB,SAAK,MAAM,IAAI,SAAS,MAAM,cAAc;AAAA,EAC9C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,eAAe,QAAgB,MAAqD;AACxF,QAAI;AACJ,QAAI;AACJ,QAAI,kBAA0B;AAC9B,QAAI,kBAA0B;AAC9B,QAAI,kBAA0B;AAC9B,QAAI,mBAA2B;AAC/B,QAAI,mBA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M,KAAK;AAAA,MACX,cAAc,KAAK,gBAAgB,KAAK;AAAA,MACxC,SAAS,KAAK;AAAA,MACd,iBAAiB,KAAK;AAAA,MACtB,gBAAgB,KAAK;AAAA,MACrB,gBAAgB,KAAK,iBACjB,IAAI,SAAS,EAAE,SAAS,OAAO,KAAK,cAAc,EAAE,CAAC,IACrD;AAAA,MACJ,iBAAiB,KAAK,kBAClB,IAAI,SAAS,EAAE,SAAS,OAAO,KAAK,eAAe,EAAE,CAAC,IACtD;AAAA,MACJ,cAAc,KAAK;AAAA,MACnB,mBAAmB,KAAK;AAAA,IAC1B,CAAC,EAAE,OAAO;AAEV,UAAM,OAAO,MAAM,KAAK,IAAI;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM,KAAK,WAAW,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC;AAAA,MACxC,KAAK;AAAA,IACP;AACA,WAAO,mBAAmB,SAAS,MAAM,EAAE,qBAAqB,KAAK,CAAC;AAAA,EACxE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,uBACJ,UACA,qBACA,YACA,MACe;AACf,QAAI,SAAS,QAAW;AACtB,aAAO,CAAC;AAAA,IACV;AAEA,UAAM,MAAM,IAAI,8BAA8B;AAAA,MAC5C;AAAA,MACA;AAAA,MACA;AAAA,MACA,cAAc,KAAK;AAAA,MACnB,SAAS,KAAK;AAAA,IAChB,CAAC,EAAE,OAAO;AAEV,UAAM,KAAK,IAAI;AAAA,MACb;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM,KAAK,WAAW,EAAE,WAAW,MAAM,MAAM,SAAS,GAAG,EAAE,MAAM,KAAK,CAAC;AAAA,IAC3E;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/SipClient.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { Duration } from '@bufbuild/protobuf';\nimport type {\n ListUpdate,\n Pagination,\n RoomConfiguration,\n SIPHeaderOptions,\n} from '@livekit/protocol';\nimport {\n CreateSIPDispatchRuleRequest,\n CreateSIPInboundTrunkRequest,\n CreateSIPOutboundTrunkRequest,\n CreateSIPParticipantRequest,\n CreateSIPTrunkRequest,\n DeleteSIPDispatchRuleRequest,\n DeleteSIPTrunkRequest,\n ListSIPDispatchRuleRequest,\n ListSIPDispatchRuleResponse,\n ListSIPInboundTrunkRequest,\n ListSIPInboundTrunkResponse,\n ListSIPOutboundTrunkRequest,\n ListSIPOutboundTrunkResponse,\n ListSIPTrunkRequest,\n ListSIPTrunkResponse,\n SIPDispatchRule,\n SIPDispatchRuleDirect,\n SIPDispatchRuleIndividual,\n SIPDispatchRuleInfo,\n SIPInboundTrunkInfo,\n SIPOutboundConfig,\n SIPOutboundTrunkInfo,\n SIPParticipantInfo,\n SIPTransport,\n SIPTrunkInfo,\n TransferSIPParticipantRequest,\n UpdateSIPDispatchRuleRequest,\n UpdateSIPInboundTrunkRequest,\n UpdateSIPOutboundTrunkRequest,\n} from '@livekit/protocol';\nimport type { ClientOptions } from './ClientOptions.js';\nimport { ServiceBase } from './ServiceBase.js';\nimport type { Rpc } from './TwirpRPC.js';\nimport { TwirpRpc, livekitPackage } from './TwirpRPC.js';\n\nconst svc = 'SIP';\n\n/**\n * @deprecated use CreateSipInboundTrunkOptions or CreateSipOutboundTrunkOptions\n */\nexport interface CreateSipTrunkOptions {\n name?: string;\n metadata?: string;\n inbound_addresses?: string[];\n inbound_numbers?: string[];\n inbound_username?: string;\n inbound_password?: string;\n outbound_address?: string;\n outbound_username?: string;\n outbound_password?: string;\n}\nexport interface CreateSipInboundTrunkOptions {\n metadata?: string;\n /** @deprecated - use `allowedAddresses` instead */\n allowed_addresses?: string[];\n allowedAddresses?: string[];\n /** @deprecated - use `allowedNumbers` instead */\n allowed_numbers?: string[];\n allowedNumbers?: string[];\n /** @deprecated - use `authUsername` instead */\n auth_username?: string;\n authUsername?: string;\n /** @deprecated - use `authPassword` instead */\n auth_password?: string;\n authPassword?: string;\n headers?: { [key: string]: string };\n headersToAttributes?: { [key: string]: string };\n // Map SIP response headers from INVITE to sip.h.* participant attributes automatically.\n includeHeaders?: SIPHeaderOptions;\n krispEnabled?: boolean;\n}\nexport interface CreateSipOutboundTrunkOptions {\n metadata?: string;\n transport: SIPTransport;\n destinationCountry?: string;\n /** @deprecated - use `authUsername` instead */\n auth_username?: string;\n authUsername?: string;\n /** @deprecated - use `authPassword` instead */\n auth_password?: string;\n authPassword?: string;\n headers?: { [key: string]: string };\n headersToAttributes?: { [key: string]: string };\n // Map SIP response headers from INVITE to sip.h.* participant attributes automatically.\n includeHeaders?: SIPHeaderOptions;\n}\n\nexport interface SipDispatchRuleDirect {\n type: 'direct';\n roomName: string;\n pin?: string;\n}\n\nexport interface SipDispatchRuleIndividual {\n type: 'individual';\n roomPrefix: string;\n pin?: string;\n}\n\nexport interface CreateSipDispatchRuleOptions {\n name?: string;\n metadata?: string;\n trunkIds?: string[];\n hidePhoneNumber?: boolean;\n attributes?: { [key: string]: string };\n roomPreset?: string;\n roomConfig?: RoomConfiguration;\n}\n\nexport interface CreateSipParticipantOptions {\n /** Optional SIP From number to use. If empty, trunk number is used. */\n fromNumber?: string;\n /** Optional identity of the SIP participant */\n participantIdentity?: string;\n /** Optional name of the participant */\n participantName?: string;\n /** Optional display name for the SIP participant */\n displayName?: string;\n /** Optional metadata to attach to the participant */\n participantMetadata?: string;\n /** Optional attributes to attach to the participant */\n participantAttributes?: { [key: string]: string };\n /** Optionally send following DTMF digits (extension codes) when making a call.\n * Character 'w' can be used to add a 0.5 sec delay. */\n dtmf?: string;\n /** @deprecated use `playDialtone` instead */\n playRingtone?: boolean;\n /** If `true`, the SIP Participant plays a dial tone to the room until the phone is picked up. */\n playDialtone?: boolean;\n /** These headers are sent as-is and may help identify this call as coming from LiveKit for the other SIP endpoint. */\n headers?: { [key: string]: string };\n /** Map SIP response headers from INVITE to sip.h.* participant attributes automatically. */\n includeHeaders?: SIPHeaderOptions;\n hidePhoneNumber?: boolean;\n /** Maximum time for the call to ring in seconds. */\n ringingTimeout?: number;\n /** Maximum call duration in seconds. */\n maxCallDuration?: number;\n /** If `true`, Krisp noise cancellation will be enabled for the caller. */\n krispEnabled?: boolean;\n /** If `true`, this will wait until the call is answered before returning. */\n waitUntilAnswered?: boolean;\n /** Optional request timeout in seconds. default 60 seconds if waitUntilAnswered is true, otherwise 10 seconds */\n timeout?: number;\n}\n\nexport interface ListSipDispatchRuleOptions {\n /** Pagination options. */\n page?: Pagination;\n /** Rule IDs to list. If this option is set, the response will contains rules in the same order. If any of the rules is missing, a nil item in that position will be sent in the response. */\n dispatchRuleIds?: string[];\n /** Only list rules that contain one of the Trunk IDs, including wildcard rules. */\n trunkIds?: string[];\n}\n\nexport interface ListSipTrunkOptions {\n /** Pagination options. */\n page?: Pagination;\n /** Trunk IDs to list. If this option is set, the response will contains trunks in the same order. If any of the trunks is missing, a nil item in that position will be sent in the response. */\n trunkIds?: string[];\n /** Only list trunks that contain one of the numbers, including wildcard trunks. */\n numbers?: string[];\n}\n\nexport interface SipDispatchRuleUpdateOptions {\n trunkIds?: ListUpdate;\n rule?: SIPDispatchRule;\n name?: string;\n metadata?: string;\n attributes?: { [key: string]: string };\n}\n\nexport interface SipInboundTrunkUpdateOptions {\n numbers?: ListUpdate;\n allowedAddresses?: ListUpdate;\n allowedNumbers?: ListUpdate;\n authUsername?: string;\n authPassword?: string;\n name?: string;\n metadata?: string;\n}\n\nexport interface SipOutboundTrunkUpdateOptions {\n numbers?: ListUpdate;\n allowedAddresses?: ListUpdate;\n allowedNumbers?: ListUpdate;\n authUsername?: string;\n authPassword?: string;\n destinationCountry?: string;\n name?: string;\n metadata?: string;\n}\n\nexport interface TransferSipParticipantOptions {\n playDialtone?: boolean;\n headers?: { [key: string]: string };\n}\n\n/**\n * Client to access Egress APIs\n */\nexport class SipClient extends ServiceBase {\n private readonly rpc: Rpc;\n\n /**\n * @param host - hostname including protocol. i.e. 'https://<project>.livekit.cloud'\n * @param apiKey - API Key, can be set in env var LIVEKIT_API_KEY\n * @param secret - API Secret, can be set in env var LIVEKIT_API_SECRET\n * @param options - client options\n */\n constructor(host: string, apiKey?: string, secret?: string, options?: ClientOptions) {\n super(apiKey, secret);\n const rpcOptions = options?.requestTimeout\n ? { requestTimeout: options.requestTimeout }\n : undefined;\n this.rpc = new TwirpRpc(host, livekitPackage, rpcOptions);\n }\n\n /**\n * @param number - phone number of the trunk\n * @param opts - CreateSipTrunkOptions\n * @deprecated use `createSipInboundTrunk` or `createSipOutboundTrunk`\n */\n async createSipTrunk(number: string, opts?: CreateSipTrunkOptions): Promise<SIPTrunkInfo> {\n let inboundAddresses: string[] | undefined;\n let inboundNumbers: string[] | undefined;\n let inboundUsername: string = '';\n let inboundPassword: string = '';\n let outboundAddress: string = '';\n let outboundUsername: string = '';\n let outboundPassword: string = '';\n let name: string = '';\n let metadata: string = '';\n\n if (opts !== undefined) {\n inboundAddresses = opts.inbound_addresses;\n inboundNumbers = opts.inbound_numbers;\n inboundUsername = opts.inbound_username || '';\n inboundPassword = opts.inbound_password || '';\n outboundAddress = opts.outbound_address || '';\n outboundUsername = opts.outbound_username || '';\n outboundPassword = opts.outbound_password || '';\n name = opts.name || '';\n metadata = opts.metadata || '';\n }\n\n const req = new CreateSIPTrunkRequest({\n name: name,\n metadata: metadata,\n inboundAddresses: inboundAddresses,\n inboundNumbers: inboundNumbers,\n inboundUsername: inboundUsername,\n inboundPassword: inboundPassword,\n outboundNumber: number,\n outboundAddress: outboundAddress,\n outboundUsername: outboundUsername,\n outboundPassword: outboundPassword,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return SIPTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Create a new SIP inbound trunk.\n *\n * @param name - human-readable name of the trunk\n * @param numbers - phone numbers of the trunk\n * @param opts - CreateSipTrunkOptions\n * @returns Created SIP inbound trunk\n */\n async createSipInboundTrunk(\n name: string,\n numbers: string[],\n opts?: CreateSipInboundTrunkOptions,\n ): Promise<SIPInboundTrunkInfo> {\n if (opts === undefined) {\n opts = {};\n }\n const req = new CreateSIPInboundTrunkRequest({\n trunk: new SIPInboundTrunkInfo({\n name: name,\n numbers: numbers,\n metadata: opts?.metadata,\n allowedAddresses: opts.allowedAddresses ?? opts.allowed_addresses,\n allowedNumbers: opts.allowedNumbers ?? opts.allowed_numbers,\n authUsername: opts.authUsername ?? opts.auth_username,\n authPassword: opts.authPassword ?? opts.auth_password,\n headers: opts.headers,\n headersToAttributes: opts.headersToAttributes,\n includeHeaders: opts.includeHeaders,\n krispEnabled: opts.krispEnabled,\n }),\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPInboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return SIPInboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Create a new SIP outbound trunk.\n *\n * @param name - human-readable name of the trunk\n * @param address - hostname and port of the SIP server to dial\n * @param numbers - phone numbers of the trunk\n * @param opts - CreateSipTrunkOptions\n * @returns Created SIP outbound trunk\n */\n async createSipOutboundTrunk(\n name: string,\n address: string,\n numbers: string[],\n opts?: CreateSipOutboundTrunkOptions,\n ): Promise<SIPOutboundTrunkInfo> {\n if (opts === undefined) {\n opts = {\n transport: SIPTransport.SIP_TRANSPORT_AUTO,\n };\n }\n\n const req = new CreateSIPOutboundTrunkRequest({\n trunk: new SIPOutboundTrunkInfo({\n name: name,\n address: address,\n numbers: numbers,\n metadata: opts.metadata,\n transport: opts.transport,\n authUsername: opts.authUsername ?? opts.auth_username,\n authPassword: opts.authPassword ?? opts.auth_password,\n headers: opts.headers,\n headersToAttributes: opts.headersToAttributes,\n includeHeaders: opts.includeHeaders,\n destinationCountry: opts.destinationCountry,\n }),\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPOutboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return SIPOutboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * @deprecated use `listSipInboundTrunk` or `listSipOutboundTrunk`\n */\n async listSipTrunk(): Promise<Array<SIPTrunkInfo>> {\n const req: Partial<ListSIPTrunkRequest> = {};\n const data = await this.rpc.request(\n svc,\n 'ListSIPTrunk',\n new ListSIPTrunkRequest(req).toJson(),\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n /**\n * List SIP inbound trunks with optional filtering.\n *\n * @param list - Request with optional filtering parameters\n * @returns Response containing list of SIP inbound trunks\n */\n async listSipInboundTrunk(list: ListSipTrunkOptions = {}): Promise<Array<SIPInboundTrunkInfo>> {\n const req = new ListSIPInboundTrunkRequest(list).toJson();\n const data = await this.rpc.request(\n svc,\n 'ListSIPInboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPInboundTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n /**\n * List SIP outbound trunks with optional filtering.\n *\n * @param list - Request with optional filtering parameters\n * @returns Response containing list of SIP outbound trunks\n */\n async listSipOutboundTrunk(list: ListSipTrunkOptions = {}): Promise<Array<SIPOutboundTrunkInfo>> {\n const req = new ListSIPOutboundTrunkRequest(list).toJson();\n const data = await this.rpc.request(\n svc,\n 'ListSIPOutboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPOutboundTrunkResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n /**\n * Delete a SIP trunk.\n *\n * @param sipTrunkId - ID of the SIP trunk to delete\n * @returns Deleted trunk information\n */\n async deleteSipTrunk(sipTrunkId: string): Promise<SIPTrunkInfo> {\n const data = await this.rpc.request(\n svc,\n 'DeleteSIPTrunk',\n new DeleteSIPTrunkRequest({ sipTrunkId }).toJson(),\n await this.authHeader({}, { admin: true }),\n );\n return SIPTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Create a new SIP dispatch rule.\n *\n * @param rule - SIP dispatch rule to create\n * @param opts - CreateSipDispatchRuleOptions\n * @returns Created SIP dispatch rule\n */\n async createSipDispatchRule(\n rule: SipDispatchRuleDirect | SipDispatchRuleIndividual,\n opts?: CreateSipDispatchRuleOptions,\n ): Promise<SIPDispatchRuleInfo> {\n if (opts === undefined) {\n opts = {};\n }\n let ruleProto: SIPDispatchRule | undefined = undefined;\n if (rule.type == 'direct') {\n ruleProto = new SIPDispatchRule({\n rule: {\n case: 'dispatchRuleDirect',\n value: new SIPDispatchRuleDirect({\n roomName: rule.roomName,\n pin: rule.pin || '',\n }),\n },\n });\n } else if (rule.type == 'individual') {\n ruleProto = new SIPDispatchRule({\n rule: {\n case: 'dispatchRuleIndividual',\n value: new SIPDispatchRuleIndividual({\n roomPrefix: rule.roomPrefix,\n pin: rule.pin || '',\n }),\n },\n });\n }\n\n const req = new CreateSIPDispatchRuleRequest({\n rule: ruleProto,\n trunkIds: opts.trunkIds,\n hidePhoneNumber: opts.hidePhoneNumber,\n name: opts.name,\n metadata: opts.metadata,\n attributes: opts.attributes,\n roomPreset: opts.roomPreset,\n roomConfig: opts.roomConfig,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPDispatchRule',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates an existing SIP dispatch rule by replacing it entirely.\n *\n * @param sipDispatchRuleId - ID of the SIP dispatch rule to update\n * @param rule - new SIP dispatch rule\n * @returns Updated SIP dispatch rule\n */\n async updateSipDispatchRule(\n sipDispatchRuleId: string,\n rule: SIPDispatchRuleInfo,\n ): Promise<SIPDispatchRuleInfo> {\n const req = new UpdateSIPDispatchRuleRequest({\n sipDispatchRuleId: sipDispatchRuleId,\n action: {\n case: 'replace',\n value: rule,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPDispatchRule',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates specific fields of an existing SIP dispatch rule.\n * Only provided fields will be updated.\n *\n * @param sipDispatchRuleId - ID of the SIP dispatch rule to update\n * @param fields - Fields of the dispatch rule to update\n * @returns Updated SIP dispatch rule\n */\n async updateSipDispatchRuleFields(\n sipDispatchRuleId: string,\n fields: SipDispatchRuleUpdateOptions = {},\n ): Promise<SIPDispatchRuleInfo> {\n const req = new UpdateSIPDispatchRuleRequest({\n sipDispatchRuleId: sipDispatchRuleId,\n action: {\n case: 'update',\n value: fields,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPDispatchRule',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates an existing SIP inbound trunk by replacing it entirely.\n *\n * @param sipTrunkId - ID of the SIP inbound trunk to update\n * @param trunk - SIP inbound trunk to update with\n * @returns Updated SIP inbound trunk\n */\n async updateSipInboundTrunk(\n sipTrunkId: string,\n trunk: SIPInboundTrunkInfo,\n ): Promise<SIPInboundTrunkInfo> {\n const req = new UpdateSIPInboundTrunkRequest({\n sipTrunkId,\n action: {\n case: 'replace',\n value: trunk,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPInboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPInboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates specific fields of an existing SIP inbound trunk.\n * Only provided fields will be updated.\n *\n * @param sipTrunkId - ID of the SIP inbound trunk to update\n * @param fields - Fields of the inbound trunk to update\n * @returns Updated SIP inbound trunk\n */\n async updateSipInboundTrunkFields(\n sipTrunkId: string,\n fields: SipInboundTrunkUpdateOptions,\n ): Promise<SIPInboundTrunkInfo> {\n const req = new UpdateSIPInboundTrunkRequest({\n sipTrunkId,\n action: {\n case: 'update',\n value: fields,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPInboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPInboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates an existing SIP outbound trunk by replacing it entirely.\n *\n * @param sipTrunkId - ID of the SIP outbound trunk to update\n * @param trunk - SIP outbound trunk to update with\n * @returns Updated SIP outbound trunk\n */\n async updateSipOutboundTrunk(\n sipTrunkId: string,\n trunk: SIPOutboundTrunkInfo,\n ): Promise<SIPOutboundTrunkInfo> {\n const req = new UpdateSIPOutboundTrunkRequest({\n sipTrunkId,\n action: {\n case: 'replace',\n value: trunk,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPOutboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPOutboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Updates specific fields of an existing SIP outbound trunk.\n * Only provided fields will be updated.\n *\n * @param sipTrunkId - ID of the SIP outbound trunk to update\n * @param fields - Fields of the outbound trunk to update\n * @returns Updated SIP outbound trunk\n */\n async updateSipOutboundTrunkFields(\n sipTrunkId: string,\n fields: SipOutboundTrunkUpdateOptions,\n ): Promise<SIPOutboundTrunkInfo> {\n const req = new UpdateSIPOutboundTrunkRequest({\n sipTrunkId,\n action: {\n case: 'update',\n value: fields,\n },\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'UpdateSIPOutboundTrunk',\n req,\n await this.authHeader({}, { admin: true }),\n );\n\n return SIPOutboundTrunkInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * List SIP dispatch rules with optional filtering.\n *\n * @param list - Request with optional filtering parameters\n * @returns Response containing list of SIP dispatch rules\n */\n async listSipDispatchRule(\n list: ListSipDispatchRuleOptions = {},\n ): Promise<Array<SIPDispatchRuleInfo>> {\n const req = new ListSIPDispatchRuleRequest(list).toJson();\n const data = await this.rpc.request(\n svc,\n 'ListSIPDispatchRule',\n req,\n await this.authHeader({}, { admin: true }),\n );\n return ListSIPDispatchRuleResponse.fromJson(data, { ignoreUnknownFields: true }).items ?? [];\n }\n\n /**\n * Delete a SIP dispatch rule.\n *\n * @param sipDispatchRuleId - ID of the SIP dispatch rule to delete\n * @returns Deleted rule information\n */\n async deleteSipDispatchRule(sipDispatchRuleId: string): Promise<SIPDispatchRuleInfo> {\n const data = await this.rpc.request(\n svc,\n 'DeleteSIPDispatchRule',\n new DeleteSIPDispatchRuleRequest({ sipDispatchRuleId }).toJson(),\n await this.authHeader({}, { admin: true }),\n );\n return SIPDispatchRuleInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Create a new SIP participant.\n *\n * @param sipTrunkId - sip trunk to use for the call\n * @param number - number to dial\n * @param roomName - room to attach the call to\n * @param opts - CreateSipParticipantOptions\n * @param outboundTrunkConfig - Optional outbound trunk configuration for sip participant.\n * @returns Created SIP participant\n */\n async createSipParticipant(\n sipTrunkId: string,\n number: string,\n roomName: string,\n opts?: CreateSipParticipantOptions,\n outboundTrunkConfig?: SIPOutboundConfig,\n ): Promise<SIPParticipantInfo> {\n if (opts === undefined) {\n opts = {};\n }\n\n if (opts.timeout === undefined) {\n opts.timeout = opts.waitUntilAnswered ? 60 : 10;\n }\n\n const req = new CreateSIPParticipantRequest({\n sipTrunkId: sipTrunkId,\n trunk: outboundTrunkConfig,\n sipCallTo: number,\n sipNumber: opts.fromNumber,\n roomName: roomName,\n participantIdentity: opts.participantIdentity || 'sip-participant',\n participantName: opts.participantName,\n displayName: opts.displayName,\n participantMetadata: opts.participantMetadata,\n participantAttributes: opts.participantAttributes,\n dtmf: opts.dtmf,\n playDialtone: opts.playDialtone ?? opts.playRingtone,\n headers: opts.headers,\n hidePhoneNumber: opts.hidePhoneNumber,\n includeHeaders: opts.includeHeaders,\n ringingTimeout: opts.ringingTimeout\n ? new Duration({ seconds: BigInt(opts.ringingTimeout) })\n : undefined,\n maxCallDuration: opts.maxCallDuration\n ? new Duration({ seconds: BigInt(opts.maxCallDuration) })\n : undefined,\n krispEnabled: opts.krispEnabled,\n waitUntilAnswered: opts.waitUntilAnswered,\n }).toJson();\n\n const data = await this.rpc.request(\n svc,\n 'CreateSIPParticipant',\n req,\n await this.authHeader({}, { call: true }),\n opts.timeout,\n );\n return SIPParticipantInfo.fromJson(data, { ignoreUnknownFields: true });\n }\n\n /**\n * Transfer a SIP participant to a different room.\n *\n * @param roomName - room the SIP participant to transfer is connectd to\n * @param participantIdentity - identity of the SIP participant to transfer\n * @param transferTo - SIP URL to transfer the participant to\n * @param opts - TransferSipParticipantOptions\n */\n async transferSipParticipant(\n roomName: string,\n participantIdentity: string,\n transferTo: string,\n opts?: TransferSipParticipantOptions,\n ): Promise<void> {\n if (opts === undefined) {\n opts = {};\n }\n\n const req = new TransferSIPParticipantRequest({\n participantIdentity: participantIdentity,\n roomName: roomName,\n transferTo: transferTo,\n playDialtone: opts.playDialtone,\n headers: opts.headers,\n }).toJson();\n\n await this.rpc.request(\n svc,\n 'TransferSIPParticipant',\n req,\n await this.authHeader({ roomAdmin: true, room: roomName }, { call: true }),\n );\n }\n}\n"],"mappings":"AAGA,SAAS,gBAAgB;AAOzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,mBAAmB;AAE5B,SAAS,UAAU,sBAAsB;AAEzC,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A,YACA,MACe;AACf,QAAI,SAAS,QAAW;AACtB,aAAO,CAAC;AAAA,IACV;AAEA,UAAM,MAAM,IAAI,8BAA8B;AAAA,MAC5C;AAAA,MACA;AAAA,MACA;AAAA,MACA,cAAc,KAAK;AAAA,MACnB,SAAS,KAAK;AAAA,IAChB,CAAC,EAAE,OAAO;AAEV,UAAM,KAAK,IAAI;AAAA,MACb;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM,KAAK,WAAW,EAAE,WAAW,MAAM,MAAM,SAAS,GAAG,EAAE,MAAM,KAAK,CAAC;AAAA,IAC3E;AAAA,EACF;AACF;","names":[]}
|
package/dist/TwirpRPC.cjs
CHANGED
|
@@ -34,6 +34,7 @@ __export(TwirpRPC_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(TwirpRPC_exports);
|
|
36
36
|
const defaultPrefix = "/twirp";
|
|
37
|
+
const defaultTimeoutSeconds = 60;
|
|
37
38
|
const livekitPackage = "livekit";
|
|
38
39
|
class TwirpError extends Error {
|
|
39
40
|
constructor(name, message, status, code, metadata) {
|
|
@@ -45,15 +46,16 @@ class TwirpError extends Error {
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
class TwirpRpc {
|
|
48
|
-
constructor(host, pkg,
|
|
49
|
+
constructor(host, pkg, options) {
|
|
49
50
|
if (host.startsWith("ws")) {
|
|
50
51
|
host = host.replace("ws", "http");
|
|
51
52
|
}
|
|
52
53
|
this.host = host;
|
|
53
54
|
this.pkg = pkg;
|
|
54
|
-
this.
|
|
55
|
+
this.requestTimeout = (options == null ? void 0 : options.requestTimeout) ?? defaultTimeoutSeconds;
|
|
56
|
+
this.prefix = (options == null ? void 0 : options.prefix) || defaultPrefix;
|
|
55
57
|
}
|
|
56
|
-
async request(service, method, data, headers, timeout =
|
|
58
|
+
async request(service, method, data, headers, timeout = this.requestTimeout) {
|
|
57
59
|
const path = `${this.prefix}/${this.pkg}.${service}/${method}`;
|
|
58
60
|
const url = new URL(path, this.host);
|
|
59
61
|
const init = {
|
package/dist/TwirpRPC.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/TwirpRPC.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { JsonValue } from '@bufbuild/protobuf';\n\n// twirp RPC adapter for client implementation\n\nconst defaultPrefix = '/twirp';\n\nexport const livekitPackage = 'livekit';\nexport interface Rpc {\n request(\n service: string,\n method: string,\n data: JsonValue,\n headers: any, // eslint-disable-line @typescript-eslint/no-explicit-any\n timeout?: number,\n ): Promise<string>;\n}\n\nexport class TwirpError extends Error {\n status: number;\n code?: string;\n metadata?: Record<string, string>;\n\n constructor(\n name: string,\n message: string,\n status: number,\n code?: string,\n metadata?: Record<string, string>,\n ) {\n super(message);\n this.name = name;\n this.status = status;\n this.code = code;\n this.metadata = metadata;\n }\n}\n\n/**\n * JSON based Twirp V7 RPC\n */\nexport class TwirpRpc {\n host: string;\n\n pkg: string;\n\n prefix: string;\n\n constructor(host: string, pkg: string,
|
|
1
|
+
{"version":3,"sources":["../src/TwirpRPC.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { JsonValue } from '@bufbuild/protobuf';\n\n// twirp RPC adapter for client implementation\n\ntype Options = {\n /** Prefix for the RPC requests */\n prefix?: string;\n /** Timeout for fetch requests, in seconds. Must be within the valid range for abort signal timeouts. */\n requestTimeout?: number;\n};\n\nconst defaultPrefix = '/twirp';\nconst defaultTimeoutSeconds = 60;\n\nexport const livekitPackage = 'livekit';\nexport interface Rpc {\n request(\n service: string,\n method: string,\n data: JsonValue,\n headers: any, // eslint-disable-line @typescript-eslint/no-explicit-any\n timeout?: number,\n ): Promise<string>;\n}\n\nexport class TwirpError extends Error {\n status: number;\n code?: string;\n metadata?: Record<string, string>;\n\n constructor(\n name: string,\n message: string,\n status: number,\n code?: string,\n metadata?: Record<string, string>,\n ) {\n super(message);\n this.name = name;\n this.status = status;\n this.code = code;\n this.metadata = metadata;\n }\n}\n\n/**\n * JSON based Twirp V7 RPC\n */\nexport class TwirpRpc {\n host: string;\n\n pkg: string;\n\n prefix: string;\n\n requestTimeout: number;\n\n constructor(host: string, pkg: string, options?: Options) {\n if (host.startsWith('ws')) {\n host = host.replace('ws', 'http');\n }\n this.host = host;\n this.pkg = pkg;\n this.requestTimeout = options?.requestTimeout ?? defaultTimeoutSeconds;\n this.prefix = options?.prefix || defaultPrefix;\n }\n\n async request(\n service: string,\n method: string,\n data: any, // eslint-disable-line @typescript-eslint/no-explicit-any\n headers: any, // eslint-disable-line @typescript-eslint/no-explicit-any\n timeout = this.requestTimeout,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<any> {\n const path = `${this.prefix}/${this.pkg}.${service}/${method}`;\n const url = new URL(path, this.host);\n const init: RequestInit = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json;charset=UTF-8',\n ...headers,\n },\n body: JSON.stringify(data),\n };\n\n if (timeout) {\n init.signal = AbortSignal.timeout(timeout * 1000);\n }\n\n const response = await fetch(url, init);\n\n if (!response.ok) {\n const isJson = response.headers.get('content-type') === 'application/json';\n let errorMessage = 'Unknown internal error';\n let errorCode: string | undefined = undefined;\n let metadata: Record<string, string> | undefined = undefined;\n try {\n if (isJson) {\n const parsedError = (await response.json()) as Record<string, unknown>;\n if ('msg' in parsedError) {\n errorMessage = <string>parsedError.msg;\n }\n if ('code' in parsedError) {\n errorCode = <string>parsedError.code;\n }\n if ('meta' in parsedError) {\n metadata = <Record<string, string>>parsedError.meta;\n }\n } else {\n errorMessage = await response.text();\n }\n } catch (e) {\n // parsing went wrong, no op and we keep default error message\n console.debug(`Error when trying to parse error message, using defaults`, e);\n }\n\n throw new TwirpError(response.statusText, errorMessage, response.status, errorCode, metadata);\n }\n const parsedResp = (await response.json()) as Record<string, unknown>;\n\n const camelcaseKeys = await import('camelcase-keys').then((mod) => mod.default);\n return camelcaseKeys(parsedResp, { deep: true });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcA,MAAM,gBAAgB;AACtB,MAAM,wBAAwB;AAEvB,MAAM,iBAAiB;AAWvB,MAAM,mBAAmB,MAAM;AAAA,EAKpC,YACE,MACA,SACA,QACA,MACA,UACA;AACA,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO;AACZ,SAAK,WAAW;AAAA,EAClB;AACF;AAKO,MAAM,SAAS;AAAA,EASpB,YAAY,MAAc,KAAa,SAAmB;AACxD,QAAI,KAAK,WAAW,IAAI,GAAG;AACzB,aAAO,KAAK,QAAQ,MAAM,MAAM;AAAA,IAClC;AACA,SAAK,OAAO;AACZ,SAAK,MAAM;AACX,SAAK,kBAAiB,mCAAS,mBAAkB;AACjD,SAAK,UAAS,mCAAS,WAAU;AAAA,EACnC;AAAA,EAEA,MAAM,QACJ,SACA,QACA,MACA,SACA,UAAU,KAAK,gBAED;AACd,UAAM,OAAO,GAAG,KAAK,MAAM,IAAI,KAAK,GAAG,IAAI,OAAO,IAAI,MAAM;AAC5D,UAAM,MAAM,IAAI,IAAI,MAAM,KAAK,IAAI;AACnC,UAAM,OAAoB;AAAA,MACxB,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,gBAAgB;AAAA,QAChB,GAAG;AAAA,MACL;AAAA,MACA,MAAM,KAAK,UAAU,IAAI;AAAA,IAC3B;AAEA,QAAI,SAAS;AACX,WAAK,SAAS,YAAY,QAAQ,UAAU,GAAI;AAAA,IAClD;AAEA,UAAM,WAAW,MAAM,MAAM,KAAK,IAAI;AAEtC,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,SAAS,SAAS,QAAQ,IAAI,cAAc,MAAM;AACxD,UAAI,eAAe;AACnB,UAAI,YAAgC;AACpC,UAAI,WAA+C;AACnD,UAAI;AACF,YAAI,QAAQ;AACV,gBAAM,cAAe,MAAM,SAAS,KAAK;AACzC,cAAI,SAAS,aAAa;AACxB,2BAAuB,YAAY;AAAA,UACrC;AACA,cAAI,UAAU,aAAa;AACzB,wBAAoB,YAAY;AAAA,UAClC;AACA,cAAI,UAAU,aAAa;AACzB,uBAAmC,YAAY;AAAA,UACjD;AAAA,QACF,OAAO;AACL,yBAAe,MAAM,SAAS,KAAK;AAAA,QACrC;AAAA,MACF,SAAS,GAAG;AAEV,gBAAQ,MAAM,4DAA4D,CAAC;AAAA,MAC7E;AAEA,YAAM,IAAI,WAAW,SAAS,YAAY,cAAc,SAAS,QAAQ,WAAW,QAAQ;AAAA,IAC9F;AACA,UAAM,aAAc,MAAM,SAAS,KAAK;AAExC,UAAM,gBAAgB,MAAM,OAAO,gBAAgB,EAAE,KAAK,CAAC,QAAQ,IAAI,OAAO;AAC9E,WAAO,cAAc,YAAY,EAAE,MAAM,KAAK,CAAC;AAAA,EACjD;AACF;","names":[]}
|
package/dist/TwirpRPC.d.cts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { JsonValue } from '@bufbuild/protobuf';
|
|
2
2
|
|
|
3
|
+
type Options = {
|
|
4
|
+
/** Prefix for the RPC requests */
|
|
5
|
+
prefix?: string;
|
|
6
|
+
/** Timeout for fetch requests, in seconds. Must be within the valid range for abort signal timeouts. */
|
|
7
|
+
requestTimeout?: number;
|
|
8
|
+
};
|
|
3
9
|
declare const livekitPackage = "livekit";
|
|
4
10
|
interface Rpc {
|
|
5
11
|
request(service: string, method: string, data: JsonValue, headers: any, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
@@ -18,7 +24,8 @@ declare class TwirpRpc {
|
|
|
18
24
|
host: string;
|
|
19
25
|
pkg: string;
|
|
20
26
|
prefix: string;
|
|
21
|
-
|
|
27
|
+
requestTimeout: number;
|
|
28
|
+
constructor(host: string, pkg: string, options?: Options);
|
|
22
29
|
request(service: string, method: string, data: any, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
23
30
|
headers: any, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
24
31
|
timeout?: number): Promise<any>;
|
package/dist/TwirpRPC.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { JsonValue } from '@bufbuild/protobuf';
|
|
2
|
+
type Options = {
|
|
3
|
+
/** Prefix for the RPC requests */
|
|
4
|
+
prefix?: string;
|
|
5
|
+
/** Timeout for fetch requests, in seconds. Must be within the valid range for abort signal timeouts. */
|
|
6
|
+
requestTimeout?: number;
|
|
7
|
+
};
|
|
2
8
|
export declare const livekitPackage = "livekit";
|
|
3
9
|
export interface Rpc {
|
|
4
10
|
request(service: string, method: string, data: JsonValue, headers: any, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
@@ -17,9 +23,11 @@ export declare class TwirpRpc {
|
|
|
17
23
|
host: string;
|
|
18
24
|
pkg: string;
|
|
19
25
|
prefix: string;
|
|
20
|
-
|
|
26
|
+
requestTimeout: number;
|
|
27
|
+
constructor(host: string, pkg: string, options?: Options);
|
|
21
28
|
request(service: string, method: string, data: any, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
22
29
|
headers: any, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
23
30
|
timeout?: number): Promise<any>;
|
|
24
31
|
}
|
|
32
|
+
export {};
|
|
25
33
|
//# sourceMappingURL=TwirpRPC.d.ts.map
|
package/dist/TwirpRPC.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TwirpRPC.d.ts","sourceRoot":"","sources":["../src/TwirpRPC.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"TwirpRPC.d.ts","sourceRoot":"","sources":["../src/TwirpRPC.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB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irp";
|
|
2
|
+
const defaultTimeoutSeconds = 60;
|
|
2
3
|
const livekitPackage = "livekit";
|
|
3
4
|
class TwirpError extends Error {
|
|
4
5
|
constructor(name, message, status, code, metadata) {
|
|
@@ -10,15 +11,16 @@ class TwirpError extends Error {
|
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
class TwirpRpc {
|
|
13
|
-
constructor(host, pkg,
|
|
14
|
+
constructor(host, pkg, options) {
|
|
14
15
|
if (host.startsWith("ws")) {
|
|
15
16
|
host = host.replace("ws", "http");
|
|
16
17
|
}
|
|
17
18
|
this.host = host;
|
|
18
19
|
this.pkg = pkg;
|
|
19
|
-
this.
|
|
20
|
+
this.requestTimeout = (options == null ? void 0 : options.requestTimeout) ?? defaultTimeoutSeconds;
|
|
21
|
+
this.prefix = (options == null ? void 0 : options.prefix) || defaultPrefix;
|
|
20
22
|
}
|
|
21
|
-
async request(service, method, data, headers, timeout =
|
|
23
|
+
async request(service, method, data, headers, timeout = this.requestTimeout) {
|
|
22
24
|
const path = `${this.prefix}/${this.pkg}.${service}/${method}`;
|
|
23
25
|
const url = new URL(path, this.host);
|
|
24
26
|
const init = {
|
package/dist/TwirpRPC.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/TwirpRPC.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { JsonValue } from '@bufbuild/protobuf';\n\n// twirp RPC adapter for client implementation\n\nconst defaultPrefix = '/twirp';\n\nexport const livekitPackage = 'livekit';\nexport interface Rpc {\n request(\n service: string,\n method: string,\n data: JsonValue,\n headers: any, // eslint-disable-line @typescript-eslint/no-explicit-any\n timeout?: number,\n ): Promise<string>;\n}\n\nexport class TwirpError extends Error {\n status: number;\n code?: string;\n metadata?: Record<string, string>;\n\n constructor(\n name: string,\n message: string,\n status: number,\n code?: string,\n metadata?: Record<string, string>,\n ) {\n super(message);\n this.name = name;\n this.status = status;\n this.code = code;\n this.metadata = metadata;\n }\n}\n\n/**\n * JSON based Twirp V7 RPC\n */\nexport class TwirpRpc {\n host: string;\n\n pkg: string;\n\n prefix: string;\n\n constructor(host: string, pkg: string,
|
|
1
|
+
{"version":3,"sources":["../src/TwirpRPC.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { JsonValue } from '@bufbuild/protobuf';\n\n// twirp RPC adapter for client implementation\n\ntype Options = {\n /** Prefix for the RPC requests */\n prefix?: string;\n /** Timeout for fetch requests, in seconds. Must be within the valid range for abort signal timeouts. */\n requestTimeout?: number;\n};\n\nconst defaultPrefix = '/twirp';\nconst defaultTimeoutSeconds = 60;\n\nexport const livekitPackage = 'livekit';\nexport interface Rpc {\n request(\n service: string,\n method: string,\n data: JsonValue,\n headers: any, // eslint-disable-line @typescript-eslint/no-explicit-any\n timeout?: number,\n ): Promise<string>;\n}\n\nexport class TwirpError extends Error {\n status: number;\n code?: string;\n metadata?: Record<string, string>;\n\n constructor(\n name: string,\n message: string,\n status: number,\n code?: string,\n metadata?: Record<string, string>,\n ) {\n super(message);\n this.name = name;\n this.status = status;\n this.code = code;\n this.metadata = metadata;\n }\n}\n\n/**\n * JSON based Twirp V7 RPC\n */\nexport class TwirpRpc {\n host: string;\n\n pkg: string;\n\n prefix: string;\n\n requestTimeout: number;\n\n constructor(host: string, pkg: string, options?: Options) {\n if (host.startsWith('ws')) {\n host = host.replace('ws', 'http');\n }\n this.host = host;\n this.pkg = pkg;\n this.requestTimeout = options?.requestTimeout ?? defaultTimeoutSeconds;\n this.prefix = options?.prefix || defaultPrefix;\n }\n\n async request(\n service: string,\n method: string,\n data: any, // eslint-disable-line @typescript-eslint/no-explicit-any\n headers: any, // eslint-disable-line @typescript-eslint/no-explicit-any\n timeout = this.requestTimeout,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<any> {\n const path = `${this.prefix}/${this.pkg}.${service}/${method}`;\n const url = new URL(path, this.host);\n const init: RequestInit = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json;charset=UTF-8',\n ...headers,\n },\n body: JSON.stringify(data),\n };\n\n if (timeout) {\n init.signal = AbortSignal.timeout(timeout * 1000);\n }\n\n const response = await fetch(url, init);\n\n if (!response.ok) {\n const isJson = response.headers.get('content-type') === 'application/json';\n let errorMessage = 'Unknown internal error';\n let errorCode: string | undefined = undefined;\n let metadata: Record<string, string> | undefined = undefined;\n try {\n if (isJson) {\n const parsedError = (await response.json()) as Record<string, unknown>;\n if ('msg' in parsedError) {\n errorMessage = <string>parsedError.msg;\n }\n if ('code' in parsedError) {\n errorCode = <string>parsedError.code;\n }\n if ('meta' in parsedError) {\n metadata = <Record<string, string>>parsedError.meta;\n }\n } else {\n errorMessage = await response.text();\n }\n } catch (e) {\n // parsing went wrong, no op and we keep default error message\n console.debug(`Error when trying to parse error message, using defaults`, e);\n }\n\n throw new TwirpError(response.statusText, errorMessage, response.status, errorCode, metadata);\n }\n const parsedResp = (await response.json()) as Record<string, unknown>;\n\n const camelcaseKeys = await import('camelcase-keys').then((mod) => mod.default);\n return camelcaseKeys(parsedResp, { deep: true });\n }\n}\n"],"mappings":"AAcA,MAAM,gBAAgB;AACtB,MAAM,wBAAwB;AAEvB,MAAM,iBAAiB;AAWvB,MAAM,mBAAmB,MAAM;AAAA,EAKpC,YACE,MACA,SACA,QACA,MACA,UACA;AACA,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO;AACZ,SAAK,WAAW;AAAA,EAClB;AACF;AAKO,MAAM,SAAS;AAAA,EASpB,YAAY,MAAc,KAAa,SAAmB;AACxD,QAAI,KAAK,WAAW,IAAI,GAAG;AACzB,aAAO,KAAK,QAAQ,MAAM,MAAM;AAAA,IAClC;AACA,SAAK,OAAO;AACZ,SAAK,MAAM;AACX,SAAK,kBAAiB,mCAAS,mBAAkB;AACjD,SAAK,UAAS,mC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;AACF;","names":[]}
|
package/dist/grants.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/grants.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { RoomConfiguration } from '@livekit/protocol';\nimport { TrackSource } from '@livekit/protocol';\nimport type { JWTPayload } from 'jose';\n\nexport function trackSourceToString(source: TrackSource) {\n switch (source) {\n case TrackSource.CAMERA:\n return 'camera';\n case TrackSource.MICROPHONE:\n return 'microphone';\n case TrackSource.SCREEN_SHARE:\n return 'screen_share';\n case TrackSource.SCREEN_SHARE_AUDIO:\n return 'screen_share_audio';\n default:\n throw new TypeError(`Cannot convert TrackSource ${source} to string`);\n }\n}\n\nexport function claimsToJwtPayload(\n grant: ClaimGrants,\n): JWTPayload & { video?: Record<string, unknown> } {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const claim: Record<string, any> = { ...grant };\n // eslint-disable-next-line no-restricted-syntax\n if (Array.isArray(claim.video?.canPublishSources)) {\n claim.video.canPublishSources = claim.video.canPublishSources.map(trackSourceToString);\n }\n return claim;\n}\n\nexport interface VideoGrant {\n /** permission to create a room */\n roomCreate?: boolean;\n\n /** permission to join a room as a participant, room must be set */\n roomJoin?: boolean;\n\n /** permission to list rooms */\n roomList?: boolean;\n\n /** permission to start a recording */\n roomRecord?: boolean;\n\n /** permission to control a specific room, room must be set */\n roomAdmin?: boolean;\n\n /** name of the room, must be set for admin or join permissions */\n room?: string;\n\n /** permissions to control ingress, not specific to any room or ingress */\n ingressAdmin?: boolean;\n\n /**\n * allow participant to publish. If neither canPublish or canSubscribe is set,\n * both publish and subscribe are enabled\n */\n canPublish?: boolean;\n\n /**\n * TrackSource types that the participant is allowed to publish\n * When set, it supersedes CanPublish. Only sources explicitly set here can be published\n */\n canPublishSources?: TrackSource[];\n\n /** allow participant to subscribe to other tracks */\n canSubscribe?: boolean;\n\n /**\n * allow participants to publish data, defaults to true if not set\n */\n canPublishData?: boolean;\n\n /**\n * by default, a participant is not allowed to update its own metadata\n */\n canUpdateOwnMetadata?: boolean;\n\n /** participant isn't visible to others */\n hidden?: boolean;\n\n /** participant is recording the room, when set, allows room to indicate it's being recorded */\n recorder?: boolean;\n\n /** participant allowed to connect to LiveKit as Agent Framework worker */\n agent?: boolean;\n\n /** allow participant to subscribe to metrics */\n canSubscribeMetrics?: boolean;\n\n /** destination room which this participant can forward to */\n destinationRoom?: string;\n}\n\nexport interface SIPGrant {\n /** manage sip resources */\n admin?: boolean;\n\n /** make outbound calls */\n call?: boolean;\n}\n\nexport interface InferenceGrant {\n /** perform inference */\n perform?: boolean;\n}\n\n/** @internal */\nexport interface ClaimGrants extends JWTPayload {\n name?: string;\n video?: VideoGrant;\n sip?: SIPGrant;\n inference?: InferenceGrant;\n kind?: string;\n metadata?: string;\n attributes?: Record<string, string>;\n sha256?: string;\n roomPreset?: string;\n roomConfig?: RoomConfiguration;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAA4B;AAGrB,SAAS,oBAAoB,QAAqB;AACvD,UAAQ,QAAQ;AAAA,IACd,KAAK,4BAAY;AACf,aAAO;AAAA,IACT,KAAK,4BAAY;AACf,aAAO;AAAA,IACT,KAAK,4BAAY;AACf,aAAO;AAAA,IACT,KAAK,4BAAY;AACf,aAAO;AAAA,IACT;AACE,YAAM,IAAI,UAAU,8BAA8B,MAAM,YAAY;AAAA,EACxE;AACF;AAEO,SAAS,mBACd,OACkD;AAxBpD;AA0BE,QAAM,QAA6B,EAAE,GAAG,MAAM;AAE9C,MAAI,MAAM,SAAQ,WAAM,UAAN,mBAAa,iBAAiB,GAAG;AACjD,UAAM,MAAM,oBAAoB,MAAM,MAAM,kBAAkB,IAAI,mBAAmB;AAAA,EACvF;AACA,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/grants.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { RoomConfiguration } from '@livekit/protocol';\nimport { TrackSource } from '@livekit/protocol';\nimport type { JWTPayload } from 'jose';\n\nexport function trackSourceToString(source: TrackSource) {\n switch (source) {\n case TrackSource.CAMERA:\n return 'camera';\n case TrackSource.MICROPHONE:\n return 'microphone';\n case TrackSource.SCREEN_SHARE:\n return 'screen_share';\n case TrackSource.SCREEN_SHARE_AUDIO:\n return 'screen_share_audio';\n default:\n throw new TypeError(`Cannot convert TrackSource ${source} to string`);\n }\n}\n\nexport function claimsToJwtPayload(\n grant: ClaimGrants,\n): JWTPayload & { video?: Record<string, unknown> } {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const claim: Record<string, any> = { ...grant };\n // eslint-disable-next-line no-restricted-syntax\n if (Array.isArray(claim.video?.canPublishSources)) {\n claim.video.canPublishSources = claim.video.canPublishSources.map(trackSourceToString);\n }\n return claim;\n}\n\nexport interface VideoGrant {\n /** permission to create a room */\n roomCreate?: boolean;\n\n /** permission to join a room as a participant, room must be set */\n roomJoin?: boolean;\n\n /** permission to list rooms */\n roomList?: boolean;\n\n /** permission to start a recording */\n roomRecord?: boolean;\n\n /** permission to control a specific room, room must be set */\n roomAdmin?: boolean;\n\n /** name of the room, must be set for admin or join permissions */\n room?: string;\n\n /** permissions to control ingress, not specific to any room or ingress */\n ingressAdmin?: boolean;\n\n /**\n * allow participant to publish. If neither canPublish or canSubscribe is set,\n * both publish and subscribe are enabled\n */\n canPublish?: boolean;\n\n /**\n * TrackSource types that the participant is allowed to publish\n * When set, it supersedes CanPublish. Only sources explicitly set here can be published\n */\n canPublishSources?: TrackSource[];\n\n /** allow participant to subscribe to other tracks */\n canSubscribe?: boolean;\n\n /**\n * allow participants to publish data, defaults to true if not set\n */\n canPublishData?: boolean;\n\n /**\n * by default, a participant is not allowed to update its own metadata\n */\n canUpdateOwnMetadata?: boolean;\n\n /** participant isn't visible to others */\n hidden?: boolean;\n\n /** participant is recording the room, when set, allows room to indicate it's being recorded */\n recorder?: boolean;\n\n /** participant allowed to connect to LiveKit as Agent Framework worker */\n agent?: boolean;\n\n /** allow participant to subscribe to metrics */\n canSubscribeMetrics?: boolean;\n\n /** destination room which this participant can forward to */\n destinationRoom?: string;\n}\n\nexport interface SIPGrant {\n /** manage sip resources */\n admin?: boolean;\n\n /** make outbound calls */\n call?: boolean;\n}\n\nexport interface InferenceGrant {\n /** perform inference */\n perform?: boolean;\n}\n\nexport interface ObservabilityGrant {\n /** write grants to publish observability data */\n write?: boolean;\n}\n\n/** @internal */\nexport interface ClaimGrants extends JWTPayload {\n name?: string;\n video?: VideoGrant;\n sip?: SIPGrant;\n inference?: InferenceGrant;\n observability?: ObservabilityGrant;\n kind?: string;\n metadata?: string;\n attributes?: Record<string, string>;\n sha256?: string;\n roomPreset?: string;\n roomConfig?: RoomConfiguration;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAA4B;AAGrB,SAAS,oBAAoB,QAAqB;AACvD,UAAQ,QAAQ;AAAA,IACd,KAAK,4BAAY;AACf,aAAO;AAAA,IACT,KAAK,4BAAY;AACf,aAAO;AAAA,IACT,KAAK,4BAAY;AACf,aAAO;AAAA,IACT,KAAK,4BAAY;AACf,aAAO;AAAA,IACT;AACE,YAAM,IAAI,UAAU,8BAA8B,MAAM,YAAY;AAAA,EACxE;AACF;AAEO,SAAS,mBACd,OACkD;AAxBpD;AA0BE,QAAM,QAA6B,EAAE,GAAG,MAAM;AAE9C,MAAI,MAAM,SAAQ,WAAM,UAAN,mBAAa,iBAAiB,GAAG;AACjD,UAAM,MAAM,oBAAoB,MAAM,MAAM,kBAAkB,IAAI,mBAAmB;AAAA,EACvF;AACA,SAAO;AACT;","names":[]}
|
package/dist/grants.d.cts
CHANGED
|
@@ -61,12 +61,17 @@ interface InferenceGrant {
|
|
|
61
61
|
/** perform inference */
|
|
62
62
|
perform?: boolean;
|
|
63
63
|
}
|
|
64
|
+
interface ObservabilityGrant {
|
|
65
|
+
/** write grants to publish observability data */
|
|
66
|
+
write?: boolean;
|
|
67
|
+
}
|
|
64
68
|
/** @internal */
|
|
65
69
|
interface ClaimGrants extends JWTPayload {
|
|
66
70
|
name?: string;
|
|
67
71
|
video?: VideoGrant;
|
|
68
72
|
sip?: SIPGrant;
|
|
69
73
|
inference?: InferenceGrant;
|
|
74
|
+
observability?: ObservabilityGrant;
|
|
70
75
|
kind?: string;
|
|
71
76
|
metadata?: string;
|
|
72
77
|
attributes?: Record<string, string>;
|
|
@@ -75,4 +80,4 @@ interface ClaimGrants extends JWTPayload {
|
|
|
75
80
|
roomConfig?: RoomConfiguration;
|
|
76
81
|
}
|
|
77
82
|
|
|
78
|
-
export { type ClaimGrants, type InferenceGrant, type SIPGrant, type VideoGrant, claimsToJwtPayload, trackSourceToString };
|
|
83
|
+
export { type ClaimGrants, type InferenceGrant, type ObservabilityGrant, type SIPGrant, type VideoGrant, claimsToJwtPayload, trackSourceToString };
|
package/dist/grants.d.ts
CHANGED
|
@@ -61,12 +61,17 @@ export interface InferenceGrant {
|
|
|
61
61
|
/** perform inference */
|
|
62
62
|
perform?: boolean;
|
|
63
63
|
}
|
|
64
|
+
export interface ObservabilityGrant {
|
|
65
|
+
/** write grants to publish observability data */
|
|
66
|
+
write?: boolean;
|
|
67
|
+
}
|
|
64
68
|
/** @internal */
|
|
65
69
|
export interface ClaimGrants extends JWTPayload {
|
|
66
70
|
name?: string;
|
|
67
71
|
video?: VideoGrant;
|
|
68
72
|
sip?: SIPGrant;
|
|
69
73
|
inference?: InferenceGrant;
|
|
74
|
+
observability?: ObservabilityGrant;
|
|
70
75
|
kind?: string;
|
|
71
76
|
metadata?: string;
|
|
72
77
|
attributes?: Record<string, string>;
|
package/dist/grants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grants.d.ts","sourceRoot":"","sources":["../src/grants.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EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,iBAAiB,CAAC;CAChC"}
|
package/dist/grants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/grants.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { RoomConfiguration } from '@livekit/protocol';\nimport { TrackSource } from '@livekit/protocol';\nimport type { JWTPayload } from 'jose';\n\nexport function trackSourceToString(source: TrackSource) {\n switch (source) {\n case TrackSource.CAMERA:\n return 'camera';\n case TrackSource.MICROPHONE:\n return 'microphone';\n case TrackSource.SCREEN_SHARE:\n return 'screen_share';\n case TrackSource.SCREEN_SHARE_AUDIO:\n return 'screen_share_audio';\n default:\n throw new TypeError(`Cannot convert TrackSource ${source} to string`);\n }\n}\n\nexport function claimsToJwtPayload(\n grant: ClaimGrants,\n): JWTPayload & { video?: Record<string, unknown> } {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const claim: Record<string, any> = { ...grant };\n // eslint-disable-next-line no-restricted-syntax\n if (Array.isArray(claim.video?.canPublishSources)) {\n claim.video.canPublishSources = claim.video.canPublishSources.map(trackSourceToString);\n }\n return claim;\n}\n\nexport interface VideoGrant {\n /** permission to create a room */\n roomCreate?: boolean;\n\n /** permission to join a room as a participant, room must be set */\n roomJoin?: boolean;\n\n /** permission to list rooms */\n roomList?: boolean;\n\n /** permission to start a recording */\n roomRecord?: boolean;\n\n /** permission to control a specific room, room must be set */\n roomAdmin?: boolean;\n\n /** name of the room, must be set for admin or join permissions */\n room?: string;\n\n /** permissions to control ingress, not specific to any room or ingress */\n ingressAdmin?: boolean;\n\n /**\n * allow participant to publish. If neither canPublish or canSubscribe is set,\n * both publish and subscribe are enabled\n */\n canPublish?: boolean;\n\n /**\n * TrackSource types that the participant is allowed to publish\n * When set, it supersedes CanPublish. Only sources explicitly set here can be published\n */\n canPublishSources?: TrackSource[];\n\n /** allow participant to subscribe to other tracks */\n canSubscribe?: boolean;\n\n /**\n * allow participants to publish data, defaults to true if not set\n */\n canPublishData?: boolean;\n\n /**\n * by default, a participant is not allowed to update its own metadata\n */\n canUpdateOwnMetadata?: boolean;\n\n /** participant isn't visible to others */\n hidden?: boolean;\n\n /** participant is recording the room, when set, allows room to indicate it's being recorded */\n recorder?: boolean;\n\n /** participant allowed to connect to LiveKit as Agent Framework worker */\n agent?: boolean;\n\n /** allow participant to subscribe to metrics */\n canSubscribeMetrics?: boolean;\n\n /** destination room which this participant can forward to */\n destinationRoom?: string;\n}\n\nexport interface SIPGrant {\n /** manage sip resources */\n admin?: boolean;\n\n /** make outbound calls */\n call?: boolean;\n}\n\nexport interface InferenceGrant {\n /** perform inference */\n perform?: boolean;\n}\n\n/** @internal */\nexport interface ClaimGrants extends JWTPayload {\n name?: string;\n video?: VideoGrant;\n sip?: SIPGrant;\n inference?: InferenceGrant;\n kind?: string;\n metadata?: string;\n attributes?: Record<string, string>;\n sha256?: string;\n roomPreset?: string;\n roomConfig?: RoomConfiguration;\n}\n"],"mappings":"AAIA,SAAS,mBAAmB;AAGrB,SAAS,oBAAoB,QAAqB;AACvD,UAAQ,QAAQ;AAAA,IACd,KAAK,YAAY;AACf,aAAO;AAAA,IACT,KAAK,YAAY;AACf,aAAO;AAAA,IACT,KAAK,YAAY;AACf,aAAO;AAAA,IACT,KAAK,YAAY;AACf,aAAO;AAAA,IACT;AACE,YAAM,IAAI,UAAU,8BAA8B,MAAM,YAAY;AAAA,EACxE;AACF;AAEO,SAAS,mBACd,OACkD;AAxBpD;AA0BE,QAAM,QAA6B,EAAE,GAAG,MAAM;AAE9C,MAAI,MAAM,SAAQ,WAAM,UAAN,mBAAa,iBAAiB,GAAG;AACjD,UAAM,MAAM,oBAAoB,MAAM,MAAM,kBAAkB,IAAI,mBAAmB;AAAA,EACvF;AACA,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/grants.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { RoomConfiguration } from '@livekit/protocol';\nimport { TrackSource } from '@livekit/protocol';\nimport type { JWTPayload } from 'jose';\n\nexport function trackSourceToString(source: TrackSource) {\n switch (source) {\n case TrackSource.CAMERA:\n return 'camera';\n case TrackSource.MICROPHONE:\n return 'microphone';\n case TrackSource.SCREEN_SHARE:\n return 'screen_share';\n case TrackSource.SCREEN_SHARE_AUDIO:\n return 'screen_share_audio';\n default:\n throw new TypeError(`Cannot convert TrackSource ${source} to string`);\n }\n}\n\nexport function claimsToJwtPayload(\n grant: ClaimGrants,\n): JWTPayload & { video?: Record<string, unknown> } {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const claim: Record<string, any> = { ...grant };\n // eslint-disable-next-line no-restricted-syntax\n if (Array.isArray(claim.video?.canPublishSources)) {\n claim.video.canPublishSources = claim.video.canPublishSources.map(trackSourceToString);\n }\n return claim;\n}\n\nexport interface VideoGrant {\n /** permission to create a room */\n roomCreate?: boolean;\n\n /** permission to join a room as a participant, room must be set */\n roomJoin?: boolean;\n\n /** permission to list rooms */\n roomList?: boolean;\n\n /** permission to start a recording */\n roomRecord?: boolean;\n\n /** permission to control a specific room, room must be set */\n roomAdmin?: boolean;\n\n /** name of the room, must be set for admin or join permissions */\n room?: string;\n\n /** permissions to control ingress, not specific to any room or ingress */\n ingressAdmin?: boolean;\n\n /**\n * allow participant to publish. If neither canPublish or canSubscribe is set,\n * both publish and subscribe are enabled\n */\n canPublish?: boolean;\n\n /**\n * TrackSource types that the participant is allowed to publish\n * When set, it supersedes CanPublish. Only sources explicitly set here can be published\n */\n canPublishSources?: TrackSource[];\n\n /** allow participant to subscribe to other tracks */\n canSubscribe?: boolean;\n\n /**\n * allow participants to publish data, defaults to true if not set\n */\n canPublishData?: boolean;\n\n /**\n * by default, a participant is not allowed to update its own metadata\n */\n canUpdateOwnMetadata?: boolean;\n\n /** participant isn't visible to others */\n hidden?: boolean;\n\n /** participant is recording the room, when set, allows room to indicate it's being recorded */\n recorder?: boolean;\n\n /** participant allowed to connect to LiveKit as Agent Framework worker */\n agent?: boolean;\n\n /** allow participant to subscribe to metrics */\n canSubscribeMetrics?: boolean;\n\n /** destination room which this participant can forward to */\n destinationRoom?: string;\n}\n\nexport interface SIPGrant {\n /** manage sip resources */\n admin?: boolean;\n\n /** make outbound calls */\n call?: boolean;\n}\n\nexport interface InferenceGrant {\n /** perform inference */\n perform?: boolean;\n}\n\nexport interface ObservabilityGrant {\n /** write grants to publish observability data */\n write?: boolean;\n}\n\n/** @internal */\nexport interface ClaimGrants extends JWTPayload {\n name?: string;\n video?: VideoGrant;\n sip?: SIPGrant;\n inference?: InferenceGrant;\n observability?: ObservabilityGrant;\n kind?: string;\n metadata?: string;\n attributes?: Record<string, string>;\n sha256?: string;\n roomPreset?: string;\n roomConfig?: RoomConfiguration;\n}\n"],"mappings":"AAIA,SAAS,mBAAmB;AAGrB,SAAS,oBAAoB,QAAqB;AACvD,UAAQ,QAAQ;AAAA,IACd,KAAK,YAAY;AACf,aAAO;AAAA,IACT,KAAK,YAAY;AACf,aAAO;AAAA,IACT,KAAK,YAAY;AACf,aAAO;AAAA,IACT,KAAK,YAAY;AACf,aAAO;AAAA,IACT;AACE,YAAM,IAAI,UAAU,8BAA8B,MAAM,YAAY;AAAA,EACxE;AACF;AAEO,SAAS,mBACd,OACkD;AAxBpD;AA0BE,QAAM,QAA6B,EAAE,GAAG,MAAM;AAE9C,MAAI,MAAM,SAAQ,WAAM,UAAN,mBAAa,iBAAiB,GAAG;AACjD,UAAM,MAAM,oBAAoB,MAAM,MAAM,kBAAkB,IAAI,mBAAmB;AAAA,EACvF;AACA,SAAO;AACT;","names":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -50,6 +50,7 @@ __export(index_exports, {
|
|
|
50
50
|
ParticipantInfo_State: () => import_protocol.ParticipantInfo_State,
|
|
51
51
|
ParticipantPermission: () => import_protocol.ParticipantPermission,
|
|
52
52
|
Room: () => import_protocol.Room,
|
|
53
|
+
RoomAgentDispatch: () => import_protocol.RoomAgentDispatch,
|
|
53
54
|
RoomCompositeEgressRequest: () => import_protocol.RoomCompositeEgressRequest,
|
|
54
55
|
RoomEgress: () => import_protocol.RoomEgress,
|
|
55
56
|
S3Upload: () => import_protocol.S3Upload,
|
|
@@ -112,6 +113,7 @@ __reExport(index_exports, require("./WebhookReceiver.cjs"), module.exports);
|
|
|
112
113
|
ParticipantInfo_State,
|
|
113
114
|
ParticipantPermission,
|
|
114
115
|
Room,
|
|
116
|
+
RoomAgentDispatch,
|
|
115
117
|
RoomCompositeEgressRequest,
|
|
116
118
|
RoomEgress,
|
|
117
119
|
S3Upload,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\nexport {\n AliOSSUpload,\n AudioCodec,\n AutoParticipantEgress,\n AutoTrackEgress,\n AzureBlobUpload,\n DataPacket_Kind,\n DirectFileOutput,\n EgressInfo,\n EgressStatus,\n EncodedFileOutput,\n EncodedFileType,\n EncodingOptions,\n EncodingOptionsPreset,\n GCPUpload,\n ImageCodec,\n ImageFileSuffix,\n ImageOutput,\n IngressAudioEncodingOptions,\n IngressAudioEncodingPreset,\n IngressAudioOptions,\n IngressInfo,\n IngressInput,\n IngressState,\n IngressVideoEncodingOptions,\n IngressVideoEncodingPreset,\n IngressVideoOptions,\n ParticipantEgressRequest,\n ParticipantInfo,\n ParticipantInfo_State,\n ParticipantPermission,\n Room,\n RoomCompositeEgressRequest,\n RoomEgress,\n S3Upload,\n SIPDispatchRuleInfo,\n SIPParticipantInfo,\n SIPTrunkInfo,\n SegmentedFileOutput,\n SegmentedFileProtocol,\n StreamOutput,\n StreamProtocol,\n TrackCompositeEgressRequest,\n TrackEgressRequest,\n TrackInfo,\n TrackSource,\n TrackType,\n WebEgressRequest,\n VideoCodec,\n WebhookConfig,\n} from '@livekit/protocol';\nexport * from './AccessToken.js';\nexport * from './AgentDispatchClient.js';\nexport * from './EgressClient.js';\nexport * from './grants.js';\nexport * from './IngressClient.js';\nexport * from './RoomServiceClient.js';\nexport * from './SipClient.js';\nexport * from './WebhookReceiver.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\nexport {\n AliOSSUpload,\n AudioCodec,\n AutoParticipantEgress,\n AutoTrackEgress,\n AzureBlobUpload,\n DataPacket_Kind,\n DirectFileOutput,\n EgressInfo,\n EgressStatus,\n EncodedFileOutput,\n EncodedFileType,\n EncodingOptions,\n EncodingOptionsPreset,\n GCPUpload,\n ImageCodec,\n ImageFileSuffix,\n ImageOutput,\n IngressAudioEncodingOptions,\n IngressAudioEncodingPreset,\n IngressAudioOptions,\n IngressInfo,\n IngressInput,\n IngressState,\n IngressVideoEncodingOptions,\n IngressVideoEncodingPreset,\n IngressVideoOptions,\n ParticipantEgressRequest,\n ParticipantInfo,\n ParticipantInfo_State,\n ParticipantPermission,\n Room,\n RoomAgentDispatch,\n RoomCompositeEgressRequest,\n RoomEgress,\n S3Upload,\n SIPDispatchRuleInfo,\n SIPParticipantInfo,\n SIPTrunkInfo,\n SegmentedFileOutput,\n SegmentedFileProtocol,\n StreamOutput,\n StreamProtocol,\n TrackCompositeEgressRequest,\n TrackEgressRequest,\n TrackInfo,\n TrackSource,\n TrackType,\n WebEgressRequest,\n VideoCodec,\n WebhookConfig,\n} from '@livekit/protocol';\nexport * from './AccessToken.js';\nexport * from './AgentDispatchClient.js';\nexport * from './EgressClient.js';\nexport * from './grants.js';\nexport * from './IngressClient.js';\nexport * from './RoomServiceClient.js';\nexport * from './SipClient.js';\nexport * from './WebhookReceiver.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAmDO;AACP,0BAAc,6BAxDd;AAyDA,0BAAc,qCAzDd;AA0DA,0BAAc,8BA1Dd;AA2DA,0BAAc,wBA3Dd;AA4DA,0BAAc,+BA5Dd;AA6DA,0BAAc,mCA7Dd;AA8DA,0BAAc,2BA9Dd;AA+DA,0BAAc,iCA/Dd;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export { AliOSSUpload, AudioCodec, AutoParticipantEgress, AutoTrackEgress, AzureBlobUpload, DataPacket_Kind, DirectFileOutput, EgressInfo, EgressStatus, EncodedFileOutput, EncodedFileType, EncodingOptions, EncodingOptionsPreset, GCPUpload, ImageCodec, ImageFileSuffix, ImageOutput, IngressAudioEncodingOptions, IngressAudioEncodingPreset, IngressAudioOptions, IngressInfo, IngressInput, IngressState, IngressVideoEncodingOptions, IngressVideoEncodingPreset, IngressVideoOptions, ParticipantEgressRequest, ParticipantInfo, ParticipantInfo_State, ParticipantPermission, Room, RoomCompositeEgressRequest, RoomEgress, S3Upload, SIPDispatchRuleInfo, SIPParticipantInfo, SIPTrunkInfo, SegmentedFileOutput, SegmentedFileProtocol, StreamOutput, StreamProtocol, TrackCompositeEgressRequest, TrackEgressRequest, TrackInfo, TrackSource, TrackType, VideoCodec, WebEgressRequest, WebhookConfig } from '@livekit/protocol';
|
|
1
|
+
export { AliOSSUpload, AudioCodec, AutoParticipantEgress, AutoTrackEgress, AzureBlobUpload, DataPacket_Kind, DirectFileOutput, EgressInfo, EgressStatus, EncodedFileOutput, EncodedFileType, EncodingOptions, EncodingOptionsPreset, GCPUpload, ImageCodec, ImageFileSuffix, ImageOutput, IngressAudioEncodingOptions, IngressAudioEncodingPreset, IngressAudioOptions, IngressInfo, IngressInput, IngressState, IngressVideoEncodingOptions, IngressVideoEncodingPreset, IngressVideoOptions, ParticipantEgressRequest, ParticipantInfo, ParticipantInfo_State, ParticipantPermission, Room, RoomAgentDispatch, RoomCompositeEgressRequest, RoomEgress, S3Upload, SIPDispatchRuleInfo, SIPParticipantInfo, SIPTrunkInfo, SegmentedFileOutput, SegmentedFileProtocol, StreamOutput, StreamProtocol, TrackCompositeEgressRequest, TrackEgressRequest, TrackInfo, TrackSource, TrackType, VideoCodec, WebEgressRequest, WebhookConfig } from '@livekit/protocol';
|
|
2
2
|
export { AccessToken, AccessTokenOptions, TokenVerifier } from './AccessToken.cjs';
|
|
3
3
|
export { AgentDispatchClient } from './AgentDispatchClient.cjs';
|
|
4
4
|
export { BaseOptions, EgressClient, EncodedOutputs, ListEgressOptions, ParticipantEgressOptions, RoomCompositeOptions, TrackCompositeOptions, WebOptions } from './EgressClient.cjs';
|
|
5
|
-
export { ClaimGrants, InferenceGrant, SIPGrant, VideoGrant, claimsToJwtPayload, trackSourceToString } from './grants.cjs';
|
|
5
|
+
export { ClaimGrants, InferenceGrant, ObservabilityGrant, SIPGrant, VideoGrant, claimsToJwtPayload, trackSourceToString } from './grants.cjs';
|
|
6
6
|
export { CreateIngressOptions, IngressClient, ListIngressOptions, UpdateIngressOptions } from './IngressClient.cjs';
|
|
7
7
|
export { CreateOptions, RoomServiceClient, SendDataOptions, UpdateParticipantOptions } from './RoomServiceClient.cjs';
|
|
8
8
|
export { CreateSipDispatchRuleOptions, CreateSipInboundTrunkOptions, CreateSipOutboundTrunkOptions, CreateSipParticipantOptions, CreateSipTrunkOptions, ListSipDispatchRuleOptions, ListSipTrunkOptions, SipClient, SipDispatchRuleDirect, SipDispatchRuleIndividual, SipDispatchRuleUpdateOptions, SipInboundTrunkUpdateOptions, SipOutboundTrunkUpdateOptions, TransferSipParticipantOptions } from './SipClient.cjs';
|
|
9
9
|
export { WebhookEvent, WebhookEventNames, WebhookReceiver, authorizeHeader } from './WebhookReceiver.cjs';
|
|
10
|
+
import './ClientOptions.cjs';
|
|
10
11
|
import './ServiceBase.cjs';
|
|
11
12
|
import 'jose';
|
|
12
13
|
import '@bufbuild/protobuf';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AliOSSUpload, AudioCodec, AutoParticipantEgress, AutoTrackEgress, AzureBlobUpload, DataPacket_Kind, DirectFileOutput, EgressInfo, EgressStatus, EncodedFileOutput, EncodedFileType, EncodingOptions, EncodingOptionsPreset, GCPUpload, ImageCodec, ImageFileSuffix, ImageOutput, IngressAudioEncodingOptions, IngressAudioEncodingPreset, IngressAudioOptions, IngressInfo, IngressInput, IngressState, IngressVideoEncodingOptions, IngressVideoEncodingPreset, IngressVideoOptions, ParticipantEgressRequest, ParticipantInfo, ParticipantInfo_State, ParticipantPermission, Room, RoomCompositeEgressRequest, RoomEgress, S3Upload, SIPDispatchRuleInfo, SIPParticipantInfo, SIPTrunkInfo, SegmentedFileOutput, SegmentedFileProtocol, StreamOutput, StreamProtocol, TrackCompositeEgressRequest, TrackEgressRequest, TrackInfo, TrackSource, TrackType, WebEgressRequest, VideoCodec, WebhookConfig, } from '@livekit/protocol';
|
|
1
|
+
export { AliOSSUpload, AudioCodec, AutoParticipantEgress, AutoTrackEgress, AzureBlobUpload, DataPacket_Kind, DirectFileOutput, EgressInfo, EgressStatus, EncodedFileOutput, EncodedFileType, EncodingOptions, EncodingOptionsPreset, GCPUpload, ImageCodec, ImageFileSuffix, ImageOutput, IngressAudioEncodingOptions, IngressAudioEncodingPreset, IngressAudioOptions, IngressInfo, IngressInput, IngressState, IngressVideoEncodingOptions, IngressVideoEncodingPreset, IngressVideoOptions, ParticipantEgressRequest, ParticipantInfo, ParticipantInfo_State, ParticipantPermission, Room, RoomAgentDispatch, RoomCompositeEgressRequest, RoomEgress, S3Upload, SIPDispatchRuleInfo, SIPParticipantInfo, SIPTrunkInfo, SegmentedFileOutput, SegmentedFileProtocol, StreamOutput, StreamProtocol, TrackCompositeEgressRequest, TrackEgressRequest, TrackInfo, TrackSource, TrackType, WebEgressRequest, VideoCodec, WebhookConfig, } from '@livekit/protocol';
|
|
2
2
|
export * from './AccessToken.js';
|
|
3
3
|
export * from './AgentDispatchClient.js';
|
|
4
4
|
export * from './EgressClient.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,EACX,2BAA2B,EAC3B,0BAA0B,EAC1B,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,2BAA2B,EAC3B,0BAA0B,EAC1B,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,IAAI,EACJ,0BAA0B,EAC1B,UAAU,EACV,QAAQ,EACR,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,2BAA2B,EAC3B,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,EACX,2BAA2B,EAC3B,0BAA0B,EAC1B,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,2BAA2B,EAC3B,0BAA0B,EAC1B,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,IAAI,EACJ,iBAAiB,EACjB,0BAA0B,EAC1B,UAAU,EACV,QAAQ,EACR,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,2BAA2B,EAC3B,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
ParticipantInfo_State,
|
|
31
31
|
ParticipantPermission,
|
|
32
32
|
Room,
|
|
33
|
+
RoomAgentDispatch,
|
|
33
34
|
RoomCompositeEgressRequest,
|
|
34
35
|
RoomEgress,
|
|
35
36
|
S3Upload,
|
|
@@ -89,6 +90,7 @@ export {
|
|
|
89
90
|
ParticipantInfo_State,
|
|
90
91
|
ParticipantPermission,
|
|
91
92
|
Room,
|
|
93
|
+
RoomAgentDispatch,
|
|
92
94
|
RoomCompositeEgressRequest,
|
|
93
95
|
RoomEgress,
|
|
94
96
|
S3Upload,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\nexport {\n AliOSSUpload,\n AudioCodec,\n AutoParticipantEgress,\n AutoTrackEgress,\n AzureBlobUpload,\n DataPacket_Kind,\n DirectFileOutput,\n EgressInfo,\n EgressStatus,\n EncodedFileOutput,\n EncodedFileType,\n EncodingOptions,\n EncodingOptionsPreset,\n GCPUpload,\n ImageCodec,\n ImageFileSuffix,\n ImageOutput,\n IngressAudioEncodingOptions,\n IngressAudioEncodingPreset,\n IngressAudioOptions,\n IngressInfo,\n IngressInput,\n IngressState,\n IngressVideoEncodingOptions,\n IngressVideoEncodingPreset,\n IngressVideoOptions,\n ParticipantEgressRequest,\n ParticipantInfo,\n ParticipantInfo_State,\n ParticipantPermission,\n Room,\n RoomCompositeEgressRequest,\n RoomEgress,\n S3Upload,\n SIPDispatchRuleInfo,\n SIPParticipantInfo,\n SIPTrunkInfo,\n SegmentedFileOutput,\n SegmentedFileProtocol,\n StreamOutput,\n StreamProtocol,\n TrackCompositeEgressRequest,\n TrackEgressRequest,\n TrackInfo,\n TrackSource,\n TrackType,\n WebEgressRequest,\n VideoCodec,\n WebhookConfig,\n} from '@livekit/protocol';\nexport * from './AccessToken.js';\nexport * from './AgentDispatchClient.js';\nexport * from './EgressClient.js';\nexport * from './grants.js';\nexport * from './IngressClient.js';\nexport * from './RoomServiceClient.js';\nexport * from './SipClient.js';\nexport * from './WebhookReceiver.js';\n"],"mappings":"AAIA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\nexport {\n AliOSSUpload,\n AudioCodec,\n AutoParticipantEgress,\n AutoTrackEgress,\n AzureBlobUpload,\n DataPacket_Kind,\n DirectFileOutput,\n EgressInfo,\n EgressStatus,\n EncodedFileOutput,\n EncodedFileType,\n EncodingOptions,\n EncodingOptionsPreset,\n GCPUpload,\n ImageCodec,\n ImageFileSuffix,\n ImageOutput,\n IngressAudioEncodingOptions,\n IngressAudioEncodingPreset,\n IngressAudioOptions,\n IngressInfo,\n IngressInput,\n IngressState,\n IngressVideoEncodingOptions,\n IngressVideoEncodingPreset,\n IngressVideoOptions,\n ParticipantEgressRequest,\n ParticipantInfo,\n ParticipantInfo_State,\n ParticipantPermission,\n Room,\n RoomAgentDispatch,\n RoomCompositeEgressRequest,\n RoomEgress,\n S3Upload,\n SIPDispatchRuleInfo,\n SIPParticipantInfo,\n SIPTrunkInfo,\n SegmentedFileOutput,\n SegmentedFileProtocol,\n StreamOutput,\n StreamProtocol,\n TrackCompositeEgressRequest,\n TrackEgressRequest,\n TrackInfo,\n TrackSource,\n TrackType,\n WebEgressRequest,\n VideoCodec,\n WebhookConfig,\n} from '@livekit/protocol';\nexport * from './AccessToken.js';\nexport * from './AgentDispatchClient.js';\nexport * from './EgressClient.js';\nexport * from './grants.js';\nexport * from './IngressClient.js';\nexport * from './RoomServiceClient.js';\nexport * from './SipClient.js';\nexport * from './WebhookReceiver.js';\n"],"mappings":"AAIA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "livekit-server-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.1",
|
|
4
4
|
"description": "Server-side SDK for LiveKit",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"require": "dist/index.cjs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@bufbuild/protobuf": "^1.10.1",
|
|
33
|
-
"@livekit/protocol": "^1.
|
|
33
|
+
"@livekit/protocol": "^1.42.0",
|
|
34
34
|
"camelcase-keys": "^9.0.0",
|
|
35
35
|
"jose": "^5.1.2"
|
|
36
36
|
},
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@edge-runtime/vm": "^5.0.0",
|
|
40
40
|
"@livekit/changesets-changelog-github": "^0.0.4",
|
|
41
41
|
"@types/node": "^20.10.1",
|
|
42
|
-
"happy-dom": "^
|
|
42
|
+
"happy-dom": "^20.0.0",
|
|
43
43
|
"prettier": "^3.0.0",
|
|
44
44
|
"tsup": "^8.3.5",
|
|
45
45
|
"typedoc": "^0.28.0",
|
package/src/AccessToken.ts
CHANGED
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import type { RoomConfiguration } from '@livekit/protocol';
|
|
5
5
|
import * as jose from 'jose';
|
|
6
|
-
import type {
|
|
6
|
+
import type {
|
|
7
|
+
ClaimGrants,
|
|
8
|
+
InferenceGrant,
|
|
9
|
+
ObservabilityGrant,
|
|
10
|
+
SIPGrant,
|
|
11
|
+
VideoGrant,
|
|
12
|
+
} from './grants.js';
|
|
7
13
|
import { claimsToJwtPayload } from './grants.js';
|
|
8
14
|
|
|
9
15
|
// 6 hours
|
|
@@ -118,6 +124,14 @@ export class AccessToken {
|
|
|
118
124
|
this.grants.sip = { ...(this.grants.sip ?? {}), ...grant };
|
|
119
125
|
}
|
|
120
126
|
|
|
127
|
+
/**
|
|
128
|
+
* Adds an observability grant to this token.
|
|
129
|
+
* @param grant -
|
|
130
|
+
*/
|
|
131
|
+
addObservabilityGrant(grant: ObservabilityGrant) {
|
|
132
|
+
this.grants.observability = { ...(this.grants.observability ?? {}), ...grant };
|
|
133
|
+
}
|
|
134
|
+
|
|
121
135
|
get name(): string | undefined {
|
|
122
136
|
return this.grants.name;
|
|
123
137
|
}
|