@sermas/api-client 1.0.0-alpha.87 → 1.0.0-alpha.89
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/index.cjs +1 -1
- package/index.cjs.map +1 -1
- package/index.d.cts +125 -17
- package/index.d.ts +125 -17
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -467,6 +467,10 @@ type TaskEventDto = {
|
|
|
467
467
|
* Chat message to send to the user
|
|
468
468
|
*/
|
|
469
469
|
message?: string;
|
|
470
|
+
/**
|
|
471
|
+
* Condition to trigger the event
|
|
472
|
+
*/
|
|
473
|
+
condition?: string;
|
|
470
474
|
/**
|
|
471
475
|
* Trigger a tool
|
|
472
476
|
*/
|
|
@@ -493,6 +497,10 @@ type OptionSelection = {
|
|
|
493
497
|
* Selection label (value is used if not provided)
|
|
494
498
|
*/
|
|
495
499
|
label?: string;
|
|
500
|
+
/**
|
|
501
|
+
* Description for an option
|
|
502
|
+
*/
|
|
503
|
+
description?: string;
|
|
496
504
|
};
|
|
497
505
|
type TaskFieldDto = {
|
|
498
506
|
/**
|
|
@@ -988,6 +996,7 @@ type DialogueMemoryMessageDto = {
|
|
|
988
996
|
content: string;
|
|
989
997
|
role: Record<string, unknown>;
|
|
990
998
|
name: string;
|
|
999
|
+
ts: string;
|
|
991
1000
|
};
|
|
992
1001
|
type DialogueTaskRecordDto = {
|
|
993
1002
|
/**
|
|
@@ -1051,6 +1060,24 @@ type DialogueToolsRepositoryDto = {
|
|
|
1051
1060
|
*/
|
|
1052
1061
|
tools?: Array<unknown[]>;
|
|
1053
1062
|
};
|
|
1063
|
+
type SessionSearchFilter = {
|
|
1064
|
+
/**
|
|
1065
|
+
* filter query
|
|
1066
|
+
*/
|
|
1067
|
+
query?: Record<string, unknown>;
|
|
1068
|
+
/**
|
|
1069
|
+
* results limit
|
|
1070
|
+
*/
|
|
1071
|
+
limit?: number;
|
|
1072
|
+
/**
|
|
1073
|
+
* results to skip from beginning
|
|
1074
|
+
*/
|
|
1075
|
+
skip?: number;
|
|
1076
|
+
/**
|
|
1077
|
+
* result sorting
|
|
1078
|
+
*/
|
|
1079
|
+
sort?: Record<string, unknown>;
|
|
1080
|
+
};
|
|
1054
1081
|
type SessionProperties = {
|
|
1055
1082
|
/**
|
|
1056
1083
|
* Reference to the current tool repository
|
|
@@ -1329,6 +1356,10 @@ type ImageUIContentDto = {
|
|
|
1329
1356
|
sessionId?: string;
|
|
1330
1357
|
contentType: SupportedContentTypes;
|
|
1331
1358
|
content: ImageContentDto;
|
|
1359
|
+
/**
|
|
1360
|
+
* Provide a description for the content
|
|
1361
|
+
*/
|
|
1362
|
+
description?: string;
|
|
1332
1363
|
/**
|
|
1333
1364
|
* Provides metadata for the content
|
|
1334
1365
|
*/
|
|
@@ -1375,6 +1406,10 @@ type VideoUIContentDto = {
|
|
|
1375
1406
|
sessionId?: string;
|
|
1376
1407
|
contentType: SupportedContentTypes;
|
|
1377
1408
|
content: VideoContentDto;
|
|
1409
|
+
/**
|
|
1410
|
+
* Provide a description for the content
|
|
1411
|
+
*/
|
|
1412
|
+
description?: string;
|
|
1378
1413
|
/**
|
|
1379
1414
|
* Provides metadata for the content
|
|
1380
1415
|
*/
|
|
@@ -1415,6 +1450,10 @@ type PdfUIContentDto = {
|
|
|
1415
1450
|
sessionId?: string;
|
|
1416
1451
|
contentType: SupportedContentTypes;
|
|
1417
1452
|
content: PdfContentDto;
|
|
1453
|
+
/**
|
|
1454
|
+
* Provide a description for the content
|
|
1455
|
+
*/
|
|
1456
|
+
description?: string;
|
|
1418
1457
|
/**
|
|
1419
1458
|
* Provides metadata for the content
|
|
1420
1459
|
*/
|
|
@@ -1455,6 +1494,10 @@ type WebpageUIContentDto = {
|
|
|
1455
1494
|
sessionId?: string;
|
|
1456
1495
|
contentType: SupportedContentTypes;
|
|
1457
1496
|
content: WebpageContentDto;
|
|
1497
|
+
/**
|
|
1498
|
+
* Provide a description for the content
|
|
1499
|
+
*/
|
|
1500
|
+
description?: string;
|
|
1458
1501
|
/**
|
|
1459
1502
|
* Provides metadata for the content
|
|
1460
1503
|
*/
|
|
@@ -1495,6 +1538,10 @@ type ObjectUIContentDto = {
|
|
|
1495
1538
|
sessionId?: string;
|
|
1496
1539
|
contentType: SupportedContentTypes;
|
|
1497
1540
|
content: ObjectContentDto;
|
|
1541
|
+
/**
|
|
1542
|
+
* Provide a description for the content
|
|
1543
|
+
*/
|
|
1544
|
+
description?: string;
|
|
1498
1545
|
/**
|
|
1499
1546
|
* Provides metadata for the content
|
|
1500
1547
|
*/
|
|
@@ -1535,6 +1582,10 @@ type TextUIContentDto = {
|
|
|
1535
1582
|
sessionId?: string;
|
|
1536
1583
|
contentType: SupportedContentTypes;
|
|
1537
1584
|
content: TextContentDto;
|
|
1585
|
+
/**
|
|
1586
|
+
* Provide a description for the content
|
|
1587
|
+
*/
|
|
1588
|
+
description?: string;
|
|
1538
1589
|
/**
|
|
1539
1590
|
* Provides metadata for the content
|
|
1540
1591
|
*/
|
|
@@ -1581,6 +1632,10 @@ type QuizUIContentDto = {
|
|
|
1581
1632
|
sessionId?: string;
|
|
1582
1633
|
contentType: SupportedContentTypes;
|
|
1583
1634
|
content: QuizContentDto;
|
|
1635
|
+
/**
|
|
1636
|
+
* Provide a description for the content
|
|
1637
|
+
*/
|
|
1638
|
+
description?: string;
|
|
1584
1639
|
/**
|
|
1585
1640
|
* Provides metadata for the content
|
|
1586
1641
|
*/
|
|
@@ -1618,6 +1673,10 @@ type ClearUIContentDto = {
|
|
|
1618
1673
|
sessionId?: string;
|
|
1619
1674
|
contentType: SupportedContentTypes;
|
|
1620
1675
|
content: Record<string, unknown>;
|
|
1676
|
+
/**
|
|
1677
|
+
* Provide a description for the content
|
|
1678
|
+
*/
|
|
1679
|
+
description?: string;
|
|
1621
1680
|
/**
|
|
1622
1681
|
* Provides metadata for the content
|
|
1623
1682
|
*/
|
|
@@ -1655,6 +1714,10 @@ type ClearScreenDto = {
|
|
|
1655
1714
|
sessionId?: string;
|
|
1656
1715
|
contentType: SupportedContentTypes;
|
|
1657
1716
|
content: Record<string, unknown>;
|
|
1717
|
+
/**
|
|
1718
|
+
* Provide a description for the content
|
|
1719
|
+
*/
|
|
1720
|
+
description?: string;
|
|
1658
1721
|
/**
|
|
1659
1722
|
* Provides metadata for the content
|
|
1660
1723
|
*/
|
|
@@ -1673,9 +1736,19 @@ type ClearScreenDto = {
|
|
|
1673
1736
|
chunkId?: string;
|
|
1674
1737
|
};
|
|
1675
1738
|
type ButtonDto = {
|
|
1739
|
+
/**
|
|
1740
|
+
* Button value
|
|
1741
|
+
*/
|
|
1676
1742
|
value: string;
|
|
1677
1743
|
id?: string;
|
|
1744
|
+
/**
|
|
1745
|
+
* Button label
|
|
1746
|
+
*/
|
|
1678
1747
|
label?: string;
|
|
1748
|
+
/**
|
|
1749
|
+
* Provide a description for the button
|
|
1750
|
+
*/
|
|
1751
|
+
description?: string;
|
|
1679
1752
|
classes?: Array<string>;
|
|
1680
1753
|
options?: UIContentOptionsDto;
|
|
1681
1754
|
};
|
|
@@ -1703,6 +1776,10 @@ type ButtonsUIContentDto = {
|
|
|
1703
1776
|
sessionId?: string;
|
|
1704
1777
|
contentType: SupportedContentTypes;
|
|
1705
1778
|
content: ButtonsContentDto;
|
|
1779
|
+
/**
|
|
1780
|
+
* Provide a description for the content
|
|
1781
|
+
*/
|
|
1782
|
+
description?: string;
|
|
1706
1783
|
/**
|
|
1707
1784
|
* Provides metadata for the content
|
|
1708
1785
|
*/
|
|
@@ -1740,6 +1817,10 @@ type DialogueMessageUIContentDto = {
|
|
|
1740
1817
|
sessionId?: string;
|
|
1741
1818
|
contentType: SupportedContentTypes;
|
|
1742
1819
|
content: DialogueMessageDto;
|
|
1820
|
+
/**
|
|
1821
|
+
* Provide a description for the content
|
|
1822
|
+
*/
|
|
1823
|
+
description?: string;
|
|
1743
1824
|
/**
|
|
1744
1825
|
* Provides metadata for the content
|
|
1745
1826
|
*/
|
|
@@ -1781,6 +1862,10 @@ type LinkUIContentDto = {
|
|
|
1781
1862
|
sessionId?: string;
|
|
1782
1863
|
contentType: SupportedContentTypes;
|
|
1783
1864
|
content: LinkContentDto;
|
|
1865
|
+
/**
|
|
1866
|
+
* Provide a description for the content
|
|
1867
|
+
*/
|
|
1868
|
+
description?: string;
|
|
1784
1869
|
/**
|
|
1785
1870
|
* Provides metadata for the content
|
|
1786
1871
|
*/
|
|
@@ -1821,6 +1906,10 @@ type HtmlUIContentDto = {
|
|
|
1821
1906
|
sessionId?: string;
|
|
1822
1907
|
contentType: SupportedContentTypes;
|
|
1823
1908
|
content: HtmlContentDto;
|
|
1909
|
+
/**
|
|
1910
|
+
* Provide a description for the content
|
|
1911
|
+
*/
|
|
1912
|
+
description?: string;
|
|
1824
1913
|
/**
|
|
1825
1914
|
* Provides metadata for the content
|
|
1826
1915
|
*/
|
|
@@ -1862,6 +1951,10 @@ type EmailUIContentDto = {
|
|
|
1862
1951
|
sessionId?: string;
|
|
1863
1952
|
contentType: SupportedContentTypes;
|
|
1864
1953
|
content: EmailContentDto;
|
|
1954
|
+
/**
|
|
1955
|
+
* Provide a description for the content
|
|
1956
|
+
*/
|
|
1957
|
+
description?: string;
|
|
1865
1958
|
/**
|
|
1866
1959
|
* Provides metadata for the content
|
|
1867
1960
|
*/
|
|
@@ -1909,6 +2002,10 @@ type UIContentDto = {
|
|
|
1909
2002
|
sessionId?: string;
|
|
1910
2003
|
contentType: SupportedContentTypes;
|
|
1911
2004
|
content: Record<string, unknown>;
|
|
2005
|
+
/**
|
|
2006
|
+
* Provide a description for the content
|
|
2007
|
+
*/
|
|
2008
|
+
description?: string;
|
|
1912
2009
|
/**
|
|
1913
2010
|
* Provides metadata for the content
|
|
1914
2011
|
*/
|
|
@@ -1951,7 +2048,7 @@ type UIAssetDto = {
|
|
|
1951
2048
|
ts?: string;
|
|
1952
2049
|
};
|
|
1953
2050
|
type Buffer$1 = {};
|
|
1954
|
-
type LogType = 'characterization' | 'stt' | 'tts' | 'interaction' | 'session' | 'document' | 'chat' | 'task' | 'performance' | 'kpi';
|
|
2051
|
+
type LogType = 'characterization' | 'stt' | 'tts' | 'interaction' | 'session' | 'document' | 'chat' | 'task' | 'performance' | 'kpi' | 'error';
|
|
1955
2052
|
declare const LogTypeEnum: {
|
|
1956
2053
|
readonly CHARACTERIZATION: "characterization";
|
|
1957
2054
|
readonly STT: "stt";
|
|
@@ -1963,6 +2060,7 @@ declare const LogTypeEnum: {
|
|
|
1963
2060
|
readonly TASK: "task";
|
|
1964
2061
|
readonly PERFORMANCE: "performance";
|
|
1965
2062
|
readonly KPI: "kpi";
|
|
2063
|
+
readonly ERROR: "error";
|
|
1966
2064
|
};
|
|
1967
2065
|
type DatasetRecordDto = {
|
|
1968
2066
|
appId: string;
|
|
@@ -2916,6 +3014,10 @@ declare class RoboticsService {
|
|
|
2916
3014
|
type TDataGetUserSession = {
|
|
2917
3015
|
appId: string;
|
|
2918
3016
|
};
|
|
3017
|
+
type TDataSearch = {
|
|
3018
|
+
appId: string;
|
|
3019
|
+
requestBody: SessionSearchFilter;
|
|
3020
|
+
};
|
|
2919
3021
|
type TDataReadSession = {
|
|
2920
3022
|
sessionId: string;
|
|
2921
3023
|
};
|
|
@@ -2958,6 +3060,12 @@ declare class SessionService {
|
|
|
2958
3060
|
* @throws ApiError
|
|
2959
3061
|
*/
|
|
2960
3062
|
getUserSession(data: TDataGetUserSession): CancelablePromise<any>;
|
|
3063
|
+
/**
|
|
3064
|
+
* List recent sessions
|
|
3065
|
+
* @returns SessionDto
|
|
3066
|
+
* @throws ApiError
|
|
3067
|
+
*/
|
|
3068
|
+
search(data: TDataSearch): CancelablePromise<Array<SessionDto>>;
|
|
2961
3069
|
/**
|
|
2962
3070
|
* Load a session
|
|
2963
3071
|
* @returns any
|
|
@@ -3247,14 +3355,14 @@ interface anonymous_schema_104 {
|
|
|
3247
3355
|
tokenUrl: string;
|
|
3248
3356
|
refreshUrl?: string;
|
|
3249
3357
|
}
|
|
3250
|
-
interface
|
|
3358
|
+
interface anonymous_schema_151 {
|
|
3251
3359
|
triggerOnce?: boolean;
|
|
3252
3360
|
removeRecord?: boolean;
|
|
3253
3361
|
enableTool?: boolean;
|
|
3254
|
-
toolOptions?:
|
|
3362
|
+
toolOptions?: anonymous_schema_155;
|
|
3255
3363
|
repositoryId?: string;
|
|
3256
3364
|
}
|
|
3257
|
-
interface
|
|
3365
|
+
interface anonymous_schema_155 {
|
|
3258
3366
|
triggerOnce?: boolean;
|
|
3259
3367
|
exclusive?: boolean;
|
|
3260
3368
|
}
|
|
@@ -3315,7 +3423,7 @@ interface StringInferenceValue {
|
|
|
3315
3423
|
probability: number;
|
|
3316
3424
|
value: string;
|
|
3317
3425
|
}
|
|
3318
|
-
type
|
|
3426
|
+
type anonymous_schema_214 = 'start' | 'stop';
|
|
3319
3427
|
interface UserCharacterizationEventDto {
|
|
3320
3428
|
appId: string;
|
|
3321
3429
|
clientId?: string;
|
|
@@ -3399,10 +3507,10 @@ interface DialogueTaskChangedDto {
|
|
|
3399
3507
|
}
|
|
3400
3508
|
interface DialogueTaskProgressDto {
|
|
3401
3509
|
type: TaskEventType;
|
|
3402
|
-
task:
|
|
3403
|
-
record:
|
|
3510
|
+
task: anonymous_schema_283;
|
|
3511
|
+
record: anonymous_schema_284;
|
|
3404
3512
|
}
|
|
3405
|
-
interface
|
|
3513
|
+
interface anonymous_schema_283 {
|
|
3406
3514
|
taskId: string;
|
|
3407
3515
|
appId: string;
|
|
3408
3516
|
sessionId?: string;
|
|
@@ -3411,9 +3519,9 @@ interface anonymous_schema_281 {
|
|
|
3411
3519
|
intents?: TaskIntentDto[];
|
|
3412
3520
|
events?: TaskEventDto[];
|
|
3413
3521
|
fields: TaskFieldDto[];
|
|
3414
|
-
options?:
|
|
3522
|
+
options?: anonymous_schema_151;
|
|
3415
3523
|
}
|
|
3416
|
-
interface
|
|
3524
|
+
interface anonymous_schema_284 {
|
|
3417
3525
|
recordId: string;
|
|
3418
3526
|
taskId: string;
|
|
3419
3527
|
appId: string;
|
|
@@ -3440,9 +3548,9 @@ interface DialogueTaskRecordHandlerDto {
|
|
|
3440
3548
|
sessionId?: string;
|
|
3441
3549
|
taskId: string;
|
|
3442
3550
|
recordId: string;
|
|
3443
|
-
field:
|
|
3551
|
+
field: anonymous_schema_305;
|
|
3444
3552
|
}
|
|
3445
|
-
interface
|
|
3553
|
+
interface anonymous_schema_305 {
|
|
3446
3554
|
name: string;
|
|
3447
3555
|
label?: string;
|
|
3448
3556
|
order?: number;
|
|
@@ -3480,10 +3588,10 @@ interface DialogueToolsRepositoryRecordDto {
|
|
|
3480
3588
|
ts?: string;
|
|
3481
3589
|
sessionId?: string;
|
|
3482
3590
|
repositoryId?: string;
|
|
3483
|
-
options?:
|
|
3591
|
+
options?: anonymous_schema_324;
|
|
3484
3592
|
tools?: any[][];
|
|
3485
3593
|
}
|
|
3486
|
-
interface
|
|
3594
|
+
interface anonymous_schema_324 {
|
|
3487
3595
|
triggerOnce?: boolean;
|
|
3488
3596
|
exclusive?: boolean;
|
|
3489
3597
|
}
|
|
@@ -3544,11 +3652,11 @@ interface UIAssetChangedDto {
|
|
|
3544
3652
|
sessionId?: string;
|
|
3545
3653
|
record: UIAssetDto;
|
|
3546
3654
|
}
|
|
3547
|
-
interface
|
|
3655
|
+
interface anonymous_schema_400 {
|
|
3548
3656
|
repositoryId?: string;
|
|
3549
3657
|
additionalProperties?: Record<string, any>;
|
|
3550
3658
|
}
|
|
3551
|
-
interface
|
|
3659
|
+
interface anonymous_schema_403 {
|
|
3552
3660
|
clearScreen?: boolean;
|
|
3553
3661
|
ttsEnabled?: boolean;
|
|
3554
3662
|
stopSpeech?: boolean;
|
|
@@ -4031,4 +4139,4 @@ declare class SermasApiClient {
|
|
|
4031
4139
|
login(username: any, password: any, appId?: string): Promise<LoginResponseDto>;
|
|
4032
4140
|
}
|
|
4033
4141
|
|
|
4034
|
-
export { type AccessTokenRequestDto, type ActuationEventDto, type AgentChangedDto, type AgentDto, type AgentEvaluatePromptDto, type AgentEvaluatePromptFormat, AgentEvaluatePromptFormatEnum, type AgentEvaluatePromptOptionsDto, type AgentEvaluatePromptResponseDto, type AgentHeartBeatEventDto, type AgentStatus, AgentStatusEnum, type AppClientDto, type AppModuleConfigDto, type AppPromptDto, type AppSettingsDto, type AppToolsDTO, type AppUserDto, type AudioClassificationEventDto, type AudioClassificationValue, type AuthJwtUser, type AuthorizationUser, type AvatarCameraConfig, type BoundingBox, Broker, type Buffer$1 as Buffer, type ButtonDto, type ButtonsContentDto, type ButtonsUIContentDto, type ClearScreenDto, type ClearUIContentDto, type CreatePlatformAppDto, type DatasetRecordDto, type DatasetRecordFilterDto, type DialogueActor, DialogueActorEnum, type DialogueDocumentDto, type DialogueDocumentMetadataDto, type DialogueDocumentOptionsDto, type DialogueMemoryMessageDto, type DialogueMessageDto, type DialogueMessageUIContentDto, type DialogueTaskChangedDto, type DialogueTaskDto, type DialogueTaskProgressDto, type DialogueTaskRecordChangedDto, type DialogueTaskRecordDto, type DialogueTaskRecordHandlerDto, type DialogueTextToSpeechDto, type DialogueToolTriggeredEventDto, type DialogueToolsRepositoryChanged, type DialogueToolsRepositoryDto, type DialogueToolsRepositoryOptionsDto, type DialogueToolsRepositoryRecordDto, type EmailContentDto, type EmailUIContentDto, type HtmlContentDto, type HtmlUIContentDto, type ImageContentDto, type ImageUIContentDto, type InitialPoseDto, type InitialPoseEventDto, type InteractionStartTypes, InteractionStartTypesEnum, InteractionTypeEnum, type JwtTokenDto, type KeycloakCredentials, type KeycloakJwtTokenResourceAccess, type LLMProvider, LLMProviderEnum, type LinearVelocityDto, type LinkContentDto, type LinkUIContentDto, type LogType, LogTypeEnum, Logger, type LoggerService, type LoginRequestDto, type LoginResponseDto, type ModelGender, ModelGenderEnum, type ModelType, ModelTypeEnum, type ModuleConfigEventDto, type ModuleResourceDto, type ModuleSettingsDto, type MonitoringRecordDto, type MovementDto, type MovementEventDto, type NoiseEventDto, type ObjectContentDto, type ObjectDetectionDto, type ObjectDetectionEventDto, type ObjectDetectionRequest, type ObjectDetectionType, ObjectDetectionTypeEnum, type ObjectUIContentDto, type OperationalStateDto, type OperationalStateEventDto, type OptionSelection, type OrientationDto, type PdfContentDto, type PdfUIContentDto, type PlatformAppChangedDto, type PlatformAppClientChangedDto, type PlatformAppDto, type PlatformAppExportFilterDto, type PlatformAppModuleConfigEventDto, type PlatformModuleConfigDto, type PlatformSettingsDto, type PlatformTokenDto, type Point3D, type PoseDto, type PositionDto, type QRCodeEventDto, type QrCodeDto, type QrCodePayloadDto, type QuizAnswerDto, type QuizContentDto, type QuizUIContentDto, type RagDocumentsDto, type RagWebsiteDto, type RefreshTokenRequestDto, type RegistrationRequestDto, type RegistrationResponseDto, type RepositoryAnimationDto, type RepositoryAssetMetadataDto, type RepositoryAssetTypes, RepositoryAssetTypesEnum, type RepositoryAvatarDto, type RepositoryBackgroundDto, type RepositoryBackgroundMetadataDto, type RepositoryConfigDto, type RepositoryDocumentDto, type RepositoryRobotModelDto, type RobotMapDto, type SentimentAnalysisRequest, SermasApiClient, type SermasApiClientConfig, type SermasBaseDto, type SermasEnvType, type SermasSessionDto, type SessionChangedDto, type SessionDto, type SessionProperties, type SessionStorageEventDto, type SessionStorageRecordDto, type SessionStorageSearchDto, type SessionSupportEventDto, type SessionSupportRequestDto, type SessionSupportResponseDto, type StatusDto, type StatusEventDto, type StringInferenceValue, type SupportedContentTypes, SupportedContentTypesEnum, type TaskEventDto, type TaskEventTriggerDto, type TaskEventType, TaskEventTypeEnum, type TaskFieldDto, type TaskIntentDto, type TaskOptionsDto, type TaskSchemaDataType, TaskSchemaDataTypeEnum, type TextContentDto, type TextUIContentDto, type ToolsParameterSchema, type ToolsParameterSchemaTypes, ToolsParameterSchemaTypesEnum, type ToolsRequestSchema, type ToolsRequestSchemaAuthBasic, type ToolsRequestSchemaAuthBearer, type UIAssetChangedDto, type UIAssetDto, type UIContentDto, type UIContentMetadataDto, type UIContentOptionsDto, type UIInteractionDTO, type UIInteractionEventDto, type UIModelMapBlendShapesRequestDto, type UIModelMapBlendShapesResponseDto, type UiInteractionButtonDto, type UpdateUserEventDto, type UpdateUserRequestDto, type UserAgeValue, type UserCharacterizationDto, type UserCharacterizationEventDto, type UserDetectionDto, type UserDetectionEventDto, type UserEmotionValue, type UserInteractionIntentionDto, type VelocityDto, type VideoContentDto, type VideoUIContentDto, type WebpageContentDto, type WebpageUIContentDto, type XRMarkerChangedDto, type XRMarkerDto, type XRMarkerListRequestDto, type XROcclusionDto, type XROcclusionResponseDto, type anonymous_schema_101, type anonymous_schema_104, type
|
|
4142
|
+
export { type AccessTokenRequestDto, type ActuationEventDto, type AgentChangedDto, type AgentDto, type AgentEvaluatePromptDto, type AgentEvaluatePromptFormat, AgentEvaluatePromptFormatEnum, type AgentEvaluatePromptOptionsDto, type AgentEvaluatePromptResponseDto, type AgentHeartBeatEventDto, type AgentStatus, AgentStatusEnum, type AppClientDto, type AppModuleConfigDto, type AppPromptDto, type AppSettingsDto, type AppToolsDTO, type AppUserDto, type AudioClassificationEventDto, type AudioClassificationValue, type AuthJwtUser, type AuthorizationUser, type AvatarCameraConfig, type BoundingBox, Broker, type Buffer$1 as Buffer, type ButtonDto, type ButtonsContentDto, type ButtonsUIContentDto, type ClearScreenDto, type ClearUIContentDto, type CreatePlatformAppDto, type DatasetRecordDto, type DatasetRecordFilterDto, type DialogueActor, DialogueActorEnum, type DialogueDocumentDto, type DialogueDocumentMetadataDto, type DialogueDocumentOptionsDto, type DialogueMemoryMessageDto, type DialogueMessageDto, type DialogueMessageUIContentDto, type DialogueTaskChangedDto, type DialogueTaskDto, type DialogueTaskProgressDto, type DialogueTaskRecordChangedDto, type DialogueTaskRecordDto, type DialogueTaskRecordHandlerDto, type DialogueTextToSpeechDto, type DialogueToolTriggeredEventDto, type DialogueToolsRepositoryChanged, type DialogueToolsRepositoryDto, type DialogueToolsRepositoryOptionsDto, type DialogueToolsRepositoryRecordDto, type EmailContentDto, type EmailUIContentDto, type HtmlContentDto, type HtmlUIContentDto, type ImageContentDto, type ImageUIContentDto, type InitialPoseDto, type InitialPoseEventDto, type InteractionStartTypes, InteractionStartTypesEnum, InteractionTypeEnum, type JwtTokenDto, type KeycloakCredentials, type KeycloakJwtTokenResourceAccess, type LLMProvider, LLMProviderEnum, type LinearVelocityDto, type LinkContentDto, type LinkUIContentDto, type LogType, LogTypeEnum, Logger, type LoggerService, type LoginRequestDto, type LoginResponseDto, type ModelGender, ModelGenderEnum, type ModelType, ModelTypeEnum, type ModuleConfigEventDto, type ModuleResourceDto, type ModuleSettingsDto, type MonitoringRecordDto, type MovementDto, type MovementEventDto, type NoiseEventDto, type ObjectContentDto, type ObjectDetectionDto, type ObjectDetectionEventDto, type ObjectDetectionRequest, type ObjectDetectionType, ObjectDetectionTypeEnum, type ObjectUIContentDto, type OperationalStateDto, type OperationalStateEventDto, type OptionSelection, type OrientationDto, type PdfContentDto, type PdfUIContentDto, type PlatformAppChangedDto, type PlatformAppClientChangedDto, type PlatformAppDto, type PlatformAppExportFilterDto, type PlatformAppModuleConfigEventDto, type PlatformModuleConfigDto, type PlatformSettingsDto, type PlatformTokenDto, type Point3D, type PoseDto, type PositionDto, type QRCodeEventDto, type QrCodeDto, type QrCodePayloadDto, type QuizAnswerDto, type QuizContentDto, type QuizUIContentDto, type RagDocumentsDto, type RagWebsiteDto, type RefreshTokenRequestDto, type RegistrationRequestDto, type RegistrationResponseDto, type RepositoryAnimationDto, type RepositoryAssetMetadataDto, type RepositoryAssetTypes, RepositoryAssetTypesEnum, type RepositoryAvatarDto, type RepositoryBackgroundDto, type RepositoryBackgroundMetadataDto, type RepositoryConfigDto, type RepositoryDocumentDto, type RepositoryRobotModelDto, type RobotMapDto, type SentimentAnalysisRequest, SermasApiClient, type SermasApiClientConfig, type SermasBaseDto, type SermasEnvType, type SermasSessionDto, type SessionChangedDto, type SessionDto, type SessionProperties, type SessionSearchFilter, type SessionStorageEventDto, type SessionStorageRecordDto, type SessionStorageSearchDto, type SessionSupportEventDto, type SessionSupportRequestDto, type SessionSupportResponseDto, type StatusDto, type StatusEventDto, type StringInferenceValue, type SupportedContentTypes, SupportedContentTypesEnum, type TaskEventDto, type TaskEventTriggerDto, type TaskEventType, TaskEventTypeEnum, type TaskFieldDto, type TaskIntentDto, type TaskOptionsDto, type TaskSchemaDataType, TaskSchemaDataTypeEnum, type TextContentDto, type TextUIContentDto, type ToolsParameterSchema, type ToolsParameterSchemaTypes, ToolsParameterSchemaTypesEnum, type ToolsRequestSchema, type ToolsRequestSchemaAuthBasic, type ToolsRequestSchemaAuthBearer, type UIAssetChangedDto, type UIAssetDto, type UIContentDto, type UIContentMetadataDto, type UIContentOptionsDto, type UIInteractionDTO, type UIInteractionEventDto, type UIModelMapBlendShapesRequestDto, type UIModelMapBlendShapesResponseDto, type UiInteractionButtonDto, type UpdateUserEventDto, type UpdateUserRequestDto, type UserAgeValue, type UserCharacterizationDto, type UserCharacterizationEventDto, type UserDetectionDto, type UserDetectionEventDto, type UserEmotionValue, type UserInteractionIntentionDto, type VelocityDto, type VideoContentDto, type VideoUIContentDto, type WebpageContentDto, type WebpageUIContentDto, type XRMarkerChangedDto, type XRMarkerDto, type XRMarkerListRequestDto, type XROcclusionDto, type XROcclusionResponseDto, type anonymous_schema_101, type anonymous_schema_104, type anonymous_schema_151, type anonymous_schema_155, type anonymous_schema_214, type anonymous_schema_283, type anonymous_schema_284, type anonymous_schema_305, type anonymous_schema_324, type anonymous_schema_400, type anonymous_schema_403, type anonymous_schema_99, sleep };
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var Y=Object.defineProperty;var Z=(o,e,t)=>e in o?Y(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var n=(o,e,t)=>(Z(o,typeof e!="symbol"?e+"":e,t),t);import{jwtDecode as ge}from"jwt-decode";var x=class{constructor(e){this.broker=e}async tokenRequested(e,t){return this.broker.publish("app/:appId/platform/token",e,t)}async onTokenRequested(e,t){return this.broker.subscribe("app/:appId/platform/token",e,t)}async appChanged(e,t){return this.broker.publish("app/:appId/platform/app/changed/:appId",e,t)}async onAppChanged(e,t){return this.broker.subscribe("app/:appId/platform/app/changed/:appId",e,t)}async clientChanged(e,t){return this.broker.publish("app/:appId/platform/client/changed/:clientId",e,t)}async onClientChanged(e,t){return this.broker.subscribe("app/:appId/platform/client/changed/:clientId",e,t)}async appModuleChanged(e,t){return this.broker.publish("app/:appId/platform/module",e,t)}async onAppModuleChanged(e,t){return this.broker.subscribe("app/:appId/platform/module",e,t)}async record(e,t){return this.broker.publish("app/:appId/platform/monitoring",e,t)}async onRecord(e,t){return this.broker.subscribe("app/:appId/platform/monitoring",e,t)}};var P=class{constructor(e){this.broker=e}async userUpdate(e,t){return this.broker.publish("app/:appId/auth/update",e,t)}async onUserUpdate(e,t){return this.broker.subscribe("app/:appId/auth/update",e,t)}async userRegistration(e,t){return this.broker.publish("app/:appId/auth/create",e,t)}async onUserRegistration(e,t){return this.broker.subscribe("app/:appId/auth/create",e,t)}async userLogin(e,t){return this.broker.publish("app/:appId/auth/login",e,t)}async onUserLogin(e,t){return this.broker.subscribe("app/:appId/auth/login",e,t)}};var S=class{constructor(e){this.broker=e}async moduleChanged(e,t){return this.broker.publish("system/platform/module/changed/:moduleId",e,t)}async onModuleChanged(e,t){return this.broker.subscribe("system/platform/module/changed/:moduleId",e,t)}};var E=class{constructor(e){this.broker=e}async userDetected(e,t){return this.broker.publish("app/:appId/detection/user",e,t)}async onUserDetected(e,t){return this.broker.subscribe("app/:appId/detection/user",e,t)}async interactionIntention(e,t){return this.broker.publish("app/:appId/detection/interaction",e,t)}async onInteractionIntention(e,t){return this.broker.subscribe("app/:appId/detection/interaction",e,t)}async userCharacterization(e,t){return this.broker.publish("app/:appId/detection/characterization",e,t)}async onUserCharacterization(e,t){return this.broker.subscribe("app/:appId/detection/characterization",e,t)}async audioClassification(e,t){return this.broker.publish("app/:appId/detection/audio",e,t)}async onAudioClassification(e,t){return this.broker.subscribe("app/:appId/detection/audio",e,t)}async objectDetected(e,t){return this.broker.publish("app/:appId/detection/object",e,t)}async onObjectDetected(e,t){return this.broker.subscribe("app/:appId/detection/object",e,t)}async qrCodeDetected(e,t){return this.broker.publish("app/:appId/detection/qr_code",e,t)}async onQrCodeDetected(e,t){return this.broker.subscribe("app/:appId/detection/qr_code",e,t)}async noise(e,t){return this.broker.publish("app/:appId/detection/noise",e,t)}async onNoise(e,t){return this.broker.subscribe("app/:appId/detection/noise",e,t)}};var U=class{constructor(e){this.broker=e}async dialogueMessages(e,t){return this.broker.publish("app/:appId/dialogue/messages/:sessionId",e,t)}async onDialogueMessages(e,t){return this.broker.subscribe("app/:appId/dialogue/messages/:sessionId",e,t)}async agentSpeech(e,t){return this.broker.publish("app/:appId/dialogue/speech/:sessionId/:chunkId",e,t)}async onAgentSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/speech/:sessionId/:chunkId",e,t)}async agentStopSpeech(e,t){return this.broker.publish("app/:appId/dialogue/stop/:sessionId",e,t)}async onAgentStopSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/stop/:sessionId",e,t)}async taskChanged(e,t){return this.broker.publish("app/:appId/dialogue/task/changed/:taskId",e,t)}async onTaskChanged(e,t){return this.broker.subscribe("app/:appId/dialogue/task/changed/:taskId",e,t)}async taskProgress(e,t){return this.broker.publish("app/:appId/dialogue/task/progress/:taskId",e,t)}async onTaskProgress(e,t){return this.broker.subscribe("app/:appId/dialogue/task/progress/:taskId",e,t)}async recordChanged(e,t){return this.broker.publish("app/:appId/dialogue/task/record/:taskId",e,t)}async onRecordChanged(e,t){return this.broker.subscribe("app/:appId/dialogue/task/record/:taskId",e,t)}async fieldHandler(e,t){return this.broker.publish("app/:appId/dialogue/task/handler",e,t)}async onFieldHandler(e,t){return this.broker.subscribe("app/:appId/dialogue/task/handler",e,t)}async toolTriggered(e,t){return this.broker.publish("app/:appId/dialogue/tool/:name",e,t)}async onToolTriggered(e,t){return this.broker.subscribe("app/:appId/dialogue/tool/:name",e,t)}async toolChanged(e,t){return this.broker.publish("app/:appId/dialogue/tool/changed/:repositoryId",e,t)}async onToolChanged(e,t){return this.broker.subscribe("app/:appId/dialogue/tool/changed/:repositoryId",e,t)}};var M=class{constructor(e){this.broker=e}async userInteraction(e,t){return this.broker.publish("app/:appId/session/interaction/user",e,t)}async onUserInteraction(e,t){return this.broker.subscribe("app/:appId/session/interaction/user",e,t)}async sessionChanged(e,t){return this.broker.publish("app/:appId/session/session/changed/:sessionId",e,t)}async onSessionChanged(e,t){return this.broker.subscribe("app/:appId/session/session/changed/:sessionId",e,t)}async support(e,t){return this.broker.publish("app/:appId/session/support",e,t)}async onSupport(e,t){return this.broker.subscribe("app/:appId/session/support",e,t)}async storageUpdated(e,t){return this.broker.publish("app/:appId/session/storage/:storageId",e,t)}async onStorageUpdated(e,t){return this.broker.subscribe("app/:appId/session/storage/:storageId",e,t)}async agentInteraction(e,t){return this.broker.publish("app/:appId/session/interaction/agent",e,t)}async onAgentInteraction(e,t){return this.broker.subscribe("app/:appId/session/interaction/agent",e,t)}async agentChanged(e,t){return this.broker.publish("app/:appId/session/agent/changed/:agentId",e,t)}async onAgentChanged(e,t){return this.broker.subscribe("app/:appId/session/agent/changed/:agentId",e,t)}};var O=class{constructor(e){this.broker=e}async assetChanged(e,t){return this.broker.publish("app/:appId/ui/status",e,t)}async onAssetChanged(e,t){return this.broker.subscribe("app/:appId/ui/status",e,t)}async content(e,t){return this.broker.publish("app/:appId/ui/content",e,t)}async onContent(e,t){return this.broker.subscribe("app/:appId/ui/content",e,t)}async interaction(e,t){return this.broker.publish("app/:appId/ui/interaction/:moduleId",e,t)}async onInteraction(e,t){return this.broker.subscribe("app/:appId/ui/interaction/:moduleId",e,t)}};var w=class{constructor(e){this.broker=e}async detected(e,t){return this.broker.publish("app/:appId/xr/marker/detected",e,t)}async onDetected(e,t){return this.broker.subscribe("app/:appId/xr/marker/detected",e,t)}async changed(e,t){return this.broker.publish("app/:appId/xr/marker/changed/:markerId",e,t)}async onChanged(e,t){return this.broker.subscribe("app/:appId/xr/marker/changed/:markerId",e,t)}async occluded(e,t){return this.broker.publish("app/:appId/xr/occlusion",e,t)}async onOccluded(e,t){return this.broker.subscribe("app/:appId/xr/occlusion",e,t)}};var B=class{constructor(e){this.broker=e}async actuate(e,t){return this.broker.publish("app/:appId/robotics/actuate",e,t)}async onActuate(e,t){return this.broker.subscribe("app/:appId/robotics/actuate",e,t)}async move(e,t){return this.broker.publish("app/:appId/robotics/move",e,t)}async onMove(e,t){return this.broker.subscribe("app/:appId/robotics/move",e,t)}async robotStatus(e,t){return this.broker.publish("app/:appId/robotics/status",e,t)}async onRobotStatus(e,t){return this.broker.subscribe("app/:appId/robotics/status",e,t)}async initialPose(e,t){return this.broker.publish("app/:appId/robotics/initialpose",e,t)}async onInitialPose(e,t){return this.broker.subscribe("app/:appId/robotics/initialpose",e,t)}async opState(e,t){return this.broker.publish("app/:appId/robotics/opstate",e,t)}async onOpState(e,t){return this.broker.subscribe("app/:appId/robotics/opstate",e,t)}};var m=class{constructor(e){this.broker=e;n(this,"platform");n(this,"auth");n(this,"module");n(this,"detection");n(this,"dialogue");n(this,"session");n(this,"ui");n(this,"xr");n(this,"robotics");this.platform=new x(e),this.auth=new P(e),this.module=new S(e),this.detection=new E(e),this.dialogue=new U(e),this.session=new M(e),this.ui=new O(e),this.xr=new w(e),this.robotics=new B(e)}};import te from"mqtt";var N,z=o=>{N=o},ee=(o="logger")=>new class{format(e){return`[${o}] ${e}`}debug(e,...t){console.debug(this.format(e))}error(e,...t){console.error(this.format(e))}fatal(e,...t){console.error(this.format(e))}log(e,...t){console.info(this.format(e))}setLogLevels(e){}verbose(e,...t){console.debug(this.format(e))}warn(e,...t){console.warn(this.format(e))}},g=class{constructor(e){n(this,"logger");this.logger=N||ee(e)}debug(e,...t){this.logger.debug(e)}error(e,...t){this.logger.error(e)}fatal(e,...t){this.logger.error(e)}log(e,...t){(this.logger.info||this.logger.log).apply(this.logger,[e])}setLogLevels(e){}verbose(e,...t){this.logger.verbose(e)}warn(e,...t){this.logger.warn(e)}};var $=class o{constructor(e){this.config=e;n(this,"logger",new g(o.name));n(this,"client");n(this,"subscriptions",[])}async reconnect(){this.logger.warn("Forcing reconnection");try{await this.disconnect()}catch(e){this.logger.warn(`reconnect: disconnection error ${e.stack}`)}try{this.client=void 0,await this.connect()}catch(e){this.logger.warn(`reconnect: connection error ${e.stack}`)}}async disconnect(){if(this.client)try{await this.client.endAsync(!0)}catch(e){this.logger.warn(`Error closing broker connection: ${e.stack}`)}}setParams(e){this.config.params=e}setToken(e){this.config.username=e,this.client&&(this.logger.debug("Token updated, reconnecting"),this.client.options.username=e,this.client.reconnect())}getClient(){return this.client||null}connect(){if(!this.client){if(!this.config.username){this.logger.debug("Skip mqtt connection, missing token");return}this.logger.debug(`Connecting to ${this.config.url}`),this.client=te.connect(this.config.url,{username:this.config.username,password:this.config.password}),this.client.on("connect",async()=>{this.logger.debug("client connected");try{for(let e of this.subscriptions)this.logger.debug(`SUB ${e.topic}`),await this.client.subscribeAsync(e.topic)}catch(e){this.logger.warn(`Subscription failed: ${e.stack}`),setTimeout(()=>this.reconnect(),1e3)}}),this.client.on("error",e=>{this.logger.error(`mqtt client error ${e.stack}`)}),this.client.on("disconnect",()=>{this.logger.warn("mqtt disconnected")}),this.client.on("reconnect",()=>{this.logger.debug("mqtt reconnecting")}),this.client.on("connect",()=>{this.logger.debug("mqtt connected")}),this.client.on("message",(e,t)=>{let r=t;try{r=JSON.parse(t.toString())}catch{}this.logger.debug(`MSG ${e}`);let s=e.indexOf("#");s>-1&&(e=e.substring(0,s));let i=this.parseTopic(e),a=p=>p==="+";this.subscriptions.forEach(p=>{if(p.type===i.type&&!(!a(p.appId)&&p.appId!==i.appId)&&!(!a(p.resource)&&p.resource!==i.resource)&&!(!a(p.scope)&&p.scope!==i.scope)){for(let d in i.context||[])if(!a(p.context[d])&&p.context[d]!==i.context[d])return;p.callback(r)}})})}}parseTopic(e){let t=e.split("/"),[r,s,i,a]=t,p=t.slice(3);return{type:r,appId:s,resource:i,scope:a,context:p}}subscribe(e,t,r){return this.connect(),e=this.replaceTopicParams(e,{...r||{}}),this.subscriptions.push({...this.parseTopic(e),topic:e,callback:t}),()=>{let s=this.subscriptions.findIndex(a=>a.topic===e&&a.callback===t);if(s===-1)return null;let i=this.subscriptions[s];this.subscriptions.splice(s,1);try{this.client.unsubscribe(i.topic,i.callback)}catch{}}}async publish(e,t,r){let s=t.byteLength!==void 0,i;s?i=t:i=JSON.stringify(t);try{e=this.replaceTopicParams(e,{...s?{}:t,...r||{}}),await this.client.publishAsync(e,i)}catch{return!1}return!0}replaceTopicParams(e,t){t={...this.config?.params||{},...t||{}};for(let r of Object.keys(t)){let s=`:${r}`,i=t[r];if(i!=null){if(typeof i=="object"&&!Array.isArray(i)){e=this.replaceTopicParams(e,i);continue}if(!(typeof i!="string"&&typeof i!="number"))for(;e.indexOf(s)>-1;)e=e.replace(s,i.toString())}}return e=e.split("/").map(r=>r[0]===":"?"+":r).join("/"),e}};var u=class{constructor(){n(this,"_fns");this._fns=[]}eject(e){let t=this._fns.indexOf(e);t!==-1&&(this._fns=[...this._fns.slice(0,t),...this._fns.slice(t+1)])}use(e){this._fns=[...this._fns,e]}},re={BASE:"",CREDENTIALS:"include",ENCODE_PATH:void 0,HEADERS:void 0,PASSWORD:void 0,RESULT:"body",TOKEN:void 0,USERNAME:void 0,VERSION:"1.0",WITH_CREDENTIALS:!1,interceptors:{request:new u,response:new u}};var h=class{constructor(e){this.config=e}};var y=class extends Error{constructor(t,r,s){super(s);n(this,"url");n(this,"status");n(this,"statusText");n(this,"body");n(this,"request");this.name="ApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.body=r.body,this.request=t}};var L=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},D=class{constructor(e){n(this,"_isResolved");n(this,"_isRejected");n(this,"_isCancelled");n(this,"cancelHandlers");n(this,"promise");n(this,"_resolve");n(this,"_reject");this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this.cancelHandlers=[],this.promise=new Promise((t,r)=>{this._resolve=t,this._reject=r;let s=p=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(p))},i=p=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(p))},a=p=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(p)};return Object.defineProperty(a,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(a,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(a,"isCancelled",{get:()=>this._isCancelled}),e(s,i,a)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,t){return this.promise.then(e,t)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this.cancelHandlers.length)try{for(let e of this.cancelHandlers)e()}catch(e){console.warn("Cancellation threw an error",e);return}this.cancelHandlers.length=0,this._reject&&this._reject(new L("Request aborted"))}}get isCancelled(){return this._isCancelled}};var I=o=>typeof o=="string",H=o=>I(o)&&o!=="",G=o=>o instanceof Blob,X=o=>o instanceof FormData,oe=o=>{try{return btoa(o)}catch{return Buffer.from(o).toString("base64")}},se=o=>{let e=[],t=(s,i)=>{e.push(`${encodeURIComponent(s)}=${encodeURIComponent(String(i))}`)},r=(s,i)=>{i!=null&&(Array.isArray(i)?i.forEach(a=>r(s,a)):typeof i=="object"?Object.entries(i).forEach(([a,p])=>r(`${s}[${a}]`,p)):t(s,i))};return Object.entries(o).forEach(([s,i])=>r(s,i)),e.length?`?${e.join("&")}`:""},ie=(o,e)=>{let t=o.ENCODE_PATH||encodeURI,r=e.url.replace("{api-version}",o.VERSION).replace(/{(.*?)}/g,(i,a)=>e.path?.hasOwnProperty(a)?t(String(e.path[a])):i),s=o.BASE+r;return e.query?s+se(e.query):s},ne=o=>{if(o.formData){let e=new FormData,t=(r,s)=>{I(s)||G(s)?e.append(r,s):e.append(r,JSON.stringify(s))};return Object.entries(o.formData).filter(([,r])=>r!=null).forEach(([r,s])=>{Array.isArray(s)?s.forEach(i=>t(r,i)):t(r,s)}),e}},_=async(o,e)=>typeof e=="function"?e(o):e,ae=async(o,e)=>{let[t,r,s,i]=await Promise.all([_(e,o.TOKEN),_(e,o.USERNAME),_(e,o.PASSWORD),_(e,o.HEADERS)]),a=Object.entries({Accept:"application/json",...i,...e.headers}).filter(([,p])=>p!=null).reduce((p,[d,c])=>({...p,[d]:String(c)}),{});if(H(t)&&(a.Authorization=`Bearer ${t}`),H(r)&&H(s)){let p=oe(`${r}:${s}`);a.Authorization=`Basic ${p}`}return e.body!==void 0&&(e.mediaType?a["Content-Type"]=e.mediaType:G(e.body)?a["Content-Type"]=e.body.type||"application/octet-stream":I(e.body)?a["Content-Type"]="text/plain":X(e.body)||(a["Content-Type"]="application/json")),new Headers(a)},pe=o=>{if(o.body!==void 0)return o.mediaType?.includes("application/json")||o.mediaType?.includes("+json")?JSON.stringify(o.body):I(o.body)||G(o.body)||X(o.body)?o.body:JSON.stringify(o.body)},de=async(o,e,t,r,s,i,a)=>{let p=new AbortController,d={headers:i,body:r??s,method:e.method,signal:p.signal};o.WITH_CREDENTIALS&&(d.credentials=o.CREDENTIALS);for(let c of o.interceptors.request._fns)d=await c(d);return a(()=>p.abort()),await fetch(t,d)},ce=(o,e)=>{if(e){let t=o.headers.get(e);if(I(t))return t}},ue=async o=>{if(o.status!==204)try{let e=o.headers.get("Content-Type");if(e){let t=["application/octet-stream","application/pdf","application/zip","audio/","image/","video/"];if(e.includes("application/json")||e.includes("+json"))return await o.json();if(t.some(r=>e.includes(r)))return await o.blob();if(e.includes("multipart/form-data"))return await o.formData();if(e.includes("text/"))return await o.text()}}catch(e){console.error(e)}},le=(o,e)=>{let r={400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"Im a teapot",421:"Misdirected Request",422:"Unprocessable Content",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required",...o.errors}[e.status];if(r)throw new y(o,e,r);if(!e.ok){let s=e.status??"unknown",i=e.statusText??"unknown",a=(()=>{try{return JSON.stringify(e.body,null,2)}catch{return}})();throw new y(o,e,`Generic Error: status: ${s}; status text: ${i}; body: ${a}`)}},Q=(o,e)=>new D(async(t,r,s)=>{try{let i=ie(o,e),a=ne(e),p=pe(e),d=await ae(o,e);if(!s.isCancelled){let c=await de(o,e,i,p,a,d,s);for(let K of o.interceptors.response._fns)c=await K(c);let V=await ue(c),W=ce(c,e.responseHeader),F={url:i,ok:c.ok,status:c.status,statusText:c.statusText,body:W??V};le(e,F),t(F.body)}}catch(i){r(i)}});var j=class extends h{constructor(e){super(e)}request(e){return Q(this.config,e)}};var R=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e){let{appId:t,room:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:t,room:r}})}roboticsAgentControllerStatusDescription(e){let{appId:t,robotId:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:t,robotId:r}})}roboticsAgentControllerMove(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:t,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:t,mediaType:"application/json"})}roboticsAgentControllerActuate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:t,mediaType:"application/json"})}roboticsAgentControllerStatus(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:t,mediaType:"application/json"})}};var b=class{constructor(e){this.httpRequest=e}whoami(){return this.httpRequest.request({method:"GET",url:"/api/auth/whoami",errors:{401:"Not authorized"}})}login(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/login",body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}register(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/register",body:t,mediaType:"application/json"})}refreshToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/refresh",body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}edit(e){let{requestBody:t,userId:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/auth/{userId}",path:{userId:r},body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}delete(e){let{userId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/auth/{userId}",path:{userId:t},errors:{401:"Not authorized"}})}saveUser(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/admin/user",body:t,mediaType:"application/json"})}importUsers(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/admin/import",body:t,mediaType:"application/json"})}};var f=class{constructor(e){this.httpRequest=e}objectDetection(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/object-detection",body:t,mediaType:"application/json"})}detectionControllerSentimentAnalysis(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/sentiment-analysis",body:t,mediaType:"application/json"})}detectionControllerInteractionIntention(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/interaction",body:t,mediaType:"application/json"})}detectionControllerSendFrame(e){let{appId:t,cameraId:r,formData:s}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/{appId}/{cameraId}/frame",path:{appId:t,cameraId:r},formData:s,mediaType:"multipart/form-data"})}detectionControllerServe(e){let{appId:t,cameraId:r,overlay:s}=e;return this.httpRequest.request({method:"GET",url:"/api/detection/{appId}/{cameraId}/camera",path:{appId:t,cameraId:r},query:{overlay:s}})}};var T=class{constructor(e){this.httpRequest=e}save(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/dialogue/document",body:t,mediaType:"application/json"})}import(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/document",body:t,mediaType:"application/json"})}importWebsite(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/document/website",body:t,mediaType:"application/json"})}removeAll(e){let{appId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/dialogue/document/{appId}/all",path:{appId:t}})}remove(e){let{appId:t,documentId:r}=e;return this.httpRequest.request({method:"DELETE",url:"/api/dialogue/document/{appId}",path:{appId:t},query:{documentId:r}})}speak(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/tts",body:t,mediaType:"application/json"})}text(e){let{appId:t,formData:r,sampleRate:s,sessionId:i}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stt/{appId}/{sessionId}",path:{appId:t,sessionId:i},query:{sampleRate:s},formData:r,mediaType:"multipart/form-data"})}chatMessage(e){let{appId:t,requestBody:r,sessionId:s}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/chat/{appId}/{sessionId}",path:{appId:t,sessionId:s},body:r,mediaType:"application/json"})}stopAgentSpeech(e){let{appId:t,sessionId:r}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stop/{appId}/{sessionId}",path:{appId:t,sessionId:r}})}listModels(){return this.httpRequest.request({method:"GET",url:"/api/dialogue/speech/models"})}getChatHistory(e){let{sessionId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/dialogue/memory/{sessionId}",path:{sessionId:t}})}nextStep(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/tasks/next-step",body:t,mediaType:"application/json"})}setTools(e){let{repositoryId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/tools/{repositoryId}",path:{repositoryId:t},body:r,mediaType:"application/json"})}addTools(e){let{repositoryId:t,requestBody:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/dialogue/tools/{repositoryId}",path:{repositoryId:t},body:r,mediaType:"application/json"})}removeRepository(e){let{repositoryId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/dialogue/tools/{repositoryId}",path:{repositoryId:t}})}};var q=class{constructor(e){this.httpRequest=e}getUserSettings(){return this.httpRequest.request({method:"GET",url:"/api/platorm/topics/user"})}getSettings(){return this.httpRequest.request({method:"GET",url:"/api/platorm/topics"})}getClientAccessToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token",body:t,mediaType:"application/json"})}getClientAccessToken1(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/access_token",body:t,mediaType:"application/json"})}getClientRefreshToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh",body:t,mediaType:"application/json"})}getClientRefreshToken1(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh_token",body:t,mediaType:"application/json"})}getRepositoryDefaults(){return this.httpRequest.request({method:"GET",url:"/api/app/repository/defaults"})}platformAppControllerListApps(){return this.httpRequest.request({method:"GET",url:"/api/app"})}createApp(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app",body:t,mediaType:"application/json"})}updateApp(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/app",body:t,mediaType:"application/json"})}listUserApps(){return this.httpRequest.request({method:"GET",url:"/api/app/list"})}updateAppTools(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/tools",path:{appId:t},body:r,mediaType:"application/json"})}updateAppSettings(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/settings",path:{appId:t},body:r,mediaType:"application/json"})}getAppRepository(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository",path:{appId:t}})}getAppRepositoryRobots(e){let{appId:t,name:r}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/robots",path:{appId:t},query:{name:r}})}getAppRepositoryAvatars(e){let{appId:t,name:r}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/avatars",path:{appId:t},query:{name:r}})}getAppRepositoryBackgrounds(e){let{appId:t,name:r}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/backgrounds",path:{appId:t},query:{name:r}})}readApp(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}",path:{appId:t}})}removeApp(e){let{appId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/app/{appId}",path:{appId:t}})}importApps(e){let{requestBody:t,skipClients:r}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/import",query:{skipClients:r},body:t,mediaType:"application/json"})}exportApps(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/export",body:t,mediaType:"application/json"})}removeApps(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/remove",body:t,mediaType:"application/json"})}createClient(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/client",path:{appId:t},body:r,mediaType:"application/json"})}readClient(e){let{appId:t,clientId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}",path:{appId:t,clientId:r}})}removeClient(e){let{appId:t,clientId:r}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/client/{clientId}",path:{clientId:r,appId:t}})}listTopics(e){let{appId:t,clientId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}/topics",path:{appId:t,clientId:r}})}saveAppModule(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/module",path:{appId:t},body:r,mediaType:"application/json"})}getAppModule(e){let{appId:t,moduleId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:t,moduleId:r}})}removeAppModule(e){let{appId:t,moduleId:r}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:t,moduleId:r}})}savePlatformModule(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/module",body:t,mediaType:"application/json"})}refreshPlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"HEAD",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}getPlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}removePlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}monitoringAdd(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/monitoring",body:t,mediaType:"application/json"})}monitoringSearch(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/monitoring/search",body:t,mediaType:"application/json"})}};var v=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e){let{appId:t,room:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:t,room:r}})}roboticsAgentControllerStatusDescription(e){let{appId:t,robotId:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:t,robotId:r}})}roboticsAgentControllerMove(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:t,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:t,mediaType:"application/json"})}roboticsAgentControllerActuate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:t,mediaType:"application/json"})}roboticsAgentControllerStatus(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:t,mediaType:"application/json"})}navigationControllerSave(){return this.httpRequest.request({method:"POST",url:"/api/robotics/navigation/{appId}"})}navigationControllerRemove(e){let{spaceId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/robotics/navigation/{appId}/spaceId",path:{spaceId:t}})}navigationControllerGetById(e){let{spaceId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/{spaceId}",path:{spaceId:t}})}navigationControllerGetStatus(e){let{appId:t,robotId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/status/{robotId}",path:{appId:t,robotId:r}})}};var C=class{constructor(e){this.httpRequest=e}getUserSession(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/user/{appId}",path:{appId:t}})}readSession(e){let{sessionId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/{sessionId}",path:{sessionId:t}})}deleteSession(e){let{sessionId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/session/{sessionId}",path:{sessionId:t}})}createSession(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session",body:t,mediaType:"application/json"})}updateSession(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/session",body:t,mediaType:"application/json"})}support(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/support",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}setRecord(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/storage",body:t,mediaType:"application/json"})}findRecords(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/storage/search",body:t,mediaType:"application/json"})}getRecord(e){let{storageId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/storage/{storageId}",path:{storageId:t}})}deleteRecord(e){let{storageId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/session/storage/{storageId}",path:{storageId:t}})}agentUpdate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/agent",body:t,mediaType:"application/json"})}prompt(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/agent/prompt",body:t,mediaType:"application/json"})}};var A=class{constructor(e){this.httpRequest=e}notifyInteraction(e){let{appId:t,moduleId:r,requestBody:s}=e;return this.httpRequest.request({method:"PUT",url:"/api/ui/interaction/{appId}/{moduleId}",path:{appId:t,moduleId:r},body:s,mediaType:"application/json",errors:{401:"unauthorized"}})}showContent(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/ui/content/{appId}",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}generateQrCode(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/qrcode/generate",body:t,mediaType:"application/json"})}uiModelControllerMapBlendShapes(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/model/map-blend-shapes",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}getAsset(e){let{appId:t,assetId:r,type:s}=e;return this.httpRequest.request({method:"GET",url:"/api/ui/asset/{appId}/{type}/{assetId}",path:{appId:t,type:s,assetId:r}})}saveAsset(e){let{formData:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/asset",formData:t,mediaType:"multipart/form-data"})}adminSaveAsset(e){let{formData:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/admin/asset",formData:t,mediaType:"multipart/form-data"})}};var k=class{constructor(e){this.httpRequest=e}xrMarkerControllerSearchMarker(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/xr/marker/search",body:t,mediaType:"application/json"})}xrMarkerControllerSaveMarker(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/xr/marker",body:t,mediaType:"application/json"})}xrMarkerControllerDeleteMarker(e){let{markerId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/xr/marker/{markerId}",path:{":markerId":t}})}xrMarkerControllerGetMarkerQrCode(e){let{markerId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/xr/marker/{markerId}",path:{":markerId":t}})}xrOcclusionControllerOcclusion(){return this.httpRequest.request({method:"GET",url:"/api/xr/occlusion",errors:{401:"Unauthorized"}})}};var l=class{constructor(e,t=j){n(this,"agent");n(this,"authentication");n(this,"detection");n(this,"dialogue");n(this,"platform");n(this,"robotics");n(this,"session");n(this,"ui");n(this,"xr");n(this,"request");this.request=new t({BASE:e?.BASE??"",VERSION:e?.VERSION??"1.0",WITH_CREDENTIALS:e?.WITH_CREDENTIALS??!1,CREDENTIALS:e?.CREDENTIALS??"include",TOKEN:e?.TOKEN,USERNAME:e?.USERNAME,PASSWORD:e?.PASSWORD,HEADERS:e?.HEADERS,ENCODE_PATH:e?.ENCODE_PATH,interceptors:{request:new u,response:new u}}),this.agent=new R(this.request),this.authentication=new b(this.request),this.detection=new f(this.request),this.dialogue=new T(this.request),this.platform=new q(this.request),this.robotics=new v(this.request),this.session=new C(this.request),this.ui=new A(this.request),this.xr=new k(this.request)}};var Kt=(o=1e3)=>new Promise(e=>setTimeout(()=>e(),o)),ye="http://localhost:8080",J=class{constructor(e){this.config=e;n(this,"logger");n(this,"api");n(this,"events");n(this,"broker");n(this,"apiUrl");n(this,"mqttUrl");n(this,"refreshTimeout");n(this,"ready",!1);n(this,"jwt");n(this,"params",{});e.logger&&z(e.logger),this.logger=new g("SermasApiClient");let t=e.baseURL||ye;this.apiUrl=`${t}`;let r=new URL(this.apiUrl),s=r.protocol.startsWith("https");this.mqttUrl=`ws${s?"s":""}://${r.hostname}${r.port?":"+r.port:""}/mqtt`,this.api=new l({BASE:this.apiUrl,TOKEN:async()=>this.config.access_token||""}),this.broker=new $({url:this.mqttUrl,username:this.config.access_token||void 0,password:"api-client",params:this.params}),this.events=new m(this.broker)}getBroker(){return this.broker||null}async close(){this.refreshTimeout&&clearTimeout(this.refreshTimeout),await this.broker.disconnect()}init(e=!1){if(e&&(this.ready=!1),!this.ready){if(!this.config.access_token){this.logger.debug("Access token not set, skip client init");return}this.params={appId:this.config.appId},this.broker.setParams(this.params),this.broker.setToken(this.config.access_token),this.watchToken(),this.ready=!0}}watchToken(){let e=ge(this.config.access_token);this.jwt=e,this.config.clientId=this.config.clientId||e.aud;let r=new Date(e.exp*1e3).getTime()-Date.now()-30*1e3;this.logger.verbose(`Token expires in ${Math.round(r/1e3/60/60)}min`),this.refreshTimeout&&clearTimeout(this.refreshTimeout),this.refreshTimeout=setTimeout(()=>this.refreshToken(),r)}async refreshToken(){this.logger.verbose("Refreshing token");let e;try{e=await this.api.platform.getClientRefreshToken({requestBody:{refreshToken:this.config.refresh_token,appId:this.config.appId,clientId:this.config.clientId,clientSecret:this.config.clientSecret}})}catch(t){this.logger.error(`Refresh token failed: ${t.stack}`);return}if(!e){this.logger.warn("Failed to refresh token, no response");return}return this.config.access_token=e.access_token,this.config.refresh_token=e.refresh_token,this.init(!0),e}async loadToken(e,t,r){let s=new l({BASE:this.apiUrl});this.config.appId=r||this.config.appId;let i=await s.platform.getClientAccessToken({requestBody:{clientId:e,clientSecret:t,appId:this.config.appId}});return this.config.clientId=e,this.config.clientSecret=t,this.config.appId=r||this.config.appId,this.config.access_token=i.access_token,this.config.refresh_token=i.refresh_token,this.init(!0),i}setToken(e,t,r){if(typeof e!="string"){let s=e;e=s.access_token,t=s.refresh_token,r=s.appId}this.config.access_token=e,this.config.refresh_token=t,r!==void 0&&(this.config.appId=r),this.init(!0)}async login(e,t,r){let s=new l({BASE:this.apiUrl});this.config.appId=r||this.config.appId;let i=await s.authentication.login({requestBody:{username:e,password:t,appId:this.config.appId}});return this.config.access_token=i.access_token,this.config.refresh_token=i.refresh_token,this.init(!0),i}};export{g as Logger,J as SermasApiClient,Kt as sleep};
|
|
1
|
+
var Y=Object.defineProperty;var Z=(o,e,t)=>e in o?Y(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var n=(o,e,t)=>(Z(o,typeof e!="symbol"?e+"":e,t),t);import{jwtDecode as ge}from"jwt-decode";var x=class{constructor(e){this.broker=e}async tokenRequested(e,t){return this.broker.publish("app/:appId/platform/token",e,t)}async onTokenRequested(e,t){return this.broker.subscribe("app/:appId/platform/token",e,t)}async appChanged(e,t){return this.broker.publish("app/:appId/platform/app/changed/:appId",e,t)}async onAppChanged(e,t){return this.broker.subscribe("app/:appId/platform/app/changed/:appId",e,t)}async clientChanged(e,t){return this.broker.publish("app/:appId/platform/client/changed/:clientId",e,t)}async onClientChanged(e,t){return this.broker.subscribe("app/:appId/platform/client/changed/:clientId",e,t)}async appModuleChanged(e,t){return this.broker.publish("app/:appId/platform/module",e,t)}async onAppModuleChanged(e,t){return this.broker.subscribe("app/:appId/platform/module",e,t)}async record(e,t){return this.broker.publish("app/:appId/platform/monitoring",e,t)}async onRecord(e,t){return this.broker.subscribe("app/:appId/platform/monitoring",e,t)}};var P=class{constructor(e){this.broker=e}async userUpdate(e,t){return this.broker.publish("app/:appId/auth/update",e,t)}async onUserUpdate(e,t){return this.broker.subscribe("app/:appId/auth/update",e,t)}async userRegistration(e,t){return this.broker.publish("app/:appId/auth/create",e,t)}async onUserRegistration(e,t){return this.broker.subscribe("app/:appId/auth/create",e,t)}async userLogin(e,t){return this.broker.publish("app/:appId/auth/login",e,t)}async onUserLogin(e,t){return this.broker.subscribe("app/:appId/auth/login",e,t)}};var S=class{constructor(e){this.broker=e}async moduleChanged(e,t){return this.broker.publish("system/platform/module/changed/:moduleId",e,t)}async onModuleChanged(e,t){return this.broker.subscribe("system/platform/module/changed/:moduleId",e,t)}};var E=class{constructor(e){this.broker=e}async userDetected(e,t){return this.broker.publish("app/:appId/detection/user",e,t)}async onUserDetected(e,t){return this.broker.subscribe("app/:appId/detection/user",e,t)}async interactionIntention(e,t){return this.broker.publish("app/:appId/detection/interaction",e,t)}async onInteractionIntention(e,t){return this.broker.subscribe("app/:appId/detection/interaction",e,t)}async userCharacterization(e,t){return this.broker.publish("app/:appId/detection/characterization",e,t)}async onUserCharacterization(e,t){return this.broker.subscribe("app/:appId/detection/characterization",e,t)}async audioClassification(e,t){return this.broker.publish("app/:appId/detection/audio",e,t)}async onAudioClassification(e,t){return this.broker.subscribe("app/:appId/detection/audio",e,t)}async objectDetected(e,t){return this.broker.publish("app/:appId/detection/object",e,t)}async onObjectDetected(e,t){return this.broker.subscribe("app/:appId/detection/object",e,t)}async qrCodeDetected(e,t){return this.broker.publish("app/:appId/detection/qr_code",e,t)}async onQrCodeDetected(e,t){return this.broker.subscribe("app/:appId/detection/qr_code",e,t)}async noise(e,t){return this.broker.publish("app/:appId/detection/noise",e,t)}async onNoise(e,t){return this.broker.subscribe("app/:appId/detection/noise",e,t)}};var U=class{constructor(e){this.broker=e}async dialogueMessages(e,t){return this.broker.publish("app/:appId/dialogue/messages/:sessionId",e,t)}async onDialogueMessages(e,t){return this.broker.subscribe("app/:appId/dialogue/messages/:sessionId",e,t)}async agentSpeech(e,t){return this.broker.publish("app/:appId/dialogue/speech/:sessionId/:chunkId",e,t)}async onAgentSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/speech/:sessionId/:chunkId",e,t)}async agentStopSpeech(e,t){return this.broker.publish("app/:appId/dialogue/stop/:sessionId",e,t)}async onAgentStopSpeech(e,t){return this.broker.subscribe("app/:appId/dialogue/stop/:sessionId",e,t)}async taskChanged(e,t){return this.broker.publish("app/:appId/dialogue/task/changed/:taskId",e,t)}async onTaskChanged(e,t){return this.broker.subscribe("app/:appId/dialogue/task/changed/:taskId",e,t)}async taskProgress(e,t){return this.broker.publish("app/:appId/dialogue/task/progress/:taskId",e,t)}async onTaskProgress(e,t){return this.broker.subscribe("app/:appId/dialogue/task/progress/:taskId",e,t)}async recordChanged(e,t){return this.broker.publish("app/:appId/dialogue/task/record/:taskId",e,t)}async onRecordChanged(e,t){return this.broker.subscribe("app/:appId/dialogue/task/record/:taskId",e,t)}async fieldHandler(e,t){return this.broker.publish("app/:appId/dialogue/task/handler",e,t)}async onFieldHandler(e,t){return this.broker.subscribe("app/:appId/dialogue/task/handler",e,t)}async toolTriggered(e,t){return this.broker.publish("app/:appId/dialogue/tool/:name",e,t)}async onToolTriggered(e,t){return this.broker.subscribe("app/:appId/dialogue/tool/:name",e,t)}async toolChanged(e,t){return this.broker.publish("app/:appId/dialogue/tool/changed/:repositoryId",e,t)}async onToolChanged(e,t){return this.broker.subscribe("app/:appId/dialogue/tool/changed/:repositoryId",e,t)}};var M=class{constructor(e){this.broker=e}async userInteraction(e,t){return this.broker.publish("app/:appId/session/interaction/user",e,t)}async onUserInteraction(e,t){return this.broker.subscribe("app/:appId/session/interaction/user",e,t)}async sessionChanged(e,t){return this.broker.publish("app/:appId/session/session/changed/:sessionId",e,t)}async onSessionChanged(e,t){return this.broker.subscribe("app/:appId/session/session/changed/:sessionId",e,t)}async support(e,t){return this.broker.publish("app/:appId/session/support",e,t)}async onSupport(e,t){return this.broker.subscribe("app/:appId/session/support",e,t)}async storageUpdated(e,t){return this.broker.publish("app/:appId/session/storage/:storageId",e,t)}async onStorageUpdated(e,t){return this.broker.subscribe("app/:appId/session/storage/:storageId",e,t)}async agentInteraction(e,t){return this.broker.publish("app/:appId/session/interaction/agent",e,t)}async onAgentInteraction(e,t){return this.broker.subscribe("app/:appId/session/interaction/agent",e,t)}async agentChanged(e,t){return this.broker.publish("app/:appId/session/agent/changed/:agentId",e,t)}async onAgentChanged(e,t){return this.broker.subscribe("app/:appId/session/agent/changed/:agentId",e,t)}};var O=class{constructor(e){this.broker=e}async assetChanged(e,t){return this.broker.publish("app/:appId/ui/status",e,t)}async onAssetChanged(e,t){return this.broker.subscribe("app/:appId/ui/status",e,t)}async content(e,t){return this.broker.publish("app/:appId/ui/content",e,t)}async onContent(e,t){return this.broker.subscribe("app/:appId/ui/content",e,t)}async interaction(e,t){return this.broker.publish("app/:appId/ui/interaction/:moduleId",e,t)}async onInteraction(e,t){return this.broker.subscribe("app/:appId/ui/interaction/:moduleId",e,t)}};var w=class{constructor(e){this.broker=e}async detected(e,t){return this.broker.publish("app/:appId/xr/marker/detected",e,t)}async onDetected(e,t){return this.broker.subscribe("app/:appId/xr/marker/detected",e,t)}async changed(e,t){return this.broker.publish("app/:appId/xr/marker/changed/:markerId",e,t)}async onChanged(e,t){return this.broker.subscribe("app/:appId/xr/marker/changed/:markerId",e,t)}async occluded(e,t){return this.broker.publish("app/:appId/xr/occlusion",e,t)}async onOccluded(e,t){return this.broker.subscribe("app/:appId/xr/occlusion",e,t)}};var B=class{constructor(e){this.broker=e}async actuate(e,t){return this.broker.publish("app/:appId/robotics/actuate",e,t)}async onActuate(e,t){return this.broker.subscribe("app/:appId/robotics/actuate",e,t)}async move(e,t){return this.broker.publish("app/:appId/robotics/move",e,t)}async onMove(e,t){return this.broker.subscribe("app/:appId/robotics/move",e,t)}async robotStatus(e,t){return this.broker.publish("app/:appId/robotics/status",e,t)}async onRobotStatus(e,t){return this.broker.subscribe("app/:appId/robotics/status",e,t)}async initialPose(e,t){return this.broker.publish("app/:appId/robotics/initialpose",e,t)}async onInitialPose(e,t){return this.broker.subscribe("app/:appId/robotics/initialpose",e,t)}async opState(e,t){return this.broker.publish("app/:appId/robotics/opstate",e,t)}async onOpState(e,t){return this.broker.subscribe("app/:appId/robotics/opstate",e,t)}};var m=class{constructor(e){this.broker=e;n(this,"platform");n(this,"auth");n(this,"module");n(this,"detection");n(this,"dialogue");n(this,"session");n(this,"ui");n(this,"xr");n(this,"robotics");this.platform=new x(e),this.auth=new P(e),this.module=new S(e),this.detection=new E(e),this.dialogue=new U(e),this.session=new M(e),this.ui=new O(e),this.xr=new w(e),this.robotics=new B(e)}};import te from"mqtt";var N,z=o=>{N=o},ee=(o="logger")=>new class{format(e){return`[${o}] ${e}`}debug(e,...t){console.debug(this.format(e))}error(e,...t){console.error(this.format(e))}fatal(e,...t){console.error(this.format(e))}log(e,...t){console.info(this.format(e))}setLogLevels(e){}verbose(e,...t){console.debug(this.format(e))}warn(e,...t){console.warn(this.format(e))}},g=class{constructor(e){n(this,"logger");this.logger=N||ee(e)}debug(e,...t){this.logger.debug(e)}error(e,...t){this.logger.error(e)}fatal(e,...t){this.logger.error(e)}log(e,...t){(this.logger.info||this.logger.log).apply(this.logger,[e])}setLogLevels(e){}verbose(e,...t){this.logger.verbose(e)}warn(e,...t){this.logger.warn(e)}};var $=class o{constructor(e){this.config=e;n(this,"logger",new g(o.name));n(this,"client");n(this,"subscriptions",[])}async reconnect(){this.logger.warn("Forcing reconnection");try{await this.disconnect()}catch(e){this.logger.warn(`reconnect: disconnection error ${e.stack}`)}try{this.client=void 0,await this.connect()}catch(e){this.logger.warn(`reconnect: connection error ${e.stack}`)}}async disconnect(){if(this.client)try{await this.client.endAsync(!0)}catch(e){this.logger.warn(`Error closing broker connection: ${e.stack}`)}}setParams(e){this.config.params=e}setToken(e){this.config.username=e,this.client&&(this.logger.debug("Token updated, reconnecting"),this.client.options.username=e,this.client.reconnect())}getClient(){return this.client||null}connect(){if(!this.client){if(!this.config.username){this.logger.debug("Skip mqtt connection, missing token");return}this.logger.debug(`Connecting to ${this.config.url}`),this.client=te.connect(this.config.url,{username:this.config.username,password:this.config.password}),this.client.on("connect",async()=>{this.logger.debug("client connected");try{for(let e of this.subscriptions)this.logger.debug(`SUB ${e.topic}`),await this.client.subscribeAsync(e.topic)}catch(e){this.logger.warn(`Subscription failed: ${e.stack}`),setTimeout(()=>this.reconnect(),1e3)}}),this.client.on("error",e=>{this.logger.error(`mqtt client error ${e.stack}`)}),this.client.on("disconnect",()=>{this.logger.warn("mqtt disconnected")}),this.client.on("reconnect",()=>{this.logger.debug("mqtt reconnecting")}),this.client.on("connect",()=>{this.logger.debug("mqtt connected")}),this.client.on("message",(e,t)=>{let r=t;try{r=JSON.parse(t.toString())}catch{}this.logger.debug(`MSG ${e}`);let s=e.indexOf("#");s>-1&&(e=e.substring(0,s));let i=this.parseTopic(e),a=p=>p==="+";this.subscriptions.forEach(p=>{if(p.type===i.type&&!(!a(p.appId)&&p.appId!==i.appId)&&!(!a(p.resource)&&p.resource!==i.resource)&&!(!a(p.scope)&&p.scope!==i.scope)){for(let d in i.context||[])if(!a(p.context[d])&&p.context[d]!==i.context[d])return;p.callback(r)}})})}}parseTopic(e){let t=e.split("/"),[r,s,i,a]=t,p=t.slice(3);return{type:r,appId:s,resource:i,scope:a,context:p}}subscribe(e,t,r){return this.connect(),e=this.replaceTopicParams(e,{...r||{}}),this.subscriptions.push({...this.parseTopic(e),topic:e,callback:t}),()=>{let s=this.subscriptions.findIndex(a=>a.topic===e&&a.callback===t);if(s===-1)return null;let i=this.subscriptions[s];this.subscriptions.splice(s,1);try{this.client.unsubscribe(i.topic,i.callback)}catch{}}}async publish(e,t,r){let s=t.byteLength!==void 0,i;s?i=t:i=JSON.stringify(t);try{e=this.replaceTopicParams(e,{...s?{}:t,...r||{}}),await this.client.publishAsync(e,i)}catch{return!1}return!0}replaceTopicParams(e,t){t={...this.config?.params||{},...t||{}};for(let r of Object.keys(t)){let s=`:${r}`,i=t[r];if(i!=null){if(typeof i=="object"&&!Array.isArray(i)){e=this.replaceTopicParams(e,i);continue}if(!(typeof i!="string"&&typeof i!="number"))for(;e.indexOf(s)>-1;)e=e.replace(s,i.toString())}}return e=e.split("/").map(r=>r[0]===":"?"+":r).join("/"),e}};var u=class{constructor(){n(this,"_fns");this._fns=[]}eject(e){let t=this._fns.indexOf(e);t!==-1&&(this._fns=[...this._fns.slice(0,t),...this._fns.slice(t+1)])}use(e){this._fns=[...this._fns,e]}},re={BASE:"",CREDENTIALS:"include",ENCODE_PATH:void 0,HEADERS:void 0,PASSWORD:void 0,RESULT:"body",TOKEN:void 0,USERNAME:void 0,VERSION:"1.0",WITH_CREDENTIALS:!1,interceptors:{request:new u,response:new u}};var h=class{constructor(e){this.config=e}};var y=class extends Error{constructor(t,r,s){super(s);n(this,"url");n(this,"status");n(this,"statusText");n(this,"body");n(this,"request");this.name="ApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.body=r.body,this.request=t}};var L=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},D=class{constructor(e){n(this,"_isResolved");n(this,"_isRejected");n(this,"_isCancelled");n(this,"cancelHandlers");n(this,"promise");n(this,"_resolve");n(this,"_reject");this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this.cancelHandlers=[],this.promise=new Promise((t,r)=>{this._resolve=t,this._reject=r;let s=p=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(p))},i=p=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(p))},a=p=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(p)};return Object.defineProperty(a,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(a,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(a,"isCancelled",{get:()=>this._isCancelled}),e(s,i,a)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,t){return this.promise.then(e,t)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this.cancelHandlers.length)try{for(let e of this.cancelHandlers)e()}catch(e){console.warn("Cancellation threw an error",e);return}this.cancelHandlers.length=0,this._reject&&this._reject(new L("Request aborted"))}}get isCancelled(){return this._isCancelled}};var I=o=>typeof o=="string",H=o=>I(o)&&o!=="",G=o=>o instanceof Blob,X=o=>o instanceof FormData,oe=o=>{try{return btoa(o)}catch{return Buffer.from(o).toString("base64")}},se=o=>{let e=[],t=(s,i)=>{e.push(`${encodeURIComponent(s)}=${encodeURIComponent(String(i))}`)},r=(s,i)=>{i!=null&&(Array.isArray(i)?i.forEach(a=>r(s,a)):typeof i=="object"?Object.entries(i).forEach(([a,p])=>r(`${s}[${a}]`,p)):t(s,i))};return Object.entries(o).forEach(([s,i])=>r(s,i)),e.length?`?${e.join("&")}`:""},ie=(o,e)=>{let t=o.ENCODE_PATH||encodeURI,r=e.url.replace("{api-version}",o.VERSION).replace(/{(.*?)}/g,(i,a)=>e.path?.hasOwnProperty(a)?t(String(e.path[a])):i),s=o.BASE+r;return e.query?s+se(e.query):s},ne=o=>{if(o.formData){let e=new FormData,t=(r,s)=>{I(s)||G(s)?e.append(r,s):e.append(r,JSON.stringify(s))};return Object.entries(o.formData).filter(([,r])=>r!=null).forEach(([r,s])=>{Array.isArray(s)?s.forEach(i=>t(r,i)):t(r,s)}),e}},_=async(o,e)=>typeof e=="function"?e(o):e,ae=async(o,e)=>{let[t,r,s,i]=await Promise.all([_(e,o.TOKEN),_(e,o.USERNAME),_(e,o.PASSWORD),_(e,o.HEADERS)]),a=Object.entries({Accept:"application/json",...i,...e.headers}).filter(([,p])=>p!=null).reduce((p,[d,c])=>({...p,[d]:String(c)}),{});if(H(t)&&(a.Authorization=`Bearer ${t}`),H(r)&&H(s)){let p=oe(`${r}:${s}`);a.Authorization=`Basic ${p}`}return e.body!==void 0&&(e.mediaType?a["Content-Type"]=e.mediaType:G(e.body)?a["Content-Type"]=e.body.type||"application/octet-stream":I(e.body)?a["Content-Type"]="text/plain":X(e.body)||(a["Content-Type"]="application/json")),new Headers(a)},pe=o=>{if(o.body!==void 0)return o.mediaType?.includes("application/json")||o.mediaType?.includes("+json")?JSON.stringify(o.body):I(o.body)||G(o.body)||X(o.body)?o.body:JSON.stringify(o.body)},de=async(o,e,t,r,s,i,a)=>{let p=new AbortController,d={headers:i,body:r??s,method:e.method,signal:p.signal};o.WITH_CREDENTIALS&&(d.credentials=o.CREDENTIALS);for(let c of o.interceptors.request._fns)d=await c(d);return a(()=>p.abort()),await fetch(t,d)},ce=(o,e)=>{if(e){let t=o.headers.get(e);if(I(t))return t}},ue=async o=>{if(o.status!==204)try{let e=o.headers.get("Content-Type");if(e){let t=["application/octet-stream","application/pdf","application/zip","audio/","image/","video/"];if(e.includes("application/json")||e.includes("+json"))return await o.json();if(t.some(r=>e.includes(r)))return await o.blob();if(e.includes("multipart/form-data"))return await o.formData();if(e.includes("text/"))return await o.text()}}catch(e){console.error(e)}},le=(o,e)=>{let r={400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"Im a teapot",421:"Misdirected Request",422:"Unprocessable Content",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required",...o.errors}[e.status];if(r)throw new y(o,e,r);if(!e.ok){let s=e.status??"unknown",i=e.statusText??"unknown",a=(()=>{try{return JSON.stringify(e.body,null,2)}catch{return}})();throw new y(o,e,`Generic Error: status: ${s}; status text: ${i}; body: ${a}`)}},Q=(o,e)=>new D(async(t,r,s)=>{try{let i=ie(o,e),a=ne(e),p=pe(e),d=await ae(o,e);if(!s.isCancelled){let c=await de(o,e,i,p,a,d,s);for(let K of o.interceptors.response._fns)c=await K(c);let V=await ue(c),W=ce(c,e.responseHeader),F={url:i,ok:c.ok,status:c.status,statusText:c.statusText,body:W??V};le(e,F),t(F.body)}}catch(i){r(i)}});var j=class extends h{constructor(e){super(e)}request(e){return Q(this.config,e)}};var R=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e){let{appId:t,room:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:t,room:r}})}roboticsAgentControllerStatusDescription(e){let{appId:t,robotId:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:t,robotId:r}})}roboticsAgentControllerMove(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:t,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:t,mediaType:"application/json"})}roboticsAgentControllerActuate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:t,mediaType:"application/json"})}roboticsAgentControllerStatus(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:t,mediaType:"application/json"})}};var f=class{constructor(e){this.httpRequest=e}whoami(){return this.httpRequest.request({method:"GET",url:"/api/auth/whoami",errors:{401:"Not authorized"}})}login(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/login",body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}register(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/register",body:t,mediaType:"application/json"})}refreshToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/refresh",body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}edit(e){let{requestBody:t,userId:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/auth/{userId}",path:{userId:r},body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}delete(e){let{userId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/auth/{userId}",path:{userId:t},errors:{401:"Not authorized"}})}saveUser(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/admin/user",body:t,mediaType:"application/json"})}importUsers(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/auth/admin/import",body:t,mediaType:"application/json"})}};var b=class{constructor(e){this.httpRequest=e}objectDetection(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/object-detection",body:t,mediaType:"application/json"})}detectionControllerSentimentAnalysis(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/sentiment-analysis",body:t,mediaType:"application/json"})}detectionControllerInteractionIntention(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/interaction",body:t,mediaType:"application/json"})}detectionControllerSendFrame(e){let{appId:t,cameraId:r,formData:s}=e;return this.httpRequest.request({method:"POST",url:"/api/detection/{appId}/{cameraId}/frame",path:{appId:t,cameraId:r},formData:s,mediaType:"multipart/form-data"})}detectionControllerServe(e){let{appId:t,cameraId:r,overlay:s}=e;return this.httpRequest.request({method:"GET",url:"/api/detection/{appId}/{cameraId}/camera",path:{appId:t,cameraId:r},query:{overlay:s}})}};var T=class{constructor(e){this.httpRequest=e}save(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/dialogue/document",body:t,mediaType:"application/json"})}import(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/document",body:t,mediaType:"application/json"})}importWebsite(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/document/website",body:t,mediaType:"application/json"})}removeAll(e){let{appId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/dialogue/document/{appId}/all",path:{appId:t}})}remove(e){let{appId:t,documentId:r}=e;return this.httpRequest.request({method:"DELETE",url:"/api/dialogue/document/{appId}",path:{appId:t},query:{documentId:r}})}speak(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/tts",body:t,mediaType:"application/json"})}text(e){let{appId:t,formData:r,sampleRate:s,sessionId:i}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stt/{appId}/{sessionId}",path:{appId:t,sessionId:i},query:{sampleRate:s},formData:r,mediaType:"multipart/form-data"})}chatMessage(e){let{appId:t,requestBody:r,sessionId:s}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/chat/{appId}/{sessionId}",path:{appId:t,sessionId:s},body:r,mediaType:"application/json"})}stopAgentSpeech(e){let{appId:t,sessionId:r}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stop/{appId}/{sessionId}",path:{appId:t,sessionId:r}})}listModels(){return this.httpRequest.request({method:"GET",url:"/api/dialogue/speech/models"})}getChatHistory(e){let{sessionId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/dialogue/memory/{sessionId}",path:{sessionId:t}})}nextStep(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/tasks/next-step",body:t,mediaType:"application/json"})}setTools(e){let{repositoryId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/dialogue/tools/{repositoryId}",path:{repositoryId:t},body:r,mediaType:"application/json"})}addTools(e){let{repositoryId:t,requestBody:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/dialogue/tools/{repositoryId}",path:{repositoryId:t},body:r,mediaType:"application/json"})}removeRepository(e){let{repositoryId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/dialogue/tools/{repositoryId}",path:{repositoryId:t}})}};var q=class{constructor(e){this.httpRequest=e}getUserSettings(){return this.httpRequest.request({method:"GET",url:"/api/platorm/topics/user"})}getSettings(){return this.httpRequest.request({method:"GET",url:"/api/platorm/topics"})}getClientAccessToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token",body:t,mediaType:"application/json"})}getClientAccessToken1(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/access_token",body:t,mediaType:"application/json"})}getClientRefreshToken(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh",body:t,mediaType:"application/json"})}getClientRefreshToken1(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh_token",body:t,mediaType:"application/json"})}getRepositoryDefaults(){return this.httpRequest.request({method:"GET",url:"/api/app/repository/defaults"})}platformAppControllerListApps(){return this.httpRequest.request({method:"GET",url:"/api/app"})}createApp(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app",body:t,mediaType:"application/json"})}updateApp(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/app",body:t,mediaType:"application/json"})}listUserApps(){return this.httpRequest.request({method:"GET",url:"/api/app/list"})}updateAppTools(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/tools",path:{appId:t},body:r,mediaType:"application/json"})}updateAppSettings(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/settings",path:{appId:t},body:r,mediaType:"application/json"})}getAppRepository(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository",path:{appId:t}})}getAppRepositoryRobots(e){let{appId:t,name:r}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/robots",path:{appId:t},query:{name:r}})}getAppRepositoryAvatars(e){let{appId:t,name:r}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/avatars",path:{appId:t},query:{name:r}})}getAppRepositoryBackgrounds(e){let{appId:t,name:r}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/backgrounds",path:{appId:t},query:{name:r}})}readApp(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/app/{appId}",path:{appId:t}})}removeApp(e){let{appId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/app/{appId}",path:{appId:t}})}importApps(e){let{requestBody:t,skipClients:r}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/import",query:{skipClients:r},body:t,mediaType:"application/json"})}exportApps(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/export",body:t,mediaType:"application/json"})}removeApps(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/app/admin/remove",body:t,mediaType:"application/json"})}createClient(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/client",path:{appId:t},body:r,mediaType:"application/json"})}readClient(e){let{appId:t,clientId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}",path:{appId:t,clientId:r}})}removeClient(e){let{appId:t,clientId:r}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/client/{clientId}",path:{clientId:r,appId:t}})}listTopics(e){let{appId:t,clientId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}/topics",path:{appId:t,clientId:r}})}saveAppModule(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/module",path:{appId:t},body:r,mediaType:"application/json"})}getAppModule(e){let{appId:t,moduleId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:t,moduleId:r}})}removeAppModule(e){let{appId:t,moduleId:r}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:t,moduleId:r}})}savePlatformModule(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/module",body:t,mediaType:"application/json"})}refreshPlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"HEAD",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}getPlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}removePlatformModule(e){let{moduleId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/platform/module/{moduleId}",path:{moduleId:t}})}monitoringAdd(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/monitoring",body:t,mediaType:"application/json"})}monitoringSearch(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/platform/monitoring/search",body:t,mediaType:"application/json"})}};var v=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e){let{appId:t,room:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:t,room:r}})}roboticsAgentControllerStatusDescription(e){let{appId:t,robotId:r}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:t,robotId:r}})}roboticsAgentControllerMove(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:t,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:t,mediaType:"application/json"})}roboticsAgentControllerActuate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:t,mediaType:"application/json"})}roboticsAgentControllerStatus(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:t,mediaType:"application/json"})}navigationControllerSave(){return this.httpRequest.request({method:"POST",url:"/api/robotics/navigation/{appId}"})}navigationControllerRemove(e){let{spaceId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/robotics/navigation/{appId}/spaceId",path:{spaceId:t}})}navigationControllerGetById(e){let{spaceId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/{spaceId}",path:{spaceId:t}})}navigationControllerGetStatus(e){let{appId:t,robotId:r}=e;return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/status/{robotId}",path:{appId:t,robotId:r}})}};var C=class{constructor(e){this.httpRequest=e}getUserSession(e){let{appId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/user/{appId}",path:{appId:t}})}search(e){let{appId:t,requestBody:r}=e;return this.httpRequest.request({method:"POST",url:"/api/session/search/{appId}",path:{appId:t},body:r,mediaType:"application/json"})}readSession(e){let{sessionId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/{sessionId}",path:{sessionId:t}})}deleteSession(e){let{sessionId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/session/{sessionId}",path:{sessionId:t}})}createSession(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session",body:t,mediaType:"application/json"})}updateSession(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/session",body:t,mediaType:"application/json"})}support(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/support",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}setRecord(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/storage",body:t,mediaType:"application/json"})}findRecords(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/storage/search",body:t,mediaType:"application/json"})}getRecord(e){let{storageId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/session/storage/{storageId}",path:{storageId:t}})}deleteRecord(e){let{storageId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/session/storage/{storageId}",path:{storageId:t}})}agentUpdate(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/agent",body:t,mediaType:"application/json"})}prompt(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/session/agent/prompt",body:t,mediaType:"application/json"})}};var A=class{constructor(e){this.httpRequest=e}notifyInteraction(e){let{appId:t,moduleId:r,requestBody:s}=e;return this.httpRequest.request({method:"PUT",url:"/api/ui/interaction/{appId}/{moduleId}",path:{appId:t,moduleId:r},body:s,mediaType:"application/json",errors:{401:"unauthorized"}})}showContent(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/ui/content/{appId}",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}generateQrCode(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/qrcode/generate",body:t,mediaType:"application/json"})}uiModelControllerMapBlendShapes(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/model/map-blend-shapes",body:t,mediaType:"application/json",errors:{401:"unauthorized"}})}getAsset(e){let{appId:t,assetId:r,type:s}=e;return this.httpRequest.request({method:"GET",url:"/api/ui/asset/{appId}/{type}/{assetId}",path:{appId:t,type:s,assetId:r}})}saveAsset(e){let{formData:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/asset",formData:t,mediaType:"multipart/form-data"})}adminSaveAsset(e){let{formData:t}=e;return this.httpRequest.request({method:"POST",url:"/api/ui/admin/asset",formData:t,mediaType:"multipart/form-data"})}};var k=class{constructor(e){this.httpRequest=e}xrMarkerControllerSearchMarker(e){let{requestBody:t}=e;return this.httpRequest.request({method:"POST",url:"/api/xr/marker/search",body:t,mediaType:"application/json"})}xrMarkerControllerSaveMarker(e){let{requestBody:t}=e;return this.httpRequest.request({method:"PUT",url:"/api/xr/marker",body:t,mediaType:"application/json"})}xrMarkerControllerDeleteMarker(e){let{markerId:t}=e;return this.httpRequest.request({method:"DELETE",url:"/api/xr/marker/{markerId}",path:{":markerId":t}})}xrMarkerControllerGetMarkerQrCode(e){let{markerId:t}=e;return this.httpRequest.request({method:"GET",url:"/api/xr/marker/{markerId}",path:{":markerId":t}})}xrOcclusionControllerOcclusion(){return this.httpRequest.request({method:"GET",url:"/api/xr/occlusion",errors:{401:"Unauthorized"}})}};var l=class{constructor(e,t=j){n(this,"agent");n(this,"authentication");n(this,"detection");n(this,"dialogue");n(this,"platform");n(this,"robotics");n(this,"session");n(this,"ui");n(this,"xr");n(this,"request");this.request=new t({BASE:e?.BASE??"",VERSION:e?.VERSION??"1.0",WITH_CREDENTIALS:e?.WITH_CREDENTIALS??!1,CREDENTIALS:e?.CREDENTIALS??"include",TOKEN:e?.TOKEN,USERNAME:e?.USERNAME,PASSWORD:e?.PASSWORD,HEADERS:e?.HEADERS,ENCODE_PATH:e?.ENCODE_PATH,interceptors:{request:new u,response:new u}}),this.agent=new R(this.request),this.authentication=new f(this.request),this.detection=new b(this.request),this.dialogue=new T(this.request),this.platform=new q(this.request),this.robotics=new v(this.request),this.session=new C(this.request),this.ui=new A(this.request),this.xr=new k(this.request)}};var Kt=(o=1e3)=>new Promise(e=>setTimeout(()=>e(),o)),ye="http://localhost:8080",J=class{constructor(e){this.config=e;n(this,"logger");n(this,"api");n(this,"events");n(this,"broker");n(this,"apiUrl");n(this,"mqttUrl");n(this,"refreshTimeout");n(this,"ready",!1);n(this,"jwt");n(this,"params",{});e.logger&&z(e.logger),this.logger=new g("SermasApiClient");let t=e.baseURL||ye;this.apiUrl=`${t}`;let r=new URL(this.apiUrl),s=r.protocol.startsWith("https");this.mqttUrl=`ws${s?"s":""}://${r.hostname}${r.port?":"+r.port:""}/mqtt`,this.api=new l({BASE:this.apiUrl,TOKEN:async()=>this.config.access_token||""}),this.broker=new $({url:this.mqttUrl,username:this.config.access_token||void 0,password:"api-client",params:this.params}),this.events=new m(this.broker)}getBroker(){return this.broker||null}async close(){this.refreshTimeout&&clearTimeout(this.refreshTimeout),await this.broker.disconnect()}init(e=!1){if(e&&(this.ready=!1),!this.ready){if(!this.config.access_token){this.logger.debug("Access token not set, skip client init");return}this.params={appId:this.config.appId},this.broker.setParams(this.params),this.broker.setToken(this.config.access_token),this.watchToken(),this.ready=!0}}watchToken(){let e=ge(this.config.access_token);this.jwt=e,this.config.clientId=this.config.clientId||e.aud;let r=new Date(e.exp*1e3).getTime()-Date.now()-30*1e3;this.logger.verbose(`Token expires in ${Math.round(r/1e3/60/60)}min`),this.refreshTimeout&&clearTimeout(this.refreshTimeout),this.refreshTimeout=setTimeout(()=>this.refreshToken(),r)}async refreshToken(){this.logger.verbose("Refreshing token");let e;try{e=await this.api.platform.getClientRefreshToken({requestBody:{refreshToken:this.config.refresh_token,appId:this.config.appId,clientId:this.config.clientId,clientSecret:this.config.clientSecret}})}catch(t){this.logger.error(`Refresh token failed: ${t.stack}`);return}if(!e){this.logger.warn("Failed to refresh token, no response");return}return this.config.access_token=e.access_token,this.config.refresh_token=e.refresh_token,this.init(!0),e}async loadToken(e,t,r){let s=new l({BASE:this.apiUrl});this.config.appId=r||this.config.appId;let i=await s.platform.getClientAccessToken({requestBody:{clientId:e,clientSecret:t,appId:this.config.appId}});return this.config.clientId=e,this.config.clientSecret=t,this.config.appId=r||this.config.appId,this.config.access_token=i.access_token,this.config.refresh_token=i.refresh_token,this.init(!0),i}setToken(e,t,r){if(typeof e!="string"){let s=e;e=s.access_token,t=s.refresh_token,r=s.appId}this.config.access_token=e,this.config.refresh_token=t,r!==void 0&&(this.config.appId=r),this.init(!0)}async login(e,t,r){let s=new l({BASE:this.apiUrl});this.config.appId=r||this.config.appId;let i=await s.authentication.login({requestBody:{username:e,password:t,appId:this.config.appId}});return this.config.access_token=i.access_token,this.config.refresh_token=i.refresh_token,this.init(!0),i}};export{g as Logger,J as SermasApiClient,Kt as sleep};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|