@sermas/api-client 1.0.0-alpha.23 → 1.0.0-alpha.24
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 +51 -62
- package/index.d.ts +51 -62
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.cts
CHANGED
|
@@ -1159,7 +1159,7 @@ type SessionDto = {
|
|
|
1159
1159
|
closedAt: string;
|
|
1160
1160
|
};
|
|
1161
1161
|
|
|
1162
|
-
type
|
|
1162
|
+
type SessionStorageRecordDto = {
|
|
1163
1163
|
appId: string;
|
|
1164
1164
|
/**
|
|
1165
1165
|
* Reference to the authenticated client the request originated from
|
|
@@ -1169,45 +1169,16 @@ type SessionStorageEventDto = {
|
|
|
1169
1169
|
* Reference to the user interacting with the system
|
|
1170
1170
|
*/
|
|
1171
1171
|
userId?: string;
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
storageId: string;
|
|
1175
|
-
};
|
|
1176
|
-
|
|
1177
|
-
type SessionStorageRequestDto = {
|
|
1178
|
-
appId: string;
|
|
1179
|
-
/**
|
|
1180
|
-
* Reference to the authenticated client the request originated from
|
|
1181
|
-
*/
|
|
1182
|
-
clientId?: string;
|
|
1183
|
-
/**
|
|
1184
|
-
* Reference to the user interacting with the system
|
|
1185
|
-
*/
|
|
1186
|
-
userId?: string;
|
|
1187
|
-
sessionId: string;
|
|
1188
|
-
data: Record<string, any>;
|
|
1189
|
-
};
|
|
1190
|
-
|
|
1191
|
-
type SessionStorageResponseDto = {
|
|
1192
|
-
appId: string;
|
|
1193
|
-
/**
|
|
1194
|
-
* Reference to the authenticated client the request originated from
|
|
1195
|
-
*/
|
|
1196
|
-
clientId?: string;
|
|
1197
|
-
/**
|
|
1198
|
-
* Reference to the user interacting with the system
|
|
1199
|
-
*/
|
|
1200
|
-
userId?: string;
|
|
1201
|
-
sessionId: string;
|
|
1172
|
+
storageId?: string;
|
|
1173
|
+
sessionId?: string;
|
|
1202
1174
|
data: Record<string, any>;
|
|
1203
|
-
storageId: string;
|
|
1204
1175
|
};
|
|
1205
1176
|
|
|
1206
1177
|
type SessionStorageSearchDto = {
|
|
1207
1178
|
appId: string;
|
|
1208
|
-
userId
|
|
1209
|
-
sessionId
|
|
1210
|
-
storageId
|
|
1179
|
+
userId?: Array<string>;
|
|
1180
|
+
sessionId?: Array<string>;
|
|
1181
|
+
storageId?: Array<string>;
|
|
1211
1182
|
};
|
|
1212
1183
|
|
|
1213
1184
|
type SessionSupportRequestDto = {
|
|
@@ -1242,29 +1213,33 @@ declare class SessionService {
|
|
|
1242
1213
|
readonly httpRequest: BaseHttpRequest;
|
|
1243
1214
|
constructor(httpRequest: BaseHttpRequest);
|
|
1244
1215
|
/**
|
|
1216
|
+
* Load a session
|
|
1245
1217
|
* @param sessionId
|
|
1246
1218
|
* @returns any
|
|
1247
1219
|
* @throws ApiError
|
|
1248
1220
|
*/
|
|
1249
|
-
|
|
1221
|
+
readSession(sessionId: string): CancelablePromise<any>;
|
|
1250
1222
|
/**
|
|
1223
|
+
* Remove session
|
|
1251
1224
|
* @param sessionId
|
|
1252
1225
|
* @returns any
|
|
1253
1226
|
* @throws ApiError
|
|
1254
1227
|
*/
|
|
1255
|
-
|
|
1228
|
+
deleteSession(sessionId: string): CancelablePromise<any>;
|
|
1256
1229
|
/**
|
|
1230
|
+
* Create session
|
|
1257
1231
|
* @param requestBody
|
|
1258
1232
|
* @returns any
|
|
1259
1233
|
* @throws ApiError
|
|
1260
1234
|
*/
|
|
1261
|
-
|
|
1235
|
+
createSession(requestBody: SessionDto): CancelablePromise<any>;
|
|
1262
1236
|
/**
|
|
1237
|
+
* Update session
|
|
1263
1238
|
* @param requestBody
|
|
1264
1239
|
* @returns any
|
|
1265
1240
|
* @throws ApiError
|
|
1266
1241
|
*/
|
|
1267
|
-
|
|
1242
|
+
updateSession(requestBody: SessionDto): CancelablePromise<any>;
|
|
1268
1243
|
/**
|
|
1269
1244
|
* Notifies of an agent update
|
|
1270
1245
|
* @param requestBody
|
|
@@ -1273,33 +1248,40 @@ declare class SessionService {
|
|
|
1273
1248
|
*/
|
|
1274
1249
|
agentUpdate(requestBody: AgentHeartBeatEventDto): CancelablePromise<any>;
|
|
1275
1250
|
/**
|
|
1276
|
-
*
|
|
1251
|
+
* Request support from human
|
|
1277
1252
|
* @param requestBody
|
|
1278
|
-
* @returns
|
|
1253
|
+
* @returns SessionSupportResponseDto Human support requested
|
|
1279
1254
|
* @throws ApiError
|
|
1280
1255
|
*/
|
|
1281
|
-
|
|
1256
|
+
support(requestBody: SessionSupportRequestDto): CancelablePromise<SessionSupportResponseDto>;
|
|
1282
1257
|
/**
|
|
1283
|
-
*
|
|
1284
|
-
* @param
|
|
1285
|
-
* @returns
|
|
1258
|
+
* Store user data
|
|
1259
|
+
* @param requestBody
|
|
1260
|
+
* @returns SessionStorageRecordDto Record stored
|
|
1286
1261
|
* @throws ApiError
|
|
1287
1262
|
*/
|
|
1288
|
-
|
|
1263
|
+
setRecord(requestBody: SessionStorageRecordDto): CancelablePromise<SessionStorageRecordDto>;
|
|
1289
1264
|
/**
|
|
1290
|
-
*
|
|
1265
|
+
* Store user data
|
|
1291
1266
|
* @param requestBody
|
|
1292
|
-
* @returns
|
|
1267
|
+
* @returns SessionStorageRecordDto Record stored
|
|
1293
1268
|
* @throws ApiError
|
|
1294
1269
|
*/
|
|
1295
|
-
|
|
1270
|
+
findRecords(requestBody: SessionStorageSearchDto): CancelablePromise<Array<SessionStorageRecordDto>>;
|
|
1296
1271
|
/**
|
|
1297
|
-
*
|
|
1298
|
-
* @param
|
|
1299
|
-
* @returns
|
|
1272
|
+
* Retrieve stored data
|
|
1273
|
+
* @param storageId
|
|
1274
|
+
* @returns SessionStorageRecordDto Record retrieved
|
|
1300
1275
|
* @throws ApiError
|
|
1301
1276
|
*/
|
|
1302
|
-
|
|
1277
|
+
getRecord(storageId: string): CancelablePromise<SessionStorageRecordDto>;
|
|
1278
|
+
/**
|
|
1279
|
+
* Delete a record
|
|
1280
|
+
* @param storageId
|
|
1281
|
+
* @returns any Record deleted
|
|
1282
|
+
* @throws ApiError
|
|
1283
|
+
*/
|
|
1284
|
+
deleteRecord(storageId: string): CancelablePromise<any>;
|
|
1303
1285
|
}
|
|
1304
1286
|
|
|
1305
1287
|
type UIContentDto = {
|
|
@@ -2112,6 +2094,13 @@ interface SessionSupportEventDto {
|
|
|
2112
2094
|
feedback: string;
|
|
2113
2095
|
code: string;
|
|
2114
2096
|
}
|
|
2097
|
+
interface SessionStorageEventDto {
|
|
2098
|
+
appId: string;
|
|
2099
|
+
clientId?: string;
|
|
2100
|
+
userId?: string;
|
|
2101
|
+
operation: string;
|
|
2102
|
+
record: SessionStorageRecordDto;
|
|
2103
|
+
}
|
|
2115
2104
|
interface UiStatusDto {
|
|
2116
2105
|
appId: string;
|
|
2117
2106
|
clientId?: string;
|
|
@@ -2125,14 +2114,14 @@ interface UiContentDto {
|
|
|
2125
2114
|
clientId?: string;
|
|
2126
2115
|
userId?: string;
|
|
2127
2116
|
sessionId?: string;
|
|
2128
|
-
contentType:
|
|
2117
|
+
contentType: AnonymousSchema_235;
|
|
2129
2118
|
content: Record<string, any>;
|
|
2130
2119
|
metadata?: Record<string, any>;
|
|
2131
2120
|
options: Record<string, any>;
|
|
2132
2121
|
chunkId?: number;
|
|
2133
2122
|
messageId?: string;
|
|
2134
2123
|
}
|
|
2135
|
-
type
|
|
2124
|
+
type AnonymousSchema_235 = 'video' | 'image' | 'pdf' | 'webpage' | 'object' | 'text' | 'email' | 'html' | 'link' | 'dialogue-message' | 'navigation' | 'buttons' | 'quiz' | 'clear-screen';
|
|
2136
2125
|
interface UiInteractionEventDto {
|
|
2137
2126
|
appId: string;
|
|
2138
2127
|
clientId?: string;
|
|
@@ -2352,19 +2341,19 @@ declare class Session {
|
|
|
2352
2341
|
appId?: string;
|
|
2353
2342
|
agentId?: string;
|
|
2354
2343
|
}): Promise<() => void>;
|
|
2355
|
-
|
|
2344
|
+
support(event: SessionSupportEventDto, params?: {
|
|
2356
2345
|
appId?: string;
|
|
2357
|
-
storageId?: string;
|
|
2358
2346
|
}): Promise<boolean>;
|
|
2359
|
-
|
|
2347
|
+
onSupport(fn: (event: SessionSupportEventDto) => void | Promise<void>, params?: {
|
|
2360
2348
|
appId?: string;
|
|
2361
|
-
storageId?: string;
|
|
2362
2349
|
}): Promise<() => void>;
|
|
2363
|
-
|
|
2350
|
+
storageUpdated(event: SessionStorageEventDto, params?: {
|
|
2364
2351
|
appId?: string;
|
|
2352
|
+
storageId?: string;
|
|
2365
2353
|
}): Promise<boolean>;
|
|
2366
|
-
|
|
2354
|
+
onStorageUpdated(fn: (event: SessionStorageEventDto) => void | Promise<void>, params?: {
|
|
2367
2355
|
appId?: string;
|
|
2356
|
+
storageId?: string;
|
|
2368
2357
|
}): Promise<() => void>;
|
|
2369
2358
|
}
|
|
2370
2359
|
|
|
@@ -2536,4 +2525,4 @@ declare class SermasApiClient {
|
|
|
2536
2525
|
login(username: any, password: any, appId?: string): Promise<LoginResponseDto>;
|
|
2537
2526
|
}
|
|
2538
2527
|
|
|
2539
|
-
export { type AccessTokenRequestDto, type ActuationEventDto, type AgentChangedDto, type AgentDto, type AgentHeartBeatEventDto, type AnonymousSchema_125, type AnonymousSchema_199, type
|
|
2528
|
+
export { type AccessTokenRequestDto, type ActuationEventDto, type AgentChangedDto, type AgentDto, type AgentHeartBeatEventDto, type AnonymousSchema_125, type AnonymousSchema_199, type AnonymousSchema_235, type AnonymousSchema_60, type AnonymousSchema_63, type AppClientDto, type AppModuleConfigDto, type AppPromptDto, type AppSettingsDto, type AppToolsDTO, type AppToolsDto, type AudioClassificationEventDto, type AudioClassificationValue, type AuthJwtUser, type AuthorizationUser, type AvatarCameraConfig, type BoundingBox, Broker, type Buffer$1 as Buffer, type ButtonsContentDto, type ButtonsUIContentDto, type ClearScreenDto, type ClearUIContentDto, type CreatePlatformAppDto, type DialogueDocumentDto, type DialogueDocumentMetadataDto, type DialogueMessageDto, type DialogueMessageUIContentDto, type DialogueTextToSpeechDto, type DialogueToolTriggeredEventDto, type DialogueUserMessageDto, type EmailContentDto, type EmailUIContentDto, type HtmlContentDto, type HtmlUIContentDto, type ImageContentDto, type ImageUIContentDto, type InitialPoseDto, type InitialPoseEventDto, type JwtTokenDto, type KeycloakJwtTokenResourceAccess, type LinearVelocityDto, type LinkContentDto, type LinkUIContentDto, type LoginRequestDto, type LoginResponseDto, type ModuleConfigEventDto, type ModuleResourceDto, type ModuleSettingsDto, type MovementDto, type MovementEventDto, type NoiseEventDto, type ObjectContentDto, type ObjectDetectionDto, type ObjectDetectionEventDto, type ObjectUIContentDto, 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 QuizAnswerDto, type QuizContentDto, type QuizUIContentDto, type RefreshTokenRequestDto, type RegistrationRequestDto, type RegistrationResponseDto, type RepositoryAvatarModelDto, type RepositoryBackgroundMetadataDto, type RepositoryBackgroundModelDto, type RepositoryConfigDto, type RepositoryMapModelDto, type RepositoryRobotModelDto, type SentimentAnalysisRequest, SermasApiClient, type SermasApiClientConfig, type SermasBaseDto, type SermasEnvType, type SessionChangedDto, type SessionDto, type SessionStorageEventDto, type SessionStorageRecordDto, type SessionStorageSearchDto, type SessionSupportEventDto, type SessionSupportRequestDto, type SessionSupportResponseDto, type StatusDto, type StatusEventDto, type StringInferenceValue, type TextContentDto, type TextUIContentDto, type ToolsRequestSchema, type ToolsRequestSchemaAuthBasic, type ToolsRequestSchemaAuthBearer, type UIContentDto, type UIInteractionDTO, type UILoaderResponseDto, type UIModelMapBlendShapesRequestDto, type UIModelMapBlendShapesResponseDto, type UiContentDto, type UiInteractionDto, type UiInteractionEventDto, type UiStatusDto, 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 ViewLogsRequestDto, type WebpageContentDto, type WebpageUIContentDto, type XRMarkerDto, type XRMarkerListRequestDto, type XRMarkerListResponseDto, type XROcclusionResponseDto, type XrMarkerDetectedDto, type XrMarkerDto, type XrOcclusionDto, sleep };
|
package/index.d.ts
CHANGED
|
@@ -1159,7 +1159,7 @@ type SessionDto = {
|
|
|
1159
1159
|
closedAt: string;
|
|
1160
1160
|
};
|
|
1161
1161
|
|
|
1162
|
-
type
|
|
1162
|
+
type SessionStorageRecordDto = {
|
|
1163
1163
|
appId: string;
|
|
1164
1164
|
/**
|
|
1165
1165
|
* Reference to the authenticated client the request originated from
|
|
@@ -1169,45 +1169,16 @@ type SessionStorageEventDto = {
|
|
|
1169
1169
|
* Reference to the user interacting with the system
|
|
1170
1170
|
*/
|
|
1171
1171
|
userId?: string;
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
storageId: string;
|
|
1175
|
-
};
|
|
1176
|
-
|
|
1177
|
-
type SessionStorageRequestDto = {
|
|
1178
|
-
appId: string;
|
|
1179
|
-
/**
|
|
1180
|
-
* Reference to the authenticated client the request originated from
|
|
1181
|
-
*/
|
|
1182
|
-
clientId?: string;
|
|
1183
|
-
/**
|
|
1184
|
-
* Reference to the user interacting with the system
|
|
1185
|
-
*/
|
|
1186
|
-
userId?: string;
|
|
1187
|
-
sessionId: string;
|
|
1188
|
-
data: Record<string, any>;
|
|
1189
|
-
};
|
|
1190
|
-
|
|
1191
|
-
type SessionStorageResponseDto = {
|
|
1192
|
-
appId: string;
|
|
1193
|
-
/**
|
|
1194
|
-
* Reference to the authenticated client the request originated from
|
|
1195
|
-
*/
|
|
1196
|
-
clientId?: string;
|
|
1197
|
-
/**
|
|
1198
|
-
* Reference to the user interacting with the system
|
|
1199
|
-
*/
|
|
1200
|
-
userId?: string;
|
|
1201
|
-
sessionId: string;
|
|
1172
|
+
storageId?: string;
|
|
1173
|
+
sessionId?: string;
|
|
1202
1174
|
data: Record<string, any>;
|
|
1203
|
-
storageId: string;
|
|
1204
1175
|
};
|
|
1205
1176
|
|
|
1206
1177
|
type SessionStorageSearchDto = {
|
|
1207
1178
|
appId: string;
|
|
1208
|
-
userId
|
|
1209
|
-
sessionId
|
|
1210
|
-
storageId
|
|
1179
|
+
userId?: Array<string>;
|
|
1180
|
+
sessionId?: Array<string>;
|
|
1181
|
+
storageId?: Array<string>;
|
|
1211
1182
|
};
|
|
1212
1183
|
|
|
1213
1184
|
type SessionSupportRequestDto = {
|
|
@@ -1242,29 +1213,33 @@ declare class SessionService {
|
|
|
1242
1213
|
readonly httpRequest: BaseHttpRequest;
|
|
1243
1214
|
constructor(httpRequest: BaseHttpRequest);
|
|
1244
1215
|
/**
|
|
1216
|
+
* Load a session
|
|
1245
1217
|
* @param sessionId
|
|
1246
1218
|
* @returns any
|
|
1247
1219
|
* @throws ApiError
|
|
1248
1220
|
*/
|
|
1249
|
-
|
|
1221
|
+
readSession(sessionId: string): CancelablePromise<any>;
|
|
1250
1222
|
/**
|
|
1223
|
+
* Remove session
|
|
1251
1224
|
* @param sessionId
|
|
1252
1225
|
* @returns any
|
|
1253
1226
|
* @throws ApiError
|
|
1254
1227
|
*/
|
|
1255
|
-
|
|
1228
|
+
deleteSession(sessionId: string): CancelablePromise<any>;
|
|
1256
1229
|
/**
|
|
1230
|
+
* Create session
|
|
1257
1231
|
* @param requestBody
|
|
1258
1232
|
* @returns any
|
|
1259
1233
|
* @throws ApiError
|
|
1260
1234
|
*/
|
|
1261
|
-
|
|
1235
|
+
createSession(requestBody: SessionDto): CancelablePromise<any>;
|
|
1262
1236
|
/**
|
|
1237
|
+
* Update session
|
|
1263
1238
|
* @param requestBody
|
|
1264
1239
|
* @returns any
|
|
1265
1240
|
* @throws ApiError
|
|
1266
1241
|
*/
|
|
1267
|
-
|
|
1242
|
+
updateSession(requestBody: SessionDto): CancelablePromise<any>;
|
|
1268
1243
|
/**
|
|
1269
1244
|
* Notifies of an agent update
|
|
1270
1245
|
* @param requestBody
|
|
@@ -1273,33 +1248,40 @@ declare class SessionService {
|
|
|
1273
1248
|
*/
|
|
1274
1249
|
agentUpdate(requestBody: AgentHeartBeatEventDto): CancelablePromise<any>;
|
|
1275
1250
|
/**
|
|
1276
|
-
*
|
|
1251
|
+
* Request support from human
|
|
1277
1252
|
* @param requestBody
|
|
1278
|
-
* @returns
|
|
1253
|
+
* @returns SessionSupportResponseDto Human support requested
|
|
1279
1254
|
* @throws ApiError
|
|
1280
1255
|
*/
|
|
1281
|
-
|
|
1256
|
+
support(requestBody: SessionSupportRequestDto): CancelablePromise<SessionSupportResponseDto>;
|
|
1282
1257
|
/**
|
|
1283
|
-
*
|
|
1284
|
-
* @param
|
|
1285
|
-
* @returns
|
|
1258
|
+
* Store user data
|
|
1259
|
+
* @param requestBody
|
|
1260
|
+
* @returns SessionStorageRecordDto Record stored
|
|
1286
1261
|
* @throws ApiError
|
|
1287
1262
|
*/
|
|
1288
|
-
|
|
1263
|
+
setRecord(requestBody: SessionStorageRecordDto): CancelablePromise<SessionStorageRecordDto>;
|
|
1289
1264
|
/**
|
|
1290
|
-
*
|
|
1265
|
+
* Store user data
|
|
1291
1266
|
* @param requestBody
|
|
1292
|
-
* @returns
|
|
1267
|
+
* @returns SessionStorageRecordDto Record stored
|
|
1293
1268
|
* @throws ApiError
|
|
1294
1269
|
*/
|
|
1295
|
-
|
|
1270
|
+
findRecords(requestBody: SessionStorageSearchDto): CancelablePromise<Array<SessionStorageRecordDto>>;
|
|
1296
1271
|
/**
|
|
1297
|
-
*
|
|
1298
|
-
* @param
|
|
1299
|
-
* @returns
|
|
1272
|
+
* Retrieve stored data
|
|
1273
|
+
* @param storageId
|
|
1274
|
+
* @returns SessionStorageRecordDto Record retrieved
|
|
1300
1275
|
* @throws ApiError
|
|
1301
1276
|
*/
|
|
1302
|
-
|
|
1277
|
+
getRecord(storageId: string): CancelablePromise<SessionStorageRecordDto>;
|
|
1278
|
+
/**
|
|
1279
|
+
* Delete a record
|
|
1280
|
+
* @param storageId
|
|
1281
|
+
* @returns any Record deleted
|
|
1282
|
+
* @throws ApiError
|
|
1283
|
+
*/
|
|
1284
|
+
deleteRecord(storageId: string): CancelablePromise<any>;
|
|
1303
1285
|
}
|
|
1304
1286
|
|
|
1305
1287
|
type UIContentDto = {
|
|
@@ -2112,6 +2094,13 @@ interface SessionSupportEventDto {
|
|
|
2112
2094
|
feedback: string;
|
|
2113
2095
|
code: string;
|
|
2114
2096
|
}
|
|
2097
|
+
interface SessionStorageEventDto {
|
|
2098
|
+
appId: string;
|
|
2099
|
+
clientId?: string;
|
|
2100
|
+
userId?: string;
|
|
2101
|
+
operation: string;
|
|
2102
|
+
record: SessionStorageRecordDto;
|
|
2103
|
+
}
|
|
2115
2104
|
interface UiStatusDto {
|
|
2116
2105
|
appId: string;
|
|
2117
2106
|
clientId?: string;
|
|
@@ -2125,14 +2114,14 @@ interface UiContentDto {
|
|
|
2125
2114
|
clientId?: string;
|
|
2126
2115
|
userId?: string;
|
|
2127
2116
|
sessionId?: string;
|
|
2128
|
-
contentType:
|
|
2117
|
+
contentType: AnonymousSchema_235;
|
|
2129
2118
|
content: Record<string, any>;
|
|
2130
2119
|
metadata?: Record<string, any>;
|
|
2131
2120
|
options: Record<string, any>;
|
|
2132
2121
|
chunkId?: number;
|
|
2133
2122
|
messageId?: string;
|
|
2134
2123
|
}
|
|
2135
|
-
type
|
|
2124
|
+
type AnonymousSchema_235 = 'video' | 'image' | 'pdf' | 'webpage' | 'object' | 'text' | 'email' | 'html' | 'link' | 'dialogue-message' | 'navigation' | 'buttons' | 'quiz' | 'clear-screen';
|
|
2136
2125
|
interface UiInteractionEventDto {
|
|
2137
2126
|
appId: string;
|
|
2138
2127
|
clientId?: string;
|
|
@@ -2352,19 +2341,19 @@ declare class Session {
|
|
|
2352
2341
|
appId?: string;
|
|
2353
2342
|
agentId?: string;
|
|
2354
2343
|
}): Promise<() => void>;
|
|
2355
|
-
|
|
2344
|
+
support(event: SessionSupportEventDto, params?: {
|
|
2356
2345
|
appId?: string;
|
|
2357
|
-
storageId?: string;
|
|
2358
2346
|
}): Promise<boolean>;
|
|
2359
|
-
|
|
2347
|
+
onSupport(fn: (event: SessionSupportEventDto) => void | Promise<void>, params?: {
|
|
2360
2348
|
appId?: string;
|
|
2361
|
-
storageId?: string;
|
|
2362
2349
|
}): Promise<() => void>;
|
|
2363
|
-
|
|
2350
|
+
storageUpdated(event: SessionStorageEventDto, params?: {
|
|
2364
2351
|
appId?: string;
|
|
2352
|
+
storageId?: string;
|
|
2365
2353
|
}): Promise<boolean>;
|
|
2366
|
-
|
|
2354
|
+
onStorageUpdated(fn: (event: SessionStorageEventDto) => void | Promise<void>, params?: {
|
|
2367
2355
|
appId?: string;
|
|
2356
|
+
storageId?: string;
|
|
2368
2357
|
}): Promise<() => void>;
|
|
2369
2358
|
}
|
|
2370
2359
|
|
|
@@ -2536,4 +2525,4 @@ declare class SermasApiClient {
|
|
|
2536
2525
|
login(username: any, password: any, appId?: string): Promise<LoginResponseDto>;
|
|
2537
2526
|
}
|
|
2538
2527
|
|
|
2539
|
-
export { type AccessTokenRequestDto, type ActuationEventDto, type AgentChangedDto, type AgentDto, type AgentHeartBeatEventDto, type AnonymousSchema_125, type AnonymousSchema_199, type
|
|
2528
|
+
export { type AccessTokenRequestDto, type ActuationEventDto, type AgentChangedDto, type AgentDto, type AgentHeartBeatEventDto, type AnonymousSchema_125, type AnonymousSchema_199, type AnonymousSchema_235, type AnonymousSchema_60, type AnonymousSchema_63, type AppClientDto, type AppModuleConfigDto, type AppPromptDto, type AppSettingsDto, type AppToolsDTO, type AppToolsDto, type AudioClassificationEventDto, type AudioClassificationValue, type AuthJwtUser, type AuthorizationUser, type AvatarCameraConfig, type BoundingBox, Broker, type Buffer$1 as Buffer, type ButtonsContentDto, type ButtonsUIContentDto, type ClearScreenDto, type ClearUIContentDto, type CreatePlatformAppDto, type DialogueDocumentDto, type DialogueDocumentMetadataDto, type DialogueMessageDto, type DialogueMessageUIContentDto, type DialogueTextToSpeechDto, type DialogueToolTriggeredEventDto, type DialogueUserMessageDto, type EmailContentDto, type EmailUIContentDto, type HtmlContentDto, type HtmlUIContentDto, type ImageContentDto, type ImageUIContentDto, type InitialPoseDto, type InitialPoseEventDto, type JwtTokenDto, type KeycloakJwtTokenResourceAccess, type LinearVelocityDto, type LinkContentDto, type LinkUIContentDto, type LoginRequestDto, type LoginResponseDto, type ModuleConfigEventDto, type ModuleResourceDto, type ModuleSettingsDto, type MovementDto, type MovementEventDto, type NoiseEventDto, type ObjectContentDto, type ObjectDetectionDto, type ObjectDetectionEventDto, type ObjectUIContentDto, 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 QuizAnswerDto, type QuizContentDto, type QuizUIContentDto, type RefreshTokenRequestDto, type RegistrationRequestDto, type RegistrationResponseDto, type RepositoryAvatarModelDto, type RepositoryBackgroundMetadataDto, type RepositoryBackgroundModelDto, type RepositoryConfigDto, type RepositoryMapModelDto, type RepositoryRobotModelDto, type SentimentAnalysisRequest, SermasApiClient, type SermasApiClientConfig, type SermasBaseDto, type SermasEnvType, type SessionChangedDto, type SessionDto, type SessionStorageEventDto, type SessionStorageRecordDto, type SessionStorageSearchDto, type SessionSupportEventDto, type SessionSupportRequestDto, type SessionSupportResponseDto, type StatusDto, type StatusEventDto, type StringInferenceValue, type TextContentDto, type TextUIContentDto, type ToolsRequestSchema, type ToolsRequestSchemaAuthBasic, type ToolsRequestSchemaAuthBearer, type UIContentDto, type UIInteractionDTO, type UILoaderResponseDto, type UIModelMapBlendShapesRequestDto, type UIModelMapBlendShapesResponseDto, type UiContentDto, type UiInteractionDto, type UiInteractionEventDto, type UiStatusDto, 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 ViewLogsRequestDto, type WebpageContentDto, type WebpageUIContentDto, type XRMarkerDto, type XRMarkerListRequestDto, type XRMarkerListResponseDto, type XROcclusionResponseDto, type XrMarkerDetectedDto, type XrMarkerDto, type XrOcclusionDto, sleep };
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var ue=Object.defineProperty;var de=(o,e,t)=>e in o?ue(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var n=(o,e,t)=>(de(o,typeof e!="symbol"?e+"":e,t),t),oe=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)};var l=(o,e,t)=>(oe(o,e,"read from private field"),t?t.call(o):e.get(o)),f=(o,e,t)=>{if(e.has(o))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(o):e.set(o,t)},c=(o,e,t,r)=>(oe(o,e,"write to private field"),r?r.call(o,t):e.set(o,t),t);import{jwtDecode as Se}from"jwt-decode";var j=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)}};var H=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 N=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 _=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 X=class{constructor(e){this.broker=e}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 dialogueMessages(e,t){return this.broker.publish("app/:appId/dialogue/messages",e,t)}async onDialogueMessages(e,t){return this.broker.subscribe("app/:appId/dialogue/messages",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)}};var z=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 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)}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 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)}};var $=class{constructor(e){this.broker=e}async assetChange(e,t){return this.broker.publish("app/:appId/ui/status",e,t)}async onAssetChange(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 G=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 J=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)}};var S=class{constructor(e){this.broker=e;n(this,"platform");n(this,"module");n(this,"auth");n(this,"detection");n(this,"dialogue");n(this,"session");n(this,"ui");n(this,"xr");n(this,"robotics");this.platform=new j(e),this.module=new H(e),this.auth=new N(e),this.detection=new _(e),this.dialogue=new X(e),this.session=new z(e),this.ui=new $(e),this.xr=new G(e),this.robotics=new J(e)}};import me from"mqtt";var Y,re=o=>{Y=o},ce=(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))}},C=class{constructor(e){n(this,"logger");this.logger=Y||ce(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 F=class o{constructor(e){this.config=e;n(this,"logger",new C(o.name));n(this,"client");n(this,"subscriptions",[])}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=me.connect(this.config.url,{username:this.config.username,password:this.config.password}),this.client.on("connect",async()=>{this.logger.debug("client connected");for(let e of this.subscriptions)try{this.logger.debug(`SUB ${e.topic}`),await this.client.subscribeAsync(e.topic)}catch(t){this.logger.warn(`Failed to subscribe ${e.topic}: ${t.stack}`)}}),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 u in i.context||[])if(!a(p.context[u])&&p.context[u]!==i.context[u])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 T=class{constructor(e){this.config=e}};import se from"axios";import ie from"form-data";var P=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 V=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},h,g,m,D,I,q,b,A=class{constructor(e){f(this,h,void 0);f(this,g,void 0);f(this,m,void 0);f(this,D,void 0);f(this,I,void 0);f(this,q,void 0);f(this,b,void 0);c(this,h,!1),c(this,g,!1),c(this,m,!1),c(this,D,[]),c(this,I,new Promise((t,r)=>{c(this,q,t),c(this,b,r);let s=p=>{l(this,h)||l(this,g)||l(this,m)||(c(this,h,!0),l(this,q)&&l(this,q).call(this,p))},i=p=>{l(this,h)||l(this,g)||l(this,m)||(c(this,g,!0),l(this,b)&&l(this,b).call(this,p))},a=p=>{l(this,h)||l(this,g)||l(this,m)||l(this,D).push(p)};return Object.defineProperty(a,"isResolved",{get:()=>l(this,h)}),Object.defineProperty(a,"isRejected",{get:()=>l(this,g)}),Object.defineProperty(a,"isCancelled",{get:()=>l(this,m)}),e(s,i,a)}))}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,t){return l(this,I).then(e,t)}catch(e){return l(this,I).catch(e)}finally(e){return l(this,I).finally(e)}cancel(){if(!(l(this,h)||l(this,g)||l(this,m))){if(c(this,m,!0),l(this,D).length)try{for(let e of l(this,D))e()}catch(e){console.warn("Cancellation threw an error",e);return}l(this,D).length=0,l(this,b)&&l(this,b).call(this,new V("Request aborted"))}}get isCancelled(){return l(this,m)}};h=new WeakMap,g=new WeakMap,m=new WeakMap,D=new WeakMap,I=new WeakMap,q=new WeakMap,b=new WeakMap;var ee=o=>o!=null,Q=o=>typeof o=="string",Z=o=>Q(o)&&o!=="",ne=o=>typeof o=="object"&&typeof o.type=="string"&&typeof o.stream=="function"&&typeof o.arrayBuffer=="function"&&typeof o.constructor=="function"&&typeof o.constructor.name=="string"&&/^(Blob|File)$/.test(o.constructor.name)&&/^(Blob|File)$/.test(o[Symbol.toStringTag]),he=o=>o instanceof ie,ge=o=>o>=200&&o<300,ye=o=>{try{return btoa(o)}catch{return Buffer.from(o).toString("base64")}},fe=o=>{let e=[],t=(s,i)=>{e.push(`${encodeURIComponent(s)}=${encodeURIComponent(String(i))}`)},r=(s,i)=>{ee(i)&&(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>0?`?${e.join("&")}`:""},De=(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}${fe(e.query)}`:s},be=o=>{if(o.formData){let e=new ie,t=(r,s)=>{Q(s)||ne(s)?e.append(r,s):e.append(r,JSON.stringify(s))};return Object.entries(o.formData).filter(([r,s])=>ee(s)).forEach(([r,s])=>{Array.isArray(s)?s.forEach(i=>t(r,i)):t(r,s)}),e}},W=async(o,e)=>typeof e=="function"?e(o):e,Ie=async(o,e,t)=>{let[r,s,i,a]=await Promise.all([W(e,o.TOKEN),W(e,o.USERNAME),W(e,o.PASSWORD),W(e,o.HEADERS)]),p=typeof t?.getHeaders=="function"&&t?.getHeaders()||{},u=Object.entries({Accept:"application/json",...a,...e.headers,...p}).filter(([y,d])=>ee(d)).reduce((y,[d,v])=>({...y,[d]:String(v)}),{});if(Z(r)&&(u.Authorization=`Bearer ${r}`),Z(s)&&Z(i)){let y=ye(`${s}:${i}`);u.Authorization=`Basic ${y}`}return e.body&&(e.mediaType?u["Content-Type"]=e.mediaType:ne(e.body)?u["Content-Type"]=e.body.type||"application/octet-stream":Q(e.body)?u["Content-Type"]="text/plain":he(e.body)||(u["Content-Type"]="application/json")),u},Re=o=>{if(o.body)return o.body},ve=async(o,e,t,r,s,i,a,p)=>{let u=se.CancelToken.source(),y={url:t,headers:i,data:r??s,method:e.method,withCredentials:o.WITH_CREDENTIALS,cancelToken:u.token};a(()=>u.cancel("The user aborted a request."));try{return await p.request(y)}catch(d){let v=d;if(v.response)return v.response;throw d}},Ce=(o,e)=>{if(e){let t=o.headers[e];if(Q(t))return t}},Pe=o=>{if(o.status!==204)return o.data},qe=(o,e)=>{let r={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...o.errors}[e.status];if(r)throw new P(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 P(o,e,`Generic Error: status: ${s}; status text: ${i}; body: ${a}`)}},ae=(o,e,t=se)=>new A(async(r,s,i)=>{try{let a=De(o,e),p=be(e),u=Re(e),y=await Ie(o,e,p);if(!i.isCancelled){let d=await ve(o,e,a,u,p,y,i,t),v=Pe(d),le=Ce(d,e.responseHeader),te={url:a,ok:ge(d.status),status:d.status,statusText:d.statusText,body:le??v};qe(e,te),r(te.body)}}catch(a){s(a)}});var K=class extends T{constructor(e){super(e)}request(e){return ae(this.config,e)}};var E=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e,t){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:e,room:t}})}roboticsAgentControllerStatusDescription(e,t){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:e,robotId:t}})}roboticsAgentControllerMove(e){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:e,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:e,mediaType:"application/json"})}roboticsAgentControllerActuate(e){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:e,mediaType:"application/json"})}roboticsAgentControllerStatus(e){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:e,mediaType:"application/json"})}};var k=class{constructor(e){this.httpRequest=e}whoami(){return this.httpRequest.request({method:"GET",url:"/api/auth/whoami",errors:{401:"Not authorized"}})}login(e){return this.httpRequest.request({method:"POST",url:"/api/auth/login",body:e,mediaType:"application/json",errors:{401:"Not authorized"}})}register(e){return this.httpRequest.request({method:"POST",url:"/api/auth/register",body:e,mediaType:"application/json"})}refreshToken(e){return this.httpRequest.request({method:"POST",url:"/api/auth/refresh",body:e,mediaType:"application/json",errors:{401:"Not authorized"}})}edit(e,t){return this.httpRequest.request({method:"PUT",url:"/api/auth/{userId}",path:{userId:e},body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}delete(e){return this.httpRequest.request({method:"DELETE",url:"/api/auth/{userId}",path:{userId:e},errors:{401:"Not authorized"}})}authAdminControllerSaveUser(e){return this.httpRequest.request({method:"POST",url:"/api/auth/admin/user",body:e,mediaType:"application/json"})}};var x=class{constructor(e){this.httpRequest=e}detectionControllerSentimentAnalysis(e){return this.httpRequest.request({method:"POST",url:"/api/detection/sentiment-analysis",body:e,mediaType:"application/json"})}detectionControllerInteractionIntention(e){return this.httpRequest.request({method:"POST",url:"/api/detection/interaction",body:e,mediaType:"application/json"})}detectionControllerSendFrame(e,t,r){return this.httpRequest.request({method:"POST",url:"/api/detection/{appId}/{cameraId}/frame",path:{appId:e,cameraId:t},formData:r,mediaType:"multipart/form-data"})}detectionControllerServe(e,t,r){return this.httpRequest.request({method:"GET",url:"/api/detection/{appId}/{cameraId}/camera",path:{appId:e,cameraId:t},query:{overlay:r}})}};var U=class{constructor(e){this.httpRequest=e}save(e){return this.httpRequest.request({method:"PUT",url:"/api/dialogue/document",body:e,mediaType:"application/json"})}import(e){return this.httpRequest.request({method:"POST",url:"/api/dialogue/document",body:e,mediaType:"application/json"})}remove(e,t){return this.httpRequest.request({method:"DELETE",url:"/api/dialogue/document/{appId}",path:{appId:e},query:{documentId:t}})}speak(e){return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/tts",body:e,mediaType:"application/json"})}text(e,t,r,s,i,a,p){return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stt/{appId}/{sessionId}",path:{appId:e,sessionId:t},query:{language:r,gender:s,llm:i,sampleRate:a},formData:p,mediaType:"multipart/form-data"})}chatMessage(e,t,r,s,i,a,p){return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/chat/{appId}/{sessionId}",path:{appId:e,sessionId:t},query:{language:r,gender:s,llm:i,actor:a},body:p,mediaType:"application/json"})}stopAgentSpeech(e,t){return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stop/{appId}/{sessionId}",path:{appId:e,sessionId:t}})}import1(){return this.httpRequest.request({method:"POST",url:"/api/dialogue/admin/document"})}};var O=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){return this.httpRequest.request({method:"POST",url:"/api/platform/token",body:e,mediaType:"application/json"})}getClientAccessToken1(e){return this.httpRequest.request({method:"POST",url:"/api/platform/token/access_token",body:e,mediaType:"application/json"})}getClientRefreshToken(e){return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh",body:e,mediaType:"application/json"})}getClientRefreshToken1(e){return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh_token",body:e,mediaType:"application/json"})}platformAppControllerListApps(){return this.httpRequest.request({method:"GET",url:"/api/app"})}createApp(e){return this.httpRequest.request({method:"POST",url:"/api/app",body:e,mediaType:"application/json"})}updateApp(e){return this.httpRequest.request({method:"PUT",url:"/api/app",body:e,mediaType:"application/json"})}listUserApps(){return this.httpRequest.request({method:"GET",url:"/api/app/list"})}updateAppTools(e,t){return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/tools",path:{appId:e},body:t,mediaType:"application/json"})}updateAppSettings(e,t){return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/settings",path:{appId:e},body:t,mediaType:"application/json"})}getAppRepository(e){return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository",path:{appId:e}})}getAppRepositoryRobots(e,t){return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/robots",path:{appId:e},query:{name:t}})}getAppRepositoryAvatars(e,t){return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/avatars",path:{appId:e},query:{name:t}})}getAppRepositoryBackgrounds(e,t){return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/backgrounds",path:{appId:e},query:{name:t}})}readApp(e){return this.httpRequest.request({method:"GET",url:"/api/app/{appId}",path:{appId:e}})}removeApp(e){return this.httpRequest.request({method:"DELETE",url:"/api/app/{appId}",path:{appId:e}})}importApps(e,t){return this.httpRequest.request({method:"POST",url:"/api/app/admin/import",query:{skipClients:e},body:t,mediaType:"application/json"})}exportApps(e){return this.httpRequest.request({method:"POST",url:"/api/app/admin/export",body:e,mediaType:"application/json"})}removeApps(e){return this.httpRequest.request({method:"POST",url:"/api/app/admin/remove",body:e,mediaType:"application/json"})}createClient(e,t){return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/client",path:{appId:e},body:t,mediaType:"application/json"})}readClient(e,t){return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}",path:{appId:e,clientId:t}})}removeClient(e,t){return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/client/{clientId}",path:{clientId:e,appId:t}})}listTopics(e,t){return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}/topics",path:{appId:e,clientId:t}})}saveAppModule(e,t){return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/module",path:{appId:e},body:t,mediaType:"application/json"})}getAppModule(e,t){return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:e,moduleId:t}})}removeAppModule(e,t){return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:e,moduleId:t}})}savePlatformModule(e){return this.httpRequest.request({method:"POST",url:"/api/platform/module",body:e,mediaType:"application/json"})}refreshPlatformModule(e){return this.httpRequest.request({method:"HEAD",url:"/api/platform/module/{moduleId}",path:{moduleId:e}})}getPlatformModule(e){return this.httpRequest.request({method:"GET",url:"/api/platform/module/{moduleId}",path:{moduleId:e}})}removePlatformModule(e){return this.httpRequest.request({method:"DELETE",url:"/api/platform/module/{moduleId}",path:{moduleId:e}})}dataLoggerControllerGetLogs(e,t){return this.httpRequest.request({method:"POST",url:"/api/datalogger/get/{appId}",path:{appId:e},body:t,mediaType:"application/json"})}};var M=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e,t){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:e,room:t}})}roboticsAgentControllerStatusDescription(e,t){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:e,robotId:t}})}roboticsAgentControllerMove(e){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:e,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:e,mediaType:"application/json"})}roboticsAgentControllerActuate(e){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:e,mediaType:"application/json"})}roboticsAgentControllerStatus(e){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:e,mediaType:"application/json"})}navigationControllerSave(){return this.httpRequest.request({method:"POST",url:"/api/robotics/navigation/{appId}"})}navigationControllerRemove(e){return this.httpRequest.request({method:"DELETE",url:"/api/robotics/navigation/{appId}/spaceId",path:{spaceId:e}})}navigationControllerGetById(e){return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/{spaceId}",path:{spaceId:e}})}navigationControllerGetStatus(e,t){return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/status/{robotId}",path:{appId:e,robotId:t}})}};var B=class{constructor(e){this.httpRequest=e}sessionControllerRead(e){return this.httpRequest.request({method:"GET",url:"/api/session/{sessionId}",path:{sessionId:e}})}sessionControllerDelete(e){return this.httpRequest.request({method:"DELETE",url:"/api/session/{sessionId}",path:{sessionId:e}})}sessionControllerCreate(e){return this.httpRequest.request({method:"POST",url:"/api/session",body:e,mediaType:"application/json"})}sessionControllerUpdate(e){return this.httpRequest.request({method:"PUT",url:"/api/session",body:e,mediaType:"application/json"})}agentUpdate(e){return this.httpRequest.request({method:"POST",url:"/api/session/agent",body:e,mediaType:"application/json"})}saveStore(e){return this.httpRequest.request({method:"POST",url:"/api/session/storage",body:e,mediaType:"application/json",errors:{401:"Unauthorized"}})}getStore(e){return this.httpRequest.request({method:"GET",url:"/api/session/storage/{storageId}",path:{storageId:e},errors:{401:"Unauthorized"}})}searchStore(e){return this.httpRequest.request({method:"POST",url:"/api/session/storage/search",body:e,mediaType:"application/json",errors:{401:"Unauthorized"}})}support(e){return this.httpRequest.request({method:"POST",url:"/api/session/support",body:e,mediaType:"application/json",errors:{401:"unauthorized"}})}};var w=class{constructor(e){this.httpRequest=e}notifyInteraction(e,t,r){return this.httpRequest.request({method:"PUT",url:"/api/ui/interaction/{appId}/{moduleId}",path:{appId:e,moduleId:t},body:r,mediaType:"application/json",errors:{401:"unauthorized"}})}showContent(e){return this.httpRequest.request({method:"GET",url:"/api/ui/asset/{appId}",body:e,mediaType:"application/json",errors:{401:"unauthorized"}})}uiModelControllerMapBlendShapes(e){return this.httpRequest.request({method:"POST",url:"/api/ui/model/map-blend-shapes",body:e,mediaType:"application/json",errors:{401:"unauthorized"}})}};var L=class{constructor(e){this.httpRequest=e}xrMarkerControllerSearchMarker(e){return this.httpRequest.request({method:"POST",url:"/api/xr/marker/search",body:e,mediaType:"application/json",errors:{401:"unauthorized"}})}xrMarkerControllerSaveMarker(e){return this.httpRequest.request({method:"PUT",url:"/api/xr/marker",body:e,mediaType:"application/json",errors:{401:"Unauthorized"}})}xrMarkerControllerDeleteMarker(e){return this.httpRequest.request({method:"DELETE",url:"/api/xr/marker/{markerId}",path:{":markerId":e},errors:{401:"Unauthorized"}})}xrMarkerControllerGetMarkerQrCode(e){return this.httpRequest.request({method:"GET",url:"/api/xr/marker/{markerId}",path:{":markerId":e},errors:{401:"Unauthorized"}})}xrOcclusionControllerOcclusion(){return this.httpRequest.request({method:"GET",url:"/api/xr/occlusion",errors:{401:"Unauthorized"}})}};var R=class{constructor(e,t=K){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}),this.agent=new E(this.request),this.authentication=new k(this.request),this.detection=new x(this.request),this.dialogue=new U(this.request),this.platform=new O(this.request),this.robotics=new M(this.request),this.session=new B(this.request),this.ui=new w(this.request),this.xr=new L(this.request)}};var io=(o=1e3)=>new Promise(e=>setTimeout(()=>e(),o)),Te="http://localhost:8080",pe=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&&re(e.logger),this.logger=new C("SermasApiClient");let t=e.baseURL||Te;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 R({BASE:this.apiUrl,TOKEN:async()=>this.config.access_token||""}),this.broker=new F({url:this.mqttUrl,username:this.config.access_token||void 0,password:"api-client",params:this.params}),this.events=new S(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=Se(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({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 R({BASE:this.apiUrl});this.config.appId=r||this.config.appId;let i=await s.platform.getClientAccessToken({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 R({BASE:this.apiUrl});this.config.appId=r||this.config.appId;let i=await s.authentication.login({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{pe as SermasApiClient,io as sleep};
|
|
1
|
+
var ue=Object.defineProperty;var de=(o,e,t)=>e in o?ue(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var n=(o,e,t)=>(de(o,typeof e!="symbol"?e+"":e,t),t),oe=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)};var l=(o,e,t)=>(oe(o,e,"read from private field"),t?t.call(o):e.get(o)),f=(o,e,t)=>{if(e.has(o))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(o):e.set(o,t)},c=(o,e,t,r)=>(oe(o,e,"write to private field"),r?r.call(o,t):e.set(o,t),t);import{jwtDecode as Te}from"jwt-decode";var j=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)}};var H=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 N=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 _=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 X=class{constructor(e){this.broker=e}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 dialogueMessages(e,t){return this.broker.publish("app/:appId/dialogue/messages",e,t)}async onDialogueMessages(e,t){return this.broker.subscribe("app/:appId/dialogue/messages",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)}};var z=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 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)}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)}};var $=class{constructor(e){this.broker=e}async assetChange(e,t){return this.broker.publish("app/:appId/ui/status",e,t)}async onAssetChange(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 G=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 J=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)}};var T=class{constructor(e){this.broker=e;n(this,"platform");n(this,"module");n(this,"auth");n(this,"detection");n(this,"dialogue");n(this,"session");n(this,"ui");n(this,"xr");n(this,"robotics");this.platform=new j(e),this.module=new H(e),this.auth=new N(e),this.detection=new _(e),this.dialogue=new X(e),this.session=new z(e),this.ui=new $(e),this.xr=new G(e),this.robotics=new J(e)}};import me from"mqtt";var Y,re=o=>{Y=o},ce=(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))}},P=class{constructor(e){n(this,"logger");this.logger=Y||ce(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 F=class o{constructor(e){this.config=e;n(this,"logger",new P(o.name));n(this,"client");n(this,"subscriptions",[])}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=me.connect(this.config.url,{username:this.config.username,password:this.config.password}),this.client.on("connect",async()=>{this.logger.debug("client connected");for(let e of this.subscriptions)try{this.logger.debug(`SUB ${e.topic}`),await this.client.subscribeAsync(e.topic)}catch(t){this.logger.warn(`Failed to subscribe ${e.topic}: ${t.stack}`)}}),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 u in i.context||[])if(!a(p.context[u])&&p.context[u]!==i.context[u])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 S=class{constructor(e){this.config=e}};import se from"axios";import ie from"form-data";var C=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 V=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},h,g,m,b,I,q,D,A=class{constructor(e){f(this,h,void 0);f(this,g,void 0);f(this,m,void 0);f(this,b,void 0);f(this,I,void 0);f(this,q,void 0);f(this,D,void 0);c(this,h,!1),c(this,g,!1),c(this,m,!1),c(this,b,[]),c(this,I,new Promise((t,r)=>{c(this,q,t),c(this,D,r);let s=p=>{l(this,h)||l(this,g)||l(this,m)||(c(this,h,!0),l(this,q)&&l(this,q).call(this,p))},i=p=>{l(this,h)||l(this,g)||l(this,m)||(c(this,g,!0),l(this,D)&&l(this,D).call(this,p))},a=p=>{l(this,h)||l(this,g)||l(this,m)||l(this,b).push(p)};return Object.defineProperty(a,"isResolved",{get:()=>l(this,h)}),Object.defineProperty(a,"isRejected",{get:()=>l(this,g)}),Object.defineProperty(a,"isCancelled",{get:()=>l(this,m)}),e(s,i,a)}))}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,t){return l(this,I).then(e,t)}catch(e){return l(this,I).catch(e)}finally(e){return l(this,I).finally(e)}cancel(){if(!(l(this,h)||l(this,g)||l(this,m))){if(c(this,m,!0),l(this,b).length)try{for(let e of l(this,b))e()}catch(e){console.warn("Cancellation threw an error",e);return}l(this,b).length=0,l(this,D)&&l(this,D).call(this,new V("Request aborted"))}}get isCancelled(){return l(this,m)}};h=new WeakMap,g=new WeakMap,m=new WeakMap,b=new WeakMap,I=new WeakMap,q=new WeakMap,D=new WeakMap;var ee=o=>o!=null,Q=o=>typeof o=="string",Z=o=>Q(o)&&o!=="",ne=o=>typeof o=="object"&&typeof o.type=="string"&&typeof o.stream=="function"&&typeof o.arrayBuffer=="function"&&typeof o.constructor=="function"&&typeof o.constructor.name=="string"&&/^(Blob|File)$/.test(o.constructor.name)&&/^(Blob|File)$/.test(o[Symbol.toStringTag]),he=o=>o instanceof ie,ge=o=>o>=200&&o<300,ye=o=>{try{return btoa(o)}catch{return Buffer.from(o).toString("base64")}},fe=o=>{let e=[],t=(s,i)=>{e.push(`${encodeURIComponent(s)}=${encodeURIComponent(String(i))}`)},r=(s,i)=>{ee(i)&&(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>0?`?${e.join("&")}`:""},be=(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}${fe(e.query)}`:s},De=o=>{if(o.formData){let e=new ie,t=(r,s)=>{Q(s)||ne(s)?e.append(r,s):e.append(r,JSON.stringify(s))};return Object.entries(o.formData).filter(([r,s])=>ee(s)).forEach(([r,s])=>{Array.isArray(s)?s.forEach(i=>t(r,i)):t(r,s)}),e}},W=async(o,e)=>typeof e=="function"?e(o):e,Ie=async(o,e,t)=>{let[r,s,i,a]=await Promise.all([W(e,o.TOKEN),W(e,o.USERNAME),W(e,o.PASSWORD),W(e,o.HEADERS)]),p=typeof t?.getHeaders=="function"&&t?.getHeaders()||{},u=Object.entries({Accept:"application/json",...a,...e.headers,...p}).filter(([y,d])=>ee(d)).reduce((y,[d,v])=>({...y,[d]:String(v)}),{});if(Z(r)&&(u.Authorization=`Bearer ${r}`),Z(s)&&Z(i)){let y=ye(`${s}:${i}`);u.Authorization=`Basic ${y}`}return e.body&&(e.mediaType?u["Content-Type"]=e.mediaType:ne(e.body)?u["Content-Type"]=e.body.type||"application/octet-stream":Q(e.body)?u["Content-Type"]="text/plain":he(e.body)||(u["Content-Type"]="application/json")),u},Re=o=>{if(o.body)return o.body},ve=async(o,e,t,r,s,i,a,p)=>{let u=se.CancelToken.source(),y={url:t,headers:i,data:r??s,method:e.method,withCredentials:o.WITH_CREDENTIALS,cancelToken:u.token};a(()=>u.cancel("The user aborted a request."));try{return await p.request(y)}catch(d){let v=d;if(v.response)return v.response;throw d}},Pe=(o,e)=>{if(e){let t=o.headers[e];if(Q(t))return t}},Ce=o=>{if(o.status!==204)return o.data},qe=(o,e)=>{let r={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...o.errors}[e.status];if(r)throw new C(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 C(o,e,`Generic Error: status: ${s}; status text: ${i}; body: ${a}`)}},ae=(o,e,t=se)=>new A(async(r,s,i)=>{try{let a=be(o,e),p=De(e),u=Re(e),y=await Ie(o,e,p);if(!i.isCancelled){let d=await ve(o,e,a,u,p,y,i,t),v=Ce(d),le=Pe(d,e.responseHeader),te={url:a,ok:ge(d.status),status:d.status,statusText:d.statusText,body:le??v};qe(e,te),r(te.body)}}catch(a){s(a)}});var K=class extends S{constructor(e){super(e)}request(e){return ae(this.config,e)}};var k=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e,t){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:e,room:t}})}roboticsAgentControllerStatusDescription(e,t){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:e,robotId:t}})}roboticsAgentControllerMove(e){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:e,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:e,mediaType:"application/json"})}roboticsAgentControllerActuate(e){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:e,mediaType:"application/json"})}roboticsAgentControllerStatus(e){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:e,mediaType:"application/json"})}};var E=class{constructor(e){this.httpRequest=e}whoami(){return this.httpRequest.request({method:"GET",url:"/api/auth/whoami",errors:{401:"Not authorized"}})}login(e){return this.httpRequest.request({method:"POST",url:"/api/auth/login",body:e,mediaType:"application/json",errors:{401:"Not authorized"}})}register(e){return this.httpRequest.request({method:"POST",url:"/api/auth/register",body:e,mediaType:"application/json"})}refreshToken(e){return this.httpRequest.request({method:"POST",url:"/api/auth/refresh",body:e,mediaType:"application/json",errors:{401:"Not authorized"}})}edit(e,t){return this.httpRequest.request({method:"PUT",url:"/api/auth/{userId}",path:{userId:e},body:t,mediaType:"application/json",errors:{401:"Not authorized"}})}delete(e){return this.httpRequest.request({method:"DELETE",url:"/api/auth/{userId}",path:{userId:e},errors:{401:"Not authorized"}})}authAdminControllerSaveUser(e){return this.httpRequest.request({method:"POST",url:"/api/auth/admin/user",body:e,mediaType:"application/json"})}};var x=class{constructor(e){this.httpRequest=e}detectionControllerSentimentAnalysis(e){return this.httpRequest.request({method:"POST",url:"/api/detection/sentiment-analysis",body:e,mediaType:"application/json"})}detectionControllerInteractionIntention(e){return this.httpRequest.request({method:"POST",url:"/api/detection/interaction",body:e,mediaType:"application/json"})}detectionControllerSendFrame(e,t,r){return this.httpRequest.request({method:"POST",url:"/api/detection/{appId}/{cameraId}/frame",path:{appId:e,cameraId:t},formData:r,mediaType:"multipart/form-data"})}detectionControllerServe(e,t,r){return this.httpRequest.request({method:"GET",url:"/api/detection/{appId}/{cameraId}/camera",path:{appId:e,cameraId:t},query:{overlay:r}})}};var U=class{constructor(e){this.httpRequest=e}save(e){return this.httpRequest.request({method:"PUT",url:"/api/dialogue/document",body:e,mediaType:"application/json"})}import(e){return this.httpRequest.request({method:"POST",url:"/api/dialogue/document",body:e,mediaType:"application/json"})}remove(e,t){return this.httpRequest.request({method:"DELETE",url:"/api/dialogue/document/{appId}",path:{appId:e},query:{documentId:t}})}speak(e){return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/tts",body:e,mediaType:"application/json"})}text(e,t,r,s,i,a,p){return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stt/{appId}/{sessionId}",path:{appId:e,sessionId:t},query:{language:r,gender:s,llm:i,sampleRate:a},formData:p,mediaType:"multipart/form-data"})}chatMessage(e,t,r,s,i,a,p){return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/chat/{appId}/{sessionId}",path:{appId:e,sessionId:t},query:{language:r,gender:s,llm:i,actor:a},body:p,mediaType:"application/json"})}stopAgentSpeech(e,t){return this.httpRequest.request({method:"POST",url:"/api/dialogue/speech/stop/{appId}/{sessionId}",path:{appId:e,sessionId:t}})}import1(){return this.httpRequest.request({method:"POST",url:"/api/dialogue/admin/document"})}};var O=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){return this.httpRequest.request({method:"POST",url:"/api/platform/token",body:e,mediaType:"application/json"})}getClientAccessToken1(e){return this.httpRequest.request({method:"POST",url:"/api/platform/token/access_token",body:e,mediaType:"application/json"})}getClientRefreshToken(e){return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh",body:e,mediaType:"application/json"})}getClientRefreshToken1(e){return this.httpRequest.request({method:"POST",url:"/api/platform/token/refresh_token",body:e,mediaType:"application/json"})}platformAppControllerListApps(){return this.httpRequest.request({method:"GET",url:"/api/app"})}createApp(e){return this.httpRequest.request({method:"POST",url:"/api/app",body:e,mediaType:"application/json"})}updateApp(e){return this.httpRequest.request({method:"PUT",url:"/api/app",body:e,mediaType:"application/json"})}listUserApps(){return this.httpRequest.request({method:"GET",url:"/api/app/list"})}updateAppTools(e,t){return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/tools",path:{appId:e},body:t,mediaType:"application/json"})}updateAppSettings(e,t){return this.httpRequest.request({method:"PUT",url:"/api/app/{appId}/settings",path:{appId:e},body:t,mediaType:"application/json"})}getAppRepository(e){return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository",path:{appId:e}})}getAppRepositoryRobots(e,t){return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/robots",path:{appId:e},query:{name:t}})}getAppRepositoryAvatars(e,t){return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/avatars",path:{appId:e},query:{name:t}})}getAppRepositoryBackgrounds(e,t){return this.httpRequest.request({method:"GET",url:"/api/app/{appId}/repository/backgrounds",path:{appId:e},query:{name:t}})}readApp(e){return this.httpRequest.request({method:"GET",url:"/api/app/{appId}",path:{appId:e}})}removeApp(e){return this.httpRequest.request({method:"DELETE",url:"/api/app/{appId}",path:{appId:e}})}importApps(e,t){return this.httpRequest.request({method:"POST",url:"/api/app/admin/import",query:{skipClients:e},body:t,mediaType:"application/json"})}exportApps(e){return this.httpRequest.request({method:"POST",url:"/api/app/admin/export",body:e,mediaType:"application/json"})}removeApps(e){return this.httpRequest.request({method:"POST",url:"/api/app/admin/remove",body:e,mediaType:"application/json"})}createClient(e,t){return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/client",path:{appId:e},body:t,mediaType:"application/json"})}readClient(e,t){return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}",path:{appId:e,clientId:t}})}removeClient(e,t){return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/client/{clientId}",path:{clientId:e,appId:t}})}listTopics(e,t){return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/client/{clientId}/topics",path:{appId:e,clientId:t}})}saveAppModule(e,t){return this.httpRequest.request({method:"POST",url:"/api/platform/app/{appId}/module",path:{appId:e},body:t,mediaType:"application/json"})}getAppModule(e,t){return this.httpRequest.request({method:"GET",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:e,moduleId:t}})}removeAppModule(e,t){return this.httpRequest.request({method:"DELETE",url:"/api/platform/app/{appId}/module/{moduleId}",path:{appId:e,moduleId:t}})}savePlatformModule(e){return this.httpRequest.request({method:"POST",url:"/api/platform/module",body:e,mediaType:"application/json"})}refreshPlatformModule(e){return this.httpRequest.request({method:"HEAD",url:"/api/platform/module/{moduleId}",path:{moduleId:e}})}getPlatformModule(e){return this.httpRequest.request({method:"GET",url:"/api/platform/module/{moduleId}",path:{moduleId:e}})}removePlatformModule(e){return this.httpRequest.request({method:"DELETE",url:"/api/platform/module/{moduleId}",path:{moduleId:e}})}dataLoggerControllerGetLogs(e,t){return this.httpRequest.request({method:"POST",url:"/api/datalogger/get/{appId}",path:{appId:e},body:t,mediaType:"application/json"})}};var M=class{constructor(e){this.httpRequest=e}roboticsAgentControllerMoveToArea(e,t){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/move/{appId}/{room}",path:{appId:e,room:t}})}roboticsAgentControllerStatusDescription(e,t){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status/{appId}/{robotId}",path:{appId:e,robotId:t}})}roboticsAgentControllerMove(e){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/relocate",body:e,mediaType:"application/json"})}roboticsAgentControllerInitialPose(e){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/initialpose",body:e,mediaType:"application/json"})}roboticsAgentControllerActuate(e){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/actuate",body:e,mediaType:"application/json"})}roboticsAgentControllerStatus(e){return this.httpRequest.request({method:"POST",url:"/api/robotics/agent/status",body:e,mediaType:"application/json"})}navigationControllerSave(){return this.httpRequest.request({method:"POST",url:"/api/robotics/navigation/{appId}"})}navigationControllerRemove(e){return this.httpRequest.request({method:"DELETE",url:"/api/robotics/navigation/{appId}/spaceId",path:{spaceId:e}})}navigationControllerGetById(e){return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/{spaceId}",path:{spaceId:e}})}navigationControllerGetStatus(e,t){return this.httpRequest.request({method:"GET",url:"/api/robotics/navigation/{appId}/status/{robotId}",path:{appId:e,robotId:t}})}};var B=class{constructor(e){this.httpRequest=e}readSession(e){return this.httpRequest.request({method:"GET",url:"/api/session/{sessionId}",path:{sessionId:e}})}deleteSession(e){return this.httpRequest.request({method:"DELETE",url:"/api/session/{sessionId}",path:{sessionId:e}})}createSession(e){return this.httpRequest.request({method:"POST",url:"/api/session",body:e,mediaType:"application/json"})}updateSession(e){return this.httpRequest.request({method:"PUT",url:"/api/session",body:e,mediaType:"application/json"})}agentUpdate(e){return this.httpRequest.request({method:"POST",url:"/api/session/agent",body:e,mediaType:"application/json"})}support(e){return this.httpRequest.request({method:"POST",url:"/api/session/support",body:e,mediaType:"application/json",errors:{401:"unauthorized"}})}setRecord(e){return this.httpRequest.request({method:"POST",url:"/api/session/storage",body:e,mediaType:"application/json"})}findRecords(e){return this.httpRequest.request({method:"POST",url:"/api/session/storage/search",body:e,mediaType:"application/json"})}getRecord(e){return this.httpRequest.request({method:"GET",url:"/api/session/storage/{storageId}",path:{storageId:e}})}deleteRecord(e){return this.httpRequest.request({method:"DELETE",url:"/api/session/storage/{storageId}",path:{storageId:e}})}};var w=class{constructor(e){this.httpRequest=e}notifyInteraction(e,t,r){return this.httpRequest.request({method:"PUT",url:"/api/ui/interaction/{appId}/{moduleId}",path:{appId:e,moduleId:t},body:r,mediaType:"application/json",errors:{401:"unauthorized"}})}showContent(e){return this.httpRequest.request({method:"GET",url:"/api/ui/asset/{appId}",body:e,mediaType:"application/json",errors:{401:"unauthorized"}})}uiModelControllerMapBlendShapes(e){return this.httpRequest.request({method:"POST",url:"/api/ui/model/map-blend-shapes",body:e,mediaType:"application/json",errors:{401:"unauthorized"}})}};var L=class{constructor(e){this.httpRequest=e}xrMarkerControllerSearchMarker(e){return this.httpRequest.request({method:"POST",url:"/api/xr/marker/search",body:e,mediaType:"application/json",errors:{401:"unauthorized"}})}xrMarkerControllerSaveMarker(e){return this.httpRequest.request({method:"PUT",url:"/api/xr/marker",body:e,mediaType:"application/json",errors:{401:"Unauthorized"}})}xrMarkerControllerDeleteMarker(e){return this.httpRequest.request({method:"DELETE",url:"/api/xr/marker/{markerId}",path:{":markerId":e},errors:{401:"Unauthorized"}})}xrMarkerControllerGetMarkerQrCode(e){return this.httpRequest.request({method:"GET",url:"/api/xr/marker/{markerId}",path:{":markerId":e},errors:{401:"Unauthorized"}})}xrOcclusionControllerOcclusion(){return this.httpRequest.request({method:"GET",url:"/api/xr/occlusion",errors:{401:"Unauthorized"}})}};var R=class{constructor(e,t=K){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}),this.agent=new k(this.request),this.authentication=new E(this.request),this.detection=new x(this.request),this.dialogue=new U(this.request),this.platform=new O(this.request),this.robotics=new M(this.request),this.session=new B(this.request),this.ui=new w(this.request),this.xr=new L(this.request)}};var io=(o=1e3)=>new Promise(e=>setTimeout(()=>e(),o)),Se="http://localhost:8080",pe=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&&re(e.logger),this.logger=new P("SermasApiClient");let t=e.baseURL||Se;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 R({BASE:this.apiUrl,TOKEN:async()=>this.config.access_token||""}),this.broker=new F({url:this.mqttUrl,username:this.config.access_token||void 0,password:"api-client",params:this.params}),this.events=new T(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=Te(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({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 R({BASE:this.apiUrl});this.config.appId=r||this.config.appId;let i=await s.platform.getClientAccessToken({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 R({BASE:this.apiUrl});this.config.appId=r||this.config.appId;let i=await s.authentication.login({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{pe as SermasApiClient,io as sleep};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|