@ctchealth/plato-sdk 0.0.9 → 0.0.11
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/README.md +208 -17
- package/package.json +4 -3
- package/src/index.d.ts +14 -0
- package/src/index.js +18 -0
- package/src/index.js.map +1 -0
- package/src/lib/plato-intefaces.d.ts +269 -0
- package/src/lib/plato-intefaces.js +130 -0
- package/src/lib/plato-intefaces.js.map +1 -0
- package/src/lib/plato-sdk.d.ts +103 -0
- package/src/lib/plato-sdk.js +269 -0
- package/src/lib/plato-sdk.js.map +1 -0
- package/eslint.config.cjs +0 -121
- package/jest.config.ts +0 -10
- package/project.json +0 -24
- package/src/index.ts +0 -1
- package/src/lib/plato-intefaces.ts +0 -232
- package/src/lib/plato-sdk.ts +0 -265
- package/tsconfig.json +0 -22
- package/tsconfig.lib.json +0 -11
- package/tsconfig.spec.json +0 -10
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RecommendationPriority = exports.CreationPhase = exports.SimulationRecordingsDto = exports.RecordingStatus = exports.SortOrder = exports.SimulationRecordingsQueryDto = exports.CreateSimulationDto = exports.ProductConfig = exports.CharacterCreateDto = exports.ContextDto = exports.ProfessionalProfileDto = exports.PersonalityAndBehaviourDto = exports.AssistantVoiceGender = exports.SegmentType = exports.PracticeType = exports.YearOfExperience = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (c) 2025 ctcHealth. All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* This file is part of the ctcHealth Plato Platform, a proprietary software system developed by ctcHealth.
|
|
8
|
+
*
|
|
9
|
+
* This source code and all related materials are confidential and proprietary to ctcHealth.
|
|
10
|
+
* Unauthorized access, use, copying, modification, distribution, or disclosure is strictly prohibited
|
|
11
|
+
* and may result in disciplinary action and civil and/or criminal penalties.
|
|
12
|
+
*
|
|
13
|
+
* This software is intended solely for authorized use within ctcHealth and its designated partners.
|
|
14
|
+
*
|
|
15
|
+
* For internal use only.
|
|
16
|
+
*/
|
|
17
|
+
var YearOfExperience;
|
|
18
|
+
(function (YearOfExperience) {
|
|
19
|
+
YearOfExperience["1-5"] = "1-5 years";
|
|
20
|
+
YearOfExperience["6-10"] = "6-10 years";
|
|
21
|
+
YearOfExperience["11-20"] = "16-20 years";
|
|
22
|
+
YearOfExperience["20+"] = "20+ years";
|
|
23
|
+
})(YearOfExperience || (exports.YearOfExperience = YearOfExperience = {}));
|
|
24
|
+
var PracticeType;
|
|
25
|
+
(function (PracticeType) {
|
|
26
|
+
PracticeType["Private"] = "Private Practice";
|
|
27
|
+
PracticeType["Hospital"] = "Hospital";
|
|
28
|
+
PracticeType["AcademicMedicalCenter"] = "Academic Medical Center";
|
|
29
|
+
PracticeType["Clinic"] = "Clinic";
|
|
30
|
+
})(PracticeType || (exports.PracticeType = PracticeType = {}));
|
|
31
|
+
var SegmentType;
|
|
32
|
+
(function (SegmentType) {
|
|
33
|
+
SegmentType["Traditionalist"] = "The Traditionalist";
|
|
34
|
+
SegmentType["Innovator"] = "The Innovator";
|
|
35
|
+
SegmentType["PatientOrientedPhysician"] = "The Patient-Oriented Physician";
|
|
36
|
+
SegmentType["FinanciallyDrivenPrescriber"] = "The Financially-Driven Prescriber";
|
|
37
|
+
SegmentType["EvidencePurist"] = "The Evidence-Purist";
|
|
38
|
+
SegmentType["CostConsciousPrescriber"] = "The Cost-Conscious Prescriber";
|
|
39
|
+
})(SegmentType || (exports.SegmentType = SegmentType = {}));
|
|
40
|
+
var AssistantVoiceGender;
|
|
41
|
+
(function (AssistantVoiceGender) {
|
|
42
|
+
AssistantVoiceGender["Male"] = "Male";
|
|
43
|
+
AssistantVoiceGender["Female"] = "Female";
|
|
44
|
+
})(AssistantVoiceGender || (exports.AssistantVoiceGender = AssistantVoiceGender = {}));
|
|
45
|
+
class PersonalityAndBehaviourDto {
|
|
46
|
+
riskTolerance;
|
|
47
|
+
researchOrientation;
|
|
48
|
+
recognitionNeed;
|
|
49
|
+
brandLoyalty;
|
|
50
|
+
patientEmpathy;
|
|
51
|
+
}
|
|
52
|
+
exports.PersonalityAndBehaviourDto = PersonalityAndBehaviourDto;
|
|
53
|
+
class ProfessionalProfileDto {
|
|
54
|
+
practiceSettings;
|
|
55
|
+
yearOfExperience;
|
|
56
|
+
specialityAndDepartment;
|
|
57
|
+
location;
|
|
58
|
+
}
|
|
59
|
+
exports.ProfessionalProfileDto = ProfessionalProfileDto;
|
|
60
|
+
class ContextDto {
|
|
61
|
+
subSpecialityOrTherapyFocus;
|
|
62
|
+
typicalPatientMix;
|
|
63
|
+
keyClinicalDrivers;
|
|
64
|
+
}
|
|
65
|
+
exports.ContextDto = ContextDto;
|
|
66
|
+
class CharacterCreateDto {
|
|
67
|
+
name;
|
|
68
|
+
professionalProfile;
|
|
69
|
+
segment;
|
|
70
|
+
personalityAndBehaviour;
|
|
71
|
+
context;
|
|
72
|
+
assistantGender;
|
|
73
|
+
}
|
|
74
|
+
exports.CharacterCreateDto = CharacterCreateDto;
|
|
75
|
+
class ProductConfig {
|
|
76
|
+
name;
|
|
77
|
+
description;
|
|
78
|
+
}
|
|
79
|
+
exports.ProductConfig = ProductConfig;
|
|
80
|
+
class CreateSimulationDto {
|
|
81
|
+
persona;
|
|
82
|
+
product;
|
|
83
|
+
presentation;
|
|
84
|
+
scenario;
|
|
85
|
+
objectives;
|
|
86
|
+
anticipatedObjections;
|
|
87
|
+
}
|
|
88
|
+
exports.CreateSimulationDto = CreateSimulationDto;
|
|
89
|
+
class SimulationRecordingsQueryDto {
|
|
90
|
+
limit;
|
|
91
|
+
page;
|
|
92
|
+
sort;
|
|
93
|
+
}
|
|
94
|
+
exports.SimulationRecordingsQueryDto = SimulationRecordingsQueryDto;
|
|
95
|
+
var SortOrder;
|
|
96
|
+
(function (SortOrder) {
|
|
97
|
+
SortOrder["ASC"] = "asc";
|
|
98
|
+
SortOrder["DESC"] = "desc";
|
|
99
|
+
})(SortOrder || (exports.SortOrder = SortOrder = {}));
|
|
100
|
+
var RecordingStatus;
|
|
101
|
+
(function (RecordingStatus) {
|
|
102
|
+
RecordingStatus["STARTED"] = "STARTED";
|
|
103
|
+
RecordingStatus["PROCESSING"] = "PROCESSING";
|
|
104
|
+
RecordingStatus["FINISHED"] = "FINISHED";
|
|
105
|
+
RecordingStatus["FAILED"] = "FAILED";
|
|
106
|
+
})(RecordingStatus || (exports.RecordingStatus = RecordingStatus = {}));
|
|
107
|
+
class SimulationRecordingsDto {
|
|
108
|
+
_id;
|
|
109
|
+
createdAt;
|
|
110
|
+
recordingStatus;
|
|
111
|
+
}
|
|
112
|
+
exports.SimulationRecordingsDto = SimulationRecordingsDto;
|
|
113
|
+
var CreationPhase;
|
|
114
|
+
(function (CreationPhase) {
|
|
115
|
+
CreationPhase["STARTING"] = "STARTING";
|
|
116
|
+
CreationPhase["CORE"] = "CORE";
|
|
117
|
+
CreationPhase["BOUNDARIES"] = "BOUNDARIES";
|
|
118
|
+
CreationPhase["SPEECH_AND_THOUGHT"] = "SPEECH_AND_THOUGHT";
|
|
119
|
+
CreationPhase["CONVERSATION_EVOLUTION"] = "CONVERSATION_EVOLUTION";
|
|
120
|
+
CreationPhase["MEMORY"] = "MEMORY";
|
|
121
|
+
CreationPhase["FINISHED"] = "FINISHED";
|
|
122
|
+
CreationPhase["ERROR"] = "ERROR";
|
|
123
|
+
})(CreationPhase || (exports.CreationPhase = CreationPhase = {}));
|
|
124
|
+
var RecommendationPriority;
|
|
125
|
+
(function (RecommendationPriority) {
|
|
126
|
+
RecommendationPriority["HIGH"] = "high";
|
|
127
|
+
RecommendationPriority["MEDIUM"] = "medium";
|
|
128
|
+
RecommendationPriority["LOW"] = "low";
|
|
129
|
+
})(RecommendationPriority || (exports.RecommendationPriority = RecommendationPriority = {}));
|
|
130
|
+
//# sourceMappingURL=plato-intefaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plato-intefa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;IACrB,eAAe,CAAwB;CACxC;AAPD,gDAOC;AAED,MAAa,aAAa;IACxB,IAAI,CAAU;IACd,WAAW,CAAU;CACtB;AAHD,sCAGC;AAED,MAAa,mBAAmB;IAC9B,OAAO,CAAsB;IAC7B,OAAO,CAAiB;IACxB,YAAY,CAAU;IACtB,QAAQ,CAAU;IAClB,UAAU,CAAU;IACpB,qBAAqB,CAAU;CAChC;AAPD,kDAOC;AAID,MAAa,4BAA4B;IACvC,KAAK,CAAmB;IACxB,IAAI,CAAU;IACd,IAAI,CAAa;CAClB;AAJD,oEAIC;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAED,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,4CAAyB,CAAA;IACzB,wCAAqB,CAAA;IACrB,oCAAiB,CAAA;AACnB,CAAC,EALW,eAAe,+BAAf,eAAe,QAK1B;AAED,MAAa,uBAAuB;IAClC,GAAG,CAAU;IACb,SAAS,CAAQ;IACjB,eAAe,CAAmB;CACnC;AAJD,0DAIC;AAiHD,IAAY,aASX;AATD,WAAY,aAAa;IACvB,sCAAqB,CAAA;IACrB,8BAAa,CAAA;IACb,0CAAyB,CAAA;IACzB,0DAAyC,CAAA;IACzC,kEAAiD,CAAA;IACjD,kCAAiB,CAAA;IACjB,sCAAqB,CAAA;IACrB,gCAAe,CAAA;AACjB,CAAC,EATW,aAAa,6BAAb,aAAa,QASxB;AAiCD,IAAY,sBAIX;AAJD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,2CAAiB,CAAA;IACjB,qCAAW,CAAA;AACb,CAAC,EAJW,sBAAsB,sCAAtB,sBAAsB,QAIjC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { CallDTO, CreateSimulationDto, CreationPhase, SimulationRecordingsDto, SimulationRecordingsQueryDto, UploadPdfSlidesResponseDto, SimulationDetailsDto, RecommendationsResponseDto } from './plato-intefaces';
|
|
2
|
+
export interface ApiClientConfig {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
token?: string;
|
|
5
|
+
user?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ToolCall {
|
|
8
|
+
function: {
|
|
9
|
+
name: string;
|
|
10
|
+
arguments: {
|
|
11
|
+
slideNumber?: number;
|
|
12
|
+
progressObjectiveNumber?: number;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
id: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Event map for call events, providing strict typing for each event's payload.
|
|
20
|
+
* There are no inputs for the events and all of them return void.
|
|
21
|
+
*/
|
|
22
|
+
export interface CallEventMap {
|
|
23
|
+
'call-start': undefined;
|
|
24
|
+
'call-end': undefined;
|
|
25
|
+
'speech-start': undefined;
|
|
26
|
+
'speech-end': undefined;
|
|
27
|
+
error: Error;
|
|
28
|
+
message: {
|
|
29
|
+
type: string;
|
|
30
|
+
role: string;
|
|
31
|
+
transcript?: string;
|
|
32
|
+
transcriptType: 'final' | 'partial';
|
|
33
|
+
toolCallList?: ToolCall[];
|
|
34
|
+
toolCalls?: ToolCall[];
|
|
35
|
+
[key: string]: unknown;
|
|
36
|
+
};
|
|
37
|
+
'volume-level': number;
|
|
38
|
+
}
|
|
39
|
+
export type CallEventNames = keyof CallEventMap;
|
|
40
|
+
export type CallEventListener<K extends CallEventNames> = (payload: CallEventMap[K]) => void;
|
|
41
|
+
export declare class PlatoApiClient {
|
|
42
|
+
private config;
|
|
43
|
+
private http;
|
|
44
|
+
private eventListeners;
|
|
45
|
+
private callControllerInstance?;
|
|
46
|
+
private eventsAttached;
|
|
47
|
+
eventNames: CallEventNames[];
|
|
48
|
+
constructor(config: ApiClientConfig);
|
|
49
|
+
/**
|
|
50
|
+
* Register a listener for a call event with strict typing.
|
|
51
|
+
* @param event Event name
|
|
52
|
+
* @param listener Listener function
|
|
53
|
+
*/
|
|
54
|
+
private on;
|
|
55
|
+
/**
|
|
56
|
+
* Remove a listener for a call event with strict typing.
|
|
57
|
+
* @param event Event name
|
|
58
|
+
* @param listener Listener function
|
|
59
|
+
*/
|
|
60
|
+
private off;
|
|
61
|
+
/**
|
|
62
|
+
* Internal: Attach event listeners and propagate to registered listeners.
|
|
63
|
+
*/
|
|
64
|
+
private attachEvents;
|
|
65
|
+
createSimulation(createSimulationParams: CreateSimulationDto): Promise<{
|
|
66
|
+
simulationId: string;
|
|
67
|
+
phase: CreationPhase;
|
|
68
|
+
}>;
|
|
69
|
+
checkSimulationStatus(simulationId: string): Promise<{
|
|
70
|
+
phase: CreationPhase;
|
|
71
|
+
}>;
|
|
72
|
+
getUserSimulations(): Promise<Array<{
|
|
73
|
+
simulationId: string;
|
|
74
|
+
phase: CreationPhase;
|
|
75
|
+
}>>;
|
|
76
|
+
getSimulationDetails(simulationId: string): Promise<SimulationDetailsDto>;
|
|
77
|
+
getCallDetails(callId: string): Promise<CallDTO>;
|
|
78
|
+
getCallRecordings(queryParams: SimulationRecordingsQueryDto): Promise<SimulationRecordingsDto[]>;
|
|
79
|
+
getCallRecording(callId: string): Promise<string>;
|
|
80
|
+
/**
|
|
81
|
+
* Remove all listeners for all call events.
|
|
82
|
+
*/
|
|
83
|
+
private removeAllEventListeners;
|
|
84
|
+
startCall(simulationId: string): Promise<{
|
|
85
|
+
stopCall: () => void;
|
|
86
|
+
callId: string;
|
|
87
|
+
/**
|
|
88
|
+
* Subscribe to call events for this call with strict typing.
|
|
89
|
+
* @param event Event name
|
|
90
|
+
* @param listener Listener function
|
|
91
|
+
*/
|
|
92
|
+
on: <K extends CallEventNames>(event: K, listener: CallEventListener<K>) => void;
|
|
93
|
+
/**
|
|
94
|
+
* Unsubscribe from call events for this call with strict typing.
|
|
95
|
+
* @param event Event name
|
|
96
|
+
* @param listener Listener function
|
|
97
|
+
*/
|
|
98
|
+
off: <K extends CallEventNames>(event: K, listener: CallEventListener<K>) => void;
|
|
99
|
+
}>;
|
|
100
|
+
private createCall;
|
|
101
|
+
uploadPdfSlides(file: File | Blob): Promise<UploadPdfSlidesResponseDto>;
|
|
102
|
+
getRecommendations(): Promise<RecommendationsResponseDto>;
|
|
103
|
+
}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlatoApiClient = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/**
|
|
6
|
+
* Copyright (c) 2025 ctcHealth. All rights reserved.
|
|
7
|
+
*
|
|
8
|
+
* This file is part of the ctcHealth Plato Platform, a proprietary software system developed by ctcHealth.
|
|
9
|
+
*
|
|
10
|
+
* This source code and all related materials are confidential and proprietary to ctcHealth.
|
|
11
|
+
* Unauthorized access, use, copying, modification, distribution, or disclosure is strictly prohibited
|
|
12
|
+
* and may result in disciplinary action and civil and/or criminal penalties.
|
|
13
|
+
*
|
|
14
|
+
* This software is intended solely for authorized use within ctcHealth and its designated partners.
|
|
15
|
+
*
|
|
16
|
+
* For internal use only.
|
|
17
|
+
*/
|
|
18
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
19
|
+
const web_1 = tslib_1.__importDefault(require("@vapi-ai/web"));
|
|
20
|
+
class PlatoApiClient {
|
|
21
|
+
config;
|
|
22
|
+
http;
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
24
|
+
eventListeners = {};
|
|
25
|
+
callControllerInstance;
|
|
26
|
+
eventsAttached = false;
|
|
27
|
+
eventNames = [
|
|
28
|
+
'call-start',
|
|
29
|
+
'call-end',
|
|
30
|
+
'speech-start',
|
|
31
|
+
'speech-end',
|
|
32
|
+
'error',
|
|
33
|
+
'message',
|
|
34
|
+
'volume-level',
|
|
35
|
+
];
|
|
36
|
+
constructor(config) {
|
|
37
|
+
this.config = config;
|
|
38
|
+
if (!config.baseUrl) {
|
|
39
|
+
throw new Error('baseUrl is required');
|
|
40
|
+
}
|
|
41
|
+
if (!config.token) {
|
|
42
|
+
throw new Error('token is required');
|
|
43
|
+
}
|
|
44
|
+
if (!config.user) {
|
|
45
|
+
throw new Error('user is required');
|
|
46
|
+
}
|
|
47
|
+
if (config.baseUrl.endsWith('/')) {
|
|
48
|
+
config.baseUrl = config.baseUrl.slice(0, -1);
|
|
49
|
+
}
|
|
50
|
+
this.http = axios_1.default.create({
|
|
51
|
+
baseURL: config.baseUrl,
|
|
52
|
+
headers: {
|
|
53
|
+
'x-api-key': config.token,
|
|
54
|
+
'x-api-key-user': config.user,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Register a listener for a call event with strict typing.
|
|
60
|
+
* @param event Event name
|
|
61
|
+
* @param listener Listener function
|
|
62
|
+
*/
|
|
63
|
+
on(event, listener) {
|
|
64
|
+
if (!this.eventListeners[event]) {
|
|
65
|
+
this.eventListeners[event] = [];
|
|
66
|
+
}
|
|
67
|
+
const listeners = this.eventListeners[event];
|
|
68
|
+
if (listeners) {
|
|
69
|
+
listeners.push(listener);
|
|
70
|
+
}
|
|
71
|
+
if (this.callControllerInstance && !this.eventsAttached) {
|
|
72
|
+
this.attachEvents();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Remove a listener for a call event with strict typing.
|
|
77
|
+
* @param event Event name
|
|
78
|
+
* @param listener Listener function
|
|
79
|
+
*/
|
|
80
|
+
off(event, listener) {
|
|
81
|
+
const listeners = this.eventListeners[event];
|
|
82
|
+
if (!listeners)
|
|
83
|
+
return;
|
|
84
|
+
this.eventListeners[event] = listeners.filter(l => l !== listener);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Internal: Attach event listeners and propagate to registered listeners.
|
|
88
|
+
*/
|
|
89
|
+
attachEvents() {
|
|
90
|
+
if (this.eventsAttached || !this.callControllerInstance)
|
|
91
|
+
return;
|
|
92
|
+
this.eventsAttached = true;
|
|
93
|
+
const vapi = this.callControllerInstance;
|
|
94
|
+
this.eventNames.forEach(event => {
|
|
95
|
+
vapi.on(event, (payload) => {
|
|
96
|
+
(this.eventListeners[event] || []).forEach(listener => listener(payload));
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
async createSimulation(createSimulationParams) {
|
|
101
|
+
try {
|
|
102
|
+
const res = await this.http.post('/api/v1/simulation', {
|
|
103
|
+
...createSimulationParams,
|
|
104
|
+
});
|
|
105
|
+
return {
|
|
106
|
+
simulationId: res.data.simulationId,
|
|
107
|
+
phase: res.data.phase,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
catch (e) {
|
|
111
|
+
if (axios_1.default.isAxiosError(e)) {
|
|
112
|
+
console.error('Error creating simulation:', e.response?.data.message);
|
|
113
|
+
}
|
|
114
|
+
throw e;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async checkSimulationStatus(simulationId) {
|
|
118
|
+
const res = await this.http.get(`/api/v1/simulation/status/${simulationId}`);
|
|
119
|
+
return res.data;
|
|
120
|
+
}
|
|
121
|
+
async getUserSimulations() {
|
|
122
|
+
try {
|
|
123
|
+
const res = await this.http.get('/api/v1/simulation/user/simulations');
|
|
124
|
+
return res.data;
|
|
125
|
+
}
|
|
126
|
+
catch (e) {
|
|
127
|
+
if (axios_1.default.isAxiosError(e)) {
|
|
128
|
+
console.error('Error getting user simulations:', e.response?.data.message);
|
|
129
|
+
}
|
|
130
|
+
throw e;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
async getSimulationDetails(simulationId) {
|
|
134
|
+
try {
|
|
135
|
+
const res = await this.http.get(`/api/v1/simulation/details/${simulationId}`);
|
|
136
|
+
return res.data;
|
|
137
|
+
}
|
|
138
|
+
catch (e) {
|
|
139
|
+
if (axios_1.default.isAxiosError(e)) {
|
|
140
|
+
console.error('Error getting simulation details:', e.response?.data.message);
|
|
141
|
+
}
|
|
142
|
+
throw e;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
async getCallDetails(callId) {
|
|
146
|
+
try {
|
|
147
|
+
const res = await this.http.get(`/api/v1/simulation/call/${callId}`);
|
|
148
|
+
return res.data;
|
|
149
|
+
}
|
|
150
|
+
catch (e) {
|
|
151
|
+
if (axios_1.default.isAxiosError(e)) {
|
|
152
|
+
console.error('Error getting call details:', e.response?.data.message);
|
|
153
|
+
}
|
|
154
|
+
throw e;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
async getCallRecordings(queryParams) {
|
|
158
|
+
try {
|
|
159
|
+
const res = await this.http.get(`/api/v1/simulation/call/recordings`, {
|
|
160
|
+
params: queryParams,
|
|
161
|
+
});
|
|
162
|
+
return res.data;
|
|
163
|
+
}
|
|
164
|
+
catch (e) {
|
|
165
|
+
if (axios_1.default.isAxiosError(e)) {
|
|
166
|
+
console.error('Error getting call recordings:', e.response?.data.message);
|
|
167
|
+
}
|
|
168
|
+
throw e;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async getCallRecording(callId) {
|
|
172
|
+
try {
|
|
173
|
+
const res = await this.http.get(`/api/v1/simulation/call/recordings/${callId}`);
|
|
174
|
+
return res.data;
|
|
175
|
+
}
|
|
176
|
+
catch (e) {
|
|
177
|
+
if (axios_1.default.isAxiosError(e)) {
|
|
178
|
+
console.error('Error getting call recording:', e.response?.data.message);
|
|
179
|
+
}
|
|
180
|
+
throw e;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Remove all listeners for all call events.
|
|
185
|
+
*/
|
|
186
|
+
removeAllEventListeners() {
|
|
187
|
+
if (!this.callControllerInstance)
|
|
188
|
+
return;
|
|
189
|
+
this.eventNames.forEach(event => {
|
|
190
|
+
(this.eventListeners[event] || []).forEach(listener => {
|
|
191
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
192
|
+
// @ts-expect-error
|
|
193
|
+
this.callControllerInstance?.off(event, listener);
|
|
194
|
+
});
|
|
195
|
+
this.eventListeners[event] = [];
|
|
196
|
+
});
|
|
197
|
+
this.eventsAttached = false;
|
|
198
|
+
}
|
|
199
|
+
async startCall(simulationId) {
|
|
200
|
+
this.callControllerInstance = new web_1.default('f07d17ec-d4e6-487d-a0b9-0539c01aecbb', 'https://db41aykk1gw9e.cloudfront.net' // base url
|
|
201
|
+
);
|
|
202
|
+
if (!this.eventsAttached) {
|
|
203
|
+
this.attachEvents();
|
|
204
|
+
}
|
|
205
|
+
const { data } = await this.http.get(`/api/v1/simulation/${simulationId}`);
|
|
206
|
+
const assistantId = data;
|
|
207
|
+
const call = await this.callControllerInstance.start(assistantId);
|
|
208
|
+
if (!call || !call.assistantId) {
|
|
209
|
+
throw new Error('Cannot start a call, please try again later');
|
|
210
|
+
}
|
|
211
|
+
try {
|
|
212
|
+
const apiCall = await this.createCall({
|
|
213
|
+
callId: call.id,
|
|
214
|
+
assistantId: call.assistantId,
|
|
215
|
+
});
|
|
216
|
+
// Return stopCall, callId, and event subscription methods with strict typing
|
|
217
|
+
return {
|
|
218
|
+
stopCall: () => {
|
|
219
|
+
this.callControllerInstance?.stop();
|
|
220
|
+
this.removeAllEventListeners();
|
|
221
|
+
},
|
|
222
|
+
callId: apiCall._id,
|
|
223
|
+
/**
|
|
224
|
+
* Subscribe to call events for this call with strict typing.
|
|
225
|
+
* @param event Event name
|
|
226
|
+
* @param listener Listener function
|
|
227
|
+
*/
|
|
228
|
+
on: (event, listener) => this.on(event, listener),
|
|
229
|
+
/**
|
|
230
|
+
* Unsubscribe from call events for this call with strict typing.
|
|
231
|
+
* @param event Event name
|
|
232
|
+
* @param listener Listener function
|
|
233
|
+
*/
|
|
234
|
+
off: (event, listener) => this.off(event, listener),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
catch (e) {
|
|
238
|
+
this.callControllerInstance?.stop();
|
|
239
|
+
this.removeAllEventListeners();
|
|
240
|
+
throw e;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
async createCall(payload) {
|
|
244
|
+
const response = await this.http.post('/api/v1/simulation/call', {
|
|
245
|
+
...payload,
|
|
246
|
+
});
|
|
247
|
+
return response.data;
|
|
248
|
+
}
|
|
249
|
+
async uploadPdfSlides(file) {
|
|
250
|
+
const formData = new FormData();
|
|
251
|
+
formData.append('file', file);
|
|
252
|
+
const response = await this.http.post('/api/v1/pdfSlides/upload', formData);
|
|
253
|
+
return response.data;
|
|
254
|
+
}
|
|
255
|
+
async getRecommendations() {
|
|
256
|
+
try {
|
|
257
|
+
const res = await this.http.get('/api/v1/recommendations');
|
|
258
|
+
return res.data;
|
|
259
|
+
}
|
|
260
|
+
catch (e) {
|
|
261
|
+
if (axios_1.default.isAxiosError(e)) {
|
|
262
|
+
console.error('Error getting recommendations:', e.response?.data.message);
|
|
263
|
+
}
|
|
264
|
+
throw e;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
exports.PlatoApiClient = PlatoApiClient;
|
|
269
|
+
//# sourceMappingURL=plato-sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plato-sdk.js","sourceRoot":"","sources":["../../../../../libs/plato-sdk/src/lib/plato-sdk.ts"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;GAYG;AACH,0DAA6C;AAY7C,+DAAgC;AA+ChC,MAAa,cAAc;IAgBL;IAfZ,IAAI,CAAgB;IAC5B,sEAAsE;IAC9D,cAAc,GAAgD,EAAE,CAAC;IACjE,sBAAsB,CAAQ;IAC9B,cAAc,GAAG,KAAK,CAAC;IAC/B,UAAU,GAAqB;QAC7B,YAAY;QACZ,UAAU;QACV,cAAc;QACd,YAAY;QACZ,OAAO;QACP,SAAS;QACT,cAAc;KACf,CAAC;IAEF,YAAoB,MAAuB;QAAvB,WAAM,GAAN,MAAM,CAAiB;QACzC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,I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IAAI,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAA6B,yBAAyB,CAAC,CAAC;YACvF,OAAO,GAAG,CAAC,IAAI,CAAC;QAClB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,eAAK,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC1B,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YAC5E,CAAC;YACD,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;CACF;AAnRD,wCAmRC"}
|
package/eslint.config.cjs
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
const { defineConfig, globalIgnores } = require('eslint/config');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const typescriptEslintEslintPlugin = require('@typescript-eslint/eslint-plugin');
|
|
5
|
-
const globals = require('globals');
|
|
6
|
-
const tsParser = require('@typescript-eslint/parser');
|
|
7
|
-
const jest = require('eslint-plugin-jest');
|
|
8
|
-
const js = require('@eslint/js');
|
|
9
|
-
const headers = require('eslint-plugin-headers');
|
|
10
|
-
const { FlatCompat } = require('@eslint/eslintrc');
|
|
11
|
-
const baseRules = require('../../eslint-config-base.cjs');
|
|
12
|
-
|
|
13
|
-
const compat = new FlatCompat({
|
|
14
|
-
baseDirectory: __dirname,
|
|
15
|
-
recommendedConfig: js.configs.recommended,
|
|
16
|
-
allConfig: js.configs.all,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
module.exports = defineConfig([
|
|
20
|
-
globalIgnores([
|
|
21
|
-
'**/.eslintrc.js',
|
|
22
|
-
'src/index.d.ts',
|
|
23
|
-
'scripts/db-migrations/archived/**/*',
|
|
24
|
-
'**/*.spec.ts',
|
|
25
|
-
'**/*.config.js',
|
|
26
|
-
'**/*.config.cjs',
|
|
27
|
-
'**/jest.config.ts',
|
|
28
|
-
]),
|
|
29
|
-
{
|
|
30
|
-
files: ['**/*.ts'],
|
|
31
|
-
plugins: {
|
|
32
|
-
headers,
|
|
33
|
-
},
|
|
34
|
-
rules: {
|
|
35
|
-
'headers/header-format': [
|
|
36
|
-
'error',
|
|
37
|
-
{
|
|
38
|
-
source: 'string',
|
|
39
|
-
content: `Copyright (c) 2025 ctcHealth. All rights reserved.
|
|
40
|
-
|
|
41
|
-
This file is part of the ctcHealth Plato Platform, a proprietary software system developed by ctcHealth.
|
|
42
|
-
|
|
43
|
-
This source code and all related materials are confidential and proprietary to ctcHealth.
|
|
44
|
-
Unauthorized access, use, copying, modification, distribution, or disclosure is strictly prohibited
|
|
45
|
-
and may result in disciplinary action and civil and/or criminal penalties.
|
|
46
|
-
|
|
47
|
-
This software is intended solely for authorized use within ctcHealth and its designated partners.
|
|
48
|
-
|
|
49
|
-
For internal use only.`,
|
|
50
|
-
style: 'jsdoc',
|
|
51
|
-
trailingNewlines: 1,
|
|
52
|
-
preservePragmas: false,
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
extends: compat.extends(
|
|
59
|
-
'plugin:@typescript-eslint/recommended',
|
|
60
|
-
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
61
|
-
'plugin:@typescript-eslint/strict'
|
|
62
|
-
),
|
|
63
|
-
|
|
64
|
-
files: ['**/*.ts'],
|
|
65
|
-
ignores: ['**/*.json', '**/*.spec.ts'],
|
|
66
|
-
|
|
67
|
-
plugins: {
|
|
68
|
-
'@typescript-eslint': typescriptEslintEslintPlugin,
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
languageOptions: {
|
|
72
|
-
globals: {
|
|
73
|
-
...globals.node,
|
|
74
|
-
...globals.jest,
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
parser: tsParser,
|
|
78
|
-
ecmaVersion: 10,
|
|
79
|
-
sourceType: 'module',
|
|
80
|
-
|
|
81
|
-
parserOptions: {
|
|
82
|
-
project: path.join(__dirname, 'tsconfig.lib.json'),
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
rules: {
|
|
87
|
-
...baseRules.rules, // shared rules
|
|
88
|
-
// project-specific rules
|
|
89
|
-
'@typescript-eslint/ban-ts-comment': 'warn',
|
|
90
|
-
'@typescript-eslint/interface-name-prefix': 'off',
|
|
91
|
-
'@typescript-eslint/explicit-function-return-type': 'warn',
|
|
92
|
-
'@typescript-eslint/promise-function-async': ['error'],
|
|
93
|
-
'@typescript-eslint/no-floating-promises': 'error',
|
|
94
|
-
'@typescript-eslint/await-thenable': 'error',
|
|
95
|
-
semi: ['error', 'always'],
|
|
96
|
-
'@typescript-eslint/unbound-method': 'error',
|
|
97
|
-
'keyword-spacing': ['error'],
|
|
98
|
-
'@typescript-eslint/restrict-template-expressions': 'error',
|
|
99
|
-
'@typescript-eslint/prefer-regexp-exec': 'warn',
|
|
100
|
-
'@typescript-eslint/require-await': 'warn',
|
|
101
|
-
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
102
|
-
'@typescript-eslint/no-unnecessary-condition': 'warn',
|
|
103
|
-
'@typescript-eslint/prefer-ts-expect-error': 'warn',
|
|
104
|
-
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
|
105
|
-
'space-infix-ops': 'off',
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
files: ['**/*.spec.ts'],
|
|
110
|
-
extends: compat.extends('plugin:jest/recommended'),
|
|
111
|
-
|
|
112
|
-
plugins: {
|
|
113
|
-
jest,
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
rules: {
|
|
117
|
-
'@typescript-eslint/unbound-method': 'off',
|
|
118
|
-
'jest/unbound-method': 'error',
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
]);
|
package/jest.config.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
displayName: 'plato-sdk',
|
|
3
|
-
preset: '../../jest.preset.js',
|
|
4
|
-
testEnvironment: 'node',
|
|
5
|
-
transform: {
|
|
6
|
-
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
|
|
7
|
-
},
|
|
8
|
-
moduleFileExtensions: ['ts', 'js', 'html'],
|
|
9
|
-
coverageDirectory: '../../coverage/libs/plato-sdk',
|
|
10
|
-
};
|
package/project.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "plato-sdk",
|
|
3
|
-
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"sourceRoot": "libs/plato-sdk/src",
|
|
5
|
-
"projectType": "library",
|
|
6
|
-
"tags": [],
|
|
7
|
-
"targets": {
|
|
8
|
-
"build": {
|
|
9
|
-
"executor": "@nx/js:tsc",
|
|
10
|
-
"outputs": ["{options.outputPath}"],
|
|
11
|
-
"options": {
|
|
12
|
-
"outputPath": "dist/libs/plato-sdk",
|
|
13
|
-
"main": "libs/plato-sdk/src/index.ts",
|
|
14
|
-
"tsConfig": "libs/plato-sdk/tsconfig.lib.json",
|
|
15
|
-
"assets": ["libs/plato-sdk/*.md"]
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"nx-release-publish": {
|
|
19
|
-
"options": {
|
|
20
|
-
"packageRoot": "dist/{projectRoot}"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './lib/plato-sdk';
|