@signalwire/js
Advanced tools
Comparing version 3.28.0-dev.202407241358.62ba0f6.0 to 3.28.0-dev.202408051204.fe44c5d.0
@@ -10,3 +10,3 @@ import { type UserOptions } from '@signalwire/core'; | ||
get httpHost(): string; | ||
getAddress(params: GetAddressParams): Promise<GetAddressResult>; | ||
getAddress(params: GetAddressParams): Promise<GetAddressResult | undefined>; | ||
getAddresses(params?: GetAddressesParams): Promise<GetAddressesResult>; | ||
@@ -13,0 +13,0 @@ registerDevice(params: RegisterDeviceParams): Promise<RegisterDeviceResult>; |
@@ -157,5 +157,9 @@ import type { ConversationEventParams, UserOptions } from '@signalwire/core'; | ||
} | ||
export interface GetAddressParams { | ||
export interface GetAddressByIdParams { | ||
id: string; | ||
} | ||
export interface GetAddressByNameParams { | ||
name: string; | ||
} | ||
export declare type GetAddressParams = GetAddressByIdParams | GetAddressByNameParams; | ||
export declare type GetAddressResult = GetAddressResponse; | ||
@@ -162,0 +166,0 @@ export declare type GetAddressesResponse = PaginatedResponse<GetAddressResponse>; |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "3.28.0-dev.202407241358.62ba0f6.0", | ||
"version": "3.28.0-dev.202408051204.fe44c5d.0", | ||
"main": "dist/index.js", | ||
@@ -43,4 +43,4 @@ "module": "dist/index.esm.js", | ||
"dependencies": { | ||
"@signalwire/core": "4.2.0-dev.202407241358.62ba0f6.0", | ||
"@signalwire/webrtc": "3.12.2-dev.202407241358.62ba0f6.0", | ||
"@signalwire/core": "4.2.0-dev.202408051204.fe44c5d.0", | ||
"@signalwire/webrtc": "3.12.2-dev.202408051204.fe44c5d.0", | ||
"jwt-decode": "^3.1.2" | ||
@@ -47,0 +47,0 @@ }, |
@@ -19,2 +19,3 @@ import jwtDecode from 'jwt-decode' | ||
import { makeQueryParamsUrls } from '../utils/makeQueryParamsUrl' | ||
import { isGetAddressByIdParams, isGetAddressByNameParams, isGetAddressesResponse } from './utils/typeGuard' | ||
@@ -58,7 +59,16 @@ type JWTHeader = { ch?: string; typ?: string } | ||
public async getAddress(params: GetAddressParams): Promise<GetAddressResult> { | ||
const { id } = params | ||
let path = `/api/fabric/addresses/${id}` | ||
public async getAddress(params: GetAddressParams): Promise<GetAddressResult | undefined> { | ||
let path = '/api/fabric/addresses' | ||
if (isGetAddressByNameParams(params)) { | ||
path = `${path}?name=${params.name}` | ||
} else if (isGetAddressByIdParams(params)) { | ||
path = `${path}/${params.id}` | ||
} | ||
const { body } = await this.httpClient<GetAddressResponse>(path) | ||
const { body } = await this.httpClient<GetAddressResponse | GetAddressesResponse>(path) | ||
if (isGetAddressesResponse(body)) { | ||
// FIXME until the server handles a index lookup by name we need to handle it as a search result | ||
return body.data[0] | ||
} | ||
return body | ||
@@ -65,0 +75,0 @@ } |
@@ -180,6 +180,12 @@ import type { ConversationEventParams, UserOptions } from '@signalwire/core' | ||
export interface GetAddressParams { | ||
export interface GetAddressByIdParams { | ||
id: string | ||
} | ||
export interface GetAddressByNameParams { | ||
name: string | ||
} | ||
export type GetAddressParams = GetAddressByIdParams | GetAddressByNameParams | ||
export type GetAddressResult = GetAddressResponse | ||
@@ -186,0 +192,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3078632
570
30927
+ Added@signalwire/core@4.2.0-dev.202408051204.fe44c5d.0(transitive)
+ Added@signalwire/webrtc@3.12.2-dev.202408051204.fe44c5d.0(transitive)
- Removed@signalwire/core@4.2.0-dev.202407241358.62ba0f6.0(transitive)
- Removed@signalwire/webrtc@3.12.2-dev.202407241358.62ba0f6.0(transitive)